v0.14.0
Classes | Typedefs | Functions | Variables
ContactOps Namespace Reference

Classes

struct  CommonData
 [Common data] More...
 
struct  ContactIntegrators
 
struct  Monitor
 
struct  OpAssembleTotalContactTractionImpl
 
struct  OpAssembleTotalContactTractionImpl< DIM, GAUSS, BoundaryEleOp >
 
struct  OpConstrainBoundaryLhs_dTractionImpl
 
struct  OpConstrainBoundaryLhs_dTractionImpl< DIM, GAUSS, AssemblyBoundaryEleOp >
 
struct  OpConstrainBoundaryLhs_dUImpl
 
struct  OpConstrainBoundaryLhs_dUImpl< DIM, GAUSS, AssemblyBoundaryEleOp >
 
struct  OpConstrainBoundaryRhsImpl
 
struct  OpConstrainBoundaryRhsImpl< DIM, GAUSS, AssemblyBoundaryEleOp >
 
struct  OpEvaluateSDFImpl
 
struct  OpEvaluateSDFImpl< DIM, GAUSS, BoundaryEleOp >
 
struct  OpMixLhsSide
 
struct  PostProcEleByDim
 
struct  PostProcEleByDim< 2 >
 
struct  PostProcEleByDim< 3 >
 

Typedefs

using EntData = EntitiesFieldData::EntData
 
using BoundaryEle = FaceElementForcesAndSourcesCore
 
using BoundaryEleOp = BoundaryEle::UserDataOperator
 
using AssemblyBoundaryEleOp = FormsIntegrators< BoundaryEleOp >::Assembly< A >::OpBase
 
using SurfaceDistanceFunction = boost::function< VectorDouble(double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords, MatrixDouble &normals_at_pts, int block_id)>
 [Common data] More...
 
using GradSurfaceDistanceFunction = boost::function< MatrixDouble(double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords, MatrixDouble &normals_at_pts, int block_id)>
 
using HessSurfaceDistanceFunction = boost::function< MatrixDouble(double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords, MatrixDouble &normals_at_pts, int block_id)>
 
using PostProcEleDomain = PostProcEleByDim< SPACE_DIM >::PostProcEleDomain
 
using SideEle = PostProcEleByDim< SPACE_DIM >::SideEle
 
using PostProcEleBdy = PostProcEleByDim< SPACE_DIM >::PostProcEleBdy
 

Functions

VectorDouble surface_distance_function (double delta_t, double t, int nb_gauss_pts, MatrixDouble &m_spatial_coords, MatrixDouble &m_normals_at_pts, int block_id)
 
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)
 
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)
 
template<typename T1 , typename T2 , int DIM1, int DIM2>
auto get_spatial_coords (FTensor::Tensor1< T1, DIM1 > &&t_coords, FTensor::Tensor1< T2, DIM2 > &&t_disp, size_t nb_gauss_pts)
 
template<typename T1 , int DIM1>
auto get_normalize_normals (FTensor::Tensor1< T1, DIM1 > &&t_normal_at_pts, size_t nb_gauss_pts)
 
double sign (double x)
 
double w (const double sdf, const double tn)
 
double constrain (double sdf, double tn)
 constrain function More...
 
template<int DIM, AssemblyType A, IntegrationType I, typename DomainEleOp >
MoFEMErrorCode opFactoryDomainRhs (boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, std::string u, bool is_axisymmetric=false)
 
template<int DIM, AssemblyType A, IntegrationType I, typename DomainEle >
MoFEMErrorCode opFactoryBoundaryToDomainLhs (MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string fe_domain_name, std::string sigma, std::string u, std::string geom, ForcesAndSourcesCore::RuleHookFun rule, bool is_axisymmetric=false)
 
template<int DIM, AssemblyType A, IntegrationType I, typename BoundaryEleOp >
MoFEMErrorCode opFactoryBoundaryLhs (boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, std::string u, bool is_axisymmetric=false)
 
