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

Assembles, constrains and solves a scattering problem and evaluates its fields. More...

#include <scattering.hpp>

Public Member Functions

 Scattering (const fespace::NedelecDofMap< Dim > &dofs, ScatteringSetup< Dim > setup)
 
const fespace::NedelecDofMap< Dim > & dofs () const noexcept
 
const ScatteringSetup< Dim > & setup () const noexcept
 
Real wavenumber () const noexcept
 Vacuum wavenumber k0 [1/m].
 
const materials::Material & material (Index cell) const
 
const materials::Material & background_material (Index cell) const
 
const materials::Material & incidence_material () const
 
assembly::MaxwellForm< Dim > form_of_cell (Index cell) const
 
assembly::DirichletData dirichlet () const
 Dirichlet data of the unknown field on the PEC and incident facets.
 
std::vector< assembly::DirichletData > dirichlet_many (std::span< const IncidentField< Dim > > incidents) const
 
assembly::AssembledSystem assemble_raw () const
 \( A = S - k_0^2 M \) and the load without boundary conditions.
 
assembly::AssembledSystem assemble () const
 
fespace::Constraints constraints () const
 
ScatteringSolution< Dim > solve () const
 
const PortModes< Dim > & port_modes (Index port) const
 Modes of port p of the setup (built in the constructor).
 
std::vector< PortCoefficients > port_coefficients (const ScatteringSolution< Dim > &solution) const
 
void add_port_terms (SparseMatrix &matrix, Vector &rhs) const
 
assembly::ComplexVector< Dim > incident_wave (const Point< Dim > &x) const
 
assembly::ComplexVector< Dim > incident_in_cell (Index cell, const Point< Dim > &x) const
 
assembly::ComplexVector< Dim > total_field (const ScatteringSolution< Dim > &solution, Index cell, const Point< Dim > &xi) const
 
assembly::ComplexVector< Dim > scattered_field (const ScatteringSolution< Dim > &solution, Index cell, const Point< Dim > &xi) const
 
std::optional< assembly::ComplexVector< Dim > > total_field (const ScatteringSolution< Dim > &solution, const mesh::PointLocator< Dim > &locator, const Point< Dim > &x) const
 
std::optional< assembly::ComplexVector< Dim > > scattered_field (const ScatteringSolution< Dim > &solution, const mesh::PointLocator< Dim > &locator, const Point< Dim > &x) const
 
assembly::HcurlErrorNorms error (const ScatteringSolution< Dim > &solution, const IncidentField< Dim > &exact) const
 
assembly::HcurlErrorNorms error (const ScatteringSolution< Dim > &solution, const IncidentField< Dim > &exact, std::span< const Index > cells) const
 The same over a subset of cells (e.g. the interior without the PML).
 
std::vector< Index > interior_cells () const
 Cells whose centroid lies inside the PML box of the setup (all cells without PML).
 
adaptivity::Estimate estimate (const ScatteringSolution< Dim > &solution, const adaptivity::EstimatorOptions &options={}) const
 

Detailed Description

template<int Dim>
class hpfem::physics::Scattering< Dim >

Assembles, constrains and solves a scattering problem and evaluates its fields.

Constructor & Destructor Documentation

◆ Scattering()

template<int Dim>
hpfem::physics::Scattering< Dim >::Scattering ( const fespace::NedelecDofMap< Dim > &  dofs,
ScatteringSetup< Dim >  setup 
)
Exceptions
InvalidArgumentif ω ≤ 0, the scattered-field formulation or incident facets lack an incident field, a current is given with the scattered field, or a cell straddles an interface of the layered background.

Member Function Documentation

◆ add_port_terms()

template<int Dim>
void hpfem::physics::Scattering< Dim >::add_port_terms ( SparseMatrix &  matrix,
Vector &  rhs 
) const

Adds the port terms to an assembled system: the modal boundary operator of every port mode to the matrix (independent of the excitation) and \( 2 a_m q_m \) of the incident amplitudes to the load (ScatteringOperator factorises the matrix once and excites the modes one by one, s_parameters).

◆ assemble()

template<int Dim>
assembly::AssembledSystem hpfem::physics::Scattering< Dim >::assemble ( ) const

\( A = S - k_0^2 M \) and the load with the Dirichlet data applied (conforming meshes without periodic directions; otherwise solve reduces by the constraints first).

◆ assemble_raw()

template<int Dim>
assembly::AssembledSystem hpfem::physics::Scattering< Dim >::assemble_raw ( ) const

\( A = S - k_0^2 M \) and the load without boundary conditions.

◆ background_material()

template<int Dim>
const materials::Material & hpfem::physics::Scattering< Dim >::background_material ( Index  cell) const

Background material of cell c: the layer of setup.background at the cell centroid, otherwise materials.background(). The scattered-field source is proportional to material(c) − background_material(c).

◆ constraints()

template<int Dim>
fespace::Constraints hpfem::physics::Scattering< Dim >::constraints ( ) const

Hanging-node constraints of a locally refined mesh followed by the Bloch-periodic constraints of the setup (empty on a conforming mesh without periodic directions).

◆ dirichlet()

template<int Dim>
assembly::DirichletData hpfem::physics::Scattering< Dim >::dirichlet ( ) const

Dirichlet data of the unknown field on the PEC and incident facets.

◆ dirichlet_many()

template<int Dim>
std::vector< assembly::DirichletData > hpfem::physics::Scattering< Dim >::dirichlet_many ( std::span< const IncidentField< Dim > >  incidents) const

