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

Classes

struct  CommonData
 [Common data] More...
 
struct  ContactIntegrators
 
struct  Monitor
 
struct  OpAssembleTotalContactAreaImpl
 
struct  OpAssembleTotalContactAreaImpl< DIM, GAUSS, BoundaryEleOp >
 
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 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
 
using EntData = EntitiesFieldData::EntData
 
using BoundaryEle = FaceElementForcesAndSourcesCore
 
using BoundaryEleOp = BoundaryEle::UserDataOperator
 
using AssemblyBoundaryEleOp = FormsIntegrators< BoundaryEleOp >::Assembly< A >::OpBase
 

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)
 
template<int DIM, IntegrationType I, typename BoundaryEleOp >
MoFEMErrorCode opFactoryCalculateArea (boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, OpLoopSide< SideEle > *op_loop_side, std::string sigma, std::string u, bool is_axisymmetric=false, boost::shared_ptr< Range > contact_range_ptr=nullptr)
 

Variables

double cn_contact = 0.1
 
double alpha_contact_const = 1
 
double alpha_contact_quadratic = 1
 
double scale = 1
 
double airplane_ray_distance = 1
 

Typedef Documentation

◆ AssemblyBoundaryEleOp

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

Definition at line 18 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 217 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 221 of file ContactOps.hpp.

◆ PostProcEleBdy

Definition at line 26 of file PostProcContact.hpp.

◆ PostProcEleDomain

Definition at line 24 of file PostProcContact.hpp.

◆ SideEle

typedef FaceElementForcesAndSourcesCoreOnSide ContactOps::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 213 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 603 of file ContactOps.hpp.

603  {
604  const auto s = sign(w(sdf, tn));
605  return (1 - s) / 2;
606 }

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

432  {
433  MatrixDouble m_normals_at_pts(3, nb_gauss_pts);
434  m_normals_at_pts.clear();
436  auto t_set_normal = getFTensor1FromMat<3>(m_normals_at_pts);
437  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
438  t_set_normal(i) = t_normal_at_pts(i) / t_normal_at_pts.l2();
439  ++t_set_normal;
440  ++t_normal_at_pts;
441  }
442  return m_normals_at_pts;
443 }

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

416  {
417  MatrixDouble m_spatial_coords(nb_gauss_pts, 3);
418  m_spatial_coords.clear();
419  auto t_spatial_coords = getFTensor1FromPtr<3>(&m_spatial_coords(0, 0));
421  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
422  t_spatial_coords(i) = t_coords(i) + t_disp(i);
423  ++t_spatial_coords;
424  ++t_coords;
425  ++t_disp;
426  }
427  return m_spatial_coords;
428 }

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

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

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

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

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

1321  {
1323 
1324  using C = ContactIntegrators<BoundaryEleOp>;
1325 
1326  auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1327 
1328  pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1329  u, common_data_ptr->contactDispPtr()));
1330  pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1331  sigma, common_data_ptr->contactTractionPtr()));
1332  pip.push_back(
1333  new typename C::template Assembly<A>::template OpConstrainBoundaryLhs_dU<
1334  DIM, GAUSS>(sigma, u, common_data_ptr, is_axisymmetric));
1335  pip.push_back(new typename C::template Assembly<A>::
1336  template OpConstrainBoundaryLhs_dTraction<DIM, GAUSS>(
1337  sigma, sigma, common_data_ptr, is_axisymmetric));
1338 
1340 }

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

1345  {
1347 
1348  using C = ContactIntegrators<BoundaryEleOp>;
1349 
1350  auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1351 
1352  pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1353  u, common_data_ptr->contactDispPtr()));
1354  pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1355  sigma, common_data_ptr->contactTractionPtr()));
1356  pip.push_back(
1357  new typename C::template Assembly<A>::template OpConstrainBoundaryRhs<
1358  DIM, GAUSS>(sigma, common_data_ptr, is_axisymmetric));
1359 
1361 }

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

