SpECTRE  v2024.12.16
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
domain::CoordinateMaps::TimeDependent::Translation< Dim > Class Template Reference

Translation map defined by x=ξ+F(r)T(t) where F(r) takes on different forms based on which constructor is used. More...

#include <Translation.hpp>

Public Member Functions

 Translation (std::string function_of_time_name)
 
 Translation (std::string function_of_time_name, double inner_radius, double outer_radius)
 
 Translation (std::string function_of_time_name, std::unique_ptr< MathFunction< 1, Frame::Inertial > > radial_function, std::array< double, Dim > &center)
 
 Translation (const Translation< Dim > &Translation_Map)
 
 Translation (Translation &&)=default
 
Translationoperator= (Translation &&)=default
 
Translationoperator= (const Translation &Translation_Map)
 
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
 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::NoFrameinv_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::NoFramejacobian (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 Translation< LocalDim > &lhs, const Translation< LocalDim > &rhs)
 

Detailed Description

template<size_t Dim>
class domain::CoordinateMaps::TimeDependent::Translation< Dim >

Translation map defined by x=ξ+F(r)T(t) where F(r) takes on different forms based on which constructor is used.

Details

The map adds a translation to the coordinates ξ based on what type of translation is needed. For the piecewise translation, a translation F(r)T(t) is added to ξ based on what region |ξ| is in. For coordinates within the inner radius, F(r)=1 causing a uniform translation. Coordinates in between the inner and outer radius have a linear radial falloff applied to them. Coordinates beyond the outer radius have no translation applied to them F(r)=0. The piecewise translation assumes that the center of your map is at (0., 0., 0.). For the radial MathFunction translation, a radial translation F(r)T(t) is added to the coordinates ξ, where T(t) is a FunctionOfTime and F(r) is a 1D radial MathFunction. The radius of each point is found by subtracting the center map argument from the coordinates ξ or the target coordinates ξ¯. The Translation Map class is overloaded so that the user can choose between a piecewise translation, radial translation or a uniform translation based on their problem. If a radial dependence is not specified, this sets F(r)=1.

Mapped Coordinates

The piecewise translation translates the coordinates ξ to the target coordinates ξ¯ based on the region ξ is in.

(1)ξ¯={ξ+T(t),|ξ|Rin,ξ+wT(t),Rin<|ξ|<Rout,ξ,|ξ|Rout

Where Rin is the inner radius, Rout is the outer radius, and w is the radial falloff factor found through

(2)w=Rout|ξ|RoutRin

The radial MathFunction translation translates the coordinates ξ to the target coordinates

(3)ξ¯=ξ+F(r)T(t)

If you only supply a FunctionOfTime to the constructor of this class, the radial function will be set to 1.0 causing a uniform translation for your coordinates. If a FunctionOfTime, MathFunction, and map center are passed in, the radius will be found through

(4)r=|ξc|

where r is the radius and c is the center argument.

Inverse Translation

The piecewise inverse translates the coordinates ξ¯ to the original coordinates based on what region ξ¯ is in.

(5)ξ={ξ¯T(t),|ξ¯|Rin,or,|ξ¯T(t)|Rin,ξ¯wT(t),Rin<|ξ¯|<Rout,ξ¯,|ξ¯|Rout

Where w is the radial falloff factor found through a quadratic solve of the form

(6)w2(T(t)2(RoutRin)2)2w(T(t)ξ¯Rout(RoutRin))+ξ¯2Rout2

The inverse map also assumes that if ξ¯T(t)Rin then the translated point originally came from within the inner radius so it'll be translated back without a quadratic solve.

The radial MathFunction inverse translates the coordinates ξ¯ to the original coordinates using

(7)ξ=ξ¯F(r)T(t)

where r2 is found as the root of

(8)r2=(ξ¯cF(r)T(t))2.

Frame Velocity

For the piecewise translation, the frame velocity is found through

(9)v={dT(t)dt,|ξ|Rin,wdT(t)dt,Rin<|ξ|<Rout,0,|ξ|Rout

For the radial MathFunction translation, the frame velocity is found through

(10)v=dT(t)dtF(r)

where dT(t)dt is the first derivative of the FunctionOfTime.

Jacobian

For the piecewise translation, the jacobian is computed based on what region the coordinates ξ is in.

(11)Jij=dwdrT(t)iξjr,Rin<|ξ¯|<Rout

otherwise, it will return the identity matrix.

For the radial MathFunction translation, the jacobian is computed through the first derivative when the radius is bigger than 1.e-13:

(12)Jij=dF(r)drT(t)i(ξjcj)r

Where dF(r)dr is the first derivative of the MathFunction, ξj is the source coordinates, c is the center of your map, and r is the radius.

At a radius smaller than 1e-13, we ASSERT that the radial MathFunction is smooth dF(r)dr0, so return the identity matrix.

Inverse Jacobian

The inverse jacobian is computed numerically by inverting the jacobian.


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