381 {
383
386
387 int nb_gauss_pts = this->getGaussPts().size2();
388
389 int nb_internal_variables =
cpPtr->nbInternalVariables;
390 auto tet = this->getNumeredEntFiniteElementPtr()->getEnt();
392
394 nb_gauss_pts, 12 +
cpPtr->nbInternalVariables,
false);
396 12 +
cpPtr->nbInternalVariables,
false);
398
405
407 auto get_Cep =
410
411
412 int iter = 1;
414 CHKERR SNESGetLinearSolveIterations(this->getFEMethod()->snes, &iter);
415 }
416
417 double ave_tr_strain = 0;
419 auto t_grad =
420 getFTensor2SymmetricFromMat<DIM>(
commonDataPtr->gradAtGaussPts);
421 auto t_Cep = get_Cep();
422
423 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
424
425 auto tmp_active =
427 12 +
cpPtr->nbInternalVariables);
428 cpPtr->activeVariablesW.swap(tmp_active);
430 12 +
cpPtr->nbInternalVariables);
431 this->
cpPtr->gradientW.swap(tmp_gradient);
432
433 auto t_voigt_strain =
435 getFTensor1FromPtr<6>(&(
cpPtr->activeVariablesW[6])));
436 ++t_grad;
437
438
439 auto copy_plastic_strain_and_internal_variables = [&]() {
441
442
447 nb_internal_variables,
448 ublas::shallow_array_adaptor<double>(
449 nb_internal_variables,
451 ->internalVariablesPtr[gg * nb_internal_variables]));
452
453
454 cpPtr->plasticStrain0.resize(6,
false);
455 noalias(
cpPtr->plasticStrain0) = plastic_strain_tags;
456 cpPtr->internalVariables0.resize(nb_internal_variables,
false);
457 noalias(
cpPtr->internalVariables0) = internal_variables_tags;
458
459 auto cp_plastic_strain =
cpPtr->getPlasticStrain();
460 auto cp_internal_variables =
cpPtr->getInternalVariables();
461 noalias(cp_plastic_strain) = plastic_strain_tags;
462 noalias(cp_internal_variables) = internal_variables_tags;
464 };
465
466 CHKERR copy_plastic_strain_and_internal_variables();
467
468 auto closest_point_projection = [&](auto &recalculate_elastic_tangent) {
472 CHKERR cpPtr->setParams(
t, recalculate_elastic_tangent);
473 }
477 cpPtr->deltaGamma = 0;
478 if (iter > 0 && y > std::numeric_limits<double>::epsilon()) {
480 }
483 };
484
485 auto evaluate_consistent_tangent_matrix =
486 [&](auto &recalculate_elastic_tangent) {
488 if (recalculate_elastic_tangent)
490
491 if (iter > 0 &&
492 cpPtr->deltaGamma > std::numeric_limits<double>::epsilon()) {
493
495
497
498
499 auto t_voight_cep =
501 &
m(0, 0), &
m(0, 1), &
m(0, 2), &
m(0, 3), &
m(0, 4),
503
504 &
m(1, 0), &
m(1, 1), &
m(1, 2), &
m(1, 3), &
m(1, 4),
506
507 &
m(2, 0), &
m(2, 1), &
m(2, 2), &
m(2, 3), &
m(2, 4),
509
510 &
m(3, 0), &
m(3, 1), &
m(3, 2), &
m(3, 3), &
m(3, 4),
512
513 &
m(4, 0), &
m(4, 1), &
m(4, 2), &
m(4, 3), &
m(4, 4),
515
516 &
m(5, 0), &
m(5, 1), &
m(5, 2), &
m(5, 3), &
m(5, 4), &
m(5, 5)
517
518 );
519
524
526 t_voight_stress_op(
i,
j, Z) *
527 (t_voight_cep(Z, Y) * t_voight_stress_op(
k,
l, Y));
528
529 } else {
530
532 auto t_voight_cep =
534 &
m(0, 0), &
m(0, 1), &
m(0, 2), &
m(0, 3), &
m(0, 4),
536
537 &
m(1, 1), &
m(1, 2), &
m(1, 3), &
m(1, 4), &
m(1, 5),
538
539 &
m(2, 2), &
m(2, 3), &
m(2, 4), &
m(2, 5),
540
541 &
m(3, 3), &
m(3, 4), &
m(3, 5),
542
544
546
551
553 t_voight_stress_op(
i,
j, Z) *
554 (t_voight_cep(Z, Y) * t_voight_stress_op(
k,
l, Y));
555 }
556
557 ++t_Cep;
559 };
560
561
562 bool recalculate_elastic_tangent =
563 (this->getNinTheLoop() == 0) ? true : false;
564 CHKERR closest_point_projection(recalculate_elastic_tangent);
565
566 CHKERR evaluate_consistent_tangent_matrix(recalculate_elastic_tangent);
567 }
568
569 auto calcs_stress_matrix = [&]() {
572
573 auto get_stress =
576 auto t_stess = get_stress();
577 auto t_voight_stress =
commonDataPtr->getFTensor1StressAtGaussPts();
578 for (
auto gg = 0; gg !=
commonDataPtr->gradientW.size1(); ++gg) {
583
584 t_stess(
i,
j) = t_voight_stress_op(
i,
j, Z) * t_voight_stress(Z);
585 ++t_voight_stress;
586 ++t_stess;
587 }
589 };
590
591 auto calcs_plastic_strain_matrix = [&]() {
596 auto t_plastic_strain =
597 getFTensor2SymmetricFromMat<3>(
commonDataPtr->plasticStrainMatrix);
598 auto t_voight_plastic_strain =
600 for (
auto gg = 0; gg !=
commonDataPtr->activeVariablesW.size1(); ++gg) {
601 t_plastic_strain(
i,
j) =
602 t_voight_strain_op(
i,
j, Z) * t_voight_plastic_strain(Z);
603 ++t_voight_plastic_strain;
604 ++t_plastic_strain;
605 }
607 };
608
609 CHKERR calcs_stress_matrix();
610 CHKERR calcs_plastic_strain_matrix();
612 };
613
615
617}
Vec t
Removal: the ring edge.
#define FTENSOR_INDEX(DIM, I)
#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.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
FTensor::Dg< double, 3, 6 > voight_to_stress_op()
Op convert Vight stress vector to stress tensor.
FTensor::Tensor1< T2, DIM3 > calcStrain(bool b_bar, double ave_tr_strain, FTensor::Tensor2< T1, DIM1, DIM2 > &t_grad, FTensor::Tensor1< T2, DIM3 > &&t_voight_strain)
VectorShallowArrayAdaptor< double > VectorAdaptor
auto getVectorAdaptor(T1 ptr, const size_t n)
Get Vector adaptor.
decltype(GetFTensor2SymmetricFromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor2SymmetricFromMatType
decltype(GetFTensor4DdgFromMatImpl< Tensor_Dim01, Tensor_Dim23, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor4DdgFromMatType
FTensor::Index< 'm', 3 > m
boost::shared_ptr< CommonData > commonDataPtr
MoFEMErrorCode setTagsData(const EntityHandle tet, const int nb_gauss_pts, const int nb_internal_variables)
boost::shared_ptr< ClosestPointProjection > cpPtr
@ CTX_SNESNONE
No specific SNES context.