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 :
10 : #include "DataStructures/Tensor/TypeAliases.hpp"
11 : #include "Domain/BoundaryConditions/BoundaryCondition.hpp"
12 : #include "Domain/Tags.hpp"
13 : #include "Evolution/BoundaryConditions/Type.hpp"
14 : #include "Evolution/Systems/ForceFree/BoundaryConditions/BoundaryCondition.hpp"
15 : #include "Evolution/Systems/ForceFree/Tags.hpp"
16 : #include "Options/String.hpp"
17 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
18 : #include "Utilities/TMPL.hpp"
19 :
20 : /// \cond
21 : class DataVector;
22 : namespace Tags {
23 : struct Time;
24 : } // namespace Tags
25 : /// \endcond
26 :
27 : namespace ForceFree::BoundaryConditions {
28 : /*!
29 : * \brief Sets Dirichlet boundary conditions using the analytic solution or
30 : * analytic data.
31 : */
32 1 : class DirichletAnalytic final : public BoundaryCondition {
33 : public:
34 : /// \brief What analytic solution/data to prescribe.
35 1 : struct AnalyticPrescription {
36 0 : static constexpr Options::String help =
37 : "What analytic solution/data to prescribe.";
38 0 : using type = std::unique_ptr<evolution::initial_data::InitialData>;
39 : };
40 :
41 0 : using options = tmpl::list<AnalyticPrescription>;
42 0 : static constexpr Options::String help{
43 : "DirichletAnalytic boundary conditions using either analytic solution or "
44 : "analytic data."};
45 :
46 0 : DirichletAnalytic() = default;
47 0 : DirichletAnalytic(DirichletAnalytic&&) = default;
48 0 : DirichletAnalytic& operator=(DirichletAnalytic&&) = default;
49 0 : DirichletAnalytic(const DirichletAnalytic&);
50 0 : DirichletAnalytic& operator=(const DirichletAnalytic&);
51 0 : ~DirichletAnalytic() override = default;
52 :
53 0 : explicit DirichletAnalytic(
54 : std::unique_ptr<evolution::initial_data::InitialData>
55 : analytic_prescription);
56 :
57 0 : explicit DirichletAnalytic(CkMigrateMessage* msg);
58 :
59 0 : WRAPPED_PUPable_decl_base_template(
60 : domain::BoundaryConditions::BoundaryCondition, DirichletAnalytic);
61 :
62 0 : auto get_clone() const -> std::unique_ptr<
63 : domain::BoundaryConditions::BoundaryCondition> override;
64 :
65 0 : static constexpr evolution::BoundaryConditions::Type bc_type =
66 : evolution::BoundaryConditions::Type::Ghost;
67 :
68 0 : void pup(PUP::er& p) override;
69 :
70 0 : using dg_interior_evolved_variables_tags = tmpl::list<>;
71 0 : using dg_interior_temporary_tags =
72 : tmpl::list<domain::Tags::Coordinates<3, Frame::Inertial>>;
73 0 : using dg_gridless_tags = tmpl::list<::Tags::Time, Tags::ParallelConductivity>;
74 :
75 0 : std::optional<std::string> dg_ghost(
76 : const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_e,
77 : const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_b,
78 : const gsl::not_null<Scalar<DataVector>*> tilde_psi,
79 : const gsl::not_null<Scalar<DataVector>*> tilde_phi,
80 : const gsl::not_null<Scalar<DataVector>*> tilde_q,
81 :
82 : const gsl::not_null<tnsr::IJ<DataVector, 3, Frame::Inertial>*>
83 : tilde_e_flux,
84 : const gsl::not_null<tnsr::IJ<DataVector, 3, Frame::Inertial>*>
85 : tilde_b_flux,
86 : const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
87 : tilde_psi_flux,
88 : const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
89 : tilde_phi_flux,
90 : const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
91 : tilde_q_flux,
92 :
93 : const gsl::not_null<Scalar<DataVector>*> lapse,
94 : const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
95 : const gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
96 : inv_spatial_metric,
97 :
98 : const std::optional<
99 : tnsr::I<DataVector, 3, Frame::Inertial>>& /*face_mesh_velocity*/,
100 : const tnsr::i<DataVector, 3, Frame::Inertial>& /*normal_covector*/,
101 : const tnsr::I<DataVector, 3, Frame::Inertial>& /*normal_vector*/,
102 :
103 : const tnsr::I<DataVector, 3, Frame::Inertial>& coords,
104 : [[maybe_unused]] const double time,
105 : const double parallel_conductivity) const;
106 :
107 : private:
108 0 : std::unique_ptr<evolution::initial_data::InitialData> analytic_prescription_;
109 : };
110 : } // namespace ForceFree::BoundaryConditions
|