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