LCOV - code coverage report
Current view: top level - src/Model/Solid/Linear - Transverse.H (source / functions) Coverage Total Hit
Test: coverage_merged.info Lines: 56.2 % 48 27
Test Date: 2025-06-26 20:08:28 Functions: 81.2 % 16 13

            Line data    Source code
       1              : //
       2              : // Transversely Isotropic Elasticity Model.
       3              : // This file implements a transversely isotropic elasticity model for the materials that exhibit
       4              : // isotropic behavior in a plane and a distinct response in the perpendicular direction.
       5              : // The stiffness tensor is defined using elastic constants (C11, C12, C13, C33, C44) and an
       6              : // orientation provided either by Bunge Euler angles (phi1, Phi, phi2) or a rotation matrix.
       7              : // Reference: http://solidmechanics.org/text/Chapter3_2/Chapter3_2.htm#Sect3_2_16
       8              : //
       9              : 
      10              : #ifndef MODEL_SOLID_LINEAR_TRANSVERSE_H_
      11              : #define MODEL_SOLID_LINEAR_TRANSVERSE_H_
      12              : 
      13              : #include "Model/Solid/Solid.H"
      14              : // # include "Model/Solid/Linear/Transverse.H"
      15              : #include "IO/ParmParse.H"
      16              : 
      17              : namespace Model
      18              : {
      19              : namespace Solid
      20              : {
      21              : namespace Linear
      22              : {
      23              : 
      24              : class Transverse : public Solid<Set::Sym::MajorMinor>
      25              : {
      26              : public:
      27           50 :     Transverse(){};
      28              :     Transverse(Solid<Set::Sym::MajorMinor> base)
      29              :         : Solid<Set::Sym::MajorMinor>(base){};
      30           76 :     virtual ~Transverse(){};
      31              : 
      32              :     void
      33           44 :     Define(Set::Scalar C11, Set::Scalar C12, Set::Scalar C13, Set::Scalar C33, Set::Scalar C44, Set::Scalar phi1, Set::Scalar Phi, Set::Scalar phi2)
      34              :     {
      35           44 :         ddw = Set::Matrix4<AMREX_SPACEDIM, Set::Sym::MajorMinor>::Transverse(
      36              :             C11, C12, C13, C33, C44, phi1, Phi, phi2);
      37           44 :     }
      38              : 
      39              :     void
      40            2 :     Define(Set::Scalar C11, Set::Scalar C12, Set::Scalar C13, Set::Scalar C33, Set::Scalar C44, Eigen::Matrix3d R = Eigen::Matrix3d::Identity())
      41              :     {
      42            2 :         ddw = Set::Matrix4<AMREX_SPACEDIM, Set::Sym::MajorMinor>::Transverse(
      43              :             C11, C12, C13, C33, C44, R);
      44            2 :     }
      45              :     Set::Scalar
      46          260 :     W(const Set::Matrix &gradu) const override
      47              :     {
      48          520 :         return (0.5 * gradu.transpose() * (ddw * gradu)).trace();
      49              :     }
      50              :     Set::Matrix
      51         1960 :     DW(const Set::Matrix &gradu) const override
      52              :     {
      53         3920 :         return ddw * gradu;
      54              :     }
      55              :     Set::Matrix4<AMREX_SPACEDIM, Set::Sym::MajorMinor>
      56           20 :     DDW(const Set::Matrix & /*gradu*/) const override
      57              :     {
      58           20 :         return ddw;
      59              :     }
      60              :     virtual void
      61            0 :     Print(std::ostream &out) const override
      62              :     {
      63            0 :         out << ddw;
      64            0 :     }
      65              : 
      66              : public:
      67              :     Set::Matrix4<AMREX_SPACEDIM, Set::Sym::MajorMinor> ddw;
      68              :     static const KinematicVariable kinvar = KinematicVariable::gradu;
      69              : 
      70              :     AMREX_FORCE_INLINE
      71              :     static Transverse
      72              :     Combine(const std::vector<Transverse> &models,
      73              :             const std::vector<Set::Scalar> &eta)
      74              :     {
      75              :         Transverse ret;
      76              :         ret.ddw = Set::Matrix4<AMREX_SPACEDIM, Set::Sym::MajorMinor>::Zero();
      77              :         Set::Scalar etasum = 0.;
      78              :         for (unsigned int n = 0; n < models.size(); n++)
      79              :             etasum += eta[n];
      80              :         for (unsigned int n = 0; n < models.size(); n++)
      81              :         {
      82              :             ret.ddw += models[n].ddw * (eta[n] / etasum);
      83              :         }
      84              :         return ret;
      85              :     }
      86              : 
      87              :     static Transverse
      88            2 :     Zero()
      89              :     {
      90            2 :         Transverse ret;
      91            2 :         ret.Define(0.0, 0.0, 0.0, 0.0, 0.0);
      92            2 :         return ret;
      93            0 :     }
      94              :     static Transverse
      95           44 :     Random()
      96              :     {
      97           44 :         return Random(Util::Random(), Util::Random(), Util::Random(), Util::Random(), Util::Random());
      98              :     }
      99              :     static Transverse
     100           44 :     Random(Set::Scalar C11, Set::Scalar C12, Set::Scalar C13, Set::Scalar C33, Set::Scalar C44)
     101              :     {
     102           44 :         Transverse ret;
     103           44 :         Set::Scalar phi1 = 2.0 * Set::Constant::Pi * Util::Random();
     104           44 :         Set::Scalar Phi = 2.0 * Set::Constant::Pi * Util::Random();
     105           44 :         Set::Scalar phi2 = 2.0 * Set::Constant::Pi * Util::Random();
     106           44 :         ret.Define(C11, C12, C13, C33, C44, phi1, Phi, phi2);
     107           44 :         return ret;
     108            0 :     }
     109              : 
     110              :     static void
     111            0 :     Parse(Transverse &value, IO::ParmParse &pp)
     112              :     {
     113            0 :         Set::Scalar C11 = NAN, C12 = NAN, C13 = NAN, C33 = NAN, C44 = NAN;
     114              : 
     115            0 :         pp_query_default("C11", C11, 1.68); // Elastic constant
     116            0 :         pp_query_default("C12", C12, 1.21); // Elastic constant
     117            0 :         pp_query_default("C13", C13, 0.75); // Elastic constant
     118            0 :         pp_query_default("C33", C33, 1.68); // Elastic constant
     119            0 :         pp_query_default("C44", C44, 1.68); // Elastic constant
     120              : 
     121            0 :         if (pp.contains("random"))
     122              :         {
     123            0 :             value = Transverse::Random(C11, C12, C13, C33, C44);
     124            0 :             return;
     125              :         }
     126              : 
     127            0 :         Set::Scalar phi1 = NAN, Phi = NAN, phi2 = NAN;
     128            0 :         Set::Scalar small = 1e-8; // <- Fixed indentation (tab replaced with spaces)
     129              : 
     130            0 :         pp_query_default("phi1", phi1, small); // Bunge Euler angle :math:\phi_1
     131            0 :         pp_query_default("Phi", Phi, small);   // Bunge Euler angle :math:\Phi
     132            0 :         pp_query_default("phi2", phi2, small); // Bunge Euler angle :math:\phi_2
     133            0 :         value.Define(C11, C12, C13, C33, C44, phi1, Phi, phi2);
     134              :     }
     135              : 
     136              : #define OP_CLASS Transverse
     137              : #define OP_VARS X(ddw)
     138              : #include "Model/Solid/InClassOperators.H"
     139              : };
     140              : #include "Model/Solid/ExtClassOperators.H"
     141              : 
     142              : } // namespace Linear
     143              : } // namespace Solid
     144              : } // namespace Model
     145              : 
     146              : #endif
        

Generated by: LCOV version 2.0-1