v0.14.0
Public Member Functions | Private Attributes | List of all members
EshelbianPlasticity::OpConstrainBoundaryL2Rhs Struct Reference

#include <users_modules/eshelbian_plasticit/src/EshelbianContact.hpp>

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

Examples
EshelbianPlasticity.cpp.

Definition at line 118 of file EshelbianContact.hpp.

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 305 of file EshelbianContact.cpp.

310  : ContactOps::AssemblyBoundaryEleOp(row_field_name, row_field_name,
311  ContactOps::BoundaryEleOp::OPROW),
312  commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
313  sdfMapRangePtr(sdf_map_range_ptr) {
314  CHK_THROW_MESSAGE(PetscOptionsGetScalar(PETSC_NULL, "", "-cn",
315  &ContactOps::cn_contact, PETSC_NULL),
316  "get cn failed");
319  PetscOptionsGetScalar(PETSC_NULL, "", "-alpha_contact_const",
320  &ContactOps::alpha_contact_const, PETSC_NULL),
321  "get alpha contact failed");
323  PetscOptionsGetScalar(PETSC_NULL, "", "-alpha_contact_quadratic",
325  "get alpha contact failed");
327  PetscOptionsGetScalar(PETSC_NULL, "", "-airplane_ray_distance",
328  &ContactOps::airplane_ray_distance, PETSC_NULL),
329  "get alpha contact failed");
330 
331 
332  MOFEM_LOG("EP", Sev::inform) << "cn " << ContactOps::cn_contact;
333  MOFEM_LOG("EP", Sev::inform)
334  << "alpha_contact_const " << ContactOps::alpha_contact_const;
335  MOFEM_LOG("EP", Sev::inform)
336  << "alpha_contact_quadratic " << ContactOps::alpha_contact_quadratic;
337  MOFEM_LOG("EP", Sev::inform)
338  << "airplane_ray_distance " << ContactOps::airplane_ray_distance;
339 }

Member Function Documentation

◆ iNtegrate()

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

Definition at line 342 of file EshelbianContact.cpp.

342  {
344 
349 
350  const size_t nb_gauss_pts = getGaussPts().size2();
351 
352 #ifndef NDEBUG
353  if (commonDataPtr->contactDisp.size2() != nb_gauss_pts) {
354  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
355  "Wrong number of integration pts %d != %d",
356  commonDataPtr->contactDisp.size2(), nb_gauss_pts);
357  }
358 #endif // !NDEBUG
359 
360  auto &nf = locF;
361  locF.clear();
362 
363  auto t_w = getFTensor0IntegrationWeight();
364  auto t_coords = getFTensor1CoordsAtGaussPts();
365  auto t_disp = getFTensor1FromMat<3>(commonDataPtr->contactDisp);
366  auto t_traction = getFTensor1FromMat<3>(commonDataPtr->contactTraction);
367 
368  // placeholder to pass boundary block id to python. default SDF is set on
369  // block = -1, one can choose different block by making block "CONTACT_SDF",
370  // then specific SDF can be set to that block.
371  auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
372  getSdf(this, commonDataPtr->contactDisp,
373  checkSdf(getFEEntityHandle(), *sdfMapRangePtr), false);
374 
375  auto t_sdf_v = getFTensor0FromVec(v_sdf);
376  auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
377  auto t_normalize_normal = getFTensor1FromMat<3>(m_normals_at_pts);
378 
379  auto next = [&]() {
380  ++t_w;
381  ++t_coords;
382  ++t_disp;
383  ++t_traction;
384  ++t_normalize_normal;
385  ++t_sdf_v;
386  ++t_grad_sdf_v;
387  };
388 
389  auto face_data_vec_ptr =
390  contactTreePtr->findFaceDataVecPtr(getFEEntityHandle());
391  auto face_gauss_pts_it = face_data_vec_ptr->begin();
392 
393  auto nb_base_functions = data.getN().size2();
394  auto t_base = data.getFTensor0N();
395  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
396 
398  auto face_data_ptr = contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
399  face_data_vec_ptr);
400 
401  auto check_face_contact = [&]() {
402  if (face_data_ptr) {
403  return true;
404  }
405  return false;
406  };
407 
408 #ifdef PYTHON_SDF
409  auto tn = t_traction(i) * t_grad_sdf_v(i);
410  auto c = ContactOps::constrain(t_sdf_v, tn);
411 #else
412  constexpr double c = 0;
413 #endif
414 
415  if (!c && check_face_contact()) {
416  FTensor::Tensor1<double, 3> t_spatial_coords;
417  t_spatial_coords(i) = t_coords(i) + t_disp(i);
418  auto t_rhs_tmp = multiPointRhs(face_data_ptr, t_coords, t_spatial_coords,
419  t_traction, MultiPointRhsType::U, true);
420  t_rhs(i) = t_rhs_tmp(i);
421 
422  } else {
423 
424 #ifdef PYTHON_SDF
425  auto inv_cn = ContactOps::alpha_contact_const;
426 
428  t_cP(i, j) = (c * t_grad_sdf_v(i)) * t_grad_sdf_v(j);
429  t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
430  t_rhs(i) =
431  t_cQ(i, j) * t_traction(j) + (c * inv_cn * t_sdf_v) * t_grad_sdf_v(i);
432 #else
433  t_rhs(i) = t_traction(i);
434 #endif
435  }
436 
437  auto t_nf = getFTensor1FromPtr<3>(&nf[0]);
438  const double alpha = t_w * getMeasure();
439 
440  size_t bb = 0;
441  for (; bb != nbRows / 3; ++bb) {
442  const double beta = alpha * t_base;
443  t_nf(i) += beta * t_rhs(i);
444  ++t_nf;
445  ++t_base;
446  }
447  for (; bb < nb_base_functions; ++bb)
448  ++t_base;
449 
450  next();
451  }
452 
454 }

