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 : #include <cstddef>
8 : #include <utility>
9 :
10 : #include "DataStructures/DataBox/Prefixes.hpp"
11 : #include "DataStructures/Tensor/TypeAliases.hpp"
12 : #include "Domain/Structure/DirectionalIdMap.hpp"
13 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/TagsDeclarations.hpp"
14 : #include "Evolution/VariableFixing/FixToAtmosphere.hpp"
15 : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
16 : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"
17 : #include "Utilities/TMPL.hpp"
18 :
19 : /// \cond
20 : class DataVector;
21 : template <typename TagsList>
22 : class Variables;
23 : namespace gsl {
24 : template <typename>
25 : class not_null;
26 : } // namespace gsl
27 : template <size_t Dim>
28 : class Direction;
29 : template <size_t Dim>
30 : class ElementId;
31 : template <size_t Dim>
32 : class Element;
33 : template <size_t Dim>
34 : class Mesh;
35 : namespace EquationsOfState {
36 : template <bool IsRelativistic, size_t ThermodynamicDim>
37 : class EquationOfState;
38 : } // namespace EquationsOfState
39 : namespace evolution::dg::subcell {
40 : class GhostData;
41 : } // namespace evolution::dg::subcell
42 : namespace evolution::dg::Actions::detail {
43 : template <size_t Dim>
44 : struct NormalVector;
45 : } // namespace evolution::dg::Actions::detail
46 : /// \endcond
47 :
48 : namespace grmhd::ValenciaDivClean::fd {
49 : /// \brief The list of tags used by `reconstruct_prims_work` and
50 : /// `reconstruct_fd_neighbor_work`
51 1 : using tags_list_for_reconstruct = tmpl::list<
52 : grmhd::ValenciaDivClean::Tags::TildeD,
53 : grmhd::ValenciaDivClean::Tags::TildeYe,
54 : grmhd::ValenciaDivClean::Tags::TildeTau,
55 : grmhd::ValenciaDivClean::Tags::TildeS<Frame::Inertial>,
56 : grmhd::ValenciaDivClean::Tags::TildeB<Frame::Inertial>,
57 : grmhd::ValenciaDivClean::Tags::TildePhi,
58 : hydro::Tags::RestMassDensity<DataVector>,
59 : hydro::Tags::ElectronFraction<DataVector>,
60 : hydro::Tags::SpecificInternalEnergy<DataVector>,
61 : hydro::Tags::SpatialVelocity<DataVector, 3>,
62 : hydro::Tags::MagneticField<DataVector, 3>,
63 : hydro::Tags::DivergenceCleaningField<DataVector>,
64 : hydro::Tags::LorentzFactor<DataVector>, hydro::Tags::Pressure<DataVector>,
65 : hydro::Tags::Temperature<DataVector>,
66 : hydro::Tags::LorentzFactorTimesSpatialVelocity<DataVector, 3>,
67 : ::Tags::Flux<grmhd::ValenciaDivClean::Tags::TildeD, tmpl::size_t<3>,
68 : Frame::Inertial>,
69 : ::Tags::Flux<grmhd::ValenciaDivClean::Tags::TildeYe, tmpl::size_t<3>,
70 : Frame::Inertial>,
71 : ::Tags::Flux<grmhd::ValenciaDivClean::Tags::TildeTau, tmpl::size_t<3>,
72 : Frame::Inertial>,
73 : ::Tags::Flux<grmhd::ValenciaDivClean::Tags::TildeS<Frame::Inertial>,
74 : tmpl::size_t<3>, Frame::Inertial>,
75 : ::Tags::Flux<grmhd::ValenciaDivClean::Tags::TildeB<Frame::Inertial>,
76 : tmpl::size_t<3>, Frame::Inertial>,
77 : ::Tags::Flux<grmhd::ValenciaDivClean::Tags::TildePhi, tmpl::size_t<3>,
78 : Frame::Inertial>,
79 : gr::Tags::Lapse<DataVector>, gr::Tags::Shift<DataVector, 3>,
80 : hydro::Tags::SpatialVelocityOneForm<DataVector, 3, Frame::Inertial>,
81 : gr::Tags::SpatialMetric<DataVector, 3>,
82 : gr::Tags::SqrtDetSpatialMetric<DataVector>,
83 : gr::Tags::InverseSpatialMetric<DataVector, 3>,
84 : evolution::dg::Actions::detail::NormalVector<3>>;
85 :
86 : /*!
87 : * \brief Reconstructs the `PrimTagsForReconstruction` (usually
88 : * \f$\rho, p, Wv^i, B^i\f$, and \f$\Phi\f$), and if `compute_conservatives` is
89 : * true computes the Lorentz factor, upper spatial velocity, specific internal
90 : * energy, and the conserved variables.
91 : *
92 : * All results are written into `vars_on_lower_face` and `vars_on_upper_face`.
93 : *
94 : * The reason the `PrimTagsForReconstruction` can be specified separately is
95 : * because some variables might need separate reconstruction methods from
96 : * others, e.g. to guarantee the reconstructed solution is positive.
97 : */
98 : template <typename PrimTagsForReconstruction, typename PrimsTagsVolume,
99 : size_t ThermodynamicDim, typename F, typename PrimsTagsSentByNeighbor>
100 1 : void reconstruct_prims_work(
101 : gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, 3>*>
102 : vars_on_lower_face,
103 : gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, 3>*>
104 : vars_on_upper_face,
105 : const F& reconstruct, const Variables<PrimsTagsVolume>& volume_prims,
106 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
107 : const Element<3>& element,
108 : const DirectionalIdMap<3, Variables<PrimsTagsSentByNeighbor>>&
109 : neighbor_data,
110 : const Mesh<3>& subcell_mesh, size_t ghost_zone_size,
111 : bool compute_conservatives, bool reconstruct_density_times_temperature,
112 : const VariableFixing::FixToAtmosphere<3>* fix_to_atmosphere);
113 :
114 : /*!
115 : * \brief Reconstructs the `PrimTagsForReconstruction` and if
116 : * `compute_conservatives` is `true` computes the Lorentz factor, upper spatial
117 : * velocity, specific internal energy, and the conserved variables.
118 : *
119 : * All results are written into `vars_on_face`.
120 : *
121 : * This is used on DG elements to reconstruct their subcell neighbors' solution
122 : * on the shared faces.
123 : *
124 : * The reason the `PrimTagsForReconstruction` can be specified separately is
125 : * because some variables might need separate reconstruction methods from
126 : * others, e.g. to guarantee the reconstructed solution is positiv
127 : */
128 : template <typename PrimTagsForReconstruction, typename PrimsTagsSentByNeighbor,
129 : typename TagsList, typename PrimsTags, size_t ThermodynamicDim,
130 : typename F0, typename F1>
131 1 : void reconstruct_fd_neighbor_work(
132 : gsl::not_null<Variables<tags_list_for_reconstruct>*> vars_on_face,
133 : const F0& reconstruct_lower_neighbor, const F1& reconstruct_upper_neighbor,
134 : const Variables<PrimsTags>& subcell_volume_prims,
135 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
136 : const Element<3>& element,
137 : const DirectionalIdMap<3, evolution::dg::subcell::GhostData>& ghost_data,
138 : const Mesh<3>& subcell_mesh, const Direction<3>& direction_to_reconstruct,
139 : size_t ghost_zone_size, bool compute_conservatives,
140 : bool reconstruct_density_times_temperature,
141 : const VariableFixing::FixToAtmosphere<3>* fix_to_atmosphere);
142 : } // namespace grmhd::ValenciaDivClean::fd
|