SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::equations::CentralDensityConstraint< EOST > Class Template Referencefinal

Prescribe central density through the continuous enthalpy: \(h(0) - h_{EOS}(\rho_c) = 0\). Generally this is not needed; however, in the particular case of an n=3 polytrope with no rotation the central density becomes ill-defined and must be prescribed to avoid a singularity in the solution. Note that this equation is not responsible for sorting out what point is the center of the star; rather, this is provided to the evaluate method. More...

#include <central_density.hpp>

Inheritance diagram for serif::equations::CentralDensityConstraint< EOST >:
[legend]
Collaboration diagram for serif::equations::CentralDensityConstraint< EOST >:
[legend]

Public Types

using Operands = utils::types::TypeList<TestOperand>
 The operand types of the equation, that is the types of the fields which are used to evaluate the equation.
 
using Border = discretization::blocks::central_density::border
 The border type of the equation, that is what row of the global system this equation contributes to.
 
using ResidualQuantity = dimensions::SpecificEnthalpy
 The physical quantity which is being constrained by this equation, that is the quantity which is being set to a target value.
 
- Public Types inherited from serif::equations::Contribution< discretization::forms::Operand< discretization::blocks::enthalpy::specific > >
using Test
 The test type of the contribution.
 
using TestOperand
 The operand type of the contribution (associating a test function and a term)
 
using Support
 The domain support of the contribution (which then boils down to the dofs which are supported by the term on that test function)
 

Public Member Functions

 CentralDensityConstraint (EOST equation_of_state, dimensions::DensityValue target_density)
 Construct a central density constraint.
 
PointLinearization< Operands > evaluate (const EquationPoint< Operands > &point) const
 Evaluate the central density constraint at a given point.
 
dimensions::DensityValue target_density () const noexcept
 Return the prescribed central density.
 
dimensions::SpecificEnthalpyValue target_enthalpy () const noexcept
 Return the target enthalpy corresponding to the prescribed central density.
 
dimensions::DensityValue density_from_enthalpy (dimensions::SpecificEnthalpyValue enthalpy) const
 Convert some enthalpy to a density for physical diagnostics, when the inverse relation exists.
 

Static Public Attributes

static constexpr std::string_view name = "central density constraint"
 Compile time name for the equation, used for debugging and logging.
 
static constexpr bool position_independent = true
 Whether the equation is independent of the position of the point being evaluated, that is whether the equation is invariant under translations and rotations of the point. This is only used for compile-time checks.
 
static constexpr bool affine = true
 Whether the equation is affine, that is whether the equation is linear in the fields being evaluated. This is only used for compile-time checks.
 
static constexpr std::array< double, 3 > reference_position {}
 The reference position of the equation, this is only used for compile-time checks and is not used in the evaluation of the equation.
 

Private Attributes

EOST m_eos
 The EOS model to use for evaluating the enthalpy from the prescribed density.
 
dimensions::DensityValue m_target_density
 The prescribed central density, which must be finite and strictly positive.
 
double m_target_enthalpy
 The target enthalpy corresponding to the prescribed central density, which is computed from the EOS and must be finite.
 

Detailed Description

template<eos::models::EOSModel EOST>
requires eos::models::EOSSupportingRelation<EOST, eos::relations::SpecificEnthalpyFromDensity>
class serif::equations::CentralDensityConstraint< EOST >

Prescribe central density through the continuous enthalpy: \(h(0) - h_{EOS}(\rho_c) = 0\). Generally this is not needed; however, in the particular case of an n=3 polytrope with no rotation the central density becomes ill-defined and must be prescribed to avoid a singularity in the solution. Note that this equation is not responsible for sorting out what point is the center of the star; rather, this is provided to the evaluate method.

Template Parameters
EOSTThe EOS model type to use for evaluating the enthalpy from the prescribed density.
Requirements
  • The EOS model must support the relation SpecificEnthalpyFromDensity
Equation Contributions
  • Residuals to the specific enthalpy row of the system
Exceptions
std::invalid_argumentIf the prescribed density is not finite and strictly positive.
std::domain_errorIf the EOS returns a non-finite enthalpy for the prescribed density.

Member Typedef Documentation

◆ Border

template<eos::models::EOSModel EOST>
using serif::equations::CentralDensityConstraint< EOST >::Border = discretization::blocks::central_density::border

The border type of the equation, that is what row of the global system this equation contributes to.

◆ Operands

template<eos::models::EOSModel EOST>
using serif::equations::CentralDensityConstraint< EOST >::Operands = utils::types::TypeList<TestOperand>

The operand types of the equation, that is the types of the fields which are used to evaluate the equation.

◆ ResidualQuantity