Member Data Documentation

◆ commonDataPtr

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

Definition at line 128 of file EshelbianContact.hpp.

◆ contactTreePtr

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

Definition at line 129 of file EshelbianContact.hpp.

◆ sdfMapRangePtr

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

Definition at line 130 of file EshelbianContact.hpp.


The documentation for this struct was generated from the following files:
ContactOps::airplane_ray_distance
double airplane_ray_distance
Definition: EshelbianContact.hpp:25
FTensor::Tensor1< double, 3 >
ContactOps::constrain
double constrain(double sdf, double tn)
constrain function
Definition: ContactOps.hpp:603
EshelbianPlasticity::OpConstrainBoundaryL2Rhs::sdfMapRangePtr
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
Definition: EshelbianContact.hpp:130
CHK_THROW_MESSAGE
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:609
EshelbianPlasticity::checkSdf
auto checkSdf(EntityHandle fe_ent, std::map< int, Range > &sdf_map_range)
Definition: EshelbianContact.cpp:17
FTensor::Tensor2< double, 3, 3 >
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
ContactOps::AssemblyBoundaryEleOp
FormsIntegrators< BoundaryEleOp >::Assembly< A >::OpBase AssemblyBoundaryEleOp
Definition: EshelbianContact.hpp:18
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
ContactOps::alpha_contact_const
double alpha_contact_const
Definition: EshelbianContact.hpp:21
FTensor::Index< 'i', 3 >
ContactOps::cn_contact
double cn_contact
Definition: contact.cpp:100
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
FTensor::kronecker_delta
Tensor2_Expr< Kronecker_Delta< T >, T, Dim0, Dim1, i, j > kronecker_delta(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
Rank 2.
Definition: Kronecker_Delta.hpp:81
EshelbianPlasticity::multiPointRhs
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)
Definition: EshelbianContact.cpp:202
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
EshelbianPlasticity::OpConstrainBoundaryL2Rhs::contactTreePtr
boost::shared_ptr< ContactTree > contactTreePtr
Definition: EshelbianContact.hpp:129
MoFEM::PetscOptionsGetScalar
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:162
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
ContactOps::alpha_contact_quadratic
double alpha_contact_quadratic
Definition: EshelbianContact.hpp:22
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
EshelbianPlasticity::OpConstrainBoundaryL2Rhs::commonDataPtr
boost::shared_ptr< ContactOps::CommonData > commonDataPtr
Definition: EshelbianContact.hpp:128
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
EshelbianPlasticity::getSdf
auto getSdf(OP_PTR op_ptr, MatrixDouble &contact_disp, int block_id, bool eval_hessian)
Definition: EshelbianContact.cpp:26