em.fdfd_2d package

Submodules

em.fdfd_2d.fdfd_2d module

Referans: A compact 2-D full-wave finite-difference frequency-domain method for general guided wave structures.pdf A Compact 2-D FDFD Method for Modeling Microstrip Structures With Nonuniform Grids and Perfectly Matched Layer.pdf Lecture 12 – Finite-Difference Analysis of Waveguides (CEM Lectures) (Sadece matris boyutunu küçültmekte kullanıldı)

class em.fdfd_2d.fdfd_2d.fdfd_2d(parent=None)

Bases: object

addpml(pmllayers)

Add PML (perfectly matched layers) and return modified grid and permittivity arrays.

Parameters:
  • pmllayers (list of int) – Number of PML layers x1,x2,y1,y2.

  • dx (list of float) – lengths of x-oriented grid cells

  • dy (list of float) – lengths of y-oriented grid cells

  • er (2-d array of float) – Dielectric permittivity array

  • erxx (2-d array of float) – Average dielectric permittivities at x-oriented grid edges

  • eryy (2-d array of float) – Average dielectric permittivities at y-oriented grid edges

  • erzz (2-d array of float) – Average dielectric permittivities at z-oriented grid edges

  • metalnodesx (list of 2-tuples of int) – indices of x-oriented grid edges

  • metalnodesy (list of 2-tuples of int) – indices of y-oriented grid edges

  • metalnodesz (list of 2-tuples of int) – indices of z-oriented grid edges

  • currentloops (list) – Indices of grid edges used to calculate current

  • vlines (list) – Field component and cell indices that are used to calculate voltage

Returns:

None

exn(i, j)

indice of Ex(i,j) in field vector

eyn(i, j)

indice of Ey(i,j) in field vector

fdfd_mesh(xres, yres)

Create FDFD mesh.

Parameters:
  • boxwidth (float) – Width of metal box.

  • boxheight (float) – Height of metal box.

  • xres (float) – Resolution along x-axis.

  • yres (float) – Resolution along y-axis

  • parts (list) – List of parts

Returns:

A tuple containing the following elements:

  1. dx, 1-d array containing the length of grid cells along x

  2. dy, 1-d array containing the length of grid cells along y

  3. er, dielectric permittivity 2-d array

  4. erxx, average dielectric permittivity 2-d array along x

  5. eryy, average dielectric permittivity 2-d array along y

  6. erzz, average dielectric permittivity 2-d array along z

  7. metalnodesx, indices of x-oriented grid edges

  8. metalnodesy, indices of y-oriented grid edges

  9. metalnodesz, indices of z-oriented grid edges

  10. currentloops, indices of grid edges used to calculate current

  11. vlines, Field component and cell indices that are used to calculate voltage

Return type:

tuple

fdfd_solve()

Solves the FDFD problem. To reduce matrix dimensions, instead of classical equation of Ax=Lx, PQx=Lx formulation is used.

hxn(i, j)

indice of Hx(i,j) in field vector

hyn(i, j)

indice of Hy(i,j) in field vector

classmethod microstrip(boxwidth, boxheight, dielheight, metalwidth, metalthickness, epsilon, freq, xres, yres)
classmethod multilayer(boxwidth, boxheight, dielthickness, epsilon, metals, freq, pmllayers, xres, yres)

Multilayer substrate.

Parameters:
  • dielthickness (list) – tabandan başlayarak yukarı dogru sirasiyla dielektriklerin kalinliklarinin listesi

  • epsilon (list) – tabandan başlayarak yukarı dogru sirasiyla dielektriklerin katsayilarinin listesi

  • metals (list) – şu elemanlardan oluşan dizi [metalheight, metalwidth, metalthickness, metaloffset]

  • metalheight (float) – metalin alt yüzeyinin yüksekliği

plot_cloops(ekran)
plot_field(ekran, v, surface=True, comp='Ex')
Parameters:
  • surface (bool) – if True, use contourf, else streamplot

  • comp (str) – “Ex”,”Ey”…

plot_grids(ekran)
plot_parts(ekran, solid=False, shift=(0, 0))
Parameters:
  • ekran – Matplotlib Axes object

  • solid (bool) – if True, use fill=true, else fill=false

