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}(\gamma^p/\alpha) \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 : } // namespace DampedHarmonicGauge_detail
71 : } // namespace gauges
72 : } // namespace gh
|