Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/Tensor/Tensor.hpp"
9 : #include "Domain/Tags.hpp"
10 : #include "Elliptic/Systems/Elasticity/Tags.hpp"
11 : #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp"
12 : #include "PointwiseFunctions/Elasticity/ConstitutiveRelations/ConstitutiveRelation.hpp"
13 : #include "PointwiseFunctions/Elasticity/ConstitutiveRelations/Tags.hpp"
14 :
15 : namespace Elasticity {
16 :
17 : /// @{
18 : /*!
19 : * \brief The potential energy density \f$U=-\frac{1}{2}S_{ij}T^{ij}\f$ stored
20 : * in the deformation of the elastic material (see Eq. (11.25) in
21 : * \cite ThorneBlandford2017)
22 : *
23 : * Note that the two-dimensional instantiation of this function assumes that
24 : * only the terms of \f$S_{ij}T^{ij}\f$ where both \f$i\f$ and \f$j\f$
25 : * correspond to one of the computational dimensions contribute to the sum. This
26 : * is the case for the plane-stress approximation employed in the
27 : * two-dimensional `Elasticity::ConstitutiveRelations::IsotropicHomogeneous`,
28 : * for example, where \f$T^{i3}=0=T^{3i}\f$.
29 : */
30 : template <size_t Dim>
31 1 : void potential_energy_density(gsl::not_null<Scalar<DataVector>*> result,
32 : const tnsr::ii<DataVector, Dim>& strain,
33 : const tnsr::II<DataVector, Dim>& stress);
34 :
35 : template <size_t Dim>
36 1 : void potential_energy_density(
37 : gsl::not_null<Scalar<DataVector>*> result,
38 : const tnsr::ii<DataVector, Dim>& strain,
39 : const tnsr::I<DataVector, Dim>& coordinates,
40 : const ConstitutiveRelations::ConstitutiveRelation<Dim>&
41 : constitutive_relation);
42 :
43 : template <size_t Dim>
44 1 : Scalar<DataVector> potential_energy_density(
45 : const tnsr::ii<DataVector, Dim>& strain,
46 : const tnsr::I<DataVector, Dim>& coordinates,
47 : const ConstitutiveRelations::ConstitutiveRelation<Dim>&
48 : constitutive_relation);
49 : /// @}
50 :
51 : namespace Tags {
52 :
53 : /// \brief Computes the energy density stored in the deformation of the elastic
54 : /// material.
55 : /// \see `Elasticity::Tags::PotentialEnergyDensity`
56 : template <size_t Dim>
57 1 : struct PotentialEnergyDensityCompute
58 : : Elasticity::Tags::PotentialEnergyDensity<Dim>,
59 : db::ComputeTag {
60 0 : using base = Elasticity::Tags::PotentialEnergyDensity<Dim>;
61 0 : using return_type = Scalar<DataVector>;
62 0 : using argument_tags =
63 : tmpl::list<Elasticity::Tags::Strain<Dim>, Elasticity::Tags::Stress<Dim>>;
64 0 : static constexpr auto function = static_cast<void (*)(
65 : gsl::not_null<Scalar<DataVector>*>, const tnsr::ii<DataVector, Dim>&,
66 : const tnsr::II<DataVector, Dim>&)>(&potential_energy_density<Dim>);
67 : };
68 :
69 : } // namespace Tags
70 : } // namespace Elasticity
|