NuTo
Numerics Tool
LinearElastic.h
Go to the documentation of this file.
1 #pragma once
2 #include <type_traits>
3 #include <tuple>
6 
7 namespace NuTo
8 {
9 namespace Laws
10 {
11 
12 template <int TDim>
13 class LinearElastic : public MechanicsInterface<TDim>
14 {
15 public:
16  LinearElastic(double E, double Nu, ePlaneState planeState = ePlaneState::PLANE_STRESS)
17  : mC(CalculateC(E, Nu, planeState))
18  , mE(E)
19  , mNu(Nu)
20  {
21  }
22 
24  {
25  return mC * strain;
26  }
27 
29  {
30  return mC;
31  }
32 
33  void SetPlaneState(ePlaneState planeState)
34  {
35  mC = CalculateC(mE, mNu, planeState);
36  }
37 
38  static EngineeringTangent<TDim> CalculateC(double E, double Nu, ePlaneState planeState = ePlaneState::PLANE_STRESS);
39 
40 private:
42  double mE;
43  double mNu;
44 };
45 
50 inline std::tuple<double, double, double> CalculateCoefficients2DPlaneStress(double E, double Nu)
51 {
52  double factor = E / (1.0 - (Nu * Nu));
53  return std::make_tuple(factor, // C11
54  factor * Nu, // C12
55  factor * 0.5 * (1.0 - Nu)); // C33
56 }
57 
62 inline std::tuple<double, double, double> CalculateCoefficients3D(double E, double Nu)
63 {
64  double factor = E / ((1.0 + Nu) * (1.0 - 2.0 * Nu));
65  return std::make_tuple(factor * (1.0 - Nu), // C11
66  factor * Nu, // C12
67  E / (2. * (1.0 + Nu))); // C33
68 }
69 
70 template <>
72 {
74 }
75 
76 template <>
77 inline EngineeringTangent<2> LinearElastic<2>::CalculateC(double E, double Nu, ePlaneState planeState)
78 {
79  double C11 = 0, C12 = 0, C33 = 0;
80  if (planeState == ePlaneState::PLANE_STRESS)
81  std::tie(C11, C12, C33) = CalculateCoefficients2DPlaneStress(E, Nu);
82  else
83  std::tie(C11, C12, C33) = CalculateCoefficients3D(E, Nu);
84 
86  C = Eigen::Matrix3d::Zero();
87  C(0, 0) = C11;
88  C(1, 0) = C12;
89 
90  C(0, 1) = C12;
91  C(1, 1) = C11;
92 
93  C(2, 2) = C33;
94  return C;
95 }
96 
97 template <>
99 {
100  double C11 = 0, C12 = 0, C44 = 0;
101  std::tie(C11, C12, C44) = CalculateCoefficients3D(E, Nu);
103  // C11 diagonal:
104  C(0, 0) = C11;
105  C(1, 1) = C11;
106  C(2, 2) = C11;
107 
108  // C12 off diagonals:
109  C(0, 1) = C12;
110  C(0, 2) = C12;
111  C(1, 0) = C12;
112  C(1, 2) = C12;
113  C(2, 0) = C12;
114  C(2, 1) = C12;
115 
116  // C44 diagonal:
117  C(3, 3) = C44;
118  C(4, 4) = C44;
119  C(5, 5) = C44;
120  return C;
121 }
122 
123 } /* Laws */
124 } /* NuTo */
ePlaneState
Definition: ConstitutivePlaneStateEnum.h:4
static EngineeringTangent< TDim > CalculateC(double E, double Nu, ePlaneState planeState=ePlaneState::PLANE_STRESS)
Engineering strain.
Definition: EngineeringStrain.h:33
named pair for cellId and ipId to make the argument list shorter and avoid accidental mixup of both ...
Definition: CellIds.h:7
std::tuple< double, double, double > CalculateCoefficients2DPlaneStress(double E, double Nu)
calculate coefficients of the PLANE_STRESS 2D material matrix
Definition: LinearElastic.h:50
Definition: LinearElastic.h:13
void SetPlaneState(ePlaneState planeState)
Definition: LinearElastic.h:33
std::tuple< double, double, double > CalculateCoefficients3D(double E, double Nu)
calculate coefficients of the 3D material matrix
Definition: LinearElastic.h:62
LinearElastic(double E, double Nu, ePlaneState planeState=ePlaneState::PLANE_STRESS)
Definition: LinearElastic.h:16
Engineering stress.
Definition: EngineeringStress.h:31
Definition: Exception.h:6
Definition: SerializeStreamOut.h:9
const double E
Definition: LinearElasticDamageBenchmark.cpp:6
const NuTo::EngineeringStrain< 3 > strain
Definition: LinearElasticDamageBenchmark.cpp:9
EngineeringTangent< TDim > Tangent(EngineeringStrain< TDim >, double=0, CellIds=CellIds{}) const override
Definition: LinearElastic.h:28
EngineeringStress< TDim > Stress(EngineeringStrain< TDim > strain, double=0, CellIds=CellIds{}) const override
Definition: LinearElastic.h:23
Definition: MechanicsInterface.h:13