SpECTRE  v2024.04.12
domain::CoordinateMaps::ShapeMapTransitionFunctions::Wedge Class Referencefinal

A transition function that falls off linearly from an inner surface of a wedge to an outer surface of a wedge. Meant to be used in domain::CoordinateMaps::Wedge blocks. More...

#include <Wedge.hpp>

Public Member Functions

 Wedge (double inner_radius, double outer_radius, double inner_sphericity, double outer_sphericity, size_t axis)
 Construct a Wedge transition for a wedge block in a given direction. More...
 
double operator() (const std::array< double, 3 > &source_coords) const override
 
DataVector operator() (const std::array< DataVector, 3 > &source_coords) const override
 
std::optional< double > original_radius_over_radius (const std::array< double, 3 > &target_coords, double distorted_radius) const override
 
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 (Wedge)
 
 Wedge (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
virtual std::optional< double > original_radius_over_radius (const std::array< double, 3 > &target_coords, double distorted_radius) const =0
 
virtual bool operator== (const ShapeMapTransitionFunction &other) const =0
 
virtual bool operator!= (const ShapeMapTransitionFunction &other) const =0
 
 WRAPPED_PUPable_abstract (ShapeMapTransitionFunction)
 
 ShapeMapTransitionFunction (CkMigrateMessage *m)
 

Detailed Description

A transition function that falls off linearly from an inner surface of a wedge to an outer surface of a wedge. Meant to be used in domain::CoordinateMaps::Wedge blocks.

Details

The functional form of this transition is

\begin{equation} f(r, \theta, \phi) = \frac{D_{\text{out}}(r, \theta, \phi) - r}{D_{\text{out}}(r, \theta, \phi) - D_{\text{in}}(r, \theta, \phi)}, \label{eq:transition_func} \end{equation}

where

\begin{equation} D(r, \theta, \phi) = R\left(\frac{1 - s}{\sqrt{3}\max(|\sin{\theta}\cos{\phi}|,|\sin{\theta}\sin{\phi}|, |\cos{\theta}|)} + s\right), \label{eq:distance} \end{equation}

where \(s\) is the sphericity of the surface which goes from 0 (flat) to 1 (spherical), \(R\) is the radius of the spherical surface, \(\text{out}\) is the outer surface, and \(\text{in}\) is the inner surface. If the sphericity is 1, then the surface is a sphere so \(D = R\). If the sphericity is 0, then the surface is a cube. This cube is circumscribed by a sphere of radius \(R\). See domain::CoordinateMaps::Wedge for more of an explanation of these boundary surfaces and their sphericities.

Note
Because the shape map distorts only radii and does not affect angles, \(D\) is not a function of \(r\) so we have that \(D(r,\theta,\phi) = D(\theta, \phi)\).

There are several assumptions made for this mapping:

  • The domain::CoordinateMaps::Wedges have an opening angle of \(\frac{\pi}{2}\) in each direction.
  • The coordinates \(r, \theta, \phi\) are assumed to be from the center of the wedge, not the center of the computational domain.
  • The wedges are concentric. (see the constructor)
  • The \(\max\) in the denominator of \(\ref{eq:distance}\) can be simplified a bit to \(\max(|x|, |y|, |z|)/r\). It was written the other way in \(\ref{eq:distance}\) to emphasize that \(D\) has no radial dependence.

Gradient

The cartesian gradient of the transition function is

\begin{equation} \frac{\partial f}{\partial x_i} = \frac{\frac{\partial D_{\text{out}}}{\partial x_i} - \frac{x_i}{r}}{D_{\text{out}} - D_{\text{in}}} - \frac{\left(D_{\text{out}} - r\right)\left(\frac{\partial D_{\text{out}}}{\partial x_i} - \frac{\partial D_{\text{in}}}{\partial x_i} \right)}{\left(D_{\text{out}} - D_{\text{in}}\right)^2}. \end{equation}

The computation of the gradient of \(D\) depends on the result of the \(\max\) in the denominator of \(\ref{eq:distance}\). To simplify the expression, let \(j \in \{0,1,2\}\) correspond to the \(\max(|x|, |y|, |z|)\) such that \(j=0\) if \(|x|\) is the \(\max\), and so on. Then we can write the gradient of \(D\) as

\begin{align} \frac{\partial D}{\partial x_j} &= -\text{sgn}(x_j)\frac{R(1-s)\left(r^2 - x_j^2\right)}{r x_j^2 \sqrt{3}} \\ \frac{\partial D}{\partial x_{j+1}} &= \frac{R(1-s)x_{j+1}}{r |x_j| \sqrt{3}} \\ \frac{\partial D}{\partial x_{j+2}} &= \frac{R(1-s)x_{j+2}}{r |x_j| \sqrt{3}} \end{align}

where \(j+1\) and \(j+2\) are understood to be \(\mod 3\). Also since we don't allow points at the origin of these wedges, we can be assured that for whichever \(j\) is max, that \(x_j\) won't be zero.

Original radius divided by mapped radius

Given an already mapped point and the distorted radius \(\Sigma(\theta, \phi) = \sum_{\ell,m}\lambda_{\ell m}Y_{\ell m}(\theta, \phi)\), we can figure out the ratio of the original radius \(r\) to the mapped \(\tilde{r}\) by solving

\begin{equation} \frac{r}{\tilde{r}} = \frac{1}{1-\frac{f(r,\theta,\phi)}{r}\Sigma(\theta,\phi)} \end{equation}

After plugging in the transition and solving, we get

\begin{equation} \frac{r}{\tilde{r}} = \frac{1 + \frac{D_{\text{out}}\Sigma(\theta, \phi)}{\tilde{r}(D_{\text{out}} - D_{\text{in}})}}{1 + \frac{\Sigma(\theta, \phi)}{D_{\text{out}} - D_{\text{in}}}} \label{eq:r_over_rtil} \end{equation}

Note
Since \(D\) is not a function of the radius, we can compute the angles using \(\tilde{r}\) in Eq. \(\ref{eq:r_over_rtil}\).

Special cases

The equations above become simpler if the inner boundary, outer boundary, or both are spherical ( \(s = 1\)). If a boundary is spherical, then \(D = R\) and \(\frac{\partial D}{\partial x_i} = 0\). This simplifies the expanded form of the gradient significantly.

Constructor & Destructor Documentation

◆ Wedge()

domain::CoordinateMaps::ShapeMapTransitionFunctions::Wedge::Wedge ( double  inner_radius,
double  outer_radius,
double  inner_sphericity,
double  outer_sphericity,
size_t  axis 
)

Construct a Wedge transition for a wedge block in a given direction.

Details

Many concentric wedges can be part of the same falloff from 1 at the inner boundary of the innermost wedge, to 0 at the outer boundary of the outermost wedge.

Parameters
inner_radiusInner radius of innermost wedge
outer_radiusOutermost radius of outermost wedge
inner_sphericitySphericity of innermost surface of innermost wedge
outer_sphericitySphericity of outermost surface of outermost wedge
axisThe direction that this wedge is in. Both the positive and negative direction get the same axis.

Member Function Documentation

◆ get_clone()

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

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() [1/2]

std::array< DataVector, 3 > domain::CoordinateMaps::ShapeMapTransitionFunctions::Wedge::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::Wedge::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::Wedge::operator!= ( const ShapeMapTransitionFunction other) const
overridevirtual

◆ operator()() [1/2]

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

Evaluate the transition function at the Cartesian coordinates source_coords.

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

◆ operator()() [2/2]

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

Evaluate the transition function at the Cartesian coordinates source_coords.

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

◆ operator==()

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

◆ original_radius_over_radius()

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

Given the mapped coordinates target_coords and the corresponding spherical harmonic expansion \(\sum_{lm} \lambda_{lm}(t)Y_{lm}\), distorted_radius, this method evaluates the original radius from the mapped radius by inverting the domain::CoordinateMaps::TimeDependent::Shape map. It also divides by the mapped radius to simplify calculations in the shape map.

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


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