SpECTRE  v2024.04.12
gh::gauges Namespace Reference

Gauge conditions for generalized harmonic evolution systems. More...

Classes

class  AnalyticChristoffel
 Imposes the analytic gauge condition, \(H_a=\Gamma_a^{\mathrm{analytic}}\) from an analytic solution or analytic data. More...
 
class  DampedHarmonic
 Impose damped harmonic gauge. More...
 
struct  DhGaugeParameters
 A struct holding the parameters for initializing damped harmonic gauge. More...
 
class  GaugeCondition
 Base class for GH gauge conditions. More...
 
class  Harmonic
 Imposes the harmonic gauge condition, \(H_a=0\). More...
 
struct  SetPiAndPhiFromConstraints
 Set \(\Pi_{ab}\) from the gauge source function (or 1-index constraint) and \(\Phi_{iab}\) from the 3-index constraint. More...
 

Typedefs

using all_gauges = tmpl::list< AnalyticChristoffel, DampedHarmonic, Harmonic >
 List of all gauge conditions.
 

Functions

template<size_t SpatialDim, typename Frame >
void damped_harmonic_rollon (gsl::not_null< tnsr::a< DataVector, SpatialDim, Frame > * > gauge_h, gsl::not_null< tnsr::ab< DataVector, SpatialDim, Frame > * > d4_gauge_h, const tnsr::a< DataVector, SpatialDim, Frame > &gauge_h_init, const tnsr::ab< DataVector, SpatialDim, Frame > &dgauge_h_init, const Scalar< DataVector > &lapse, const tnsr::I< DataVector, SpatialDim, Frame > &shift, const Scalar< DataVector > &sqrt_det_spatial_metric, const tnsr::II< DataVector, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::abb< DataVector, SpatialDim, Frame > &d4_spacetime_metric, const Scalar< DataVector > &half_pi_two_normals, const tnsr::i< DataVector, SpatialDim, Frame > &half_phi_two_normals, const tnsr::aa< DataVector, SpatialDim, Frame > &spacetime_metric, const tnsr::iaa< DataVector, SpatialDim, Frame > &phi, double time, const tnsr::I< DataVector, SpatialDim, Frame > &coords, double amp_coef_L1, double amp_coef_L2, double amp_coef_S, int exp_L1, int exp_L2, int exp_S, double rollon_start_time, double rollon_width, double sigma_r)
 Damped harmonic gauge source function and its spacetime derivative. More...
 
template<size_t SpatialDim, typename Frame >
void damped_harmonic (gsl::not_null< tnsr::a< DataVector, SpatialDim, Frame > * > gauge_h, gsl::not_null< tnsr::ab< DataVector, SpatialDim, Frame > * > d4_gauge_h, const Scalar< DataVector > &lapse, const tnsr::I< DataVector, SpatialDim, Frame > &shift, const Scalar< DataVector > &sqrt_det_spatial_metric, const tnsr::II< DataVector, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::abb< DataVector, SpatialDim, Frame > &d4_spacetime_metric, const Scalar< DataVector > &half_pi_two_normals, const tnsr::i< DataVector, SpatialDim, Frame > &half_phi_two_normals, const tnsr::aa< DataVector, SpatialDim, Frame > &spacetime_metric, const tnsr::iaa< DataVector, SpatialDim, Frame > &phi, const tnsr::I< DataVector, SpatialDim, Frame > &coords, double amp_coef_L1, double amp_coef_L2, double amp_coef_S, int exp_L1, int exp_L2, int exp_S, double sigma_r)
 Damped harmonic gauge source function and its spacetime derivative. More...
 
template<size_t Dim>
void dispatch (gsl::not_null< tnsr::a< DataVector, Dim, Frame::Inertial > * > gauge_h, gsl::not_null< tnsr::ab< DataVector, Dim, Frame::Inertial > * > d4_gauge_h, const Scalar< DataVector > &lapse, const tnsr::I< DataVector, Dim, Frame::Inertial > &shift, const Scalar< DataVector > &sqrt_det_spatial_metric, const tnsr::II< DataVector, Dim, Frame::Inertial > &inverse_spatial_metric, const tnsr::abb< DataVector, Dim, Frame::Inertial > &d4_spacetime_metric, const Scalar< DataVector > &half_pi_two_normals, const tnsr::i< DataVector, Dim, Frame::Inertial > &half_phi_two_normals, const tnsr::aa< DataVector, Dim, Frame::Inertial > &spacetime_metric, const tnsr::iaa< DataVector, Dim, Frame::Inertial > &phi, const Mesh< Dim > &mesh, double time, const tnsr::I< DataVector, Dim, Frame::Inertial > &inertial_coords, const InverseJacobian< DataVector, Dim, Frame::ElementLogical, Frame::Inertial > &inverse_jacobian, const GaugeCondition &gauge_condition)
 Dispatch to the derived gauge condition. More...
 
