SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Elasticity/ConstitutiveRelations - CubicCrystal.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 20.5 % 39 8
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            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              : #include <limits>
       8              : #include <memory>
       9              : #include <pup.h>
      10              : 
      11              : #include "DataStructures/Tensor/TypeAliases.hpp"
      12              : #include "Options/String.hpp"
      13              : #include "PointwiseFunctions/Elasticity/ConstitutiveRelations/ConstitutiveRelation.hpp"
      14              : #include "Utilities/Serialization/CharmPupable.hpp"
      15              : #include "Utilities/TMPL.hpp"
      16              : 
      17              : /// \cond
      18              : class DataVector;
      19              : /// \endcond
      20              : 
      21              : namespace Elasticity::ConstitutiveRelations {
      22              : 
      23              : /*!
      24              :  * \brief A cubic crystalline material
      25              :  *
      26              :  * \details For a cubic crystalline material the Elasticity tensor in the linear
      27              :  * constitutive relation \f$T^{ij}=-Y^{ijkl}S_{kl}\f$ reduces to
      28              :  *
      29              :  * \f[
      30              :  * Y^{ijkl} =
      31              :  * \begin{cases}
      32              :  * c_{11} & \mathrm{for}\; i=j=k=l \\
      33              :  * c_{12} & \mathrm{for}\; i=j,k=l,i \neq k \\
      34              :  * c_{44} & \mathrm{for}\; i=k,j=l,i \neq j \;\mathrm{or}\; i=l,j=k,i\neq j \\
      35              :  * \end{cases}
      36              :  * \f]
      37              :  *
      38              :  * with the three independent parameters: the \f$\mathrm{Lam\acute{e}}\f$
      39              :  * parameter \f$\lambda\f$, the Shear modulus \f$\mu\f$ and the %Poisson
      40              :  * ratio \f$\nu\f$. In the parametrization chosen in this implementation we use
      41              :  * the experimental group parameters \f$c_{11}\f$, \f$c_{12}\f$ and
      42              :  * \f$c_{44}\f$, related by;
      43              :  *
      44              :  * \f[
      45              :  * c_{11} = \frac{1 - \nu}{\nu} \lambda = \frac{(1 - \nu)E}{(1 + \nu)(1 -
      46              :  * 2\nu)}, \quad
      47              :  * c_{12} = \lambda = \frac{E\nu}{(1 + \nu)(1 - 2\nu)}, \quad
      48              :  * c_{44} = \mu
      49              :  * \f]
      50              :  *
      51              :  * and inversely;
      52              :  *
      53              :  * \f[
      54              :  * E = \frac{(c_{11} + 2c_{12})(c_{11} - c_{12})}{c_{11} + c_{12}}, \quad
      55              :  * \nu = \left(1 + \frac{c_{11}}{c_{12}}\right)^{-1}, \quad
      56              :  * \mu = c_{44}
      57              :  * \f]
      58              :  *
      59              :  * The stress-strain relation then reduces to
      60              :  *
      61              :  * \f[
      62              :  * T^{ij} =
      63              :  * \begin{cases}
      64              :  * -(c_{11} - c_{12}) S^{ij} - c_{12} \mathrm{Tr}(S) & \mathrm{for}\; i=j \\
      65              :  * -2 c_{44} S^{ij} & \mathrm{for}\; i \neq j \\
      66              :  * \end{cases}
      67              :  * \f]
      68              :  *
      69              :  * In the case where the shear modulus satisfies \f$c_{44} =
      70              :  * \frac{c_{11}-c_{12}}{2}\f$ the constitutive relation is that of an isotropic
      71              :  * material (see `Elasticity::ConstitutiveRelations::IsotropicHomogeneous`).
      72              :  */
      73              : 
      74            1 : class CubicCrystal : public ConstitutiveRelation<3> {
      75              :  public:
      76            0 :   static constexpr size_t volume_dim = 3;
      77              : 
      78            0 :   struct C_11 {
      79            0 :     using type = double;
      80            0 :     static constexpr Options::String help = {
      81              :         "c_11 parameter for a cubic crystal"};
      82            0 :     static type lower_bound() { return 0.0; }
      83              :   };
      84              : 
      85            0 :   struct C_12 {
      86            0 :     using type = double;
      87            0 :     static constexpr Options::String help = {
      88              :         "c_12 parameter for a cubic crystal"};
      89            0 :     static type lower_bound() { return 0.0; }
      90              :   };
      91              : 
      92            0 :   struct C_44 {
      93            0 :     using type = double;
      94            0 :     static constexpr Options::String help = {
      95              :         "c_44 parameter for a cubic crystal"};
      96            0 :     static type lower_bound() { return 0.0; }
      97              :   };
      98              : 
      99            0 :   using options = tmpl::list<C_11, C_12, C_44>;
     100              : 
     101            0 :   static constexpr Options::String help = {
     102              :       "A constitutive relation that describes a cubic, crystalline material in "
     103              :       "terms of the three independent group paremeters. The parameters "
     104              :       "are measured in units of stress, typically Pascals."};
     105              : 
     106            0 :   CubicCrystal() = default;
     107            0 :   CubicCrystal(const CubicCrystal&) = default;
     108            0 :   CubicCrystal& operator=(const CubicCrystal&) = default;
     109            0 :   CubicCrystal(CubicCrystal&&) = default;
     110            0 :   CubicCrystal& operator=(CubicCrystal&&) = default;
     111            0 :   ~CubicCrystal() override = default;
     112              : 
     113            0 :   CubicCrystal(double c_11, double c_12, double c_44);
     114              : 
     115            1 :   std::unique_ptr<ConstitutiveRelation<3>> get_clone() const override;
     116              : 
     117              :   /// The constitutive relation that characterizes the elastic properties of a
     118              :   /// material
     119            1 :   void stress(gsl::not_null<tnsr::II<DataVector, 3>*> stress,
     120              :               const tnsr::ii<DataVector, 3>& strain,
     121              :               const tnsr::I<DataVector, 3>& x) const override;
     122              : 
     123              :   /// The 1st group parameter \f$c_{11} = \frac{1 - \nu}{\nu} \lambda\f$
     124            1 :   double c_11() const;
     125              :   /// The 2nd group parameter; the \f$\mathrm{Lam\acute{e}}\f$ parameter
     126              :   /// \f$c_{12} = \lambda\f$
     127            1 :   double c_12() const;
     128              :   /// The 3rd group parameter; the shear modulus (rigidity) \f$c_{44} = \mu\f$
     129            1 :   double c_44() const;
     130              :   /// The Young's modulus \f$E\f$
     131            1 :   double youngs_modulus() const;
     132              :   /// The %Poisson ratio \f$\nu\f$
     133            1 :   double poisson_ratio() const;
     134              : 
     135              :   // clang-tidy: no runtime references
     136            0 :   void pup(PUP::er& /*p*/) override;  //  NOLINT
     137              : 
     138            0 :   explicit CubicCrystal(CkMigrateMessage* /*unused*/) {}
     139              : 
     140            0 :   WRAPPED_PUPable_decl_base_template(  // NOLINT
     141              :       SINGLE_ARG(ConstitutiveRelation<3>), CubicCrystal);
     142              : 
     143              :  private:
     144            0 :   double c_11_ = std::numeric_limits<double>::signaling_NaN();
     145            0 :   double c_12_ = std::numeric_limits<double>::signaling_NaN();
     146            0 :   double c_44_ = std::numeric_limits<double>::signaling_NaN();
     147              : };  // namespace ConstitutiveRelations
     148              : 
     149            0 : bool operator==(const CubicCrystal& lhs, const CubicCrystal& rhs);
     150            0 : bool operator!=(const CubicCrystal& lhs, const CubicCrystal& rhs);
     151              : 
     152              : }  // namespace Elasticity::ConstitutiveRelations
        

Generated by: LCOV version 2.0-1