v0.15.4
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)
 Class dedicated to integrate operator.
 
- Public Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
 OpBaseImpl (const std::string row_field_name, const std::string col_field_name, const OpType type, boost::shared_ptr< Range > ents_ptr=nullptr)
 Constructor for base operator implementation.
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 Do calculations for the left hand side.
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntData &row_data)
 Do calculations for the right hand side.
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from MoFEM::OpBaseImpl< A, EleOp >
using OpType = typename EleOp::OpType
 
using EntData = EntitiesFieldData::EntData
 
using MatSetValuesHook = boost::function< MoFEMErrorCode(ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)>
 
- Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
TimeFun timeScalingFun
 assumes that time variable is set
 
FEFun feScalingFun
 set by fe entity handle
 
boost::shared_ptr< RangeentsPtr
 Entities on which element is run.
 
- Static Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
static MatSetValuesHook matSetValuesHook
 
- Protected Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
template<int DIM>
FTensor::Tensor1< FTensor::PackPtr< double *, DIM >, DIM > getNf ()
 Get local vector tensor for assembly.
 
template<int DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, DIM >, DIM, DIM > getLocMat (const int rr)
 Get local matrix tensor for assembly.
 
virtual MoFEMErrorCode iNtegrate (EntData &row_data, EntData &col_data)
 Integrate grad-grad operator.
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data, const bool trans)
 Assemble local matrix into global matrix.
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 Assemble local vector into global vector.
 
virtual size_t getNbOfBaseFunctions (EntitiesFieldData::EntData &data)
 Get number of base functions.
 
- Protected Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
int nbRows
 number of dofs on rows
 
int nbCols
 number if dof on column
 
int nbIntegrationPts
 number of integration points
 
int nbRowBaseFunctions
 number or row base functions
 
int rowSide
 row side number
 
int colSide
 column side number
 
EntityType rowType
 row type
 
EntityType colType
 column type
 
bool assembleTranspose
 
bool onlyTranspose
 
MatrixDouble locMat
 local entity block matrix
 
MatrixDouble locMatTranspose
 local entity block matrix
 
VectorDouble locF
 local entity vector
 

Detailed Description

Definition at line 476 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 491 of file EshelbianContact.cpp.

496 : ContactOps::AssemblyBoundaryEleOp(row_field_name, row_field_name,
497 ContactOps::BoundaryEleOp::OPROW),
498 commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
499 sdfMapRangePtr(sdf_map_range_ptr) {
500 CHK_THROW_MESSAGE(PetscOptionsGetScalar(PETSC_NULLPTR, "", "-cn",
502 PETSC_NULLPTR),
503 "get cn failed");
506 PetscOptionsGetScalar(PETSC_NULLPTR, "", "-alpha_contact_const",
507 &ContactOps::alpha_contact_const, PETSC_NULLPTR),
508 "get alpha contact failed");
510 PETSC_NULLPTR, "", "-alpha_contact_quadratic",
512 "get alpha contact failed");
514 PetscOptionsGetScalar(PETSC_NULLPTR, "", "-airplane_ray_distance",
515 &ContactOps::airplane_ray_distance, PETSC_NULLPTR),
516 "get alpha contact failed");
517
518 MOFEM_LOG("EP", Sev::inform) << "cn " << ContactOps::cn_contact;
519 MOFEM_LOG("EP", Sev::inform)
520 << "alpha_contact_const " << ContactOps::alpha_contact_const;
521 MOFEM_LOG("EP", Sev::inform)
522 << "alpha_contact_quadratic " << ContactOps::alpha_contact_quadratic;
523 MOFEM_LOG("EP", Sev::inform)
524 << "airplane_ray_distance " << ContactOps::airplane_ray_distance;
525}
#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 data)
virtual

Class dedicated to integrate operator.

Parameters
dataentity data on element row
Returns
error code

Reimplemented from MoFEM::OpBaseImpl< A, EleOp >.

Definition at line 528 of file EshelbianContact.cpp.