template<size_t Dim, typename Frame >
void half_pi_and_phi_two_normals (gsl::not_null< Scalar< DataVector > * > half_pi_two_normals, gsl::not_null< tnsr::i< DataVector, Dim, Frame > * > half_phi_two_normals, const tnsr::A< DataVector, Dim, Frame > &spacetime_normal_vector, const tnsr::aa< DataVector, Dim, Frame > &pi, const tnsr::iaa< DataVector, Dim, Frame > &phi)
 Compute \(0.5 n^a n^b \Pi_{ab}\) and \(0.5 n^a n^b \Phi_{iab}\).
 
void register_derived_with_charm ()
 

Detailed Description

Gauge conditions for generalized harmonic evolution systems.

Function Documentation

◆ damped_harmonic()

template<size_t SpatialDim, typename Frame >
void gh::gauges::damped_harmonic ( gsl::not_null< tnsr::a< DataVector, SpatialDim, Frame > * >  gauge_h,
gsl::not_null< tnsr::ab< DataVector, SpatialDim, Frame > * >  d4_gauge_h,
const Scalar< DataVector > &  lapse,
const tnsr::I< DataVector, SpatialDim, Frame > &  shift,
const Scalar< DataVector > &  sqrt_det_spatial_metric,
const tnsr::II< DataVector, SpatialDim, Frame > &  inverse_spatial_metric,
const tnsr::abb< DataVector, SpatialDim, Frame > &  d4_spacetime_metric,
const Scalar< DataVector > &  half_pi_two_normals,
const tnsr::i< DataVector, SpatialDim, Frame > &  half_phi_two_normals,
const tnsr::aa< DataVector, SpatialDim, Frame > &  spacetime_metric,
const tnsr::iaa< DataVector, SpatialDim, Frame > &  phi,
const tnsr::I< DataVector, SpatialDim, Frame > &  coords,
double  amp_coef_L1,
double  amp_coef_L2,
double  amp_coef_S,
int  exp_L1,
int  exp_L2,
int  exp_S,
double  sigma_r 
)

Damped harmonic gauge source function and its spacetime derivative.

Details

The gauge condition has been taken from [175] and [50]. We provide both a "rollon" version (damped_harmonic_rollon), and a "non-rollon" version (damped_harmonic). In the non-rollon version the rollon function \(R(t)=1\).

Warning
Only the non-rollon version can be used with a moving mesh.

The covariant form of the source function \(H_a\) is written as:

\begin{align*} H_a := [1 - R(t)] H_a^\mathrm{init} + [\mu_{L1} \mathrm{log}(\sqrt{g}/N) + \mu_{L2} \mathrm{log}(1/N)] t_a - \mu_S g_{ai} N^i / N \end{align*}

where \(N, N^k\) are the lapse and shift respectively, \(t_a\) is the unit normal one-form to the spatial slice, and \(g_{ab}\) is the spatial metric (obtained by projecting the spacetime metric onto the 3-slice, i.e. \(g_{ab} = \psi_{ab} + t_a t_b\)). The prefactors are:

\begin{align*} \mu_{L1} &= A_{L1} R(t) W(x^i) \mathrm{log}(\sqrt{g}/N)^{e_{L1}}, \\ \mu_{L2} &= A_{L2} R(t) W(x^i) \mathrm{log}(1/N)^{e_{L2}}, \\ \mu_{S} &= A_{S} R(t) W(x^i) \mathrm{log}(\sqrt{g}/N)^{e_{S}}, \end{align*}

temporal roll-on function \( R(t)\) is:

\begin{align*} \begin{array}{ll} R(t) & = 0, & t< t_{0} \\ & = 1 - \exp[-((t - t_{0})/ \sigma_t)^4], & t\geq t_{0} \\ \end{array} \end{align*}

