DirichletAnalytic.hpp
1 // 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 
13 #include "DataStructures/DataVector.hpp"
16 #include "Evolution/BoundaryConditions/Type.hpp"
17 #include "Evolution/Systems/Burgers/BoundaryConditions/BoundaryCondition.hpp"
18 #include "Evolution/Systems/Burgers/Tags.hpp"
19 #include "Options/Options.hpp"
21 #include "PointwiseFunctions/AnalyticData/Tags.hpp"
22 #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
23 #include "Time/Tags.hpp"
24 #include "Utilities/Gsl.hpp"
25 #include "Utilities/TMPL.hpp"
26 
27 /// \cond
28 namespace domain::Tags {
29 template <size_t Dim, typename Frame>
30 struct Coordinates;
31 } // namespace domain::Tags
32 /// \endcond
33 
35 class DirichletAnalytic final : public BoundaryCondition {
36  private:
37  using flux_tag =
39 
40  public:
41  using options = tmpl::list<>;
42  static constexpr Options::String help{
43  "DirichletAnalytic boundary conditions setting the value of U to "
44  "the analytic solution or analytic data."};
45  static std::string name() noexcept { return "DirichletAnalytic"; }
46 
47  DirichletAnalytic() = default;
48  DirichletAnalytic(DirichletAnalytic&&) noexcept = default;
49  DirichletAnalytic& operator=(DirichletAnalytic&&) noexcept = default;
50  DirichletAnalytic(const DirichletAnalytic&) = default;
51  DirichletAnalytic& operator=(const DirichletAnalytic&) = default;
52  ~DirichletAnalytic() override = default;
53 
54  explicit DirichletAnalytic(CkMigrateMessage* msg) noexcept;
55 
56  WRAPPED_PUPable_decl_base_template(
58 
59  auto get_clone() const noexcept -> std::unique_ptr<
61 
62  static constexpr evolution::BoundaryConditions::Type bc_type =
63  evolution::BoundaryConditions::Type::Ghost;
64 
65  void pup(PUP::er& p) override;
66 
67  using dg_interior_evolved_variables_tags = tmpl::list<>;
68  using dg_interior_temporary_tags =
69  tmpl::list<domain::Tags::Coordinates<1, Frame::Inertial>>;
70  using dg_gridless_tags =
71  tmpl::list<::Tags::Time, ::Tags::AnalyticSolutionOrData>;
72 
73  template <typename AnalyticSolutionOrData>
76  const gsl::not_null<tnsr::I<DataVector, 1, Frame::Inertial>*> flux_u,
77  const std::optional<
78  tnsr::I<DataVector, 1, Frame::Inertial>>& /*face_mesh_velocity*/,
79  const tnsr::i<DataVector, 1, Frame::Inertial>& /*normal_covector*/,
80  const tnsr::I<DataVector, 1, Frame::Inertial>& coords,
81  [[maybe_unused]] const double time,
82  const AnalyticSolutionOrData& analytic_solution_or_data) const noexcept {
83  if constexpr (std::is_base_of_v<MarkAsAnalyticSolution,
84  AnalyticSolutionOrData>) {
85  *u = get<Burgers::Tags::U>(analytic_solution_or_data.variables(
86  coords, time, tmpl::list<Burgers::Tags::U>{}));
87  } else {
88  *u = get<Burgers::Tags::U>(analytic_solution_or_data.variables(
89  coords, tmpl::list<Burgers::Tags::U>{}));
90  }
91  flux_impl(flux_u, *u);
92  return {};
93  }
94 
95  private:
96  static void flux_impl(
97  gsl::not_null<tnsr::I<DataVector, 1, Frame::Inertial>*> flux,
98  const Scalar<DataVector>& u_analytic) noexcept;
99 };
100 } // namespace Burgers::BoundaryConditions
std::string
CharmPupable.hpp
domain::BoundaryConditions::BoundaryCondition
Base class from which all system-specific base classes must inherit.
Definition: BoundaryCondition.hpp:18
Frame::Inertial
Definition: IndexType.hpp:44
Options.hpp
Burgers::BoundaryConditions
Boundary conditions for the Burgers system.
Definition: BoundaryCondition.hpp:21
Tags::Flux
Prefix indicating a flux.
Definition: Prefixes.hpp:40
Burgers::BoundaryConditions::DirichletAnalytic
Definition: DirichletAnalytic.hpp:35
memory
Variables.hpp
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
Tensor.hpp
Burgers::BoundaryConditions::BoundaryCondition
The base class off of which all boundary conditions must inherit.
Definition: BoundaryCondition.hpp:23
optional
std::unique_ptr
Prefixes.hpp
type_traits
TMPL.hpp
domain::Tags
Tags for the domain.
Definition: FaceNormal.hpp:107
gsl::not_null
Require a pointer to not be a nullptr
Definition: ReadSpecThirdOrderPiecewisePolynomial.hpp:13
string