Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <limits> 7 : 8 : #include "DataStructures/DataBox/Prefixes.hpp" // IWYU pragma: keep 9 : #include "DataStructures/Tensor/TypeAliases.hpp" 10 : #include "Evolution/Systems/Burgers/Tags.hpp" // IWYU pragma: keep 11 : #include "Options/String.hpp" 12 : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp" 13 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp" 14 : #include "Utilities/Serialization/CharmPupable.hpp" 15 : #include "Utilities/TMPL.hpp" 16 : #include "Utilities/TaggedTuple.hpp" 17 : 18 : /// \cond 19 : class DataVector; 20 : // IWYU pragma: no_forward_declare Tensor 21 : namespace PUP { 22 : class er; 23 : } // namespace PUP 24 : /// \endcond 25 : 26 : namespace Burgers::Solutions { 27 : /// A solution that is linear in space at all times. 28 : /// 29 : /// \f$u(x, t) = x / (t - t_0)\f$ where \f$t_0\f$ is the shock time. 30 1 : class Linear : public evolution::initial_data::InitialData, 31 : public MarkAsAnalyticSolution { 32 : public: 33 0 : struct ShockTime { 34 0 : using type = double; 35 0 : static constexpr Options::String help{"The time at which a shock forms"}; 36 : }; 37 : 38 0 : using options = tmpl::list<ShockTime>; 39 0 : static constexpr Options::String help{"A spatially linear solution"}; 40 : 41 0 : Linear() = default; 42 0 : Linear(const Linear&) = default; 43 0 : Linear& operator=(const Linear&) = default; 44 0 : Linear(Linear&&) = default; 45 0 : Linear& operator=(Linear&&) = default; 46 0 : ~Linear() override = default; 47 : 48 0 : explicit Linear(double shock_time); 49 : 50 0 : auto get_clone() const 51 : -> std::unique_ptr<evolution::initial_data::InitialData> override; 52 : 53 : /// \cond 54 : explicit Linear(CkMigrateMessage* msg); 55 : using PUP::able::register_constructor; 56 : WRAPPED_PUPable_decl_template(Linear); 57 : /// \endcond 58 : 59 : template <typename T> 60 0 : Scalar<T> u(const tnsr::I<T, 1>& x, double t) const; 61 : 62 : template <typename T> 63 0 : Scalar<T> du_dt(const tnsr::I<T, 1>& x, double t) const; 64 : 65 0 : tuples::TaggedTuple<Tags::U> variables(const tnsr::I<DataVector, 1>& x, 66 : double t, 67 : tmpl::list<Tags::U> /*meta*/) const; 68 : 69 0 : tuples::TaggedTuple<::Tags::dt<Tags::U>> variables( 70 : const tnsr::I<DataVector, 1>& x, double t, 71 : tmpl::list<::Tags::dt<Tags::U>> /*meta*/) const; 72 : 73 : // NOLINTNEXTLINE(google-runtime-references) 74 0 : void pup(PUP::er& p) override; 75 : 76 : private: 77 0 : double shock_time_ = std::numeric_limits<double>::signaling_NaN(); 78 : }; 79 : } // namespace Burgers::Solutions