pyoptics.fdtd.boundaries

Boundary conditions: convolutional PML, PEC walls and periodicity.

The convolutional perfectly matched layer (CPML, Roden and Gedney 2000) stretches the coordinate across the absorbing layer with s(d) = kappa(d) + sigma(d)/(alpha(d) - i*omega), graded polynomially from the inner edge (d = 0) to the outer wall (d = 1). Each spatial derivative inside the layer becomes dF/dx/kappa + psi, with the recursive convolution psi <- b*psi + c*dF/dx. The layer is matched for any medium that extends into it, and its outer wall is a PEC.

Classes

PML

Absorbing layer of the given number of cells on both ends of an axis.

Functions

parse

Normalize a boundary spec to one entry (PML, "pec" or "periodic") per axis.

class pyoptics.fdtd.boundaries.PML(cells=12, order=3, reflection=1e-08, kappa_max=1.0, alpha_max=0.0)[source]

Bases: object

Absorbing layer of the given number of cells on both ends of an axis.

Parameters:
cellsint

Thickness in cells.

ordernumber

Polynomial grading order m of sigma and kappa.

reflectionnumber

Theoretical reflection R0 at normal incidence; sets sigma_max = -(m + 1)*ln(R0)/(2*thickness).

kappa_maxnumber

Maximum real coordinate stretch (>= 1); > 1 helps with evanescent and grazing waves.

alpha_maxnumber

Complex frequency shift at the inner edge (in units of 1/time, decreasing linearly to 0 at the wall); absorbs low frequencies less and so avoids late-time drift for long runs.

coefficients(n_cells, spacing, dt, offset)[source]

b, c and 1/kappa for the left and the right layer along an axis of n_cells cells, at nodes shifted by offset cells. Each is an array of length cells; the left layer covers indices 0..cells - 1, the right one n_cells - cells..n_cells - 1.

pyoptics.fdtd.boundaries.parse(boundaries, ndim)[source]

Normalize a boundary spec to one entry (PML, “pec” or “periodic”) per axis. A single entry is used for all axes; “pml” means PML().