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

Concrete implementation of the ExteriorDomainMap interface for the Kelvin compactification. More...

#include <kelvin.hpp>

Inheritance diagram for serif::mapping::compactification::KelvinCompactification:
[legend]
Collaboration diagram for serif::mapping::compactification::KelvinCompactification:
[legend]

Classes

struct  RadialFactors
 A struct to hold the radial factors for the Kelvin compactification mapping. More...
 

Public Member Functions

 KelvinCompactification (const utils::user_options::KelvinCompactificationOptions &options)
 Construct a KelvinCompactification with the given options.
 
bool is_affine_in_displacement () const noexcept override
 Check if the mapping is affine in the displacement. For the Kelvin compactification, this is always true.
 
MappingStatus evaluate (const ExteriorMapInput &input, ExteriorMapResult &result) const override
 Evaluate the mapping at a given point in the reference domain.
 
MappingStatus evaluate_variation (const ExteriorMapInput &input, const ExteriorMapResult &result, const ExteriorMapDirection &direction, ExteriorMapVariation &variation) const override
 Evaluate the variation of the mapping at a given point in the reference domain.
 
std::string_view get_name () const noexcept override
 Get the name of the mapping, which is "KelvinCompactification" for this class.
 
double get_reference_stellar_radius () const noexcept
 Get the reference stellar radius for the mapping, which is the radius of the inner surface of the reference domain.
 
double get_reference_infinity_radius () const noexcept
 Get the reference infinity radius for the mapping, which is the radius of the outer surface of the reference domain.
 
double get_coordinate_tolerance () const noexcept
 Get the coordinate tolerance for the mapping, which is the tolerance for the compactification coordinate.
 
MappingStatus evaluate_jacobian_variation_factors (double compactification_coordinate, const mfem::Vector &coordinateGradient, double &scale, mfem::Vector &scaleGradient) const
 Evaluate the mapping jacobian variation factors at some given compactification coordinate.
 
- Public Member Functions inherited from serif::mapping::compactification::ExteriorDomainMap
virtual ~ExteriorDomainMap ()=default
 

Private Member Functions

MappingStatus compute_radial_factors (double compactification_coordinate, RadialFactors &radial_factors) const
 Compute the radial factors for the Kelvin compactification mapping at a given compactification coordinate.
 

Private Attributes

utils::user_options::KelvinCompactificationOptions m_options
 The options for the Kelvin compactification, which must be valid.
 
const std::string_view m_name = "KelvinCompactification"
 The name of the mapping, which is "KelvinCompactification" for this class.
 

Detailed Description

Concrete implementation of the ExteriorDomainMap interface for the Kelvin compactification.

Broadly, for some reference position \(\mathbf{x_{r}}\) on some reference domain \(\Omega_{r}\) the Kelvin compactification maps to a physical position \(\mathbf{x_{p}}\) on some physical domain \(\Omega_{p}\) through the mapping

\[\mathbf{x_{p}} = \frac{\mathbf{x_{r}}}{1 - \frac{|\mathbf{x_{r}}|}{R_{\infty}}} \]

This results in the inner surface of the domain being mapped to the exterior surface of the physical domain while the outer surface of the exterior domain is mapped to infinity. There are some implications of this, namely that we loose accuracy in all things as we approach the outer surface of the domain. However, it is nice in so far as we can apply true boundary conditions at infinity.

Constructor & Destructor Documentation

◆ KelvinCompactification()

serif::mapping::compactification::KelvinCompactification::KelvinCompactification ( const utils::user_options::KelvinCompactificationOptions & options)
explicit

Construct a KelvinCompactification with the given options.

Parameters
optionsThe options for the Kelvin compactification, which must be valid.
Exceptions
std::invalid_argumentIf the reference stellar radius is not finite or positive
std::invalid_argumentIf the reference infinity radius is not finite or positive
std::invalid_argumentIf the reference infinity radius is not greater than the reference stellar radius
std::invalid_argumentIf the coordinate tolerance is not finite or positive or is greater than or equal to one

Member Function Documentation

◆ compute_radial_factors()

MappingStatus serif::mapping::compactification::KelvinCompactification::compute_radial_factors ( double compactification_coordinate,
RadialFactors & radial_factors ) const
nodiscardprivate

Compute the radial factors for the Kelvin compactification mapping at a given compactification coordinate.

Parameters
[in]compactification_coordinateThe compactification coordinate at which to compute the radial factors. (Note this runs from 0 to 1, where 0 is the inner surface and 1 is the outer surface of the reference domain)
[out]radial_factorsThe radial factors, which will be filled in by the method.
Returns
The status of the mapping evaluation.
Note
See the implementation file for more details on the actual algorithm used here.

◆ evaluate()

MappingStatus serif::mapping::compactification::KelvinCompactification::evaluate ( const ExteriorMapInput & input,
ExteriorMapResult & result ) const
nodiscardoverridevirtual

Evaluate the mapping at a given point in the reference domain.

