hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
residual_estimator.hpp
Go to the documentation of this file.
1#pragma once
25
26#include <span>
27#include <type_traits>
28#include <vector>
29
32#include "hpfem/core/types.hpp"
34
35namespace hpfem::adaptivity {
36
52
59 [[nodiscard]] Real sum() const noexcept {
61 }
62};
63
65struct Estimate {
66 std::vector<Real> indicators;
67 std::vector<ResidualParts> parts;
69 [[nodiscard]] Real total() const;
71 [[nodiscard]] Index argmax() const;
72};
73
79template <int Dim>
81 const fespace::NedelecDofMap<Dim>& dofs, const Vector& e_h, Real k_squared,
82 const std::type_identity_t<assembly::CellFormFactory<Dim>>& form_of_cell,
83 const EstimatorOptions& options = {},
84 std::span<const assembly::PeriodicPair<Dim>> periodic = {});
85
94template <int Dim>
95[[nodiscard]] std::vector<Complex> weighted_residual(
96 const fespace::NedelecDofMap<Dim>& dofs, const Vector& e_h, Real k_squared,
97 const std::type_identity_t<assembly::CellFormFactory<Dim>>& form_of_cell,
98 const fespace::NedelecDofMap<Dim>& weight_dofs, const Vector& weight,
99 const EstimatorOptions& options = {});
100
101extern template std::vector<Complex> weighted_residual<2>(const fespace::NedelecDofMap<2>&,
102 const Vector&, Real,
105 const Vector&, const EstimatorOptions&);
106extern template std::vector<Complex> weighted_residual<3>(const fespace::NedelecDofMap<3>&,
107 const Vector&, Real,
110 const Vector&, const EstimatorOptions&);
111
114 const EstimatorOptions&,
115 std::span<const assembly::PeriodicPair<2>>);
118 const EstimatorOptions&,
119 std::span<const assembly::PeriodicPair<3>>);
120
121} // namespace hpfem::adaptivity
Definition dof_map.hpp:51
Definition axisymmetric_estimator.hpp:39
template std::vector< Complex > weighted_residual< 2 >(const fespace::NedelecDofMap< 2 > &, const Vector &, Real, const assembly::CellFormFactory< 2 > &, const fespace::NedelecDofMap< 2 > &, const Vector &, const EstimatorOptions &)
template Estimate residual_estimate< 3 >(const fespace::NedelecDofMap< 3 > &, const Vector &, Real, const assembly::CellFormFactory< 3 > &, const EstimatorOptions &, std::span< const assembly::PeriodicPair< 3 > >)
std::vector< Complex > weighted_residual(const fespace::NedelecDofMap< Dim > &dofs, const Vector &e_h, Real k_squared, const std::type_identity_t< assembly::CellFormFactory< Dim > > &form_of_cell, const fespace::NedelecDofMap< Dim > &weight_dofs, const Vector &weight, const EstimatorOptions &options={})
template std::vector< Complex > weighted_residual< 3 >(const fespace::NedelecDofMap< 3 > &, const Vector &, Real, const assembly::CellFormFactory< 3 > &, const fespace::NedelecDofMap< 3 > &, const Vector &, const EstimatorOptions &)
Estimate residual_estimate(const fespace::NedelecDofMap< Dim > &dofs, const Vector &e_h, Real k_squared, const std::type_identity_t< assembly::CellFormFactory< Dim > > &form_of_cell, const EstimatorOptions &options={}, std::span< const assembly::PeriodicPair< Dim > > periodic={})
template Estimate residual_estimate< 2 >(const fespace::NedelecDofMap< 2 > &, const Vector &, Real, const assembly::CellFormFactory< 2 > &, const EstimatorOptions &, std::span< const assembly::PeriodicPair< 2 > >)
std::function< MaxwellForm< Dim >(Index)> CellFormFactory
Definition maxwell_forms.hpp:97
double Real
Definition types.hpp:15
std::int64_t Index
global indices (DoFs, entities)
Definition types.hpp:17
Eigen::Matrix< Complex, Eigen::Dynamic, 1 > Vector
Definition types.hpp:20
Element indicators of one discrete solution.
Definition residual_estimator.hpp:65
std::vector< ResidualParts > parts
Definition residual_estimator.hpp:67
Real total() const
Global estimate .
Index argmax() const
Cell with the largest indicator (kInvalidIndex if there are none).
std::vector< Real > indicators
η_K per cell
Definition residual_estimator.hpp:66
Definition residual_estimator.hpp:37
Real difference_step
Definition residual_estimator.hpp:50
Real length_scale
Definition residual_estimator.hpp:46
bool divergence_terms
Include the Gauss-law terms (divergence residual and normal-flux jumps).
Definition residual_estimator.hpp:41
int extra_order
Added to 2p for the quadrature degree on cells and facets (+2 on curved cells).
Definition residual_estimator.hpp:39
Squared contributions of the four residual terms of one cell.
Definition residual_estimator.hpp:54
Real sum() const noexcept
Definition residual_estimator.hpp:59
Real tangential_jump
Σ_F h_F/(2p_F) ‖[n × w]‖²
Definition residual_estimator.hpp:57
Real element
(h/p)² ‖R_K‖²
Definition residual_estimator.hpp:55
Real normal_jump
Σ_F h_F/(2p_F) ‖[n · d]‖²
Definition residual_estimator.hpp:58
Real divergence
(h/p)² ‖∇·d‖²
Definition residual_estimator.hpp:56
Definition periodic.hpp:34