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 : hydro::Tags::SpatialVelocityOneForm<DataVector, 3, Frame::Inertial>,
80 : gr::Tags::SpatialMetric<DataVector, 3>,
81 : gr::Tags::SqrtDetSpatialMetric<DataVector>,
82 : gr::Tags::InverseSpatialMetric<DataVector, 3>,
83 : evolution::dg::Actions::detail::NormalVector<3>>;
84 :
85 : /*!
86 : * \brief Reconstructs the `PrimTagsForReconstruction` (usually
87 : * \f$\rho, p, Wv^i, B^i\f$, and \f$\Phi\f$), and if `compute_conservatives` is
88 : * true computes the Lorentz factor, upper spatial velocity, specific internal
89 : * energy, and the conserved variables.
90 : *
91 : * All results are written into `vars_on_lower_face` and `vars_on_upper_face`.
92 : *
93 : * The reason the `PrimTagsForReconstruction` can be specified separately is
94 : * because some variables might need separate reconstruction methods from
95 : * others, e.g. to guarantee the reconstructed solution is positive.
96 : */
97 : template <typename PrimTagsForReconstruction, typename PrimsTagsVolume,
98 : size_t ThermodynamicDim, typename F, typename PrimsTagsSentByNeighbor>
99 1 : void reconstruct_prims_work(
100 : gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, 3>*>
101 : vars_on_lower_face,
102 : gsl::not_null<std::array<Variables<tags_list_for_reconstruct>, 3>*>
103 : vars_on_upper_face,
104 : const F& reconstruct, const Variables<PrimsTagsVolume>& volume_prims,
105 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
106 : const Element<3>& element,
107 : const DirectionalIdMap<3, Variables<PrimsTagsSentByNeighbor>>&
108 : neighbor_data,
109 : const Mesh<3>& subcell_mesh, size_t ghost_zone_size,
110 : bool compute_conservatives);
111 :
112 : /*!
113 : * \brief Reconstructs the `PrimTagsForReconstruction` and if
114 : * `compute_conservatives` is `true` computes the Lorentz factor, upper spatial
115 : * velocity, specific internal energy, and the conserved variables.
116 : *
117 : * All results are written into `vars_on_face`.
118 : *
119 : * This is used on DG elements to reconstruct their subcell neighbors' solution
120 : * on the shared faces.
121 : *
122 : * The reason the `PrimTagsForReconstruction` can be specified separately is
123 : * because some variables might need separate reconstruction methods from
124 : * others, e.g. to guarantee the reconstructed solution is positiv
125 : */
126 : template <typename PrimTagsForReconstruction, typename PrimsTagsSentByNeighbor,
127 : typename TagsList, typename PrimsTags, size_t ThermodynamicDim,
128 : typename F0, typename F1>
129 1 : void reconstruct_fd_neighbor_work(
130 : gsl::not_null<Variables<tags_list_for_reconstruct>*> vars_on_face,
131 : const F0& reconstruct_lower_neighbor, const F1& reconstruct_upper_neighbor,
132 : const Variables<PrimsTags>& subcell_volume_prims,
133 : const EquationsOfState::EquationOfState<true, ThermodynamicDim>& eos,
134 : const Element<3>& element,
135 : const DirectionalIdMap<3, evolution::dg::subcell::GhostData>& ghost_data,
136 : const Mesh<3>& subcell_mesh, const Direction<3>& direction_to_reconstruct,
137 : const size_t ghost_zone_size, bool compute_conservatives);
138 : } // namespace grmhd::ValenciaDivClean::fd
|