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/Systems/GrMhd/ValenciaDivClean/Subcell/TciOptions.hpp"
12 #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
13 #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.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 TagsList>
30 class Variables;
31 /// \endcond
32 
34 /*!
35  * \brief The troubled-cell indicator run on the DG grid to check if the
36  * solution is admissible.
37  *
38  * We denote variables at the candidate solution's time level by a superscript
39  * \f$n+1\f$ and at the time level where the solution is known to be admissible
40  * by a superscript \f$n\f$.
41  *
42  * The following checks are done in the order they are listed:
43  *
44  * - if \f$\min(\tilde{D}^{n+1}/\sqrt{\gamma^{n}})\f$ is less than
45  * `tci_options.minimum_rest_mass_density_times_lorentz_factor` then we have a
46  * negative (or extremely small) density and the cell is troubled. Note that
47  * if this `tci_option` is approximately equal to or larger than the
48  * `atmosphere_density`, the atmosphere will be flagged as troubled.
49  * - if \f$\max(\tilde{D}^{n+1}/(\sqrt{\gamma^n}W^n))\f$ and \f$\max(\rho^n)\f$
50  * are less than `tci_options.atmosphere_density` then the entire DG element
51  * is in atmosphere and it is _not_ troubled.
52  * - if
53  * \f$(\tilde{B}^{n+1})^2>2\sqrt{\gamma^n}(1-\epsilon_B)\tilde{\tau}^{n+1}\f$
54  * at any grid point, then the cell is troubled
55  * - attempt a primitive recovery using the `RecoveryScheme` from the template
56  * parameter. The cell is marked as troubled if the primitive recovery fails
57  * at any grid point.
58  * - if \f$\max(\rho^{n+1})\f$ is below `tci_options.atmosphere_density` then
59  * the cell is in atmosphere and not marked as troubled. Note that the
60  * magnetic field is still freely evolved.
61  * - apply the Persson TCI to \f$\tilde{D}^{n+1}\f$ and \f$\tilde{\tau}^{n+1}\f$
62  *
63  * If the cell is not flagged as troubled then the primitives are computed at
64  * time level `n+1`.
65  */
66 template <typename RecoveryScheme>
67 class TciOnDgGrid {
68  public:
69  using return_tags =
70  tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>>;
71  using argument_tags =
81 
82  template <size_t ThermodynamicDim>
83  static bool apply(
84  gsl::not_null<Variables<hydro::grmhd_tags<DataVector>>*> dg_prim_vars,
85  const Scalar<DataVector>& tilde_d, const Scalar<DataVector>& tilde_tau,
86  const tnsr::i<DataVector, 3, Frame::Inertial>& tilde_s,
87  const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_b,
88  const Scalar<DataVector>& tilde_phi,
89  const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,
90  const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric,
91  const Scalar<DataVector>& sqrt_det_spatial_metric,
93  const Mesh<3>& dg_mesh, const TciOptions& tci_options,
94  double persson_exponent) noexcept;
95 };
96 } // namespace grmhd::ValenciaDivClean::subcell
EquationsOfState
Contains all equations of state, including base class.
Definition: DarkEnergyFluid.hpp:26
gr::Tags::SpatialMetric
Definition: Tags.hpp:26
EquationsOfState::EquationOfState
Base class for equations of state depending on whether or not the system is relativistic,...
Definition: EquationOfState.hpp:63
grmhd::ValenciaDivClean::subcell
Code required by the DG-subcell/FD hybrid solver.
Definition: InitialDataTci.hpp:23
Tags.hpp
domain::Tags::Mesh
The computational grid of the Element in the DataBox.
Definition: Tags.hpp:107
grmhd::ValenciaDivClean::subcell::TciOnDgGrid
The troubled-cell indicator run on the DG grid to check if the solution is admissible.
Definition: TciOnDgGrid.hpp:67
cstddef
grmhd::ValenciaDivClean::subcell::TciOptions
Class holding options using by the GRMHD-specific parts of the troubled-cell indicator.
Definition: TciOptions.hpp:25
grmhd::ValenciaDivClean::Tags::TildeS
The densitized momentum density .
Definition: Tags.hpp:42
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
grmhd::ValenciaDivClean::Tags::TildeB
The densitized magnetic field .
Definition: Tags.hpp:49
Mesh
Holds the number of grid points, basis, and quadrature in each direction of the computational grid.
Definition: Mesh.hpp:49
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
grmhd::ValenciaDivClean::subcell::Tags::TciOptions
Definition: TciOptions.hpp:82
TypeAliases.hpp
hydro::Tags::EquationOfStateBase
Base tag for the equation of state.
Definition: Tags.hpp:53
gr::spatial_metric
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
grmhd::ValenciaDivClean::Tags::TildeD
The densitized rest-mass density .
Definition: Tags.hpp:31
grmhd::ValenciaDivClean::Tags::TildePhi
The densitized divergence-cleaning field .
Definition: Tags.hpp:55
gsl
Implementations from the Guideline Support Library.
Definition: ReadSpecPiecewisePolynomial.hpp:11
TMPL.hpp
gr::Tags::InverseSpatialMetric
Inverse of the spatial metric.
Definition: Tags.hpp:33
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecPiecewisePolynomial.hpp:13
grmhd::ValenciaDivClean::Tags::TildeTau
The densitized energy density .
Definition: Tags.hpp:36
gr::Tags::SqrtDetSpatialMetric
Definition: Tags.hpp:44