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

#include "tutorials/adv-1_contact/src/ContactOps.hpp"

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

Public Member Functions

 OpEvaluateSDFImpl (boost::shared_ptr< CommonData > common_data_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 
 OpEvaluateSDFImpl (boost::shared_ptr< CommonData > common_data_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 

Private Attributes

boost::shared_ptr< CommonData > commonDataPtr
 
SurfaceDistanceFunction surfaceDistanceFunction = surface_distance_function
 
GradSurfaceDistanceFunction gradSurfaceDistanceFunction
 
HessSurfaceDistanceFunction hessSurfaceDistanceFunction
 

Detailed Description

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

Definition at line 510 of file ContactOps.hpp.

Constructor & Destructor Documentation

◆ OpEvaluateSDFImpl() [1/2]

template<int DIM, typename BoundaryEleOp >
ContactOps::OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >::OpEvaluateSDFImpl ( boost::shared_ptr< CommonData >  common_data_ptr)

Definition at line 776 of file ContactOps.hpp.

778 : BoundaryEleOp(NOSPACE, BoundaryEleOp::OPSPACE),
779 commonDataPtr(common_data_ptr) {}
@ NOSPACE
Definition definitions.h:83
BoundaryEle::UserDataOperator BoundaryEleOp

◆ OpEvaluateSDFImpl() [2/2]

template<int DIM, typename BoundaryEleOp >
ContactOps::OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >::OpEvaluateSDFImpl ( boost::shared_ptr< CommonData >  common_data_ptr)

Member Function Documentation

◆ doWork() [1/2]

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

Definition at line 783 of file ContactOps.hpp.

784 {
786
787 const auto nb_gauss_pts = BoundaryEleOp::getGaussPts().size2();
788 auto &sdf_vec = commonDataPtr->sdfVals;
789 auto &grad_mat = commonDataPtr->gradsSdf;
790 auto &hess_mat = commonDataPtr->hessSdf;
791 auto &constraint_vec = commonDataPtr->constraintVals;
792 auto &contactTraction_mat = commonDataPtr->contactTraction;
793
794 sdf_vec.resize(nb_gauss_pts, false);
795 grad_mat.resize(nb_gauss_pts, DIM, false);
796 hess_mat.resize(nb_gauss_pts, (DIM * (DIM + 1)) / 2, false);
797 constraint_vec.resize(nb_gauss_pts, false);
798
799 auto t_traction = getFTensor1FromMat<DIM>(contactTraction_mat);
800
801 auto t_sdf = getFTensor0FromVec(sdf_vec);
802 auto t_grad_sdf = getFTensor1FromMat<DIM>(grad_mat);
803 auto t_hess_sdf = getFTensor2SymmetricFromMat<DIM>(hess_mat);
804 auto t_constraint = getFTensor0FromVec(constraint_vec);
805
806 auto t_disp = getFTensor1FromMat<DIM>(commonDataPtr->contactDisp);
807 auto t_coords = BoundaryEleOp::getFTensor1CoordsAtGaussPts();
808 auto t_normal_at_pts = BoundaryEleOp::getFTensor1NormalsAtGaussPts();
809
810 FTensor::Index<'i', DIM> i;
811 FTensor::Index<'j', DIM> j;
812
813 auto ts_time = BoundaryEleOp::getTStime();
814 auto ts_time_step = BoundaryEleOp::getTStimeStep();
815
816 auto m_spatial_coords = get_spatial_coords(
817 BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
818 getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
819 auto m_normals_at_pts = get_normalize_normals(
820 BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
821
822 // placeholder to pass boundary block id to python
823 int block_id = 0;
824
825 auto v_sdf =
826 surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
827 m_spatial_coords, m_normals_at_pts, block_id);
828
829 auto m_grad_sdf =
830 gradSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
831 m_spatial_coords, m_normals_at_pts, block_id);
832
833 auto m_hess_sdf =
834 hessSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
835 m_spatial_coords, m_normals_at_pts, block_id);
836
837 auto t_sdf_v = getFTensor0FromVec(v_sdf);
838 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
839 auto t_hess_sdf_v = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
840
841 auto next = [&]() {
842 ++t_sdf;
843 ++t_sdf_v;
844 ++t_grad_sdf;
845 ++t_grad_sdf_v;
846 ++t_hess_sdf;
847 ++t_hess_sdf_v;
848 ++t_disp;
849 ++t_traction;
850 ++t_constraint;
851 };
852
853 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
854
855 auto tn = -t_traction(i) * t_grad_sdf_v(i);
856 auto c = constrain(t_sdf_v, tn);
857
858 t_sdf = t_sdf_v;
859 t_grad_sdf(i) = t_grad_sdf_v(i);
860 t_hess_sdf(i, j) = t_hess_sdf_v(i, j);
861 t_constraint = c;
862
863 next();
864 }
865
867}
#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()
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

◆ doWork() [2/2]

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

Member Data Documentation

◆ commonDataPtr

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

Definition at line 515 of file ContactOps.hpp.

◆ gradSurfaceDistanceFunction

template<int DIM, typename BoundaryEleOp >
GradSurfaceDistanceFunction ContactOps::OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >::gradSurfaceDistanceFunction
private
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 518 of file ContactOps.hpp.

◆ hessSurfaceDistanceFunction

template<int DIM, typename BoundaryEleOp >
HessSurfaceDistanceFunction ContactOps::OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >::hessSurfaceDistanceFunction
private
Initial value:
=
MatrixDouble hess_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 520 of file ContactOps.hpp.

◆ surfaceDistanceFunction

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

Definition at line 517 of file ContactOps.hpp.


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