Equations.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
9 #include "Domain/Tags.hpp"
10 #include "Elliptic/Systems/Elasticity/Tags.hpp"
11 #include "PointwiseFunctions/Elasticity/ConstitutiveRelations/Tags.hpp"
12 #include "Utilities/Gsl.hpp"
14 #include "Utilities/TMPL.hpp"
15 
16 /// \cond
17 class DataVector;
18 namespace PUP {
19 class er;
20 } // namespace PUP
21 namespace Elasticity {
22 namespace ConstitutiveRelations {
23 template <size_t Dim>
24 class ConstitutiveRelation;
25 } // namespace ConstitutiveRelations
26 } // namespace Elasticity
27 /// \endcond
28 
29 namespace Elasticity {
30 
31 /*!
32  * \brief Compute the fluxes \f$F^{ij}=Y^{ijkl}(x) S_{kl}(x)\f$ for
33  * the Elasticity equation on a flat spatial metric in Cartesian coordinates.
34  */
35 template <size_t Dim>
36 void primal_fluxes(
37  gsl::not_null<tnsr::IJ<DataVector, Dim>*> flux_for_displacement,
38  const tnsr::ii<DataVector, Dim>& strain,
39  const ConstitutiveRelations::ConstitutiveRelation<Dim>&
40  constitutive_relation,
41  const tnsr::I<DataVector, Dim>& coordinates) noexcept;
42 
43 /*!
44  * \brief Compute the fluxes \f$F^i_{jk}=\delta^{i}_{(j} \xi_{k)}\f$ for the
45  * auxiliary field in the first-order formulation of the Elasticity equation.
46  *
47  * \see Elasticity::FirstOrderSystem
48  */
49 template <size_t Dim>
50 void auxiliary_fluxes(
51  gsl::not_null<tnsr::Ijj<DataVector, Dim>*> flux_for_strain,
52  const tnsr::I<DataVector, Dim>& displacement) noexcept;
53 
54 /*!
55  * \brief Compute the fluxes \f$F^i_A\f$ for the Elasticity equation on a flat
56  * metric in Cartesian coordinates.
57  *
58  * \see Elasticity::FirstOrderSystem
59  */
60 template <size_t Dim>
61 struct Fluxes {
62  using argument_tags =
65  using volume_tags = tmpl::list<Tags::ConstitutiveRelationBase>;
66  static void apply(
67  const gsl::not_null<tnsr::IJ<DataVector, Dim>*> flux_for_displacement,
69  constitutive_relation,
70  const tnsr::I<DataVector, Dim>& coordinates,
71  const tnsr::ii<DataVector, Dim>& strain) noexcept {
72  primal_fluxes(flux_for_displacement, strain, constitutive_relation,
73  coordinates);
74  }
75  static void apply(
76  const gsl::not_null<tnsr::Ijj<DataVector, Dim>*> flux_for_strain,
78  Dim>& /*constitutive_relation*/,
79  const tnsr::I<DataVector, Dim>& /*coordinates*/,
80  const tnsr::I<DataVector, Dim>& displacement) noexcept {
81  auxiliary_fluxes(flux_for_strain, displacement);
82  }
83  // clang-tidy: no runtime references
84  void pup(PUP::er& /*p*/) noexcept {} // NOLINT
85 };
86 
87 /*!
88  * \brief Compute the sources \f$S_A\f$ for the Elasticity equation.
89  *
90  * \see Elasticity::FirstOrderSystem
91  */
92 template <size_t Dim>
93 struct Sources {
94  using argument_tags = tmpl::list<>;
95  static void apply(
96  const gsl::not_null<tnsr::I<DataVector, Dim>*> source_for_displacement,
97  const gsl::not_null<tnsr::ii<DataVector, Dim>*> /*source_for_strain*/,
98  const tnsr::I<DataVector, Dim>& /*displacement*/,
99  const tnsr::IJ<DataVector, Dim>& /*stress*/) noexcept {
100  for (size_t d = 0; d < Dim; d++) {
101  source_for_displacement->get(d) = 0.;
102  }
103  }
104 };
105 
106 } // namespace Elasticity
domain::Tags::Coordinates< Dim, Frame::Inertial >
Elasticity::Fluxes
Compute the fluxes for the Elasticity equation on a flat metric in Cartesian coordinates.
Definition: Equations.hpp:61
Tags.hpp
Elasticity
Items related to solving elasticity problems.
Definition: Equations.cpp:19
Elasticity::Tags::ConstitutiveRelationBase
Base tag for the constitutive relation.
Definition: Tags.hpp:13
cstddef
MakeWithValue.hpp
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:42
Gsl.hpp
Tensor.hpp
Elasticity::ConstitutiveRelations::ConstitutiveRelation
Base class for constitutive (stress-strain) relations that characterize the elastic properties of a m...
Definition: ConstitutiveRelation.hpp:55
Elasticity::Sources
Compute the sources for the Elasticity equation.
Definition: Equations.hpp:93
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183