Perfectly Matched Layers¶
Perfectly Matched Layers are now implemented in NGSolve via a complex mesh deformation. All preimplemented PMLs are of the form
where \(d(x)\) is some distance function and \(\alpha\) is the scaling parameter.
Creating a PML Transformation¶
A PML transformation is a mesh independent object, which can be created using its
generator function defined in the python module comp.pml
.

class
ngsolve.comp.pml.
PML
¶ Base PML object
can only be created by generator functions. Use PML(x, [y, z]) to evaluate the scaling.

Det_CF
¶ the determinant of the jacobian as coefficient function

JacInv_CF
¶ the inverse of the jacobian as coefficient function

Jac_CF
¶ the jacobian of the PML as coefficient function

PML_CF
¶ the scaling as coefficient function

call_jacobian
(*args) → ngsolve.bla.MatrixC¶ evaluate PML jacobian at point x, [y, z]

dim
¶ dimension

Preimplemented scalings¶
The following scalings are available by default:

ngsolve.comp.pml.
Radial
(origin: object, rad: float = 1, alpha: complex = 1j) → ngsolve.comp.pml.PML¶ radial pml transformation
origin is a list/tuple determining the dimenson

ngsolve.comp.pml.
Cartesian
(mins: object, maxs: object, alpha: complex = 1j) → ngsolve.comp.pml.PML¶ cartesian pml transformation
mins and maxs are tuples/lists determining the dimension

ngsolve.comp.pml.
BrickRadial
(mins: object, maxs: object, origin: object = (0.0, 0.0, 0.0), alpha: complex = 1j) → ngsolve.comp.pml.PML¶ radial pml on a brick
mins, maxs and origin are given as tuples/lists

ngsolve.comp.pml.
HalfSpace
(point: object, normal: object, alpha: complex = 1j) → ngsolve.comp.pml.PML¶ half space pml
scales orthogonal to specified plane in direction of normal point and normal are given as tuples/lists determining the dimension
Creating your own scaling¶
Aside from the preimplemented scalings, one can also create scalings using coefficient functions or combine available PMLs.

ngsolve.comp.pml.
Custom
(trafo: ngsolve.fem.CoefficientFunction, jac: ngsolve.fem.CoefficientFunction) → ngsolve.comp.pml.PML¶ custom pml transformation
trafo and jac are coefficient functions of the scaling and the jacobian

ngsolve.comp.pml.
Compound
(pml1: ngsolve.comp.pml.PML, pml2: ngsolve.comp.pml.PML, dims1: object = <ngsolve.ngstd.DummyArgument>, dims2: object = <ngsolve.ngstd.DummyArgument>) → ngsolve.comp.pml.PML¶ tensor product of two pml transformations
dimensions are optional, given as tuples/lists and start with 1
PML transformations can be added using the +
operator.
Applying the Transformation to a Mesh¶
A PML object pmlobj
can be applied to a mesh m
on domain domain
using
m.SetPML(pmlobj,'domain')
After this is done all (symbolic) integrators will respect the additional complex transformation. Note that right now PMLs are tested on H1 spaces only.
Caution
Evaluating coordinate coefficient functions on complex mapped integration points will result only in evaluation of their real part. Thus, using non constant coefficient functions in the PML domain should be handled with caution.