template<eos::models::EOSModel EOST>
using serif::equations::CentralDensityConstraint< EOST >::ResidualQuantity = dimensions::SpecificEnthalpy

The physical quantity which is being constrained by this equation, that is the quantity which is being set to a target value.

Constructor & Destructor Documentation

◆ CentralDensityConstraint()

template<eos::models::EOSModel EOST>
serif::equations::CentralDensityConstraint< EOST >::CentralDensityConstraint ( EOST equation_of_state,
dimensions::DensityValue target_density )
inline

Construct a central density constraint.

Parameters
equation_of_stateThe EOS model to use for evaluating the enthalpy from the prescribed density.
target_densityThe prescribed central density, which must be finite and strictly positive.
Exceptions
std::invalid_argumentIf the prescribed density is not finite and strictly positive.
std::domain_errorIf the EOS returns a non-finite enthalpy for the prescribed density.
Todo
We should consider whether we actually need to own the EOS, this choice made lifetime management easier but introduces copy overhead. Moreover, it means that the EOS must be copyable and, more importantly in my view, that the caller must know that the EOS is being copied.

Member Function Documentation

◆ density_from_enthalpy()

template<eos::models::EOSModel EOST>
dimensions::DensityValue serif::equations::CentralDensityConstraint< EOST >::density_from_enthalpy ( dimensions::SpecificEnthalpyValue enthalpy) const
inlinenodiscard

Convert some enthalpy to a density for physical diagnostics, when the inverse relation exists.

Parameters
enthalpyThe specific enthalpy to convert.
Returns
The corresponding density.
Requirements
  • The EOS model must support the relation DensityFromSpecificEnthalpy, otherwise this method is not available.
Note
Generally this method is only for debugging, if you want to use the density you should really call the EOS directly.

◆ evaluate()

template<eos::models::EOSModel EOST>
PointLinearization< Operands > serif::equations::CentralDensityConstraint< EOST >::evaluate ( const EquationPoint< Operands > & point) const
inlinenodiscard

Evaluate the central density constraint at a given point.

Parameters
pointThe point at which to evaluate the equation, which must be the center of the star.
Note
It is the responsibility of the caller (and generally of the border equation backend) to ensure that this residual is applied to the correct row of the global system, the row defined by the Border type alias.
Returns
The linearization of the equation at the given point, which contains the residual and the derivatives of the residual with respect to the fields being evaluated.

◆ target_density()

template<eos::models::EOSModel EOST>
dimensions::DensityValue serif::equations::CentralDensityConstraint< EOST >::target_density ( ) const
inlinenodiscardnoexcept

Return the prescribed central density.

Returns
The prescribed central density.

◆ target_enthalpy()

template<eos::models::EOSModel EOST>
dimensions::SpecificEnthalpyValue serif::equations::CentralDensityConstraint< EOST >::target_enthalpy ( ) const
inlinenodiscardnoexcept

Return the target enthalpy corresponding to the prescribed central density.

Returns
The target enthalpy corresponding to the prescribed central density.

Member Data Documentation

◆ affine

template<eos::models::EOSModel EOST>
bool serif::equations::CentralDensityConstraint< EOST >::affine = true
staticconstexpr

Whether the equation is affine, that is whether the equation is linear in the fields being evaluated. This is only used for compile-time checks.

◆ m_eos

template<eos::models::EOSModel EOST>
EOST serif::equations::CentralDensityConstraint< EOST >::m_eos
private

The EOS model to use for evaluating the enthalpy from the prescribed density.

◆ m_target_density

template<eos::models::EOSModel EOST>
dimensions::DensityValue serif::equations::CentralDensityConstraint< EOST >::m_target_density
private

The prescribed central density, which must be finite and strictly positive.

◆ m_target_enthalpy

template<eos::models::EOSModel EOST>
double serif::equations::CentralDensityConstraint< EOST >::m_target_enthalpy
private

The target enthalpy corresponding to the prescribed central density, which is computed from the EOS and must be finite.

◆ name

template<eos::models::EOSModel EOST>
std::string_view serif::equations::CentralDensityConstraint< EOST >::name = "central density constraint"
staticconstexpr

Compile time name for the equation, used for debugging and logging.

◆ position_independent

template<eos::models::EOSModel EOST>
bool serif::equations::CentralDensityConstraint< EOST >::position_independent = true
staticconstexpr

Whether the equation is independent of the position of the point being evaluated, that is whether the equation is invariant under translations and rotations of the point. This is only used for compile-time checks.

◆ reference_position

template<eos::models::EOSModel EOST>
std::array<double, 3> serif::equations::CentralDensityConstraint< EOST >::reference_position {}
staticconstexpr

The reference position of the equation, this is only used for compile-time checks and is not used in the evaluation of the equation.


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