Parameters
[in]inputThe input point in the reference domain to evaluate the mapping at.
[out]resultThe result of the mapping evaluation, which will be filled in by the method.
Returns
A status indicating the success or failure of the mapping evaluation. Mapping may fail if
  • the size of the input reference position is less than or equal to zero
  • the input displaced position size does not match the input reference position size
  • the input compactification coordinate gradient size does not match the input reference position size
  • the displacement_jacobian height does not match the input reference position size
  • the displacement_jacobian width does not match the input reference position size
  • the input reference, displaced, compactification coordinate gradient or jacobian contains non-finite values
  • There is some issue computing the radial factors (this error will be passed through)

The mapping jacobian comes from trivial application of the product rule recall: \(r_i = scale * x_i\) where \(r\) is the physical position and \(x\) is the displaced position. then we can differentiate wrt. \(X_j\) holding nothing fixed. Note the capital \(X\) here, this is the mesh coordinate not the displaced position. Lets call this jacobian \(F\)

\[ F = \frac{\partial r_i}{\partial X_{j}} \]

\(F\) then tells us how the physical position changes as we move along mesh coordinates

Lets then apply this to the function we have for the kelvin compactification

\[F = scale * \frac{\partial x_i}{\partial X_j} + x_i * \frac{\partial scale}{\partial X_j} \]

In the implementation you can see the displacement jacobian ( \(\frac{\partial x_i}{\partial X_j}\)) and the scale derivative ( \(\frac{\partial scale}{\partial X_j}\)) being applied to compute the mapping jacobian.

Implements serif::mapping::compactification::ExteriorDomainMap.

◆ evaluate_jacobian_variation_factors()

MappingStatus serif::mapping::compactification::KelvinCompactification::evaluate_jacobian_variation_factors ( double compactification_coordinate,
const mfem::Vector & coordinateGradient,
double & scale,
mfem::Vector & scaleGradient ) const
nodiscard

Evaluate the mapping jacobian variation factors at some given compactification coordinate.

Parameters
[in]compactification_coordinateThe compactification coordinate at which to evaluate the mapping jacobian variation factors. (Note this runs from 0 to 1, where 0 is the inner surface and 1 is the outer surface of the reference domain)
[in]coordinateGradientThe gradient of the compactification coordinate with respect to the mesh coordinates, which must be finite and have size 3.
[out]scaleThe scale factor for the mapping jacobian, which will be filled in by the method.
[out]scaleGradientThe gradient of the scale factor with respect to the mesh coordinates, which will be filled in by the method.
Returns
The status of the mapping evaluation.

◆ evaluate_variation()

MappingStatus serif::mapping::compactification::KelvinCompactification::evaluate_variation ( const ExteriorMapInput & input,
const ExteriorMapResult & result,
const ExteriorMapDirection & direction,
ExteriorMapVariation & variation ) const
nodiscardoverridevirtual

Evaluate the variation of the mapping at a given point in the reference domain.

Parameters
[in]inputThe input point in the reference domain to evaluate the mapping at.
[in]resultThe result of the mapping evaluation, which will be used in the variation computation.
[in]directionThe direction in which to evaluate the variation.
[out]variationThe result of the variation evaluation, which will be filled in by the method.
Returns
A status indicating the success or failure of the variation evaluation. The reasons for a failure are effectively the same as the reasons for a failure in the evaluate method just extended to cover the additional inputs.

Implements serif::mapping::compactification::ExteriorDomainMap.

◆ get_coordinate_tolerance()

double serif::mapping::compactification::KelvinCompactification::get_coordinate_tolerance ( ) const
nodiscardnoexcept

Get the coordinate tolerance for the mapping, which is the tolerance for the compactification coordinate.

Returns
The coordinate tolerance for the mapping.

◆ get_name()

std::string_view serif::mapping::compactification::KelvinCompactification::get_name ( ) const
nodiscardoverridevirtualnoexcept

Get the name of the mapping, which is "KelvinCompactification" for this class.

Returns
The name of the mapping.

Implements serif::mapping::compactification::ExteriorDomainMap.

◆ get_reference_infinity_radius()

double serif::mapping::compactification::KelvinCompactification::get_reference_infinity_radius ( ) const
nodiscardnoexcept

Get the reference infinity radius for the mapping, which is the radius of the outer surface of the reference domain.

Returns
The reference infinity radius for the mapping.

◆ get_reference_stellar_radius()

double serif::mapping::compactification::KelvinCompactification::get_reference_stellar_radius ( ) const
nodiscardnoexcept

Get the reference stellar radius for the mapping, which is the radius of the inner surface of the reference domain.

Returns
The reference stellar radius for the mapping.

◆ is_affine_in_displacement()

bool serif::mapping::compactification::KelvinCompactification::is_affine_in_displacement ( ) const
nodiscardoverridevirtualnoexcept

Check if the mapping is affine in the displacement. For the Kelvin compactification, this is always true.

Returns
false

Implements serif::mapping::compactification::ExteriorDomainMap.

Member Data Documentation

◆ m_name

const std::string_view serif::mapping::compactification::KelvinCompactification::m_name = "KelvinCompactification"
private

The name of the mapping, which is "KelvinCompactification" for this class.

◆ m_options

utils::user_options::KelvinCompactificationOptions serif::mapping::compactification::KelvinCompactification::m_options
private

The options for the Kelvin compactification, which must be valid.


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