SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
domain::CoordinateMaps::ShapeMapTransitionFunctions::SphereTransition Class Referencefinal

A transition function that falls off as \(G(r,\theta,\phi) = \frac{f(r)}{r} = \frac{ar + b}{r}\). More...

#include <SphereTransition.hpp>

Public Member Functions

 SphereTransition (double r_min, double r_max, bool reverse=false, bool interior=false)
double operator() (const std::array< double, 3 > &source_coords, const std::optional< size_t > &one_over_radius_power) const override
DataVector operator() (const std::array< DataVector, 3 > &source_coords, const std::optional< size_t > &one_over_radius_power) const override
std::optional< double > original_radius_over_radius (const std::array< double, 3 > &target_coords, double radial_distortion) const override
 The inverse of the transition function.
std::array< double, 3 > gradient (const std::array< double, 3 > &source_coords) const override
std::array< DataVector, 3 > gradient (const std::array< DataVector, 3 > &source_coords) const override
 WRAPPED_PUPable_decl_template (SphereTransition)
 SphereTransition (CkMigrateMessage *msg)
void pup (PUP::er &p) override
std::unique_ptr< ShapeMapTransitionFunctionget_clone () const override
bool operator== (const ShapeMapTransitionFunction &other) const override
bool operator!= (const ShapeMapTransitionFunction &other) const override
Public Member Functions inherited from domain::CoordinateMaps::ShapeMapTransitionFunctions::ShapeMapTransitionFunction
 WRAPPED_PUPable_abstract (ShapeMapTransitionFunction)
 ShapeMapTransitionFunction (CkMigrateMessage *m)

Detailed Description

A transition function that falls off as \(G(r,\theta,\phi) = \frac{f(r)}{r} = \frac{ar + b}{r}\).

Details

The coefficients \(a\) and \(b\) are chosen so that the function \(f(r) = ar + b\) falls off linearly from 1 at r_min to 0 at r_max. The coefficients are

\begin{align}\label{eq:transition_func} a &= \frac{-1}{r_{\text{max}} - r_{\text{min}}} \\ b &= \frac{r_{\text{max}}}{r_{\text{max}} - r_{\text{min}}} = -a r_{\text{max}} \end{align}

If reverse is set to true, then the function falls off from 0 at r_min to 1 at r_max. To do this, the coefficients are modified as \(a \rightarrow -a\) and \(b \rightarrow 1-b\).

The function can be called within r_min, but only if interior is true and reverse is false. Within r_min,

\begin{equation}G(r,\theta,\phi) = \frac{r^2}{r_{\text{min}}^3}. \end{equation}

which is chosen to match Eq. \(\ref{eq:transition_func}\) at \(r_{\text{min}}\) and go to 0 at \(r=0\).

This function cannot be called beyond r_max.

If interior is false and if the operator() or gradient() is called with a point within r_min, an error will occur and original_radius_over_radius will return std::nullopt.

This is a special, simplified, case of the domain::CoordinateMaps::ShapeMapTransitionFunctions::Wedge class where both the inner and outer surface are spheres centered on the same center.

Member Function Documentation

◆ get_clone()

std::unique_ptr< ShapeMapTransitionFunction > domain::CoordinateMaps::ShapeMapTransitionFunctions::SphereTransition::get_clone ( ) const
inlineoverridevirtual

◆ gradient() [1/2]

std::array< DataVector, 3 > domain::CoordinateMaps::ShapeMapTransitionFunctions::SphereTransition::gradient ( const std::array< DataVector, 3 > & source_coords) const
overridevirtual

Evaluate the gradient of the transition function with respect to the Cartesian coordinates x, y and z at the Cartesian coordinates source_coords.

Implements domain::CoordinateMaps::ShapeMapTransitionFunctions::ShapeMapTransitionFunction.

◆ gradient() [2/2]

std::array< double, 3 > domain::CoordinateMaps::ShapeMapTransitionFunctions::SphereTransition::gradient ( const std::array< double, 3 > & source_coords) const
overridevirtual

Evaluate the gradient of the transition function with respect to the Cartesian coordinates x, y and z at the Cartesian coordinates source_coords.

Implements domain::CoordinateMaps::ShapeMapTransitionFunctions::ShapeMapTransitionFunction.

◆ operator!=()

bool domain::CoordinateMaps::ShapeMapTransitionFunctions::SphereTransition::operator!= ( const ShapeMapTransitionFunction & other) const
overridevirtual

◆ operator()() [1/2]

DataVector domain::CoordinateMaps::ShapeMapTransitionFunctions::SphereTransition::operator() ( const std::array< DataVector, 3 > & source_coords,
const std::optional< size_t > & one_over_radius_power ) const
overridevirtual

Evaluate the transition function \(G(r,\theta,\phi)\) at the Cartesian coordinates source_coords and possibly divide by the radius \(r\).

Details

If one_over_radius_power has a value, then divide \(G\) by \(r\) to that power. This is done here because the transition function knows how to handle points in various regions of the map.

Implements domain::CoordinateMaps::ShapeMapTransitionFunctions::ShapeMapTransitionFunction.

◆ operator()() [2/2]

double domain::CoordinateMaps::ShapeMapTransitionFunctions::SphereTransition::operator() ( const std::array< double, 3 > & source_coords,
const std::optional< size_t > & one_over_radius_power ) const
overridevirtual

Evaluate the transition function \(G(r,\theta,\phi)\) at the Cartesian coordinates source_coords and possibly divide by the radius \(r\).

Details

If one_over_radius_power has a value, then divide \(G\) by \(r\) to that power. This is done here because the transition function knows how to handle points in various regions of the map.

Implements domain::CoordinateMaps::ShapeMapTransitionFunctions::ShapeMapTransitionFunction.

◆ operator==()

bool domain::CoordinateMaps::ShapeMapTransitionFunctions::SphereTransition::operator== ( const ShapeMapTransitionFunction & other) const
overridevirtual

◆ original_radius_over_radius()

std::optional< double > domain::CoordinateMaps::ShapeMapTransitionFunctions::SphereTransition::original_radius_over_radius ( const std::array< double, 3 > & target_coords,
double radial_distortion ) const
overridevirtual

The inverse of the transition function.

This method returns \(r/\tilde{r}\) given the mapped coordinates \(\tilde{x}^i\) (target_coords) and the spherical harmonic expansion \(\Sigma(t, \theta, \phi) = \sum_{lm} \lambda_{lm}(t)Y_{lm}(\theta, \phi)\) (radial_distortion). See domain::CoordinateMaps::TimeDependent::Shape for details on how this quantity is used to compute the inverse of the Shape map.

To derive the expression for this inverse, solve Eq. ( \(\ref{eq:shape_map_radius}\)) for \(r\) after substituting \(G(r,\theta,\phi)\).

Parameters
target_coordsThe mapped Cartesian coordinates \(\tilde{x}^i\).
radial_distortionThe spherical harmonic expansion \(\Sigma(t, \theta, \phi)\).

Returns: The quantity \(r/\tilde{r}\).

Implements domain::CoordinateMaps::ShapeMapTransitionFunctions::ShapeMapTransitionFunction.


The documentation for this class was generated from the following file:
  • src/Domain/CoordinateMaps/TimeDependent/ShapeMapTransitionFunctions/SphereTransition.hpp