SpECTRE  v2024.12.16
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
gh::gauges Namespace Reference

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

Classes

class  AnalyticChristoffel
 Imposes the analytic gauge condition, Ha=Γaanalytic 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, Ha=0. More...
 
struct  SetPiAndPhiFromConstraints
 Set Πab from the gauge source function (or 1-index constraint) and Φiab from the 3-index constraint. More...
 

Typedefs

using all_gauges = implementation defined
 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.5nanbΠab and 0.5nanbΦ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 and . 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 Ha is written as:

Ha:=[1R(t)]Hainit+[μL1log(g/N)+μL2log(1/N)]taμSgaiNi/N

where N,Nk are the lapse and shift respectively, ta is the unit normal one-form to the spatial slice, and gab is the spatial metric (obtained by projecting the spacetime metric onto the 3-slice, i.e. gab=ψab+tatb). The prefactors are:

μL1=AL1R(t)W(xi)log(g/N)eL1,μL2=AL2R(t)W(xi)log(1/N)eL2,μS=ASR(t)W(xi)log(g/N)eS,

temporal roll-on function R(t) is:

R(t)=0,t<t0=1exp[((tt0)/σt)4],tt0

and the spatial weight function is:

W(xi)=exp[(r/σr)2].

This weight function can be written with multiple constant factors in the exponent in literature , but we absorb them all into σr here. The coordinate r is the Euclidean radius in Inertial coordinates.

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

  • Amplitude factors AX are taken as input here as amp_coef_X
  • Exponents eX are taken as input here as exp_X.
  • Spatial weight function W is specified completely by σr, which is taken as input here as sigma_r.

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

aHb=aT1+aT2+aT3,Ha=T1+T2+T3,

where:

T1=[1R(t)]Hainit,T2=[μL1log(g/N)+μL2log(1/N)]ta,T3=μSgaiNi/N.

Derivation:

For T1, the derivatives are:

aT1=(1R(t))aHbinitHbinitaR.

Write T2(μ1+μ2)tb. Then:

aT2=(aμ1+aμ2)tb+(μ1+μ2)atb,

where

atb=(aN,0,0,0)aμ1=a[AL1R(t)W(xi)log(g/N)eL1+1],=AL1R(t)W(xi)a[log(g/N)eL1+1]+AL1log(g/N)eL1+1a[R(t)W(xi)],aμ2=a[AL2R(t)W(xi)log(1/N)eL2+1],=AL2R(t)W(xi)a[log(1/N)eL2+1]+AL2log(1/N)eL2+1a[R(t)W(xi)],

where a[RW]=(0R(t),iW(xj)).

Finally, the derivatives of T3 are:

aT3=a(μS/N)gbiNi(μS/N)a(gbi)Ni(μS/N)gbiaNi,

where

a(μS/N)=(1/N)aμSμSN2aN,andaμS=a[ASR(t)W(xi)log(g/N)eS],=ASR(t)W(xi)a[log(g/N)eS]+ASlog(g/N)eSa[R(t)W(xi)].

◆ 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 [185] and . 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 Ha is written as:

Ha:=[1R(t)]Hainit+[μL1log(g/N)+μL2log(1/N)]taμSgaiNi/N

where N,Nk are the lapse and shift respectively, ta is the unit normal one-form to the spatial slice, and gab is the spatial metric (obtained by projecting the spacetime metric onto the 3-slice, i.e. gab=ψab+tatb). The prefactors are:

μL1=AL1R(t)W(xi)log(g/N)eL1,μL2=AL2R(t)W(xi)log(1/N)eL2,μS=ASR(t)W(xi)log(g/N)eS,

temporal roll-on function R(t) is:

R(t)=0,t<t0=1exp[((tt0)/σt)4],tt0

and the spatial weight function is:

W(xi)=exp[(r/σr)2].

This weight function can be written with multiple constant factors in the exponent in literature , but we absorb them all into σr here. The coordinate r is the Euclidean radius in Inertial coordinates.

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

  • Amplitude factors AX are taken as input here as amp_coef_X
  • Exponents eX are taken as input here as exp_X.
  • Spatial weight function W is specified completely by σr, which is taken as input here as sigma_r.

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

aHb=aT1+aT2+aT3,Ha=T1+T2+T3,

where:

T1=[1R(t)]Hainit,T2=[μL1log(g/N)+μL2log(1/N)]ta,T3=μSgaiNi/N.

Derivation:

For T1, the derivatives are:

aT1=(1R(t))aHbinitHbinitaR.

Write T2(μ1+μ2)tb. Then:

aT2=(aμ1+aμ2)tb+(μ1+μ2)atb,

where

atb=(aN,0,0,0)aμ1=a[AL1R(t)W(xi)log(g/N)eL1+1],=AL1R(t)W(xi)a[log(g/N)eL1+1]+AL1log(g/N)eL1+1a[R(t)W(xi)],aμ2=a[AL2R(t)W(xi)log(1/N)eL2+1],=AL2R(t)W(xi)a[log(1/N)eL2+1]+AL2log(1/N)eL2+1a[R(t)W(xi)],

where a[RW]=(0R(t),iW(xj)).

Finally, the derivatives of T3 are:

aT3=a(μS/N)gbiNi(μS/N)a(gbi)Ni(μS/N)gbiaNi,

where

a(μS/N)=(1/N)aμSμSN2aN,andaμS=a[ASR(t)W(xi)log(g/N)eS],=ASR(t)W(xi)a[log(g/N)eS]+ASlog(g/N)eSa[R(t)W(xi)].

◆ 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.