template<int DIM, AssemblyType A, IntegrationType I, typename BoundaryEleOp >
MoFEMErrorCode opFactoryBoundaryRhs (boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, std::string u, bool is_axisymmetric=false)
 
template<int DIM, IntegrationType I, typename BoundaryEleOp >
MoFEMErrorCode opFactoryCalculateTraction (boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, bool is_axisymmetric=false)
 

Variables

double cn_contact = 1
 
double alpha_contact_const = 1
 
double alpha_contact_quadratic = 1
 
double scale = 1
 

Typedef Documentation

◆ AssemblyBoundaryEleOp

using ContactOps::AssemblyBoundaryEleOp = typedef FormsIntegrators<BoundaryEleOp>::Assembly<A>::OpBase
Examples
ContactOps.hpp.

Definition at line 17 of file EshelbianContact.hpp.

◆ BoundaryEle

Definition at line 13 of file EshelbianContact.hpp.

◆ BoundaryEleOp

Examples
ContactOps.hpp.

Definition at line 14 of file EshelbianContact.hpp.

◆ EntData

using ContactOps::EntData = typedef EntitiesFieldData::EntData

Definition at line 12 of file EshelbianContact.hpp.

◆ GradSurfaceDistanceFunction

using ContactOps::GradSurfaceDistanceFunction = typedef boost::function<MatrixDouble( double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords, MatrixDouble &normals_at_pts, int block_id)>
Examples
ContactOps.hpp.

Definition at line 210 of file ContactOps.hpp.

◆ HessSurfaceDistanceFunction

using ContactOps::HessSurfaceDistanceFunction = typedef boost::function<MatrixDouble( double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords, MatrixDouble &normals_at_pts, int block_id)>
Examples
ContactOps.hpp.

Definition at line 214 of file ContactOps.hpp.

◆ PostProcEleBdy

Definition at line 26 of file PostProcContact.hpp.

◆ PostProcEleDomain

Definition at line 24 of file PostProcContact.hpp.

◆ SideEle

Definition at line 25 of file PostProcContact.hpp.

◆ SurfaceDistanceFunction

using ContactOps::SurfaceDistanceFunction = typedef boost::function<VectorDouble( double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords, MatrixDouble &normals_at_pts, int block_id)>

[Common data]

[Surface distance function from python] [Surface distance function from python]

Examples
ContactOps.hpp.

Definition at line 206 of file ContactOps.hpp.

Function Documentation

◆ constrain()

double ContactOps::constrain ( double  sdf,
double  tn 
)
inline

constrain function

return 1 if negative sdf or positive tn

Parameters
sdfsigned distance
tntraction
Returns
double
Examples
ContactOps.hpp.

Definition at line 572 of file ContactOps.hpp.

572  {
573  const auto s = sign(w(sdf, tn));
574  return (1 - s) / 2;
575 }

◆ get_normalize_normals()

template<typename T1 , int DIM1>
auto ContactOps::get_normalize_normals ( FTensor::Tensor1< T1, DIM1 > &&  t_normal_at_pts,
size_t  nb_gauss_pts 
)
inline
Examples
ContactOps.hpp.

Definition at line 422 of file ContactOps.hpp.

423  {
424  MatrixDouble m_normals_at_pts(3, nb_gauss_pts);
425  m_normals_at_pts.clear();
427  auto t_set_normal = getFTensor1FromMat<3>(m_normals_at_pts);
428  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
429  t_set_normal(i) = t_normal_at_pts(i) / t_normal_at_pts.l2();
430  ++t_set_normal;
431  ++t_normal_at_pts;
432  }
433  return m_normals_at_pts;
434 }

◆ get_spatial_coords()

template<typename T1 , typename T2 , int DIM1, int DIM2>
auto ContactOps::get_spatial_coords ( FTensor::Tensor1< T1, DIM1 > &&  t_coords,
FTensor::Tensor1< T2, DIM2 > &&  t_disp,
size_t  nb_gauss_pts 
)
inline
Examples
ContactOps.hpp.

