hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
hpfem::pml::PmlBox< Dim > Class Template Reference

#include <pml.hpp>

Public Types

using Thickness = std::array< Real, kNumSides >
 x-min, x-max, y-min, y-max[, z-min, z-max]
 

Public Member Functions

 PmlBox (const Point< Dim > &lower, const Point< Dim > &upper, const Thickness &thickness, Real k0, Real background_index=1.0, PmlProfile profile={})
 
const Point< Dim > & lower () const noexcept
 
const Point< Dim > & upper () const noexcept
 
const Thickness & thickness () const noexcept
 
const PmlProfile & profile () const noexcept
 
Real sigma_max (std::size_t side) const noexcept
 \( \hat\sigma_{\max} \) of side k (0 for a side without layer).
 
Real k0 () const noexcept
 Vacuum wavenumber the layers were designed for.
 
Real max_resolution (Real cell_size, Real index) const
 
Point< Dim > outer_lower () const
 Outer boundary of the layers: the box enlarged by the thicknesses.
 
Point< Dim > outer_upper () const
 
bool in_layer (const Point< Dim > &x) const
 True if x lies in at least one layer (some \( s_\xi \ne 1 \)).
 
ComplexCoordinates< Dim > stretch (const Point< Dim > &x) const
 Stretch factors \( s_\xi(x) = 1 + i\hat\sigma_\xi \) per axis (1 inside the box).
 
ComplexCoordinates< Dim > stretched_coordinate (const Point< Dim > &x) const
 
assembly::PermittivityTensor< Dim > permittivity (Complex eps_r, const Point< Dim > &x) const
 
assembly::PermittivityTensor< Dim > permittivity (const assembly::PermittivityTensor< Dim > &eps, const Point< Dim > &x) const
 
assembly::InversePermeabilityTensor< Dim > inverse_permeability (Complex mu_r, const Point< Dim > &x) const
 

Static Public Member Functions

static Real recommended_thickness (Real k0, Real background_index, Real cell_size, Real wavelengths=0.5)
 
static Real recommended_thickness (Real k0, Real background_index, Real cell_size, const PmlProfile &profile, int p)
 
static Real resolution_limit (int p) noexcept
 
static PmlBox uniform (const Point< Dim > &lower, const Point< Dim > &upper, Real thickness, Real k0, Real background_index=1.0, PmlProfile profile={})
 The same thickness on all sides.
 

Static Public Attributes

static constexpr std::size_t kNumSides = 2 * static_cast<std::size_t>(Dim)
 

Detailed Description

template<int Dim>
class hpfem::pml::PmlBox< Dim >

PML layers of given thickness on the sides of the interior box [lower, upper]. A side with thickness 0 carries no layer (e.g. a periodic or PEC direction). The layers must be covered by mesh cells; cell facets should coincide with the box faces.

Member Typedef Documentation

◆ Thickness

template<int Dim>
using hpfem::pml::PmlBox< Dim >::Thickness = std::array<Real, kNumSides>

x-min, x-max, y-min, y-max[, z-min, z-max]

Constructor & Destructor Documentation

◆ PmlBox()

template<int Dim>
hpfem::pml::PmlBox< Dim >::PmlBox ( const Point< Dim > &  lower,
const Point< Dim > &  upper,
const Thickness &  thickness,
Real  k0,
Real  background_index = 1.0,
PmlProfile  profile = {} 
)
Parameters
k0vacuum wavenumber [1/m];
background_indexreal part of the refractive index of the medium the layer continues (sets σ_max);
Exceptions
InvalidArgumentfor a degenerate box, negative thickness, k0 ≤ 0 or an unusable profile.

Member Function Documentation

◆ in_layer()

template<int Dim>
bool hpfem::pml::PmlBox< Dim >::in_layer ( const Point< Dim > &  x) const

True if x lies in at least one layer (some \( s_\xi \ne 1 \)).

◆ inverse_permeability()

template<int Dim>
assembly::InversePermeabilityTensor< Dim > hpfem::pml::PmlBox< Dim >::inverse_permeability ( Complex  mu_r,
const Point< Dim > &  x 
) const

Effective inverse permeability acting on curls: \( \mu_r^{-1}\Lambda^2/\det\Lambda \) (3D, diagonal) or the scalar \( 1/(\mu_r s_x s_y) \) (2D, out-of-plane curl).

◆ k0()

template<int Dim>
Real hpfem::pml::PmlBox< Dim >::k0 ( ) const
inlinenoexcept

Vacuum wavenumber the layers were designed for.

◆ lower()

template<int Dim>
const Point< Dim > & hpfem::pml::PmlBox< Dim >::lower ( ) const
inlinenoexcept

◆ max_resolution()

template<int Dim>
Real hpfem::pml::PmlBox< Dim >::max_resolution ( Real  cell_size,
Real  index 
) const

Largest \( |k s| h \) over the layers for cells of size cell_size in a medium of real index index ( \( k = k_0 n \), \( s \) at the far end of each layer): the resolution the stretched field \( e^{iks\xi} \) asks of the mesh, to be kept below resolution_limit(p). A layer meshed with a medium of higher index than the background_index it was designed for (a substrate) is the usual offender.

