SpECTRE  v2024.09.29
domain::CoordinateMaps::TimeDependent::SphericalCompression< InteriorMap > Class Template Reference

Time-dependent compression of a finite 3D spherical volume. More...

#include <SphericalCompression.hpp>

Public Member Functions

 SphericalCompression (std::string function_of_time_name, double min_radius, double max_radius, const std::array< double, 3 > &center)
 
template<typename T >
std::array< tt::remove_cvref_wrap_t< T >, 3 > operator() (const std::array< T, 3 > &source_coords, double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) const
 
std::optional< std::array< double, 3 > > inverse (const std::array< double, 3 > &target_coords, double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) const
 The inverse function is only callable with doubles because the inverse might fail if called for a point out of range, and it is unclear what should happen if the inverse were to succeed for some points in a DataVector but fail for other points.
 
template<typename T >
std::array< tt::remove_cvref_wrap_t< T >, 3 > frame_velocity (const std::array< T, 3 > &source_coords, double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) const
 
template<typename T >
tnsr::Ij< tt::remove_cvref_wrap_t< T >, 3, Frame::NoFramejacobian (const std::array< T, 3 > &source_coords, double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) const
 
template<typename T >
tnsr::Ij< tt::remove_cvref_wrap_t< T >, 3, Frame::NoFrameinv_jacobian (const std::array< T, 3 > &source_coords, double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) const
 
void pup (PUP::er &p)
 
const std::unordered_set< std::string > & function_of_time_names () const
 

Static Public Member Functions

static bool is_identity ()
 

Static Public Attributes

static constexpr size_t dim = 3
 

Friends

bool operator== (const SphericalCompression &lhs, const SphericalCompression &rhs)
 

Detailed Description

template<bool InteriorMap>
class domain::CoordinateMaps::TimeDependent::SphericalCompression< InteriorMap >

Time-dependent compression of a finite 3D spherical volume.

Details

Let \(\xi^i\) be the unmapped coordinates, and let \(\rho\) be the Euclidean radius corresponding to these coordinates with respect to some center \(C^i\). The transformation implemented by this map is equivalent to the following transformation: at each point, the mapped coordinates are the same as the unmapped coordinates, except in a spherical region \(\rho \leq \rho_{\rm max}\), where instead coordinates are mapped using a compression that is spherically symmetric about the center \(C^i\). The amount of compression decreases linearly from a maximum at \(\rho = \rho_{\rm min}\) to zero at \(\rho = \rho_{\rm max}\). A scalar domain::FunctionsOfTime::FunctionOfTime \(\lambda_{00}(t)\) controls the amount of compression.

The mapped coordinates are a continuous function of the unmapped coordinates, but the Jacobians are not continuous at \(\rho_{\rm min}\) and \(\rho_{\rm max}\). Therefore, \(\rho_{\rm min}\) and \(\rho_{\rm max}\) should both be surfaces corresponding to block boundaries. Therefore, this class implements the transformation described above as follows: the if the template parameter InteriorMap is true, the map is the one appropriate for \(\rho < \rho_{\rm min}\), while if InteriorMap is false, the map is the one appropriate for \(\rho_{\rm min} \leq \rho \leq \rho_{\rm max}\). To use this map, add it to the blocks where the transformation is not the identity, using the appropriate template parameter, depending on which region the block is in.

Note
This map performs a only a spherical compression. A generalization of this map that changes the region's shape as well as its size, by including more terms than the spherically symmetric term included here, can be found in the domain::CoordinateMaps::TimeDependent::Shape map.
The quantity stored in the FunctionOfTime is really the spherical-harmonic coefficient \(\lambda_{00}(t)\). This is different from the Shape map, which stores ylm::Spherepack coefficients \(a_{lm}(t)\) and \(b_{lm}(t)\) instead of \(\lambda_{lm}(t)\). See domain::CoordinateMaps::TimeDependent::Shape for more details.

Mapped coordinates

The mapped coordinates \(x^i\) are related to the unmapped coordinates \(\xi^i\) as follows:

\begin{align} x^i &= \left\{\begin{array}{ll}\xi^i - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\rho^i}{\rho_{\rm min}}, & \rho < \rho_{\rm min}, \\ \xi^i - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\rho_{\rm max} / \rho - 1}{\rho_{\rm max} - \rho_{\rm min}} \rho^i, & \rho_{\rm min} \leq \rho \leq \rho_{\rm max}, \\ \xi^i, & \rho_{\rm max} < \rho,\end{array}\right. \end{align}

