v0.15.5
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< CommonDatacommonDataPtr
 
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 511 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 777 of file ContactOps.hpp.

779 : BoundaryEleOp(NOSPACE, BoundaryEleOp::OPSPACE),
780 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 784 of file ContactOps.hpp.

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

◆ surfaceDistanceFunction

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

Definition at line 518 of file ContactOps.hpp.


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