Definition at line 405 of file ContactOps.hpp.

407  {
408  MatrixDouble m_spatial_coords(nb_gauss_pts, 3);
409  m_spatial_coords.clear();
410  auto t_spatial_coords = getFTensor1FromPtr<3>(&m_spatial_coords(0, 0));
412  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
413  t_spatial_coords(i) = t_coords(i) + t_disp(i);
414  ++t_spatial_coords;
415  ++t_coords;
416  ++t_disp;
417  }
418  return m_spatial_coords;
419 }

◆ grad_surface_distance_function()

MatrixDouble ContactOps::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 
)
inline
Examples
ContactOps.hpp.

Definition at line 273 of file ContactOps.hpp.

275  {
276 #ifdef PYTHON_SDF
277  if (auto sdf_ptr = sdfPythonWeakPtr.lock()) {
278 
279  VectorDouble v_spatial_coords = m_spatial_coords.data();
280  VectorDouble v_normal_at_pts = m_normals_at_pts.data();
281 
282  bp::list python_coords;
283  bp::list python_normals;
284 
285  for (int idx = 0; idx < 3; ++idx) {
286  python_coords.append(
287  convert_to_numpy(v_spatial_coords, nb_gauss_pts, idx));
288  python_normals.append(
289  convert_to_numpy(v_normal_at_pts, nb_gauss_pts, idx));
290  }
291 
292  np::ndarray np_grad_sdf = np::empty(bp::make_tuple(nb_gauss_pts, 3),
293  np::dtype::get_builtin<double>());
294  CHK_MOAB_THROW(sdf_ptr->evalGradSdf(
295  delta_t, t, bp::extract<np::ndarray>(python_coords[0]),
296  bp::extract<np::ndarray>(python_coords[1]),
297  bp::extract<np::ndarray>(python_coords[2]),
298  bp::extract<np::ndarray>(python_normals[0]),
299  bp::extract<np::ndarray>(python_normals[1]),
300  bp::extract<np::ndarray>(python_normals[2]), block_id,
301  np_grad_sdf),
302  "Failed python call");
303 
304  double *grad_ptr = reinterpret_cast<double *>(np_grad_sdf.get_data());
305 
306  MatrixDouble m_grad_sdf;
307  m_grad_sdf.resize(3, nb_gauss_pts, false);
308  for (size_t gg = 0; gg < nb_gauss_pts; ++gg) {
309  for (int idx = 0; idx < 3; ++idx)
310  m_grad_sdf(idx, gg) = *(grad_ptr + (3 * gg + idx));
311  }
312  return m_grad_sdf;
313  }
314 #endif
315  MatrixDouble m_grad_sdf;
316  m_grad_sdf.resize(3, nb_gauss_pts, false);
318  FTensor::Tensor1<double, 3> t_grad_sdf_set{0.0, 0.0, 1.0};
319  auto t_grad_sdf = getFTensor1FromMat<3>(m_grad_sdf);
320 
321  for (size_t gg = 0; gg < nb_gauss_pts; ++gg) {
322  t_grad_sdf(i) = t_grad_sdf_set(i);
323  ++t_grad_sdf;
324  }
325 
326  return m_grad_sdf;
327 }

◆ hess_surface_distance_function()

MatrixDouble ContactOps::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 
)
inline
Examples
ContactOps.hpp.

Definition at line 330 of file ContactOps.hpp.

