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 : #include <memory>
8 : #include <optional>
9 : #include <string>
10 :
11 : #include "DataStructures/DataBox/Prefixes.hpp"
12 : #include "DataStructures/Tensor/TypeAliases.hpp"
13 : #include "Domain/BoundaryConditions/BoundaryCondition.hpp"
14 : #include "Evolution/BoundaryConditions/Type.hpp"
15 : #include "Evolution/Systems/Burgers/BoundaryConditions/BoundaryCondition.hpp"
16 : #include "Evolution/Systems/Burgers/Tags.hpp"
17 : #include "Options/String.hpp"
18 : #include "Utilities/Gsl.hpp"
19 : #include "Utilities/Serialization/CharmPupable.hpp"
20 : #include "Utilities/TMPL.hpp"
21 :
22 : /// \cond
23 : class DataVector;
24 : template <size_t Dim>
25 : class Direction;
26 : namespace PUP {
27 : class er;
28 : } // namespace PUP
29 : template <typename>
30 : class Variables;
31 : /// \endcond
32 :
33 : namespace Burgers::BoundaryConditions {
34 : /*
35 : * \brief Dirichlet boundary condition setting the value of U to a
36 : * time-independent constant.
37 : */
38 0 : class Dirichlet final : public BoundaryCondition {
39 : private:
40 0 : using flux_tag =
41 : ::Tags::Flux<Burgers::Tags::U, tmpl::size_t<1>, Frame::Inertial>;
42 :
43 : public:
44 0 : struct U {
45 0 : using type = double;
46 0 : static constexpr Options::String help{"The value for U on the boundary"};
47 : };
48 :
49 0 : using options = tmpl::list<U>;
50 0 : static constexpr Options::String help{
51 : "Dirichlet boundary condition setting the value of U to "
52 : "a time-independent constant."};
53 :
54 0 : Dirichlet(double u_value);
55 :
56 0 : Dirichlet() = default;
57 0 : Dirichlet(Dirichlet&&) = default;
58 0 : Dirichlet& operator=(Dirichlet&&) = default;
59 0 : Dirichlet(const Dirichlet&) = default;
60 0 : Dirichlet& operator=(const Dirichlet&) = default;
61 0 : ~Dirichlet() override = default;
62 :
63 0 : explicit Dirichlet(CkMigrateMessage* msg);
64 :
65 0 : WRAPPED_PUPable_decl_base_template(BoundaryCondition, Dirichlet);
66 :
67 0 : auto get_clone() const -> std::unique_ptr<
68 : domain::BoundaryConditions::BoundaryCondition> override;
69 :
70 0 : static constexpr evolution::BoundaryConditions::Type bc_type =
71 : evolution::BoundaryConditions::Type::Ghost;
72 :
73 0 : void pup(PUP::er& p) override;
74 :
75 0 : using dg_interior_evolved_variables_tags = tmpl::list<>;
76 0 : using dg_interior_temporary_tags = tmpl::list<>;
77 0 : using dg_gridless_tags = tmpl::list<>;
78 :
79 0 : std::optional<std::string> dg_ghost(
80 : gsl::not_null<Scalar<DataVector>*> u,
81 : gsl::not_null<tnsr::I<DataVector, 1, Frame::Inertial>*> flux_u,
82 : const std::optional<
83 : tnsr::I<DataVector, 1, Frame::Inertial>>& /*face_mesh_velocity*/,
84 : const tnsr::i<DataVector, 1, Frame::Inertial>& /*normal_covector*/) const;
85 :
86 0 : using fd_interior_evolved_variables_tags = tmpl::list<>;
87 0 : using fd_interior_temporary_tags = tmpl::list<>;
88 0 : using fd_gridless_tags = tmpl::list<>;
89 :
90 0 : void fd_ghost(gsl::not_null<Scalar<DataVector>*> u,
91 : const Direction<1>& /*direction*/) const;
92 :
93 : private:
94 0 : void dg_ghost_impl(
95 : gsl::not_null<tnsr::I<DataVector, 1, Frame::Inertial>*> flux,
96 : gsl::not_null<Scalar<DataVector>*> u) const;
97 :
98 0 : double u_value_ = std::numeric_limits<double>::signaling_NaN();
99 : };
100 : } // namespace Burgers::BoundaryConditions
|