Zero.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7 #include <pup.h>
8
11 #include "Elliptic/Systems/Elasticity/Tags.hpp"
12 #include "Options/Options.hpp"
14 #include "PointwiseFunctions/AnalyticData/AnalyticData.hpp"
16 #include "Utilities/TMPL.hpp"
17 #include "Utilities/TaggedTuple.hpp"
18
19 namespace Elasticity::Solutions {
20
21 /// \cond
22 template <size_t Dim, typename Registrars>
23 struct Zero;
24
25 namespace Registrars {
26 template <size_t Dim>
27 struct Zero {
28  template <typename Registrars>
29  using f = Solutions::Zero<Dim, Registrars>;
30 };
31 } // namespace Registrars
32 /// \endcond
33
34 /*!
35  * \brief The trivial solution \f$\xi^i(x)=0\f$ of the Elasticity equations.
36  * Useful as initial guess.
37  *
38  * \note This class derives off ::AnalyticData because, while it is
39  * technically an analytic solution, it will only be used as initial guess and
40  * thus doesn't need to implement the additional requirements of the
41  * Elasticity::Solutions::AnalyticSolution base class. In particular, it
42  * doesn't need to provide a constitutive relation.
43  */
44 template <size_t Dim,
45  typename Registrars = tmpl::list<Solutions::Registrars::Zero<Dim>>>
46 class Zero : public ::AnalyticData<Dim, Registrars> {
47  public:
48  using options = tmpl::list<>;
49  static constexpr Options::String help{
50  "The trivial solution, useful as initial guess."};
51
52  Zero() = default;
53  Zero(const Zero&) noexcept = default;
54  Zero& operator=(const Zero&) noexcept = default;
55  Zero(Zero&&) noexcept = default;
56  Zero& operator=(Zero&&) noexcept = default;
57  ~Zero() noexcept override = default;
58
59  /// \cond
60  explicit Zero(CkMigrateMessage* /*unused*/) noexcept {}
61  using PUP::able::register_constructor;
63  /// \endcond
64
65  /// Retrieve a collection of variables at coordinates x
66  template <typename DataType, typename... RequestedTags>
67  tuples::TaggedTuple<RequestedTags...> variables(
68  const tnsr::I<DataType, Dim>& x,
69  tmpl::list<RequestedTags...> /*meta*/) const noexcept {
70  using supported_tags =
71  tmpl::list<Tags::Displacement<Dim>, Tags::Strain<Dim>,
74  static_assert(tmpl::size<tmpl::list_difference<tmpl::list<RequestedTags...>,
75  supported_tags>>::value == 0,
76  "The requested tag is not supported");
77  return {make_with_value<typename RequestedTags::type>(x, 0.)...};
78  }
79
81  void pup(PUP::er& /*p*/) noexcept override {}
82 };
83
84 /// \cond
85 template <size_t Dim, typename Registrars>
86 PUP::able::PUP_ID Zero<Dim, Registrars>::my_PUP_ID = 0; // NOLINT
87 /// \endcond
88
89 template <size_t Dim, typename Registrars>
90 bool operator==(const Zero<Dim, Registrars>& /*lhs*/,
91  const Zero<Dim, Registrars>& /*rhs*/) noexcept {
92  return true;
93 }
94
95 template <size_t Dim, typename Registrars>
96 bool operator!=(const Zero<Dim, Registrars>& /*lhs*/,
97  const Zero<Dim, Registrars>& /*rhs*/) noexcept {
98  return false;
99 }
100 } // namespace Elasticity::Solutions
Elasticity::Tags::MinusStress
Minus the symmetric stress, i.e. , describing pressure within the elastic material....
Definition: Tags.hpp:66
CharmPupable.hpp
Elasticity::Solutions::Zero::variables
tuples::TaggedTuple< RequestedTags... > variables(const tnsr::I< DataType, Dim > &x, tmpl::list< RequestedTags... >) const noexcept
Retrieve a collection of variables at coordinates x
Definition: Zero.hpp:67
std::rel_ops::operator!=
T operator!=(T... args)
Options.hpp
Elasticity::Solutions::Zero
The trivial solution of the Elasticity equations. Useful as initial guess.
Definition: Zero.hpp:46
Tags::FixedSource
Prefix indicating a source term that is independent of dynamic variables.
Definition: Prefixes.hpp:75
WRAPPED_PUPable_decl_template
#define WRAPPED_PUPable_decl_template(className)
Mark derived classes as serializable.
Definition: CharmPupable.hpp:22
cstddef
Elasticity::Tags::Strain
The symmetric strain , describing the deformation of the elastic material.
Definition: Tags.hpp:56
MakeWithValue.hpp
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Elasticity::Solutions
Analytic solutions of the linear Elasticity equations.
Definition: AnalyticSolution.hpp:18
AnalyticData
Provides analytic tensor data as a function of the spatial coordinates.
Definition: AnalyticData.hpp:34
Elasticity::Tags::PotentialEnergyDensity
The energy density stored in the deformation of the elastic material.
Definition: Tags.hpp:75
Options::String
const char *const String
The string used in option structs.
Definition: Options.hpp:32
Tensor.hpp
Prefixes.hpp
brigand::list_difference
fold< Sequence2, Sequence1, lazy::remove< _state, _element > > list_difference
Obtain the elements of Sequence1 that are not in Sequence2.
Definition: TMPL.hpp:625
TMPL.hpp