332  {
333 #ifdef PYTHON_SDF
334  if (auto sdf_ptr = sdfPythonWeakPtr.lock()) {
335 
336  VectorDouble v_spatial_coords = m_spatial_coords.data();
337  VectorDouble v_normal_at_pts = m_normals_at_pts.data();
338 
339  bp::list python_coords;
340  bp::list python_normals;
341 
342  for (int idx = 0; idx < 3; ++idx) {
343  python_coords.append(
344  convert_to_numpy(v_spatial_coords, nb_gauss_pts, idx));
345  python_normals.append(
346  convert_to_numpy(v_normal_at_pts, nb_gauss_pts, idx));
347  };
348 
349  np::ndarray np_hess_sdf = np::empty(bp::make_tuple(nb_gauss_pts, 6),
350  np::dtype::get_builtin<double>());
351  CHK_MOAB_THROW(sdf_ptr->evalHessSdf(
352  delta_t, t, bp::extract<np::ndarray>(python_coords[0]),
353  bp::extract<np::ndarray>(python_coords[1]),
354  bp::extract<np::ndarray>(python_coords[2]),
355  bp::extract<np::ndarray>(python_normals[0]),
356  bp::extract<np::ndarray>(python_normals[1]),
357  bp::extract<np::ndarray>(python_normals[2]), block_id,
358  np_hess_sdf),
359  "Failed python call");
360 
361  double *hess_ptr = reinterpret_cast<double *>(np_hess_sdf.get_data());
362 
363  MatrixDouble m_hess_sdf;
364  m_hess_sdf.resize(6, nb_gauss_pts, false);
365  for (size_t gg = 0; gg < nb_gauss_pts; ++gg) {
366  for (int idx = 0; idx < 6; ++idx)
367  m_hess_sdf(idx, gg) =
368  *(hess_ptr + (6 * gg + idx));
369  }
370  return m_hess_sdf;
371  }
372 #endif
373  MatrixDouble m_hess_sdf;
374  m_hess_sdf.resize(6, nb_gauss_pts, false);
377  FTensor::Tensor2_symmetric<double, 3> t_hess_sdf_set{0., 0., 0., 0., 0., 0.};
378  auto t_hess_sdf = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
379 
380  for (size_t gg = 0; gg < nb_gauss_pts; ++gg) {
381  t_hess_sdf(i, j) = t_hess_sdf_set(i, j);
382  ++t_hess_sdf;
383  }
384  return m_hess_sdf;
385 }

◆ opFactoryBoundaryLhs()

template<int DIM, AssemblyType A, IntegrationType I, typename BoundaryEleOp >
MoFEMErrorCode ContactOps::opFactoryBoundaryLhs ( boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &  pip,
std::string  sigma,
std::string  u,
bool  is_axisymmetric = false 
)
Examples
ContactOps.hpp.

Definition at line 1196 of file ContactOps.hpp.

1198  {
1200 
1201  using C = ContactIntegrators<BoundaryEleOp>;
1202 
1203  auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1204 
1205  pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1206  u, common_data_ptr->contactDispPtr()));
1207  pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1208  sigma, common_data_ptr->contactTractionPtr()));
1209  pip.push_back(
1210  new typename C::template Assembly<A>::template OpConstrainBoundaryLhs_dU<
1211  DIM, GAUSS>(sigma, u, common_data_ptr, is_axisymmetric));
1212  pip.push_back(new typename C::template Assembly<A>::
1213  template OpConstrainBoundaryLhs_dTraction<DIM, GAUSS>(
1214  sigma, sigma, common_data_ptr, is_axisymmetric));
1215 
1217 }

◆ opFactoryBoundaryRhs()

template<int DIM, AssemblyType A, IntegrationType I, typename BoundaryEleOp >
MoFEMErrorCode ContactOps::opFactoryBoundaryRhs ( boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &  pip,
std::string  sigma,
std::string  u,
bool  is_axisymmetric = false 
)
Examples
ContactOps.hpp.

Definition at line 1220 of file ContactOps.hpp.

1222  {
1224 
1225  using C = ContactIntegrators<BoundaryEleOp>;
1226 
1227  auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1228 
1229  pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1230  u, common_data_ptr->contactDispPtr()));
1231  pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1232  sigma, common_data_ptr->contactTractionPtr()));
1233  pip.push_back(
1234  new typename C::template Assembly<A>::template OpConstrainBoundaryRhs<
1235  DIM, GAUSS>(sigma, common_data_ptr, is_axisymmetric));
1236 
1238 }