1270  {
1272 
1273  using DomainEleOp = typename DomainEle::UserDataOperator;
1274 
1275  auto op_loop_side = new OpLoopSide<DomainEle>(
1276  m_field, fe_domain_name, DIM, Sev::noisy,
1277  boost::make_shared<ForcesAndSourcesCore::UserDataOperator::AdjCache>());
1278  pip.push_back(op_loop_side);
1279 
1280  CHKERR AddHOOps<DIM, DIM, DIM>::add(op_loop_side->getOpPtrVector(),
1281  {H1, HDIV}, geom);
1282 
1283  using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
1284  A>::template BiLinearForm<I>;
1285 
1286  using OpMixDivULhs = typename B::template OpMixDivTimesVec<DIM>;
1287  using OpMixDivUCylLhs =
1288  typename B::template OpMixDivTimesVec<DIM, CYLINDRICAL>;
1289  using OpLambdaGraULhs = typename B::template OpMixTensorTimesGrad<DIM>;
1290 
1291  using OpMixDivULhsSide = OpMixLhsSide<OpMixDivULhs>;
1292  using OpMixDivUCylLhsSide = OpMixLhsSide<OpMixDivUCylLhs>;
1293  using OpLambdaGraULhsSide = OpMixLhsSide<OpLambdaGraULhs>;
1294 
1295  auto unity = []() { return 1; };
1296  auto jacobian = [is_axisymmetric](const double r, const double,
1297  const double) {
1298  if (is_axisymmetric)
1299  return 2. * M_PI * r;
1300  else
1301  return 1.;
1302  };
1303 
1304  if (!is_axisymmetric) {
1305  op_loop_side->getOpPtrVector().push_back(
1306  new OpMixDivULhsSide(sigma, u, unity, jacobian, true));
1307  } else {
1308  op_loop_side->getOpPtrVector().push_back(
1309  new OpMixDivUCylLhsSide(sigma, u, unity, jacobian, true));
1310  }
1311  op_loop_side->getOpPtrVector().push_back(
1312  new OpLambdaGraULhsSide(sigma, u, unity, jacobian, true));
1313 
1314  op_loop_side->getSideFEPtr()->getRuleHook = rule;
1316 }

◆ opFactoryCalculateArea()

template<int DIM, IntegrationType I, typename BoundaryEleOp >
MoFEMErrorCode ContactOps::opFactoryCalculateArea ( boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &  pip,
OpLoopSide< SideEle > *  op_loop_side,
std::string  sigma,
std::string  u,
bool  is_axisymmetric = false,
boost::shared_ptr< Range contact_range_ptr = nullptr 
)
Examples
ContactOps.hpp.

Definition at line 1381 of file ContactOps.hpp.

1385  {
1387  using C = ContactIntegrators<BoundaryEleOp>;
1388 
1389  auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1390 
1391  op_loop_side->getOpPtrVector().push_back(
1393  "U", common_data_ptr->contactDispGradPtr()));
1394 
1395  if (contact_range_ptr) {
1396  pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1397  u, common_data_ptr->contactDispPtr()));
1398  pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1399  sigma, common_data_ptr->contactTractionPtr()));
1400  pip.push_back(op_loop_side);
1401  pip.push_back(new typename C::template OpAssembleTotalContactArea<DIM, I>(
1402  common_data_ptr, is_axisymmetric, contact_range_ptr));
1403  }
1405 }

◆ 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
adolc_plasticity.cpp, and ContactOps.hpp.

Definition at line 1364 of file ContactOps.hpp.

1366  {
1368 
1369  using C = ContactIntegrators<BoundaryEleOp>;
1370 
1371  auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1372  pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1373  sigma, common_data_ptr->contactTractionPtr()));
1374  pip.push_back(new typename C::template OpAssembleTotalContactTraction<DIM, I>(
1375  common_data_ptr, 1. / scale, is_axisymmetric));
1376 
1378 }

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