and the spatial weight function is:

\begin{align*} W(x^i) = \exp[-(r/\sigma_r)^2]. \end{align*}

This weight function can be written with multiple constant factors in the exponent in literature [50], but we absorb them all into \( \sigma_r\) here. The coordinate \( r\) is the Euclidean radius in Inertial coordinates.

Note that for the last three terms in \(H_a\) (with \( X = \{L1, L2, S\} \)):

  • Amplitude factors \( A_{X} \) are taken as input here as amp_coef_X
  • Exponents \( e_X\) are taken as input here as exp_X.
  • Spatial weight function \(W\) is specified completely by \(\sigma_r\), which is taken as input here as sigma_r.

Also computes spacetime derivatives, i.e. \(\partial_a H_b\), of the damped harmonic source function H. Using notation from damped_harmonic_h(), we rewrite the same as:

\begin{align*} \partial_a H_b =& \partial_a T_1 + \partial_a T_2 + \partial_a T_3, \\ H_a =& T_1 + T_2 + T_3, \end{align*}

where:

\begin{align*} T_1 =& [1 - R(t)] H_a^\mathrm{init}, \\ T_2 =& [\mu_{L1} \mathrm{log}(\sqrt{g}/N) + \mu_{L2} \mathrm{log}(1/N)] t_a, \\ T_3 =& - \mu_S g_{ai} N^i / N. \end{align*}

Derivation:

\(\blacksquare\) For \( T_1 \), the derivatives are:

\begin{align*} \partial_a T_1 = (1 - R(t)) \partial_a H_b^\mathrm{init} - H_b^\mathrm{init} \partial_a R. \end{align*}

\(\blacksquare\) Write \( T_2 \equiv (\mu_1 + \mu_2) t_b \). Then:

\begin{align*} \partial_a T_2 =& (\partial_a \mu_1 + \partial_a \mu_2) t_b \\ +& (\mu_1 + \mu_2) \partial_a t_b, \end{align*}

where

\begin{align*} \partial_a t_b =& \left(-\partial_a N, 0, 0, 0\right) \\ \partial_a \mu_1 =& \partial_a [A_{L1} R(t) W(x^i) \mathrm{log}(\sqrt{g}/N)^{e_{L1} + 1}], \\ =& A_{L1} R(t) W(x^i) \partial_a [\mathrm{log}(\sqrt{g}/N)^{e_{L1} + 1}] \\ +& A_{L1} \mathrm{log}(\sqrt{g}/N)^{e_{L1} + 1} \partial_a [R(t) W(x^i)],\\ \partial_a \mu_2 =& \partial_a [A_{L2} R(t) W(x^i) \mathrm{log}(1/N)^{e_{L2} + 1}], \\ =& A_{L2} R(t) W(x^i) \partial_a [\mathrm{log}(1/N)^{e_{L2} + 1}] \\ +& A_{L2} \mathrm{log}(1/N)^{e_{L2} + 1} \partial_a [R(t) W(x^i)], \end{align*}

where \(\partial_a [R W] = \left(\partial_0 R(t), \partial_i W(x^j)\right)\).

\(\blacksquare\) Finally, the derivatives of \( T_3 \) are:

\[ \partial_a T_3 = -\partial_a(\mu_S/N) g_{bi} N^i -(\mu_S/N) \partial_a(g_{bi}) N^i -(\mu_S/N) g_{bi}\partial_a N^i, \]

where

\begin{align*} \partial_a(\mu_S / N) =& (1/N)\partial_a \mu_S - \frac{\mu_S}{N^2}\partial_a N, \,\,\mathrm{and}\\ \partial_a \mu_S =& \partial_a [A_S R(t) W(x^i) \mathrm{log}(\sqrt{g}/N)^{e_S}], \\ =& A_S R(t) W(x^i) \partial_a [\mathrm{log}(\sqrt{g}/N)^{e_S}] \\ +& A_S \mathrm{log}(\sqrt{g} / N)^{e_S} \partial_a [R(t) W(x^i)]. \end{align*}

◆ damped_harmonic_rollon()

