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/TaggedTuple.hpp"
9 : #include "DataStructures/Tensor/TypeAliases.hpp"
10 : #include "Evolution/Systems/ScalarAdvection/Tags.hpp"
11 : #include "Options/String.hpp"
12 : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
13 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
14 : #include "Utilities/TMPL.hpp"
15 :
16 : /// \cond
17 : class DataVector;
18 :
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 2D scalar advection problem adopted from
28 : * \cite Kuzmin2014 and its analytic solution.
29 : *
30 : * Let \f$r(x,y) = \sqrt{(x-x_0)^2 + (y-y_0)^2}/r_0\f$ be the normalized
31 : * distance from a point \f$(x_0,y_0)\f$ within a circle with the radius
32 : * \f$r_0=0.15\f$. The initial proļ¬le consists of three bodies:
33 : *
34 : * - a slotted cylinder centered at \f$(0.5, 0.75)\f$
35 : * \f{align*}
36 : * u(x,y) = \left\{\begin{array}{ll}
37 : * 1 & \text{if } |x-x_0| \geq 0.025 \text{ or } y \geq 0.85 \\
38 : * 0 & \text{otherwise} \\
39 : * \end{array}\right\},
40 : * \f}
41 : *
42 : * - a cone centered at \f$(0.5, 0.25)\f$
43 : * \f{align*}
44 : * u(x,y) = 1 - r(x,y) ,
45 : * \f}
46 : *
47 : * - and a hump centered at \f$(0.25, 0.5)\f$
48 : * \f{align*}
49 : * u(x,y) = \frac{1 + \cos(\pi r(x,y))}{4} .
50 : * \f}
51 : *
52 : * The system is evolved over the domain \f$[0,1]\times[0,1]\f$ with the
53 : * advection velocity field \f$v(x,y) = (0.5-y,-0.5+x)\f$, which causes a solid
54 : * rotation about \f$(x,y)=(0.5,0.5)\f$ with angular velocity being 1.0. We use
55 : * the periodic boundary condition for evolving this problem.
56 : */
57 1 : class Kuzmin : public evolution::initial_data::InitialData,
58 : public MarkAsAnalyticSolution {
59 : public:
60 0 : using options = tmpl::list<>;
61 0 : static constexpr Options::String help{
62 : "A rotating 2D scalar advecting problem adopted from Kuzmin2014 paper"};
63 :
64 0 : Kuzmin() = default;
65 0 : Kuzmin(const Kuzmin&) = default;
66 0 : Kuzmin& operator=(const Kuzmin&) = default;
67 0 : Kuzmin(Kuzmin&&) = default;
68 0 : Kuzmin& operator=(Kuzmin&&) = default;
69 0 : ~Kuzmin() override = default;
70 :
71 0 : auto get_clone() const
72 : -> std::unique_ptr<evolution::initial_data::InitialData> override;
73 :
74 : template <typename DataType>
75 0 : tuples::TaggedTuple<ScalarAdvection::Tags::U> variables(
76 : const tnsr::I<DataType, 2>& x, double t,
77 : tmpl::list<ScalarAdvection::Tags::U> /*meta*/) const;
78 :
79 : // NOLINTNEXTLINE(google-runtime-references)
80 0 : void pup(PUP::er& p) override;
81 :
82 : /// \cond
83 : explicit Kuzmin(CkMigrateMessage* msg);
84 : using PUP::able::register_constructor;
85 : WRAPPED_PUPable_decl_template(Kuzmin);
86 : /// \endcond
87 : };
88 :
89 0 : bool operator==(const Kuzmin& /*lhs*/, const Kuzmin& /*rhs*/);
90 :
91 0 : bool operator!=(const Kuzmin& lhs, const Kuzmin& rhs);
92 :
93 : } // namespace Solutions
94 : } // namespace ScalarAdvection
|