v0.16.3
Loading...
Searching...
No Matches
ContactOps.hpp
Go to the documentation of this file.
1
2
3/**
4 * \file ContactOps.hpp
5 * \example mofem/tutorials/adv-1_contact/src/ContactOps.hpp
6 */
7
8#ifndef __CONTACTOPS_HPP__
9#define __CONTACTOPS_HPP__
10
11namespace ContactOps {
12
13/** Indices into CommonData::totalTractionAndArea. */
22
23//! [Common data]
24struct CommonData : public boost::enable_shared_from_this<CommonData> {
25 // MatrixDouble contactStress;
26 MatrixDouble contactTraction;
27 MatrixDouble contactDisp;
28 MatrixDouble contactDispGrad;
29
30 VectorDouble sdfVals; ///< size is equal to number of gauss points on element
31 MatrixDouble gradsSdf; ///< nb of rows is equals to number of gauss points on
32 ///< element, and nb of cols is equals to dimension
33 MatrixDouble hessSdf; ///< nb of rows is equals to nb of element of symmetric
34 ///< matrix, and nb of cols is equals to number of gauss
35 ///< points on element
36 VectorDouble constraintVals;
37
38 static SmartPetscObj<Vec>
39 totalTractionAndArea; // User have to release and create vector when appropiate.
40
41 static auto createTotalTraction(MoFEM::Interface &m_field) {
42 constexpr int ghosts[] = {TX, TY, TZ, AREA_ACTIVE, AREA_POTENTIAL};
43 totalTractionAndArea = createGhostVector(
44 m_field.get_comm(),
45
46 (m_field.get_comm_rank() == 0) ? LAST_TOTAL_TRACTION_AND_AREA : 0,
48
49 (m_field.get_comm_rank() == 0) ? 0 : LAST_TOTAL_TRACTION_AND_AREA,
50 ghosts);
52 }
53
56 const double *t_ptr;
58 "get array");
60 t_ptr[TX], t_ptr[TY], t_ptr[TZ], t_ptr[AREA_ACTIVE],
61 t_ptr[AREA_POTENTIAL]};
62 CHK_THROW_MESSAGE(VecRestoreArrayRead(CommonData::totalTractionAndArea, &t_ptr),
63 "restore array");
64 return t;
65 } else {
67 0., 0.};
68 }
69 }
70
71 inline auto contactTractionPtr() {
72 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
74 }
75
76 inline auto contactDispPtr() {
77 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &contactDisp);
78 }
79
80 inline auto contactDispGradPtr() {
81 return boost::shared_ptr<MatrixDouble>(shared_from_this(),
83 }
84
85 inline auto sdfPtr() {
86 return boost::shared_ptr<VectorDouble>(shared_from_this(), &sdfVals);
87 }
88
89 inline auto gradSdfPtr() {
90 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &gradsSdf);
91 }
92
93 inline auto hessSdfPtr() {
94 return boost::shared_ptr<MatrixDouble>(shared_from_this(), &hessSdf);
95 }
96
97 inline auto constraintPtr() {
98 return boost::shared_ptr<VectorDouble>(shared_from_this(), &constraintVals);
99 }
100};
101
102SmartPetscObj<Vec> CommonData::totalTractionAndArea;
103
104//! [Common data]
105
106//! [Surface distance function from python]
107#ifdef ENABLE_PYTHON_BINDING
108using MoFEM::SDFPython;
109static boost::weak_ptr<SDFPython> sdfPythonWeakPtr;
110#endif
111//! [Surface distance function from python]
112
113using SurfaceDistanceFunction = boost::function<VectorDouble(
114 double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords,
115 MatrixDouble &normals_at_pts, int block_id)>;
116
117using GradSurfaceDistanceFunction = boost::function<MatrixDouble(
118 double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords,
119 MatrixDouble &normals_at_pts, int block_id)>;
120
121using HessSurfaceDistanceFunction = boost::function<MatrixDouble(
122 double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords,
123 MatrixDouble &normals_at_pts, int block_id)>;
124
125inline VectorDouble surface_distance_function(double delta_t, double t,
126 int nb_gauss_pts,
127 MatrixDouble &m_spatial_coords,
128 MatrixDouble &m_normals_at_pts,
129 int block_id) {
130
131#ifdef ENABLE_PYTHON_BINDING
132 if (auto sdf_ptr = sdfPythonWeakPtr.lock()) {
133 VectorDouble values;
134 CHK_MOAB_THROW(sdf_ptr->evalSdf(delta_t, t, m_spatial_coords,
135 m_normals_at_pts, block_id, values),
136 "Failed Python SDF evaluation");
137 return values;
138 }
139#endif
140 VectorDouble v_sdf;
141 v_sdf.resize(nb_gauss_pts, false);
142 auto t_coords = getFTensor1FromPtr<3>(&m_spatial_coords(0, 0));
143
144 for (size_t gg = 0; gg < nb_gauss_pts; ++gg) {
145 v_sdf[gg] = -t_coords(2) - 0.1;
146 ++t_coords;
147 }
148
149 return v_sdf;
150}
151
152inline MatrixDouble
153grad_surface_distance_function(double delta_t, double t, int nb_gauss_pts,
154 MatrixDouble &m_spatial_coords,
155 MatrixDouble &m_normals_at_pts, int block_id) {
156#ifdef ENABLE_PYTHON_BINDING
157 if (auto sdf_ptr = sdfPythonWeakPtr.lock()) {
158 MatrixDouble values;
159 CHK_MOAB_THROW(sdf_ptr->evalGradSdf(delta_t, t, m_spatial_coords,
160 m_normals_at_pts, block_id, values),
161 "Failed Python SDF evaluation");
162 return values;
163 }
164#endif
165 MatrixDouble m_grad_sdf;
166 m_grad_sdf.resize(nb_gauss_pts, 3, false);
167 FTensor::Index<'i', 3> i;
168 FTensor::Tensor1<double, 3> t_grad_sdf_set{0.0, 0.0, -1.0};
169 auto t_grad_sdf = getFTensor1FromMat<3>(m_grad_sdf);
170
171 for (size_t gg = 0; gg < nb_gauss_pts; ++gg) {
172 t_grad_sdf(i) = t_grad_sdf_set(i);
173 ++t_grad_sdf;
174 }
175
176 return m_grad_sdf;
177}
178
179inline MatrixDouble
180hess_surface_distance_function(double delta_t, double t, int nb_gauss_pts,
181 MatrixDouble &m_spatial_coords,
182 MatrixDouble &m_normals_at_pts, int block_id) {
183#ifdef ENABLE_PYTHON_BINDING
184 if (auto sdf_ptr = sdfPythonWeakPtr.lock()) {
185 MatrixDouble values;
186 CHK_MOAB_THROW(sdf_ptr->evalHessSdf(delta_t, t, m_spatial_coords,
187 m_normals_at_pts, block_id, values),
188 "Failed Python SDF evaluation");
189 return values;
190 }
191#endif
192 MatrixDouble m_hess_sdf;
193 m_hess_sdf.resize(nb_gauss_pts, 6, false);
194 FTensor::Index<'i', 3> i;
195 FTensor::Index<'j', 3> j;
196 FTensor::Tensor2_symmetric<double, 3> t_hess_sdf_set{0., 0., 0., 0., 0., 0.};
197 auto t_hess_sdf = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
198
199 for (size_t gg = 0; gg < nb_gauss_pts; ++gg) {
200 t_hess_sdf(i, j) = t_hess_sdf_set(i, j);
201 ++t_hess_sdf;
202 }
203 return m_hess_sdf;
204}
205
206template <int DIM, IntegrationType I, typename BoundaryEleOp>
208
209template <int DIM, IntegrationType I, typename BoundaryEleOp>
211
212template <int DIM, IntegrationType I, typename BoundaryEleOp>
214
215template <int DIM, IntegrationType I, typename AssemblyBoundaryEleOp>
217
218template <int DIM, IntegrationType I, typename AssemblyBoundaryEleOp>
220
221template <int DIM, IntegrationType I, typename AssemblyBoundaryEleOp>
223
224template <typename T1, typename T2, int DIM1, int DIM2>
227 size_t nb_gauss_pts) {
228 MatrixDouble m_spatial_coords(nb_gauss_pts, 3);
229 m_spatial_coords.clear();
230 auto t_spatial_coords = getFTensor1FromPtr<3>(&m_spatial_coords(0, 0));
231 FTensor::Index<'i', DIM2> i;
232 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
233 t_spatial_coords(i) = t_coords(i) + t_disp(i);
234 ++t_spatial_coords;
235 ++t_coords;
236 ++t_disp;
237 }
238 return m_spatial_coords;
239}
240
241template <typename T1, int DIM1>
243 size_t nb_gauss_pts) {
244 MatrixDouble m_normals_at_pts(nb_gauss_pts, 3);
245 m_normals_at_pts.clear();
246 FTensor::Index<'i', DIM1> i;
247 auto t_set_normal = getFTensor1FromMat<3>(m_normals_at_pts);
248 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
249 t_set_normal(i) = t_normal_at_pts(i) / t_normal_at_pts.l2();
250 ++t_set_normal;
251 ++t_normal_at_pts;
252 }
253 return m_normals_at_pts;
254}
255
256template <int DIM, typename BoundaryEleOp>
258 : public BoundaryEleOp {
260 boost::shared_ptr<CommonData> common_data_ptr, double scale = 1,
261 bool is_axisymmetric = false);
262 MoFEMErrorCode doWork(int side, EntityType type, EntData &data);
263
264private:
265 boost::shared_ptr<CommonData> commonDataPtr;
266 const double scaleTraction;
268};
269
270template <int DIM, typename BoundaryEleOp>
272 : public BoundaryEleOp {
274 boost::shared_ptr<CommonData> common_data_ptr,
275 bool is_axisymmetric = false,
276 boost::shared_ptr<Range> contact_range_ptr = nullptr);
277 MoFEMErrorCode doWork(int side, EntityType type, EntData &data);
278
280 GradSurfaceDistanceFunction gradSurfaceDistanceFunction =
282
283private:
284 boost::shared_ptr<CommonData> commonDataPtr;
286 boost::shared_ptr<Range> contactRange;
287};
288
289template <int DIM, typename BoundaryEleOp>
290struct OpEvaluateSDFImpl<DIM, GAUSS, BoundaryEleOp> : public BoundaryEleOp {
291 OpEvaluateSDFImpl(boost::shared_ptr<CommonData> common_data_ptr);
292 MoFEMErrorCode doWork(int side, EntityType type, EntData &data);
293
294private:
295 boost::shared_ptr<CommonData> commonDataPtr;
296
298 GradSurfaceDistanceFunction gradSurfaceDistanceFunction =
300 HessSurfaceDistanceFunction hessSurfaceDistanceFunction =
302};
303
304template <int DIM, typename AssemblyBoundaryEleOp>
306 : public AssemblyBoundaryEleOp {
307 OpConstrainBoundaryRhsImpl(const std::string field_name,
308 boost::shared_ptr<CommonData> common_data_ptr,
309 bool is_axisymmetric = false);
310 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &data);
311
313 GradSurfaceDistanceFunction gradSurfaceDistanceFunction =
315
316private:
317 boost::shared_ptr<CommonData> commonDataPtr;
319};
320
321template <int DIM, typename AssemblyBoundaryEleOp>
323 : public AssemblyBoundaryEleOp {
324 OpConstrainBoundaryLhs_dUImpl(const std::string row_field_name,
325 const std::string col_field_name,
326 boost::shared_ptr<CommonData> common_data_ptr,
327 bool is_axisymmetric = false);
328 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
329 EntitiesFieldData::EntData &col_data);
330
332 GradSurfaceDistanceFunction gradSurfaceDistanceFunction =
334 HessSurfaceDistanceFunction hessSurfaceDistanceFunction =
336
337 boost::shared_ptr<CommonData> commonDataPtr;
339};
340
341template <int DIM, typename AssemblyBoundaryEleOp>
343 : public AssemblyBoundaryEleOp {
345 const std::string row_field_name, const std::string col_field_name,
346 boost::shared_ptr<CommonData> common_data_ptr,
347 bool is_axisymmetric = false);
348 MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data,
349 EntitiesFieldData::EntData &col_data);
350
352 GradSurfaceDistanceFunction gradSurfaceDistanceFunction =
354
355private:
356 boost::shared_ptr<CommonData> commonDataPtr;
358};
359
360template <typename BoundaryEleOp> struct ContactIntegrators {
361 template <int DIM, IntegrationType I>
364
365 template <int DIM, IntegrationType I>
368
369 template <int DIM, IntegrationType I>
371
372 template <AssemblyType A> struct Assembly {
373
375 typename FormsIntegrators<BoundaryEleOp>::template Assembly<A>::OpBase;
376
377 template <int DIM, IntegrationType I>
380
381 template <int DIM, IntegrationType I>
384
385 template <int DIM, IntegrationType I>
388 };
389};
390
391inline double sign(double x) {
392 constexpr auto eps = std::numeric_limits<float>::epsilon();
393 if (std::abs(x) < eps)
394 return 0;
395 else if (x > eps)
396 return 1;
397 else
398 return -1;
399};
400
401inline double w(const double sdf, const double tn) {
402 return sdf - cn_contact * tn;
403}
404
405/**
406 * @brief constrain function
407 *
408 * return 1 if negative sdf or positive tn
409 *
410 * @param sdf signed distance
411 * @param tn traction
412 * @return double
413 */
414inline double constrain(double sdf, double tn) {
415 const auto s = sign(w(sdf, tn));
416 return (1 - s) / 2;
417}
418
419template <int DIM, typename BoundaryEleOp>
422 boost::shared_ptr<CommonData> common_data_ptr, double scale,
423 bool is_axisymmetric)
425 commonDataPtr(common_data_ptr), scaleTraction(scale),
426 isAxisymmetric(is_axisymmetric) {}
427
428template <int DIM, typename BoundaryEleOp>
429MoFEMErrorCode
431 int side, EntityType type, EntData &data) {
433
434 FTensor::Index<'i', DIM> i;
435 FTensor::Tensor1<double, 3> t_sum_t{0., 0., 0.};
436
437 auto t_w = BoundaryEleOp::getFTensor0IntegrationWeight();
438 auto t_traction = getFTensor1FromMat<DIM>(commonDataPtr->contactTraction);
439 auto t_coords = BoundaryEleOp::getFTensor1CoordsAtGaussPts();
440
441 const auto nb_gauss_pts = BoundaryEleOp::getGaussPts().size2();
442 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
443 double jacobian = 1.;
444 if (isAxisymmetric) {
445 jacobian = 2. * M_PI * t_coords(0);
446 }
447 const double alpha = t_w * jacobian * BoundaryEleOp::getMeasure();
448 t_sum_t(i) += alpha * t_traction(i);
449 ++t_w;
450 ++t_traction;
451 ++t_coords;
452 }
453
454 t_sum_t(i) *= scaleTraction;
455
456 constexpr int ind[] = {TX, TY, TZ};
457 CHKERR VecSetValues(commonDataPtr->totalTractionAndArea, 3, ind, &t_sum_t(0),
458 ADD_VALUES);
459
461}
462template <int DIM, typename BoundaryEleOp>
465 boost::shared_ptr<CommonData> common_data_ptr, bool is_axisymmetric,
466 boost::shared_ptr<Range> contact_range_ptr)
468 commonDataPtr(common_data_ptr), isAxisymmetric(is_axisymmetric),
469 contactRange(contact_range_ptr) {}
470
471template <int DIM, typename BoundaryEleOp>
472MoFEMErrorCode
474 int side, EntityType type, EntData &data) {
476
477 auto fe_type = BoundaryEleOp::getFEType();
478
479 const auto fe_ent = BoundaryEleOp::getFEEntityHandle();
480
481 if (contactRange->find(fe_ent) != contactRange->end()) {
482 FTensor::Index<'i', DIM> i;
483 FTensor::Index<'j', DIM> j;
484 FTensor::Tensor1<double, 2> t_sum_a{0., 0.};
485
486 auto t_w = BoundaryEleOp::getFTensor0IntegrationWeight();
487 auto t_traction = getFTensor1FromMat<DIM>(commonDataPtr->contactTraction);
488 auto t_coords = BoundaryEleOp::getFTensor1CoordsAtGaussPts();
489
490 auto t_grad = getFTensor2FromMat<DIM, DIM>(commonDataPtr->contactDispGrad);
491 auto t_normal_at_pts = BoundaryEleOp::getFTensor1NormalsAtGaussPts();
492
493 const auto nb_gauss_pts = BoundaryEleOp::getGaussPts().size2();
494 auto m_spatial_coords = get_spatial_coords(
495 BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
496 getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
497 auto m_normals_at_pts = get_normalize_normals(
498 BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
499
500 auto ts_time = BoundaryEleOp::getTStime();
501 auto ts_time_step = BoundaryEleOp::getTStimeStep();
502 int block_id = 0;
503 auto v_sdf =
504 surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
505 m_spatial_coords, m_normals_at_pts, block_id);
506 auto m_grad_sdf = gradSurfaceDistanceFunction(
507 ts_time_step, ts_time, nb_gauss_pts, m_spatial_coords, m_normals_at_pts,
508 block_id);
509 auto t_sdf = getFTensor0FromVec(v_sdf);
510 auto t_grad_sdf = getFTensor1FromMat<3>(m_grad_sdf);
511 for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
512 double jacobian = 1.;
513 if (isAxisymmetric) {
514 jacobian = 2. * M_PI * t_coords(0); // Axisymmetric Jacobian
515 }
516 auto tn = -t_traction(i) * t_grad_sdf(i);
517 auto c = constrain(t_sdf, tn);
518 double alpha = t_w * jacobian;
519
522 FTensor::Tensor1<double, DIM> t_normal_current;
523
524 F(i, j) = t_grad(i, j) + kronecker_delta(i, j);
525 auto det = determinantTensor(F);
526 CHKERR invertTensor(F, det, invF);
527 t_normal_current(i) = det * (invF(j, i) * t_normal_at_pts(j));
528
529 alpha *= sqrt(t_normal_current(i) * t_normal_current(i));
530
531 if (fe_type == MBTRI) {
532 alpha /= 2;
533 }
534 if (c > 1e-12) {
535 t_sum_a(0) += alpha; // real area
536 }
537 t_sum_a(1) += alpha; // Potential area
538 ++t_w;
539 ++t_traction;
540 ++t_coords;
541 ++t_sdf;
542 ++t_grad_sdf;
543
544 ++t_grad;
545 ++t_normal_at_pts;
546 }
547 constexpr int ind[] = {AREA_ACTIVE, AREA_POTENTIAL};
548 CHKERR VecSetValues(commonDataPtr->totalTractionAndArea, 2, ind, &t_sum_a(0),
549 ADD_VALUES);
550 }
552}
553
554template <int DIM, typename BoundaryEleOp>
556 boost::shared_ptr<CommonData> common_data_ptr)
558 commonDataPtr(common_data_ptr) {}
559
560template <int DIM, typename BoundaryEleOp>
561MoFEMErrorCode
563 EntData &data) {
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}
644
645template <int DIM, typename AssemblyBoundaryEleOp>
648 boost::shared_ptr<CommonData> common_data_ptr,
649 bool is_axisymmetric)
651 AssemblyBoundaryEleOp::OPROW),
652 commonDataPtr(common_data_ptr), isAxisymmetric(is_axisymmetric) {}
653
654template <int DIM, typename AssemblyBoundaryEleOp>
655MoFEMErrorCode
657 EntitiesFieldData::EntData &data) {
659
660 FTensor::Index<'i', DIM> i;
661 FTensor::Index<'j', DIM> j;
662 FTensor::Index<'k', DIM> k;
663 FTensor::Index<'l', DIM> l;
664
665 const size_t nb_gauss_pts = AssemblyBoundaryEleOp::getGaussPts().size2();
666
667 auto &nf = AssemblyBoundaryEleOp::locF;
668
669 auto t_w = AssemblyBoundaryEleOp::getFTensor0IntegrationWeight();
670 auto t_disp = getFTensor1FromMat<DIM>(commonDataPtr->contactDisp);
671 auto t_traction = getFTensor1FromMat<DIM>(commonDataPtr->contactTraction);
672 auto t_coords = AssemblyBoundaryEleOp::getFTensor1CoordsAtGaussPts();
673
674 size_t nb_base_functions = data.getN().size2() / 3;
675 auto t_base = data.getFTensor1N<3>();
676
677 auto m_spatial_coords = get_spatial_coords(
678 BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
679 getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
680 auto m_normals_at_pts = get_normalize_normals(
681 BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
682
683 auto t_normal = getFTensor1FromMat<3>(m_normals_at_pts);
684
685 auto ts_time = AssemblyBoundaryEleOp::getTStime();
686 auto ts_time_step = AssemblyBoundaryEleOp::getTStimeStep();
687
688 // placeholder to pass boundary block id to python
689 int block_id = 0;
690
691 auto v_sdf =
692 surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
693 m_spatial_coords, m_normals_at_pts, block_id);
694
695 auto m_grad_sdf =
696 gradSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
697 m_spatial_coords, m_normals_at_pts, block_id);
698
699 auto t_sdf = getFTensor0FromVec(v_sdf);
700 auto t_grad_sdf = getFTensor1FromMat<3>(m_grad_sdf);
701
702 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
703
704 auto t_nf = getFTensor1FromPtr<DIM>(&nf[0]);
705
706 double jacobian = 1.;
707 if (isAxisymmetric) {
708 jacobian = 2. * M_PI * t_coords(0);
709 }
710 const double alpha = t_w * jacobian * AssemblyBoundaryEleOp::getMeasure();
711
712 auto tn = -t_traction(i) * t_grad_sdf(i);
713 auto c = constrain(t_sdf, tn);
714
716 t_cP(i, j) = (c * t_grad_sdf(i)) * t_grad_sdf(j);
718 t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
719
721 t_rhs(i) =
722
723 t_cQ(i, j) * (t_disp(j) - cn_contact * t_traction(j))
724
725 +
726
727 t_cP(i, j) * t_disp(j) +
728 c * (t_sdf * t_grad_sdf(i)); // add gap0 displacements
729
730 size_t bb = 0;
731 for (; bb != AssemblyBoundaryEleOp::nbRows / DIM; ++bb) {
732 const double beta = alpha * (t_base(i) * t_normal(i));
733 t_nf(i) -= beta * t_rhs(i);
734
735 ++t_nf;
736 ++t_base;
737 }
738 for (; bb < nb_base_functions; ++bb)
739 ++t_base;
740
741 ++t_disp;
742 ++t_traction;
743 ++t_coords;
744 ++t_w;
745 ++t_normal;
746 ++t_sdf;
747 ++t_grad_sdf;
748 }
749
751}
752
753template <int DIM, typename AssemblyBoundaryEleOp>
755 OpConstrainBoundaryLhs_dUImpl(const std::string row_field_name,
756 const std::string col_field_name,
757 boost::shared_ptr<CommonData> common_data_ptr,
758 bool is_axisymmetric)
759 : AssemblyBoundaryEleOp(row_field_name, col_field_name,
760 AssemblyBoundaryEleOp::OPROWCOL),
761 commonDataPtr(common_data_ptr), isAxisymmetric(is_axisymmetric) {
762 AssemblyBoundaryEleOp::sYmm = false;
763}
764
765template <int DIM, typename AssemblyBoundaryEleOp>
766MoFEMErrorCode
768 EntitiesFieldData::EntData &row_data,
769 EntitiesFieldData::EntData &col_data) {
771
772 FTensor::Index<'i', DIM> i;
773 FTensor::Index<'j', DIM> j;
774 FTensor::Index<'k', DIM> k;
775
776 const size_t nb_gauss_pts = AssemblyBoundaryEleOp::getGaussPts().size2();
777 auto &locMat = AssemblyBoundaryEleOp::locMat;
778
779 auto t_traction = getFTensor1FromMat<DIM>(commonDataPtr->contactTraction);
780 auto t_coords = AssemblyBoundaryEleOp::getFTensor1CoordsAtGaussPts();
781
782 auto t_w = AssemblyBoundaryEleOp::getFTensor0IntegrationWeight();
783 auto t_row_base = row_data.getFTensor1N<3>();
784 size_t nb_face_functions = row_data.getN().size2() / 3;
785
786 auto m_spatial_coords = get_spatial_coords(
787 BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
788 getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
789 auto m_normals_at_pts = get_normalize_normals(
790 BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
791
792 auto t_normal = getFTensor1FromMat<3>(m_normals_at_pts);
793
794 auto ts_time = AssemblyBoundaryEleOp::getTStime();
795 auto ts_time_step = AssemblyBoundaryEleOp::getTStimeStep();
796
797 // placeholder to pass boundary block id to python
798 int block_id = 0;
799
800 auto v_sdf =
801 surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
802 m_spatial_coords, m_normals_at_pts, block_id);
803
804 auto m_grad_sdf =
805 gradSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
806 m_spatial_coords, m_normals_at_pts, block_id);
807
808 auto m_hess_sdf =
809 hessSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
810 m_spatial_coords, m_normals_at_pts, block_id);
811
812 auto t_sdf = getFTensor0FromVec(v_sdf);
813 auto t_grad_sdf = getFTensor1FromMat<3>(m_grad_sdf);
814 auto t_hess_sdf = getFTensor2SymmetricFromMat<3>(m_hess_sdf);
815
816 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
817
818 double jacobian = 1.;
819 if (isAxisymmetric) {
820 jacobian = 2. * M_PI * t_coords(0);
821 }
822 const double alpha = t_w * jacobian * AssemblyBoundaryEleOp::getMeasure();
823
824 auto tn = -t_traction(i) * t_grad_sdf(i);
825 auto c = constrain(t_sdf, tn);
826
828 t_cP(i, j) = (c * t_grad_sdf(i)) * t_grad_sdf(j);
830 t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
831
833 t_res_dU(i, j) = kronecker_delta(i, j) + t_cP(i, j);
834
835 if (c > 0) {
836 t_res_dU(i, j) +=
837 (c * cn_contact) *
838 (t_hess_sdf(i, j) * (t_grad_sdf(k) * t_traction(k)) +
839 t_grad_sdf(i) * t_hess_sdf(k, j) * t_traction(k)) +
840 c * t_sdf * t_hess_sdf(i, j);
841 }
842
843 size_t rr = 0;
844 for (; rr != AssemblyBoundaryEleOp::nbRows / DIM; ++rr) {
845
846 auto t_mat = getFTensor2FromArray<DIM, DIM, DIM>(locMat, DIM * rr);
847
848 const double row_base = t_row_base(i) * t_normal(i);
849
850 auto t_col_base = col_data.getFTensor0N(gg, 0);
851 for (size_t cc = 0; cc != AssemblyBoundaryEleOp::nbCols / DIM; ++cc) {
852 const double beta = alpha * row_base * t_col_base;
853
854 t_mat(i, j) -= beta * t_res_dU(i, j);
855
856 ++t_col_base;
857 ++t_mat;
858 }
859
860 ++t_row_base;
861 }
862 for (; rr < nb_face_functions; ++rr)
863 ++t_row_base;
864
865 ++t_traction;
866 ++t_coords;
867 ++t_w;
868 ++t_normal;
869 ++t_sdf;
870 ++t_grad_sdf;
871 ++t_hess_sdf;
872 }
873
875}
876
877template <int DIM, typename AssemblyBoundaryEleOp>
880 const std::string row_field_name, const std::string col_field_name,
881 boost::shared_ptr<CommonData> common_data_ptr, bool is_axisymmetric)
882 : AssemblyBoundaryEleOp(row_field_name, col_field_name,
883 AssemblyBoundaryEleOp::OPROWCOL),
884 commonDataPtr(common_data_ptr), isAxisymmetric(is_axisymmetric) {
885 AssemblyBoundaryEleOp::sYmm = false;
886}
887
888template <int DIM, typename AssemblyBoundaryEleOp>
889MoFEMErrorCode
891 iNtegrate(EntitiesFieldData::EntData &row_data,
892 EntitiesFieldData::EntData &col_data) {
894
895 FTensor::Index<'i', DIM> i;
896 FTensor::Index<'j', DIM> j;
897 FTensor::Index<'k', DIM> k;
898
899 const size_t nb_gauss_pts = AssemblyBoundaryEleOp::getGaussPts().size2();
900 auto &locMat = AssemblyBoundaryEleOp::locMat;
901
902 auto t_traction = getFTensor1FromMat<DIM>(commonDataPtr->contactTraction);
903 auto t_coords = AssemblyBoundaryEleOp::getFTensor1CoordsAtGaussPts();
904
905 auto t_w = AssemblyBoundaryEleOp::getFTensor0IntegrationWeight();
906 auto t_row_base = row_data.getFTensor1N<3>();
907 size_t nb_face_functions = row_data.getN().size2() / 3;
908
909 auto m_spatial_coords = get_spatial_coords(
910 BoundaryEleOp::getFTensor1CoordsAtGaussPts(),
911 getFTensor1FromMat<DIM>(commonDataPtr->contactDisp), nb_gauss_pts);
912 auto m_normals_at_pts = get_normalize_normals(
913 BoundaryEleOp::getFTensor1NormalsAtGaussPts(), nb_gauss_pts);
914
915 auto t_normal = getFTensor1FromMat<3>(m_normals_at_pts);
916
917 auto ts_time = AssemblyBoundaryEleOp::getTStime();
918 auto ts_time_step = AssemblyBoundaryEleOp::getTStimeStep();
919
920 // placeholder to pass boundary block id to python
921 int block_id = 0;
922
923 auto v_sdf =
924 surfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
925 m_spatial_coords, m_normals_at_pts, block_id);
926
927 auto m_grad_sdf =
928 gradSurfaceDistanceFunction(ts_time_step, ts_time, nb_gauss_pts,
929 m_spatial_coords, m_normals_at_pts, block_id);
930
931 auto t_sdf = getFTensor0FromVec(v_sdf);
932 auto t_grad_sdf = getFTensor1FromMat<3>(m_grad_sdf);
933
934 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
935
936 double jacobian = 1.;
937 if (isAxisymmetric) {
938 jacobian = 2. * M_PI * t_coords(0);
939 }
940 const double alpha = t_w * jacobian * AssemblyBoundaryEleOp::getMeasure();
941
942 auto tn = -t_traction(i) * t_grad_sdf(i);
943 auto c = constrain(t_sdf, tn);
944
946 t_cP(i, j) = (c * t_grad_sdf(i)) * t_grad_sdf(j);
948 t_cQ(i, j) = kronecker_delta(i, j) - t_cP(i, j);
949
951 t_res_dt(i, j) = -cn_contact * t_cQ(i, j);
952
953 size_t rr = 0;
954 for (; rr != AssemblyBoundaryEleOp::nbRows / DIM; ++rr) {
955
956 auto t_mat = getFTensor2FromArray<DIM, DIM, DIM>(locMat, DIM * rr);
957 const double row_base = t_row_base(i) * t_normal(i);
958
959 auto t_col_base = col_data.getFTensor1N<3>(gg, 0);
960 for (size_t cc = 0; cc != AssemblyBoundaryEleOp::nbCols / DIM; ++cc) {
961 const double col_base = t_col_base(i) * t_normal(i);
962 const double beta = alpha * row_base * col_base;
963
964 t_mat(i, j) -= beta * t_res_dt(i, j);
965
966 ++t_col_base;
967 ++t_mat;
968 }
969
970 ++t_row_base;
971 }
972 for (; rr < nb_face_functions; ++rr)
973 ++t_row_base;
974
975 ++t_traction;
976 ++t_coords;
977 ++t_w;
978 ++t_normal;
979 ++t_sdf;
980 ++t_grad_sdf;
981 }
982
984}
985
986template <int DIM, AssemblyType A, IntegrationType I, typename DomainEleOp>
987MoFEMErrorCode opFactoryDomainRhs(
988 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
989 std::string sigma, std::string u, bool is_axisymmetric = false) {
991
992 using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
993 A>::template LinearForm<I>;
994 using OpMixDivURhs = typename B::template OpMixDivTimesU<3, DIM, DIM>;
995 using OpMixDivUCylRhs =
996 typename B::template OpMixDivTimesU<3, DIM, DIM, CYLINDRICAL>;
997
998 using OpMixLambdaGradURhs = typename B::template OpMixTensorTimesGradU<DIM>;
999 using OpMixUTimesDivLambdaRhs =
1000 typename B::template OpMixVecTimesDivLambda<SPACE_DIM>;
1001 using OpMixUTimesLambdaRhs =
1002 typename B::template OpGradTimesTensor<1, DIM, DIM>;
1003
1004 auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1005 auto mat_grad_ptr = boost::make_shared<MatrixDouble>();
1006 auto div_stress_ptr = boost::make_shared<MatrixDouble>();
1007 auto contact_stress_ptr = boost::make_shared<MatrixDouble>();
1008
1009 auto jacobian = [is_axisymmetric](const double r, const double,
1010 const double) {
1011 if (is_axisymmetric)
1012 return 2. * M_PI * r;
1013 else
1014 return 1.;
1015 };
1016
1017 pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1018 u, common_data_ptr->contactDispPtr()));
1019 pip.push_back(
1020 new OpCalculateHVecTensorField<DIM, DIM>(sigma, contact_stress_ptr));
1021
1022 if (!is_axisymmetric) {
1023 pip.push_back(
1024 new OpCalculateHVecTensorDivergence<DIM, DIM>(sigma, div_stress_ptr));
1025 } else {
1026 pip.push_back(new OpCalculateHVecTensorDivergence<DIM, DIM, CYLINDRICAL>(
1027 sigma, div_stress_ptr));
1028 }
1029
1030 pip.push_back(new OpCalculateVectorFieldGradient<DIM, DIM>(u, mat_grad_ptr));
1031
1032 if (!is_axisymmetric) {
1033 pip.push_back(
1034 new OpMixDivURhs(sigma, common_data_ptr->contactDispPtr(), jacobian));
1035 } else {
1036 pip.push_back(new OpMixDivUCylRhs(sigma, common_data_ptr->contactDispPtr(),
1037 jacobian));
1038 }
1039
1040 pip.push_back(new OpMixLambdaGradURhs(sigma, mat_grad_ptr, jacobian));
1041 pip.push_back(new OpMixUTimesDivLambdaRhs(u, div_stress_ptr, jacobian));
1042 pip.push_back(new OpMixUTimesLambdaRhs(u, contact_stress_ptr, jacobian));
1043
1045}
1046
1047template <typename OpMixLhs> struct OpMixLhsSide : public OpMixLhs {
1048 using OpMixLhs::OpMixLhs;
1049 MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type,
1050 EntityType col_type,
1051 EntitiesFieldData::EntData &row_data,
1052 EntitiesFieldData::EntData &col_data) {
1054 auto side_fe_entity = OpMixLhs::getSidePtrFE()->getFEEntityHandle();
1055 auto side_fe_data = OpMixLhs::getSideEntity(row_side, row_type);
1056 // Only assemble side which correspond to edge entity on boundary
1057 if (side_fe_entity == side_fe_data) {
1058 CHKERR OpMixLhs::doWork(row_side, col_side, row_type, col_type, row_data,
1059 col_data);
1060 }
1062 }
1063};
1064
1065template <int DIM, AssemblyType A, IntegrationType I, typename DomainEle>
1067 MoFEM::Interface &m_field,
1068 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
1069 std::string fe_domain_name, std::string sigma, std::string u,
1070 std::string geom, ForcesAndSourcesCore::RuleHookFun rule,
1071 bool is_axisymmetric = false) {
1073
1074 using DomainEleOp = typename DomainEle::UserDataOperator;
1075
1076 auto op_loop_side = new OpLoopSide<DomainEle>(
1077 m_field, fe_domain_name, DIM, Sev::noisy,
1078 boost::make_shared<ForcesAndSourcesCore::UserDataOperator::AdjCache>());
1079 pip.push_back(op_loop_side);
1080
1081 CHKERR AddHOOps<DIM, DIM, DIM>::add(op_loop_side->getOpPtrVector(),
1082 {H1, HDIV}, geom);
1083
1084 using B = typename FormsIntegrators<DomainEleOp>::template Assembly<
1085 A>::template BiLinearForm<I>;
1086
1087 using OpMixDivULhs = typename B::template OpMixDivTimesVec<DIM>;
1088 using OpMixDivUCylLhs =
1089 typename B::template OpMixDivTimesVec<DIM, CYLINDRICAL>;
1090 using OpLambdaGraULhs = typename B::template OpMixTensorTimesGrad<DIM>;
1091
1092 using OpMixDivULhsSide = OpMixLhsSide<OpMixDivULhs>;
1093 using OpMixDivUCylLhsSide = OpMixLhsSide<OpMixDivUCylLhs>;
1094 using OpLambdaGraULhsSide = OpMixLhsSide<OpLambdaGraULhs>;
1095
1096 auto unity = []() { return 1; };
1097 auto jacobian = [is_axisymmetric](const double r, const double,
1098 const double) {
1099 if (is_axisymmetric)
1100 return 2. * M_PI * r;
1101 else
1102 return 1.;
1103 };
1104
1105 if (!is_axisymmetric) {
1106 op_loop_side->getOpPtrVector().push_back(
1107 new OpMixDivULhsSide(sigma, u, unity, jacobian, true));
1108 } else {
1109 op_loop_side->getOpPtrVector().push_back(
1110 new OpMixDivUCylLhsSide(sigma, u, unity, jacobian, true));
1111 }
1112 op_loop_side->getOpPtrVector().push_back(
1113 new OpLambdaGraULhsSide(sigma, u, unity, jacobian, true));
1114
1115 op_loop_side->getSideFEPtr()->getRuleHook = rule;
1117}
1118
1119template <int DIM, AssemblyType A, IntegrationType I, typename BoundaryEleOp>
1121 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
1122 std::string sigma, std::string u, bool is_axisymmetric = false) {
1124
1126
1127 auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1128
1129 pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1130 u, common_data_ptr->contactDispPtr()));
1131 pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1132 sigma, common_data_ptr->contactTractionPtr()));
1133 pip.push_back(
1134 new typename C::template Assembly<A>::template OpConstrainBoundaryLhs_dU<
1135 DIM, GAUSS>(sigma, u, common_data_ptr, is_axisymmetric));
1136 pip.push_back(new typename C::template Assembly<A>::
1137 template OpConstrainBoundaryLhs_dTraction<DIM, GAUSS>(
1138 sigma, sigma, common_data_ptr, is_axisymmetric));
1139
1141}
1142
1143template <int DIM, AssemblyType A, IntegrationType I, typename BoundaryEleOp>
1145 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
1146 std::string sigma, std::string u, bool is_axisymmetric = false) {
1148
1150
1151 auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1152
1153 pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1154 u, common_data_ptr->contactDispPtr()));
1155 pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1156 sigma, common_data_ptr->contactTractionPtr()));
1157 pip.push_back(
1158 new typename C::template Assembly<A>::template OpConstrainBoundaryRhs<
1159 DIM, GAUSS>(sigma, common_data_ptr, is_axisymmetric));
1160
1162}
1163
1164template <int DIM, IntegrationType I, typename BoundaryEleOp>
1166 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
1167 std::string sigma, bool is_axisymmetric = false) {
1169
1171
1172 auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1173 pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1174 sigma, common_data_ptr->contactTractionPtr()));
1175 pip.push_back(new typename C::template OpAssembleTotalContactTraction<DIM, I>(
1176 common_data_ptr, 1. / scale, is_axisymmetric));
1177
1179}
1180
1181template <int DIM, IntegrationType I, typename BoundaryEleOp>
1183 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
1184 OpLoopSide<SideEle> *op_loop_side, std::string sigma, std::string u,
1185 bool is_axisymmetric = false,
1186 boost::shared_ptr<Range> contact_range_ptr = nullptr) {
1189
1190 auto common_data_ptr = boost::make_shared<ContactOps::CommonData>();
1191
1192 op_loop_side->getOpPtrVector().push_back(
1193 new OpCalculateVectorFieldGradient<SPACE_DIM, SPACE_DIM>(
1194 "U", common_data_ptr->contactDispGradPtr()));
1195
1196 if (contact_range_ptr) {
1197 pip.push_back(new OpCalculateVectorFieldValues<DIM>(
1198 u, common_data_ptr->contactDispPtr()));
1199 pip.push_back(new OpCalculateHVecTensorTrace<DIM, BoundaryEleOp>(
1200 sigma, common_data_ptr->contactTractionPtr()));
1201 pip.push_back(op_loop_side);
1202 pip.push_back(new typename C::template OpAssembleTotalContactArea<DIM, I>(
1203 common_data_ptr, is_axisymmetric, contact_range_ptr));
1204 }
1206}
1207
1208}; // namespace ContactOps
1209
1210#endif // __CONTACTOPS_HPP__
int w
Free node.
Vec t
Removal: the ring edge.
SmartPetscObj< Mat > C
std::string type
SmartPetscObj< Mat > jacobian
SmartPetscObj< Vec > values
static const double eps
PetscBool is_axisymmetric
Definition contact.cpp:84
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
@ NOSPACE
Definition definitions.h:83
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
@ F
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
constexpr int DIM2
Definition level_set.cpp:22
constexpr int DIM1
Definition level_set.cpp:21
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
boost::function< MatrixDouble(double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords, MatrixDouble &normals_at_pts, int block_id)> GradSurfaceDistanceFunction
MoFEMErrorCode opFactoryDomainRhs(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, std::string u, bool is_axisymmetric=false)
auto get_normalize_normals(FTensor::Tensor1< T1, DIM1 > &&t_normal_at_pts, size_t nb_gauss_pts)
double cn_contact
Definition contact.cpp:88
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)
@ LAST_TOTAL_TRACTION_AND_AREA
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)
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)
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)
MoFEMErrorCode opFactoryBoundaryRhs(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, std::string u, bool is_axisymmetric=false)
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
boost::function< MatrixDouble(double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords, MatrixDouble &normals_at_pts, int block_id)> HessSurfaceDistanceFunction
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)
boost::function< VectorDouble(double delta_t, double t, int nb_gauss_pts, MatrixDouble &spatial_coords, MatrixDouble &normals_at_pts, int block_id)> SurfaceDistanceFunction
[Common data]
MoFEMErrorCode opFactoryBoundaryLhs(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, std::string u, bool is_axisymmetric=false)
MoFEMErrorCode opFactoryCalculateTraction(boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string sigma, bool is_axisymmetric=false)
double sign(double x)
Definition sdf.py:1
FormsIntegrators< DomainEleOp >::Assembly< A >::LinearForm< I >::OpGradTimesTensor< 1, FIELD_DIM, SPACE_DIM > OpGradTimesTensor
constexpr AssemblyType A
double scale
Definition plastic.cpp:124
constexpr auto field_name
MatrixDouble contactDispGrad
MatrixDouble contactDisp
static auto getFTensor1TotalTraction()
VectorDouble constraintVals
static SmartPetscObj< Vec > totalTractionAndArea
MatrixDouble contactTraction
static auto createTotalTraction(MoFEM::Interface &m_field)
VectorDouble sdfVals
size is equal to number of gauss points on element
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
virtual MPI_Comm & get_comm() const =0
virtual int get_comm_rank() const =0
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)