plot_pml(ekran, solid=False, shift=(0, 0))
Parameters:
  • ekran – Matplotlib Axes object

  • solid (bool) – if True, use fill=true, else fill=false

plot_vline(ekran)
powerflow(v)
Parameters:
  • comp – “Ex”,”Ey”…

  • surface – if 1, use contourf, else streamplot

  • v – (Ev, Hv)

sigma(i, dx, nlayer)
classmethod stripline(boxwidth, boxheight, metalwidth, metalthickness, epsilon, freq, xres, yres)
classmethod suspended(boxwidth, boxheight, dielthickness, metalheight, metalwidth, metalthickness, epsilon, freq, xres, yres)
sx(i)

sigma.arr : dizi, hucre boyutlari sigma.nlayer : list, bastan ve sondan pml layer sayisi

sy(i)

sigma.arr : dizi, hucre boyutlari sigma.nlayer : list, bastan ve sondan pml layer sayisi

classmethod waveguide(boxwidth, boxheight, dielthickness, epsilon, freq, pmllayers, xres, yres)

Generates rectangular waveguide problem. Multilayer function is not used because of the definition of voltage line wihtout any metal.

Parameters:
  • dielthickness (list) – tabandan başlayarak yukarı dogru sirasiyla dielektriklerin kalinliklarinin listesi

  • epsilon (list) – tabandan başlayarak yukarı dogru sirasiyla dielektriklerin katsayilarinin listesi

  • metalwidth (float) – object

em.fdfd_2d.fdfd_2d.getindice(cc, dizi, pml=0)

Get the 1-based indice of cell in dizi in which point coordinate cc resides. The length of first pml cells of array dizi are ignored. But calculated indice contains these cells.

Parameters:
  • cc (float) – coordinate of point

  • dizi ((list, np.ndarray)) – array of cell dimensions

  • pml (int,optional) – number of pml cells at the beginning of the array. Default is 0.

Returns:

1-based indice of the cell, cc resides in.

Return type:

int

em.fdfd_2d.fdfd_2d.getindiceordered(cc, cumsumarray)

Faster alternative to getindice, but works only with array of node coordinates instead of array of cell lengths. This array can be generated by cumsum function of numpy. The coordinate of starting node (0) is not included in this array.

Parameters:
  • cc (float) – coordinate of point

  • cumsumarray (np.ndarray) – cumulative sum of array of cell dimensions

Returns:

1-based indice of the cell, cc resides in.

Return type:

int

Example

getindiceordered(5.5, np.cumsum(np.ones(10)))=6

em.fdfd_2d.grid3 module

class em.fdfd_2d.grid3.CartesianGrid

Bases: object

SetUnit(s)
customgrid(dmin, dmax, index, rmax, shape, axis, policy)
Parameters:
  • index (int) – subregion numarasi

  • rmax (float) – maximum ratio between neighboring grids

  • shape (int) – 0- fine-coarse 1- coarse-fine 2- fine-coarse-fine 3- uniform

  • policy (int) – 0- minimum number of grids 1- minimum ratio, smoother transition

findsubregions(kritikx, kritiky, kritikz)
get_grids_sub_i(i, axis)
get_nof_sub(eksen)
get_subregion_index_of_point(coor, axis)
getsubregion(i)
getsubregion_p(j, i)
loadfromfile(dosya)
nu_grid(deltax, deltay, deltaz)
nugrid(delta1, delta2, rmax, length, shape, policy=0, cc=0.99)

Nonuniform grid generation.

Parameters:
  • rmax (float) – Maximum ratio between neighboring grids

  • length (float) – total length

  • shape (int) – 0- fine-coarse 1- coarse-fine 2- fine-coarse-fine 3- uniform

  • policy (int) – 0- minimum number of grids 1- minimum ratio, smoother transition

optimizegrids()
reshapegrid(delta, index, rmax, shape, axis, policy)
return_subregion_params(grid, index)
set_number_of_abc_layers(x1, x2, y1, y2, z1, z2)
subregionparams(c, grid)
sumz()
ugrid(delta, length, parite=0)
writetofile(dosya)
em.fdfd_2d.grid3.refinearray(inp)
class em.fdfd_2d.grid3.subregion

Bases: object

Module contents