SERiF v0.0.1a
Stellar Evolution and Rotation in Four Dimensions
Loading...
Searching...
No Matches
serif::equations::MassNormalization Class Referencefinal

Mass normalization equation, which enforces a global constraint on the total mass of a system. More...

#include <mass_normalization.hpp>

Inheritance diagram for serif::equations::MassNormalization:
[legend]
Collaboration diagram for serif::equations::MassNormalization:
[legend]

Public Types

using Density = discretization::blocks::density::mass
 Alias for mass density.
 
using ResidualQuantity = dimensions::Mass
 Alias for the dimension of the residual.
 
using DensityValue = discretization::forms::Operand<Density>
 Alias for the operand type of the mass density.
 
using Operands = utils::types::TypeList<DensityValue>
 The list of operands for the mass normalization equation.
 
- Public Types inherited from serif::equations::Contribution< discretization::forms::Operand< discretization::blocks::barotropic_constant::mass_normalization > >
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

 MassNormalization (const double target_mass)
 Construct a mass normalization equation.
 
double residual_offset () const
 Return the residual offset for the mass normalization equation.
 

Static Public Member Functions

static PointLinearization< Operands > evaluate (const EquationPoint< Operands > &point)
 Evaluate the mass normalization equation point-wise integrand and its partial derivatives.
 
static int additional_order (DensityValue, int)
 Return the additional quadrature order required for the operands of this equation.
 

Static Public Attributes

static constexpr std::string_view name = "mass normalization"
 Compile time name for the mass normalization equation, used for debugging and logging.
 

Private Attributes

double m_target_mass
 The target mass for the system, which must be finite and positive.
 

Detailed Description

Mass normalization equation, which enforces a global constraint on the total mass of a system.

Note
In the barotropic case the bernoulli constant as the control variable here. This is a "clever" choice in this case; however, more broadly most of this equation is general (its only that in we choose to inject the residual into the mass_normalization member of the barotropic_constant block). That could very easily become a more general control variable without changing the rest of this

Mass normalization, being an integral constraint must make use of the residual_offset() method to properly find the residual. See AngularMomentumConstraint for a more detailed discussion of this. Suffice it to say that these are point-wise integrands so if we were to subtract the target mass from every point we would wildly over count the target mass. Rather, we simply return the density everywhere as the volume integrated density will be the mass. Then the residual_offset() method returns the negative of the target mass (the backend automatically adds anything from this function, if it exists, to the integrated residual to get the final residual).

@contribution Residuals to the mass_normalization term in the barotropic_constant block. This is effectively a global constraint on the total mass of the system.

Member Typedef Documentation

◆ Density

◆ DensityValue

Alias for the operand type of the mass density.

◆ Operands

The list of operands for the mass normalization equation.

◆ ResidualQuantity

Alias for the dimension of the residual.

Constructor & Destructor Documentation

◆ MassNormalization()

serif::equations::MassNormalization::MassNormalization ( const double target_mass)
inlineexplicit

Construct a mass normalization equation.

Parameters
target_massThe target mass for the system, which must be finite and positive.
Exceptions
std::invalid_argumentIf the target mass is not finite or not positive.

Member Function Documentation

◆ additional_order()

static int serif::equations::MassNormalization::additional_order ( DensityValue ,
int  )
inlinestaticnodiscard

Return the additional quadrature order required for the operands of this equation.

Parameters
operandThe operand type for which to determine the additional quadrature order. Note that this is only used to select the correct overload of this function. This particular version only has one overload; therefore this is really just their to maintain symmetry with other equation implementations.
position_orderThe order of the position basis functions.
Returns
The additional quadrature order required for the given operand type (always 0 in this case).

◆ evaluate()

static PointLinearization< Operands > serif::equations::MassNormalization::evaluate ( const EquationPoint< Operands > & point)
inlinestaticnodiscard

Evaluate the mass normalization equation point-wise integrand and its partial derivatives.

The point-wise integrand is calculated as \( \rho \), where \( \rho \) is the model density. The partial derivative is calculated as:

  • \( \frac{\partial r}{\partial \rho} = 1 \)
Note
As the class description notes, the residual is not calculated as \( \rho - M_{\text{target}} \) because this would over count the target mass. Instead we simply return the density and then use the residual_offset() method to subtract the target mass from the integrated residual.
Parameters
pointThe point at which to evaluate the equation.
Returns
The point-wise linearization of the mass normalization equation, which contains the residual and the partial derivative with respect to the model density.

◆ residual_offset()

double serif::equations::MassNormalization::residual_offset ( ) const
inlinenodiscard

Return the residual offset for the mass normalization equation.

The backend integrates the point-wise residual integrand over the domain. The global constraint is satisfied when the total mass equals the target value. Therefore we subtract the target from the integrated residual to get the actual residual.

Note
The backend automatically looks for this method and calls it if it exists.

The backend actually adds whatever is returned from this function to the integrated residual to get the final residual. Therefore we return the negative of the target mass here.
Returns
The negative of the target mass, \(-M_{\text{target}}\).

Member Data Documentation

◆ m_target_mass

double serif::equations::MassNormalization::m_target_mass
private

The target mass for the system, which must be finite and positive.

◆ name

std::string_view serif::equations::MassNormalization::name = "mass normalization"
staticconstexpr

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


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