◆ outer_lower()

template<int Dim>
Point< Dim > hpfem::pml::PmlBox< Dim >::outer_lower ( ) const

Outer boundary of the layers: the box enlarged by the thicknesses.

◆ outer_upper()

template<int Dim>
Point< Dim > hpfem::pml::PmlBox< Dim >::outer_upper ( ) const

◆ permittivity() [1/2]

template<int Dim>
assembly::PermittivityTensor< Dim > hpfem::pml::PmlBox< Dim >::permittivity ( Complex  eps_r,
const Point< Dim > &  x 
) const

Effective permittivity tensor \( \varepsilon_r\det\Lambda\,\Lambda^{-2} \) of an isotropic material (diagonal).

◆ permittivity() [2/2]

template<int Dim>
assembly::PermittivityTensor< Dim > hpfem::pml::PmlBox< Dim >::permittivity ( const assembly::PermittivityTensor< Dim > &  eps,
const Point< Dim > &  x 
) const

Effective permittivity tensor of an anisotropic material, \( ilde arepsilon_{ij} = arepsilon_{ij}\det\Lambda/(s_i s_j) \) (ADR-0015 §2); in 2D eps is the in-plane block and \( s_z = 1 \). Equals the scalar overload for \( arepsilon = arepsilon_r I \).

◆ profile()

template<int Dim>
const PmlProfile & hpfem::pml::PmlBox< Dim >::profile ( ) const
inlinenoexcept

◆ recommended_thickness() [1/2]

template<int Dim>
static Real hpfem::pml::PmlBox< Dim >::recommended_thickness ( Real  k0,
Real  background_index,
Real  cell_size,
const PmlProfile &  profile,
int  p 
)
static

The smallest thickness (whole cells of size cell_size) at which the profile stays resolved for polynomial order p: \( |k s| h \le \) resolution_limit(p) at the far end of the layer, where \( |s| = \sqrt{1 + \hat\sigma_{\max}^2} \) and \( \hat\sigma_{\max} \propto 1 / \text{thickness} \). At least the thickness of the half-wavelength rule.

Exceptions
InvalidArgumentif even an unstretched layer is not resolved ( \( k_0 n h \) above the limit) or for non-positive arguments.

◆ recommended_thickness() [2/2]

template<int Dim>
static Real hpfem::pml::PmlBox< Dim >::recommended_thickness ( Real  k0,
Real  background_index,
Real  cell_size,
Real  wavelengths = 0.5 
)
static

Layer thickness adapted to the wavelength and the mesh: wavelengths local wavelengths \( \lambda_0 / n \), rounded up to a whole number of cells of size cell_size, so the layer boundary falls on cell facets of a structured mesh.

Exceptions
InvalidArgumentfor non-positive arguments.

◆ resolution_limit()

template<int Dim>
static Real hpfem::pml::PmlBox< Dim >::resolution_limit ( int  p)
staticnoexcept

Largest \( |k s| h \) the stretched field may have on cells of order p: 3 for \( p \ge 4 \) (docs/theory/pml.md), \( 0.75\,p \) below.

◆ sigma_max()

template<int Dim>
Real hpfem::pml::PmlBox< Dim >::sigma_max ( std::size_t  side) const
inlinenoexcept

\( \hat\sigma_{\max} \) of side k (0 for a side without layer).

◆ stretch()

template<int Dim>
ComplexCoordinates< Dim > hpfem::pml::PmlBox< Dim >::stretch ( const Point< Dim > &  x) const

Stretch factors \( s_\xi(x) = 1 + i\hat\sigma_\xi \) per axis (1 inside the box).

◆ stretched_coordinate()

template<int Dim>
ComplexCoordinates< Dim > hpfem::pml::PmlBox< Dim >::stretched_coordinate ( const Point< Dim > &  x) const

Stretched coordinates \( \tilde x_\xi = x_\xi + i\int_{\text{box}}^{x_\xi}\hat\sigma \) (closed form for the polynomial profile); an outgoing analytic field evaluated at \( \tilde x \) is the exact solution inside the layer.

◆ thickness()

template<int Dim>
const Thickness & hpfem::pml::PmlBox< Dim >::thickness ( ) const
inlinenoexcept

◆ uniform()

template<int Dim>
static PmlBox hpfem::pml::PmlBox< Dim >::uniform ( const Point< Dim > &  lower,
const Point< Dim > &  upper,
Real  thickness,
Real  k0,
Real  background_index = 1.0,
PmlProfile  profile = {} 
)
static

The same thickness on all sides.

◆ upper()

template<int Dim>
const Point< Dim > & hpfem::pml::PmlBox< Dim >::upper ( ) const
inlinenoexcept

Member Data Documentation

◆ kNumSides

template<int Dim>
constexpr std::size_t hpfem::pml::PmlBox< Dim >::kNumSides = 2 * static_cast<std::size_t>(Dim)
staticconstexpr

The documentation for this class was generated from the following file: