Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <pup.h> 7 : 8 : #include "DataStructures/Tensor/TypeAliases.hpp" 9 : #include "Evolution/Systems/ScalarAdvection/Tags.hpp" 10 : #include "Options/String.hpp" 11 : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp" 12 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp" 13 : #include "Utilities/TMPL.hpp" 14 : #include "Utilities/TaggedTuple.hpp" 15 : 16 : /// \cond 17 : class DataVector; 18 : // IWYU pragma: no_forward_declare Tensor 19 : namespace PUP { 20 : class er; 21 : } // namespace PUP 22 : /// \endcond 23 : 24 : namespace ScalarAdvection { 25 : namespace Solutions { 26 : /*! 27 : * \brief Initial data for the 1D scalar advection problem adopted from 28 : * \cite Krivodonova2007 and its analytic solution. 29 : * 30 : * The initial proļ¬le consists of a combination of Gaussians, a square pulse, 31 : * a sharp triangle, and a combination of half-ellipses. 32 : * 33 : * \f{align*} 34 : * u(x,t=0) = \left\{\begin{array}{lcl} 35 : * (G(x,\beta,z-\delta) + G(x,\beta,z+\delta) + 4G(x,\beta,z))/6 & \text{if} & 36 : * -0.8 \leq x \leq -0.6 \\ 37 : * 1 & \text{if} & -0.4 \leq x \leq -0.2 \\ 38 : * 1 - |10(x-0.1)| & \text{if} & 0 \leq x \leq 0.2 \\ 39 : * (F(x,\alpha,a-\delta) + F(x,\alpha,a+\delta) + 4F(x,\alpha,a))/6 & \text{if} 40 : * & 0.4 \leq x \leq 0.6 \\ 41 : * 0 & \text{otherwise} & \\ 42 : * \end{array}\right\}, 43 : * \f} 44 : * 45 : * where 46 : * 47 : * \f{align*} 48 : * G(x,\beta, z) & = e^{-\beta(x-z)^2} \\ 49 : * F(x,\alpha, a) & = \sqrt{\max(1-\alpha^2(x-a)^2, 0)} 50 : * \f} 51 : * 52 : * with \f$a=0.5, z=-0.7, \delta=0.005, \alpha=10, \text{and }\beta = 53 : * \log2/(36\delta^2)\f$. 54 : * 55 : * The system is evolved over the 1D domain \f$[-1, 1]\f$ with the constant 56 : * advection velocity field \f$v(x) = 1.0\f$ and with the periodic boundary 57 : * condition. The initial profile is simply advected (translated) to +x 58 : * direction, going over cycles in the domain every 2.0 time unit. 59 : */ 60 1 : class Krivodonova : public evolution::initial_data::InitialData, 61 : public MarkAsAnalyticSolution { 62 : public: 63 0 : using options = tmpl::list<>; 64 0 : static constexpr Options::String help{ 65 : "An advecting 1D profile adopted from Krivodonova2007 paper, periodic " 66 : "over the interval [-1, 1]"}; 67 : 68 0 : Krivodonova() = default; 69 0 : Krivodonova(const Krivodonova&) = default; 70 0 : Krivodonova& operator=(const Krivodonova&) = default; 71 0 : Krivodonova(Krivodonova&&) = default; 72 0 : Krivodonova& operator=(Krivodonova&&) = default; 73 0 : ~Krivodonova() override = default; 74 : 75 0 : auto get_clone() const 76 : -> std::unique_ptr<evolution::initial_data::InitialData> override; 77 : 78 : template <typename DataType> 79 0 : tuples::TaggedTuple<ScalarAdvection::Tags::U> variables( 80 : const tnsr::I<DataType, 1>& x, double t, 81 : tmpl::list<ScalarAdvection::Tags::U> /*meta*/) const; 82 : 83 : // NOLINTNEXTLINE(google-runtime-references) 84 0 : void pup(PUP::er& p) override; 85 : 86 : /// \cond 87 : explicit Krivodonova(CkMigrateMessage* msg); 88 : using PUP::able::register_constructor; 89 : WRAPPED_PUPable_decl_template(Krivodonova); 90 : /// \endcond 91 : }; 92 : 93 0 : bool operator==(const Krivodonova& /*lhs*/, const Krivodonova& /*rhs*/); 94 : 95 0 : bool operator!=(const Krivodonova& lhs, const Krivodonova& rhs); 96 : 97 : } // namespace Solutions 98 : } // namespace ScalarAdvection