|
SpECTRE
v2025.08.19
|
Maps \(\xi\) in the 1D interval \([A, B]\) to \(x\) in the interval \([a, b]\) according to a domain::CoordinateMaps::Distribution.
More...
#include <Interval.hpp>
Public Member Functions | |
| Interval (double A, double B, double a, double b, Distribution distribution, std::optional< double > singularity_pos=std::nullopt) | |
| template<typename T > | |
| std::array< tt::remove_cvref_wrap_t< T >, 1 > | operator() (const std::array< T, 1 > &source_coords) const |
| std::optional< std::array< double, 1 > > | inverse (const std::array< double, 1 > &target_coords) const |
| template<typename T > | |
| tnsr::Ij< tt::remove_cvref_wrap_t< T >, 1, Frame::NoFrame > | jacobian (const std::array< T, 1 > &source_coords) const |
| template<typename T > | |
| tnsr::Ij< tt::remove_cvref_wrap_t< T >, 1, Frame::NoFrame > | inv_jacobian (const std::array< T, 1 > &source_coords) const |
| void | pup (PUP::er &p) |
| bool | is_identity () const |
Static Public Attributes | |
| static constexpr size_t | dim = 1 |
Friends | |
| bool | operator== (const Interval &lhs, const Interval &rhs) |
Maps \(\xi\) in the 1D interval \([A, B]\) to \(x\) in the interval \([a, b]\) according to a domain::CoordinateMaps::Distribution.
The mapping takes a domain::CoordinateMaps::Distribution and distributes the grid points accordingly.
The formula for the mapping is, in case of a Linear distribution
\begin{align} x &= \frac{b}{B-A} (\xi-A) + \frac{a}{B-A} (B-\xi)\\ \xi &=\frac{B}{b-a} (x-a) + \frac{A}{b-a} (b-x) \end{align}
For every other distribution we use this linear mapping to map onto an interval \([-1, 1]\), so we define:
\begin{align} f(\xi) &:= \frac{A+B-2\xi}{A-B} \in [-1, 1]\\ g(x) &:= \frac{a+b-2x}{a-b} \in [-1, 1] \end{align}
With this an Equiangular distribution is described by
\begin{align} x &= \frac{a}{2} \left(1-\mathrm{tan}\left(\frac{\pi}{4}f(\xi)\right)\right) + \frac{b}{2} \left(1+\mathrm{tan}\left(\frac{\pi}{4}f(\xi)\right)\right)\\ \xi &= \frac{A}{2} \left(1-\frac{4}{\pi}\mathrm{arctan}\left(g(x)\right)\right) + \frac{B}{2} \left(1+\frac{4}{\pi}\mathrm{arctan}\left(g(x)\right)\right) \end{align}
Wedge map when equiangular coordinates are chosen for those maps. For more information on this choice of coordinates, see the documentation for Wedge.For both the Logarithmic and Inverse distribution, we first specify a position for the singularity \(c:=\)singularity_pos outside the target interval \([a, b]\).
The Logarithmic distribution further requires the introduction of a variable \(\sigma\) dependent on whether \(c\) is left ( \( \sigma = 1\)) or right ( \( \sigma = -1\)) of the target interval. With this, the Logarithmic distribution is described by
\begin{align} x &= \sigma\, {\rm exp}\left(\frac{\ln(b-c)+\ln(a-c)}{2} + f(\xi) \frac{\ln(b-c)-\ln(a-c)}{2}\right) + c\\ \xi &= \frac{B-A}{2}\frac{2\ln(\sigma [x-c]) - \ln(b-c) - \ln(a-c)}{\ln(b-c) - \ln(a-c)} + \frac{B+A}{2} \end{align}
and the Inverse distribution by
\begin{align} x &= \frac{2(a-c)(b-c)}{a+b-2c+(a-b)f(\xi)} + c\\ \xi &= -\frac{A-B}{2(a-b)} \left(\frac{2(a-c)(b-c)}{x-c} - (a-c) - (b-c)\right) + \frac{A+B}{2} \end{align}