Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <memory>
7 : #include <optional>
8 : #include <pup.h>
9 : #include <string>
10 : #include <type_traits>
11 :
12 : #include "DataStructures/DataBox/Prefixes.hpp"
13 : #include "DataStructures/DataVector.hpp"
14 : #include "DataStructures/Tensor/Tensor.hpp"
15 : #include "DataStructures/Variables.hpp"
16 : #include "Evolution/BoundaryConditions/Type.hpp"
17 : #include "Evolution/Systems/ScalarWave/BoundaryConditions/BoundaryCondition.hpp"
18 : #include "Evolution/Systems/ScalarWave/Tags.hpp"
19 : #include "Options/String.hpp"
20 : #include "PointwiseFunctions/AnalyticData/Tags.hpp"
21 : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
22 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
23 : #include "Utilities/Gsl.hpp"
24 : #include "Utilities/Serialization/CharmPupable.hpp"
25 : #include "Utilities/TMPL.hpp"
26 :
27 : /// \cond
28 : namespace Tags {
29 : struct Time;
30 : } // namespace Tags
31 : namespace domain::Tags {
32 : template <size_t Dim, typename Frame>
33 : struct Coordinates;
34 : } // namespace domain::Tags
35 : /// \endcond
36 :
37 : namespace ScalarWave::BoundaryConditions {
38 : /*!
39 : * \brief Sets Dirichlet boundary conditions using the analytic solution or
40 : * analytic data.
41 : */
42 : template <size_t Dim>
43 1 : class DirichletAnalytic final : public BoundaryCondition<Dim> {
44 : public:
45 : /// \brief What analytic solution/data to prescribe.
46 1 : struct AnalyticPrescription {
47 0 : static constexpr Options::String help =
48 : "What analytic solution/data to prescribe.";
49 0 : using type = std::unique_ptr<evolution::initial_data::InitialData>;
50 : };
51 :
52 0 : using options = tmpl::list<AnalyticPrescription>;
53 :
54 0 : static constexpr Options::String help{
55 : "DirichletAnalytic boundary conditions setting the value of Psi, Phi, "
56 : "and Pi to the analytic solution or analytic data."};
57 :
58 0 : DirichletAnalytic() = default;
59 0 : DirichletAnalytic(DirichletAnalytic&&) = default;
60 0 : DirichletAnalytic& operator=(DirichletAnalytic&&) = default;
61 0 : DirichletAnalytic(const DirichletAnalytic&);
62 0 : DirichletAnalytic& operator=(const DirichletAnalytic&);
63 0 : ~DirichletAnalytic() override = default;
64 :
65 0 : explicit DirichletAnalytic(
66 : std::unique_ptr<evolution::initial_data::InitialData>
67 : analytic_prescription);
68 :
69 0 : explicit DirichletAnalytic(CkMigrateMessage* msg);
70 :
71 0 : WRAPPED_PUPable_decl_base_template(
72 : domain::BoundaryConditions::BoundaryCondition, DirichletAnalytic);
73 :
74 0 : auto get_clone() const -> std::unique_ptr<
75 : domain::BoundaryConditions::BoundaryCondition> override;
76 :
77 0 : static constexpr evolution::BoundaryConditions::Type bc_type =
78 : evolution::BoundaryConditions::Type::Ghost;
79 :
80 0 : void pup(PUP::er& p) override;
81 :
82 0 : using dg_interior_evolved_variables_tags = tmpl::list<>;
83 0 : using dg_interior_temporary_tags =
84 : tmpl::list<domain::Tags::Coordinates<Dim, Frame::Inertial>,
85 : Tags::ConstraintGamma2>;
86 0 : using dg_gridless_tags = tmpl::list<::Tags::Time>;
87 :
88 0 : std::optional<std::string> dg_ghost(
89 : const gsl::not_null<Scalar<DataVector>*> psi,
90 : const gsl::not_null<Scalar<DataVector>*> pi,
91 : const gsl::not_null<tnsr::i<DataVector, Dim, Frame::Inertial>*> phi,
92 : const gsl::not_null<Scalar<DataVector>*> gamma2,
93 : const std::optional<
94 : tnsr::I<DataVector, Dim, Frame::Inertial>>& /*face_mesh_velocity*/,
95 : const tnsr::i<DataVector, Dim, Frame::Inertial>& /*normal_covector*/,
96 : const tnsr::I<DataVector, Dim, Frame::Inertial>& coords,
97 : const Scalar<DataVector>& interior_gamma2,
98 : [[maybe_unused]] const double time) const;
99 :
100 : private:
101 0 : std::unique_ptr<evolution::initial_data::InitialData> analytic_prescription_;
102 : };
103 : } // namespace ScalarWave::BoundaryConditions
|