528 {
530
531 FTensor::Index<'i', 3> i;
532 FTensor::Index<'j', 3> j;
533 FTensor::Index<'k', 3> k;
534 FTensor::Index<'l', 3> l;
535
536 const size_t nb_gauss_pts = getGaussPts().size2();
537
538#ifndef NDEBUG
539 if (commonDataPtr->contactDisp.size2() != nb_gauss_pts) {
540 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
541 "Wrong number of integration pts %ld != %ld",
542 commonDataPtr->contactDisp.size2(), nb_gauss_pts);
543 }
544#endif // !NDEBUG
545
546 auto &nf = locF;
547 locF.clear();
548
549 auto t_w = getFTensor0IntegrationWeight();
550 auto t_coords = getFTensor1CoordsAtGaussPts();
551 auto t_disp = getFTensor1FromMat<3>(commonDataPtr->contactDisp);
552 auto t_traction = getFTensor1FromMat<3>(commonDataPtr->contactTraction);
553
554 // placeholder to pass boundary block id to python. default SDF is set on
555 // block = -1, one can choose different block by making block "CONTACT_SDF",
556 // then specific SDF can be set to that block.
557 auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
558 getSdf(this, commonDataPtr->contactDisp,
559 checkSdf(getFEEntityHandle(), *sdfMapRangePtr), false);
560
561 auto t_sdf_v = getFTensor0FromVec(v_sdf);
562 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
563 auto t_normalize_normal = getFTensor1FromMat<3>(m_normals_at_pts);
564
565 auto next = [&]() {
566 ++t_w;
567 ++t_coords;
568 ++t_disp;
569 ++t_traction;
570 ++t_normalize_normal;
571 ++t_sdf_v;
572 ++t_grad_sdf_v;
573 };
574
575 auto face_data_vec_ptr =
576 contactTreePtr->findFaceDataVecPtr(getFEEntityHandle());
577 auto face_gauss_pts_it = face_data_vec_ptr->begin();
578
579 auto nb_base_functions = data.getN().size2();
580 auto t_base = data.getFTensor0N();
581 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
582
584 auto face_data_ptr = contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
585 face_data_vec_ptr);
586
587 auto check_face_contact = [&]() {
588 if (checkSdf(getFEEntityHandle(), *sdfMapRangePtr) != -1)
589 return false;
590
591 if (face_data_ptr) {
592 return true;
593 }
594 return false;
595 };
596
597#ifdef ENABLE_PYTHON_BINDING
598 double c = 0.;
599 if (ContactOps::sdfPythonWeakPtr.lock()) {
600 auto tn = t_traction(i) * t_grad_sdf_v(i);
601 c = ContactOps::constrain(t_sdf_v, tn);
602 }
603#else
604 constexpr double c = 0;
605#endif
606
607 if (!c && check_face_contact()) {
608 FTensor::Tensor1<double, 3> t_spatial_coords;
609 t_spatial_coords(i) = t_coords(i) + t_disp(i);
610 auto t_rhs_tmp = multiPointRhs(face_data_ptr, t_coords, t_spatial_coords,
611 t_traction, MultiPointRhsType::U, true);
612 t_rhs(i) = t_rhs_tmp(i);
613
614 } else {
615
616#ifdef ENABLE_PYTHON_BINDING
617 auto inv_cn = 1. / ContactOps::cn_contact;
618
619 if (ContactOps::sdfPythonWeakPtr.lock()) {
621 t_cP(i, j) = (c * t_grad_sdf_v(i)) * t_grad_sdf_v(j);
622 t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
623 t_rhs(i) = t_cQ(i, j) * t_traction(j) +
624 (c * inv_cn * t_sdf_v) * t_grad_sdf_v(i);
625 } else {
626 t_rhs(i) = t_traction(i);
627 }
628#else
629 t_rhs(i) = t_traction(i);
630#endif
631 }
632
633 auto t_nf = getFTensor1FromPtr<3>(&nf[0]);
634 const double alpha = t_w * getMeasure();
635
636 size_t bb = 0;
637 for (; bb != nbRows / 3; ++bb) {
638 const double beta = alpha * t_base;
639 t_nf(i) -= beta * t_rhs(i);
640 ++t_nf;
641 ++t_base;
642 }
643 for (; bb < nb_base_functions; ++bb)
644 ++t_base;
645
646 next();
647 }
648
650}
#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.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
VectorDouble locF
local entity vector
int nbRows
number of dofs on rows

Member Data Documentation

◆ commonDataPtr

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

Definition at line 486 of file EshelbianContact.cpp.

◆ contactTreePtr

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

Definition at line 487 of file EshelbianContact.cpp.

◆ sdfMapRangePtr

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

Definition at line 488 of file EshelbianContact.cpp.


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