1188  {
1190 
1191  using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
1192  A>::template LinearForm<I>;
1193  using OpMixDivURhs = typename B::template OpMixDivTimesU<3, DIM, DIM>;
1194  using OpMixDivUCylRhs =
1195  typename B::template OpMixDivTimesU<3, DIM, DIM, CYLINDRICAL>;
1196 
1197  using OpMixLambdaGradURhs = typename B::template OpMixTensorTimesGradU<DIM>;
1198  using OpMixUTimesDivLambdaRhs =
1199  typename B::template OpMixVecTimesDivLambda<SPACE_DIM>;
1200  using OpMixUTimesLambdaRhs =
1201  typename B::template OpGradTimesTensor<1, DIM, DIM>;
1202 
1203  auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1204  auto mat_grad_ptr = boost::make_shared<MatrixDouble>();
1205  auto div_stress_ptr = boost::make_shared<MatrixDouble>();
1206  auto contact_stress_ptr = boost::make_shared<MatrixDouble>();
1207 
1208  auto jacobian = [is_axisymmetric](const double r, const double,
1209  const double) {
1210  if (is_axisymmetric)
1211  return 2. * M_PI * r;
1212  else
1213  return 1.;
1214  };
1215 
1216  pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1217  u, common_data_ptr->contactDispPtr()));
1218  pip.push_back(
1219  new OpCalculateHVecTensorField<DIM, DIM>(sigma, contact_stress_ptr));
1220 
1221  if (!is_axisymmetric) {
1222  pip.push_back(
1223  new OpCalculateHVecTensorDivergence<DIM, DIM>(sigma, div_stress_ptr));
1224  } else {
1225  pip.push_back(new OpCalculateHVecTensorDivergence<DIM, DIM, CYLINDRICAL>(
1226  sigma, div_stress_ptr));
1227  }
1228 
1229  pip.push_back(new OpCalculateVectorFieldGradient<DIM, DIM>(u, mat_grad_ptr));
1230 
1231  if (!is_axisymmetric) {
1232  pip.push_back(
1233  new OpMixDivURhs(sigma, common_data_ptr->contactDispPtr(), jacobian));
1234  } else {
1235  pip.push_back(new OpMixDivUCylRhs(sigma, common_data_ptr->contactDispPtr(),
1236  jacobian));
1237  }
1238 
1239  pip.push_back(new OpMixLambdaGradURhs(sigma, mat_grad_ptr, jacobian));
1240  pip.push_back(new OpMixUTimesDivLambdaRhs(u, div_stress_ptr, jacobian));
1241  pip.push_back(new OpMixUTimesLambdaRhs(u, contact_stress_ptr, jacobian));
1242 
1244 }

◆ sign()

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

Definition at line 580 of file ContactOps.hpp.

580  {
581  constexpr auto eps = std::numeric_limits<float>::epsilon();
582  if (std::abs(x) < eps)
583  return 0;
584  else if (x > eps)
585  return 1;
586  else
587  return -1;
588 };

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

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

◆ w()

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

Definition at line 590 of file ContactOps.hpp.

590  {
591  return sdf - cn_contact * tn;
592 }

Variable Documentation

◆ airplane_ray_distance

double ContactOps::airplane_ray_distance = 1

Definition at line 25 of file EshelbianContact.hpp.

◆ alpha_contact_const

double ContactOps::alpha_contact_const = 1

Definition at line 21 of file EshelbianContact.hpp.

◆ alpha_contact_quadratic

double ContactOps::alpha_contact_quadratic = 1

Definition at line 22 of file EshelbianContact.hpp.

◆ cn_contact

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

Definition at line 100 of file contact.cpp.

◆ scale

double ContactOps::scale = 1
Examples
ContactOps.hpp.

Definition at line 23 of file EshelbianContact.hpp.

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:580
FTensor::Tensor1< double, 3 >
ContactOps::w
double w(const double sdf, const double tn)
Definition: ContactOps.hpp:590
is_axisymmetric
PetscBool is_axisymmetric
Definition: contact.cpp:93
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
scale
double scale
Definition: plastic.cpp:119
sdf.r
int r
Definition: sdf.py:8
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
double
MoFEM::GAUSS
@ GAUSS
Definition: FormsIntegrators.hpp:136
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
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: contact.cpp:100
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