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