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 : #include <unordered_map>
12 :
13 : #include "DataStructures/DataBox/Prefixes.hpp"
14 : #include "DataStructures/DataVector.hpp"
15 : #include "DataStructures/Tensor/Tensor.hpp"
16 : #include "Domain/CoordinateMaps/CoordinateMap.hpp"
17 : #include "Domain/CoordinateMaps/Tags.hpp"
18 : #include "Domain/ElementMap.hpp"
19 : #include "Domain/FunctionsOfTime/FunctionOfTime.hpp"
20 : #include "Domain/FunctionsOfTime/Tags.hpp"
21 : #include "Domain/Structure/Direction.hpp"
22 : #include "Domain/Tags.hpp"
23 : #include "Evolution/BoundaryConditions/Type.hpp"
24 : #include "Evolution/DgSubcell/GhostZoneLogicalCoordinates.hpp"
25 : #include "Evolution/DgSubcell/SliceTensor.hpp"
26 : #include "Evolution/DgSubcell/Tags/Coordinates.hpp"
27 : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
28 : #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/Tags.hpp"
29 : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
30 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/AllSolutions.hpp"
31 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/BoundaryConditions/BoundaryCondition.hpp"
32 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/Factory.hpp"
33 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/Reconstructor.hpp"
34 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/FiniteDifference/Tag.hpp"
35 : #include "Evolution/Systems/GrMhd/GhValenciaDivClean/Tags.hpp"
36 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/ConservativeFromPrimitive.hpp"
37 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Fluxes.hpp"
38 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/Tags.hpp"
39 : #include "Evolution/TypeTraits.hpp"
40 : #include "NumericalAlgorithms/Spectral/Mesh.hpp"
41 : #include "Options/String.hpp"
42 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
43 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
44 : #include "Utilities/ErrorHandling/Assert.hpp"
45 : #include "Utilities/Gsl.hpp"
46 : #include "Utilities/Serialization/CharmPupable.hpp"
47 : #include "Utilities/TMPL.hpp"
48 :
49 : /// \cond
50 : namespace Tags {
51 : struct Time;
52 : } // namespace Tags
53 : /// \endcond
54 :
55 : namespace grmhd::GhValenciaDivClean::BoundaryConditions {
56 : /*!
57 : * \brief Sets Dirichlet boundary conditions using the analytic solution or
58 : * analytic data.
59 : */
60 1 : class DirichletAnalytic final : public BoundaryCondition {
61 : public:
62 : /// \brief What analytic solution/data to prescribe.
63 1 : struct AnalyticPrescription {
64 0 : static constexpr Options::String help =
65 : "What analytic solution/data to prescribe.";
66 0 : using type = std::unique_ptr<evolution::initial_data::InitialData>;
67 : };
68 0 : using options = tmpl::list<AnalyticPrescription>;
69 0 : static constexpr Options::String help{
70 : "DirichletAnalytic boundary conditions using either analytic solution or "
71 : "analytic data."};
72 :
73 0 : DirichletAnalytic() = default;
74 0 : DirichletAnalytic(DirichletAnalytic&&) = default;
75 0 : DirichletAnalytic& operator=(DirichletAnalytic&&) = default;
76 0 : DirichletAnalytic(const DirichletAnalytic&);
77 0 : DirichletAnalytic& operator=(const DirichletAnalytic&);
78 0 : ~DirichletAnalytic() override = default;
79 :
80 0 : explicit DirichletAnalytic(CkMigrateMessage* msg);
81 :
82 0 : explicit DirichletAnalytic(
83 : std::unique_ptr<evolution::initial_data::InitialData>
84 : analytic_prescription);
85 :
86 0 : WRAPPED_PUPable_decl_base_template(
87 : domain::BoundaryConditions::BoundaryCondition, DirichletAnalytic);
88 :
89 0 : auto get_clone() const -> std::unique_ptr<
90 : domain::BoundaryConditions::BoundaryCondition> override;
91 :
92 0 : static constexpr evolution::BoundaryConditions::Type bc_type =
93 : evolution::BoundaryConditions::Type::Ghost;
94 :
95 0 : void pup(PUP::er& p) override;
96 :
97 0 : using dg_interior_evolved_variables_tags = tmpl::list<>;
98 0 : using dg_interior_temporary_tags =
99 : tmpl::list<domain::Tags::Coordinates<3, Frame::Inertial>,
100 : ::gh::ConstraintDamping::Tags::ConstraintGamma1,
101 : ::gh::ConstraintDamping::Tags::ConstraintGamma2>;
102 0 : using dg_interior_primitive_variables_tags = tmpl::list<>;
103 0 : using dg_gridless_tags = tmpl::list<::Tags::Time>;
104 :
105 0 : std::optional<std::string> dg_ghost(
106 : gsl::not_null<tnsr::aa<DataVector, 3, Frame::Inertial>*> spacetime_metric,
107 : gsl::not_null<tnsr::aa<DataVector, 3, Frame::Inertial>*> pi,
108 : gsl::not_null<tnsr::iaa<DataVector, 3, Frame::Inertial>*> phi,
109 : gsl::not_null<Scalar<DataVector>*> tilde_d,
110 : gsl::not_null<Scalar<DataVector>*> tilde_ye,
111 : gsl::not_null<Scalar<DataVector>*> tilde_tau,
112 : gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*> tilde_s,
113 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_b,
114 : gsl::not_null<Scalar<DataVector>*> tilde_phi,
115 :
116 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_d_flux,
117 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_ye_flux,
118 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_tau_flux,
119 : gsl::not_null<tnsr::Ij<DataVector, 3, Frame::Inertial>*> tilde_s_flux,
120 : gsl::not_null<tnsr::IJ<DataVector, 3, Frame::Inertial>*> tilde_b_flux,
121 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> tilde_phi_flux,
122 :
123 : gsl::not_null<Scalar<DataVector>*> gamma1,
124 : gsl::not_null<Scalar<DataVector>*> gamma2,
125 : gsl::not_null<Scalar<DataVector>*> lapse,
126 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
127 : gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
128 : inv_spatial_metric,
129 :
130 : const std::optional<
131 : tnsr::I<DataVector, 3, Frame::Inertial>>& /*face_mesh_velocity*/,
132 : const tnsr::i<DataVector, 3, Frame::Inertial>& /*normal_covector*/,
133 : const tnsr::I<DataVector, 3, Frame::Inertial>& /*normal_vector*/,
134 : const tnsr::I<DataVector, 3, Frame::Inertial>& coords,
135 : const Scalar<DataVector>& interior_gamma1,
136 : const Scalar<DataVector>& interior_gamma2,
137 : [[maybe_unused]] double time) const;
138 :
139 0 : using fd_interior_evolved_variables_tags = tmpl::list<>;
140 0 : using fd_interior_temporary_tags =
141 : tmpl::list<evolution::dg::subcell::Tags::Mesh<3>>;
142 0 : using fd_interior_primitive_variables_tags = tmpl::list<>;
143 0 : using fd_gridless_tags =
144 : tmpl::list<::Tags::Time, ::domain::Tags::FunctionsOfTime,
145 : domain::Tags::ElementMap<3, Frame::Grid>,
146 : domain::CoordinateMaps::Tags::CoordinateMap<3, Frame::Grid,
147 : Frame::Inertial>,
148 : fd::Tags::Reconstructor>;
149 0 : void fd_ghost(
150 : gsl::not_null<tnsr::aa<DataVector, 3, Frame::Inertial>*> spacetime_metric,
151 : gsl::not_null<tnsr::aa<DataVector, 3, Frame::Inertial>*> pi,
152 : gsl::not_null<tnsr::iaa<DataVector, 3, Frame::Inertial>*> phi,
153 : gsl::not_null<Scalar<DataVector>*> rest_mass_density,
154 : gsl::not_null<Scalar<DataVector>*> electron_fraction,
155 : gsl::not_null<Scalar<DataVector>*> temperature,
156 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
157 : lorentz_factor_times_spatial_velocity,
158 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> magnetic_field,
159 : gsl::not_null<Scalar<DataVector>*> divergence_cleaning_field,
160 : const Direction<3>& direction,
161 :
162 : // fd_interior_temporary_tags
163 : const Mesh<3>& subcell_mesh,
164 :
165 : // fd_gridless_tags
166 : double time,
167 : const std::unordered_map<
168 : std::string,
169 : std::unique_ptr<::domain::FunctionsOfTime::FunctionOfTime>>&
170 : functions_of_time,
171 : const ElementMap<3, Frame::Grid>& logical_to_grid_map,
172 : const domain::CoordinateMapBase<Frame::Grid, Frame::Inertial, 3>&
173 : grid_to_inertial_map,
174 : const fd::Reconstructor& reconstructor) const;
175 :
176 : private:
177 0 : std::unique_ptr<evolution::initial_data::InitialData> analytic_prescription_;
178 : };
179 : } // namespace grmhd::GhValenciaDivClean::BoundaryConditions
|