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/RadiationTransport/M1Grey/Tags.hpp"
9 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
10 : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
11 : #include "PointwiseFunctions/Hydro/Tags.hpp"
12 : #include "Utilities/Gsl.hpp"
13 : #include "Utilities/TMPL.hpp"
14 :
15 : /// \cond
16 : class DataVector;
17 : /// \endcond
18 :
19 : namespace RadiationTransport::M1Grey {
20 :
21 : // Implementation of the curvature source terms
22 : // for the M1 system, for an individual species.
23 : namespace detail {
24 : void compute_sources_impl(gsl::not_null<Scalar<DataVector>*> source_tilde_e,
25 : gsl::not_null<tnsr::i<DataVector, 3>*> source_tilde_s,
26 : const Scalar<DataVector>& tilde_e,
27 : const tnsr::i<DataVector, 3>& tilde_s,
28 : const tnsr::II<DataVector, 3>& tilde_p,
29 : const Scalar<DataVector>& lapse,
30 : const tnsr::i<DataVector, 3>& d_lapse,
31 : const tnsr::iJ<DataVector, 3>& d_shift,
32 : const tnsr::ijj<DataVector, 3>& d_spatial_metric,
33 : const tnsr::II<DataVector, 3>& inv_spatial_metric,
34 : const tnsr::ii<DataVector, 3>& extrinsic_curvature,
35 : const tnsr::ii<DataVector, 3>& spatial_metric,
36 : const Scalar<DataVector>& emissivity,
37 : const Scalar<DataVector>& absorption_opacity,
38 : const Scalar<DataVector>& scattering_opacity,
39 : const Scalar<DataVector>& tilde_j,
40 : const Scalar<DataVector>& tilde_h_normal,
41 : const tnsr::i<DataVector, 3>& tilde_h_spatial,
42 : const tnsr::I<DataVector, 3>& spatial_velocity,
43 : const Scalar<DataVector>& lorentz,
44 : const Scalar<DataVector>& sqrt_det_spatial_metric);
45 : } // namespace detail
46 :
47 : /*!
48 : * \brief Compute the curvature source terms for the flux-balanced
49 : * grey M1 radiation transport.
50 : *
51 : *
52 : * A flux-balanced system has the generic form:
53 : * \f[
54 : * \partial_t U_i + \partial_m F^m(U_i) = S(U_i)
55 : * \f]
56 : *
57 : * where \f$F^a()\f$ denotes the flux of a conserved variable \f$U_i\f$ and
58 : * \f$S()\f$ denotes the source term for the conserved variable.
59 : *
60 : * For the grey M1 formalism (neglecting coupling to the fluid):
61 : * \f{align*}
62 : * S({\tilde E}) &= \alpha \tilde P^{ij} K_{ij} - \tilde S^i \partial_i
63 : * \alpha,\\ S({\tilde S_i}) &= -\tilde E \partial_i \alpha + \tilde S_k
64 : * \partial_i \beta^k
65 : * + \frac{1}{2} \alpha \tilde P^{jk} \partial_i \gamma_{jk},
66 : * \f}
67 : *
68 : * where \f${\tilde E}\f$, \f${\tilde S_i}\f$, \f${\tilde P}^{ij}\f$ are the
69 : * densitized energy, momentum, and pressure tensor of the neutrinos/photons,
70 : * \f$K_{ij}\f$ is the extrinsic curvature, and \f$\alpha\f$, \f$\beta^i\f$,
71 : * \f$\gamma_{ij}\f$ are the lapse, shift and 3-metric.
72 : *
73 : * In the main function, we loop over all neutrino species, and then call
74 : * the actual implementation of the curvature source terms.
75 : */
76 : template <typename... NeutrinoSpecies>
77 1 : struct ComputeSources {
78 0 : using return_tags = tmpl::list<
79 : ::Tags::Source<Tags::TildeE<Frame::Inertial, NeutrinoSpecies>>...,
80 : ::Tags::Source<Tags::TildeS<Frame::Inertial, NeutrinoSpecies>>...>;
81 :
82 0 : using argument_tags =
83 : tmpl::list<Tags::TildeE<Frame::Inertial, NeutrinoSpecies>...,
84 : Tags::TildeS<Frame::Inertial, NeutrinoSpecies>...,
85 : Tags::TildeP<Frame::Inertial, NeutrinoSpecies>...,
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>,
92 : tmpl::size_t<3>, Frame::Inertial>,
93 : gr::Tags::InverseSpatialMetric<DataVector, 3>,
94 : gr::Tags::ExtrinsicCurvature<DataVector, 3>,
95 : gr::Tags::SpatialMetric<DataVector, 3>,
96 : Tags::GreyEmissivity<NeutrinoSpecies>...,
97 : Tags::GreyAbsorptionOpacity<NeutrinoSpecies>...,
98 : Tags::GreyScatteringOpacity<NeutrinoSpecies>...,
99 : Tags::TildeJ<NeutrinoSpecies>...,
100 : Tags::TildeHNormal<NeutrinoSpecies>...,
101 : Tags::TildeHSpatial<Frame::Inertial, NeutrinoSpecies>...,
102 : hydro::Tags::SpatialVelocity<DataVector, 3>,
103 : hydro::Tags::LorentzFactor<DataVector>,
104 : gr::Tags::SqrtDetSpatialMetric<DataVector>>;
105 :
106 0 : static void apply(
107 : const gsl::not_null<typename Tags::TildeE<
108 : Frame::Inertial, NeutrinoSpecies>::type*>... sources_tilde_e,
109 : const gsl::not_null<typename Tags::TildeS<
110 : Frame::Inertial, NeutrinoSpecies>::type*>... sources_tilde_s,
111 : const typename Tags::TildeE<Frame::Inertial,
112 : NeutrinoSpecies>::type&... tilde_e,
113 : const typename Tags::TildeS<Frame::Inertial,
114 : NeutrinoSpecies>::type&... tilde_s,
115 : const typename Tags::TildeP<Frame::Inertial,
116 : NeutrinoSpecies>::type&... tilde_p,
117 : const Scalar<DataVector>& lapse, const tnsr::i<DataVector, 3>& d_lapse,
118 : const tnsr::iJ<DataVector, 3>& d_shift,
119 : const tnsr::ijj<DataVector, 3>& d_spatial_metric,
120 : const tnsr::II<DataVector, 3>& inv_spatial_metric,
121 : const tnsr::ii<DataVector, 3>& extrinsic_curvature,
122 : const tnsr::ii<DataVector, 3>& spatial_metric,
123 : const Scalar<DataVector>& emissivity,
124 : const Scalar<DataVector>& absorption_opacity,
125 : const Scalar<DataVector>& scattering_opacity,
126 : const typename Tags::TildeJ<NeutrinoSpecies>::type&... tilde_j,
127 : const typename Tags::TildeHNormal<
128 : NeutrinoSpecies>::type&... tilde_h_normal,
129 : const typename Tags::TildeHSpatial<
130 : Frame::Inertial, NeutrinoSpecies>::type&... tilde_h_spatial,
131 : const tnsr::I<DataVector, 3>& spatial_velocity,
132 : const Scalar<DataVector>& lorentz,
133 : const Scalar<DataVector>& sqrt_det_spatial_metric) {
134 : EXPAND_PACK_LEFT_TO_RIGHT(detail::compute_sources_impl(
135 : sources_tilde_e, sources_tilde_s, tilde_e, tilde_s, tilde_p, lapse,
136 : d_lapse, d_shift, d_spatial_metric, inv_spatial_metric,
137 : extrinsic_curvature, spatial_metric, emissivity, absorption_opacity,
138 : scattering_opacity, tilde_j, tilde_h_normal, tilde_h_spatial,
139 : spatial_velocity, lorentz, sqrt_det_spatial_metric));
140 : }
141 : };
142 :
143 : } // namespace RadiationTransport::M1Grey
|