SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/ValenciaDivClean/Subcell - TciOnDgGrid.hpp Hit Total Coverage
Commit: aabde07399ba7837e5db64eedfd0a21f31f96922 Lines: 1 5 20.0 %
Date: 2024-04-26 02:38:13
Legend: Lines: hit not hit

          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/GrMhd/ValenciaDivClean/PrimitiveFromConservativeOptions.hpp"
      17             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Subcell/TciOptions.hpp"
      18             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
      19             : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
      20             : #include "PointwiseFunctions/Hydro/Tags.hpp"
      21             : #include "Utilities/TMPL.hpp"
      22             : 
      23             : /// \cond
      24             : class DataVector;
      25             : namespace EquationsOfState {
      26             : template <bool IsRelativistic, size_t ThermodynamicDim>
      27             : class EquationOfState;
      28             : }  // namespace EquationsOfState
      29             : namespace evolution::dg::subcell {
      30             : struct RdmpTciData;
      31             : class SubcellOptions;
      32             : }  // namespace evolution::dg::subcell
      33             : template <size_t Dim>
      34             : class Mesh;
      35             : namespace gsl {
      36             : template <typename T>
      37             : class not_null;
      38             : }  // namespace gsl
      39             : template <typename TagsList>
      40             : class Variables;
      41             : /// \endcond
      42             : 
      43             : namespace grmhd::ValenciaDivClean::subcell {
      44             : /*!
      45             :  * \brief The troubled-cell indicator run on the DG grid to check if the
      46             :  * solution is admissible.
      47             :  *
      48             :  * We denote variables at the candidate solution's time level by a superscript
      49             :  * \f$n+1\f$ and at the time level where the solution is known to be admissible
      50             :  * by a superscript \f$n\f$.
      51             :  *
      52             :  * The following checks are done in the order they are listed:
      53             :  *
      54             :  * <table>
      55             :  * <caption>List of checks</caption>
      56             :  * <tr><th> Description <th> TCI status
      57             :  *
      58             :  * <tr><td> if \f$\min(\tilde{D}^{n+1}/\textrm{avg}(\sqrt{\gamma^{n}}))\f$
      59             :  * is less than `tci_options.minimum_rest_mass_density_times_lorentz_factor`
      60             :  * or if \f$\min(\tilde{Y}_e^{n+1}/\textrm{avg}(\sqrt{\gamma^{n}}))\f$ is less
      61             :  * than `tci_options.minimum_rest_mass_density_times_lorentz_factor` times
      62             :  * `tci_options.minimum_ye`, we have a negative (or extremely small) density or
      63             :  * electron fraction and the cell is troubled. Note that if this `tci_option` is
      64             :  * approximately equal to or larger than the `atmosphere_density`, the
      65             :  * atmosphere will be flagged as troubled.
      66             :  * <td> `-1`
      67             :  *
      68             :  * <tr><td> if \f$\tilde{\tau}\f$ is less than `tci_options.minimum_tilde_tau`
      69             :  * then we have a negative (or extremely small) energy and the cell is troubled.
      70             :  * <td> `-2`
      71             :  *
      72             :  * <tr><td> if \f$\max(\tilde{D}^{n+1}/(\sqrt{\gamma^n}W^n))\f$ and
      73             :  * \f$\max(\rho^n)\f$ are less than `tci_options.atmosphere_density` then the
      74             :  * entire DG element is in atmosphere and it is _not_ troubled.
      75             :  * <td> `0`
      76             :  *
      77             :  * <tr><td> if
      78             :  * \f$(\tilde{B}^{n+1})^2>2\sqrt{\gamma^n}(1-\epsilon_B)\tilde{\tau}^{n+1}\f$ at
      79             :  * any grid point, then the cell is troubled.
      80             :  * <td> `-3`
      81             :  *
      82             :  * <tr><td> attempt a primitive recovery using the `RecoveryScheme` from the
      83             :  * template parameter. The cell is marked as troubled if the primitive recovery
      84             :  * fails at any grid point.
      85             :  * <td> `-4`
      86             :  *
      87             :  * <tr><td> if \f$\max(\rho^{n+1})\f$ is below `tci_options.atmosphere_density`
      88             :  * then the cell is in atmosphere and not marked as troubled. Note that the
      89             :  * magnetic field is still freely evolved.
      90             :  * <td> `0`
      91             :  *
      92             :  * <tr><td> apply the Persson TCI to \f$\tilde{D}^{n+1}\f$
      93             :  * <td> `-5`
      94             :  *
      95             :  * <tr><td> apply the Persson TCI to \f$\tilde{Y}_e^{n+1}\f$
      96             :  * <td> `-6`
      97             :  *
      98             :  * <tr><td> apply the Persson TCI to pressure \f$p^{n+1}\f$
      99             :  * <td> `-7`
     100             :  *
     101             :  * <tr><td> apply the Persson TCI to the magnitude of \f$\tilde{B}^{n+1}\f$ if
     102             :  * its magnitude is greater than `tci_options.magnetic_field_cutoff`
     103             :  * <td> `-8`
     104             :  *
     105             :  * <tr><td> apply the RDMP TCI to `TildeD`
     106             :  * <td> `-9`
     107             :  *
     108             :  * <tr><td> apply the RDMP TCI to `TildeTau`
     109             :  * <td> `-10`
     110             :  *
     111             :  * <tr><td> apply the RDMP TCI to `TildeB`
     112             :  * <td> `-11`
     113             :  *
     114             :  * </table>
     115             :  *
     116             :  * If the cell is not flagged as troubled then the primitives are computed at
     117             :  * time level `n+1`.
     118             :  *
     119             :  * The second column of the table above denotes the value of an integer stored
     120             :  * as the first element of the returned `std::tuple`, which indicates the
     121             :  * particular kind of check that failed. For example, if the fifth check
     122             :  * (primitive recovery) fails and cell is marked as troubled, an integer with
     123             :  * value `-4` is stored in the first slot of the returned tuple. Note that this
     124             :  * integer is marking only the _first_ check to fail, since checks are done in a
     125             :  * particular sequence as listed above. If all checks are passed and cell is not
     126             :  * troubled, it is returned with the value `0`.
     127             :  *
     128             :  * \note We adopt negative integers to mark TCI status from DG grid returned by
     129             :  * TciOnDgGrid class. Positive integers are used for TCIs on FD grid; see
     130             :  * TciOnFdGrid and its documentation.
     131             :  *
     132             :  */
     133             : template <typename RecoveryScheme>
     134           1 : class TciOnDgGrid {
     135             :  public:
     136           0 :   using return_tags =
     137             :       tmpl::list<::Tags::Variables<hydro::grmhd_tags<DataVector>>>;
     138           0 :   using argument_tags = tmpl::list<
     139             :       grmhd::ValenciaDivClean::Tags::TildeD,
     140             :       grmhd::ValenciaDivClean::Tags::TildeYe,
     141             :       grmhd::ValenciaDivClean::Tags::TildeTau,
     142             :       grmhd::ValenciaDivClean::Tags::TildeS<>,
     143             :       grmhd::ValenciaDivClean::Tags::TildeB<>,
     144             :       grmhd::ValenciaDivClean::Tags::TildePhi,
     145             :       gr::Tags::SpatialMetric<DataVector, 3>,
     146             :       gr::Tags::InverseSpatialMetric<DataVector, 3>,
     147             :       gr::Tags::SqrtDetSpatialMetric<DataVector>,
     148             :       hydro::Tags::GrmhdEquationOfState, domain::Tags::Mesh<3>,
     149             :       evolution::dg::subcell::Tags::Mesh<3>,
     150             :       evolution::dg::subcell::Tags::DataForRdmpTci, Tags::TciOptions,
     151             :       evolution::dg::subcell::Tags::SubcellOptions<3>,
     152             :       grmhd::ValenciaDivClean::Tags::PrimitiveFromConservativeOptions>;
     153             : 
     154           0 :   static std::tuple<int, evolution::dg::subcell::RdmpTciData> apply(
     155             :       gsl::not_null<Variables<hydro::grmhd_tags<DataVector>>*> dg_prim_vars,
     156             :       const Scalar<DataVector>& tilde_d, const Scalar<DataVector>& tilde_ye,
     157             :       const Scalar<DataVector>& tilde_tau,
     158             :       const tnsr::i<DataVector, 3, Frame::Inertial>& tilde_s,
     159             :       const tnsr::I<DataVector, 3, Frame::Inertial>& tilde_b,
     160             :       const Scalar<DataVector>& tilde_phi,
     161             :       const tnsr::ii<DataVector, 3, Frame::Inertial>& spatial_metric,
     162             :       const tnsr::II<DataVector, 3, Frame::Inertial>& inv_spatial_metric,
     163             :       const Scalar<DataVector>& sqrt_det_spatial_metric,
     164             :       const EquationsOfState::EquationOfState<true, 3>& eos,
     165             :       const Mesh<3>& dg_mesh, const Mesh<3>& subcell_mesh,
     166             :       const evolution::dg::subcell::RdmpTciData& past_rdmp_tci_data,
     167             :       const TciOptions& tci_options,
     168             :       const evolution::dg::subcell::SubcellOptions& subcell_options,
     169             :       const grmhd::ValenciaDivClean::PrimitiveFromConservativeOptions&
     170             :           primitive_from_conservative_options,
     171             :       double persson_exponent, bool element_stays_on_dg);
     172             : };
     173             : }  // namespace grmhd::ValenciaDivClean::subcell

Generated by: LCOV version 1.14