v0.15.0
Loading...
Searching...
No Matches
HMHHStVenantKirchhoff.cpp
Go to the documentation of this file.
1/**
2 * @file HMHHStVenantKirchhoff.cpp
3 * @brief Implementation StVenantKirchhoff
4 * @version 0.1
5 * @date 2024-08-31
6 *
7 * @copyright Copyright (c) 2024
8 *
9 */
10
11namespace EshelbianPlasticity {
12
14
15 static constexpr int numberOfActiveVariables = 9;
16 static constexpr int numberOfDependentVariables = 9;
17
21
22 MoFEMErrorCode getOptions() {
24
25 double E = 1;
26 double nu = 0;
27
28 PetscOptionsBegin(PETSC_COMM_WORLD, "stvenant_", "", "none");
29
30 CHKERR PetscOptionsScalar("-young_modulus", "Young modulus", "", E, &E,
31 PETSC_NULLPTR);
32 CHKERR PetscOptionsScalar("-poisson_ratio", "poisson ratio", "", nu, &nu,
33 PETSC_NULLPTR);
34
35 PetscOptionsEnd();
36
37 MOFEM_LOG("EP", Sev::inform) << "St Venant Kirchhoff model parameters: "
38 << "E = " << E << ", nu = " << nu;
39
40 lambda = LAMBDA(E, nu);
41 mu = MU(E, nu);
42
44 }
45
46 double lambda;
47 double mu;
48 double sigmaY;
49
58
68
70
71 MoFEMErrorCode recordTape(const int tape, DTensor2Ptr *t_h_ptr) {
73 FTensor::Index<'i', 3> i;
74 FTensor::Index<'j', 3> j;
75 FTensor::Index<'I', 3> I;
76 FTensor::Index<'J', 3> J;
80
82
84
85 auto ih = get_h();
86 // auto iH = get_H();
87 if (t_h_ptr)
88 ih(i, j) = (*t_h_ptr)(i, j);
89 else {
90 ih(i, j) = t_kd(i, j);
91 }
92
93 auto r_P = get_P();
94
95 enableMinMaxUsingAbs();
96 trace_on(tape);
97
98 // Set active variables to ADOL-C
99 th(i, j) <<= get_h()(i, j);
100
101 tF(i, I) = th(i, I);
102 CHKERR determinantTensor3by3(tF, detF);
103 CHKERR invertTensor3by3(tF, detF, tInvF);
104
105 // Deformation and strain
106 tC(I, J) = tF(i, I) * tF(i, J);
107 tE(I, J) = tC(I, J);
108 tE(N0, N0) -= 1;
109 tE(N1, N1) -= 1;
110 tE(N2, N2) -= 1;
111 tE(I, J) *= 0.5;
112
113 // Energy
114 trE = tE(I, I);
115 energy = 0.5 * lambda * trE * trE + mu * (tE(I, J) * tE(I, J));
116
117 // Stress Piola II
118 tS(I, J) = tE(I, J);
119 tS(I, J) *= 2 * mu;
120 tS(N0, N0) += lambda * trE;
121 tS(N1, N1) += lambda * trE;
122 tS(N2, N2) += lambda * trE;
123 // Stress Piola I
124 tP(i, J) = tF(i, I) * tS(I, J);
125
126 // Set dependent variables to ADOL-C
127 tP(i, j) >>= r_P(i, j);
128
129 trace_off();
130
132 }
133};
134
135
136
137} // namespace EshelbianPlasticity
Kronecker Delta class symmetric.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MU(E, NU)
Definition fem_tools.h:23
#define LAMBDA(E, NU)
Definition fem_tools.h:22
constexpr auto t_kd
#define MOFEM_LOG(channel, severity)
Log.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
FTensor::Index< 'j', 3 > j
constexpr IntegrationType I
HMHStVenantKirchhoff(const double lambda, const double mu)
MoFEMErrorCode recordTape(const int tape, DTensor2Ptr *t_h_ptr)