TciOnDgGrid.hpp
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"
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
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,
95 };
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
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
The troubled-cell indicator run on the DG grid to check if the solution is admissible.
Definition: TciOnDgGrid.hpp:67
cstddef
Class holding options using by the GRMHD-specific parts of the troubled-cell indicator.
Definition: TciOptions.hpp:25
The densitized momentum density .
Definition: Tags.hpp:42
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:46
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
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.
The densitized rest-mass density .
Definition: Tags.hpp:31
The densitized divergence-cleaning field .
Definition: Tags.hpp:55
gsl
Implementations from the Guideline Support Library.