SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GeneralizedHarmonic/GaugeSourceFunctions - DampedWaveHelpers.hpp Hit Total Coverage
Commit: 9f349d3c09e1c03107f00c2135ca40e209d3b84c Lines: 0 1 0.0 %
Date: 2023-06-09 21:05:06
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <cstddef>
       7             : 
       8             : #include "DataStructures/Tensor/TypeAliases.hpp"
       9             : #include "Utilities/Gsl.hpp"
      10             : 
      11             : namespace gh {
      12             : namespace gauges {
      13             : namespace DampedHarmonicGauge_detail {
      14             : /*
      15             :  * Spatial weight function used in the damped harmonic gauge source
      16             :  * function.
      17             :  *
      18             :  * The spatial weight function is:
      19             :  * \f{align*}{
      20             :  *   W(x^i) = \exp(- (r / \sigma_r)^2),
      21             :  * \f}
      22             :  *
      23             :  * where \f$r=\sqrt{x^i\delta_{ij}x^j}\f$ is the coordinate radius, and
      24             :  * \f$\sigma_r\f$ is the width of the Gaussian.
      25             :  *
      26             :  * This function can be written with an extra factor inside the exponent in
      27             :  * literature, e.g. \cite Deppe2018uye. We absorb that in \f$\sigma_r\f$.
      28             :  */
      29             : template <typename DataType, size_t SpatialDim, typename Frame>
      30             : void spatial_weight_function(gsl::not_null<Scalar<DataType>*> weight,
      31             :                              const tnsr::I<DataType, SpatialDim, Frame>& coords,
      32             :                              double sigma_r);
      33             : 
      34             : /*
      35             :  * Spacetime derivatives of the spatial weight function that enters the
      36             :  * damped harmonic gauge source function.
      37             :  *
      38             :  * Compute the derivatives:
      39             :  * \f{align*}{
      40             :  * \partial_a W(x^i)= \partial_a \exp(- (r/\sigma_r)^2)
      41             :  *                  = (-2 * x^i / \sigma_r^2) * exp(-(r/\sigma_r)^2)
      42             :  * \f}
      43             :  *
      44             :  * where \f$r=\sqrt{x^i\delta_{ij}x^j}\f$ is the coordinate radius, and
      45             :  * \f$\sigma_r\f$ is the width of the Gaussian. Since the weight function is
      46             :  * spatial, the time derivative is always zero.
      47             :  */
      48             : template <typename DataType, size_t SpatialDim, typename Frame>
      49             : void spacetime_deriv_of_spatial_weight_function(
      50             :     gsl::not_null<tnsr::a<DataType, SpatialDim, Frame>*> d4_weight,
      51             :     const tnsr::I<DataType, SpatialDim, Frame>& coords, double sigma_r,
      52             :     const Scalar<DataType>& weight_function);
      53             : 
      54             : /*
      55             :  * The log factor that appears in damped harmonic gauge source function.
      56             :  *
      57             :  * Calculates:  \f$ logF = \mathrm{log}(g^p/N) \f$.
      58             :  */
      59             : template <typename DataType>
      60             : void log_factor_metric_lapse(gsl::not_null<Scalar<DataType>*> logfac,
      61             :                              const Scalar<DataType>& lapse,
      62             :                              const Scalar<DataType>& sqrt_det_spatial_metric,
      63             :                              double exponent);
      64             : 
      65             : template <typename DataType>
      66             : Scalar<DataType> log_factor_metric_lapse(
      67             :     const Scalar<DataType>& lapse,
      68             :     const Scalar<DataType>& sqrt_det_spatial_metric, double exponent);
      69             : 
      70             : /*
      71             :  * Spacetime derivatives of the log factor that appears in the
      72             :  * damped harmonic gauge source function.
      73             :  *
      74             :  * Computes the spacetime derivatives:
      75             :  * \f{align*}{
      76             :  *  \partial_a logF = (p/g)\partial_a g - (1/N)\partial_a N
      77             :  * \f}
      78             :  */
      79             : template <typename DataType, size_t SpatialDim, typename Frame>
      80             : void spacetime_deriv_of_log_factor_metric_lapse(
      81             :     gsl::not_null<tnsr::a<DataType, SpatialDim, Frame>*> d4_logfac,
      82             :     const Scalar<DataType>& lapse,
      83             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      84             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
      85             :     const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
      86             :     const Scalar<DataType>& sqrt_det_spatial_metric,
      87             :     const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
      88             :     const tnsr::aa<DataType, SpatialDim, Frame>& pi,
      89             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi, double exponent);
      90             : 
      91             : template <typename DataType, size_t SpatialDim, typename Frame>
      92             : tnsr::a<DataType, SpatialDim, Frame> spacetime_deriv_of_log_factor_metric_lapse(
      93             :     const Scalar<DataType>& lapse,
      94             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
      95             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
      96             :     const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
      97             :     const Scalar<DataType>& sqrt_det_spatial_metric,
      98             :     const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
      99             :     const tnsr::aa<DataType, SpatialDim, Frame>& pi,
     100             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi, double exponent);
     101             : 
     102             : /*
     103             :  * Spacetime derivatives of the log factor (that appears in
     104             :  * damped harmonic gauge source function), raised to an exponent.
     105             :  *
     106             :  * Computes the spacetime derivatives:
     107             :  * \f{align*}{
     108             :  *  \partial_a (logF)^q = q (logF)^{q-1} \partial_a (logF)
     109             :  * \f}
     110             :  */
     111             : template <typename DataType, size_t SpatialDim, typename Frame>
     112             : void spacetime_deriv_of_power_log_factor_metric_lapse(
     113             :     gsl::not_null<tnsr::a<DataType, SpatialDim, Frame>*> d4_powlogfac,
     114             :     const Scalar<DataType>& lapse,
     115             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
     116             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
     117             :     const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
     118             :     const Scalar<DataType>& sqrt_det_spatial_metric,
     119             :     const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
     120             :     const tnsr::aa<DataType, SpatialDim, Frame>& pi,
     121             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi, double g_exponent,
     122             :     int exponent);
     123             : 
     124             : template <typename DataType, size_t SpatialDim, typename Frame>
     125             : tnsr::a<DataType, SpatialDim, Frame>
     126             : spacetime_deriv_of_power_log_factor_metric_lapse(
     127             :     const Scalar<DataType>& lapse,
     128             :     const tnsr::I<DataType, SpatialDim, Frame>& shift,
     129             :     const tnsr::A<DataType, SpatialDim, Frame>& spacetime_unit_normal,
     130             :     const tnsr::II<DataType, SpatialDim, Frame>& inverse_spatial_metric,
     131             :     const Scalar<DataType>& sqrt_det_spatial_metric,
     132             :     const tnsr::ii<DataType, SpatialDim, Frame>& dt_spatial_metric,
     133             :     const tnsr::aa<DataType, SpatialDim, Frame>& pi,
     134             :     const tnsr::iaa<DataType, SpatialDim, Frame>& phi, double g_exponent,
     135             :     int exponent);
     136             : 
     137             : }  // namespace DampedHarmonicGauge_detail
     138             : }  // namespace gauges
     139             : }  // namespace gh

Generated by: LCOV version 1.14