SpECTRE
v2024.09.29
|
A FocallyLiftedInnerMap that maps a 3D unit right cylindrical shell to a volume that connects portions of two spherical surfaces. More...
#include <FocallyLiftedSide.hpp>
Public Member Functions | |
Side (const std::array< double, 3 > ¢er, const double radius, const double z_lower, const double z_upper) | |
Side (Side &&)=default | |
Side (const Side &)=default | |
Side & | operator= (const Side &)=default |
Side & | operator= (Side &&)=default |
template<typename T > | |
void | forward_map (const gsl::not_null< std::array< tt::remove_cvref_wrap_t< T >, 3 > * > target_coords, const std::array< T, 3 > &source_coords) const |
std::optional< std::array< double, 3 > > | inverse (const std::array< double, 3 > &target_coords, double sigma_in) const |
template<typename T > | |
void | jacobian (const gsl::not_null< tnsr::Ij< tt::remove_cvref_wrap_t< T >, 3, Frame::NoFrame > * > jacobian_out, const std::array< T, 3 > &source_coords) const |
template<typename T > | |
void | inv_jacobian (const gsl::not_null< tnsr::Ij< tt::remove_cvref_wrap_t< T >, 3, Frame::NoFrame > * > inv_jacobian_out, const std::array< T, 3 > &source_coords) const |
template<typename T > | |
void | sigma (const gsl::not_null< tt::remove_cvref_wrap_t< T > * > sigma_out, const std::array< T, 3 > &source_coords) const |
template<typename T > | |
void | deriv_sigma (const gsl::not_null< std::array< tt::remove_cvref_wrap_t< T >, 3 > * > deriv_sigma_out, const std::array< T, 3 > &source_coords) const |
template<typename T > | |
void | dxbar_dsigma (const gsl::not_null< std::array< tt::remove_cvref_wrap_t< T >, 3 > * > dxbar_dsigma_out, const std::array< T, 3 > &source_coords) const |
std::optional< double > | lambda_tilde (const std::array< double, 3 > &parent_mapped_target_coords, const std::array< double, 3 > &projection_point, bool source_is_between_focus_and_target) const |
template<typename T > | |
void | deriv_lambda_tilde (const gsl::not_null< std::array< tt::remove_cvref_wrap_t< T >, 3 > * > deriv_lambda_tilde_out, const std::array< T, 3 > &target_coords, const T &lambda_tilde, const std::array< double, 3 > &projection_point) const |
void | pup (PUP::er &p) |
Static Public Member Functions | |
static bool | is_identity () |
Static Public Attributes | |
static constexpr size_t | dim = 3 |
Friends | |
bool | operator== (const Side &lhs, const Side &rhs) |
A FocallyLiftedInnerMap that maps a 3D unit right cylindrical shell to a volume that connects portions of two spherical surfaces.
The domain of the map is a 3D unit right cylinder with coordinates \((\bar{x},\bar{y},\bar{z})\) such that \(-1\leq\bar{z}\leq 1\) and \(1\leq \bar{x}^2+\bar{y}^2 \leq 4\). The range of the map has coordinates \((x,y,z)\).
Consider a sphere with center \(C^i\) and radius \(R\) that is intersected by two planes normal to the \(z\) axis located at \(z = z_\mathrm{L}\) and \(z = z_\mathrm{U}\), with \(z_\mathrm{L} < z_\mathrm{U}\). Side
provides the following functions:
forward_map()
maps \((\bar{x},\bar{y},\bar{z})\) to a point on the inner surface \(\bar{x}^2+\bar{y}^2=1\) by dividing \(\bar{x}\) and \(\bar{y}\) by \((1+\sigma)\), where \(\sigma\) is the function given by Eq. (7) below. Then it maps that point to a point on the portion of the sphere with \(z_\mathrm{L} \leq z \leq z_\mathrm{U}\). forward_map()
returns \(x_0^i\), the 3D coordinates on that sphere, which are given by
\begin{align} x_0^0 &= R \sin\theta \frac{\bar{x}}{1+\sigma} + C^0,\\ x_0^1 &= R \sin\theta \frac{\bar{y}}{1+\sigma} + C^1,\\ x_0^2 &= R \cos\theta + C^2.\\ \end{align}
Here
\begin{align} \theta = \theta_\mathrm{max} + (\theta_\mathrm{min}-\theta_\mathrm{max}) \frac{\bar{z}+1}{2}, \end{align}
where
\begin{align} \cos(\theta_\mathrm{max}) &= (z_\mathrm{L}-C^2)/R,\\ \cos(\theta_\mathrm{min}) &= (z_\mathrm{U}-C^2)/R. \end{align}
Note that \(\theta\) decreases with increasing \(\bar{z}\), which is the usual convention for a polar angle but might otherwise cause confusion.
\(\sigma\) is a function that is zero on the sphere \(x^i=x_0^i\) and unity at \(\bar{x}^2+\bar{y}^2=4\) (corresponding to the upper surface of the FocallyLiftedMap). We define
\begin{align} \sigma &= \sqrt{\bar{x}^2+\bar{y}^2}-1. \end{align}
deriv_sigma
returns
\begin{align} \frac{\partial \sigma}{\partial \bar{x}^j} &= \left(\frac{\bar{x}}{1+\sigma}, \frac{\bar{y}}{1+\sigma},0\right). \end{align}
jacobian
returns \(\partial x_0^k/\partial \bar{x}^j\). The arguments to jacobian
are \((\bar{x},\bar{y},\bar{z})\). Differentiating Eqs.(1–4) above yields
\begin{align*} \frac{\partial x_0^0}{\partial \bar{x}} &= R \sin\theta \frac{\bar{y}^2}{(1+\sigma)^3}, \\ \frac{\partial x_0^0}{\partial \bar{y}} &= -R \sin\theta \frac{\bar{x}\bar{y}}{(1+\sigma)^3}, \\ \frac{\partial x_0^0}{\partial \bar{z}} &= R \cos\theta \frac{\theta_\mathrm{min}-\theta_\mathrm{max}}{2(1+\sigma)} \bar{x},\\ \frac{\partial x_0^1}{\partial \bar{x}} &= -R \sin\theta \frac{\bar{x}\bar{y}}{(1+\sigma)^3}, \\ \frac{\partial x_0^1}{\partial \bar{y}} &= R \sin\theta \frac{\bar{x}^2}{(1+\sigma)^3}, \\ \frac{\partial x_0^1}{\partial \bar{z}} &= R \cos\theta \frac{\theta_\mathrm{min}-\theta_\mathrm{max}}{2(1+\sigma)} \bar{y},\\ \frac{\partial x_0^2}{\partial \bar{x}} &= 0,\\ \frac{\partial x_0^2}{\partial \bar{y}} &= 0,\\ \frac{\partial x_0^2}{\partial \bar{z}} &= - R \sin\theta \frac{\theta_\mathrm{min}-\theta_\mathrm{max}}{2}. \end{align*}
inverse
takes \(x_0^i\) and \(\sigma\) as arguments, and returns \((\bar{x},\bar{y},\bar{z})\), or a default-constructed std::optional<std::array<double, 3>>
if \(x_0^i\) or \(\sigma\) are outside the range of the map.
If \(\sigma\) is outside the range \([0,1]\) then we return a default-constructed std::optional<std::array<double, 3>>
.
To get \(\bar{z}\) we invert Eq. (4):
\begin{align} \bar{z} &= 2\frac{\acos\left((x_0^2-C^2)/R\right)-\theta_\mathrm{max}} {\theta_\mathrm{min}-\theta_\mathrm{max}} - 1. \end{align}
If \(\bar{z}\) is outside the range \([-1,1]\) then we return a default-constructed std::optional<std::array<double, 3>>
.
To compute \(\bar{x}\) and \(\bar{y}\), we invert Eqs. (1–3) and use \(\sigma\):
\begin{align} \bar{x} &= \frac{(x_0^0-C^0) (1+\sigma)}{\rho},\\ \bar{y} &= \frac{(x_0^1-C^1) (1+\sigma)}{\rho}, \end{align}
where
\begin{align} \rho = \sqrt{(x_0^0-C^0)^2+(x_0^1-C^1)^2}. \end{align}
lambda_tilde
takes as arguments a point \(x^i\) and a projection point \(P^i\), and computes \(\tilde{\lambda}\), the solution to
\begin{align} x_0^i = P^i + (x^i - P^i) \tilde{\lambda}.\end{align}
Since \(x_0^i\) must lie on the sphere, \(\tilde{\lambda}\) is the solution of the quadratic equation
\begin{align} |P^i + (x^i - P^i) \tilde{\lambda} - C^i |^2 - R^2 = 0. \end{align}
In solving the quadratic, we choose the larger root if \(x^2>z_\mathrm{P}\) and the smaller root otherwise. We demand that the root is greater than unity. If there is no such root, this means that the point \(x^i\) is not in the range of the map so we return a default-constructed std::optional<double>
.
deriv_lambda_tilde
takes as arguments \(x_0^i\), a projection point \(P^i\), and \(\tilde{\lambda}\), and returns \(\partial \tilde{\lambda}/\partial x^i\). By differentiating Eq. (14), we find
\begin{align} \frac{\partial\tilde{\lambda}}{\partial x^j} &= \tilde{\lambda}^2 \frac{C^j - x_0^j}{ (x_0^i - P^i)(x_{0i} - C_{i})} \nonumber \\ &= \tilde{\lambda}^2 \frac{C^j - x_0^j}{|x_0^i - P^i|^2 + (x_0^i - P^i)(P_i - C_{i})}. \end{align}
inv_jacobian
returns \(\partial \bar{x}^i/\partial x_0^k\), where \(\sigma\) is held fixed. The arguments to inv_jacobian
are \((\bar{x},\bar{y},\bar{z})\).
Note from Eqs. (9–12) that \(\bar{x}\) and \(\bar{y}\) depend only on \(x_0^0\) and \(x_0^1\) but not on \(x_0^2\).
By differentiating Eqs. (9–12), we find
\begin{align*} \frac{\partial \bar{x}}{\partial x_0^0} &= \frac{\bar{y}^2}{(1+\sigma)\rho},\\ \frac{\partial \bar{x}}{\partial x_0^1} &= - \frac{\bar{x}\bar{y}}{(1+\sigma)\rho},\\ \frac{\partial \bar{x}}{\partial x_0^2} &= 0,\\ \frac{\partial \bar{y}}{\partial x_0^0} &= - \frac{\bar{x}\bar{y}}{(1+\sigma)\rho},\\ \frac{\partial \bar{y}}{\partial x_0^1} &= \frac{\bar{x}^2}{(1+\sigma)\rho},\\ \frac{\partial \bar{y}}{\partial x_0^2} &= 0,\\ \frac{\partial \bar{z}}{\partial x_0^0} &= 0,\\ \frac{\partial \bar{z}}{\partial x_0^1} &= 0,\\ \frac{\partial \bar{z}}{\partial x_0^2} &= -\frac{2}{\rho(\theta_\mathrm{min}-\theta_\mathrm{max})}, \end{align*}
where
\[ \rho = R \sin\theta = R\sin\left(\theta_\mathrm{max} + (\theta_\mathrm{min}-\theta_\mathrm{max}) \frac{\bar{z}+1}{2}\right), \]
which is also equal to the quantity in Eq. (12).
dxbar_dsigma
returns \(\partial \bar{x}^i/\partial \sigma\), where \(x_0^i\) is held fixed.
From Eqs. (10) and (11) we have
\begin{align} \frac{\partial \bar{x}^i}{\partial \sigma} &= \left(\frac{\bar{x}}{\sqrt{\bar{x}^2+\bar{y}^2}}, \frac{\bar{y}}{\sqrt{\bar{x}^2+\bar{y}^2}},0\right). \end{align}