v0.15.5
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
EshelbianPlasticity::OpConstrainBoundaryL2Rhs Struct Reference
Inheritance diagram for EshelbianPlasticity::OpConstrainBoundaryL2Rhs:
[legend]
Collaboration diagram for EshelbianPlasticity::OpConstrainBoundaryL2Rhs:
[legend]

Public Member Functions

 OpConstrainBoundaryL2Rhs (const std::string row_field_name, boost::shared_ptr< ContactOps::CommonData > common_data_ptr, boost::shared_ptr< ContactTree > contact_tree_ptr, boost::shared_ptr< std::map< int, Range > > sdf_map_range_ptr=nullptr)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data)
 

Private Attributes

boost::shared_ptr< ContactOps::CommonDatacommonDataPtr
 
boost::shared_ptr< ContactTreecontactTreePtr
 
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
 

Detailed Description

Definition at line 474 of file EshelbianContact.cpp.

Constructor & Destructor Documentation

◆ OpConstrainBoundaryL2Rhs()

EshelbianPlasticity::OpConstrainBoundaryL2Rhs::OpConstrainBoundaryL2Rhs ( const std::string  row_field_name,
boost::shared_ptr< ContactOps::CommonData common_data_ptr,
boost::shared_ptr< ContactTree contact_tree_ptr,
boost::shared_ptr< std::map< int, Range > >  sdf_map_range_ptr = nullptr 
)

Definition at line 489 of file EshelbianContact.cpp.

494 : ContactOps::AssemblyBoundaryEleOp(row_field_name, row_field_name,
495 ContactOps::BoundaryEleOp::OPROW),
496 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
497 sdfMapRangePtr(sdf_map_range_ptr) {
498 CHK_THROW_MESSAGE(PetscOptionsGetScalar(PETSC_NULLPTR, "", "-cn",
500 PETSC_NULLPTR),
501 "get cn failed");
504 PetscOptionsGetScalar(PETSC_NULLPTR, "", "-alpha_contact_const",
505 &ContactOps::alpha_contact_const, PETSC_NULLPTR),
506 "get alpha contact failed");
508 PETSC_NULLPTR, "", "-alpha_contact_quadratic",
510 "get alpha contact failed");
512 PetscOptionsGetScalar(PETSC_NULLPTR, "", "-airplane_ray_distance",
513 &ContactOps::airplane_ray_distance, PETSC_NULLPTR),
514 "get alpha contact failed");
515
516 MOFEM_LOG("EP", Sev::inform) << "cn " << ContactOps::cn_contact;
517 MOFEM_LOG("EP", Sev::inform)
518 << "alpha_contact_const " << ContactOps::alpha_contact_const;
519 MOFEM_LOG("EP", Sev::inform)
520 << "alpha_contact_quadratic " << ContactOps::alpha_contact_quadratic;
521 MOFEM_LOG("EP", Sev::inform)
522 << "airplane_ray_distance " << ContactOps::airplane_ray_distance;
523}
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MOFEM_LOG(channel, severity)
Log.
double cn_contact
Definition contact.cpp:97
double alpha_contact_quadratic
FormsIntegrators< BoundaryEleOp >::Assembly< A >::OpBase AssemblyBoundaryEleOp
double alpha_contact_const
double airplane_ray_distance
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
boost::shared_ptr< ContactOps::CommonData > commonDataPtr
boost::shared_ptr< ContactTree > contactTreePtr

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode EshelbianPlasticity::OpConstrainBoundaryL2Rhs::iNtegrate ( EntitiesFieldData::EntData row_data)

Definition at line 526 of file EshelbianContact.cpp.

