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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

◆ sign()

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

Definition at line 551 of file ContactOps.hpp.

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

◆ 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  ++t_coords;
269  }
270 
271  return v_sdf;
272 }

◆ w()

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

Definition at line 561 of file ContactOps.hpp.

561  {
562  return sdf - cn_contact * tn;
563 }

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:589
ContactOps::sign
double sign(double x)
Definition: ContactOps.hpp:551
FTensor::Tensor1< double, 3 >
ContactOps::w
double w(const double sdf, const double tn)
Definition: ContactOps.hpp:561
is_axisymmetric
PetscBool is_axisymmetric
Definition: contact.cpp:90
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:548
ContactOps::scale
double scale
Definition: EshelbianContact.hpp:22
double
MoFEM::GAUSS
@ GAUSS
Definition: FormsIntegrators.hpp:136
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:429
OpCalculateVectorFieldGradient
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359