Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/Tensor/TypeAliases.hpp"
9 : #include "DataStructures/VariablesTag.hpp"
10 : #include "Domain/Tags.hpp"
11 : #include "Evolution/DgSubcell/ActiveGrid.hpp"
12 : #include "Evolution/DgSubcell/Tags/ActiveGrid.hpp"
13 : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
14 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/PrimitiveFromConservativeOptions.hpp"
15 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
16 : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
17 : #include "PointwiseFunctions/Hydro/Tags.hpp"
18 : #include "Utilities/TMPL.hpp"
19 :
20 : /// \cond
21 : class DataVector;
22 : namespace EquationsOfState {
23 : template <bool IsRelativistic, size_t ThermodynamicDim>
24 : class EquationOfState;
25 : } // namespace EquationsOfState
26 : template <size_t Dim>
27 : class Mesh;
28 : namespace gsl {
29 : template <typename T>
30 : class not_null;
31 : } // namespace gsl
32 : template <typename TagsList>
33 : class Variables;
34 : /// \endcond
35 :
36 : namespace grmhd::GhValenciaDivClean::subcell {
37 : /*!
38 : * \brief If the grid is switched from subcell to DG, then this mutator resizes
39 : * the primitive variables to the DG grid and computes the primitive variables
40 : * on the DG grid.
41 : *
42 : * In the DG-subcell `step_actions` list this will normally be called using the
43 : * `::Actions::MutateApply` action in the following way in the action list:
44 : * - `TciAndSwitchToDg<TciOnFdGrid>`
45 : * - `Actions::MutateApply<ResizeAndComputePrims<primitive_recovery_schemes>>`
46 : *
47 : * If the active grid is DG (we are switching from subcell back to DG) then this
48 : * mutator computes the primitive variables on the active grid. We reconstruct
49 : * the pressure to the DG grid to give a high-order initial guess for the
50 : * primitive recovery. A possible future optimization would be to avoid this
51 : * reconstruction when all recovery schemes don't need an initial guess.
52 : * Finally, we perform the primitive recovery on the DG grid.
53 : *
54 : * If the active grid is Subcell then this mutator does nothing.
55 : *
56 : * \note All evolved variables are on the DG grid when this mutator is called
57 : * and the active grid is DG.
58 : */
59 : template <typename OrderedListOfRecoverySchemes>
60 1 : struct ResizeAndComputePrims {
61 0 : using return_tags =
62 : tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>>;
63 0 : using argument_tags = tmpl::list<
64 : evolution::dg::subcell::Tags::ActiveGrid, domain::Tags::Mesh<3>,
65 : evolution::dg::subcell::Tags::Mesh<3>,
66 : grmhd::ValenciaDivClean::Tags::TildeD,
67 : grmhd::ValenciaDivClean::Tags::TildeYe,
68 : grmhd::ValenciaDivClean::Tags::TildeTau,
69 : grmhd::ValenciaDivClean::Tags::TildeS<>,
70 : grmhd::ValenciaDivClean::Tags::TildeB<>,
71 : grmhd::ValenciaDivClean::Tags::TildePhi,
72 : gr::Tags::SpacetimeMetric<DataVector, 3>,
73 : hydro::Tags::GrmhdEquationOfState,
74 : grmhd::ValenciaDivClean::Tags::PrimitiveFromConservativeOptions>;
75 :
76 0 : static void apply(
77 : gsl::not_null<Variables<hydro::grmhd_tags<DataVector>>*> prim_vars,
78 : evolution::dg::subcell::ActiveGrid active_grid, const Mesh<3>& dg_mesh,
79 : const Mesh<3>& subcell_mesh, const Scalar<DataVector>& tilde_d,
80 : const Scalar<DataVector>& tilde_ye, const Scalar<DataVector>& tilde_tau,
81 : const tnsr::i<DataVector, 3, Frame::Inertial>& tilde_s,
82 : const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_b,
83 : const Scalar<DataVector>& tilde_phi,
84 : const tnsr::aa<DataVector, 3, Frame::Inertial>& spacetime_metric,
85 : const EquationsOfState::EquationOfState<true, 3>& eos,
86 : const grmhd::ValenciaDivClean::PrimitiveFromConservativeOptions&
87 : primitive_from_conservative_options);
88 : };
89 : } // namespace grmhd::GhValenciaDivClean::subcell
|