where \(\rho^i = \xi^i - C^i\) is the Euclidean radial position vector in the unmapped coordinates with respect to the center \(C^i\), \(\rho = \sqrt{\delta_{kl}\left(\xi^k - C^l\right)\left(\xi^l - C^l\right)}\) is the Euclidean magnitude of \(\rho^i\), and \(\rho_j = \delta_{ij} \rho^i\).

Frame velocity

The frame velocity \(v^i \equiv dx^i/dt\) is then

\begin{align} v^i &= \left\{\begin{array}{ll} - \frac{\lambda_{00}^\prime(t)}{\sqrt{4\pi}} \frac{\rho^i}{\rho_{\rm min}}, & \rho < \rho_{\rm min}, \\ - \frac{\lambda_{00}^\prime(t)}{\sqrt{4\pi}} \frac{\rho_{\rm max} / \rho - 1}{\rho_{\rm max} - \rho_{\rm min}} \rho^i, & \rho_{\rm min} \leq \rho \leq \rho_{\rm max}, \\ 0, & \rho_{\rm max} < \rho,\end{array}\right. \end{align}

where \(\lambda_{00}^\prime(t) \equiv d\lambda_{00}/dt\).

Jacobian

Differentiating the equations for \(x^i\) gives the Jacobian \(\partial x^i / \partial \xi^j\). Using the result

\begin{align} \frac{\partial \rho^i}{\partial \xi^j} &= \frac{\partial}{\partial \xi^j} \left(\xi^i - C^i\right) = \frac{\partial \xi^i}{\partial \xi^j} = \delta^i_{j} \end{align}

and taking the derivatives yields

\begin{align} \frac{\partial x^i}{\partial \xi^j} &= \left\{\begin{array}{ll} \delta^i_j \left(1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm min}}\right), & \rho < \rho_{\rm min},\\ \delta^i_j \left(1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\rho_{\rm max} / \rho - 1}{\rho_{\rm max} - \rho_{\rm min}}\right) - \rho^i \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\partial}{\partial \xi^j}\left( \frac{\rho_{\rm max} / \rho - 1}{\rho_{\rm max} - \rho_{\rm min}}\right), & \rho_{\rm min} \leq \rho < \rho_{\rm max},\\ \delta^i_j, & \rho_{\rm max} < \rho.\end{array}\right. \end{align}

Inserting

\begin{align} \frac{\partial}{\partial \xi^j}\left( \frac{\rho_{\rm max} / \rho - 1}{\rho_{\rm max} - \rho_{\rm min}}\right) &= \frac{\rho_{\rm max}}{\rho_{\rm max} - \rho_{\rm min}} \frac{\partial}{\partial \xi^j}\left(\frac{1}{\rho}\right) = - \frac{\rho_{\rm max}}{\rho_{\rm max} - \rho_{\rm min}} \frac{1}{\rho^2} \frac{\partial \rho}{\partial \xi^j} \end{align}

and

\begin{align} \frac{\partial \rho}{\partial \xi^j} &= \frac{\rho_j}{\rho}. \end{align}

into the Jacobian yields

\begin{align} \frac{\partial x^i}{\partial \xi^j} &= \left\{\begin{array}{ll} \delta^i_j \left(1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm min}}\right), & \rho < \rho_{\rm min},\\ \delta^i_j \left(1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\rho_{\rm max} / \rho - 1}{\rho_{\rm max} - \rho_{\rm min}}\right) + \rho^i \rho_j \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\rho_{\rm max}}{\rho_{\rm max} - \rho_{\rm min}}\frac{1}{\rho^3}, & \rho_{\rm min} \leq \rho < \rho_{\rm max},\\ \delta^i_j, & \rho_{\rm max} < \rho.\end{array}\right. \end{align}

Inverse Jacobian

This map finds the inverse Jacobian by first finding the Jacobian and then numerically inverting it.

Inverse map

For \(\lambda_{00}(t)\) that satisfy

\begin{align} \rho_{\rm min} - \rho_{\rm max} < \lambda_{00}(t) / \sqrt{4\pi} < \rho_{\rm min}, \end{align}

the map will be invertible and nonsingular. For simplicity, here we enforce this condition, even though perhaps the map might be generalized to handle cases that are still invertible but violate this condition. This avoids the need to specially handle the cases \(\lambda_{00}(t) / \sqrt{4\pi} = \rho_{\rm min} - \rho_{\rm max}\) and \(\lambda_{00}(t) / \sqrt{4\pi} = \rho_{\rm min}\), both of which yield a singular map, and it also avoids cases where the map behaves in undesirable ways (such as a larger \(\lambda_{00}(t)\) leading to an expansion and a coordinate inversion instead of a compression).

