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)
 

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 290 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)

Definition at line 555 of file ContactOps.hpp.

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

Member Function Documentation

◆ doWork()

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

Definition at line 562 of file ContactOps.hpp.

563 {
565
566 const auto nb_gauss_pts = BoundaryEleOp::getGaussPts().size2();
567 auto &sdf_vec = commonDataPtr->sdfVals;
568 auto &grad_mat = commonDataPtr->gradsSdf;
569 auto &hess_mat = commonDataPtr->hessSdf;
570 auto &constraint_vec = commonDataPtr->constraintVals;
571 auto &contactTraction_mat = commonDataPtr->contactTraction;
572
573 sdf_vec.resize(nb_gauss_pts, false);
574 grad_mat.resize(nb_gauss_pts, DIM, false);
575 hess_mat.resize(nb_gauss_pts, (DIM * (DIM + 1)) / 2, false);
576 constraint_vec.resize(nb_gauss_pts, false);
577
578 auto t_traction = getFTensor1FromMat<DIM>(contactTraction_mat);
579
580 auto t_sdf = getFTensor0FromVec(sdf_vec);
581 auto t_grad_sdf = getFTensor1FromMat<DIM>(grad_mat);
582 auto t_hess_sdf = getFTensor2SymmetricFromMat<DIM>(hess_mat);
583 auto t_constraint = getFTensor0FromVec(constraint_vec);
584
585 auto t_disp = getFTensor1FromMat<DIM>(commonDataPtr->contactDisp);
586 FTensor::Index<'i', DIM> i;
587 FTensor::Index<'j', DIM> j;
588
589 auto ts_time = BoundaryEleOp::getTStime();
590 auto ts_time_step = BoundaryEleOp::getTStimeStep();
591
592 auto m_spatial_coords = get_spatial_coords(
593 BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
594 getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
595 auto m_normals_at_pts = get_normalize_normals(
596 BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
597
598 // placeholder to pass boundary block id to python
599 int block_id = 0;
600
601 auto v_sdf =
602 surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
603 m_spatial_coords, m_normals_at_pts, block_id);
604
605 auto m_grad_sdf =
606 gradSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
607 m_spatial_coords, m_normals_at_pts, block_id);
608
609 auto m_hess_sdf =
610 hessSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
611 m_spatial_coords, m_normals_at_pts, block_id);
612
613 auto t_sdf_v = getFTensor0FromVec(v_sdf);
614 auto t_grad_sdf_v = getFTensor1FromMat<3>(m_grad_sdf);
615 auto t_hess_sdf_v = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
616
617 auto next = [&]() {
618 ++t_sdf;
619 ++t_sdf_v;
620 ++t_grad_sdf;
621 ++t_grad_sdf_v;
622 ++t_hess_sdf;
623 ++t_hess_sdf_v;
624 ++t_disp;
625 ++t_traction;
626 ++t_constraint;
627 };
628
629 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
630
631 auto tn = -t_traction(i) * t_grad_sdf_v(i);
632 auto c = constrain(t_sdf_v, tn);
633
634 t_sdf = t_sdf_v;
635 t_grad_sdf(i) = t_grad_sdf_v(i);
636 t_hess_sdf(i, j) = t_hess_sdf_v(i, j);
637 t_constraint = c;
638
639 next();
640 }
641
643}
#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

Member Data Documentation

◆ commonDataPtr

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

Definition at line 295 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 298 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 300 of file ContactOps.hpp.

◆ surfaceDistanceFunction

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

Definition at line 297 of file ContactOps.hpp.


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