|
hp-FEM
Adaptive hp-FEM suite for nano-optics
|
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 |
Assembles, constrains and solves a scattering problem and evaluates its fields.
| hpfem::physics::Scattering< Dim >::Scattering | ( | const fespace::NedelecDofMap< Dim > & | dofs, |
| ScatteringSetup< Dim > | setup | ||
| ) |
| InvalidArgument | if ω ≤ 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. |
| 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).
| 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).
| assembly::AssembledSystem hpfem::physics::Scattering< Dim >::assemble_raw | ( | ) | const |
\( A = S - k_0^2 M \) and the load without boundary conditions.
| 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).
| 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).
| assembly::DirichletData hpfem::physics::Scattering< Dim >::dirichlet | ( | ) | const |
Dirichlet data of the unknown field on the PEC and incident facets.
| 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.
|
inlinenoexcept |
| 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).
| 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).
| 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.
| 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.
| 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).
| 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).
| 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).
| 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).
|
inline |
| 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 \)).
|
inline |
Modes of port p of the setup (built in the constructor).
| 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 |
| assembly::ComplexVector< Dim > hpfem::physics::Scattering< Dim >::scattered_field | ( | const ScatteringSolution< Dim > & | solution, |
| Index | cell, | ||
| const Point< Dim > & | xi | ||
| ) | const |
|
inlinenoexcept |
| 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).
| 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.
| 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.
|
inlinenoexcept |
Vacuum wavenumber k0 [1/m].