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/PrefixHelpers.hpp"
13 : #include "DataStructures/DataBox/Prefixes.hpp"
14 : #include "DataStructures/DataVector.hpp"
15 : #include "DataStructures/Tensor/Tensor.hpp"
16 : #include "Domain/Structure/Direction.hpp"
17 : #include "Evolution/BoundaryConditions/Type.hpp"
18 : #include "Evolution/DgSubcell/Tags/Mesh.hpp"
19 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/BoundaryConditions/BoundaryCondition.hpp"
20 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Tag.hpp"
21 : #include "Evolution/Systems/GrMhd/ValenciaDivClean/System.hpp"
22 : #include "Options/String.hpp"
23 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
24 : #include "PointwiseFunctions/Hydro/Tags.hpp"
25 : #include "Utilities/Gsl.hpp"
26 : #include "Utilities/Serialization/CharmPupable.hpp"
27 : #include "Utilities/TMPL.hpp"
28 :
29 : namespace grmhd::ValenciaDivClean::BoundaryConditions {
30 : /// A `BoundaryCondition` that only verifies that all characteristic speeds are
31 : /// directed out of the domain; no boundary data is altered by this boundary
32 : /// condition.
33 1 : class DemandOutgoingCharSpeeds final : public BoundaryCondition {
34 : private:
35 : template <typename T>
36 0 : using Flux = ::Tags::Flux<T, tmpl::size_t<3>, Frame::Inertial>;
37 :
38 : public:
39 0 : using options = tmpl::list<>;
40 0 : static constexpr Options::String help{
41 : "DemandOutgoingCharSpeeds boundary condition that only verifies the "
42 : "characteristic speeds "
43 : "are all directed out of the domain."};
44 :
45 0 : DemandOutgoingCharSpeeds() = default;
46 0 : DemandOutgoingCharSpeeds(DemandOutgoingCharSpeeds&&) = default;
47 0 : DemandOutgoingCharSpeeds& operator=(DemandOutgoingCharSpeeds&&) = default;
48 0 : DemandOutgoingCharSpeeds(const DemandOutgoingCharSpeeds&) = default;
49 0 : DemandOutgoingCharSpeeds& operator=(const DemandOutgoingCharSpeeds&) =
50 : default;
51 0 : ~DemandOutgoingCharSpeeds() override = default;
52 :
53 0 : explicit DemandOutgoingCharSpeeds(CkMigrateMessage* msg);
54 :
55 0 : WRAPPED_PUPable_decl_base_template(
56 : domain::BoundaryConditions::BoundaryCondition, DemandOutgoingCharSpeeds);
57 :
58 0 : auto get_clone() const -> std::unique_ptr<
59 : domain::BoundaryConditions::BoundaryCondition> override;
60 :
61 0 : static constexpr evolution::BoundaryConditions::Type bc_type =
62 : evolution::BoundaryConditions::Type::DemandOutgoingCharSpeeds;
63 :
64 0 : void pup(PUP::er& p) override;
65 :
66 0 : using dg_interior_evolved_variables_tags = tmpl::list<>;
67 0 : using dg_interior_temporary_tags =
68 : tmpl::list<gr::Tags::Shift<DataVector, 3>, gr::Tags::Lapse<DataVector>>;
69 0 : using dg_interior_primitive_variables_tags = tmpl::list<>;
70 0 : using dg_gridless_tags = tmpl::list<>;
71 :
72 0 : static std::optional<std::string> dg_demand_outgoing_char_speeds(
73 : const std::optional<tnsr::I<DataVector, 3, Frame::Inertial>>&
74 : face_mesh_velocity,
75 : const tnsr::i<DataVector, 3, Frame::Inertial>&
76 : outward_directed_normal_covector,
77 : const tnsr::I<DataVector, 3, Frame::Inertial>&
78 : /*outward_directed_normal_vector*/,
79 :
80 : const tnsr::I<DataVector, 3, Frame::Inertial>& shift,
81 : const Scalar<DataVector>& lapse);
82 :
83 0 : using fd_interior_evolved_variables_tags = tmpl::list<>;
84 0 : using fd_interior_temporary_tags =
85 : tmpl::list<evolution::dg::subcell::Tags::Mesh<3>,
86 : gr::Tags::Shift<DataVector, 3>, gr::Tags::Lapse<DataVector>,
87 : gr::Tags::SpatialMetric<DataVector, 3>>;
88 0 : using fd_interior_primitive_variables_tags =
89 : tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
90 : hydro::Tags::ElectronFraction<DataVector>,
91 : hydro::Tags::Pressure<DataVector>,
92 : hydro::Tags::SpecificInternalEnergy<DataVector>,
93 : hydro::Tags::LorentzFactor<DataVector>,
94 : hydro::Tags::SpatialVelocity<DataVector, 3>,
95 : hydro::Tags::MagneticField<DataVector, 3>,
96 : hydro::Tags::DivergenceCleaningField<DataVector>>;
97 0 : using fd_gridless_tags = tmpl::list<fd::Tags::Reconstructor>;
98 :
99 0 : static void fd_demand_outgoing_char_speeds(
100 : gsl::not_null<Scalar<DataVector>*> rest_mass_density,
101 : gsl::not_null<Scalar<DataVector>*> electron_fraction,
102 : gsl::not_null<Scalar<DataVector>*> pressure,
103 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
104 : lorentz_factor_times_spatial_velocity,
105 : gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> magnetic_field,
106 : gsl::not_null<Scalar<DataVector>*> divergence_cleaning_field,
107 :
108 : gsl::not_null<std::optional<Variables<db::wrap_tags_in<
109 : Flux, typename grmhd::ValenciaDivClean::System::flux_variables>>>*>
110 : cell_centered_ghost_fluxes,
111 :
112 : const Direction<3>& direction,
113 :
114 : const std::optional<tnsr::I<DataVector, 3, Frame::Inertial>>&
115 : face_mesh_velocity,
116 : const tnsr::i<DataVector, 3, Frame::Inertial>&
117 : outward_directed_normal_covector,
118 :
119 : // fd_interior_temporary_tags
120 : const Mesh<3>& subcell_mesh,
121 : const tnsr::I<DataVector, 3, Frame::Inertial>& interior_shift,
122 : const Scalar<DataVector>& interior_lapse,
123 : const tnsr::ii<DataVector, 3, Frame::Inertial>& interior_spatial_metric,
124 :
125 : // fd_interior_primitive_variables_tags
126 : const Scalar<DataVector>& interior_rest_mass_density,
127 : const Scalar<DataVector>& interior_electron_fraction,
128 : const Scalar<DataVector>& interior_pressure,
129 : const Scalar<DataVector>& interior_specific_internal_energy,
130 : const Scalar<DataVector>& interior_lorentz_factor,
131 : const tnsr::I<DataVector, 3, Frame::Inertial>& interior_spatial_velocity,
132 : const tnsr::I<DataVector, 3, Frame::Inertial>& interior_magnetic_field,
133 : const Scalar<DataVector>& interior_divergence_cleaning_field,
134 :
135 : // fd_gridless_tags
136 : const fd::Reconstructor& reconstructor);
137 : };
138 : } // namespace grmhd::ValenciaDivClean::BoundaryConditions
|