SpECTRE
v2024.08.03
|
Maps the radius as \(r(t) = a(t)\rho + \left(b(t) - a(t)\right) \frac{\rho^3} {R^2}\) where \(\rho\) is the radius of the source coordinates. More...
#include <CubicScale.hpp>
Public Member Functions | |
CubicScale (double outer_boundary, std::string function_of_time_name_a, std::string function_of_time_name_b) | |
template<typename T > | |
std::array< tt::remove_cvref_wrap_t< T >, Dim > | operator() (const std::array< T, Dim > &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, Dim > > | inverse (const std::array< double, Dim > &target_coords, double time, const std::unordered_map< std::string, std::unique_ptr< domain::FunctionsOfTime::FunctionOfTime > > &functions_of_time) const |
Returns std::nullopt if the point is outside the range of the map. 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 >, Dim > | frame_velocity (const std::array< T, Dim > &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 >, Dim, Frame::NoFrame > | inv_jacobian (const std::array< T, Dim > &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 >, Dim, Frame::NoFrame > | jacobian (const std::array< T, Dim > &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 = Dim |
Friends | |
template<size_t LocalDim> | |
bool | operator== (const CubicScale< LocalDim > &lhs, const CubicScale< LocalDim > &rhs) |
Maps the radius as \(r(t) = a(t)\rho + \left(b(t) - a(t)\right) \frac{\rho^3} {R^2}\) where \(\rho\) is the radius of the source coordinates.
The map scales the radius \(\rho\) in the source coordinates \(\xi^{\hat{i}}\) by a factor \(a(t)\), while the coordinates near the outer boundary \(R\), are scaled by a factor \(b(t)\). Here \(a(t)\) and \(b(t)\) are FunctionsOfTime. The target/mapped coordinates are denoted by \(x^i\).
The mapped coordinates are given by:
\begin{align} x^i = \left[a + (b-a) \frac{\rho^2}{R^2}\right] \xi^{\hat{i}} \delta^i_{\hat{i}}, \end{align}
where \(\xi^{\hat{i}}\) are the source coordinates, \(a\) and \(b\) are functions of time, \(\rho\) is the radius in the source coordinates, and \(R\) is the outer boundary.
The inverse map is computed by solving the cubic equation:
\begin{align} (b-a)\frac{\rho^3}{R^2} + a \rho - r = 0, \end{align}
which is done by defining \(q=\rho/R\), and solving
\begin{align} q \left[(b-a) q^2 + a\right] - \frac{r}{R} = 0. \end{align}
The source coordinates are obtained using:
\begin{align} \xi^{\hat{i}} = \frac{qR}{r} x^i(t) \delta^{\hat{i}}_i \end{align}
The Jacobian is given by:
\begin{align} \frac{\partial x^i}{\partial \xi^{\hat{i}}}= \left[a + (b-a) \frac{\rho^2}{R^2}\right] \delta^i_{\hat{i}} + \frac{2 (b-a)}{R^2} \xi^{\hat{j}} \delta^i_{\hat{j}} \xi^{\hat{k}} \delta_{\hat{k}\hat{i}} \end{align}
The inverse Jacobian is given by:
\begin{align} \frac{\partial \xi^{\hat{i}}}{\partial x^i}= \frac{1}{\left[a + (b-a)\rho^2/R^2\right]} \left[\delta^{\hat{i}}_i - \frac{2 (b-a)}{\left[a R^2 + 3(b-a)\rho^2\right]} \xi^{\hat{i}}\xi^{\hat{j}}\delta_{\hat{j}i}\right] \end{align}
The mesh velocity \(v_g^i\) is given by:
\begin{align} v_g^i = \left[\frac{da}{dt} + \left(\frac{db}{dt}-\frac{da}{dt}\right) \frac{\rho^2}{R^2}\right] \xi^{\hat{i}} \delta^i_{\hat{i}}. \end{align}