v0.9.1
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 99 of file EshelbianADOL-C.cpp.

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

◆ 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 =
41  [nb_integration_pts](boost::shared_ptr<VectorDouble> &v_ptr) {
42  if (!v_ptr)
43  v_ptr = boost::make_shared<VectorDouble>();
44  v_ptr->resize(nb_integration_pts, false);
45  };
46  auto create_data_mat =
47  [nb_integration_pts](boost::shared_ptr<MatrixDouble> &m_ptr) {
48  if (!m_ptr)
49  m_ptr = boost::make_shared<MatrixDouble>();
50  m_ptr->resize(9, nb_integration_pts, false);
51  };
52 
53  create_data_mat(dataAtPts->PAtPts);
54  create_data_mat(dataAtPts->SigmaAtPts);
55  create_data_vec(dataAtPts->phiAtPts);
56  create_data_mat(dataAtPts->flowAtPts);
57 
58  auto r_P = getFTensor2FromMat<3, 3>(*(dataAtPts->PAtPts));
59  auto r_Sigma = getFTensor2FromMat<3, 3>(*(dataAtPts->SigmaAtPts));
60  auto r_phi = getFTensor0FromVec(*(dataAtPts->phiAtPts));
61  auto r_flow = getFTensor2FromMat<3, 3>(*(dataAtPts->flowAtPts));
62 
63  for (unsigned int gg = 0; gg != nb_integration_pts; ++gg) {
64 
65  auto t_h = physicsPtr->get_h();
66  for (auto ii : {0, 1, 2})
67  for (auto jj : {0, 1, 2})
68  t_h(ii, jj) = iu(ii, jj);
69 
70  physicsPtr->get_H()(i, j) = iG(i, j);
71  for (int ii = 0; ii != 3; ++ii)
72  physicsPtr->get_H()(ii, ii) += 1;
73 
74  // CHKERR physicsPtr->recordTape(tAg, &t_h);
75  int r = ::function(tAg, physicsPtr->dependentVariables.size(),
76  physicsPtr->activeVariables.size(),
77  &physicsPtr->activeVariables[0],
78  &physicsPtr->dependentVariables[0]);
79  if (r < 0) { // function is locally analytic
80  SETERRQ1(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
81  "ADOL-C function evaluation with error r = %d", r);
82  }
83 
84  r_P(i, j) = physicsPtr->get_P()(i, j);
85  r_Sigma(i, j) = physicsPtr->get_Sigma()(i, j);
86  r_phi = physicsPtr->get_Phi();
87  r_flow(i, j) = physicsPtr->get_Flow()(i, j);
88 
89  ++iu;
90  ++iG;
91  ++r_P;
92  ++r_Sigma;
93  ++r_phi;
94  ++r_flow;
95  }
97 }
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:141
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:482
boost::shared_ptr< DataAtIntegrationPts > dataAtPts
data at integration pts
FTensor::Index< 'k', 2 > k
Definition: ContactOps.hpp:28
FTensor::Index< 'j', 2 > j
Definition: ContactOps.hpp:27
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:412
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ContactOps.hpp:26

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