After requiring the above inequality to be satisfied, however, the inverse mapping can be derived as follows. Let \(r^i \equiv x^i - C^i\). In terms of \(r^i\), the map is

\begin{align} r^i &= \left\{\begin{array}{ll}\rho^i \left(1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm min}}\right), & \rho < \rho_{\rm min}, \\ \rho^i\left(1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\rho_{\rm max} / \rho - 1}{\rho_{\rm max} - \rho_{\rm min}}\right), & \rho_{\rm min} \leq \rho \leq \rho_{\rm max}, \\ \rho^i, & \rho_{\rm max} < \rho.\end{array}\right. \end{align}

Taking the Euclidean magnitude of both sides and simplifying yields

\begin{align} \frac{r}{\rho} &= \left\{\begin{array}{ll} 1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm min}}, & \rho < \rho_{\rm min}, \\ 1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\rho_{\rm max}/\rho - 1}{\rho_{\rm max} - \rho_{\rm min}}, & \rho_{\rm min} \leq \rho \leq \rho_{\rm max}, \\ 1, & \rho_{\rm max} < \rho,\end{array}\right. \end{align}

which implies

\begin{align} r^i = \rho^i \frac{r}{\rho} \Rightarrow \rho^i = r^i \frac{\rho}{r}. \end{align}

Inserting \(\rho_{\rm min}\) or \(\rho_{\rm max}\) then gives the corresponding bounds in the mapped coordinates:

\begin{align} r_{\rm min} &= \rho_{\rm min} - \frac{\lambda_{00}(t)}{\sqrt{4\pi}},\\ r_{\rm max} &= \rho_{\rm max}. \end{align}

In the regime \(\rho_{\rm min} \leq \rho < \rho_{\rm max}\), rearranging yields a linear relationship between \(\rho\) and \(r\), which can then be solved for \(\rho(r)\):

\begin{align} r &= \rho - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\rho_{\rm max} - \rho}{\rho_{\rm max} - \rho_{\rm min}}\\ \Rightarrow r &= \rho \left(1 + \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm max} - \rho_{\rm min}}\right) - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{\rho_{\rm max}}{\rho_{\rm max} - \rho_{\rm min}}. \end{align}

Solving this linear equation for \(\rho\) yields

\begin{align} \rho &= \left(r+\frac{\lambda_{00}(t)}{\sqrt{4\pi}}\frac{\rho_{\rm max}}{\rho_{\rm max}-\rho_{\rm min}}\right) \left(1 + \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm max} - \rho_{\rm min}}\right)^{-1}. \end{align}

Inserting the expressions for \(\rho\) into the equation

\begin{align} \rho^i = r^i \frac{\rho}{r} \end{align}

then gives

\begin{align} \rho^i &= \left\{\begin{array}{ll} r^i\left(1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm min}}\right)^{-1}, & r < \rho_{\rm min} - \frac{\lambda_{00}(t)}{\sqrt{4\pi}},\\ r^i \left(1+\frac{1}{r}\frac{\lambda_{00}(t)}{\sqrt{4\pi}}\frac{\rho_{\rm max}}{\rho_{\rm max}-\rho_{\rm min}}\right)\left(1 + \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm max} - \rho_{\rm min}}\right)^{-1}, & \rho_{\rm min} - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \leq r \leq \rho_{\rm max},\\ r^i, & \rho_{\rm max} < r.\end{array}\right. \end{align}

Finally, inserting \(\rho^i = \xi^i - C^i\) yields the inverse map:

\begin{align} \xi^i &= \left\{\begin{array}{ll} r^i\left(1 - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm min}}\right)^{-1} + C^i, & r < \rho_{\rm min} - \frac{\lambda_{00}(t)}{\sqrt{4\pi}},\\ r^i \left(1+\frac{1}{r}\frac{\lambda_{00}(t)}{\sqrt{4\pi}}\frac{\rho_{\rm max}}{\rho_{\rm max}-\rho_{\rm min}}\right)\left(1 + \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \frac{1}{\rho_{\rm max} - \rho_{\rm min}}\right)^{-1} + C^i, & \rho_{\rm min} - \frac{\lambda_{00}(t)}{\sqrt{4\pi}} \leq r \leq \rho_{\rm max},\\ r^i + C^i = x^i, & \rho_{\rm max} < r.\end{array}\right. \end{align}


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