v0.10.0
Public Member Functions | List of all members
EshelbianPlasticity::OpHMHH Struct Reference
Inheritance diagram for EshelbianPlasticity::OpHMHH:
[legend]
Collaboration diagram for EshelbianPlasticity::OpHMHH:
[legend]

Public Member Functions

 OpHMHH (const std::string &field_name, const int tag, const bool eval_rhs, const bool eval_lhs, boost::shared_ptr< DataAtIntegrationPts > &data_ptr, boost::shared_ptr< PhysicalEquations > &physics_ptr)
 
MoFEMErrorCode evaluateRhs (EntData &data)
 
MoFEMErrorCode evaluateLhs (EntData &data)
 
- Public Member Functions inherited from EshelbianPlasticity::OpJacobian
 OpJacobian (const std::string &field_name, const int tag, const bool eval_rhs, const bool eval_lhs, boost::shared_ptr< DataAtIntegrationPts > &data_ptr, boost::shared_ptr< PhysicalEquations > &physics_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Additional Inherited Members

- Public Attributes inherited from EshelbianPlasticity::OpJacobian
const int tAg
 adol-c tape More...
 
const bool evalRhs
 
const bool evalLhs
 
boost::shared_ptr< DataAtIntegrationPtsdataAtPts
 data at integration pts More...
 
boost::shared_ptr< PhysicalEquationsphysicsPtr
 material physical equations More...
 

Detailed Description

Definition at line 18 of file EshelbianADOL-C.cpp.

Constructor & Destructor Documentation

◆ OpHMHH()

EshelbianPlasticity::OpHMHH::OpHMHH ( const std::string &  field_name,
const int  tag,
const bool  eval_rhs,
const bool  eval_lhs,
boost::shared_ptr< DataAtIntegrationPts > &  data_ptr,
boost::shared_ptr< PhysicalEquations > &  physics_ptr 
)

Definition at line 19 of file EshelbianADOL-C.cpp.

22  : OpJacobian(field_name, tag, eval_rhs, eval_lhs, data_ptr, physics_ptr) {
23  }
OpJacobian(const std::string &field_name, const int tag, const bool eval_rhs, const bool eval_lhs, boost::shared_ptr< DataAtIntegrationPts > &data_ptr, boost::shared_ptr< PhysicalEquations > &physics_ptr)

Member Function Documentation

◆ evaluateLhs()

MoFEMErrorCode EshelbianPlasticity::OpHMHH::evaluateLhs ( EntData data)
virtual

Implements EshelbianPlasticity::OpJacobian.

Definition at line 93 of file EshelbianADOL-C.cpp.

93  {
98  const int number_of_active_variables = physicsPtr->activeVariables.size();
99  const int number_of_dependent_variables =
100  physicsPtr->dependentVariables.size();
101  std::vector<double *> jac_ptr(number_of_dependent_variables);
102  for (unsigned int n = 0; n != number_of_dependent_variables; ++n) {
103  jac_ptr[n] =
104  &(physicsPtr
105  ->dependentVariablesDirevatives[n * number_of_active_variables]);
106  }
107 
108  const auto nb_integration_pts = ent_data.getN().size1();
109 
110  auto create_data_mat = [nb_integration_pts](auto &m) {
111  m.resize(9, nb_integration_pts, false);
112  };
113 
114  auto create_data_ten = [nb_integration_pts](auto &m) {
115  m.resize(27, nb_integration_pts, false);
116  };
117 
118  create_data_ten(dataAtPts->P_dh0);
119  create_data_ten(dataAtPts->P_dh1);
120  create_data_ten(dataAtPts->P_dh2);
121  create_data_ten(dataAtPts->P_dH0);
122  create_data_ten(dataAtPts->P_dH1);
123  create_data_ten(dataAtPts->P_dH2);
124  create_data_ten(dataAtPts->Sigma_dh0);
125  create_data_ten(dataAtPts->Sigma_dh1);
126  create_data_ten(dataAtPts->Sigma_dh2);
127  create_data_ten(dataAtPts->Sigma_dH0);
128  create_data_ten(dataAtPts->Sigma_dH1);
129  create_data_ten(dataAtPts->Sigma_dH2);
130  create_data_mat(dataAtPts->phi_dh);
131  create_data_mat(dataAtPts->phi_dH);
132  create_data_ten(dataAtPts->Flow_dh0);
133  create_data_ten(dataAtPts->Flow_dh1);
134  create_data_ten(dataAtPts->Flow_dh2);
135  create_data_ten(dataAtPts->Flow_dH0);
136  create_data_ten(dataAtPts->Flow_dH1);
137  create_data_ten(dataAtPts->Flow_dH2);
138 
139  auto iu = getFTensor2SymmetricFromMat<3>(dataAtPts->streachTensorAtPts);
140  auto iG = getFTensor2FromMat<3, 3>(dataAtPts->GAtPts);
141 
142  auto r_P_dh0 = getFTensor3FromMat(dataAtPts->P_dh0);
143  auto r_P_dh1 = getFTensor3FromMat(dataAtPts->P_dh1);
144  auto r_P_dh2 = getFTensor3FromMat(dataAtPts->P_dh2);
145  auto r_P_dH0 = getFTensor3FromMat(dataAtPts->P_dH0);
146  auto r_P_dH1 = getFTensor3FromMat(dataAtPts->P_dH1);
147  auto r_P_dH2 = getFTensor3FromMat(dataAtPts->P_dH2);
148  auto r_Sigma_dh0 = getFTensor3FromMat(dataAtPts->Sigma_dh0);
149  auto r_Sigma_dh1 = getFTensor3FromMat(dataAtPts->Sigma_dh1);
150  auto r_Sigma_dh2 = getFTensor3FromMat(dataAtPts->Sigma_dh2);
151  auto r_Sigma_dH0 = getFTensor3FromMat(dataAtPts->Sigma_dH0);
152  auto r_Sigma_dH1 = getFTensor3FromMat(dataAtPts->Sigma_dH1);
153  auto r_Sigma_dH2 = getFTensor3FromMat(dataAtPts->Sigma_dH2);
154  auto r_phi_dh = getFTensor2FromMat<3, 3>(dataAtPts->phi_dh);
155  auto r_phi_dH = getFTensor2FromMat<3, 3>(dataAtPts->phi_dH);
156  auto r_Flow_dh0 = getFTensor3FromMat(dataAtPts->Flow_dh0);
157  auto r_Flow_dh1 = getFTensor3FromMat(dataAtPts->Flow_dh1);
158  auto r_Flow_dh2 = getFTensor3FromMat(dataAtPts->Flow_dh2);
159  auto r_Flow_dH0 = getFTensor3FromMat(dataAtPts->Flow_dH0);
160  auto r_Flow_dH1 = getFTensor3FromMat(dataAtPts->Flow_dH1);
161  auto r_Flow_dH2 = getFTensor3FromMat(dataAtPts->Flow_dH2);
162 
163  for (unsigned int gg = 0; gg != nb_integration_pts; ++gg) {
164 
165  auto t_h = physicsPtr->get_h();
166  for(auto ii : {0, 1, 2})
167  for(auto jj : {0, 1, 2})
168  t_h(ii, jj) = iu(ii, jj);
169 
170  physicsPtr->get_H()(i, j) = iG(i, j);
171  for (int ii = 0; ii != 3; ++ii)
172  physicsPtr->get_H()(ii, ii) += 1;
173 
174  // play recorder for jacobians
175  // CHKERR physicsPtr->recordTape(tAg, &t_h);
176  int r = ::jacobian(tAg, number_of_dependent_variables,
177  number_of_active_variables,
178  &physicsPtr->activeVariables[0], &jac_ptr[0]);
179  if (r < 0) {
180  SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
181  "ADOL-C function evaluation with error");
182  }
183 
184  r_P_dh0(i, j, k) = physicsPtr->get_P_dh0()(i, j, k);
185  r_P_dh1(i, j, k) = physicsPtr->get_P_dh1()(i, j, k);
186  r_P_dh2(i, j, k) = physicsPtr->get_P_dh2()(i, j, k);
187  r_P_dH0(i, j, k) = physicsPtr->get_P_dH0()(i, j, k);
188  r_P_dH1(i, j, k) = physicsPtr->get_P_dH1()(i, j, k);
189  r_P_dH2(i, j, k) = physicsPtr->get_P_dH2()(i, j, k);
190  r_Sigma_dh0(i, j, k) = physicsPtr->get_Sigma_dh0()(i, j, k);
191  r_Sigma_dh1(i, j, k) = physicsPtr->get_Sigma_dh1()(i, j, k);
192  r_Sigma_dh2(i, j, k) = physicsPtr->get_Sigma_dh2()(i, j, k);
193  r_Sigma_dH0(i, j, k) = physicsPtr->get_Sigma_dH0()(i, j, k);
194  r_Sigma_dH1(i, j, k) = physicsPtr->get_Sigma_dH1()(i, j, k);
195  r_Sigma_dH2(i, j, k) = physicsPtr->get_Sigma_dH2()(i, j, k);
196  r_phi_dh(i, j) = physicsPtr->get_Phi_dh()(i, j);
197  r_phi_dH(i, j) = physicsPtr->get_Phi_dH()(i, j);
198  r_Flow_dh0(i, j, k) = physicsPtr->get_Flow_dh0()(i, j, k);
199  r_Flow_dh1(i, j, k) = physicsPtr->get_Flow_dh1()(i, j, k);
200  r_Flow_dh2(i, j, k) = physicsPtr->get_Flow_dh2()(i, j, k);
201  r_Flow_dH0(i, j, k) = physicsPtr->get_Flow_dH0()(i, j, k);
202  r_Flow_dH1(i, j, k) = physicsPtr->get_Flow_dH1()(i, j, k);
203  r_Flow_dH2(i, j, k) = physicsPtr->get_Flow_dH2()(i, j, k);
204 
205  ++iu;
206  ++iG;
207  ++r_P_dh0;
208  ++r_P_dh1;
209  ++r_P_dh2;
210  ++r_P_dH0;
211  ++r_P_dH1;
212  ++r_P_dH2;
213  ++r_Sigma_dh0;
214  ++r_Sigma_dh1;
215  ++r_Sigma_dh2;
216  ++r_Sigma_dH0;
217  ++r_Sigma_dH1;
218  ++r_Sigma_dH2;
219  ++r_phi_dh;
220  ++r_phi_dH;
221  ++r_Flow_dh0;
222  ++r_Flow_dh1;
223  ++r_Flow_dh2;
224  ++r_Flow_dH0;
225  ++r_Flow_dH1;
226  ++r_Flow_dH2;
227  }
229 }
boost::shared_ptr< PhysicalEquations > physicsPtr
material physical equations
FTensor::Index< 'i', 3 > i
FTensor::Index< 'k', 3 > k
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
static Index< 'n', 3 > n
static Index< 'm', 3 > m
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
data at integration pts
FTensor::Tensor3< FTensor::PackPtr< double *, 1 >, 3, 3, 3 > getFTensor3FromMat(MatrixDouble &m)
FTensor::Index< 'j', 3 > j
const double r
rate factor
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

