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/Burgers/BoundaryCorrections/BoundaryCorrection.hpp" 12 : #include "Evolution/Systems/Burgers/Tags.hpp" 13 : #include "NumericalAlgorithms/DiscontinuousGalerkin/Formulation.hpp" 14 : #include "Options/String.hpp" 15 : #include "Utilities/Serialization/CharmPupable.hpp" 16 : #include "Utilities/TMPL.hpp" 17 : 18 : /// \cond 19 : class DataVector; 20 : namespace gsl { 21 : template <typename T> 22 : class not_null; 23 : } // namespace gsl 24 : namespace PUP { 25 : class er; 26 : } // namespace PUP 27 : /// \endcond 28 : 29 : namespace Burgers::BoundaryCorrections { 30 : /*! 31 : * \brief A Rusanov/local Lax-Friedrichs Riemann solver 32 : * 33 : * Let \f$U\f$ be the evolved variable, \f$F^i\f$ the flux, and \f$n_i\f$ be 34 : * the outward directed unit normal to the interface. Denoting \f$F := n_i 35 : * F^i\f$, the %Rusanov boundary correction is 36 : * 37 : * \f{align*} 38 : * G_\text{Rusanov} = \frac{F_\text{int} - F_\text{ext}}{2} - 39 : * \frac{\text{max}\left(|U_\text{int}|, |U_\text{ext}|\right)}{2} 40 : * \left(U_\text{ext} - U_\text{int}\right), 41 : * \f} 42 : * 43 : * where "int" and "ext" stand for interior and exterior. The minus sign in 44 : * front of the \f$F_{\text{ext}}\f$ is necessary because the outward directed 45 : * normal of the neighboring element has the opposite sign, i.e. 46 : * \f$n_i^{\text{ext}}=-n_i^{\text{int}}\f$. 47 : * 48 : * \note In the strong form the `dg_boundary_terms` function returns 49 : * \f$G - F_\text{int}\f$ 50 : */ 51 1 : class Rusanov final : public BoundaryCorrection { 52 : private: 53 0 : struct AbsCharSpeed : db::SimpleTag { 54 0 : using type = Scalar<DataVector>; 55 : }; 56 : 57 : public: 58 0 : using options = tmpl::list<>; 59 0 : static constexpr Options::String help = { 60 : "Computes the Rusanov or local Lax-Friedrichs boundary correction term " 61 : "for the Burgers system."}; 62 : 63 0 : Rusanov() = default; 64 0 : Rusanov(const Rusanov&) = default; 65 0 : Rusanov& operator=(const Rusanov&) = default; 66 0 : Rusanov(Rusanov&&) = default; 67 0 : Rusanov& operator=(Rusanov&&) = default; 68 0 : ~Rusanov() override = default; 69 : 70 : /// \cond 71 : explicit Rusanov(CkMigrateMessage* msg); 72 : using PUP::able::register_constructor; 73 : WRAPPED_PUPable_decl_template(Rusanov); // NOLINT 74 : /// \endcond 75 0 : void pup(PUP::er& p) override; // NOLINT 76 : 77 0 : std::unique_ptr<BoundaryCorrection> get_clone() const override; 78 : 79 0 : using dg_package_field_tags = 80 : tmpl::list<Tags::U, ::Tags::NormalDotFlux<Tags::U>, AbsCharSpeed>; 81 0 : using dg_package_data_temporary_tags = tmpl::list<>; 82 0 : using dg_package_data_volume_tags = tmpl::list<>; 83 0 : using dg_boundary_terms_volume_tags = tmpl::list<>; 84 : 85 0 : static double dg_package_data( 86 : gsl::not_null<Scalar<DataVector>*> packaged_u, 87 : gsl::not_null<Scalar<DataVector>*> packaged_normal_dot_flux, 88 : gsl::not_null<Scalar<DataVector>*> packaged_abs_char_speed, 89 : const Scalar<DataVector>& u, 90 : const tnsr::I<DataVector, 1, Frame::Inertial>& flux_u, 91 : const tnsr::i<DataVector, 1, Frame::Inertial>& normal_covector, 92 : const std::optional<tnsr::I<DataVector, 1, Frame::Inertial>>& 93 : mesh_velocity, 94 : const std::optional<Scalar<DataVector>>& normal_dot_mesh_velocity); 95 : 96 0 : static void dg_boundary_terms( 97 : gsl::not_null<Scalar<DataVector>*> boundary_correction_u, 98 : const Scalar<DataVector>& u_int, 99 : const Scalar<DataVector>& normal_dot_flux_u_int, 100 : const Scalar<DataVector>& abs_char_speed_int, 101 : const Scalar<DataVector>& u_ext, 102 : const Scalar<DataVector>& normal_dot_flux_u_ext, 103 : const Scalar<DataVector>& abs_char_speed_ext, 104 : dg::Formulation dg_formulation); 105 : }; 106 : } // namespace Burgers::BoundaryCorrections