TciOnDgGrid.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
9 #include "DataStructures/VariablesTag.hpp"
10 #include "Domain/Tags.hpp"
11 #include "Evolution/DgSubcell/Tags/Inactive.hpp"
12 #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
13 #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp"
14 #include "PointwiseFunctions/Hydro/Tags.hpp"
15 #include "Utilities/TMPL.hpp"
16 
17 /// \cond
18 class DataVector;
19 namespace EquationsOfState {
20 template <bool IsRelativistic, size_t ThermodynamicDim>
21 class EquationOfState;
22 } // namespace EquationsOfState
23 template <size_t Dim>
24 class Mesh;
25 namespace gsl {
26 template <typename T>
27 class not_null;
28 } // namespace gsl
29 template <typename T>
30 class Variables;
31 /// \endcond
32 
33 namespace NewtonianEuler::subcell {
34 /*!
35  * \brief Troubled-cell indicator applied to the DG solution.
36  *
37  * Computes the primitive variables on the DG grid, mutating them in the
38  * DataBox. Then,
39  * - if the minimum density or pressure are below \f$10^{-18}\f$ (the arbitrary
40  * threshold used to signal "negative" density and pressure), marks the
41  * element as troubled and returns
42  * - runs the Persson TCI on the density and pressure. The reason for applying
43  * the Persson TCI to both the density and pressure is to flag cells at
44  * contact discontinuities.
45  */
46 template <size_t Dim>
47 class TciOnDgGrid {
48  private:
52 
58 
59  static constexpr double min_density_allowed = 1.0e-18;
60  static constexpr double min_pressure_allowed = 1.0e-18;
61 
62  public:
63  using return_tags = tmpl::list<::Tags::Variables<
64  tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>>;
65  using argument_tags =
68 
69  template <size_t ThermodynamicDim>
70  static bool apply(
71  const gsl::not_null<Variables<
72  tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>*>
73  dg_prim_vars,
74  const Scalar<DataVector>& mass_density,
75  const tnsr::I<DataVector, Dim, Frame::Inertial>& momentum_density,
76  const Scalar<DataVector>& energy_density,
78  const Mesh<Dim>& dg_mesh, const double persson_exponent) noexcept;
79 };
80 } // namespace NewtonianEuler::subcell
EquationsOfState
Contains all equations of state, including base class.
Definition: DarkEnergyFluid.hpp:26
EquationsOfState::EquationOfState
Base class for equations of state depending on whether or not the system is relativistic,...
Definition: EquationOfState.hpp:63
Tags.hpp
NewtonianEuler::Tags::MassDensity
The mass density of the fluid.
Definition: Tags.hpp:26
Tags::Variables
Definition: VariablesTag.hpp:21
NewtonianEuler::Tags::SpecificInternalEnergy
The specific internal energy of the fluid.
Definition: Tags.hpp:60
domain::Tags::Mesh
The computational grid of the Element in the DataBox.
Definition: Tags.hpp:107
NewtonianEuler::Tags::MassDensityCons
The mass density of the fluid (as a conservative variable).
Definition: Tags.hpp:31
NewtonianEuler::subcell
Code required by the DG-subcell/FD hybrid solver.
Definition: InitialDataTci.hpp:22
cstddef
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
NewtonianEuler::Tags::Pressure
The fluid pressure.
Definition: Tags.hpp:66
NewtonianEuler::Tags::EnergyDensity
The energy density of the fluid.
Definition: Tags.hpp:45
NewtonianEuler::subcell::TciOnDgGrid
Troubled-cell indicator applied to the DG solution.
Definition: TciOnDgGrid.hpp:47
Mesh
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:49
NewtonianEuler::Tags::MomentumDensity
The momentum density of the fluid.
Definition: Tags.hpp:37
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
TypeAliases.hpp
hydro::Tags::EquationOfStateBase
Base tag for the equation of state.
Definition: Tags.hpp:53
NewtonianEuler::Tags::Velocity
The macroscopic or flow velocity of the fluid.
Definition: Tags.hpp:51
gsl
Implementations from the Guideline Support Library.
Definition: ReadSpecPiecewisePolynomial.hpp:11
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13