◆ opFactoryBoundaryToDomainLhs()

template<int DIM, AssemblyType A, IntegrationType I, typename DomainEle >
MoFEMErrorCode ContactOps::opFactoryBoundaryToDomainLhs ( MoFEM::Interface m_field,
boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &  pip,
std::string  fe_domain_name,
std::string  sigma,
std::string  u,
std::string  geom,
ForcesAndSourcesCore::RuleHookFun  rule,
bool  is_axisymmetric = false 
)
Examples
ContactOps.hpp.

Definition at line 1142 of file ContactOps.hpp.

1147  {
1149 
1150  using DomainEleOp = typename DomainEle::UserDataOperator;
1151 
1152  auto op_loop_side = new OpLoopSide<DomainEle>(
1153  m_field, fe_domain_name, DIM, Sev::noisy,
1154  boost::make_shared<ForcesAndSourcesCore::UserDataOperator::AdjCache>());
1155  pip.push_back(op_loop_side);
1156 
1157  CHKERR AddHOOps<DIM, DIM, DIM>::add(op_loop_side->getOpPtrVector(),
1158  {H1, HDIV}, geom);
1159 
1160  using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
1161  A>::template BiLinearForm<I>;
1162 
1163  using OpMixDivULhs = typename B::template OpMixDivTimesVec<DIM>;
1164  using OpMixDivUCylLhs =
1165  typename B::template OpMixDivTimesVec<DIM, CYLINDRICAL>;
1166  using OpLambdaGraULhs = typename B::template OpMixTensorTimesGrad<DIM>;
1167 
1168  using OpMixDivULhsSide = OpMixLhsSide<OpMixDivULhs>;
1169  using OpMixDivUCylLhsSide = OpMixLhsSide<OpMixDivUCylLhs>;
1170  using OpLambdaGraULhsSide = OpMixLhsSide<OpLambdaGraULhs>;
1171 
1172  auto unity = []() { return 1; };
1173  auto jacobian = [is_axisymmetric](const double r, const double,
1174  const double) {
1175  if (is_axisymmetric)
1176  return 2. * M_PI * r;
1177  else
1178  return 1.;
1179  };
1180 
1181  if (!is_axisymmetric) {
1182  op_loop_side->getOpPtrVector().push_back(
1183  new OpMixDivULhsSide(sigma, u, unity, jacobian, true));
1184  } else {
1185  op_loop_side->getOpPtrVector().push_back(
1186  new OpMixDivUCylLhsSide(sigma, u, unity, jacobian, true));
1187  }
1188  op_loop_side->getOpPtrVector().push_back(
1189  new OpLambdaGraULhsSide(sigma, u, unity, jacobian, true));
1190 
1191  op_loop_side->getSideFEPtr()->getRuleHook = rule;
1193 }

◆ opFactoryCalculateTraction()

template<int DIM, IntegrationType I, typename BoundaryEleOp >
MoFEMErrorCode ContactOps::opFactoryCalculateTraction ( boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &  pip,
std::string  sigma,
bool  is_axisymmetric = false 
)
Examples
ContactOps.hpp.

Definition at line 1241 of file ContactOps.hpp.

1243  {
1245 
1246  using C = ContactIntegrators<BoundaryEleOp>;
1247 
1248  auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1249  pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1250  sigma, common_data_ptr->contactTractionPtr()));
1251  pip.push_back(new typename C::template OpAssembleTotalContactTraction<DIM, I>(
1252  common_data_ptr, 1. / scale, is_axisymmetric));
1253 
1255 }

◆ opFactoryDomainRhs()

template<int DIM, AssemblyType A, IntegrationType I, typename DomainEleOp >
MoFEMErrorCode ContactOps::opFactoryDomainRhs ( boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &  pip,
std::string  sigma,
std::string  u,
bool  is_axisymmetric = false 
)
Examples
ContactOps.hpp.

Definition at line 1063 of file ContactOps.hpp.

