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 
46  DirichletAnalytic() = default;
47  DirichletAnalytic(DirichletAnalytic&&) noexcept = default;
48  DirichletAnalytic& operator=(DirichletAnalytic&&) noexcept = default;
49  DirichletAnalytic(const DirichletAnalytic&) = default;
50  DirichletAnalytic& operator=(const DirichletAnalytic&) = default;
51  ~DirichletAnalytic() override = default;
52 
53  explicit DirichletAnalytic(CkMigrateMessage* msg) noexcept;
54 
55  WRAPPED_PUPable_decl_base_template(
57 
58  auto get_clone() const noexcept -> std::unique_ptr<
60 
61  static constexpr evolution::BoundaryConditions::Type bc_type =
62  evolution::BoundaryConditions::Type::Ghost;
63 
64  void pup(PUP::er& p) override;
65 
66  using dg_interior_evolved_variables_tags = tmpl::list<>;
67  using dg_interior_temporary_tags =
68  tmpl::list<domain::Tags::Coordinates<1, Frame::Inertial>>;
69  using dg_gridless_tags =
70  tmpl::list<::Tags::Time, ::Tags::AnalyticSolutionOrData>;
71 
72  template <typename AnalyticSolutionOrData>
75  const gsl::not_null<tnsr::I<DataVector, 1, Frame::Inertial>*> flux_u,
76  const std::optional<
77  tnsr::I<DataVector, 1, Frame::Inertial>>& /*face_mesh_velocity*/,
78  const tnsr::i<DataVector, 1, Frame::Inertial>& /*normal_covector*/,
79  const tnsr::I<DataVector, 1, Frame::Inertial>& coords,
80  [[maybe_unused]] const double time,
81  const AnalyticSolutionOrData& analytic_solution_or_data) const noexcept {
82  if constexpr (std::is_base_of_v<MarkAsAnalyticSolution,
83  AnalyticSolutionOrData>) {
84  *u = get<Burgers::Tags::U>(analytic_solution_or_data.variables(
85  coords, time, tmpl::list<Burgers::Tags::U>{}));
86  } else {
87  *u = get<Burgers::Tags::U>(analytic_solution_or_data.variables(
88  coords, tmpl::list<Burgers::Tags::U>{}));
89  }
90  flux_impl(flux_u, *u);
91  return {};
92  }
93 
94  private:
95  static void flux_impl(
96  gsl::not_null<tnsr::I<DataVector, 1, Frame::Inertial>*> flux,
97  const Scalar<DataVector>& u_analytic) noexcept;
98 };
99 } // namespace Burgers::BoundaryConditions
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: ReadSpecPiecewisePolynomial.hpp:13
string