Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <array>
7 :
8 : #include "DataStructures/DataBox/Prefixes.hpp"
9 : #include "DataStructures/DataVector.hpp"
10 : #include "DataStructures/Tensor/Tensor.hpp"
11 : #include "DataStructures/Tensor/TypeAliases.hpp"
12 : #include "Evolution/Systems/RadiationTransport/M1Grey/Tags.hpp"
13 : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
14 : #include "Utilities/Gsl.hpp"
15 : #include "Utilities/TMPL.hpp"
16 :
17 : namespace RadiationTransport {
18 : namespace M1Grey {
19 :
20 : // Implementation of the M1 fluxes for individual neutrino species
21 : namespace detail {
22 : void compute_fluxes_impl(
23 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_e_flux,
24 : gsl::not_null<tnsr::Ij<DataVector, 3, Frame::Inertial>*> tilde_s_flux,
25 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_s_M,
26 : const Scalar<DataVector>& tilde_e,
27 : const tnsr::i<DataVector, 3, Frame::Inertial>& tilde_s,
28 : const tnsr::II<DataVector, 3, Frame::Inertial>& tilde_p,
29 : const Scalar<DataVector>& lapse,
30 : const tnsr::I<DataVector, 3, Frame::Inertial>& shift,
31 : const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,
32 : const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric);
33 : } // namespace detail
34 :
35 : /*!
36 : * \brief The fluxes of the conservative variables in the M1 scheme
37 : *
38 : * \f{align*}
39 : * F^i({\tilde E}) = &~ \alpha \gamma^{ij} {\tilde S}_j - \beta^j {\tilde E} \\
40 : * F^i({\tilde S}_j) = &~ \alpha {\tilde P}^{ik} \gamma_{kj} - \beta^i {\tilde
41 : * S}_j \f}
42 : *
43 : * where the conserved variables \f${\tilde E}\f$, \f${\tilde S}_i\f$,
44 : * are a generalized mass-energy density and momentum density.
45 : * Furthermore, \f${\tilde P^{ij}}\f$ is the pressure tensor density of the
46 : * radiation field, \f$\alpha\f$ is the lapse, \f$\beta^i\f$ is the shift,
47 : * \f$\gamma_{ij}\f$ the 3-metric, and \f$\gamma^{ij}\f$ its inverse.
48 : *
49 : * In the main function, we loop over all neutrino species, and then call
50 : * the actual implementation of the fluxes.
51 : */
52 : template <typename... NeutrinoSpecies>
53 1 : struct ComputeFluxes {
54 0 : using return_tags =
55 : tmpl::list<::Tags::Flux<Tags::TildeE<Frame::Inertial, NeutrinoSpecies>,
56 : tmpl::size_t<3>, Frame::Inertial>...,
57 : ::Tags::Flux<Tags::TildeS<Frame::Inertial, NeutrinoSpecies>,
58 : tmpl::size_t<3>, Frame::Inertial>...>;
59 :
60 0 : using argument_tags =
61 : tmpl::list<Tags::TildeE<Frame::Inertial, NeutrinoSpecies>...,
62 : Tags::TildeS<Frame::Inertial, NeutrinoSpecies>...,
63 : Tags::TildeP<Frame::Inertial, NeutrinoSpecies>...,
64 : gr::Tags::Lapse<DataVector>, gr::Tags::Shift<DataVector, 3>,
65 : gr::Tags::SpatialMetric<DataVector, 3>,
66 : gr::Tags::InverseSpatialMetric<DataVector, 3>>;
67 :
68 0 : static void apply(
69 : const gsl::not_null<typename ::Tags::Flux<
70 : Tags::TildeE<Frame::Inertial, NeutrinoSpecies>, tmpl::size_t<3>,
71 : Frame::Inertial>::type*>... tilde_e_flux,
72 : const gsl::not_null<typename ::Tags::Flux<
73 : Tags::TildeS<Frame::Inertial, NeutrinoSpecies>, tmpl::size_t<3>,
74 : Frame::Inertial>::type*>... tilde_s_flux,
75 : const typename Tags::TildeE<Frame::Inertial,
76 : NeutrinoSpecies>::type&... tilde_e,
77 : const typename Tags::TildeS<Frame::Inertial,
78 : NeutrinoSpecies>::type&... tilde_s,
79 : const typename Tags::TildeP<Frame::Inertial,
80 : NeutrinoSpecies>::type&... tilde_p,
81 : const Scalar<DataVector>& lapse,
82 : const tnsr::I<DataVector, 3, Frame::Inertial>& shift,
83 : const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,
84 : const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric) {
85 : // Allocate memory for tildeS^i
86 : tnsr::I<DataVector, 3, Frame::Inertial> tilde_s_M(get(lapse).size());
87 : EXPAND_PACK_LEFT_TO_RIGHT(detail::compute_fluxes_impl(
88 : tilde_e_flux, tilde_s_flux, &tilde_s_M, tilde_e, tilde_s, tilde_p,
89 : lapse, shift, spatial_metric, inv_spatial_metric));
90 : }
91 : };
92 : } // namespace M1Grey
93 : } // namespace RadiationTransport
|