template<size_t SpatialDim, typename Frame >
void gh::gauges::damped_harmonic_rollon ( gsl::not_null< tnsr::a< DataVector, SpatialDim, Frame > * >  gauge_h,
gsl::not_null< tnsr::ab< DataVector, SpatialDim, Frame > * >  d4_gauge_h,
const tnsr::a< DataVector, SpatialDim, Frame > &  gauge_h_init,
const tnsr::ab< DataVector, SpatialDim, Frame > &  dgauge_h_init,
const Scalar< DataVector > &  lapse,
const tnsr::I< DataVector, SpatialDim, Frame > &  shift,
const Scalar< DataVector > &  sqrt_det_spatial_metric,
const tnsr::II< DataVector, SpatialDim, Frame > &  inverse_spatial_metric,
const tnsr::abb< DataVector, SpatialDim, Frame > &  d4_spacetime_metric,
const Scalar< DataVector > &  half_pi_two_normals,
const tnsr::i< DataVector, SpatialDim, Frame > &  half_phi_two_normals,
const tnsr::aa< DataVector, SpatialDim, Frame > &  spacetime_metric,
const tnsr::iaa< DataVector, SpatialDim, Frame > &  phi,
double  time,
const tnsr::I< DataVector, SpatialDim, Frame > &  coords,
double  amp_coef_L1,
double  amp_coef_L2,
double  amp_coef_S,
int  exp_L1,
int  exp_L2,
int  exp_S,
double  rollon_start_time,
double  rollon_width,
double  sigma_r 
)

Damped harmonic gauge source function and its spacetime derivative.

Details

The gauge condition has been taken from [175] and [50]. We provide both a "rollon" version (damped_harmonic_rollon), and a "non-rollon" version (damped_harmonic). In the non-rollon version the rollon function \(R(t)=1\).

Warning
Only the non-rollon version can be used with a moving mesh.

The covariant form of the source function \(H_a\) is written as:

\begin{align*} H_a := [1 - R(t)] H_a^\mathrm{init} + [\mu_{L1} \mathrm{log}(\sqrt{g}/N) + \mu_{L2} \mathrm{log}(1/N)] t_a - \mu_S g_{ai} N^i / N \end{align*}

where \(N, N^k\) are the lapse and shift respectively, \(t_a\) is the unit normal one-form to the spatial slice, and \(g_{ab}\) is the spatial metric (obtained by projecting the spacetime metric onto the 3-slice, i.e. \(g_{ab} = \psi_{ab} + t_a t_b\)). The prefactors are:

\begin{align*} \mu_{L1} &= A_{L1} R(t) W(x^i) \mathrm{log}(\sqrt{g}/N)^{e_{L1}}, \\ \mu_{L2} &= A_{L2} R(t) W(x^i) \mathrm{log}(1/N)^{e_{L2}}, \\ \mu_{S} &= A_{S} R(t) W(x^i) \mathrm{log}(\sqrt{g}/N)^{e_{S}}, \end{align*}

temporal roll-on function \( R(t)\) is:

\begin{align*} \begin{array}{ll} R(t) & = 0, & t< t_{0} \\ & = 1 - \exp[-((t - t_{0})/ \sigma_t)^4], & t\geq t_{0} \\ \end{array} \end{align*}

and the spatial weight function is:

\begin{align*} W(x^i) = \exp[-(r/\sigma_r)^2]. \end{align*}

This weight function can be written with multiple constant factors in the exponent in literature [50], but we absorb them all into \( \sigma_r\) here. The coordinate \( r\) is the Euclidean radius in Inertial coordinates.

Note that for the last three terms in \(H_a\) (with \( X = \{L1, L2, S\} \)):

  • Amplitude factors \( A_{X} \) are taken as input here as amp_coef_X
  • Exponents \( e_X\) are taken as input here as exp_X.
  • Spatial weight function \(W\) is specified completely by \(\sigma_r\), which is taken as input here as sigma_r.

Also computes spacetime derivatives, i.e. \(\partial_a H_b\), of the damped harmonic source function H. Using notation from damped_harmonic_h(), we rewrite the same as:

\begin{align*} \partial_a H_b =& \partial_a T_1 + \partial_a T_2 + \partial_a T_3, \\ H_a =& T_1 + T_2 + T_3, \end{align*}

where:

\begin{align*} T_1 =& [1 - R(t)] H_a^\mathrm{init}, \\ T_2 =& [\mu_{L1} \mathrm{log}(\sqrt{g}/N) + \mu_{L2} \mathrm{log}(1/N)] t_a, \\ T_3 =& - \mu_S g_{ai} N^i / N. \end{align*}

