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

#include "tutorials/adv-1_contact/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)
 
 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 492 of file ContactOps.hpp.

Constructor & Destructor Documentation

◆ OpAssembleTotalContactAreaImpl() [1/2]

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 684 of file ContactOps.hpp.

688 : BoundaryEleOp(NOSPACE, BoundaryEleOp::OPSPACE),
690 contactRange(contact_range_ptr) {}
@ NOSPACE
Definition definitions.h:83
BoundaryEle::UserDataOperator BoundaryEleOp
PetscBool is_axisymmetric
Definition contact.cpp:91

◆ OpAssembleTotalContactAreaImpl() [2/2]

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 
)

Member Function Documentation

◆ doWork() [1/2]

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

Definition at line 694 of file ContactOps.hpp.

695 {
697
698 auto fe_type = BoundaryEleOp::getFEType();
699
700 const auto fe_ent = BoundaryEleOp::getFEEntityHandle();
701
702 if (contactRange->find(fe_ent) != contactRange->end()) {
703 FTensor::Index<'i', DIM> i;
704 FTensor::Index<'j', DIM> j;
705 FTensor::Tensor1<double, 2> t_sum_a{0., 0.};
706
707 auto t_w = BoundaryEleOp::getFTensor0IntegrationWeight();
708 auto t_traction = getFTensor1FromMat<DIM>(commonDataPtr->contactTraction);
709 auto t_coords = BoundaryEleOp::getFTensor1CoordsAtGaussPts();
710
711 auto t_grad = getFTensor2FromMat<DIM, DIM>(commonDataPtr->contactDispGrad);
712 auto t_normal_at_pts = BoundaryEleOp::getFTensor1NormalsAtGaussPts();
713
714 const auto nb_gauss_pts = BoundaryEleOp::getGaussPts().size2();
715 auto m_spatial_coords = get_spatial_coords(
716 BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
717 getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
718 auto m_normals_at_pts = get_normalize_normals(
719 BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
720
721 auto t_normal = getFTensor1FromMat<3>(m_normals_at_pts);
722 auto ts_time = BoundaryEleOp::getTStime();
723 auto ts_time_step = BoundaryEleOp::getTStimeStep();
724 int block_id = 0;
725 auto v_sdf =
726 surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
727 m_spatial_coords, m_normals_at_pts, block_id);
728 auto m_grad_sdf = gradSurfaceDistanceFunction(
729 ts_time_step, ts_time, nb_gauss_pts, m_spatial_coords, m_normals_at_pts,
730 block_id);
731 auto t_sdf = getFTensor0FromVec(v_sdf);
732 auto t_grad_sdf = getFTensor1FromMat<3>(m_grad_sdf);
733 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
734 double jacobian = 1.;
735 if (isAxisymmetric) {
736 jacobian = 2. * M_PI * t_coords(0); // Axisymmetric Jacobian
737 }
738 auto tn = -t_traction(i) * t_grad_sdf(i);
739 auto c = constrain(t_sdf, tn);
740 double alpha = t_w * jacobian;
741
744 FTensor::Tensor1<double, DIM> t_normal_current;
745
746 F(i, j) = t_grad(i, j) + kronecker_delta(i, j);
747 auto det = determinantTensor(F);
748 CHKERR invertTensor(F, det, invF);
749 t_normal_current(i) = det * (invF(j, i) * t_normal_at_pts(j));
750
751 alpha *= sqrt(t_normal_current(i) * t_normal_current(i));
752
753 if (fe_type == MBTRI) {
754 alpha /= 2;
755 }
756 if (c > 1e-12) {
757 t_sum_a(0) += alpha; // real area
758 }
759 t_sum_a(1) += alpha; // Potential area
760 ++t_w;
761 ++t_traction;
762 ++t_coords;
763 ++t_sdf;
764 ++t_grad_sdf;
765
766 ++t_grad;
767 ++t_normal_at_pts;
768 }
769 constexpr int ind[] = {3, 4};
770 CHKERR VecSetValues(commonDataPtr->totalTraction, 2, ind, &t_sum_a(0),
771 ADD_VALUES);
772 }
774}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
@ F
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
FTensor::Index< 'j', 3 > j
auto get_normalize_normals(FTensor::Tensor1< T1, DIM1 > &&t_normal_at_pts, size_t nb_gauss_pts)
auto get_spatial_coords(FTensor::Tensor1< T1, DIM1 > &&t_coords, FTensor::Tensor1< T2, DIM2 > &&t_disp, size_t nb_gauss_pts)
double constrain(double sdf, double tn)
constrain function
Tensor2_Expr< Kronecker_Delta< T >, T, Dim0, Dim1, i, j > kronecker_delta(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
Rank 2.
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.

◆ doWork() [2/2]

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

Member Data Documentation

◆ commonDataPtr

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

Definition at line 505 of file ContactOps.hpp.

◆ contactRange

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

Definition at line 507 of file ContactOps.hpp.

◆ gradSurfaceDistanceFunction

template<int DIM, typename BoundaryEleOp >
GradSurfaceDistanceFunction ContactOps::OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >::gradSurfaceDistanceFunction
Initial value:
=
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 at line 501 of file ContactOps.hpp.

◆ isAxisymmetric

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

Definition at line 506 of file ContactOps.hpp.

◆ surfaceDistanceFunction

Definition at line 500 of file ContactOps.hpp.


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