SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/NewtonianEuler/BoundaryCorrections - Hll.hpp Hit Total Coverage
Commit: 2ae2b99409ac582030d56a4560a92a3e066a7e54 Lines: 1 22 4.5 %
Date: 2022-01-15 08:40:38
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 <memory>
       7             : #include <optional>
       8             : 
       9             : #include "DataStructures/DataBox/Prefixes.hpp"
      10             : #include "DataStructures/Tensor/TypeAliases.hpp"
      11             : #include "Evolution/Systems/NewtonianEuler/BoundaryCorrections/BoundaryCorrection.hpp"
      12             : #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
      13             : #include "NumericalAlgorithms/DiscontinuousGalerkin/Formulation.hpp"
      14             : #include "Options/Options.hpp"
      15             : #include "Parallel/CharmPupable.hpp"
      16             : #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp"
      17             : #include "PointwiseFunctions/Hydro/Tags.hpp"
      18             : #include "Utilities/Gsl.hpp"
      19             : #include "Utilities/TMPL.hpp"
      20             : 
      21             : /// \cond
      22             : class DataVector;
      23             : namespace gsl {
      24             : template <typename T>
      25             : class not_null;
      26             : }  // namespace gsl
      27             : namespace PUP {
      28             : class er;
      29             : }  // namespace PUP
      30             : /// \endcond
      31             : 
      32             : namespace NewtonianEuler::BoundaryCorrections {
      33             : /*!
      34             :  * \brief An HLL (Harten-Lax-van Leer) Riemann solver for NewtonianEuler system
      35             :  *
      36             :  * Let \f$U\f$ be the evolved variable, \f$F^i\f$ the flux, and \f$n_i\f$ be the
      37             :  * outward directed unit normal to the interface. Denoting \f$F := n_i F^i\f$,
      38             :  * the HLL boundary correction is \cite Harten1983
      39             :  *
      40             :  * \f{align*}
      41             :  * G_\text{HLL} = \frac{\lambda_\text{max} F_\text{int} +
      42             :  * \lambda_\text{min} F_\text{ext}}{\lambda_\text{max} - \lambda_\text{min}}
      43             :  * - \frac{\lambda_\text{min}\lambda_\text{max}}{\lambda_\text{max} -
      44             :  *   \lambda_\text{min}} \left(U_\text{int} - U_\text{ext}\right)
      45             :  * \f}
      46             :  *
      47             :  * where "int" and "ext" stand for interior and exterior.
      48             :  * \f$\lambda_\text{min}\f$ and \f$\lambda_\text{max}\f$ are defined as
      49             :  *
      50             :  * \f{align*}
      51             :  * \lambda_\text{min} &=
      52             :  * \text{min}\left(\lambda^{-}_\text{int},-\lambda^{+}_\text{ext}, 0\right) \\
      53             :  * \lambda_\text{max} &=
      54             :  * \text{max}\left(\lambda^{+}_\text{int},-\lambda^{-}_\text{ext}, 0\right)
      55             :  * \f}
      56             :  *
      57             :  * where \f$\lambda^{+}\f$ (\f$\lambda^{-}\f$) is the largest characteristic
      58             :  * speed in the outgoing (ingoing) direction. Note the minus signs in front of
      59             :  * \f$\lambda^{\pm}_\text{ext}\f$, which is because an outgoing speed w.r.t. the
      60             :  * neighboring element is an ingoing speed w.r.t. the local element, and vice
      61             :  * versa. Similarly, the \f$F_{\text{ext}}\f$ term in \f$G_\text{HLL}\f$ has a
      62             :  * positive sign because the outward directed normal of the neighboring element
      63             :  * has the opposite sign, i.e. \f$n_i^{\text{ext}}=-n_i^{\text{int}}\f$.
      64             :  *
      65             :  * For the NewtonianEuler system, \f$\lambda^\pm\f$ are given as
      66             :  *
      67             :  * \f{align*}
      68             :  * \lambda^\pm = v^in_i \pm c_s
      69             :  * \f}
      70             :  *
      71             :  * where \f$v^i\f$ is the spatial velocity and \f$c_s\f$ the sound speed.
      72             :  *
      73             :  * \note
      74             :  * - In the strong form the `dg_boundary_terms` function returns \f$G -
      75             :  *   F_\text{int}\f$
      76             :  * - For either \f$\lambda_\text{min} = 0\f$ or \f$\lambda_\text{max} = 0\f$
      77             :  *   (i.e. all characteristics move in the same direction) the HLL boundary
      78             :  *   correction reduces to pure upwinding.
      79             :  * - Some references use \f$S\f$ instead of \f$\lambda\f$ for the
      80             :  *   signal/characteristic speeds
      81             :  */
      82             : template <size_t Dim>
      83           1 : class Hll final : public BoundaryCorrection<Dim> {
      84             :  public:
      85           0 :   struct LargestOutgoingCharSpeed : db::SimpleTag {
      86           0 :     using type = Scalar<DataVector>;
      87             :   };
      88           0 :   struct LargestIngoingCharSpeed : db::SimpleTag {
      89           0 :     using type = Scalar<DataVector>;
      90             :   };
      91             : 
      92           0 :   using options = tmpl::list<>;
      93           0 :   static constexpr Options::String help = {
      94             :       "Computes the HLL boundary correction term for the "
      95             :       "Newtonian Euler/hydrodynamics system."};
      96             : 
      97           0 :   Hll() = default;
      98           0 :   Hll(const Hll&) = default;
      99           0 :   Hll& operator=(const Hll&) = default;
     100           0 :   Hll(Hll&&) = default;
     101           0 :   Hll& operator=(Hll&&) = default;
     102           0 :   ~Hll() override = default;
     103             : 
     104             :   /// \cond
     105             :   explicit Hll(CkMigrateMessage* msg);
     106             :   using PUP::able::register_constructor;
     107             :   WRAPPED_PUPable_decl_template(Hll);  // NOLINT
     108             :   /// \endcond
     109           0 :   void pup(PUP::er& p) override;  // NOLINT
     110             : 
     111           0 :   std::unique_ptr<BoundaryCorrection<Dim>> get_clone() const override;
     112             : 
     113           0 :   using dg_package_field_tags =
     114             :       tmpl::list<Tags::MassDensityCons, Tags::MomentumDensity<Dim>,
     115             :                  Tags::EnergyDensity,
     116             :                  ::Tags::NormalDotFlux<Tags::MassDensityCons>,
     117             :                  ::Tags::NormalDotFlux<Tags::MomentumDensity<Dim>>,
     118             :                  ::Tags::NormalDotFlux<Tags::EnergyDensity>,
     119             :                  LargestOutgoingCharSpeed, LargestIngoingCharSpeed>;
     120           0 :   using dg_package_data_temporary_tags = tmpl::list<>;
     121           0 :   using dg_package_data_primitive_tags =
     122             :       tmpl::list<NewtonianEuler::Tags::Velocity<DataVector, Dim>,
     123             :                  NewtonianEuler::Tags::SpecificInternalEnergy<DataVector>>;
     124           0 :   using dg_package_data_volume_tags =
     125             :       tmpl::list<hydro::Tags::EquationOfStateBase>;
     126             : 
     127             :   template <size_t ThermodynamicDim>
     128           0 :   double dg_package_data(
     129             :       gsl::not_null<Scalar<DataVector>*> packaged_mass_density,
     130             :       gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
     131             :           packaged_momentum_density,
     132             :       gsl::not_null<Scalar<DataVector>*> packaged_energy_density,
     133             :       gsl::not_null<Scalar<DataVector>*> packaged_normal_dot_flux_mass_density,
     134             :       gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
     135             :           packaged_normal_dot_flux_momentum_density,
     136             :       gsl::not_null<Scalar<DataVector>*>
     137             :           packaged_normal_dot_flux_energy_density,
     138             :       gsl::not_null<Scalar<DataVector>*> packaged_largest_outgoing_char_speed,
     139             :       gsl::not_null<Scalar<DataVector>*> packaged_largest_ingoing_char_speed,
     140             : 
     141             :       const Scalar<DataVector>& mass_density,
     142             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& momentum_density,
     143             :       const Scalar<DataVector>& energy_density,
     144             : 
     145             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& flux_mass_density,
     146             :       const tnsr::IJ<DataVector, Dim, Frame::Inertial>& flux_momentum_density,
     147             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& flux_energy_density,
     148             : 
     149             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& velocity,
     150             :       const Scalar<DataVector>& specific_internal_energy,
     151             : 
     152             :       const tnsr::i<DataVector, Dim, Frame::Inertial>& normal_covector,
     153             :       const std::optional<tnsr::I<DataVector, Dim, Frame::Inertial>>&
     154             :       /*mesh_velocity*/,
     155             :       const std::optional<Scalar<DataVector>>& normal_dot_mesh_velocity,
     156             :       const EquationsOfState::EquationOfState<false, ThermodynamicDim>&
     157             :           equation_of_state) const;
     158             : 
     159           0 :   void dg_boundary_terms(
     160             :       gsl::not_null<Scalar<DataVector>*> boundary_correction_mass_density,
     161             :       gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
     162             :           boundary_correction_momentum_density,
     163             :       gsl::not_null<Scalar<DataVector>*> boundary_correction_energy_density,
     164             :       const Scalar<DataVector>& mass_density_int,
     165             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& momentum_density_int,
     166             :       const Scalar<DataVector>& energy_density_int,
     167             :       const Scalar<DataVector>& normal_dot_flux_mass_density_int,
     168             :       const tnsr::I<DataVector, Dim, Frame::Inertial>&
     169             :           normal_dot_flux_momentum_density_int,
     170             :       const Scalar<DataVector>& normal_dot_flux_energy_density_int,
     171             :       const Scalar<DataVector>& largest_outgoing_char_speed_int,
     172             :       const Scalar<DataVector>& largest_ingoing_char_speed_int,
     173             :       const Scalar<DataVector>& mass_density_ext,
     174             :       const tnsr::I<DataVector, Dim, Frame::Inertial>& momentum_density_ext,
     175             :       const Scalar<DataVector>& energy_density_ext,
     176             :       const Scalar<DataVector>& normal_dot_flux_mass_density_ext,
     177             :       const tnsr::I<DataVector, Dim, Frame::Inertial>&
     178             :           normal_dot_flux_momentum_density_ext,
     179             :       const Scalar<DataVector>& normal_dot_flux_energy_density_ext,
     180             :       const Scalar<DataVector>& largest_outgoing_char_speed_ext,
     181             :       const Scalar<DataVector>& largest_ingoing_char_speed_ext,
     182             :       dg::Formulation dg_formulation) const;
     183             : };
     184             : }  // namespace NewtonianEuler::BoundaryCorrections

Generated by: LCOV version 1.14