SpECTRE
v2025.01.30
|
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 Types | |
enum class | Axis : int { PlusZ = 3 , MinusZ = -3 , PlusY = 2 , MinusY = -2 , PlusX = 1 , MinusX = -1 , None = 0 } |
Class to represent the direction of the wedge relative to the outer center. | |
Public Member Functions | |
Wedge (const std::array< double, 3 > &inner_center, double inner_radius, double inner_sphericity, const std::array< double, 3 > &outer_center, double outer_radius, double outer_sphericity, Axis axis, bool reverse=false) | |
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 radial_distortion) const override |
The inverse of the transition function. More... | |
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< ShapeMapTransitionFunction > | get_clone () const override |
bool | operator== (const ShapeMapTransitionFunction &other) const override |
bool | operator!= (const ShapeMapTransitionFunction &other) const override |
![]() | |
virtual std::optional< double > | original_radius_over_radius (const std::array< double, 3 > &target_coords, double radial_distortion) const =0 |
The inverse of the transition function. More... | |
virtual bool | operator== (const ShapeMapTransitionFunction &other) const =0 |
virtual bool | operator!= (const ShapeMapTransitionFunction &other) const =0 |
WRAPPED_PUPable_abstract (ShapeMapTransitionFunction) | |
ShapeMapTransitionFunction (CkMigrateMessage *m) | |
Friends | |
std::ostream & | operator<< (std::ostream &os, Axis axis) |
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.
The functional form of this transition is
where, in general,
reverse
is true, then the functional form of the transition is actually \begin{equation} f(r, \theta, \phi) = 1 - \frac{D_{\text{out}}(r, \theta, \phi) - r}{D_{\text{out}}(r, \theta, \phi) - D_{\text{in}}(r, \theta, \phi)} = \frac{r - \frac{D_{\text{in}}(r, \theta, \phi)} {D_{\text{out}}(r, \theta, \phi) - D_{\text{in}}(r, \theta, \phi)}. \label{eq:transition_func_reverse} \end{equation}
The function is also defined beyond reverse
is true, this logic is flipped.
Here, domain::CoordinateMaps::Wedge
for more of an explanation of these boundary surfaces and their sphericities.
There are several assumptions made for this mapping:
It can be more convenient to work with vectors rather than just distances for the following equations. Therefore, we define the projection center
In this way, we can reformulate Eq.
where
Similar to Eq.
with
and also
Then, we define
where
Computing
To compute
If we generalize this to all six unit vectors and solve for
for
Some
To compute
This is simply a quadratic equation for
We explicitly don't write the typical form of the solution of a quadratic equation because that form behaviors poorly numerically if the two terms in the numerator are close to each other (bad numerical roundoff). Therefore, we just resolve to compute the solution numerically, and say that we have
We have now solved for
given the solutions for
Given an already mapped point
After plugging in the transition and solving, we get
reverse
is true, then the value multiplying
reverse
is true, this logic is reversed.The cartesian gradient of the transition function is
reverse
is true, the gradient picks up an overall factor of -1.0.Therefore, we need to compute the gradients of
If
The gradient of
where
This gradient is much more complicated because of how we have to define
Since we know
Taking the gradient of Eqn.
The gradient in the numerator is simple to take so we end up with
Taking the gradient of Eqn.
Taking the simple gradients and moving things around, we get
where
So now we can put it all together and we get
which can then be substituted into Eqn.
domain::CoordinateMaps::ShapeMapTransitionFunctions::Wedge::Wedge | ( | const std::array< double, 3 > & | inner_center, |
double | inner_radius, | ||
double | inner_sphericity, | ||
const std::array< double, 3 > & | outer_center, | ||
double | outer_radius, | ||
double | outer_sphericity, | ||
Axis | axis, | ||
bool | reverse = false |
||
) |
Construct a Wedge transition for a wedge block in a given direction.
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.
inner_center
and outer_center
are different, then inner_sphericity
must be 1.0.inner_center | Center of the inner surface |
inner_radius | Inner radius of innermost wedge |
inner_sphericity | Sphericity of innermost surface of innermost wedge |
outer_center | Center of the outer surface |
outer_radius | Outermost radius of outermost wedge |
outer_sphericity | Sphericity of outermost surface of outermost wedge |
axis | The direction that this wedge is in. |
reverse | If true, the transition function will be 0 at the inner boundary and 1 at the outer boundary (useful for deforming star surfaces). Otherwise, it will be 1 at the inner boundary and 0 at the outer boundary (useful for deforming black hole excision surfaces). |
|
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.
|
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.
|
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.
|
overridevirtual |
|
overridevirtual |
Evaluate the transition function source_coords
.
Implements domain::CoordinateMaps::ShapeMapTransitionFunctions::ShapeMapTransitionFunction.
|
overridevirtual |
Evaluate the transition function source_coords
.
Implements domain::CoordinateMaps::ShapeMapTransitionFunctions::ShapeMapTransitionFunction.
|
overridevirtual |
|
overridevirtual |
The inverse of the transition function.
This method returns target_coords
) and the spherical harmonic expansion 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. (
target_coords | The mapped Cartesian coordinates |
radial_distortion | The spherical harmonic expansion |
Returns: The quantity
Implements domain::CoordinateMaps::ShapeMapTransitionFunctions::ShapeMapTransitionFunction.