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 : #include <tuple>
8 :
9 : #include "DataStructures/Tensor/TypeAliases.hpp"
10 : #include "DataStructures/VariablesTag.hpp"
11 : #include "Domain/Tags.hpp"
12 : #include "Evolution/DgSubcell/RdmpTciData.hpp"
13 : #include "Evolution/DgSubcell/Tags/DataForRdmpTci.hpp"
14 : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
15 : #include "Evolution/DgSubcell/Tags/SubcellOptions.hpp"
16 : #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
17 : #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp"
18 : #include "PointwiseFunctions/Hydro/Tags.hpp"
19 : #include "Utilities/TMPL.hpp"
20 :
21 : /// \cond
22 : class DataVector;
23 : namespace EquationsOfState {
24 : template <bool IsRelativistic, size_t ThermodynamicDim>
25 : class EquationOfState;
26 : } // namespace EquationsOfState
27 : template <size_t Dim>
28 : class Mesh;
29 : namespace gsl {
30 : template <typename T>
31 : class not_null;
32 : } // namespace gsl
33 : template <typename T>
34 : class Variables;
35 : /// \endcond
36 :
37 : namespace NewtonianEuler::subcell {
38 : /*!
39 : * \brief Troubled-cell indicator applied to the DG solution.
40 : *
41 : * Computes the primitive variables on the DG grid, mutating them in the
42 : * DataBox. Then,
43 : * - apply RDMP TCI to the mass and energy density
44 : * - if the minimum density or pressure are below \f$10^{-18}\f$ (the arbitrary
45 : * threshold used to signal "negative" density and pressure), marks the
46 : * element as troubled and returns
47 : * - runs the Persson TCI on the mass and energy density. The reason for
48 : * applying the Persson TCI to both the mass and energy density is to flag
49 : * cells at contact discontinuities.
50 : */
51 : template <size_t Dim>
52 1 : class TciOnDgGrid {
53 : private:
54 0 : using MassDensityCons = NewtonianEuler::Tags::MassDensityCons;
55 0 : using EnergyDensity = NewtonianEuler::Tags::EnergyDensity;
56 0 : using MomentumDensity = NewtonianEuler::Tags::MomentumDensity<Dim>;
57 :
58 0 : using MassDensity = hydro::Tags::RestMassDensity<DataVector>;
59 0 : using Velocity = hydro::Tags::SpatialVelocity<DataVector, Dim>;
60 0 : using SpecificInternalEnergy =
61 : hydro::Tags::SpecificInternalEnergy<DataVector>;
62 0 : using Pressure = hydro::Tags::Pressure<DataVector>;
63 :
64 0 : static constexpr double min_density_allowed = 1.0e-18;
65 0 : static constexpr double min_pressure_allowed = 1.0e-18;
66 :
67 : public:
68 0 : using return_tags = tmpl::list<::Tags::Variables<
69 : tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>>;
70 0 : using argument_tags = tmpl::list<
71 : ::Tags::Variables<
72 : tmpl::list<MassDensityCons, MomentumDensity, EnergyDensity>>,
73 : hydro::Tags::EquationOfState<false, 2>, domain::Tags::Mesh<Dim>,
74 : evolution::dg::subcell::Tags::Mesh<Dim>,
75 : evolution::dg::subcell::Tags::DataForRdmpTci,
76 : evolution::dg::subcell::Tags::SubcellOptions<Dim>>;
77 :
78 0 : static std::tuple<bool, evolution::dg::subcell::RdmpTciData> apply(
79 : gsl::not_null<Variables<
80 : tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>*>
81 : dg_prim_vars,
82 : const Variables<
83 : tmpl::list<MassDensityCons, MomentumDensity, EnergyDensity>>& dg_vars,
84 : const EquationsOfState::EquationOfState<false, 2>& eos,
85 : const Mesh<Dim>& dg_mesh, const Mesh<Dim>& subcell_mesh,
86 : const evolution::dg::subcell::RdmpTciData& past_rdmp_tci_data,
87 : const evolution::dg::subcell::SubcellOptions& subcell_options,
88 : double persson_exponent, bool element_stays_on_dg);
89 : };
90 : } // namespace NewtonianEuler::subcell
|