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

298  : ContactOps::AssemblyBoundaryEleOp(row_field_name, row_field_name,
300  commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
301  sdfMapRangePtr(sdf_map_range_ptr) {
302  CHK_THROW_MESSAGE(PetscOptionsGetScalar(PETSC_NULL, "", "-cn",
303  &ContactOps::cn_contact, PETSC_NULL),
304  "get cn failed");
307  PetscOptionsGetScalar(PETSC_NULL, "", "-alpha_contact_const",
308  &ContactOps::alpha_contact_const, PETSC_NULL),
309  "get alpha contact failed");
311  PetscOptionsGetScalar(PETSC_NULL, "", "-alpha_contact_quadratic",
313  "get alpha contact failed");
314 
315  MOFEM_LOG("EP", Sev::inform) << "cn " << ContactOps::cn_contact;
316  MOFEM_LOG("EP", Sev::inform)
317  << "alpha_contact_const " << ContactOps::alpha_contact_const;
318  MOFEM_LOG("EP", Sev::inform)
319  << "alpha_contact_quadratic " << ContactOps::alpha_contact_quadratic;
320 }

Member Function Documentation

◆ iNtegrate()

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

Definition at line 323 of file EshelbianContact.cpp.

323  {
325 
330 
331  const size_t nb_gauss_pts = getGaussPts().size2();
332 
333 #ifndef NDEBUG
334  if (commonDataPtr->contactDisp.size2() != nb_gauss_pts) {
335  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
336  "Wrong number of integration pts %d != %d",
337  commonDataPtr->contactDisp.size2(), nb_gauss_pts);
338  }
339 #endif // !NDEBUG
340 
341  auto &nf = locF;
342  locF.clear();
343 
344  auto t_w = getFTensor0IntegrationWeight();
345  auto t_coords = getFTensor1CoordsAtGaussPts();
346  auto t_disp = getFTensor1FromMat<3>(commonDataPtr->contactDisp);
347  auto t_traction = getFTensor1FromMat<3>(commonDataPtr->contactTraction);
348 
349  // placeholder to pass boundary block id to python
350  auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
351  getSdf(this, commonDataPtr->contactDisp,
352  checkSdf(getFEEntityHandle(), *sdfMapRangePtr), false);
353 
354  auto t_sdf_v = getFTensor0FromVec(v_sdf);
355  auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
356  auto t_normalize_normal = getFTensor1FromMat<3>(m_normals_at_pts);
357 
358  auto next = [&]() {
359  ++t_w;
360  ++t_coords;
361  ++t_disp;
362  ++t_traction;
363  ++t_normalize_normal;
364  ++t_sdf_v;
365  ++t_grad_sdf_v;
366  };
367 
368  auto face_data_vec_ptr =
369  contactTreePtr->findFaceDataVecPtr(getFEEntityHandle());
370  auto face_gauss_pts_it = face_data_vec_ptr->begin();
371 
372  auto nb_base_functions = data.getN().size2();
373  auto t_base = data.getFTensor0N();
374  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
375 
377  auto face_data_ptr = contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
378  face_data_vec_ptr);
379 
380  auto check_face_contact = [&]() {
381  if (face_data_ptr) {
382  return true;
383  }
384  return false;
385  };
386 
387  auto tn = t_traction(i) * t_grad_sdf_v(i);
388  auto c = ContactOps::constrain(t_sdf_v, tn);
389  if (!c && check_face_contact()) {
390  FTensor::Tensor1<double, 3> t_spatial_coords;
391  t_spatial_coords(i) = t_coords(i) + t_disp(i);
392  auto t_rhs_tmp = multiPointRhs(face_data_ptr, t_coords, t_spatial_coords,
393  t_traction, MultiPointRhsType::U, true);
394  t_rhs(i) = t_rhs_tmp(i);
395 
396  } else {
397 
398  auto inv_cn = ContactOps::alpha_contact_const;
399 
401  t_cP(i, j) = (c * t_grad_sdf_v(i)) * t_grad_sdf_v(j);
402  t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
403  t_rhs(i) =
404  t_cQ(i, j) * t_traction(j) + (c * inv_cn * t_sdf_v) * t_grad_sdf_v(i);
405  }
406 
407  auto t_nf = getFTensor1FromPtr<3>(&nf[0]);
408  const double alpha = t_w * getMeasure();
409 
410  size_t bb = 0;
411  for (; bb != nbRows / 3; ++bb) {
412  const double beta = alpha * t_base;
413  t_nf(i) += beta * t_rhs(i);
414  ++t_nf;
415  ++t_base;
416  }
417  for (; bb < nb_base_functions; ++bb)
418  ++t_base;
419 
420  next();
421  }
422 
424 }

Member Data Documentation

◆ commonDataPtr

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

Definition at line 124 of file EshelbianContact.hpp.

◆ contactTreePtr

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

Definition at line 125 of file EshelbianContact.hpp.

◆ sdfMapRangePtr

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

Definition at line 126 of file EshelbianContact.hpp.


The documentation for this struct was generated from the following files:
FTensor::Tensor1< double, 3 >
ContactOps::constrain
double constrain(double sdf, double tn)
constrain function
Definition: ContactOps.hpp:572
EshelbianPlasticity::OpConstrainBoundaryL2Rhs::sdfMapRangePtr
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
Definition: EshelbianContact.hpp:126
CHK_THROW_MESSAGE
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:596
EshelbianPlasticity::checkSdf
auto checkSdf(EntityHandle fe_ent, std::map< int, Range > &sdf_map_range)
Definition: EshelbianContact.cpp:27
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:17
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:20
FTensor::Index< 'i', 3 >
ContactOps::cn_contact
double cn_contact
Definition: EshelbianContact.hpp:19
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:196
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:125
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:21
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
EshelbianPlasticity::OpConstrainBoundaryL2Rhs::commonDataPtr
boost::shared_ptr< ContactOps::CommonData > commonDataPtr
Definition: EshelbianContact.hpp:124
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:193
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
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:36
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROW
@ OPROW
operator doWork function is executed on FE rows
Definition: ForcesAndSourcesCore.hpp:567