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/NewtonianEuler/BoundaryConditions/BoundaryCondition.hpp"
18 : #include "Evolution/Systems/NewtonianEuler/ConservativeFromPrimitive.hpp"
19 : #include "Evolution/Systems/NewtonianEuler/Fluxes.hpp"
20 : #include "Evolution/Systems/NewtonianEuler/Tags.hpp"
21 : #include "Options/String.hpp"
22 : #include "PointwiseFunctions/AnalyticData/Tags.hpp"
23 : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
24 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
25 : #include "Utilities/Gsl.hpp"
26 : #include "Utilities/Serialization/CharmPupable.hpp"
27 : #include "Utilities/TMPL.hpp"
28 :
29 : /// \cond
30 : namespace domain::Tags {
31 : template <size_t Dim, typename Frame>
32 : struct Coordinates;
33 : } // namespace domain::Tags
34 : namespace Tags {
35 : struct Time;
36 : } // namespace Tags
37 : /// \endcond
38 :
39 : namespace NewtonianEuler::BoundaryConditions {
40 : /*!
41 : * \brief Sets Dirichlet boundary conditions using the analytic solution or
42 : * analytic data.
43 : */
44 : template <size_t Dim>
45 1 : class DirichletAnalytic final : public BoundaryCondition<Dim> {
46 : public:
47 : /// \brief What analytic solution/data to prescribe.
48 1 : struct AnalyticPrescription {
49 0 : static constexpr Options::String help =
50 : "What analytic solution/data to prescribe.";
51 0 : using type = std::unique_ptr<evolution::initial_data::InitialData>;
52 : };
53 0 : using options = tmpl::list<AnalyticPrescription>;
54 0 : static constexpr Options::String help{
55 : "DirichletAnalytic boundary conditions using either analytic solution or "
56 : "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(CkMigrateMessage* msg);
66 :
67 0 : explicit DirichletAnalytic(
68 : std::unique_ptr<evolution::initial_data::InitialData>
69 : analytic_prescription);
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 0 : using dg_interior_primitive_variables_tags = tmpl::list<>;
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>*> mass_density,
90 : gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
91 : momentum_density,
92 : gsl::not_null<Scalar<DataVector>*> energy_density,
93 :
94 : gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
95 : flux_mass_density,
96 : gsl::not_null<tnsr::IJ<DataVector, Dim, Frame::Inertial>*>
97 : flux_momentum_density,
98 : gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*>
99 : flux_energy_density,
100 :
101 : gsl::not_null<tnsr::I<DataVector, Dim, Frame::Inertial>*> velocity,
102 : gsl::not_null<Scalar<DataVector>*> specific_internal_energy,
103 :
104 : const std::optional<
105 : tnsr::I<DataVector, Dim, Frame::Inertial>>& /*face_mesh_velocity*/,
106 : const tnsr::i<DataVector, Dim, Frame::Inertial>& /*normal_covector*/,
107 : const tnsr::I<DataVector, Dim, Frame::Inertial>& coords,
108 : double time) const;
109 :
110 : private:
111 0 : std::unique_ptr<evolution::initial_data::InitialData> analytic_prescription_;
112 : };
113 : } // namespace NewtonianEuler::BoundaryConditions
|