The same for several incident fields of this setup (same tags, formulation and materials), interpolated in one pass over the facets; element k equals dirichlet() of the setup with incident = incidents[k] up to round-off.

◆ dofs()

template<int Dim>
const fespace::NedelecDofMap< Dim > & hpfem::physics::Scattering< Dim >::dofs ( ) const
inlinenoexcept

◆ error() [1/2]

template<int Dim>
assembly::HcurlErrorNorms hpfem::physics::Scattering< Dim >::error ( const ScatteringSolution< Dim > &  solution,
const IncidentField< Dim > &  exact 
) const

Error norms of the unknown field against an exact field of the same kind (total or scattered, matching the formulation).

◆ error() [2/2]

template<int Dim>
assembly::HcurlErrorNorms hpfem::physics::Scattering< Dim >::error ( const ScatteringSolution< Dim > &  solution,
const IncidentField< Dim > &  exact,
std::span< const Index >  cells 
) const

The same over a subset of cells (e.g. the interior without the PML).

◆ estimate()

template<int Dim>
adaptivity::Estimate hpfem::physics::Scattering< Dim >::estimate ( const ScatteringSolution< Dim > &  solution,
const adaptivity::EstimatorOptions &  options = {} 
) const

Residual-based element indicators of the solution (adaptivity::residual_estimate with the forms of this problem and k0²); PML cells use their stretched tensors.

◆ form_of_cell()

template<int Dim>
assembly::MaxwellForm< Dim > hpfem::physics::Scattering< Dim >::form_of_cell ( Index  cell) const

Coefficients and sources of cell c for assemble_maxwell: relative tensors μr⁻¹ I, εr I and the sources of the formulation.

◆ incidence_material()

template<int Dim>
const materials::Material & hpfem::physics::Scattering< Dim >::incidence_material ( ) const

Medium the incident wave travels in: the incidence medium of the layered background, otherwise materials.background() (normalisation of cross-sections).

◆ incident_in_cell()

template<int Dim>
assembly::ComplexVector< Dim > hpfem::physics::Scattering< Dim >::incident_in_cell ( Index  cell,
const Point< Dim > &  x 
) const

The incident field of the setup at the physical point x evaluated on the side of cell: on a layered background the branch of the region of the cell's centroid, so a point on an interface gets the value of the side it was located on (zero without an incident field).

◆ incident_wave()

template<int Dim>
assembly::ComplexVector< Dim > hpfem::physics::Scattering< Dim >::incident_wave ( const Point< Dim > &  x) const

The incident wave at x: setup.incident_wave if given, else setup.incident (zero without an incident field).

◆ interior_cells()

template<int Dim>
std::vector< Index > hpfem::physics::Scattering< Dim >::interior_cells ( ) const

Cells whose centroid lies inside the PML box of the setup (all cells without PML).

◆ material()

template<int Dim>
const materials::Material & hpfem::physics::Scattering< Dim >::material ( Index  cell) const
inline

◆ port_coefficients()

template<int Dim>
std::vector< PortCoefficients > hpfem::physics::Scattering< Dim >::port_coefficients ( const ScatteringSolution< Dim > &  solution) const

Incoming and outgoing modal amplitudes of a solution on every port ( \( b_m = q_m^\top e / N_m - a_m \)).

◆ port_modes()

template<int Dim>
const PortModes< Dim > & hpfem::physics::Scattering< Dim >::port_modes ( Index  port) const
inline

Modes of port p of the setup (built in the constructor).

◆ scattered_field() [1/2]

template<int Dim>
std::optional< assembly::ComplexVector< Dim > > hpfem::physics::Scattering< Dim >::scattered_field ( const ScatteringSolution< Dim > &  solution,
const mesh::PointLocator< Dim > &  locator,
const Point< Dim > &  x 
) const

◆ scattered_field() [2/2]

template<int Dim>
assembly::ComplexVector< Dim > hpfem::physics::Scattering< Dim >::scattered_field ( const ScatteringSolution< Dim > &  solution,
Index  cell,
const Point< Dim > &  xi 
) const

◆ setup()

template<int Dim>
const ScatteringSetup< Dim > & hpfem::physics::Scattering< Dim >::setup ( ) const
inlinenoexcept

◆ solve()

template<int Dim>
ScatteringSolution< Dim > hpfem::physics::Scattering< Dim >::solve ( ) const

Assembles (with static condensation of the interior DoFs if condense), imposes the Dirichlet data, reduces by the constraints and solves with the chosen direct solver; the returned coefficients are complete (interior DoFs recovered).

◆ total_field() [1/2]

template<int Dim>
std::optional< assembly::ComplexVector< Dim > > hpfem::physics::Scattering< Dim >::total_field ( const ScatteringSolution< Dim > &  solution,
const mesh::PointLocator< Dim > &  locator,
const Point< Dim > &  x 
) const

The same at a physical point located with locator (built on the mesh), or nothing outside the mesh.

◆ total_field() [2/2]

template<int Dim>
assembly::ComplexVector< Dim > hpfem::physics::Scattering< Dim >::total_field ( const ScatteringSolution< Dim > &  solution,
Index  cell,
const Point< Dim > &  xi 
) const

Total / scattered field at reference point ξ of cell c (the incident field is added or subtracted according to the formulation; without an incident field both coincide). On a layered background the background field is evaluated with the region of the cell's centroid, so a point on an interface takes the side of the cell it was located in.

◆ wavenumber()

template<int Dim>
Real hpfem::physics::Scattering< Dim >::wavenumber ( ) const
inlinenoexcept

Vacuum wavenumber k0 [1/m].


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