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

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

Inheritance diagram for EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU:
[legend]
Collaboration diagram for EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU:
[legend]

Public Member Functions

 OpConstrainBoundaryL2Lhs_dU (const std::string row_field_name, const std::string col_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, EntitiesFieldData::EntData &col_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 155 of file EshelbianContact.hpp.

Constructor & Destructor Documentation

◆ OpConstrainBoundaryL2Lhs_dU()

EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::OpConstrainBoundaryL2Lhs_dU ( const std::string  row_field_name,
const std::string  col_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 531 of file EshelbianContact.cpp.

536  : ContactOps::AssemblyBoundaryEleOp(row_field_name, col_field_name,
537  ContactOps::BoundaryEleOp::OPROWCOL),
538  commonDataPtr(common_data_ptr), contactTreePtr(contact_tree_ptr),
539  sdfMapRangePtr(sdf_map_range_ptr) {
540 
541  sYmm = false;
542 }

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::iNtegrate ( EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)

Definition at line 545 of file EshelbianContact.cpp.

546  {
548 
549  using namespace ContactOps;
550 
554 
555  auto nb_rows = row_data.getIndices().size();
556  auto nb_cols = col_data.getIndices().size();
557 
558  auto &locMat = AssemblyBoundaryEleOp::locMat;
559  locMat.resize(nb_rows, nb_cols, false);
560  locMat.clear();
561 
562  if (nb_cols && nb_rows) {
563 
564  auto nb_gauss_pts = getGaussPts().size2();
565  auto t_w = getFTensor0IntegrationWeight();
566  auto t_coords = getFTensor1CoordsAtGaussPts();
567  auto t_disp = getFTensor1FromMat<3>(commonDataPtr->contactDisp);
568  auto t_traction = getFTensor1FromMat<3>(commonDataPtr->contactTraction);
569 
570  // placeholder to pass boundary block id to python
571  auto [block_id, m_normals_at_pts, v_sdf, m_grad_sdf, m_hess_sdf] =
572  getSdf(this, commonDataPtr->contactDisp,
573  checkSdf(getFEEntityHandle(), *sdfMapRangePtr), true);
574 
575  auto t_sdf_v = getFTensor0FromVec(v_sdf);
576  auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
577  auto t_hess_sdf_v = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
578  auto t_normalized_normal = getFTensor1FromMat<3>(m_normals_at_pts);
579 
580  auto next = [&]() {
581  ++t_w;
582  ++t_coords;
583  ++t_disp;
584  ++t_traction;
585  ++t_sdf_v;
586  ++t_grad_sdf_v;
587  ++t_hess_sdf_v;
588  ++t_normalized_normal;
589  };
590 
591  auto face_data_vec_ptr =
592  contactTreePtr->findFaceDataVecPtr(getFEEntityHandle());
593  auto face_gauss_pts_it = face_data_vec_ptr->begin();
594 
595  auto t_row_base = row_data.getFTensor0N();
596  auto nb_face_functions = row_data.getN().size2() / 3;
597  constexpr auto t_kd = FTensor::Kronecker_Delta<int>();
598 
599  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
600 
601  auto face_data_ptr = contactTreePtr->getFaceDataPtr(face_gauss_pts_it, gg,
602  face_data_vec_ptr);
603 
604  auto check_face_contact = [&]() {
605  if (face_data_ptr) {
606  return true;
607  }
608  return false;
609  };
610 
612 
613 #ifdef PYTHON_SDF
614  auto tn = t_traction(i) * t_grad_sdf_v(i);
615  auto c = ContactOps::constrain(t_sdf_v, tn);
616 #else
617  constexpr double c = 0;
618 #endif
619 
620  if (!c && check_face_contact()) {
621  FTensor::Tensor1<double, 3> t_spatial_coords;
622  t_spatial_coords(i) = t_coords(i) + t_disp(i);
623  constexpr double eps = std::numeric_limits<float>::epsilon();
624  for (auto ii = 0; ii < 3; ++ii) {
625  FTensor::Tensor1<std::complex<double>, 3> t_spatial_coords_cx{
626  t_spatial_coords(0), t_spatial_coords(1), t_spatial_coords(2)};
627  t_spatial_coords_cx(ii) += eps * 1i;
628  auto t_rhs_tmp =
629  multiPointRhs(face_data_ptr, t_coords, t_spatial_coords_cx,
630  t_traction, MultiPointRhsType::U);
631  for (int jj = 0; jj != 3; ++jj) {
632  auto v = t_rhs_tmp(jj).imag();
633  t_res_dU(jj, ii) = v / eps;
634  }
635  }
636 
637  } else {
638 
639 #ifdef PYTHON_SDF
640 
641  auto inv_cn = ContactOps::alpha_contact_const;
642 
643  t_res_dU(i, j) =
644 
645  (-c) * (t_hess_sdf_v(i, j) * t_grad_sdf_v(k) * t_traction(k) +
646  t_grad_sdf_v(i) * t_hess_sdf_v(k, j) * t_traction(k))
647 
648  + (c * inv_cn) * (t_sdf_v * t_hess_sdf_v(i, j) +
649 
650  t_grad_sdf_v(j) * t_grad_sdf_v(i));
651 
652 #else
653  t_res_dU(i, j) = 0;
654 #endif
655  }
656 
657  auto alpha = t_w * getMeasure();
658 
659  size_t rr = 0;
660  for (; rr != nb_rows / 3; ++rr) {
661 
662  auto t_mat = getFTensor2FromArray<3, 3, 3>(locMat, 3 * rr);
663  auto t_col_base = col_data.getFTensor0N(gg, 0);
664 
665  for (size_t cc = 0; cc != nb_cols / 3; ++cc) {
666  auto beta = alpha * t_row_base * t_col_base;
667  t_mat(i, j) += beta * t_res_dU(i, j);
668  ++t_col_base;
669  ++t_mat;
670  }
671 
672  ++t_row_base;
673  }
674  for (; rr < nb_face_functions; ++rr)
675  ++t_row_base;
676 
677  next();
678  }
679  }
680 
682 }

Member Data Documentation

◆ commonDataPtr

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

Definition at line 167 of file EshelbianContact.hpp.

◆ contactTreePtr

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

Definition at line 168 of file EshelbianContact.hpp.

◆ sdfMapRangePtr

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

Definition at line 169 of file EshelbianContact.hpp.


The documentation for this struct was generated from the following files:
FTensor::Tensor1< double, 3 >
ContactOps
Definition: contact.cpp:99
ContactOps::constrain
double constrain(double sdf, double tn)
constrain function
Definition: ContactOps.hpp:603
FTensor::Kronecker_Delta
Kronecker Delta class.
Definition: Kronecker_Delta.hpp:15
EshelbianPlasticity::checkSdf
auto checkSdf(EntityHandle fe_ent, std::map< int, Range > &sdf_map_range)
Definition: EshelbianContact.cpp:17
FTensor::Tensor2< double, 3, 3 >
EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::sdfMapRangePtr
boost::shared_ptr< std::map< int, Range > > sdfMapRangePtr
Definition: EshelbianContact.hpp:169
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
EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::commonDataPtr
boost::shared_ptr< ContactOps::CommonData > commonDataPtr
Definition: EshelbianContact.hpp:167
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
t_kd
constexpr auto t_kd
Definition: free_surface.cpp:137
ContactOps::alpha_contact_const
double alpha_contact_const
Definition: EshelbianContact.hpp:21
FTensor::Index< 'i', 3 >
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
EshelbianPlasticity::OpConstrainBoundaryL2Lhs_dU::contactTreePtr
boost::shared_ptr< ContactTree > contactTreePtr
Definition: EshelbianContact.hpp:168
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
eps
static const double eps
Definition: check_base_functions_derivatives_on_tet.cpp:11
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
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
EshelbianPlasticity::getSdf
auto getSdf(OP_PTR op_ptr, MatrixDouble &contact_disp, int block_id, bool eval_hessian)
Definition: EshelbianContact.cpp:26