1065  {
1067 
1068  using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
1069  A>::template LinearForm<I>;
1070  using OpMixDivURhs = typename B::template OpMixDivTimesU<3, DIM, DIM>;
1071  using OpMixDivUCylRhs =
1072  typename B::template OpMixDivTimesU<3, DIM, DIM, CYLINDRICAL>;
1073 
1074  using OpMixLambdaGradURhs = typename B::template OpMixTensorTimesGradU<DIM>;
1075  using OpMixUTimesDivLambdaRhs =
1076  typename B::template OpMixVecTimesDivLambda<SPACE_DIM>;
1077  using OpMixUTimesLambdaRhs =
1078  typename B::template OpGradTimesTensor<1, DIM, DIM>;
1079 
1080  auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1081  auto mat_grad_ptr = boost::make_shared<MatrixDouble>();
1082  auto div_stress_ptr = boost::make_shared<MatrixDouble>();
1083  auto contact_stress_ptr = boost::make_shared<MatrixDouble>();
1084 
1085  auto jacobian = [is_axisymmetric](const double r, const double,
1086  const double) {
1087  if (is_axisymmetric)
1088  return 2. * M_PI * r;
1089  else
1090  return 1.;
1091  };
1092 
1093  pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1094  u, common_data_ptr->contactDispPtr()));
1095  pip.push_back(
1096  new OpCalculateHVecTensorField<DIM, DIM>(sigma, contact_stress_ptr));
1097 
1098  if (!is_axisymmetric) {
1099  pip.push_back(
1100  new OpCalculateHVecTensorDivergence<DIM, DIM>(sigma, div_stress_ptr));
1101  } else {
1102  pip.push_back(new OpCalculateHVecTensorDivergence<DIM, DIM, CYLINDRICAL>(
1103  sigma, div_stress_ptr));
1104  }
1105 
1106  pip.push_back(new OpCalculateVectorFieldGradient<DIM, DIM>(u, mat_grad_ptr));
1107 
1108  if (!is_axisymmetric) {
1109  pip.push_back(
1110  new OpMixDivURhs(sigma, common_data_ptr->contactDispPtr(), jacobian));
1111  } else {
1112  pip.push_back(new OpMixDivUCylRhs(sigma, common_data_ptr->contactDispPtr(),
1113  jacobian));
1114  }
1115 
1116  pip.push_back(new OpMixLambdaGradURhs(sigma, mat_grad_ptr, jacobian));
1117  pip.push_back(new OpMixUTimesDivLambdaRhs(u, div_stress_ptr, jacobian));
1118  pip.push_back(new OpMixUTimesLambdaRhs(u, contact_stress_ptr, jacobian));
1119 
1121 }

◆ sign()

double ContactOps::sign ( double  x)
inline
Examples
ContactOps.hpp, and PlasticOpsGeneric.hpp.

Definition at line 549 of file ContactOps.hpp.

549  {
550  constexpr auto eps = std::numeric_limits<float>::epsilon();
551  if (std::abs(x) < eps)
552  return 0;
553  else if (x > eps)
554  return 1;
555  else
556  return -1;
557 };

◆ surface_distance_function()

VectorDouble ContactOps::surface_distance_function ( double  delta_t,
double  t,
int  nb_gauss_pts,
MatrixDouble &  m_spatial_coords,
MatrixDouble &  m_normals_at_pts,
int  block_id 
)
inline
Examples
ContactOps.hpp.

Definition at line 216 of file ContactOps.hpp.

