v0.14.0
Public Member Functions | Public Attributes | Private Attributes | List of all members
ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp > Struct Template Reference

#include <tutorials/adv-1/src/ContactOps.hpp>

Inheritance diagram for ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >:
[legend]
Collaboration diagram for ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >:
[legend]

Public Member Functions

 OpAssembleTotalContactAreaImpl (boost::shared_ptr< CommonData > common_data_ptr, bool is_axisymmetric=false, boost::shared_ptr< Range > contact_range_ptr=nullptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Public Attributes

SurfaceDistanceFunction surfaceDistanceFunction = surface_distance_function
 
GradSurfaceDistanceFunction gradSurfaceDistanceFunction
 

Private Attributes

boost::shared_ptr< CommonDatacommonDataPtr
 
bool isAxisymmetric
 
boost::shared_ptr< RangecontactRange
 

Detailed Description

template<int DIM, typename BoundaryEleOp>
struct ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >

Definition at line 460 of file ContactOps.hpp.

Constructor & Destructor Documentation

◆ OpAssembleTotalContactAreaImpl()

template<int DIM, typename BoundaryEleOp >
ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::OpAssembleTotalContactAreaImpl ( boost::shared_ptr< CommonData common_data_ptr,
bool  is_axisymmetric = false,
boost::shared_ptr< Range contact_range_ptr = nullptr 
)

Definition at line 653 of file ContactOps.hpp.

656  : BoundaryEleOp(NOSPACE, BoundaryEleOp::OPSPACE),
657  commonDataPtr(common_data_ptr), isAxisymmetric(is_axisymmetric),
658  contactRange(contact_range_ptr) {}

Member Function Documentation

◆ doWork()

template<int DIM, typename BoundaryEleOp >
MoFEMErrorCode ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::doWork ( int  side,
EntityType  type,
EntData data 
)
Examples
ContactOps.hpp.

Definition at line 662 of file ContactOps.hpp.

663  {
665 
666  auto fe_type = BoundaryEleOp::getFEType();
667 
668  const auto fe_ent = BoundaryEleOp::getFEEntityHandle();
669 
670  if (contactRange->find(fe_ent) != contactRange->end()) {
673  FTensor::Tensor1<double, 2> t_sum_a{0., 0.};
674 
675  auto t_w = BoundaryEleOp::getFTensor0IntegrationWeight();
676  auto t_traction = getFTensor1FromMat<DIM>(commonDataPtr->contactTraction);
677  auto t_coords = BoundaryEleOp::getFTensor1CoordsAtGaussPts();
678 
679  auto t_grad = getFTensor2FromMat<DIM, DIM>(commonDataPtr->contactDispGrad);
680  auto t_normal_at_pts = BoundaryEleOp::getFTensor1NormalsAtGaussPts();
681 
682  const auto nb_gauss_pts = BoundaryEleOp::getGaussPts().size2();
683  auto m_spatial_coords = get_spatial_coords(
684  BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
685  getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
686  auto m_normals_at_pts = get_normalize_normals(
687  BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
688 
689  auto t_normal = getFTensor1FromMat<3>(m_normals_at_pts);
690  auto ts_time = BoundaryEleOp::getTStime();
691  auto ts_time_step = BoundaryEleOp::getTStimeStep();
692  int block_id = 0;
693  auto v_sdf =
694  surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
695  m_spatial_coords, m_normals_at_pts, block_id);
696  auto m_grad_sdf = gradSurfaceDistanceFunction(
697  ts_time_step, ts_time, nb_gauss_pts, m_spatial_coords, m_normals_at_pts,
698  block_id);
699  auto t_sdf = getFTensor0FromVec(v_sdf);
700  auto t_grad_sdf = getFTensor1FromMat<3>(m_grad_sdf);
701  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
702  double jacobian = 1.;
703  if (isAxisymmetric) {
704  jacobian = 2. * M_PI * t_coords(0); // Axisymmetric Jacobian
705  }
706  auto tn = -t_traction(i) * t_grad_sdf(i);
707  auto c = constrain(t_sdf, tn);
708  double alpha = t_w * jacobian;
709 
712  FTensor::Tensor1<double, DIM> t_normal_current;
713 
714  F(i, j) = t_grad(i, j) + kronecker_delta(i, j);
715  auto det = determinantTensor(F);
716  CHKERR invertTensor(F, det, invF);
717  t_normal_current(i) = det * (invF(j, i) * t_normal_at_pts(j));
718 
719  alpha *= sqrt(t_normal_current(i) * t_normal_current(i));
720 
721  if (fe_type == MBTRI) {
722  alpha /= 2;
723  }
724  if (c > 1e-12) {
725  t_sum_a(0) += alpha; // real area
726  }
727  t_sum_a(1) += alpha; // Potential area
728  ++t_w;
729  ++t_traction;
730  ++t_coords;
731  ++t_sdf;
732  ++t_grad_sdf;
733 
734  ++t_grad;
735  ++t_normal_at_pts;
736  }
737  constexpr int ind[] = {3, 4};
738  CHKERR VecSetValues(commonDataPtr->totalTraction, 2, ind, &t_sum_a(0),
739  ADD_VALUES);
740  }
742 }

Member Data Documentation

◆ commonDataPtr

template<int DIM, typename BoundaryEleOp >
boost::shared_ptr<CommonData> ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::commonDataPtr
private

Definition at line 473 of file ContactOps.hpp.

◆ contactRange

template<int DIM, typename BoundaryEleOp >
boost::shared_ptr<Range> ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::contactRange
private

Definition at line 475 of file ContactOps.hpp.

◆ gradSurfaceDistanceFunction

template<int DIM, typename BoundaryEleOp >
GradSurfaceDistanceFunction ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::gradSurfaceDistanceFunction
Initial value:

Definition at line 469 of file ContactOps.hpp.

◆ isAxisymmetric

template<int DIM, typename BoundaryEleOp >
bool ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::isAxisymmetric
private

Definition at line 474 of file ContactOps.hpp.

◆ surfaceDistanceFunction

template<int DIM, typename BoundaryEleOp >
SurfaceDistanceFunction ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::surfaceDistanceFunction = surface_distance_function

Definition at line 468 of file ContactOps.hpp.


The documentation for this struct was generated from the following file:
ContactOps::get_spatial_coords
auto get_spatial_coords(FTensor::Tensor1< T1, DIM1 > &&t_coords, FTensor::Tensor1< T2, DIM2 > &&t_disp, size_t nb_gauss_pts)
Definition: ContactOps.hpp:414
NOSPACE
@ NOSPACE
Definition: definitions.h:83
ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::gradSurfaceDistanceFunction
GradSurfaceDistanceFunction gradSurfaceDistanceFunction
Definition: ContactOps.hpp:469
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
ContactOps::constrain
double constrain(double sdf, double tn)
constrain function
Definition: ContactOps.hpp:603
is_axisymmetric
PetscBool is_axisymmetric
Definition: contact.cpp:93
ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::isAxisymmetric
bool isAxisymmetric
Definition: ContactOps.hpp:474
ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::commonDataPtr
boost::shared_ptr< CommonData > commonDataPtr
Definition: ContactOps.hpp:473
MoFEM::VecSetValues
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
Definition: EntitiesFieldData.hpp:1589
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::contactRange
boost::shared_ptr< Range > contactRange
Definition: ContactOps.hpp:475
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
ContactOps::get_normalize_normals
auto get_normalize_normals(FTensor::Tensor1< T1, DIM1 > &&t_normal_at_pts, size_t nb_gauss_pts)
Definition: ContactOps.hpp:431
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
MoFEM::invertTensor
static MoFEMErrorCode invertTensor(FTensor::Tensor2< T1, DIM, DIM > &t, T2 &det, FTensor::Tensor2< T3, DIM, DIM > &inv_t)
Definition: Templates.hpp:1771
MoFEM::determinantTensor
static auto determinantTensor(FTensor::Tensor2< T, DIM, DIM > &t)
Calculate the determinant of a tensor of rank DIM.
Definition: Templates.hpp:1571
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', DIM >
ContactOps::BoundaryEleOp
BoundaryEle::UserDataOperator BoundaryEleOp
Definition: EshelbianContact.hpp:14
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
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::surfaceDistanceFunction
SurfaceDistanceFunction surfaceDistanceFunction
Definition: ContactOps.hpp:468
sdf_wavy_2d.ind
float ind
Definition: sdf_wavy_2d.py:7
ContactOps::grad_surface_distance_function
MatrixDouble grad_surface_distance_function(double delta_t, double t, int nb_gauss_pts, MatrixDouble &m_spatial_coords, MatrixDouble &m_normals_at_pts, int block_id)
Definition: ContactOps.hpp:281
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
F
@ F
Definition: free_surface.cpp:394