◆ evaluateRhs()

MoFEMErrorCode EshelbianPlasticity::OpHMHH::evaluateRhs ( EntData data)
virtual

Implements EshelbianPlasticity::OpJacobian.

Definition at line 29 of file EshelbianADOL-C.cpp.

29  {
34 
35  const auto nb_integration_pts = ent_data.getN().size1();
36  auto iu = getFTensor2SymmetricFromMat<3>(dataAtPts->streachTensorAtPts);
37  // FIXME: that should work with material streach
38  auto iG = getFTensor2FromMat<3, 3>(dataAtPts->GAtPts);
39 
40  auto create_data_vec = [nb_integration_pts](auto &v) {
41  v.resize(nb_integration_pts, false);
42  };
43  auto create_data_mat = [nb_integration_pts](auto &m) {
44  m.resize(9, nb_integration_pts, false);
45  };
46 
47  create_data_mat(dataAtPts->PAtPts);
48  create_data_mat(dataAtPts->SigmaAtPts);
49  create_data_vec(dataAtPts->phiAtPts);
50  create_data_mat(dataAtPts->flowAtPts);
51 
52  auto r_P = getFTensor2FromMat<3, 3>(dataAtPts->PAtPts);
53  auto r_Sigma = getFTensor2FromMat<3, 3>(dataAtPts->SigmaAtPts);
54  auto r_phi = getFTensor0FromVec(dataAtPts->phiAtPts);
55  auto r_flow = getFTensor2FromMat<3, 3>(dataAtPts->flowAtPts);
56 
57  for (unsigned int gg = 0; gg != nb_integration_pts; ++gg) {
58 
59  auto t_h = physicsPtr->get_h();
60  for (auto ii : {0, 1, 2})
61  for (auto jj : {0, 1, 2})
62  t_h(ii, jj) = iu(ii, jj);
63 
64  physicsPtr->get_H()(i, j) = iG(i, j);
65  for (int ii = 0; ii != 3; ++ii)
66  physicsPtr->get_H()(ii, ii) += 1;
67 
68  // CHKERR physicsPtr->recordTape(tAg, &t_h);
69  int r = ::function(tAg, physicsPtr->dependentVariables.size(),
70  physicsPtr->activeVariables.size(),
71  &physicsPtr->activeVariables[0],
72  &physicsPtr->dependentVariables[0]);
73  if (r < 0) { // function is locally analytic
74  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
75  "ADOL-C function evaluation with error r = %d", r);
76  }
77 
78  r_P(i, j) = physicsPtr->get_P()(i, j);
79  r_Sigma(i, j) = physicsPtr->get_Sigma()(i, j);
80  r_phi = physicsPtr->get_Phi();
81  r_flow(i, j) = physicsPtr->get_Flow()(i, j);
82 
83  ++iu;
84  ++iG;
85  ++r_P;
86  ++r_Sigma;
87  ++r_phi;
88  ++r_flow;
89  }
91 }
boost::shared_ptr< PhysicalEquations > physicsPtr
material physical equations
static FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:143
FTensor::Index< 'i', 3 > i
FTensor::Index< 'k', 3 > k
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
static Index< 'm', 3 > m
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
data at integration pts
FTensor::Index< 'j', 3 > j
const double r
rate factor
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

The documentation for this struct was generated from the following file: