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

#include <tutorials/adv-1/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)
 

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

Constructor & Destructor Documentation

◆ OpEvaluateSDFImpl()

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

Definition at line 745 of file ContactOps.hpp.

747  : BoundaryEleOp(NOSPACE, BoundaryEleOp::OPSPACE),
748  commonDataPtr(common_data_ptr) {}

Member Function Documentation

◆ doWork()

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

Definition at line 752 of file ContactOps.hpp.

753  {
755 
756  const auto nb_gauss_pts = BoundaryEleOp::getGaussPts().size2();
757  auto &sdf_vec = commonDataPtr->sdfVals;
758  auto &grad_mat = commonDataPtr->gradsSdf;
759  auto &hess_mat = commonDataPtr->hessSdf;
760  auto &constraint_vec = commonDataPtr->constraintVals;
761  auto &contactTraction_mat = commonDataPtr->contactTraction;
762 
763  sdf_vec.resize(nb_gauss_pts, false);
764  grad_mat.resize(DIM, nb_gauss_pts, false);
765  hess_mat.resize((DIM * (DIM + 1)) / 2, nb_gauss_pts, false);
766  constraint_vec.resize(nb_gauss_pts, false);
767 
768  auto t_traction = getFTensor1FromMat<DIM>(contactTraction_mat);
769 
770  auto t_sdf = getFTensor0FromVec(sdf_vec);
771  auto t_grad_sdf = getFTensor1FromMat<DIM>(grad_mat);
772  auto t_hess_sdf = getFTensor2SymmetricFromMat<DIM>(hess_mat);
773  auto t_constraint = getFTensor0FromVec(constraint_vec);
774 
775  auto t_disp = getFTensor1FromMat<DIM>(commonDataPtr->contactDisp);
776  auto t_coords = BoundaryEleOp::getFTensor1CoordsAtGaussPts();
777  auto t_normal_at_pts = BoundaryEleOp::getFTensor1NormalsAtGaussPts();
778 
781 
782  auto ts_time = BoundaryEleOp::getTStime();
783  auto ts_time_step = BoundaryEleOp::getTStimeStep();
784 
785  auto m_spatial_coords = get_spatial_coords(
786  BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
787  getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
788  auto m_normals_at_pts = get_normalize_normals(
789  BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
790 
791  // placeholder to pass boundary block id to python
792  int block_id = 0;
793 
794  auto v_sdf =
795  surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
796  m_spatial_coords, m_normals_at_pts, block_id);
797 
798  auto m_grad_sdf =
799  gradSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
800  m_spatial_coords, m_normals_at_pts, block_id);
801 
802  auto m_hess_sdf =
803  hessSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
804  m_spatial_coords, m_normals_at_pts, block_id);
805 
806  auto t_sdf_v = getFTensor0FromVec(v_sdf);
807  auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
808  auto t_hess_sdf_v = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
809 
810  auto next = [&]() {
811  ++t_sdf;
812  ++t_sdf_v;
813  ++t_grad_sdf;
814  ++t_grad_sdf_v;
815  ++t_hess_sdf;
816  ++t_hess_sdf_v;
817  ++t_disp;
818  ++t_traction;
819  ++t_constraint;
820  };
821 
822  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
823 
824  auto tn = -t_traction(i) * t_grad_sdf_v(i);
825  auto c = constrain(t_sdf_v, tn);
826 
827  t_sdf = t_sdf_v;
828  t_grad_sdf(i) = t_grad_sdf_v(i);
829  t_hess_sdf(i, j) = t_hess_sdf_v(i, j);
830  t_constraint = c;
831 
832  next();
833  }
834 
836 }

Member Data Documentation

◆ commonDataPtr

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

Definition at line 484 of file ContactOps.hpp.

◆ gradSurfaceDistanceFunction

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

Definition at line 487 of file ContactOps.hpp.

◆ hessSurfaceDistanceFunction

template<int DIM, typename BoundaryEleOp >
HessSurfaceDistanceFunction ContactOps::OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >::hessSurfaceDistanceFunction
private
Initial value:

Definition at line 489 of file ContactOps.hpp.

◆ surfaceDistanceFunction

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

Definition at line 486 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::OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >::gradSurfaceDistanceFunction
GradSurfaceDistanceFunction gradSurfaceDistanceFunction
Definition: ContactOps.hpp:487
ContactOps::hess_surface_distance_function
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: ContactOps.hpp:338
ContactOps::constrain
double constrain(double sdf, double tn)
constrain function
Definition: ContactOps.hpp:603
ContactOps::OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >::commonDataPtr
boost::shared_ptr< CommonData > commonDataPtr
Definition: ContactOps.hpp:484
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
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
ContactOps::OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >::surfaceDistanceFunction
SurfaceDistanceFunction surfaceDistanceFunction
Definition: ContactOps.hpp:486
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
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
ContactOps::OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >::hessSurfaceDistanceFunction
HessSurfaceDistanceFunction hessSurfaceDistanceFunction
Definition: ContactOps.hpp:489
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