Linear.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <limits>
7
8 #include "DataStructures/DataBox/Prefixes.hpp" // IWYU pragma: keep
10 #include "Evolution/Systems/Burgers/Tags.hpp" // IWYU pragma: keep
11 #include "Options/Options.hpp"
12 #include "Utilities/TMPL.hpp"
14
15 /// \cond
16 class DataVector;
17 // IWYU pragma: no_forward_declare Tensor
18 namespace PUP {
19 class er;
20 } // namespace PUP
21 /// \endcond
22
23 namespace Burgers {
24 namespace Solutions {
25 /// A solution that is linear in space at all times.
26 ///
27 /// \f$u(x, t) = x / (t - t_0)\f$ where \f$t_0\f$ is the shock time.
28 class Linear {
29  public:
30  struct ShockTime {
31  using type = double;
32  static constexpr OptionString help{"The time at which a shock forms"};
33  };
34
35  using options = tmpl::list<ShockTime>;
36  static constexpr OptionString help{"A spatially linear solution"};
37
38  Linear() = default;
39  Linear(const Linear&) noexcept = delete;
40  Linear& operator=(const Linear&) noexcept = delete;
41  Linear(Linear&&) noexcept = default;
42  Linear& operator=(Linear&&) noexcept = default;
43  ~Linear() noexcept = default;
44
45  explicit Linear(double shock_time) noexcept;
46
47  template <typename T>
48  Scalar<T> u(const tnsr::I<T, 1>& x, double t) const noexcept;
49
50  template <typename T>
51  Scalar<T> du_dt(const tnsr::I<T, 1>& x, double t) const noexcept;
52
54  const tnsr::I<DataVector, 1>& x, double t,
55  tmpl::list<Tags::U> /*meta*/) const noexcept;
56
58  const tnsr::I<DataVector, 1>& x, double t,
59  tmpl::list<::Tags::dt<Tags::U>> /*meta*/) const noexcept;
60
61  // clang-tidy: no pass by reference
62  void pup(PUP::er& p) noexcept; // NOLINT
63
64  private:
65  double shock_time_ = std::numeric_limits<double>::signaling_NaN();
66 };
67 } // namespace Solutions
68 } // namespace Burgers
Definition: Strahlkorper.hpp:14
Defines class tuples::TaggedTuple.
T signaling_NaN(T... args)
Defines classes and functions for making classes creatable from input files.
Define prefixes for DataBox tags.
Definition: Linear.hpp:30
Prefix indicating a time derivative.
Definition: Prefixes.hpp:28
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:26
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
Defines a list of useful type aliases for tensors.
Stores a collection of function values.
Definition: DataVector.hpp:46
Wraps the template metaprogramming library used (brigand)
Items related to evolving the Burgers equation .
Definition: Equations.cpp:20
A solution that is linear in space at all times.
Definition: Linear.hpp:28
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21