v0.16.3
Loading...
Searching...
No Matches
ADOLCPlasticity.hpp
Go to the documentation of this file.
1/** \file ADOLCPlasticity.hpp
2 * \ingroup adoc_plasticity
3 * \example mofem/users_modules/adolc-plasticity/src/ADOLCPlasticity.hpp
4 *
5 * \brief Operators and data structures for small strain plasticity
6 *
7 * \defgroup adoc_plasticity ADOL-C plasticity
8 * \ingroup user_modules
9 * \defgroup user_modules User modules
10 *
11 **/
12
13#ifndef __ADOLCPLASTICITY_HPP_
14#define __ADOLCPLASTICITY_HPP_
15
16#ifndef WITH_ADOL_C
17#error "MoFEM need to be compiled with ADOL-C"
18#endif
19
20/**
21 * \ingroup adoc_plasticity
22 *
23 */
24namespace ADOLCPlasticity {
25
27
28/**
29 * \brief Op convert Vight strain vector to strain tensor
30 */
32 return FTensor::Dg<double, 3, 6>{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
33 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0,
34 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
35 0.0, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
36};
37
38/**
39 * \brief Op convert strain tensor to Vight strain vector
40 */
42 return FTensor::Dg<double, 3, 6>{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
43 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
44 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
45 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
46};
47
48/**
49 * \brief Op convert Vight stress vector to stress tensor
50 */
52 return FTensor::Dg<double, 3, 6>{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
53 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
54 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
55 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
56};
57
58/** \brief common data used by volume elements
59 * \ingroup nonlinear_elastic_elem
60 */
61struct CommonData : boost::enable_shared_from_this<CommonData> {
62
63 MatrixDouble activeVariablesW;
64 MatrixDouble gradientW;
65
66 inline auto getFTensor1StressAtGaussPts(int gg = 0) {
68 &gradientW(gg, 7),
69 &gradientW(gg, 8),
70 &gradientW(gg, 9),
71 &gradientW(gg, 10),
72 &gradientW(gg, 11),
73 static_cast<int>(gradientW.size2())};
74 };
75
76 inline auto getFTensor1PlasticStrainAtGaussPts(int gg = 0) {
78 &activeVariablesW(gg, 0),
79 &activeVariablesW(gg, 1),
80 &activeVariablesW(gg, 2),
81 &activeVariablesW(gg, 3),
82 &activeVariablesW(gg, 4),
83 &activeVariablesW(gg, 5),
84 static_cast<int>(activeVariablesW.size2())};
85 };
86
87 MatrixDouble gradAtGaussPts;
89
90 inline auto getPlasticStrain(int gg = 0) {
91 return getVectorAdaptor(&(activeVariablesW(gg, 0)), 6);
92 }
93
94 inline auto getInternalVariables(int gg = 0) {
95 return getVectorAdaptor(&(activeVariablesW(gg, 12)),
96 activeVariablesW.size2() - 12);
97 }
98
99 vector<double> deltaGamma; //< Lagrange plastic multiplier
104
105 inline auto getGradAtGaussPtsPtr() {
106 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &gradAtGaussPts);
107 }
108
109 inline auto getMatTangentPtr() {
110 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
112 }
113
114 bool bBar = true;
115
118 PetscBool b_bar = bBar ? PETSC_TRUE : PETSC_FALSE;
119 CHKERR PetscOptionsGetBool(PETSC_NULLPTR, PETSC_NULLPTR, "-b_bar", &b_bar,
120 PETSC_NULLPTR);
121 bBar = b_bar;
123 }
124
125 boost::shared_ptr<MatrixDouble> getStressMatrixPtr() {
126 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &stressMatrix);
127 }
128 boost::shared_ptr<MatrixDouble> getPlasticStrainMatrixPtr() {
129 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
131 }
132
133 MatrixDouble stressMatrix;
135
137
138 CHK_THROW_MESSAGE(getDefaultMaterialParameters(), "get parameters failed");
139 }
140};
141
142/** \brief Closest point projection algorithm
143* \ingroup small_strain_plasticity
144
145*/
147
149 boost::function<int(int, int, int)> integrationRule = [](int, int, int p) {
150 return 2 * (p - 1);
151 };
152
153 VectorDouble internalVariables0;
154 VectorDouble plasticStrain0;
155
156 inline VectorAdaptor getPlasticStrain() {
157 return getVectorAdaptor(&(activeVariablesW[0]), 6);
158 }
159 inline VectorAdaptor getTotalStrain() {
160 return getVectorAdaptor(&(activeVariablesW[6]), 6);
161 }
162 inline VectorAdaptor getInternalVariables() {
163 return getVectorAdaptor(&(activeVariablesW[12]), nbInternalVariables);
164 }
165 inline VectorAdaptor getActiveVariablesYH() {
166 return getVectorAdaptor(&(gradientW[6]), 6 + nbInternalVariables);
167 }
168 inline VectorAdaptor getStress() {
169 return getVectorAdaptor(&(gradientW[6]), 6);
170 }
171 inline VectorAdaptor getInternalFluxes() {
172 return getVectorAdaptor(&(gradientW[12]), nbInternalVariables);
173 }
174
175 enum TypesTags { W = 0, Y, H, LAST_TAPE }; //< W - energy, Y - yield, H - flow
176 std::array<int, LAST_TAPE> tapesTags; //< Tapes nmbers
177
179
180 VectorAdaptor activeVariablesW;
181 VectorAdaptor gradientW;
182
183 double w;
184 double y;
185 double h;
186
187 double deltaGamma; // Increment of plastic multiplier
188 MatrixDouble Ep, Cp, Cep;
189 ublas::symmetric_matrix<double, ublas::lower> C, D;
190
191 PetscBool implHessianW;
192
193 /**
194 * \brief Record strain energy
195 */
196 MoFEMErrorCode recordW();
197
198 /**
199 * \brief Record yield function
200 */
201 MoFEMErrorCode recordY();
202
203 /**
204 * \brief Record flow potential
205 */
206 MoFEMErrorCode recordH();
207
208 MatrixDouble hessianW; //< Hessian of energy
209 MoFEMErrorCode playW();
210 MoFEMErrorCode playW_NoHessian();
211
212 VectorDouble gradientY; //< Gradient of yield function
213 MoFEMErrorCode playY();
214 MoFEMErrorCode playY_NoGradient();
215
216 VectorDouble gradientH; //< Gradient of flow potential
217 MatrixDouble hessianH; //< Hessian of flow potential
218 MoFEMErrorCode playH();
219 MoFEMErrorCode playH_NoHessian();
220
221 MoFEMErrorCode createMatAVecR(); //< For integration point SNES solver
222
223 MoFEMErrorCode evaluatePotentials(); //< Evaluate potentials
224
225 MoFEMErrorCode
226 playPotentials(); //< Play potentials from recorded ADOl-C tapes
227
228 MoFEMErrorCode
229 playPotentials_NoHessian(); //< Play potentials from recorded ADOl-C tapes
230
231 MoFEMErrorCode calculateR(Vec R); //< Calculate residual
232
233 MoFEMErrorCode calculateA(); //< Calculate tangent matrix
234
235 /**
236 * \brief Function executed by nested SENES at evaluationg residual
237 */
238 friend MoFEMErrorCode ADOLCPlasticityRes(SNES, Vec, Vec, void *ctx);
239
240 /**
241 * \brief Function executed by nested SENES at evaluationg tangent matrix
242 */
243 friend MoFEMErrorCode ADOLCPlasticityJac(SNES, Vec, Mat, Mat, void *ctx);
244
245 /**
246 * \brief Create nested snes
247 */
248 MoFEMErrorCode snesCreate();
249
250 /**
251 * \brief Solve nonlinear system of equations to find stress, internal
252 * fluxes, and Lagrange plastic multiplier
253 */
254 MoFEMErrorCode solveClosestProjection();
255
256 /**
257 * \brief Calculate consistent tangent matrix
258 */
259 MoFEMErrorCode consistentTangent();
260
261 /**
262 * \brief Record tapes
263 */
264 MoFEMErrorCode recordTapes();
265
266 /**
267 * \brief Get model parameters from blocks
268 */
269 virtual MoFEMErrorCode
271 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
272 std::string block_name, Sev sev) {
273 return 0;
274 }
275
276 /**
277 * \brief Set parameters for ADOL-C of constitutive relations
278 *
279 * \param tag [in] - tag of the tape
280 * \param recalculate_elastic_tangent [out] - if setParam set it to true,
281 * tangent matrix for elastic domain should be recalculated
282 */
283 virtual MoFEMErrorCode setParams(short tag,
284 bool &recalculate_elastic_tangent) {
285 return 0;
286 }
287
288 /**
289 * \brief Set Hemholtz energy
290 */
291 virtual MoFEMErrorCode freeHemholtzEnergy() = 0;
292
293 /**
294 * \brief Set yield function
295 */
296 virtual MoFEMErrorCode yieldFunction() = 0;
297
298 /**
299 * \brief Set flow potential
300 */
301 virtual MoFEMErrorCode flowPotential() = 0;
302
303 virtual MoFEMErrorCode codedHessianW(vector<double *>) { return 0; }
304
305 // protected:
306
307 MatrixDouble
308 partialWStrainPlasticStrain; //< Partial derivative of free energy
309 // with respect to plastic strain
310 VectorAdaptor partialYSigma; //< Partial derivative of yield function with
311 // respect to stress
312 VectorAdaptor partialYFlux; //< Partial derivative of yield function with
313 // respect to internal fluxes
314 VectorAdaptor partialHSigma; //< Partial derivative of flow potential with
315 // respect to stress
316 VectorAdaptor partialHFlux; //< Partial derivative of flow potential with
317 // respect to internal fluxes
318
319 /// Second partial derivative of flow potential with respect to stresses
320 /// and internal
321 ublas::symmetric_matrix<double, ublas::lower> partial2HSigma;
322 /// Second partial derivative of flow potential with respect to internal
323 /// fluxes
324 ublas::symmetric_matrix<double, ublas::lower> partial2HFlux;
325 /// Mixed decond partial derivative of flow potential with respect to stresses
326 /// and internal fluxes
327 MatrixDouble partial2HSigmaFlux;
328
329 SmartPetscObj<Mat> A; //< Nested SNES tangent matrix
330 SmartPetscObj<Vec> R; //< Nested SNES residual
331 SmartPetscObj<Vec> Chi; //< Nested SNES unknown vector
332 SmartPetscObj<Vec> dChi; //< Nested SNES increment vector
333 ublas::matrix<double, ublas::column_major> dataA;
334 SmartPetscObj<SNES> sNes; //< Nested SNES solver
335
336 ublas::vector<adouble> a_sTrain;
337 ublas::vector<adouble> a_plasticStrain;
338 ublas::vector<adouble> a_internalVariables;
339 ublas::vector<adouble> a_sTress, a_internalFluxes;
343};
344
345/**
346 * \brief Internal SNES function used at integration points to calulate stress
347 */
348MoFEMErrorCode ADOLCPlasticityRes(SNES snes, Vec chi, Vec r, void *ctx);
349
350/**
351 * \brief Internal SNES function used at integration points to calulate
352 * tangent matrix
353 */
354MoFEMErrorCode ADOLCPlasticityJac(SNES, Vec, Mat, Mat, void *ctx);
355
356/**
357 * \brief Get opreator to calulate stress
358 */
359template <int DIM, StrainType STRAIN>
360ForcesAndSourcesCore::UserDataOperator *getRawPtrOpCalculateStress(
361 MoFEM::Interface &m_field, boost::shared_ptr<CommonData> common_data_ptr,
362 boost::shared_ptr<ClosestPointProjection> cp_ptr, bool calc_lhs);
363
364template <>
365ForcesAndSourcesCore::UserDataOperator *
367 MoFEM::Interface &m_field, boost::shared_ptr<CommonData> common_data_ptr,
368 boost::shared_ptr<ClosestPointProjection> cp_ptr, bool calc_lhs);
369
370template <>
371ForcesAndSourcesCore::UserDataOperator *
373 MoFEM::Interface &m_field, boost::shared_ptr<CommonData> common_data_ptr,
374 boost::shared_ptr<ClosestPointProjection> cp_ptr, bool calc_lhs);
375
376template <>
377ForcesAndSourcesCore::UserDataOperator *
379 MoFEM::Interface &m_field, boost::shared_ptr<CommonData> common_data_ptr,
380 boost::shared_ptr<ClosestPointProjection> cp_ptr, bool calc_lhs);
381
382template <>
383ForcesAndSourcesCore::UserDataOperator *
385 MoFEM::Interface &m_field, boost::shared_ptr<CommonData> common_data_ptr,
386 boost::shared_ptr<ClosestPointProjection> cp_ptr, bool calc_lhs);
387
388/**
389 * \brief Assemble right hand side
390 *
391 * \param field_name [in] - name of field
392 * \param common_data_ptr [in] - shared pointer to common data
393 *
394 * \ingroup small_strain_plasticity
395 */
396template <int DIM, IntegrationType I, typename AssemblyDomainEleOp>
398
399/**
400 * \brief Assemble left hand side
401 *
402 * \param field_name [in] - name of field
403 * \param common_data_ptr [in] - shared pointer to common data
404 *
405 * \ingroup small_strain_plasticity
406 */
407template <int DIM, IntegrationType I, typename AssemblyDomainEleOp>
409
410template <typename DomainEleOp> struct ADOLCPlasticityIntegrators {
411
412 template <AssemblyType A> struct Assembly {
413
415 typename FormsIntegrators<DomainEleOp>::template Assembly<A>::OpBase;
416
417 template <int DIM, IntegrationType I>
419
420 template <int DIM, IntegrationType I>
422 };
423};
424
425using Pip = boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator>;
426
427/**
428 * @brief Assemble the left hand side, i.e. tangent matrix
429 * @ingroup adoc_plasticity
430 *
431 * @tparam DIM dimension of the problem
432 * @tparam A assembly type
433 * @tparam I integration type
434 * @tparam DomainEleOp operator type
435 * @param m_field
436 * @param field_name
437 * @param pip
438 * @param block_name esh block name caring material parameters
439 * @param common_data_ptr
440 * @param cp_ptr
441 * @return MoFEMErrorCode
442 */
443template <int DIM, AssemblyType A, IntegrationType I, typename DomainEleOp>
444MoFEMErrorCode opFactoryDomainRhs(
445 MoFEM::Interface &m_field, string field_name, Pip &pip,
446 std::string block_name, boost::shared_ptr<CommonData> common_data_ptr,
447 boost::shared_ptr<ClosestPointProjection> cp_ptr, Sev sev = Sev::inform) {
450 CHKERR cp_ptr->addMatBlockOps(m_field, pip, block_name, sev);
451 pip.push_back(getRawPtrOpCalculateStress<DIM, SMALL_STRAIN>(
452 m_field, common_data_ptr, cp_ptr, false));
453 pip.push_back(new typename P::template Assembly<A>::template OpRhs<DIM, I>(
454 field_name, common_data_ptr));
456}
457/**
458 * @brief Assemble the left hand side, i.e. tangent matrix
459 * @ingroup adoc_plasticity
460 *
461 * @tparam DIM dimension of the problem
462 * @tparam A assembly type
463 * @tparam I integration type
464 * @tparam DomainEleOp operator type
465 * @param m_field
466 * @param field_name
467 * @param pip
468 * @param block_name esh block name caring material parameters
469 * @param common_data_ptr
470 * @param cp_ptr
471 * @return MoFEMErrorCode
472 */
473template <int DIM, AssemblyType A, IntegrationType I, typename DomainEleOp>
474MoFEMErrorCode
476 std::string block_name,
477 boost::shared_ptr<CommonData> common_data_ptr,
478 boost::shared_ptr<ClosestPointProjection> cp_ptr) {
481 CHKERR cp_ptr->addMatBlockOps(m_field, pip, block_name, Sev::noisy);
482 pip.push_back(getRawPtrOpCalculateStress<DIM, SMALL_STRAIN>(
483 m_field, common_data_ptr, cp_ptr, true));
484 pip.push_back(new typename P::template Assembly<A>::template OpLhs<DIM, I>(
485 field_name, common_data_ptr));
487}
488
489/**
490 * @brief Push operators to update history variables
491 * @ingroup adoc_plasticity
492 *
493 * @tparam DIM dimension of the problem
494 * @param m_field core interface
495 * @param pip
496 * @param block_name mesh block name caring material parameters
497 * @param common_data_ptr
498 * @param cp_ptr
499 * @return MoFEMErrorCode
500 */
501template <int DIM>
502MoFEMErrorCode
504 std::string block_name,
505 boost::shared_ptr<CommonData> common_data_ptr,
506 boost::shared_ptr<ClosestPointProjection> cp_ptr);
507
508/**
509 * @copydoc ADOLCPlasticity::opFactoryDomainUpdate
510 */
511template <>
512MoFEMErrorCode
514 std::string block_name,
515 boost::shared_ptr<CommonData> common_data_ptr,
516 boost::shared_ptr<ClosestPointProjection> cp_ptr);
517
518/**
519 * @copydoc ADOLCPlasticity::opFactoryDomainUpdate
520 */
521template <>
522MoFEMErrorCode
524 std::string block_name,
525 boost::shared_ptr<CommonData> common_data_ptr,
526 boost::shared_ptr<ClosestPointProjection> cp_ptr);
527
528/**
529 * \brief Update internal fluxes (update history variables)
530 * \ingroup adoc_plasticity
531 */
532struct TSUpdate {
533 virtual MoFEMErrorCode postProcess(TS ts) = 0;
534};
535boost::shared_ptr<TSUpdate> createTSUpdate(std::string fe_name,
536 boost::shared_ptr<FEMethod> fe_ptr);
537
538/**
539 * \brief Calculate tensorial base functions. Apply bBar method when needed
540 */
541struct MakeB {
542
544 getFTensor2SymmetricDiffBase(DataForcesAndSourcesCore::EntData &data,
545 MatrixDouble &storage, const bool b_bar,
546 const int nb_integration_pts, double *w_ptr,
548
550 getFTensor2SymmetricDiffBase(DataForcesAndSourcesCore::EntData &data,
551 MatrixDouble &storage, const bool b_bar,
552 const int nb_integration_pts, double *w_ptr,
554};
555
556template <int DIM, typename AssemblyDomainEleOp>
558 OpRhsImpl(std::string field_name,
559 boost::shared_ptr<CommonData> common_data_ptr);
560 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data);
561
562private:
563 boost::shared_ptr<CommonData> commonDataPtr;
564 MatrixDouble baseStorage; ///< Store tensorial base functions
565};
566
567template <int DIM, typename AssemblyDomainEleOp>
569 OpLhsImpl(std::string field_name,
570 boost::shared_ptr<CommonData> common_data_ptr);
571 MoFEMErrorCode iNtegrate(DataForcesAndSourcesCore::EntData &row_data,
572 DataForcesAndSourcesCore::EntData &col_data);
573
574protected:
575 boost::shared_ptr<CommonData> commonDataPtr;
576 MatrixDouble baseRowStorage; ///< Store tensorial base functions
577 MatrixDouble baseColStorage; ///< Store tensorial base functions
578};
579
580template <int DIM, typename AssemblyDomainEleOp>
582 string field_name, boost::shared_ptr<CommonData> common_data_ptr)
584 commonDataPtr(common_data_ptr) {}
585
586//! [OpRhsImpl integrate]
587template <int DIM, typename AssemblyDomainEleOp>
589 EntitiesFieldData::EntData &data) {
591 using OP = AssemblyDomainEleOp;
592 FTensor::Index<'i', 3> i;
593 FTensor::Index<'j', 3> j;
594 double *w_ptr = &(OP::getGaussPts()(DIM, 0));
595 // Calulate tensorial base functions. Apply bBar method when needed
597 data, baseStorage, commonDataPtr->bBar, OP::getGaussPts().size2(), w_ptr,
599
600 auto t_stress = getFTensor2SymmetricFromMat<3>(commonDataPtr->stressMatrix);
601
602 const auto vol = OP::getMeasure();
603 auto t_w = OP::getFTensor0IntegrationWeight();
604 for (int gg = 0; gg != OP::nbIntegrationPts; gg++) {
605 double alpha = vol * t_w;
606 for (int bb = 0; bb != OP::nbRows; ++bb) {
607 OP::locF[bb] += alpha * (t_stress(i, j) * t_diff(i, j));
608 ++t_diff;
609 }
610 ++t_w;
611 ++t_stress;
612 }
614}
615//! [OpRhsImpl integrate]
616
617template <int DIM, typename AssemblyDomainEleOp>
619 string field_name, boost::shared_ptr<CommonData> common_data_ptr)
621 AssemblyDomainEleOp::OPROWCOL),
622 commonDataPtr(common_data_ptr) {
623 this->sYmm = false; // It has to be false for not-associtive plasticity
624}
625
626template <int DIM, typename AssemblyDomainEleOp>
628 DataForcesAndSourcesCore::EntData &row_data,
629 DataForcesAndSourcesCore::EntData &col_data) {
631 using OP = AssemblyDomainEleOp;
632
633 double *w_ptr = &(OP::getGaussPts()(DIM, 0));
634 auto t_diff_row = MakeB::getFTensor2SymmetricDiffBase(
635 row_data, baseRowStorage, commonDataPtr->bBar, OP::getGaussPts().size2(),
636 w_ptr, FTensor::Number<DIM>());
637 auto t_diff_col = MakeB::getFTensor2SymmetricDiffBase(
638 col_data, baseColStorage, commonDataPtr->bBar, OP::getGaussPts().size2(),
639 w_ptr, FTensor::Number<DIM>());
640
641 auto get_ftensor2_symmetric = [&](auto &storage, const auto gg,
642 const auto rr) {
644 &storage(gg, 6 * rr + 0), &storage(gg, 6 * rr + 1),
645 &storage(gg, 6 * rr + 2), &storage(gg, 6 * rr + 3),
646 &storage(gg, 6 * rr + 4), &storage(gg, 6 * rr + 5)};
647 };
648
649 FTensor::Index<'i', 3> i;
650 FTensor::Index<'j', 3> j;
651 FTensor::Index<'k', 3> k;
652 FTensor::Index<'l', 3> l;
653
654 auto t_Cep =
655 getFTensor4DdgFromMat<3, 3>(commonDataPtr->materialTangentOperator);
656 const auto vol = OP::getMeasure();
657 auto t_w = OP::getFTensor0IntegrationWeight();
658 for (int gg = 0; gg != OP::nbIntegrationPts; ++gg) {
659 const double alpha = vol * t_w;
660 ++t_w;
661
662 for (auto rr = 0; rr != OP::nbRows; ++rr) {
664 t_rowCep(k, l) = t_Cep(i, j, k, l) * t_diff_row(i, j);
665 auto t_diff_col = get_ftensor2_symmetric(baseColStorage, gg, 0);
666 for (auto cc = 0; cc != OP::nbCols; ++cc) {
667 OP::locMat(rr, cc) += alpha * (t_rowCep(k, l) * t_diff_col(k, l));
668 ++t_diff_col;
669 }
670 ++t_diff_row;
671 }
672
673 ++t_Cep;
674 }
676}
677
678} // namespace ADOLCPlasticity
679
680#endif //__ADOLCPLASTICITY_HPP_
Tag tag
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#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.
MoFEMErrorCode opFactoryDomainLhs(MoFEM::Interface &m_field, string field_name, Pip &pip, std::string block_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr)
Assemble the left hand side, i.e. tangent matrix.
MoFEMErrorCode opFactoryDomainUpdate(MoFEM::Interface &m_field, Pip &pip, std::string block_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr)
Push operators to update history variables.
MoFEMErrorCode opFactoryDomainRhs(MoFEM::Interface &m_field, string field_name, Pip &pip, std::string block_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr, Sev sev=Sev::inform)
Assemble the left hand side, i.e. tangent matrix.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
ForcesAndSourcesCore::UserDataOperator * getRawPtrOpCalculateStress< 3, SMALL_STRAIN >(MoFEM::Interface &m_field, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr, bool calc_lhs)
ForcesAndSourcesCore::UserDataOperator * getRawPtrOpCalculateStress< 2, SMALL_STRAIN >(MoFEM::Interface &m_field, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr, bool calc_lhs)
FTensor::Dg< double, 3, 6 > strain_to_voight_op()
Op convert strain tensor to Vight strain vector.
FTensor::Dg< double, 3, 6 > voight_to_stress_op()
Op convert Vight stress vector to stress tensor.
MoFEMErrorCode opFactoryDomainUpdate< 2 >(MoFEM::Interface &m_field, Pip &pip, std::string block_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr)
Push operators to update history variables.
MoFEMErrorCode ADOLCPlasticityJac(SNES, Vec, Mat, Mat, void *ctx)
Internal SNES function used at integration points to calulate tangent matrix.
boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > Pip
FTensor::Dg< double, 3, 6 > voight_to_strain_op()
Op convert Vight strain vector to strain tensor.
MoFEMErrorCode ADOLCPlasticityRes(SNES snes, Vec chi, Vec r, void *ctx)
Internal SNES function used at integration points to calulate stress.
ForcesAndSourcesCore::UserDataOperator * getRawPtrOpCalculateStress(MoFEM::Interface &m_field, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr, bool calc_lhs)
Get opreator to calulate stress.
boost::shared_ptr< TSUpdate > createTSUpdate(std::string fe_name, boost::shared_ptr< FEMethod > fe_ptr)
ForcesAndSourcesCore::UserDataOperator * getRawPtrOpCalculateStress< 2, LARGE_STRAIN >(MoFEM::Interface &m_field, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr, bool calc_lhs)
ForcesAndSourcesCore::UserDataOperator * getRawPtrOpCalculateStress< 3, LARGE_STRAIN >(MoFEM::Interface &m_field, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr, bool calc_lhs)
MoFEMErrorCode opFactoryDomainUpdate< 3 >(MoFEM::Interface &m_field, Pip &pip, std::string block_name, boost::shared_ptr< CommonData > common_data_ptr, boost::shared_ptr< ClosestPointProjection > cp_ptr)
Push operators to update history variables.
constexpr auto field_name
Closest point projection algorithm.
friend MoFEMErrorCode ADOLCPlasticityJac(SNES, Vec, Mat, Mat, void *ctx)
Function executed by nested SENES at evaluationg tangent matrix.
std::array< int, LAST_TAPE > tapesTags
MoFEMErrorCode solveClosestProjection()
Solve nonlinear system of equations to find stress, internal fluxes, and Lagrange plastic multiplier.
MoFEMErrorCode recordH()
Record flow potential.
MoFEMErrorCode recordY()
Record yield function.
boost::function< int(int, int, int)> integrationRule
virtual MoFEMErrorCode flowPotential()=0
Set flow potential.
ublas::symmetric_matrix< double, ublas::lower > partial2HFlux
MoFEMErrorCode recordW()
Record strain energy.
virtual MoFEMErrorCode addMatBlockOps(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string block_name, Sev sev)
Get model parameters from blocks.
ublas::symmetric_matrix< double, ublas::lower > D
friend MoFEMErrorCode ADOLCPlasticityRes(SNES, Vec, Vec, void *ctx)
Function executed by nested SENES at evaluationg residual.
ublas::symmetric_matrix< double, ublas::lower > C
virtual MoFEMErrorCode setParams(short tag, bool &recalculate_elastic_tangent)
Set parameters for ADOL-C of constitutive relations.
virtual MoFEMErrorCode codedHessianW(vector< double * >)
virtual MoFEMErrorCode yieldFunction()=0
Set yield function.
MoFEMErrorCode consistentTangent()
Calculate consistent tangent matrix.
ublas::symmetric_matrix< double, ublas::lower > partial2HSigma
ublas::matrix< double, ublas::column_major > dataA
virtual MoFEMErrorCode freeHemholtzEnergy()=0
Set Hemholtz energy.
MoFEMErrorCode snesCreate()
Create nested snes.
common data used by volume elements
MoFEMErrorCode getDefaultMaterialParameters()
auto getFTensor1StressAtGaussPts(int gg=0)
auto getFTensor1PlasticStrainAtGaussPts(int gg=0)
boost::shared_ptr< MatrixDouble > getStressMatrixPtr()
boost::shared_ptr< MatrixDouble > getPlasticStrainMatrixPtr()
Calculate tensorial base functions. Apply bBar method when needed.
static FTensor::Tensor2_symmetric< FTensor::CursorPtr< double *, 6 >, 3 > getFTensor2SymmetricDiffBase(DataForcesAndSourcesCore::EntData &data, MatrixDouble &storage, const bool b_bar, const int nb_integration_pts, double *w_ptr, FTensor::Number< 2 >)
MatrixDouble baseRowStorage
Store tensorial base functions.
MatrixDouble baseColStorage
Store tensorial base functions.
Assemble left hand side.
MatrixDouble baseStorage
Store tensorial base functions.
Assemble right hand side.
Update internal fluxes (update history variables)
virtual MoFEMErrorCode postProcess(TS ts)=0
Deprecated interface functions.
FormsIntegrators< DomainEleOp >::Assembly< A >::OpBase AssemblyDomainEleOp