220  {
221 
222 #ifdef PYTHON_SDF
223  if (auto sdf_ptr = sdfPythonWeakPtr.lock()) {
224 
225  VectorDouble v_spatial_coords = m_spatial_coords.data();
226  VectorDouble v_normal_at_pts = m_normals_at_pts.data();
227 
228  bp::list python_coords;
229  bp::list python_normals;
230 
231  for (int idx = 0; idx < 3; ++idx) {
232  python_coords.append(
233  convert_to_numpy(v_spatial_coords, nb_gauss_pts, idx));
234  python_normals.append(
235  convert_to_numpy(v_normal_at_pts, nb_gauss_pts, idx));
236  }
237 
238  np::ndarray np_sdf = np::empty(bp::make_tuple(nb_gauss_pts),
239  np::dtype::get_builtin<double>());
240  CHK_MOAB_THROW(sdf_ptr->evalSdf(delta_t, t,
241  bp::extract<np::ndarray>(python_coords[0]),
242  bp::extract<np::ndarray>(python_coords[1]),
243  bp::extract<np::ndarray>(python_coords[2]),
244  bp::extract<np::ndarray>(python_normals[0]),
245  bp::extract<np::ndarray>(python_normals[1]),
246  bp::extract<np::ndarray>(python_normals[2]),
247  block_id, np_sdf),
248  "Failed python call");
249 
250  double *sdf_val_ptr = reinterpret_cast<double *>(np_sdf.get_data());
251 
252  VectorDouble v_sdf;
253  v_sdf.resize(nb_gauss_pts, false);
254 
255  for (size_t gg = 0; gg < nb_gauss_pts; ++gg)
256  v_sdf[gg] = *(sdf_val_ptr + gg);
257 
258  return v_sdf;
259  }
260 #endif
261  VectorDouble v_sdf;
262  v_sdf.resize(nb_gauss_pts, false);
263  m_spatial_coords.resize(3, nb_gauss_pts);
264  auto t_coords = getFTensor1FromMat<3>(m_spatial_coords);
265 
266  for (size_t gg = 0; gg < nb_gauss_pts; ++gg)
267  v_sdf[gg] = t_coords(1) + 0.5;
268 
269  return v_sdf;
270 }

◆ w()

double ContactOps::w ( const double  sdf,
const double  tn 
)
inline
Examples
ContactOps.hpp.

Definition at line 559 of file ContactOps.hpp.

559  {
560  return sdf - cn_contact * tn;
561 }

Variable Documentation

◆ alpha_contact_const

double ContactOps::alpha_contact_const = 1

Definition at line 20 of file EshelbianContact.hpp.

◆ alpha_contact_quadratic

double ContactOps::alpha_contact_quadratic = 1

Definition at line 21 of file EshelbianContact.hpp.

◆ cn_contact

double ContactOps::cn_contact = 1
Examples
ContactOps.hpp, and plastic.cpp.

Definition at line 19 of file EshelbianContact.hpp.

◆ scale

double ContactOps::scale = 1
CHK_MOAB_THROW
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:576
ContactOps::sign
double sign(double x)
Definition: ContactOps.hpp:549
FTensor::Tensor1< double, 3 >
ContactOps::w
double w(const double sdf, const double tn)
Definition: ContactOps.hpp:559
is_axisymmetric
PetscBool is_axisymmetric
Definition: contact.cpp:137
FTensor::Tensor1::l2
T l2() const
Definition: Tensor1_value.hpp:84
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
sdf
Definition: sdf.py:1
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
sdf.r
int r
Definition: sdf.py:8
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
ContactOps::scale
double scale
Definition: EshelbianContact.hpp:22
double
MoFEM::GAUSS
@ GAUSS
Definition: FormsIntegrators.hpp:128
t
constexpr double t
plate stiffness
Definition: plate.cpp:59
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
BiLinearForm
OpGradTimesTensor
FormsIntegrators< DomainEleOp >::Assembly< A >::LinearForm< I >::OpGradTimesTensor< 1, FIELD_DIM, SPACE_DIM > OpGradTimesTensor
Definition: operators_tests.cpp:48
FTensor::Index
Definition: Index.hpp:23
ContactOps::cn_contact
double cn_contact
Definition: EshelbianContact.hpp:19
DomainEleOp
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
eps
static const double eps
Definition: check_base_functions_derivatives_on_tet.cpp:11
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
OpCalculateVectorFieldGradient
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346