The abstract interface for any numerical model. Most methods have a standard implementation, which can be overwritten if needed. To see how the models are used, refer to the DiFfRG::AbstractAssembler class and the Numerical Models guide in the documentation.
More...
|
| const auto & | get_components () const |
| |
|
| template<int dim, typename Vector > |
| void | initial_condition (const Point< dim > &x, Vector &u_i) const =delete |
| | This method implements the initial condition for the FE functions.
|
| |
| template<int dim, typename NumberType , typename Vector , typename Vector_dot , size_t n_fe_functions> |
| void | mass (std::array< NumberType, n_fe_functions > &m_i, const Point< dim > &x, const Vector &u_i, const Vector_dot &dt_u_i) const |
| | The mass function \(m_i(\partial_t u_j, u_j, x)\) is implemented in this method.
|
| |
| template<int dim, typename NumberType , size_t n_fe_functions> |
| void | mass (std::array< std::array< NumberType, n_fe_functions >, n_fe_functions > &m_ij, const Point< dim > &x) const |
| | If not using a DAE, the mass matrix \(m_{ij}(x)\) is implemented in this method.
|
| |
| template<int dim, typename NumberType , typename Solutions , size_t n_fe_functions> |
| void | flux (std::array< Tensor< 1, dim, NumberType >, n_fe_functions > &F_i, const Point< dim > &x, const Solutions &sol) const |
| | The flux function \(F_i(u_j, \partial_x u_j, \partial_x^2 u_j, e_b, v_a, x)\) is implemented by this method.
|
| |
| template<int dim, typename NumberType , typename Solutions , size_t n_fe_functions> |
| void | diffusion_flux (std::array< Tensor< 1, dim, NumberType >, n_fe_functions > &F_i, const Point< dim > &x, const Solutions &sol) const |
| | If the Kurganov Tadmor Scheme is used, this is the implementation of the diffusion (parabolic) part of the face flux. \(D_i(u_j, \partial_x u_j, \partial_x^3 u_j, x)\).
|
| |
| template<int dim, typename NumberType , typename Solutions , size_t n_fe_functions> |
| void | source (std::array< NumberType, n_fe_functions > &s_i, const Point< dim > &x, const Solutions &sol) const |
| | The source function \(s_i(u_j, \partial_x u_j, \partial_x^2 u_j, e_b, v_a, x)\) is implemented by this method.
|
| |
| template<uint dim> |
| std::vector< bool > | differential_components () const |
| | A method to find out which components of the mass function are differential when using a DAE.
|
| |
| template<size_t n_fe_functions> |
| void | wave_speed_blocks (std::array< int, n_fe_functions > &blocks) const |
| | Which FE components share a wave speed, and which carry no hyperbolic flux at all.
|
| |
|
| template<typename Vector > |
| void | initial_condition_variables (Vector &v_a) const |
| |
| template<typename Vector , typename Solution > |
| void | dt_variables (Vector &r_a, const Solution &sol) const |
| |
|
| template<int dim, typename Vector , typename Solutions > |
| void | extract (Vector &result, const Point< dim > &x, const Solutions &sol) const |
| | Read data off the FE solution at a single point and hand it to the Variables.
|
| |
|
| static constexpr bool | extract_uses_potential = true |
| | Whether extract() reads the reconstructed potential handed to it.
|
| |
| template<uint dependent, int dim, typename NumberType , typename Vector , size_t n_fe_functions_dep> |
| void | ldg_flux (std::array< Tensor< 1, dim, NumberType >, n_fe_functions_dep > &F, const Point< dim > &x, const Vector &u) const |
| | The LDG flux function \(F^{LDG}_i(u_j, x),\,i>0\) is implemented by this method.
|
| |
| template<uint dependent, int dim, typename NumberType , typename Vector , size_t n_fe_functions_dep> |
| void | ldg_source (std::array< NumberType, n_fe_functions_dep > &s, const Point< dim > &x, const Vector &u) const |
| | The LDG source function \(s^{LDG}_i(u_j, x),\,i>0\) is implemented by this method.
|
| |
| template<int dim, typename NumberType , typename Solutions_s , typename Solutions_n > |
| void | face_indicator (std::array< NumberType, 2 > &indicator, const Tensor< 1, dim > &normal, const Point< dim > &p, const Solutions_s &sol_s, const Solutions_n &sol_n) const |
| |
| template<int dim, typename NumberType , typename Solution > |
| void | cell_indicator (NumberType &indicator, const Point< dim > &p, const Solution &sol) const |
| |
| template<int dim, typename Vector > |
| std::array< double, dim > | EoM (const Point< dim > &x, const Vector &u) const |
| |
| template<int dim, typename Vector > |
| std::array< double, dim > | raw_potential_gradient (const Point< dim > &x, const Vector &u) const |
| | The unmodified gradient of the scalar potential reconstructed for readouts and extractors.
|
| |
| template<int dim, typename Vector > |
| Point< dim > | EoM_postprocess (const Point< dim > &EoM, const Vector &) const |
| | Relocate the point found by the EoM search, given the solution values there.
|
| |
| template<typename FUN , typename DataOut > |
| void | readouts_multiple (FUN &helper, DataOut &) const |
| |
| template<int dim, typename DataOut , typename Solutions > |
| void | readouts (DataOut &output, const Point< dim > &x, const Solutions &sol) const |
| |
| template<typename Constraints , typename Context > |
| void | affine_constraints (Constraints &constraints, const Context &context) const |
| | Add affine constraints to the FE/DG system before sparsity patterns and operators are rebuilt.
|
| |
template<typename Model, typename Components_>
class DiFfRG::def::AbstractModel< Model, Components_ >
The abstract interface for any numerical model. Most methods have a standard implementation, which can be overwritten if needed. To see how the models are used, refer to the DiFfRG::AbstractAssembler class and the Numerical Models guide in the documentation.
- Template Parameters
-
| Model | The model which implements this interface. (CRTP) |
| Components_ | The components of the model, this must be a DiFfRG::ComponentDescriptor. |
template<typename Model , typename Components_ >
template<typename Constraints , typename Context >
| void DiFfRG::def::AbstractModel< Model, Components_ >::affine_constraints |
( |
Constraints & | constraints, |
|
|
const Context & | context ) const |
|
inline |
Add affine constraints to the FE/DG system before sparsity patterns and operators are rebuilt.
Boundary-only constraints should use apply_boundary_affine_constraints(constraints, context) and inspect context.template boundary<"u">(). Constraints that may need interior support points should use apply_affine_constraints(constraints, context) and inspect context.template support<"u">().
The origin helpers use x[0] as their signed origin coordinate in one-dimensional domains. In multidimensional domains, models using these helpers must provide Model::OriginConstraintCoordinate<component_name>::signed_coordinate(point) to define the zero level set that should be constrained for each named component.
template<typename Model , typename Components_ >
template<
uint dependent, int dim, typename NumberType , typename Vector , size_t n_fe_functions_dep>
| void DiFfRG::def::AbstractModel< Model, Components_ >::ldg_flux |
( |
std::array< Tensor< 1, dim, NumberType >, n_fe_functions_dep > & | F, |
|
|
const Point< dim > & | x, |
|
|
const Vector & | u ) const |
|
inline |
The LDG flux function \(F^{LDG}_i(u_j, x),\,i>0\) is implemented by this method.
The assembler constructs the i-th LDG function l_i from the i-1-th level as
\[l_i = \partial_x F^{LDG}_i(l_{i-1}, x) + s^{LDG}_i(l_{i-1}, x)\]
Here, \(l_0\) is the solution itself (with all its components).
- Note
- The standard implementation of this method simply sets \(F^{LDG}_i = 0\).
- Template Parameters
-
| dependent | the index \(i\) of the dependent variable \(l_i\) which is constructed from the previous level \(l_{i-1}\). |
- Parameters
-
| F | the resulting LDG flux function \(F^{LDG}_i\), with n_fe_functions_dep components. This method should fill this argument with the desired structure of the flow equation. |
| x | a d-dimensional dealii::Point<dim> representing field coordinates. |
| u | the field values of \(l_j(x)\) at the point x. |
template<typename Model , typename Components_ >
template<
uint dependent, int dim, typename NumberType , typename Vector , size_t n_fe_functions_dep>
| void DiFfRG::def::AbstractModel< Model, Components_ >::ldg_source |
( |
std::array< NumberType, n_fe_functions_dep > & | s, |
|
|
const Point< dim > & | x, |
|
|
const Vector & | u ) const |
|
inline |
The LDG source function \(s^{LDG}_i(u_j, x),\,i>0\) is implemented by this method.
The assembler constructs the i-th LDG function l_i from the i-1-th level as
\[l_i = \partial_x F^{LDG}_i(l_{i-1}, x) + s^{LDG}_i(l_{i-1}, x)\]
Here, \(l_0\) is the solution itself (with all its components).
- Note
- The standard implementation of this method simply sets \(s^{LDG}_i = 0\).
- Template Parameters
-
| dependent | the index \(i\) of the dependent variable \(l_i\) which is constructed from the previous level \(l_{i-1}\). |
- Parameters
-
| s | the resulting LDG source function \(s^{LDG}_i\), with n_fe_functions_dep components. This method should fill this argument with the desired structure of the flow equation. |
| x | a d-dimensional dealii::Point<dim> representing field coordinates. |
| u | the field values of \(l_j(x)\) at the point x. |
template<typename Model , typename Components_ >
template<int dim, typename NumberType , typename Solutions , size_t n_fe_functions>
| void DiFfRG::def::AbstractModel< Model, Components_ >::source |
( |
std::array< NumberType, n_fe_functions > & | s_i, |
|
|
const Point< dim > & | x, |
|
|
const Solutions & | sol ) const |
|
inline |
The source function \(s_i(u_j, \partial_x u_j, \partial_x^2 u_j, e_b, v_a, x)\) is implemented by this method.
- Note
- The standard implementation of this method simply sets \(s_i = 0\).
- Parameters
-
| s_i | the resulting source function \(s_i\), with \(N_f\) components. This method should fill this argument with the desired structure of the flow equation. |
| x | a d-dimensional dealii::Point<dim> representing field coordinates. |
| sol | a named tuple; which entries it carries depends on the assembler:
- CG and dDG:
"fe_functions" \(u_j\), "fe_derivatives" \(\partial_x u_j\), "fe_hessians" \(\partial_x^2 u_j\), "extractors" \(e_b\), "variables" \(v_a\)
- DG:
"fe_functions", "extractors", "variables"
- KT-FV:
"fe_functions", "fe_derivatives", "extractors", "variables" – no hessians, and the derivatives are the scheme's reconstructed cell gradient
|
Access the entries by name (get<"fe_derivatives">(sol)); a model that reads an entry its assembler does not provide fails to compile.
template<typename Model , typename Components_ >
template<size_t n_fe_functions>
Which FE components share a wave speed, and which carry no hyperbolic flux at all.
Only the Kurganov-Tadmor assembler consults this. KT adds a dissipation term -a/2 (u^+ - u^-) to the numerical flux of every component, with a a wave speed read off the flux jacobian. Which jacobian, and whether a component is dissipated at all, is what this declares: components sharing a block id share one speed, computed as the spectral radius of the flux jacobian restricted to that block, and a component marked no_wave_speed is not dissipated.
Two things go wrong when the whole system shares one speed, and a model that mixes a conservation law with constraints needs both fixed.
A component whose flux is identically zero is dissipated all the same. For a differential component that is harmless: its diagonal carries c_j * JxW, which swamps the dissipation. An algebraic component has no such term, so the dissipation becomes the leading entry of its row – and drags the reconstruction's slope limiter into the newton jacobian with it, where a limiter kink stalls the iteration outright. no_wave_speed drops the dissipation instead, leaving the row exactly as the model wrote it.
A component that does carry a flux, but a much slower one than the fastest in the system, is over-dissipated by the ratio of the two speeds. That is worse than inaccurate when the row is algebraic. Its own terms are integrated over the cell and so carry a factor of the cell width, while the dissipation is a face quantity and does not; the row's diagonal dominance is then O(dx) and the row degenerates under refinement, so the scheme fails when the grid is made finer. Giving such a component its own block restores the balance: both the diagonal and the off-diagonal scale as a/dx and their difference stays finite.
Blocking is a statement that the cross-couplings between blocks do not carry characteristics – true when the off-block rows are constraints rather than conservation laws, which is the case this exists for. It is not a licence to split a genuinely hyperbolic system, where the full spectral radius is the safe choice and is what one block gives.
This is a structural property of the model, not a function of the state: it is queried per face, and blocks that varied with the solution would be both a cost and a discontinuity.
The default puts every component in one block, i.e. the scheme as it was before this hook existed.