Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include "DataStructures/DataBox/Prefixes.hpp"
7 : #include "DataStructures/Tensor/TypeAliases.hpp"
8 : #include "Evolution/Systems/ForceFree/Tags.hpp"
9 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
10 : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
11 : #include "Utilities/TMPL.hpp"
12 :
13 : /// \cond
14 : class DataVector;
15 : /// \endcond
16 :
17 : namespace ForceFree {
18 :
19 : namespace detail {
20 : void sources_impl(
21 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> source_tilde_e,
22 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> source_tilde_b,
23 : gsl::not_null<Scalar<DataVector>*> source_tilde_psi,
24 : gsl::not_null<Scalar<DataVector>*> source_tilde_phi,
25 :
26 : // temp variables
27 : const tnsr::I<DataVector, 3, Frame::Inertial>&
28 : trace_spatial_christoffel_second,
29 :
30 : // EM args
31 : const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_e,
32 : const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_b,
33 : const Scalar<DataVector>& tilde_psi, const Scalar<DataVector>& tilde_phi,
34 : const Scalar<DataVector>& tilde_q,
35 : const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_j_drift,
36 : double kappa_psi, double kappa_phi,
37 : // GR args
38 : const Scalar<DataVector>& lapse,
39 : const tnsr::i<DataVector, 3, Frame::Inertial>& d_lapse,
40 : const tnsr::iJ<DataVector, 3, Frame::Inertial>& d_shift,
41 : const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric,
42 : const tnsr::ii<DataVector, 3, Frame::Inertial>& extrinsic_curvature);
43 : } // namespace detail
44 :
45 : /*!
46 : * \brief Compute the source terms for the GRFFE system with divergence
47 : * cleaning.
48 : *
49 : * \f{align*}
50 : * S(\tilde{E}^i) &= -\alpha \sqrt{\gamma} J^i - \tilde{E}^j \partial_j \beta^i
51 : * + \tilde{\psi} ( \gamma^{ij} \partial_j \alpha - \alpha \gamma^{jk}
52 : * \Gamma^i_{jk} ) \\
53 : * S(\tilde{B}^i) &= -\tilde{B}^j \partial_j \beta^i + \tilde{\phi} (
54 : * \gamma^{ij} \partial_j \alpha - \alpha \gamma^{jk} \Gamma^i_{jk} ) \\
55 : * S(\tilde{\psi}) &= \tilde{E}^k \partial_k \alpha + \alpha \tilde{q} - \alpha
56 : * \tilde{\phi} ( K + \kappa_\phi ) \\
57 : * S(\tilde{\phi}) &= \tilde{B}^k \partial_k \alpha - \alpha \tilde{\phi} (K +
58 : * \kappa_\phi ) \\
59 : * S(\tilde{q}) &= 0
60 : * \f}
61 : *
62 : * where the conserved variables \f$\tilde{E}^i, \tilde{B}^i, \tilde{\psi},
63 : * \tilde{\phi}, \tilde{q}\f$ are densitized electric field, magnetic field,
64 : * magnetic divergence cleaning field, electric divergence cleaning field, and
65 : * electric charge density.
66 : *
67 : * \f$J^i\f$ is the spatial electric current density, \f$\alpha\f$ is the lapse,
68 : * \f$\beta^i\f$ is the shift, \f$\gamma^{ij}\f$ is the spatial metric,
69 : * \f$\gamma\f$ is the determinant of spatial metric, \f$\Gamma^i_{jk}\f$ is the
70 : * spatial Christoffel symbol, \f$K\f$ is the trace of extrinsic curvature.
71 : * \f$\kappa_\phi\f$ and \f$\kappa_\psi\f$ are damping parameters associated
72 : * with divergence cleaning of magnetic and electric fields, respectively.
73 : *
74 : */
75 1 : struct Sources {
76 0 : using return_tags =
77 : tmpl::list<::Tags::Source<Tags::TildeE>, ::Tags::Source<Tags::TildeB>,
78 : ::Tags::Source<Tags::TildePsi>,
79 : ::Tags::Source<Tags::TildePhi>>;
80 :
81 0 : using argument_tags = tmpl::list<
82 : // EM variables
83 : Tags::TildeE, Tags::TildeB, Tags::TildePsi, Tags::TildePhi, Tags::TildeQ,
84 : Tags::KappaPsi, Tags::KappaPhi, Tags::ParallelConductivity,
85 : // GR variables
86 : gr::Tags::Lapse<DataVector>,
87 : ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<3>,
88 : Frame::Inertial>,
89 : ::Tags::deriv<gr::Tags::Shift<DataVector, 3>, tmpl::size_t<3>,
90 : Frame::Inertial>,
91 : ::Tags::deriv<gr::Tags::SpatialMetric<DataVector, 3>, tmpl::size_t<3>,
92 : Frame::Inertial>,
93 : gr::Tags::SpatialMetric<DataVector, 3>,
94 : gr::Tags::InverseSpatialMetric<DataVector, 3>,
95 : gr::Tags::SqrtDetSpatialMetric<DataVector>,
96 : gr::Tags::ExtrinsicCurvature<DataVector, 3>>;
97 :
98 0 : static void apply(
99 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> source_tilde_e,
100 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> source_tilde_b,
101 : gsl::not_null<Scalar<DataVector>*> source_tilde_psi,
102 : gsl::not_null<Scalar<DataVector>*> source_tilde_phi,
103 : // EM variables
104 : const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_e,
105 : const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_b,
106 : const Scalar<DataVector>& tilde_psi, const Scalar<DataVector>& tilde_phi,
107 : const Scalar<DataVector>& tilde_q, double kappa_psi, double kappa_phi,
108 : double parallel_conductivity,
109 : // GR variables
110 : const Scalar<DataVector>& lapse,
111 : const tnsr::i<DataVector, 3, Frame::Inertial>& d_lapse,
112 : const tnsr::iJ<DataVector, 3, Frame::Inertial>& d_shift,
113 : const tnsr::ijj<DataVector, 3, Frame::Inertial>& d_spatial_metric,
114 : const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,
115 : const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric,
116 : const Scalar<DataVector>& sqrt_det_spatial_metric,
117 : const tnsr::ii<DataVector, 3, Frame::Inertial>& extrinsic_curvature);
118 : };
119 :
120 : } // namespace ForceFree
|