356 {
358
359 auto getLamesParam = [](
double E,
double nu) {
365 };
366
367 auto fe_ent = op_ptr->getNumeredEntFiniteElementPtr()->getEnt();
368 int nb_integration_pts = op_ptr->getGaussPts().size2();
369
370 dataAtGaussPts->muAtPts.resize(nb_integration_pts, false);
371 dataAtGaussPts->lambdaAtPts.resize(nb_integration_pts, false);
372 dataAtGaussPts->muAtPts.clear();
373 dataAtGaussPts->lambdaAtPts.clear();
374
375 dataAtGaussPts->youngModulusAtPts.resize(nb_integration_pts, false);
376 dataAtGaussPts->youngModulusAtPts.clear();
377
378 auto t_young_modulus =
379 getFTensor0FromVec(dataAtGaussPts->youngModulusAtPts);
380 auto t_mu = getFTensor0FromVec(dataAtGaussPts->muAtPts);
381 auto t_lambda = getFTensor0FromVec(dataAtGaussPts->lambdaAtPts);
382
383 MatrixSizeHelper<
384 GetFTensor4DdgFromMatType<SPACE_DIM, SPACE_DIM, STRIDEMATD, DL>,
385 DL>::size(dataAtGaussPts->matD, nb_integration_pts);
386 MatrixSizeHelper<
387 GetFTensor4DdgFromMatType<SPACE_DIM, SPACE_DIM, STRIDEMATD, DL>,
388 DL>::size(dataAtGaussPts->matAxiatorD, nb_integration_pts);
389 MatrixSizeHelper<
390 GetFTensor4DdgFromMatType<SPACE_DIM, SPACE_DIM, STRIDEMATD, DL>,
391 DL>::size(dataAtGaussPts->matDeviatorD, nb_integration_pts);
392 MatrixSizeHelper<
393 GetFTensor4DdgFromMatType<SPACE_DIM, SPACE_DIM, STRIDEMATD, DL>,
394 DL>::size(dataAtGaussPts->matInvD, nb_integration_pts);
395
396 dataAtGaussPts->matD.clear();
397 dataAtGaussPts->matAxiatorD.clear();
398 dataAtGaussPts->matDeviatorD.clear();
399 dataAtGaussPts->matInvD.clear();
400
406
407 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, STRIDEMATD>(
408 dataAtGaussPts->matD);
409 auto t_axiator_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, STRIDEMATD>(
410 dataAtGaussPts->matAxiatorD);
411 auto t_deviator_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, STRIDEMATD>(
412 dataAtGaussPts->matDeviatorD);
413 auto t_inv_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, STRIDEMATD>(
414 dataAtGaussPts->matInvD);
415
416 auto next = [&]() {
417 ++t_young_modulus;
418 ++t_mu;
419 ++t_lambda;
420 ++t_D;
421 ++t_axiator_D;
422 ++t_deviator_D;
423 ++t_inv_D;
424 };
425
430 t_deviator_D(
i,
j,
k,
l) =
432 t_D(
i,
j,
k,
l) = t_axiator_D(
i,
j,
k,
l) + t_deviator_D(
i,
j,
k,
l);
434 };
435
441 t_inv_D(
i,
j,
k,
l) =
444 };
445
446
447
449 if (b.blockEnts.find(op_ptr->getFEEntityHandle()) != b.blockEnts.end()) {
450
454
455 auto t_analytical_elastic = getFTensor0FromVec(analytical_elastic);
456
457 for (int gg = 0; gg != nb_integration_pts; ++gg) {
458 t_young_modulus = t_analytical_elastic;
460 t_analytical_elastic / (3 * (1 - 2 * b.poissonRatio));
462 t_analytical_elastic / (2 * (1 + b.poissonRatio));
465
468 ++t_analytical_elastic;
469 next();
470 }
471
473 Tag tag_heterogenous_mat;
474 CHKERR op_ptr->getPtrFE()->mField.get_moab().tag_get_handle(
476 tag_heterogenous_mat);
477 int tag_length;
478 CHKERR op_ptr->getPtrFE()->mField.get_moab().tag_get_length(
479 tag_heterogenous_mat, tag_length);
480 if (tag_length != 1) {
482 "heterogeneous Young's modulus tag should be 1 but is %d",
483 tag_length);
484 }
486
487 double elem_young_mod = 0.0;
488 CHKERR op_ptr->getPtrFE()->mField.get_moab().tag_get_data(
489 tag_heterogenous_mat, &fe_ent, 1, &elem_young_mod);
490
491 for (int gg = 0; gg != nb_integration_pts; ++gg) {
492 t_young_modulus = elem_young_mod;
493 auto [
mu,
lambda] = getLamesParam(elem_young_mod, b.poissonRatio);
497 elem_young_mod / (3 * (1 - 2 * b.poissonRatio));
499 elem_young_mod / (2 * (1 + b.poissonRatio));
500
503 next();
504 }
506
508 int vert_num;
509 CHKERR op_ptr->getPtrFE()->mField.get_moab().get_connectivity(
510 fe_ent, vert_conn, vert_num, true);
511
513 CHKERR op_ptr->getPtrFE()->mField.get_moab().tag_get_data(
514 tag_heterogenous_mat, vert_conn, vert_num, &vert_young_mod[0]);
515
516 auto t_shape_n = data.getFTensor0N();
517 int nb_shape_fn = data.getN(
NOBASE).size2();
518
519 for (int gg = 0; gg != nb_integration_pts; ++gg) {
520 t_young_modulus = 0;
521 auto t_vert_young_mod = getFTensor0FromVec(vert_young_mod);
522 for (int bb = 0; bb != nb_shape_fn; ++bb) {
523 t_young_modulus += t_vert_young_mod * t_shape_n;
524 ++t_vert_young_mod;
525 ++t_shape_n;
526 }
528 getLamesParam(t_young_modulus, b.poissonRatio);
532 t_young_modulus / (3 * (1 - 2 * b.poissonRatio));
534 t_young_modulus / (2 * (1 + b.poissonRatio));
535
538 next();
539 }
540 } else {
542 "Unsupported heterogeneous Young's modulus interpolation "
543 "order %d",
545 }
546 } else {
547
548 for (int gg = 0; gg != nb_integration_pts; ++gg) {
549 t_young_modulus = b.youngModulus;
550 t_mu = b.shearModulusG;
551 t_lambda = b.bulkModulusK - 2 * b.shearModulusG / 3;
552
553 CHKERR evalMatD(b.bulkModulusK, b.shearModulusG);
554 CHKERR evalInvMatDPtr(b.bulkModulusK, b.shearModulusG);
555 next();
556 }
557 }
559 }
560 }
561
562
563 const auto E = this->
E;
564 const auto nu = this->
nu;
565
568
569
572
573 for (int gg = 0; gg != nb_integration_pts; ++gg) {
579 next();
580 }
581
583 }
#define FTENSOR_INDEX(DIM, I)
Kronecker Delta class symmetric.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
#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
VectorDouble getAnalyticalElastic(OP_PTR op_ptr, const std::string block_name)
DataLayoutTraits< DataLayout::GaussByCoeffs > DL
UBlasVector< double > VectorDouble
analytical_elastic(delta_t, t, x, y, z, block_name)
static std::string heterogeneousYoungModTagName
static int meshTransferInterpOrder
std::vector< BlockData > blockData