526 {
528
529 FTensor::Index<'i', 3> i;
530 FTensor::Index<'j', 3> j;
531 FTensor::Index<'k', 3> k;
532 FTensor::Index<'l', 3> l;
533
534 const size_t nb_gauss_pts = getGaussPts().size2();
535
536#ifndef NDEBUG
537 if (commonDataPtr->contactDisp.size2() != nb_gauss_pts) {
538 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
539 "Wrong number of integration pts %ld != %ld",
540 commonDataPtr->contactDisp.size2(), nb_gauss_pts);
541 }
542#endif // !NDEBUG
543
544 auto &nf = locF;
545 locF.clear();
546
547 auto t_w = getFTensor0IntegrationWeight();
548 auto t_coords = getFTensor1CoordsAtGaussPts();
549 auto t_disp = getFTensor1FromMat<3>(commonDataPtr->contactDisp);
550 auto t_traction = getFTensor1FromMat<3>(commonDataPtr->contactTraction);
551
552 // placeholder to pass boundary block id to python. default SDF is set on
553 // block = -1, one can choose different block by making block "CONTACT_SDF",
554 // then specific SDF can be set to that block.
555 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
556 getSdf(this, commonDataPtr->contactDisp,
557 checkSdf(getFEEntityHandle(), *sdfMapRangePtr), false);
558
559 auto t_sdf_v = getFTensor0FromVec(v_sdf);
560 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
561 auto t_normalize_normal = getFTensor1FromMat<3>(m_normals_at_pts);
562
563 auto next = [&]() {
564 ++t_w;
565 ++t_coords;
566 ++t_disp;
567 ++t_traction;
568 ++t_normalize_normal;
569 ++t_sdf_v;
570 ++t_grad_sdf_v;
571 };
572
573 auto face_data_vec_ptr =
574 contactTreePtr->findFaceDataVecPtr(getFEEntityHandle());
575 auto face_gauss_pts_it = face_data_vec_ptr->begin();
576
577 auto nb_base_functions = data.getN().size2();
578 auto t_base = data.getFTensor0N();
579 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
580
582 auto face_data_ptr = contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
583 face_data_vec_ptr);
584
585 auto check_face_contact = [&]() {
586 if (checkSdf(getFEEntityHandle(), *sdfMapRangePtr) != -1)
587 return false;
588
589 if (face_data_ptr) {
590 return true;
591 }
592 return false;
593 };
594
595#ifdef ENABLE_PYTHON_BINDING
596 double c = 0.;
597 if (ContactOps::sdfPythonWeakPtr.lock()) {
598 auto tn = t_traction(i) * t_grad_sdf_v(i);
599 c = ContactOps::constrain(t_sdf_v, tn);
600 }
601#else
602 constexpr double c = 0;
603#endif
604
605 if (!c && check_face_contact()) {
606 FTensor::Tensor1<double, 3> t_spatial_coords;
607 t_spatial_coords(i) = t_coords(i) + t_disp(i);
608 auto t_rhs_tmp = multiPointRhs(face_data_ptr, t_coords, t_spatial_coords,
609 t_traction, MultiPointRhsType::U, true);
610 t_rhs(i) = t_rhs_tmp(i);
611
612 } else {
613
614#ifdef ENABLE_PYTHON_BINDING
615 auto inv_cn = 1. / ContactOps::cn_contact;
616
617 if (ContactOps::sdfPythonWeakPtr.lock()) {
619 t_cP(i, j) = (c * t_grad_sdf_v(i)) * t_grad_sdf_v(j);
620 t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
621 t_rhs(i) = t_cQ(i, j) * t_traction(j) +
622 (c * inv_cn * t_sdf_v) * t_grad_sdf_v(i);
623 } else {
624 t_rhs(i) = t_traction(i);
625 }
626#else
627 t_rhs(i) = t_traction(i);
628#endif
629 }
630
631 auto t_nf = getFTensor1FromPtr<3>(&nf[0]);
632 const double alpha = t_w * getMeasure();
633
634 size_t bb = 0;
635 for (; bb != nbRows / 3; ++bb) {
636 const double beta = alpha * t_base;
637 t_nf(i) -= beta * t_rhs(i);
638 ++t_nf;
639 ++t_base;
640 }
641 for (; bb < nb_base_functions; ++bb)
642 ++t_base;
643
644 next();
645 }
646
648}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
double constrain(double sdf, double tn)
constrain function
auto checkSdf(EntityHandle fe_ent, std::map< int, Range > &sdf_map_range)
auto multiPointRhs(ContactTree::FaceData *face_data_ptr, FTensor::Tensor1< T1, 3 > &t_coords, FTensor::Tensor1< T2, 3 > &t_spatial_coords, FTensor::Tensor1< T3, 3 > &t_master_traction, MultiPointRhsType type, bool debug=false)
auto getSdf(OP_PTR op_ptr, MatrixDouble &contact_disp, int block_id, bool eval_hessian)
Tensor2_Expr< Kronecker_Delta< T >, T, Dim0, Dim1, i, j > kronecker_delta(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
Rank 2.
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.

Member Data Documentation

◆ commonDataPtr

boost::shared_ptr<ContactOps::CommonData> EshelbianPlasticity::OpConstrainBoundaryL2Rhs::commonDataPtr
private

Definition at line 484 of file EshelbianContact.cpp.

◆ contactTreePtr

boost::shared_ptr<ContactTree> EshelbianPlasticity::OpConstrainBoundaryL2Rhs::contactTreePtr
private

Definition at line 485 of file EshelbianContact.cpp.

◆ sdfMapRangePtr

boost::shared_ptr<std::map<int, Range> > EshelbianPlasticity::OpConstrainBoundaryL2Rhs::sdfMapRangePtr
private

Definition at line 486 of file EshelbianContact.cpp.


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