v0.14.0
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 
11 namespace EshelbianPlasticity {
12 
14 
15  static constexpr int numberOfActiveVariables = 9;
16  static constexpr int numberOfDependentVariables = 9;
17 
18  HMHStVenantKirchhoff(const double lambda, const double mu)
20  lambda(lambda), mu(mu) {}
21 
24 
25  double E = 1;
26  double nu = 0;
27 
28  CHKERR PetscOptionsBegin(PETSC_COMM_WORLD, "stvenant_", "", "none");
29 
30  CHKERR PetscOptionsScalar("-young_modulus", "Young modulus", "", E, &E,
31  PETSC_NULL);
32  CHKERR PetscOptionsScalar("-poisson_ratio", "poisson ratio", "", nu, &nu,
33  PETSC_NULL);
34 
35  ierr = PetscOptionsEnd();
36  CHKERRG(ierr);
37 
38  MOFEM_LOG("EP", Sev::inform) << "St Venant Kirchhoff model parameters: "
39  << "E = " << E << ", nu = " << nu;
40 
41  lambda = LAMBDA(E, nu);
42  mu = MU(E, nu);
43 
45  }
46 
47  virtual OpJacobian *
48  returnOpJacobian(const int tag, const bool eval_rhs, const bool eval_lhs,
49  boost::shared_ptr<DataAtIntegrationPts> data_ptr,
50  boost::shared_ptr<PhysicalEquations> physics_ptr) {
51  return (new OpHMHH(tag, eval_rhs, eval_lhs, data_ptr, physics_ptr));
52  }
53 
54  double lambda;
55  double mu;
56  double sigmaY;
57 
66 
76 
78 
79  MoFEMErrorCode recordTape(const int tape, DTensor2Ptr *t_h_ptr) {
88 
90 
92 
93  auto ih = get_h();
94  // auto iH = get_H();
95  if (t_h_ptr)
96  ih(i, j) = (*t_h_ptr)(i, j);
97  else {
98  ih(i, j) = t_kd(i, j);
99  }
100 
101  auto r_P = get_P();
102 
103  enableMinMaxUsingAbs();
104  trace_on(tape);
105 
106  // Set active variables to ADOL-C
107  th(i, j) <<= get_h()(i, j);
108 
109  tF(i, I) = th(i, I);
112 
113  // Deformation and strain
114  tC(I, J) = tF(i, I) * tF(i, J);
115  tE(I, J) = tC(I, J);
116  tE(N0, N0) -= 1;
117  tE(N1, N1) -= 1;
118  tE(N2, N2) -= 1;
119  tE(I, J) *= 0.5;
120 
121  // Energy
122  trE = tE(I, I);
123  energy = 0.5 * lambda * trE * trE + mu * (tE(I, J) * tE(I, J));
124 
125  // Stress Piola II
126  tS(I, J) = tE(I, J);
127  tS(I, J) *= 2 * mu;
128  tS(N0, N0) += lambda * trE;
129  tS(N1, N1) += lambda * trE;
130  tS(N2, N2) += lambda * trE;
131  // Stress Piola I
132  tP(i, J) = tF(i, I) * tS(I, J);
133 
134  // Set dependent variables to ADOL-C
135  tP(i, j) >>= r_P(i, j);
136 
137  trace_off();
138 
140  }
141 };
142 
143 
144 
145 } // namespace EshelbianPlasticity
EshelbianPlasticity::HMHStVenantKirchhoff::sigmaY
double sigmaY
Definition: HMHHStVenantKirchhoff.cpp:56
EshelbianPlasticity::HMHStVenantKirchhoff::detF
adouble detF
Definition: HMHHStVenantKirchhoff.cpp:68
EshelbianPlasticity::HMHStVenantKirchhoff::tInvH
ATensor2 tInvH
Definition: HMHHStVenantKirchhoff.cpp:70
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
E
EshelbianPlasticity::HMHStVenantKirchhoff::phi
adouble phi
Definition: HMHHStVenantKirchhoff.cpp:62
LAMBDA
#define LAMBDA(E, NU)
Definition: fem_tools.h:22
EshelbianPlasticity
Definition: CGGTonsorialBubbleBase.hpp:11
EshelbianPlasticity::PhysicalEquations
Definition: EshelbianPlasticity.hpp:219
J
FTensor::Index< 'J', DIM1 > J
Definition: level_set.cpp:30
EshelbianPlasticity::HMHStVenantKirchhoff::trE
adouble trE
Definition: HMHHStVenantKirchhoff.cpp:69
EshelbianPlasticity::HMHStVenantKirchhoff::tInvF
ATensor2 tInvF
Definition: HMHHStVenantKirchhoff.cpp:72
FTensor::Tensor2< adouble, 3, 3 >
EshelbianPlasticity::HMHStVenantKirchhoff::detH
adouble detH
Definition: HMHHStVenantKirchhoff.cpp:67
EshelbianPlasticity::HMHStVenantKirchhoff::tP
ATensor2 tP
Definition: HMHHStVenantKirchhoff.cpp:60
I
constexpr IntegrationType I
Definition: operators_tests.cpp:31
MoFEM::invertTensor3by3
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
Definition: Templates.hpp:1588
EshelbianPlasticity::HMHStVenantKirchhoff::returnOpJacobian
virtual OpJacobian * returnOpJacobian(const int tag, const bool eval_rhs, const bool eval_lhs, boost::shared_ptr< DataAtIntegrationPts > data_ptr, boost::shared_ptr< PhysicalEquations > physics_ptr)
Definition: HMHHStVenantKirchhoff.cpp:48
FTensor::Number< 0 >
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
EshelbianPlasticity::HMHStVenantKirchhoff::tPulledP
ATensor2 tPulledP
Definition: HMHHStVenantKirchhoff.cpp:77
EshelbianPlasticity::HMHStVenantKirchhoff::tF
ATensor2 tF
Definition: HMHHStVenantKirchhoff.cpp:71
EshelbianPlasticity::HMHStVenantKirchhoff::s2
adouble s2
Definition: HMHHStVenantKirchhoff.cpp:63
EshelbianPlasticity::HMHStVenantKirchhoff::numberOfActiveVariables
static constexpr int numberOfActiveVariables
Definition: HMHHStVenantKirchhoff.cpp:15
EshelbianPlasticity::OpHMHH
Definition: EshelbianADOL-C.cpp:277
EshelbianPlasticity::HMHStVenantKirchhoff::tS
ATensor2 tS
Definition: HMHHStVenantKirchhoff.cpp:75
EshelbianPlasticity::HMHStVenantKirchhoff
Definition: HMHHStVenantKirchhoff.cpp:13
EshelbianPlasticity::HMHStVenantKirchhoff::lambda
double lambda
Definition: HMHHStVenantKirchhoff.cpp:54
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
EshelbianPlasticity::HMHStVenantKirchhoff::energy
adouble energy
Definition: HMHHStVenantKirchhoff.cpp:65
t_kd
constexpr auto t_kd
Definition: free_surface.cpp:137
EshelbianPlasticity::HMHStVenantKirchhoff::tE
ATensor2 tE
Definition: HMHHStVenantKirchhoff.cpp:74
FTensor::Index< 'i', 3 >
EshelbianPlasticity::HMHStVenantKirchhoff::HMHStVenantKirchhoff
HMHStVenantKirchhoff(const double lambda, const double mu)
Definition: HMHHStVenantKirchhoff.cpp:18
MoFEM::determinantTensor3by3
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:1540
adouble
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
EshelbianPlasticity::HMHStVenantKirchhoff::getOptions
MoFEMErrorCode getOptions()
Definition: HMHHStVenantKirchhoff.cpp:22
EshelbianPlasticity::HMHStVenantKirchhoff::th
ATensor2 th
Definition: HMHHStVenantKirchhoff.cpp:58
EshelbianPlasticity::OpJacobian
Definition: EshelbianPlasticity.hpp:380
EshelbianPlasticity::HMHStVenantKirchhoff::numberOfDependentVariables
static constexpr int numberOfDependentVariables
Definition: HMHHStVenantKirchhoff.cpp:16
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
EshelbianPlasticity::HMHStVenantKirchhoff::f
adouble f
Definition: HMHHStVenantKirchhoff.cpp:64
EshelbianPlasticity::HMHStVenantKirchhoff::tH
ATensor2 tH
Definition: HMHHStVenantKirchhoff.cpp:59
FTensor::Kronecker_Delta_symmetric
Kronecker Delta class symmetric.
Definition: Kronecker_Delta.hpp:49
EshelbianPlasticity::HMHStVenantKirchhoff::recordTape
MoFEMErrorCode recordTape(const int tape, DTensor2Ptr *t_h_ptr)
Definition: HMHHStVenantKirchhoff.cpp:79
EshelbianPlasticity::PhysicalEquations::get_h
DTensor2Ptr get_h()
Definition: EshelbianPlasticity.hpp:317
EshelbianPlasticity::HMHStVenantKirchhoff::tSigma
ATensor2 tSigma
Definition: HMHHStVenantKirchhoff.cpp:61
EshelbianPlasticity::HMHStVenantKirchhoff::mu
double mu
Definition: HMHHStVenantKirchhoff.cpp:55
EshelbianPlasticity::HMHStVenantKirchhoff::tC
ATensor2 tC
Definition: HMHHStVenantKirchhoff.cpp:73
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
CHKERRG
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:496
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
EshelbianPlasticity::PhysicalEquations::get_P
DTensor2Ptr get_P()
Definition: EshelbianPlasticity.hpp:325
MU
#define MU(E, NU)
Definition: fem_tools.h:23