Derivation:

\(\blacksquare\) For \( T_1 \), the derivatives are:

\begin{align*} \partial_a T_1 = (1 - R(t)) \partial_a H_b^\mathrm{init} - H_b^\mathrm{init} \partial_a R. \end{align*}

\(\blacksquare\) Write \( T_2 \equiv (\mu_1 + \mu_2) t_b \). Then:

\begin{align*} \partial_a T_2 =& (\partial_a \mu_1 + \partial_a \mu_2) t_b \\ +& (\mu_1 + \mu_2) \partial_a t_b, \end{align*}

where

\begin{align*} \partial_a t_b =& \left(-\partial_a N, 0, 0, 0\right) \\ \partial_a \mu_1 =& \partial_a [A_{L1} R(t) W(x^i) \mathrm{log}(\sqrt{g}/N)^{e_{L1} + 1}], \\ =& A_{L1} R(t) W(x^i) \partial_a [\mathrm{log}(\sqrt{g}/N)^{e_{L1} + 1}] \\ +& A_{L1} \mathrm{log}(\sqrt{g}/N)^{e_{L1} + 1} \partial_a [R(t) W(x^i)],\\ \partial_a \mu_2 =& \partial_a [A_{L2} R(t) W(x^i) \mathrm{log}(1/N)^{e_{L2} + 1}], \\ =& A_{L2} R(t) W(x^i) \partial_a [\mathrm{log}(1/N)^{e_{L2} + 1}] \\ +& A_{L2} \mathrm{log}(1/N)^{e_{L2} + 1} \partial_a [R(t) W(x^i)], \end{align*}

where \(\partial_a [R W] = \left(\partial_0 R(t), \partial_i W(x^j)\right)\).

\(\blacksquare\) Finally, the derivatives of \( T_3 \) are:

\[ \partial_a T_3 = -\partial_a(\mu_S/N) g_{bi} N^i -(\mu_S/N) \partial_a(g_{bi}) N^i -(\mu_S/N) g_{bi}\partial_a N^i, \]

where

\begin{align*} \partial_a(\mu_S / N) =& (1/N)\partial_a \mu_S - \frac{\mu_S}{N^2}\partial_a N, \,\,\mathrm{and}\\ \partial_a \mu_S =& \partial_a [A_S R(t) W(x^i) \mathrm{log}(\sqrt{g}/N)^{e_S}], \\ =& A_S R(t) W(x^i) \partial_a [\mathrm{log}(\sqrt{g}/N)^{e_S}] \\ +& A_S \mathrm{log}(\sqrt{g} / N)^{e_S} \partial_a [R(t) W(x^i)]. \end{align*}

◆ dispatch()

template<size_t Dim>
void gh::gauges::dispatch ( gsl::not_null< tnsr::a< DataVector, Dim, Frame::Inertial > * >  gauge_h,
gsl::not_null< tnsr::ab< DataVector, Dim, Frame::Inertial > * >  d4_gauge_h,
const Scalar< DataVector > &  lapse,
const tnsr::I< DataVector, Dim, Frame::Inertial > &  shift,
const Scalar< DataVector > &  sqrt_det_spatial_metric,
const tnsr::II< DataVector, Dim, Frame::Inertial > &  inverse_spatial_metric,
const tnsr::abb< DataVector, Dim, Frame::Inertial > &  d4_spacetime_metric,
const Scalar< DataVector > &  half_pi_two_normals,
const tnsr::i< DataVector, Dim, Frame::Inertial > &  half_phi_two_normals,
const tnsr::aa< DataVector, Dim, Frame::Inertial > &  spacetime_metric,
const tnsr::iaa< DataVector, Dim, Frame::Inertial > &  phi,
const Mesh< Dim > &  mesh,
double  time,
const tnsr::I< DataVector, Dim, Frame::Inertial > &  inertial_coords,
const InverseJacobian< DataVector, Dim, Frame::ElementLogical, Frame::Inertial > &  inverse_jacobian,
const GaugeCondition gauge_condition 
)

Dispatch to the derived gauge condition.

Which of the arguments to this function are used will depend on the gauge condition, but since that is a runtime choice we need support for all gauge conditions.