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/DataVector.hpp" 13 : #include "DataStructures/Tensor/Tensor.hpp" 14 : #include "Domain/FaceNormal.hpp" 15 : #include "Evolution/BoundaryConditions/Type.hpp" 16 : #include "Evolution/Systems/CurvedScalarWave/BoundaryConditions/BoundaryCondition.hpp" 17 : #include "Evolution/Systems/CurvedScalarWave/Tags.hpp" 18 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 19 : #include "Utilities/Serialization/CharmPupable.hpp" 20 : #include "Utilities/TMPL.hpp" 21 : 22 : /// \cond 23 : namespace domain::Tags { 24 : template <size_t Dim, typename Frame> 25 : struct Coordinates; 26 : } // namespace domain::Tags 27 : /// \endcond 28 : 29 1 : namespace CurvedScalarWave::BoundaryConditions { 30 : /// A `BoundaryCondition` that imposes the scalar to be constant at the 31 : /// outer boundary. 32 : template <size_t Dim> 33 1 : class AnalyticConstant final : public BoundaryCondition<Dim> { 34 : public: 35 0 : struct Amplitude { 36 0 : using type = double; 37 0 : static constexpr Options::String help = { 38 : "Amplitude of the scalar at the boundary"}; 39 : }; 40 0 : using options = tmpl::list<Amplitude>; 41 0 : static constexpr Options::String help{ 42 : "Boundary conditions which impose a constant scalar at the boundary."}; 43 : 44 0 : AnalyticConstant(double amplitude); 45 0 : AnalyticConstant() = default; 46 : /// \cond 47 : AnalyticConstant(AnalyticConstant&&) = default; 48 : AnalyticConstant& operator=(AnalyticConstant&&) = default; 49 : AnalyticConstant(const AnalyticConstant&) = default; 50 : AnalyticConstant& operator=(const AnalyticConstant&) = default; 51 : /// \endcond 52 0 : ~AnalyticConstant() override = default; 53 : 54 0 : explicit AnalyticConstant(CkMigrateMessage* msg); 55 : 56 0 : WRAPPED_PUPable_decl_base_template( 57 : domain::BoundaryConditions::BoundaryCondition, AnalyticConstant); 58 : 59 0 : auto get_clone() const -> std::unique_ptr< 60 : domain::BoundaryConditions::BoundaryCondition> override; 61 : 62 0 : static constexpr evolution::BoundaryConditions::Type bc_type = 63 : evolution::BoundaryConditions::Type::Ghost; 64 : 65 0 : void pup(PUP::er& p) override; 66 : 67 0 : using dg_interior_evolved_variables_tags = tmpl::list<>; 68 0 : using dg_interior_temporary_tags = tmpl::list< 69 : gr::Tags::InverseSpatialMetric<DataVector, Dim, Frame::Inertial>, 70 : Tags::ConstraintGamma1, Tags::ConstraintGamma2, 71 : gr::Tags::Lapse<DataVector>, 72 : gr::Tags::Shift<DataVector, Dim, Frame::Inertial>>; 73 0 : using dg_interior_dt_vars_tags = tmpl::list<>; 74 0 : using dg_interior_deriv_vars_tags = tmpl::list<>; 75 0 : using dg_gridless_tags = tmpl::list<>; 76 : 77 0 : std::optional<std::string> dg_ghost( 78 : const gsl::not_null<Scalar<DataVector>*> psi, 79 : const gsl::not_null<Scalar<DataVector>*> pi, 80 : const gsl::not_null<tnsr::i<DataVector, Dim, Frame::Inertial>*> phi, 81 : const gsl::not_null<Scalar<DataVector>*> lapse, 82 : const gsl::not_null<tnsr::I<DataVector, Dim>*> shift, 83 : const gsl::not_null<Scalar<DataVector>*> gamma1, 84 : const gsl::not_null<Scalar<DataVector>*> gamma2, 85 : const gsl::not_null<tnsr::II<DataVector, Dim, Frame::Inertial>*> 86 : inverse_spatial_metric, 87 : const std::optional<tnsr::I<DataVector, Dim, Frame::Inertial>>& 88 : /*face_mesh_velocity*/, 89 : const tnsr::i<DataVector, Dim>& /*normal_covector*/, 90 : const tnsr::I<DataVector, Dim>& /*normal_vector*/, 91 : const tnsr::II<DataVector, Dim, Frame::Inertial>& 92 : inverse_spatial_metric_interior, 93 : const Scalar<DataVector>& gamma1_interior, 94 : const Scalar<DataVector>& gamma2_interior, 95 : const Scalar<DataVector>& lapse_interior, 96 : const tnsr::I<DataVector, Dim>& shift_interior) const; 97 : 98 : private: 99 0 : double amplitude_ = std::numeric_limits<double>::signaling_NaN(); 100 : }; 101 : } // namespace CurvedScalarWave::BoundaryConditions