M1HydroCoupling.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 ///\file
5 /// Defines functions to compute the M1-hydro
6 /// coupling terms.
7 
8 #pragma once
9 
10 #include <tuple>
11 
13 #include "DataStructures/Tensor/TypeAliases.hpp" // IWYU pragma: keep
14 #include "Evolution/Systems/RadiationTransport/M1Grey/Tags.hpp" // IWYU pragma: keep
15 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
16 #include "PointwiseFunctions/Hydro/Tags.hpp"
17 #include "Utilities/Requires.hpp"
18 #include "Utilities/TMPL.hpp"
19 #include "Utilities/TaggedTuple.hpp"
20 
21 // IWYU pragma: no_forward_declare Tensor
22 
23 /// \cond
24 class DataVector;
25 namespace Parallel {
26 template <typename Metavariables>
27 class GlobalCache;
28 } // namespace Parallel
29 // IWYU pragma: no_forward_declare db::DataBox
30 /// \endcond
31 
32 namespace RadiationTransport {
33 namespace M1Grey {
34 
35 // Implementation of the coupling terms for
36 // individual species
37 namespace detail {
38 void compute_m1_hydro_coupling_impl(
40  gsl::not_null<tnsr::i<DataVector, 3>*> source_i,
41  const Scalar<DataVector>& emissivity,
42  const Scalar<DataVector>& absorption_opacity,
43  const Scalar<DataVector>& scattering_opacity,
44  const Scalar<DataVector>& comoving_energy_density,
45  const Scalar<DataVector>& comoving_momentum_density_normal,
46  const tnsr::i<DataVector, 3>& comoving_momentum_density_spatial,
47  const tnsr::I<DataVector, 3>& fluid_velocity,
48  const Scalar<DataVector>& fluid_lorentz_factor,
50  const tnsr::ii<DataVector, 3>& spatial_metric,
51  const Scalar<DataVector>& sqrt_det_spatial_metric) noexcept;
52 } // namespace detail
53 
54 template <typename NeutrinoSpeciesList>
56 /*!
57  * Compute the source terms of the M1 equation due to neutrino-matter
58  * interactions.
59  * These are:
60  *
61  * \f{align}{
62  * \partial_t \tilde E = \alpha W (\sqrt{\gamma} \eta - \kappa_a \tilde J)
63  * + \alpha (\kappa_a + \kappa_s) H_n\\
64  * \partial_t \tilde S_i = \alpha u_i (\sqrt{\gamma} \eta - \kappa_a \tilde J)
65  * - \alpha (\kappa_a + \kappa_s) H_i.
66  * \f}
67  *
68  * with \f$W\f$ the Lorentz factor, \f$u_i = W v_i\f$ the spatial components of
69  * the fluid 4-velocity, \f$\eta\f$ the emissivity, \f$\kappa_{a,s}\f$
70  * the absorption and scattering opacities, \f$J\f$ the comoving energy
71  * density, and \f$H_{n,i}\f$ the normal and spatial components of the comoving
72  * flux density.
73  *
74  * The function returns in `source_n` the energy source and in
75  * `source_i` the momentum source. We write a separate action for these
76  * sources to make it easier to switch between implicit / explicit time
77  * stepping, as well as to add the source terms to both the fluid and M1
78  * evolutions.
79  */
80 template <typename... NeutrinoSpecies>
81 struct ComputeM1HydroCoupling<tmpl::list<NeutrinoSpecies...>> {
82  using return_tags = tmpl::list<
85 
86  using argument_tags =
87  tmpl::list<Tags::GreyEmissivity<NeutrinoSpecies>...,
96 
97  static void apply(
99  NeutrinoSpecies>::type*>... source_n,
101  Frame::Inertial, NeutrinoSpecies>::type*>... source_i,
102  const typename Tags::GreyEmissivity<NeutrinoSpecies>::type&... emissivity,
103  const typename Tags::GreyAbsorptionOpacity<
104  NeutrinoSpecies>::type&... absorption_opacity,
105  const typename Tags::GreyScatteringOpacity<
106  NeutrinoSpecies>::type&... scattering_opacity,
107  const typename Tags::TildeJ<NeutrinoSpecies>::type&... tilde_j,
108  const typename Tags::TildeHNormal<NeutrinoSpecies>::type&... tilde_hn,
109  const typename Tags::TildeHSpatial<Frame::Inertial,
110  NeutrinoSpecies>::type&... tilde_hi,
111  const tnsr::I<DataVector, 3>& spatial_velocity,
112  const Scalar<DataVector>& lorentz_factor, const Scalar<DataVector>& lapse,
113  const tnsr::ii<DataVector, 3>& spatial_metric,
114  const Scalar<DataVector>& sqrt_det_spatial_metric) noexcept {
115  EXPAND_PACK_LEFT_TO_RIGHT(detail::compute_m1_hydro_coupling_impl(
116  source_n, source_i, emissivity, absorption_opacity, scattering_opacity,
117  tilde_j, tilde_hn, tilde_hi, spatial_velocity, lorentz_factor, lapse,
118  spatial_metric, sqrt_det_spatial_metric));
119  }
120 };
121 
122 } // namespace M1Grey
123 } // namespace RadiationTransport
RadiationTransport::M1Grey::Tags::TildeHNormal
The normal component of the fluid-frame momentum density of neutrinos of a given species .
Definition: Tags.hpp:94
EXPAND_PACK_LEFT_TO_RIGHT
#define EXPAND_PACK_LEFT_TO_RIGHT(...)
Expand a parameter pack evaluating the terms from left to right.
Definition: TMPL.hpp:563
Frame::Inertial
Definition: IndexType.hpp:44
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
tuple
gr::lapse
Scalar< DataType > lapse(const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute lapse from shift and spacetime metric.
RadiationTransport::M1Grey::Tags::TildeJ
The fluid-frame densitized energy density of neutrinos of a given species .
Definition: Tags.hpp:84
db::apply
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args) noexcept
Apply the invokable f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1424
DataBox.hpp
hydro::Tags::LorentzFactor
The Lorentz factor , where is the spatial velocity of the fluid.
Definition: Tags.hpp:64
RadiationTransport::M1Grey::Tags::M1HydroCouplingSpatial
The spatial components of source term coupling the M1 and hydro equations.
Definition: Tags.hpp:168
RadiationTransport
Items related to general relativistic radiation transport.
Definition: Characteristics.cpp:10
RadiationTransport::M1Grey::Tags::GreyScatteringOpacity
The scattering opacity of the fluid for neutrinos of a given species.
Definition: Tags.hpp:141
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:42
RadiationTransport::M1Grey::Tags::GreyAbsorptionOpacity
The absorption opacity of the fluid for neutrinos of a given species.
Definition: Tags.hpp:129
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
TypeAliases.hpp
hydro::Tags::SpatialVelocity
The spatial velocity of the fluid, where . Here is the spatial part of the 4-velocity of the fluid,...
Definition: Tags.hpp:142
Requires.hpp
gr::spatial_metric
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
RadiationTransport::M1Grey::ComputeM1HydroCoupling
Definition: M1HydroCoupling.hpp:55
RadiationTransport::M1Grey::Tags::TildeHSpatial
The spatial components of the fluid-frame momentum density of neutrinos of a given species .
Definition: Tags.hpp:104
RadiationTransport::M1Grey::Tags::M1HydroCouplingNormal
The normal component of the source term coupling the M1 and hydro equations.
Definition: Tags.hpp:154
Parallel
Contains functions that forward to Charm++ parallel functions.
Definition: ElementReceiveInterpPoints.hpp:14
gr::Tags::Lapse
Definition: Tags.hpp:52
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183
gr::Tags::SqrtDetSpatialMetric
Definition: Tags.hpp:44