SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/NewtonianEuler/Subcell - TciOnFdGrid.hpp Hit Total Coverage
Commit: e93d8312de4f331d36b5aa00ea83a894e26dfcb7 Lines: 1 15 6.7 %
Date: 2021-09-24 22:40:29
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             : 
       8             : #include "DataStructures/Tensor/TypeAliases.hpp"
       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             : template <size_t Dim>
      20             : class Mesh;
      21             : namespace gsl {
      22             : template <typename T>
      23             : class not_null;
      24             : }  // namespace gsl
      25             : template <typename TagsList>
      26             : class Variables;
      27             : /// \endcond
      28             : 
      29             : namespace NewtonianEuler::subcell {
      30             : /*!
      31             :  * \brief Troubled-cell indicator applied to the finite difference subcell
      32             :  * solution to check if the corresponding DG solution is admissible.
      33             :  *
      34             :  * Computes the primitive variables on the DG and subcell grids, mutating the
      35             :  * subcell/active primitive variables in the DataBox. Then,
      36             :  * - if the minimum density or pressure on either the DG or subcell mesh are
      37             :  *   below \f$10^{-18}\f$, marks the element as troubled and returns. We check
      38             :  *   both the FD and DG grids since when a discontinuity is inside the element
      39             :  *   oscillations in the DG solution can result in negative values that aren't
      40             :  *   present in the FD solution.
      41             :  * - runs the Persson TCI on the density and pressure on the DG grid. The reason
      42             :  *   for applying the Persson TCI to both the density and pressure is to flag
      43             :  *   cells at contact discontinuities. The Persson TCI only works with
      44             :  *   spectral-type methods and is a direct check of whether or not the DG
      45             :  *   solution is a good representation of the underlying data.
      46             :  *
      47             :  * Please note that the TCI is run after the subcell solution has been
      48             :  * reconstructed to the DG grid, and so `Inactive<Tag>` is the updated DG
      49             :  * solution.
      50             :  */
      51             : template <size_t Dim>
      52           1 : class TciOnFdGrid {
      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 = NewtonianEuler::Tags::MassDensity<DataVector>;
      59           0 :   using Velocity = NewtonianEuler::Tags::Velocity<DataVector, Dim>;
      60           0 :   using SpecificInternalEnergy =
      61             :       NewtonianEuler::Tags::SpecificInternalEnergy<DataVector>;
      62           0 :   using Pressure = NewtonianEuler::Tags::Pressure<DataVector>;
      63             : 
      64             :   template <typename Tag>
      65           0 :   using Inactive = evolution::dg::subcell::Tags::Inactive<Tag>;
      66             : 
      67           0 :   static constexpr double min_density_allowed = 1.0e-18;
      68           0 :   static constexpr double min_pressure_allowed = 1.0e-18;
      69             : 
      70             :  public:
      71           0 :   using return_tags = tmpl::list<::Tags::Variables<
      72             :       tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>>;
      73           0 :   using argument_tags =
      74             :       tmpl::list<MassDensityCons, MomentumDensity, EnergyDensity,
      75             :                  Inactive<MassDensityCons>, Inactive<MomentumDensity>,
      76             :                  Inactive<EnergyDensity>, hydro::Tags::EquationOfStateBase,
      77             :                  domain::Tags::Mesh<Dim>>;
      78             : 
      79             :   template <size_t ThermodynamicDim>
      80           0 :   static bool apply(
      81             :       gsl::not_null<Variables<
      82             :           tmpl::list<MassDensity, Velocity, SpecificInternalEnergy, Pressure>>*>
      83             :           subcell_grid_prim_vars,
      84             :       const Scalar<DataVector>& subcell_mass_density,
      85             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& subcell_momentum_density,
      86             :       const Scalar<DataVector>& subcell_energy_density,
      87             :       const Scalar<DataVector>& dg_mass_density,
      88             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& dg_momentum_density,
      89             :       const Scalar<DataVector>& dg_energy_density,
      90             :       const EquationsOfState::EquationOfState<false, ThermodynamicDim>& eos,
      91             :       const Mesh<Dim>& dg_mesh, double persson_exponent) noexcept;
      92             : };
      93             : }  // namespace NewtonianEuler::subcell

Generated by: LCOV version 1.14