19 using namespace MoFEM;
20 using namespace boost::numeric;
34 gaussPtsMaster.resize(3, nb_gauss_pts,
false);
35 gaussPtsSlave.resize(3, nb_gauss_pts,
false);
36 double xy_coords[2 * nb_gauss_pts];
37 double w_array[nb_gauss_pts];
40 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
41 gaussPtsMaster(0, gg) = xy_coords[gg * 2];
42 gaussPtsMaster(1, gg) = xy_coords[gg * 2 + 1];
43 gaussPtsMaster(2, gg) = w_array[gg];
44 gaussPtsSlave(0, gg) = xy_coords[gg * 2];
45 gaussPtsSlave(1, gg) = xy_coords[gg * 2 + 1];
46 gaussPtsSlave(2, gg) = w_array[gg];
54 template <
bool CONVECT_MASTER>
59 auto get_material_dofs_from_coords = [&]() {
61 materialCoords.resize(18,
false);
64 CHKERR fePtr->mField.get_moab().get_connectivity(fePtr->getFEEntityHandle(),
65 conn, num_nodes,
true);
66 CHKERR fePtr->mField.get_moab().get_coords(conn, 6,
67 &*materialCoords.data().begin());
68 CHKERR fePtr->getNodeData(materialPositionsField, materialCoords,
false);
72 auto get_dofs_data_for_slave_and_master = [&] {
73 slaveSpatialCoords.resize(3, 3,
false);
74 slaveMaterialCoords.resize(3, 3,
false);
75 masterSpatialCoords.resize(3, 3,
false);
76 masterMaterialCoords.resize(3, 3,
false);
77 for (
size_t n = 0;
n != 3; ++
n) {
78 for (
size_t d = 0;
d != 3; ++
d) {
79 masterSpatialCoords(
n,
d) = spatialCoords(3 *
n +
d);
80 slaveSpatialCoords(
n,
d) = spatialCoords(3 * (
n + 3) +
d);
81 masterMaterialCoords(
n,
d) = materialCoords(3 *
n +
d);
82 slaveMaterialCoords(
n,
d) = materialCoords(3 * (
n + 3) +
d);
87 auto calculate_shape_base_functions = [&](
const int nb_gauss_pts) {
89 if (nb_gauss_pts != fePtr->gaussPtsMaster.size2())
92 "Inconsistent size of slave and master integration points (%d != %d)",
93 nb_gauss_pts, fePtr->gaussPtsMaster.size2());
94 slaveN.resize(nb_gauss_pts, 3,
false);
95 masterN.resize(nb_gauss_pts, 3,
false);
97 &fePtr->gaussPtsSlave(1, 0), nb_gauss_pts);
99 &fePtr->gaussPtsMaster(1, 0), nb_gauss_pts);
105 return diffKsiMaster;
114 return diffKsiMaster;
117 auto get_slave_material_coords = [&]() ->
MatrixDouble & {
119 return slaveMaterialCoords;
121 return masterMaterialCoords;
126 return fePtr->gaussPtsMaster;
128 return fePtr->gaussPtsSlave;
131 auto get_slave_spatial_coords = [&]() ->
MatrixDouble & {
133 return slaveSpatialCoords;
135 return masterSpatialCoords;
138 auto get_master_spatial_coords = [&]() ->
MatrixDouble & {
140 return masterSpatialCoords;
142 return slaveSpatialCoords;
159 auto convect_points = [get_diff_ksi_master, get_diff_ksi_slave,
160 get_slave_material_coords, get_master_gauss_pts,
161 get_slave_spatial_coords, get_master_spatial_coords,
162 get_slave_n, get_master_n](
const int nb_gauss_pts) {
171 &inv_matA(0, 0), &inv_matA(0, 1), &inv_matA(1, 0), &inv_matA(1, 1));
173 auto get_t_coords = [](
auto &
m) {
175 &
m(0, 0), &
m(0, 1), &
m(0, 2)};
178 auto get_t_xi = [](
auto &
m) {
183 auto get_t_diff = []() {
188 auto get_t_tau = []() {
193 auto get_t_x = []() {
198 auto get_t_F = [&]() {
202 auto get_t_A = [&](
auto &
m) {
204 &
m(0, 0), &
m(0, 1), &
m(1, 0), &
m(1, 1)};
207 auto get_diff_ksi = [](
auto &
m,
const int gg) {
209 &
m(0, gg), &
m(1, gg), &
m(2, gg), &
m(3, gg), &
m(4, gg), &
m(5, gg));
218 get_diff_ksi_master().resize(6, 3 * nb_gauss_pts,
false);
219 get_diff_ksi_slave().resize(6, 3 * nb_gauss_pts,
false);
221 auto t_xi_master = get_t_xi(get_master_gauss_pts());
222 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
224 auto t_tau = get_t_tau();
225 auto t_x_slave = get_t_x();
226 auto t_x_master = get_t_x();
227 auto t_mat = get_t_A(
A);
228 auto t_f = get_t_F();
230 auto newton_solver = [&]() {
231 auto get_values = [&]() {
236 auto t_slave_material_coords =
237 get_t_coords(get_slave_material_coords());
238 auto t_slave_spatial_coords =
239 get_t_coords(get_slave_spatial_coords());
240 auto t_master_spatial_coords =
241 get_t_coords(get_master_spatial_coords());
242 double *slave_base = &get_slave_n()(gg, 0);
243 double *master_base = &get_master_n()(gg, 0);
244 auto t_diff = get_t_diff();
245 for (
size_t n = 0;
n != 3; ++
n) {
247 t_tau(
i,
J) += t_diff(
J) * t_slave_material_coords(
i);
248 t_x_slave(
i) += (*slave_base) * t_slave_spatial_coords(
i);
249 t_x_master(
i) += (*master_base) * t_master_spatial_coords(
i);
252 ++t_slave_material_coords;
253 ++t_slave_spatial_coords;
254 ++t_master_spatial_coords;
260 auto assemble = [&]() {
262 auto t_master_spatial_coords =
263 get_t_coords(get_master_spatial_coords());
264 auto t_diff = get_t_diff();
265 for (
size_t n = 0;
n != 3; ++
n) {
266 t_mat(
I,
J) += t_diff(
J) * t_tau(
i,
I) * t_master_spatial_coords(
i);
268 ++t_master_spatial_coords;
270 t_f(
I) = t_tau(
i,
I) * (t_x_slave(
i) - t_x_master(
i));
273 auto update = [&]() {
274 t_xi_master(
I) += t_f(
I);
275 get_master_n()(gg, 0) =
277 get_master_n()(gg, 1) =
279 get_master_n()(gg, 2) =
290 auto linear_solver = [&]() {
291 invert_2_by_2(inv_matA,
A);
292 t_copy_F(
J) = t_f(
J);
293 t_f(
I) = t_inv_matA(
I,
J) * t_copy_F(
J);
296 auto invert_A = [&]() { invert_2_by_2(invA,
A); };
298 auto nonlinear_solve = [&]() {
299 constexpr
double tol = 1e-12;
300 constexpr
int max_it = 10;
313 }
while (
eps >
tol && (it++) < max_it);
321 auto get_diff_slave = [&]() {
322 auto t_inv_A = get_t_A(invA);
323 auto t_diff_xi_slave = get_diff_ksi(get_diff_ksi_slave(), 3 * gg);
324 double *slave_base = &get_slave_n()(gg, 0);
325 for (
size_t n = 0;
n != 3; ++
n) {
326 t_diff_xi_slave(
I,
i) = t_inv_A(
I,
J) * t_tau(
i,
J) * (*slave_base);
332 auto get_diff_master = [&]() {
333 auto t_inv_A = get_t_A(invA);
334 auto t_diff_xi_master = get_diff_ksi(get_diff_ksi_master(), 3 * gg);
335 auto t_diff = get_t_diff();
336 double *master_base = &get_master_n()(gg, 0);
338 t_diff_A(
I,
J,
K,
L) = -t_inv_A(
I,
K) * t_inv_A(
L,
J);
339 for (
size_t n = 0;
n != 3; ++
n) {
340 t_diff_xi_master(
I,
i) =
341 (t_diff_A(
I,
J,
K,
L) * (t_f(
J) * t_diff(
L))) * t_tau(
i,
K) -
342 t_inv_A(
I,
J) * t_tau(
i,
J) * (*master_base);
359 const int nb_gauss_pts = fePtr->gaussPtsSlave.size2();
360 CHKERR fePtr->getNodeData(sparialPositionsField, spatialCoords);
361 CHKERR get_material_dofs_from_coords();
362 get_dofs_data_for_slave_and_master();
363 CHKERR calculate_shape_base_functions(nb_gauss_pts);
364 convect_points(nb_gauss_pts);
373 CHKERR convectPtr->convectSlaveIntegrationPts<
true>();
381 CHKERR convectPtr->convectSlaveIntegrationPts<
false>();
392 if (
type != MBVERTEX)
401 const double *normal_slave_ptr = &getNormalSlave()[0];
403 commonDataSimpleContact->normalVectorSlavePtr.get()->resize(3);
404 commonDataSimpleContact->normalVectorSlavePtr.get()->clear();
407 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
409 for (
int ii = 0; ii != 3; ++ii)
410 t_normal(ii) = normal_slave_ptr[ii];
412 const double normal_length = sqrt(t_normal(
i) * t_normal(
i));
413 t_normal(
i) = t_normal(
i) / normal_length;
415 commonDataSimpleContact->areaSlave = 0.5 * normal_length;
428 if (
type != MBVERTEX)
437 const double *normal_master_ptr = &getNormalMaster()[0];
438 commonDataSimpleContact->normalVectorMasterPtr.get()->resize(3);
439 commonDataSimpleContact->normalVectorMasterPtr.get()->clear();
442 get_tensor_vec(commonDataSimpleContact->normalVectorMasterPtr.get()[0]);
443 for (
int ii = 0; ii != 3; ++ii)
444 t_normal(ii) = normal_master_ptr[ii];
446 const double normal_length = sqrt(t_normal(
i) * t_normal(
i));
447 t_normal(
i) = t_normal(
i) / normal_length;
448 commonDataSimpleContact->areaMaster = 0.5 * normal_length;
461 const int nb_gauss_pts = data.
getN().size1();
463 if (
type == MBVERTEX) {
464 commonDataSimpleContact->positionAtGaussPtsMasterPtr.get()->resize(
465 3, nb_gauss_pts,
false);
467 commonDataSimpleContact->positionAtGaussPtsMasterPtr.get()->clear();
470 auto t_position_master = getFTensor1FromMat<3>(
471 *commonDataSimpleContact->positionAtGaussPtsMasterPtr);
477 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
484 for (
int bb = 0; bb != nb_base_fun_col; ++bb) {
485 t_position_master(
i) += t_base_master * t_field_data_master(
i);
488 ++t_field_data_master;
505 const int nb_gauss_pts = data.
getN().size1();
507 auto t_new_spat_pos_master = getFTensor1FromMat<3>(
508 *commonDataSimpleContact->positionAtGaussPtsMasterPtr);
514 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
521 for (
int bb = 0; bb != nb_base_fun_col; ++bb) {
522 t_new_spat_pos_master(
i) -= t_base_master * t_field_data_master(
i);
525 ++t_field_data_master;
527 ++t_new_spat_pos_master;
542 const int nb_gauss_pts = data.
getN().size1();
544 auto t_new_spat_pos_master = getFTensor1FromMat<3>(
545 *commonDataSimpleContact->positionAtGaussPtsMasterPtr);
551 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
558 for (
int bb = 0; bb != nb_base_fun_col; ++bb) {
559 t_new_spat_pos_master(
i) += t_base_master * t_field_data_master(
i);
562 ++t_field_data_master;
564 ++t_new_spat_pos_master;
578 const int nb_gauss_pts = data.
getN().size1();
580 if (
type == MBVERTEX) {
581 commonDataSimpleContact->positionAtGaussPtsSlavePtr.get()->resize(
582 3, nb_gauss_pts,
false);
584 commonDataSimpleContact->positionAtGaussPtsSlavePtr.get()->clear();
587 auto t_position_slave = getFTensor1FromMat<3>(
588 *commonDataSimpleContact->positionAtGaussPtsSlavePtr);
594 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
601 for (
int bb = 0; bb != nb_base_fun_col; ++bb) {
602 t_position_slave(
i) += t_base_slave * t_field_data_slave(
i);
605 ++t_field_data_slave;
621 const int nb_gauss_pts = data.
getN().size1();
623 auto t_new_spat_pos_slave = getFTensor1FromMat<3>(
624 *commonDataSimpleContact->positionAtGaussPtsSlavePtr);
630 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
637 for (
int bb = 0; bb != nb_base_fun_col; ++bb) {
638 t_new_spat_pos_slave(
i) -= t_base_slave * t_field_data_slave(
i);
641 ++t_field_data_slave;
643 ++t_new_spat_pos_slave;
658 const int nb_gauss_pts = data.
getN().size1();
660 auto t_new_spat_pos_slave = getFTensor1FromMat<3>(
661 *commonDataSimpleContact->positionAtGaussPtsSlavePtr);
667 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
674 for (
int bb = 0; bb != nb_base_fun_col; ++bb) {
675 t_new_spat_pos_slave(
i) += t_base_slave * t_field_data_slave(
i);
678 ++t_field_data_slave;
680 ++t_new_spat_pos_slave;
694 if (
type != MBVERTEX)
701 const int nb_gauss_pts = data.
getN().size1();
703 commonDataSimpleContact->gapPtr.get()->resize(nb_gauss_pts);
704 commonDataSimpleContact->gapPtr.get()->clear();
708 auto t_position_master_gp = getFTensor1FromMat<3>(
709 *commonDataSimpleContact->positionAtGaussPtsMasterPtr);
710 auto t_position_slave_gp = getFTensor1FromMat<3>(
711 *commonDataSimpleContact->positionAtGaussPtsSlavePtr);
715 auto t_normal_at_gp =
716 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
718 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
720 t_normal_at_gp(
i) * (t_position_slave_gp(
i) - t_position_master_gp(
i));
721 ++t_position_slave_gp;
722 ++t_position_master_gp;
736 const int nb_gauss_pts = data.
getN().size1();
738 if (
type == MBVERTEX) {
739 commonDataSimpleContact->lagMultAtGaussPtsPtr.get()->resize(nb_gauss_pts);
740 commonDataSimpleContact->lagMultAtGaussPtsPtr.get()->clear();
745 auto t_lagrange_slave =
748 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
752 for (
int bb = 0; bb != nb_base_fun_row; ++bb) {
753 t_lagrange_slave += t_base_lambda * t_field_data_slave;
755 ++t_field_data_slave;
770 if (
type != MBVERTEX)
777 const int nb_gauss_pts = data.
getN().size1();
779 commonDataSimpleContact->augmentedLambdasPtr.get()->resize(nb_gauss_pts);
780 commonDataSimpleContact->augmentedLambdasPtr.get()->clear();
784 auto t_aug_lambda_ptr =
789 auto t_lagrange_slave =
792 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
793 t_aug_lambda_ptr += t_lagrange_slave + cN * t_gap_ptr;
804 doWork(
int row_side,
int col_side, EntityType row_type, EntityType col_type,
810 const int nb_row = row_data.
getIndices().size();
811 const int nb_col = col_data.
getIndices().size();
813 if (nb_row && nb_col) {
814 const int nb_gauss_pts = row_data.
getN().size1();
816 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
819 const double area_master =
820 commonDataSimpleContact->areaSlave;
822 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
833 NN.resize(3 * nb_base_fun_row, nb_base_fun_col,
false);
837 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr.get()));
839 auto t_w = getFTensor0IntegrationWeightSlave();
841 auto t_aug_lambda_ptr =
844 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
846 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
851 double val_m = t_w * area_master;
854 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
855 auto t_assemble_m = get_tensor_from_mat(NN, 3 * bbr, 0);
857 const double m = val_m * t_base_master;
858 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
859 const double n =
m * t_base_lambda;
860 t_assemble_m(
i) +=
n * const_unit_n(
i);
879 int row_side,
int col_side, EntityType row_type, EntityType col_type,
885 const int nb_row = row_data.
getIndices().size();
886 const int nb_col = col_data.
getIndices().size();
888 if (nb_row && nb_col) {
889 const int nb_gauss_pts = row_data.
getN().size1();
891 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
894 const double area_slave =
895 commonDataSimpleContact->areaSlave;
897 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
908 NN.resize(3 * nb_base_fun_row, nb_base_fun_col,
false);
912 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr.get()));
914 auto t_w = getFTensor0IntegrationWeightSlave();
916 auto t_aug_lambda_ptr =
919 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
921 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
927 double val_m = t_w * area_slave;
930 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
931 auto t_assemble_m = get_tensor_from_mat(NN, 3 * bbr, 0);
933 const double m = val_m * t_base_master;
934 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
935 const double n =
m * t_base_lambda;
936 t_assemble_m(
i) -=
n * const_unit_n(
i);
954 int row_side,
int col_side, EntityType row_type, EntityType col_type,
958 const int nb_row = row_data.
getIndices().size();
959 const int nb_col = col_data.
getIndices().size();
961 if (nb_row && nb_col) {
962 const int nb_gauss_pts = row_data.
getN().size1();
963 const double area_slave =
964 commonDataSimpleContact->areaSlave;
966 NN.resize(nb_row, nb_col,
false);
969 auto t_lagrange_slave =
971 auto t_w = getFTensor0IntegrationWeightSlave();
973 auto t_aug_lambda_ptr =
976 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
978 if (t_aug_lambda_ptr <= 0) {
985 const double val_s = -t_w * area_slave / cN;
988 &*NN.data().begin());
991 for (
int bbr = 0; bbr != nb_row; ++bbr) {
993 const double s = val_s * t_base_lambda_row;
994 for (
int bbc = 0; bbc != nb_col; ++bbc) {
996 t_mat += s * t_base_lambda_col;
1001 ++t_base_lambda_row;
1017 int row_side,
int col_side, EntityType row_type, EntityType col_type,
1021 const int nb_row = row_data.
getIndices().size();
1022 const int nb_col = col_data.
getIndices().size();
1024 if (nb_row && nb_col) {
1026 const int nb_gauss_pts = row_data.
getN().size1();
1028 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
1030 const double area_master =
1031 commonDataSimpleContact->areaSlave;
1033 const double area_slave =
1034 commonDataSimpleContact->areaSlave;
1036 NN.resize(nb_base_fun_row, 3 * nb_base_fun_col,
false);
1045 auto t_const_unit_n =
1046 get_tensor_from_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
1048 auto t_const_unit_master =
1049 get_tensor_from_vec(*(commonDataSimpleContact->normalVectorMasterPtr));
1051 auto t_aug_lambda_ptr =
1054 auto t_w = getFTensor0IntegrationWeightSlave();
1055 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1057 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
1063 const double val_m = t_w * area_slave;
1066 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
1070 &NN(bbr, 0), &NN(bbr, 1), &NN(bbr, 2)};
1071 const double m = val_m * t_base_lambda;
1073 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
1075 t_mat(
i) += t_const_unit_n(
i) *
m * t_base_master;
1096 int row_side,
int col_side, EntityType row_type, EntityType col_type,
1100 const int nb_row = row_data.
getIndices().size();
1101 const int nb_col = col_data.
getIndices().size();
1103 if (nb_row && nb_col) {
1105 const int nb_gauss_pts = row_data.
getN().size1();
1107 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
1109 const double area_slave =
1110 commonDataSimpleContact->areaSlave;
1112 NN.resize(nb_base_fun_row, 3 * nb_base_fun_col,
false);
1121 auto t_const_unit_n =
1122 get_tensor_from_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
1124 auto t_aug_lambda_ptr =
1127 auto t_w = getFTensor0IntegrationWeightSlave();
1128 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1130 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
1136 const double val_m = t_w * area_slave;
1139 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
1143 &NN(bbr, 0), &NN(bbr, 1), &NN(bbr, 2)};
1144 const double m = val_m * t_base_lambda;
1146 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
1148 t_mat(
i) -= t_const_unit_n(
i) *
m * t_base_slave;
1169 doWork(
int row_side,
int col_side, EntityType row_type, EntityType col_type,
1176 const int nb_row = row_data.
getIndices().size();
1179 const int nb_col = col_data.
getIndices().size();
1182 const int nb_gauss_pts = row_data.
getN().size1();
1184 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
1185 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
1187 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
1189 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
1190 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
1201 NN.resize(3 * nb_base_fun_row, 3 * nb_base_fun_col,
false);
1204 auto t_w = getFTensor0IntegrationWeightSlave();
1206 const double area_master = commonDataSimpleContact->areaSlave;
1209 get_tensor_vec(commonDataSimpleContact->normalVectorSlavePtr.get()[0]);
1211 auto t_aug_lambda_ptr =
1214 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
1216 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
1222 const double val_m = t_w * area_master * cN;
1226 for (
int bbc = 0; bbc != nb_base_fun_col; bbc++) {
1229 const double m = val_m * t_base_master_col;
1231 for (
int bbr = 0; bbr != nb_base_fun_row; bbr++) {
1233 auto t_assemble_s = get_tensor_from_mat(NN, 3 * bbr, 3 * bbc);
1235 t_assemble_s(
i,
j) +=
m * normal(
i) * normal(
j) * t_base_master_row;
1237 ++t_base_master_row;
1239 ++t_base_master_col;
1253 doWork(
int row_side,
int col_side, EntityType row_type, EntityType col_type,
1260 const int nb_row = row_data.
getIndices().size();
1263 const int nb_col = col_data.
getIndices().size();
1266 const int nb_gauss_pts = row_data.
getN().size1();
1268 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
1269 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
1271 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
1273 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
1274 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
1285 NN.resize(3 * nb_base_fun_row, 3 * nb_base_fun_col,
false);
1288 auto t_w = getFTensor0IntegrationWeightSlave();
1290 const double area_master = commonDataSimpleContact->areaSlave;
1293 get_tensor_vec(commonDataSimpleContact->normalVectorSlavePtr.get()[0]);
1295 auto t_aug_lambda_ptr =
1298 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
1300 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
1306 const double val_m = t_w * area_master * cN;
1310 for (
int bbc = 0; bbc != nb_base_fun_col; bbc++) {
1313 const double m = val_m * t_base_slave_col;
1315 for (
int bbr = 0; bbr != nb_base_fun_row; bbr++) {
1317 auto t_assemble_s = get_tensor_from_mat(NN, 3 * bbr, 3 * bbc);
1319 t_assemble_s(
i,
j) -=
m * normal(
i) * normal(
j) * t_base_master_row;
1321 ++t_base_master_row;
1337 doWork(
int row_side,
int col_side, EntityType row_type, EntityType col_type,
1344 const int nb_row = row_data.
getIndices().size();
1347 const int nb_col = col_data.
getIndices().size();
1350 const int nb_gauss_pts = row_data.
getN().size1();
1352 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
1353 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
1355 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
1357 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
1358 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
1369 NN.resize(3 * nb_base_fun_row, 3 * nb_base_fun_col,
false);
1372 auto t_w = getFTensor0IntegrationWeightSlave();
1374 const double area_slave = commonDataSimpleContact->areaSlave;
1377 get_tensor_vec(commonDataSimpleContact->normalVectorSlavePtr.get()[0]);
1379 auto t_aug_lambda_ptr =
1382 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
1384 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
1390 const double val_s = t_w * area_slave * cN;
1394 for (
int bbc = 0; bbc != nb_base_fun_col; bbc++) {
1397 const double s = val_s * t_base_slave_col;
1399 for (
int bbr = 0; bbr != nb_base_fun_row; bbr++) {
1401 auto t_assemble_s = get_tensor_from_mat(NN, 3 * bbr, 3 * bbc);
1403 t_assemble_s(
i,
j) += s * normal(
i) * normal(
j) * t_base_slave_row;
1421 doWork(
int row_side,
int col_side, EntityType row_type, EntityType col_type,
1428 const int nb_row = row_data.
getIndices().size();
1431 const int nb_col = col_data.
getIndices().size();
1434 const int nb_gauss_pts = row_data.
getN().size1();
1436 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
1437 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
1439 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
1441 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
1442 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
1453 NN.resize(3 * nb_base_fun_row, 3 * nb_base_fun_col,
false);
1456 auto t_w = getFTensor0IntegrationWeightSlave();
1458 const double area_slave = commonDataSimpleContact->areaSlave;
1461 get_tensor_vec(commonDataSimpleContact->normalVectorSlavePtr.get()[0]);
1463 auto t_aug_lambda_ptr =
1466 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
1468 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
1474 const double val_s = t_w * area_slave * cN;
1478 for (
int bbc = 0; bbc != nb_base_fun_col; bbc++) {
1481 const double s = val_s * t_base_master_col;
1483 for (
int bbr = 0; bbr != nb_base_fun_row; bbr++) {
1485 auto t_assemble_s = get_tensor_from_mat(NN, 3 * bbr, 3 * bbc);
1487 t_assemble_s(
i,
j) -= s * normal(
i) * normal(
j) * t_base_slave_row;
1491 ++t_base_master_col;
1507 if (
type != MBVERTEX)
1510 const int nb_gauss_pts = data.
getN().size1();
1512 commonDataSimpleContact->lagGapProdPtr.get()->resize(nb_gauss_pts);
1513 commonDataSimpleContact->lagGapProdPtr.get()->clear();
1517 auto t_lagrange_slave =
1520 auto t_lag_gap_prod_slave =
1525 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1526 t_lag_gap_prod_slave += t_gap_ptr * t_lagrange_slave;
1528 ++t_lag_gap_prod_slave;
1539 const int nb_dofs = data.
getIndices().size();
1542 const int nb_gauss_pts = data.
getN().size1();
1543 int nb_base_fun_col = nb_dofs / 3;
1545 vecF.resize(nb_dofs,
false);
1548 const double area_m =
1549 commonDataSimpleContact->areaMaster;
1557 auto t_lagrange_slave =
1560 auto t_const_unit_n = get_tensor_vec(
1561 commonDataSimpleContact->normalVectorSlavePtr.get()[0], 0);
1563 auto t_w = getFTensor0IntegrationWeightMaster();
1565 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1567 double val_m = t_w * area_m;
1571 &vecF[0], &vecF[1], &vecF[2]};
1573 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
1574 const double m = val_m * t_base_master * t_lagrange_slave;
1575 t_assemble_m(
i) -=
m * t_const_unit_n(
i);
1593 const int nb_dofs = data.
getIndices().size();
1596 const int nb_gauss_pts = data.
getN().size1();
1597 int nb_base_fun_col = nb_dofs / 3;
1599 vecF.resize(nb_dofs,
false);
1602 const double area_m = commonDataSimpleContact->areaSlave;
1610 auto t_lagrange_slave =
1613 auto t_const_unit_n = get_tensor_vec(
1614 commonDataSimpleContact->normalVectorSlavePtr.get()[0], 0);
1616 auto t_w = getFTensor0IntegrationWeightSlave();
1618 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1620 double val_m = t_w * area_m;
1624 &vecF[0], &vecF[1], &vecF[2]};
1626 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
1627 const double m = val_m * t_base_slave * t_lagrange_slave;
1628 t_assemble_m(
i) +=
m * t_const_unit_n(
i);
1650 const int nb_gauss_pts = data.
getN().size1();
1653 const double area_s =
1654 commonDataSimpleContact->areaSlave;
1656 vecR.resize(nb_base_fun_col,
false);
1659 auto t_lagrange_slave =
1662 auto t_w = getFTensor0IntegrationWeightSlave();
1663 const double cn_value = *cNPtr.get();
1664 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1665 const double val_s = t_w * area_s *
1667 cn_value, t_gap_gp, t_lagrange_slave);
1669 for (
int bbr = 0; bbr != nb_base_fun_col; ++bbr) {
1670 vecR[bbr] += val_s * t_base_lambda;
1692 const int nb_gauss_pts = data.
getN().size1();
1695 const double area_s =
1696 commonDataSimpleContact->areaSlave;
1698 vecR.resize(nb_base_fun_col,
false);
1701 auto t_lagrange_slave =
1704 auto t_w = getFTensor0IntegrationWeightSlave();
1706 auto t_aug_lambda_ptr =
1709 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1712 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
1713 branch_gg = -t_lagrange_slave / cN;
1715 branch_gg = t_gap_gp;
1718 const double val_s = t_w * area_s * branch_gg;
1720 for (
int bbr = 0; bbr != nb_base_fun_col; ++bbr) {
1721 vecR[bbr] += val_s * t_base_lambda;
1739 int row_side,
int col_side, EntityType row_type, EntityType col_type,
1745 const int nb_row = row_data.
getIndices().size();
1746 const int nb_col = col_data.
getIndices().size();
1748 if (nb_row && nb_col) {
1749 const int nb_gauss_pts = row_data.
getN().size1();
1751 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
1754 const double area_master =
1755 commonDataSimpleContact->areaMaster;
1757 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
1768 NN.resize(3 * nb_base_fun_row, nb_base_fun_col,
false);
1772 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr.get()));
1774 auto t_w = getFTensor0IntegrationWeightMaster();
1776 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1778 double val_m = t_w * area_master;
1781 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
1782 auto t_assemble_m = get_tensor_from_mat(NN, 3 * bbr, 0);
1784 const double m = val_m * t_base_master;
1785 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
1786 const double n =
m * t_base_lambda;
1787 t_assemble_m(
i) -=
n * const_unit_n(
i);
1810 const int nb_dofs = data.
getIndices().size();
1812 const int nb_gauss_pts = data.
getN().size1();
1815 vecF.resize(nb_dofs,
false);
1818 const double area_s =
1819 commonDataSimpleContact->areaSlave;
1827 auto const_unit_n = get_tensor_vec(
1828 commonDataSimpleContact->normalVectorSlavePtr.get()[0], 0);
1830 auto t_w = getFTensor0IntegrationWeightSlave();
1831 auto t_aug_lambda_ptr =
1834 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1835 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
1840 const double val_s = t_w * area_s;
1844 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
1846 auto t_assemble_s = get_tensor_vec(vecF, 3 * bbc);
1849 val_s * const_unit_n(
i) * t_aug_lambda_ptr * t_base_slave;
1869 const int nb_dofs = data.
getIndices().size();
1872 const int nb_gauss_pts = data.
getN().size1();
1873 const int nb_base_fun_col = data.
getFieldData().size() / 3;
1875 vecF.resize(nb_dofs,
1882 const double area_m =
1883 commonDataSimpleContact->areaSlave;
1891 auto const_unit_n = get_tensor_vec(
1892 commonDataSimpleContact->normalVectorSlavePtr.get()[0], 0);
1894 auto t_w = getFTensor0IntegrationWeightSlave();
1895 auto t_aug_lambda_ptr =
1898 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1899 if (t_aug_lambda_ptr > 0 && std::abs(t_aug_lambda_ptr) > ALM_TOL) {
1904 const double val_m = t_w * area_m;
1908 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
1910 auto t_assemble_m = get_tensor_vec(vecF, 3 * bbc);
1913 val_m * const_unit_n(
i) * t_aug_lambda_ptr * t_base_master;
1928 int row_side,
int col_side, EntityType row_type, EntityType col_type,
1934 const int nb_row = row_data.
getIndices().size();
1935 const int nb_col = col_data.
getIndices().size();
1937 if (nb_row && nb_col) {
1938 const int nb_gauss_pts = row_data.
getN().size1();
1940 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
1943 const double area_slave =
1944 commonDataSimpleContact->areaSlave;
1946 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
1957 NN.resize(3 * nb_base_fun_row, nb_base_fun_col,
false);
1961 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr.get()));
1963 auto t_w = getFTensor0IntegrationWeightSlave();
1965 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1967 double val_m = t_w * area_slave;
1970 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
1971 auto t_assemble_m = get_tensor_from_mat(NN, 3 * bbr, 0);
1973 const double m = val_m * t_base_master;
1974 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
1975 const double n =
m * t_base_lambda;
1976 t_assemble_m(
i) +=
n * const_unit_n(
i);
1993 int row_side,
int col_side, EntityType row_type, EntityType col_type,
1997 const int nb_row = row_data.
getIndices().size();
1998 const int nb_col = col_data.
getIndices().size();
2000 if (nb_row && nb_col) {
2001 const int nb_gauss_pts = row_data.
getN().size1();
2002 const double area_slave =
2003 commonDataSimpleContact->areaSlave;
2005 NN.resize(nb_row, nb_col,
false);
2008 auto t_lagrange_slave =
2011 auto t_w = getFTensor0IntegrationWeightSlave();
2012 const double cn_value = *cNPtr.get();
2014 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
2016 cn_value, t_gap_gp, t_lagrange_slave) *
2020 &*NN.data().begin());
2023 for (
int bbr = 0; bbr != nb_row; ++bbr) {
2025 const double s = val_s * t_base_lambda_row;
2026 for (
int bbc = 0; bbc != nb_col; ++bbc) {
2028 t_mat += s * t_base_lambda_col;
2031 ++t_base_lambda_col;
2033 ++t_base_lambda_row;
2050 int row_side,
int col_side, EntityType row_type, EntityType col_type,
2054 const int nb_row = row_data.
getIndices().size();
2055 const int nb_col = col_data.
getIndices().size();
2057 if (nb_row && nb_col) {
2059 const int nb_gauss_pts = row_data.
getN().size1();
2061 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
2063 const double area_master =
2064 commonDataSimpleContact->areaSlave;
2066 const double area_slave =
2067 commonDataSimpleContact->areaSlave;
2069 NN.resize(nb_base_fun_row, 3 * nb_base_fun_col,
false);
2078 auto t_const_unit_n =
2079 get_tensor_from_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
2081 auto t_const_unit_master =
2082 get_tensor_from_vec(*(commonDataSimpleContact->normalVectorMasterPtr));
2084 auto t_lagrange_slave =
2088 auto t_w = getFTensor0IntegrationWeightSlave();
2089 const double cn_value = *cNPtr.get();
2091 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
2093 cn_value, t_gap_gp, t_lagrange_slave) *
2097 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
2101 &NN(bbr, 0), &NN(bbr, 1), &NN(bbr, 2)};
2102 const double m = val_m * t_base_lambda;
2104 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
2106 t_mat(
i) += t_const_unit_n(
i) *
m * t_base_master;
2128 int row_side,
int col_side, EntityType row_type, EntityType col_type,
2132 const int nb_row = row_data.
getIndices().size();
2133 const int nb_col = col_data.
getIndices().size();
2135 if (nb_row && nb_col) {
2137 const int nb_gauss_pts = row_data.
getN().size1();
2139 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
2141 const double area_slave =
2142 commonDataSimpleContact->areaSlave;
2144 NN.resize(nb_base_fun_row, 3 * nb_base_fun_col,
false);
2153 auto t_lagrange_slave =
2157 auto t_const_unit_n =
2158 get_tensor_from_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
2160 auto t_w = getFTensor0IntegrationWeightSlave();
2161 const double cn_value = *cNPtr.get();
2162 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
2164 cn_value, t_gap_gp, t_lagrange_slave) *
2168 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
2172 &NN(bbr, 0), &NN(bbr, 1), &NN(bbr, 2)};
2173 const double m = val_m * t_base_lambda;
2175 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
2177 t_mat(
i) -= t_const_unit_n(
i) *
m * t_base_slave;
2202 if (
type != MBVERTEX)
2207 if (stateTagSide == MASTER_SIDE) {
2208 CHKERR mField.get_moab().side_element(prism_ent, 2, 3, tri_ent);
2210 if (stateTagSide == SLAVE_SIDE) {
2211 CHKERR mField.get_moab().side_element(prism_ent, 2, 4, tri_ent);
2217 int nb_gauss_pts = data.
getN().size1();
2219 double def_val = 0.;
2222 CHKERR moabOut.tag_get_handle(
"GAP", 1, MB_TYPE_DOUBLE, th_gap,
2223 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
2226 CHKERR moabOut.tag_get_handle(
"LAGMULT", 1, MB_TYPE_DOUBLE, th_lag_mult,
2227 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
2229 Tag th_lag_gap_prod;
2230 CHKERR moabOut.tag_get_handle(
"LAG_GAP_PROD", 1, MB_TYPE_DOUBLE,
2231 th_lag_gap_prod, MB_TAG_CREAT | MB_TAG_SPARSE,
2234 int def_val_int = 0;
2237 CHKERR moabOut.tag_get_handle(
"STATE", 1, MB_TYPE_INTEGER, th_state,
2238 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val_int);
2241 if (stateTagSide > 0) {
2242 CHKERR mField.get_moab().tag_get_handle(
2243 "STATE", 1, MB_TYPE_INTEGER, th_state_side,
2244 MB_TAG_CREAT | MB_TAG_SPARSE, &def_val_int);
2247 auto get_tag_pos = [&](
const std::string name) {
2249 constexpr std::array<double, 3> def_vals = {0, 0, 0};
2250 CHKERR moabOut.tag_get_handle(name.c_str(), 3, MB_TYPE_DOUBLE,
th,
2251 MB_TAG_CREAT | MB_TAG_SPARSE,
2255 auto th_pos_master = get_tag_pos(
"MASTER_SPATIAL_POSITION");
2256 auto th_pos_slave = get_tag_pos(
"SLAVE_SPATIAL_POSITION");
2257 auto th_master_coords = get_tag_pos(
"MASTER_GAUSS_PTS_COORDS");
2264 auto t_lagrange_slave =
2266 auto t_lag_gap_prod_slave =
2268 auto t_position_master = getFTensor1FromMat<3>(
2269 *commonDataSimpleContact->positionAtGaussPtsMasterPtr);
2270 auto t_position_slave = getFTensor1FromMat<3>(
2271 *commonDataSimpleContact->positionAtGaussPtsSlavePtr);
2273 auto get_ftensor_coords_at_gauss_pts_slave = [&](
auto &coords_at_gauss_pts) {
2274 auto ptr = &*coords_at_gauss_pts.data().begin();
2278 auto t_coords_at_gauss_pts_slave =
2279 get_ftensor_coords_at_gauss_pts_slave(getCoordsAtGaussPtsSlave());
2280 auto t_coords_at_gauss_pts_master =
2281 get_ftensor_coords_at_gauss_pts_slave(getCoordsAtGaussPtsMaster());
2286 auto set_float_precision = [](
const double x) {
2287 if (std::abs(x) < std::numeric_limits<float>::epsilon())
2293 std::array<double, 3> pos_vec;
2295 auto get_vec_ptr = [&](
auto t) {
2296 for (
int dd = 0;
dd != 3; ++
dd)
2297 pos_vec[
dd] = set_float_precision(
t(
dd));
2298 return pos_vec.data();
2301 int count_active_pts = 0;
2303 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
2306 if (t_state_ptr > 0.5) {
2311 bool output_at_gauss_pts =
true;
2312 if (!postProcSurface.empty()) {
2314 CHKERR mField.get_moab().get_adjacencies(
2315 &prism_ent, 1, 2,
false, tri_ents, moab::Interface::UNION);
2316 tri_ents = tri_ents.subset_by_type(MBTRI);
2317 if (intersect(postProcSurface, tri_ents).empty())
2318 output_at_gauss_pts =
false;
2321 if (output_at_gauss_pts) {
2322 CHKERR moabOut.create_vertex(get_vec_ptr(t_coords_at_gauss_pts_slave),
2325 double gap_vtk = set_float_precision(t_gap_ptr);
2326 CHKERR moabOut.tag_set_data(th_gap, &new_vertex, 1, &gap_vtk);
2328 double lag_gap_prod_vtk = set_float_precision(t_lag_gap_prod_slave);
2329 CHKERR moabOut.tag_set_data(th_lag_gap_prod, &new_vertex, 1,
2332 double lagrange_slave_vtk = set_float_precision(t_lagrange_slave);
2333 CHKERR moabOut.tag_set_data(th_lag_mult, &new_vertex, 1,
2334 &lagrange_slave_vtk);
2336 CHKERR moabOut.tag_set_data(th_state, &new_vertex, 1, &state);
2338 CHKERR moabOut.tag_set_data(th_pos_master, &new_vertex, 1,
2339 get_vec_ptr(t_position_master));
2340 CHKERR moabOut.tag_set_data(th_pos_slave, &new_vertex, 1,
2341 get_vec_ptr(t_position_slave));
2343 CHKERR moabOut.tag_set_data(th_master_coords, &new_vertex, 1,
2344 get_vec_ptr(t_coords_at_gauss_pts_master));
2349 ++t_lag_gap_prod_slave;
2350 ++t_position_master;
2352 ++t_coords_at_gauss_pts_slave;
2353 ++t_coords_at_gauss_pts_master;
2357 if (stateTagSide > 0) {
2359 if (count_active_pts >= nb_gauss_pts / 2) {
2362 CHKERR mField.get_moab().tag_set_data(th_state_side, &tri_ent, 1,
2374 if (
type != MBVERTEX)
2380 int nb_gauss_pts = data.
getN().size1();
2384 auto t_lagrange_slave =
2387 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
2388 const double d_lambda =
2389 std::abs(t_lagrange_slave) < TOL ? 0.0 : t_lagrange_slave;
2390 d_gap = std::abs(t_gap_ptr) < TOL ? 0.0 : t_gap_ptr;
2391 mySplit << d_lambda <<
" " << d_gap <<
" " << std::endl;
2400 boost::shared_ptr<SimpleContactElement> fe_rhs_simple_contact,
2401 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
2402 string field_name,
string lagrange_field_name,
bool is_alm,
2403 bool is_eigen_pos_field,
string eigen_pos_field_name,
2404 bool use_reference_coordinates) {
2408 "MESH_NODE_POSITIONS", common_data_simple_contact));
2411 "MESH_NODE_POSITIONS", common_data_simple_contact));
2413 fe_rhs_simple_contact->getOpPtrVector().push_back(
2415 common_data_simple_contact));
2417 fe_rhs_simple_contact->getOpPtrVector().push_back(
2420 if (is_eigen_pos_field) {
2421 fe_rhs_simple_contact->getOpPtrVector().push_back(
2423 eigen_pos_field_name, common_data_simple_contact));
2425 fe_rhs_simple_contact->getOpPtrVector().push_back(
2427 eigen_pos_field_name, common_data_simple_contact));
2428 if (use_reference_coordinates) {
2429 fe_rhs_simple_contact->getOpPtrVector().push_back(
2431 common_data_simple_contact));
2433 fe_rhs_simple_contact->getOpPtrVector().push_back(
2435 common_data_simple_contact));
2439 fe_rhs_simple_contact->getOpPtrVector().push_back(
2442 fe_rhs_simple_contact->getOpPtrVector().push_back(
2444 common_data_simple_contact));
2447 lagrange_field_name, common_data_simple_contact, cnValue, is_alm));
2450 fe_rhs_simple_contact->getOpPtrVector().push_back(
2452 common_data_simple_contact));
2455 lagrange_field_name, common_data_simple_contact, cnValuePtr));
2457 fe_rhs_simple_contact->getOpPtrVector().push_back(
2461 fe_rhs_simple_contact->getOpPtrVector().push_back(
2463 common_data_simple_contact));
2465 fe_rhs_simple_contact->getOpPtrVector().push_back(
2467 common_data_simple_contact, cnValue));
2474 boost::shared_ptr<SimpleContactElement> fe_rhs_simple_contact,
2475 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
2476 string field_name,
string lagrange_field_name,
bool is_alm,
2477 bool is_eigen_pos_field,
string eigen_pos_field_name,
2478 bool use_reference_coordinates) {
2482 "MESH_NODE_POSITIONS", common_data_simple_contact));
2485 "MESH_NODE_POSITIONS", common_data_simple_contact));
2487 fe_rhs_simple_contact->getOpPtrVector().push_back(
2489 common_data_simple_contact));
2492 fe_rhs_simple_contact->getOpPtrVector().push_back(
2494 common_data_simple_contact));
2497 fe_rhs_simple_contact->getOpPtrVector().push_back(
2499 common_data_simple_contact));
2501 fe_rhs_simple_contact->getOpPtrVector().push_back(
2503 common_data_simple_contact));
2505 if (is_eigen_pos_field) {
2506 fe_rhs_simple_contact->getOpPtrVector().push_back(
2508 eigen_pos_field_name, common_data_simple_contact));
2510 fe_rhs_simple_contact->getOpPtrVector().push_back(
2512 eigen_pos_field_name, common_data_simple_contact));
2514 if (use_reference_coordinates) {
2515 fe_rhs_simple_contact->getOpPtrVector().push_back(
2517 "MESH_NODE_POSITIONS", common_data_simple_contact));
2519 fe_rhs_simple_contact->getOpPtrVector().push_back(
2521 common_data_simple_contact));
2525 fe_rhs_simple_contact->getOpPtrVector().push_back(
2528 fe_rhs_simple_contact->getOpPtrVector().push_back(
2532 fe_rhs_simple_contact->getOpPtrVector().push_back(
2534 common_data_simple_contact));
2541 boost::shared_ptr<SimpleContactElement> fe_lhs_simple_contact,
2542 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
2543 string field_name,
string lagrange_field_name,
bool is_alm,
2544 bool is_eigen_pos_field,
string eigen_pos_field_name,
2545 bool use_reference_coordinates) {
2548 fe_lhs_simple_contact->getOpPtrVector().push_back(
2550 common_data_simple_contact));
2553 "MESH_NODE_POSITIONS", common_data_simple_contact));
2556 "MESH_NODE_POSITIONS", common_data_simple_contact));
2558 fe_lhs_simple_contact->getOpPtrVector().push_back(
2561 if (is_eigen_pos_field) {
2562 fe_lhs_simple_contact->getOpPtrVector().push_back(
2564 eigen_pos_field_name, common_data_simple_contact));
2566 fe_lhs_simple_contact->getOpPtrVector().push_back(
2568 eigen_pos_field_name, common_data_simple_contact));
2570 if (use_reference_coordinates) {
2571 fe_lhs_simple_contact->getOpPtrVector().push_back(
2573 common_data_simple_contact));
2575 fe_lhs_simple_contact->getOpPtrVector().push_back(
2577 common_data_simple_contact));
2581 fe_lhs_simple_contact->getOpPtrVector().push_back(
2584 fe_lhs_simple_contact->getOpPtrVector().push_back(
2586 common_data_simple_contact));
2588 fe_lhs_simple_contact->getOpPtrVector().push_back(
2590 field_name, lagrange_field_name, common_data_simple_contact));
2592 fe_lhs_simple_contact->getOpPtrVector().push_back(
2594 lagrange_field_name, common_data_simple_contact, cnValuePtr));
2596 fe_lhs_simple_contact->getOpPtrVector().push_back(
2598 lagrange_field_name,
field_name, common_data_simple_contact,
2601 fe_lhs_simple_contact->getOpPtrVector().push_back(
2603 lagrange_field_name,
field_name, common_data_simple_contact,
2606 fe_lhs_simple_contact->getOpPtrVector().push_back(
2610 fe_lhs_simple_contact->getOpPtrVector().push_back(
2612 field_name, lagrange_field_name, common_data_simple_contact));
2614 fe_lhs_simple_contact->getOpPtrVector().push_back(
2618 fe_lhs_simple_contact->getOpPtrVector().push_back(
2622 fe_lhs_simple_contact->getOpPtrVector().push_back(
2624 lagrange_field_name, common_data_simple_contact, cnValue));
2626 fe_lhs_simple_contact->getOpPtrVector().push_back(
2628 field_name, lagrange_field_name, common_data_simple_contact,
2631 fe_lhs_simple_contact->getOpPtrVector().push_back(
2633 field_name, lagrange_field_name, common_data_simple_contact,
2641 boost::shared_ptr<SimpleContactElement> fe_lhs_simple_contact,
2642 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
2643 string field_name,
string lagrange_field_name,
bool is_alm,
2644 bool is_eigen_pos_field,
string eigen_pos_field_name,
2645 bool use_reference_coordinates) {
2649 "MESH_NODE_POSITIONS", common_data_simple_contact));
2652 "MESH_NODE_POSITIONS", common_data_simple_contact));
2654 fe_lhs_simple_contact->getOpPtrVector().push_back(
2656 common_data_simple_contact));
2658 fe_lhs_simple_contact->getOpPtrVector().push_back(
2660 field_name, lagrange_field_name, common_data_simple_contact));
2663 fe_lhs_simple_contact->getOpPtrVector().push_back(
2665 common_data_simple_contact));
2667 fe_lhs_simple_contact->getOpPtrVector().push_back(
2669 common_data_simple_contact));
2671 if (is_eigen_pos_field) {
2672 fe_lhs_simple_contact->getOpPtrVector().push_back(
2674 eigen_pos_field_name, common_data_simple_contact));
2676 fe_lhs_simple_contact->getOpPtrVector().push_back(
2678 eigen_pos_field_name, common_data_simple_contact));
2679 if (use_reference_coordinates) {
2680 fe_lhs_simple_contact->getOpPtrVector().push_back(
2682 "MESH_NODE_POSITIONS", common_data_simple_contact));
2684 fe_lhs_simple_contact->getOpPtrVector().push_back(
2686 common_data_simple_contact));
2690 fe_lhs_simple_contact->getOpPtrVector().push_back(
2693 fe_lhs_simple_contact->getOpPtrVector().push_back(
2697 fe_lhs_simple_contact->getOpPtrVector().push_back(
2699 field_name, lagrange_field_name, common_data_simple_contact));
2701 fe_lhs_simple_contact->getOpPtrVector().push_back(
2705 fe_lhs_simple_contact->getOpPtrVector().push_back(
2714 boost::shared_ptr<ConvectMasterContactElement> fe_lhs_simple_contact,
2715 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
2716 string field_name,
string lagrange_field_name,
bool is_alm,
2717 bool is_eigen_pos_field,
string eigen_pos_field_name,
2718 bool use_reference_coordinates) {
2720 CHKERR setContactOperatorsLhs(
2721 boost::dynamic_pointer_cast<SimpleContactElement>(fe_lhs_simple_contact),
2722 common_data_simple_contact,
field_name, lagrange_field_name, is_alm,
2723 is_eigen_pos_field, eigen_pos_field_name);
2725 fe_lhs_simple_contact->getOpPtrVector().push_back(
2728 fe_lhs_simple_contact->getOpPtrVector().push_back(
2730 lagrange_field_name,
field_name, common_data_simple_contact,
2731 cnValuePtr, ContactOp::FACESLAVESLAVE,
2732 fe_lhs_simple_contact->getConvectPtr()->getDiffKsiSpatialSlave()));
2734 fe_lhs_simple_contact->getOpPtrVector().push_back(
2736 lagrange_field_name,
field_name, common_data_simple_contact,
2737 cnValuePtr, ContactOp::FACESLAVEMASTER,
2738 fe_lhs_simple_contact->getConvectPtr()->getDiffKsiSpatialMaster()));
2744 boost::shared_ptr<ConvectSlaveContactElement> fe_lhs_simple_contact,
2745 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
2746 string field_name,
string lagrange_field_name,
bool is_alm,
2747 bool is_eigen_pos_field,
string eigen_pos_field_name,
2748 bool use_reference_coordinates) {
2751 CHKERR setMasterForceOperatorsLhs(
2752 boost::dynamic_pointer_cast<SimpleContactElement>(fe_lhs_simple_contact),
2753 common_data_simple_contact,
field_name, lagrange_field_name);
2756 lagrange_field_name, common_data_simple_contact));
2758 fe_lhs_simple_contact->getOpPtrVector().push_back(
2761 ContactOp::FACEMASTERSLAVE,
2762 fe_lhs_simple_contact->getConvectPtr()->getDiffKsiSpatialSlave()));
2764 fe_lhs_simple_contact->getOpPtrVector().push_back(
2767 ContactOp::FACEMASTERMASTER,
2768 fe_lhs_simple_contact->getConvectPtr()->getDiffKsiSpatialMaster()));
2773 boost::shared_ptr<SimpleContactElement> fe_post_proc_simple_contact,
2774 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
2777 string eigen_pos_field_name,
bool use_reference_coordinates,
2781 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2783 common_data_simple_contact));
2785 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2787 common_data_simple_contact));
2789 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2791 common_data_simple_contact));
2793 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2796 if (is_eigen_pos_field) {
2797 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2799 eigen_pos_field_name, common_data_simple_contact));
2801 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2803 eigen_pos_field_name, common_data_simple_contact));
2804 if (use_reference_coordinates) {
2805 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2807 common_data_simple_contact));
2809 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2811 common_data_simple_contact));
2815 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2818 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2820 common_data_simple_contact));
2822 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2824 common_data_simple_contact));
2826 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2828 cnValue, alm_flag));
2830 fe_post_proc_simple_contact->getOpPtrVector().push_back(
2832 moab_out, state_tag_side));
2834 fe_post_proc_simple_contact->getOpPtrVector().push_back(
new OpGetContactArea(
2835 lagrange_field_name, common_data_simple_contact, cnValue, alm_flag));
2845 const int nb_integration_pts = getGaussPtsSlave().size2();
2846 auto &xi_grad_mat = *(commonDataSimpleContact->gradKsiLambdaAtGaussPtsPtr);
2847 xi_grad_mat.resize(2, nb_integration_pts,
false);
2848 if (
type == MBVERTEX)
2849 xi_grad_mat.clear();
2855 auto t_diff_lambda_xi = getFTensor1FromMat<2>(xi_grad_mat);
2857 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
2860 for (
size_t bb = 0; bb != nb_dofs; ++bb) {
2861 t_diff_lambda_xi(
I) += t_diff_base(
I) * t_data;
2874 int row_side,
int col_side, EntityType row_type, EntityType col_type,
2878 const int nb_row_dofs = row_data.
getIndices().size();
2879 const int nb_col_dofs = col_data.
getIndices().size();
2880 if (nb_row_dofs && (nb_col_dofs && col_type == MBVERTEX)) {
2882 const int nb_gauss_pts = getGaussPtsSlave().size2();
2883 int nb_base_fun_row = nb_row_dofs / 3;
2884 int nb_base_fun_col = nb_col_dofs / 3;
2886 matLhs.resize(nb_row_dofs, nb_col_dofs,
false);
2889 const double area_s =
2890 commonDataSimpleContact->areaSlave;
2900 auto t_const_unit_n =
2901 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
2902 auto t_diff_lambda_xi = getFTensor1FromMat<2>(
2903 *(commonDataSimpleContact->gradKsiLambdaAtGaussPtsPtr));
2904 auto t_w = getFTensor0IntegrationWeightSlave();
2906 auto get_diff_ksi = [](
auto &
m,
auto gg) {
2908 &
m(0, gg), &
m(1, gg), &
m(2, gg), &
m(3, gg), &
m(4, gg), &
m(5, gg));
2913 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
2915 double val_s = t_w * area_s;
2918 for (
int rr = 0; rr != nb_base_fun_row; ++rr) {
2921 &matLhs(3 * rr + 0, 0), &matLhs(3 * rr + 0, 1),
2922 &matLhs(3 * rr + 0, 2),
2924 &matLhs(3 * rr + 1, 0), &matLhs(3 * rr + 1, 1),
2925 &matLhs(3 * rr + 1, 2),
2927 &matLhs(3 * rr + 2, 0), &matLhs(3 * rr + 2, 1),
2928 &matLhs(3 * rr + 2, 2)};
2930 auto t_diff_convect = get_diff_ksi(*diffConvect, 3 * gg);
2932 for (
int cc = 0; cc != nb_base_fun_col; ++cc) {
2933 t_mat(
i,
j) -= val_s * t_base_row * t_const_unit_n(
i) *
2934 (t_diff_lambda_xi(
I) * t_diff_convect(
I,
j));
2958 const int nb_integration_pts = getGaussPtsSlave().size2();
2959 auto &xi_grad_mat = *(commonDataSimpleContact->gradKsiPositionAtGaussPtsPtr);
2960 xi_grad_mat.resize(6, nb_integration_pts,
false);
2961 if (
type == MBVERTEX)
2962 xi_grad_mat.clear();
2969 auto t_grad_pos_xi = getFTensor2FromMat<3, 2>(xi_grad_mat);
2971 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
2974 for (
size_t bb = 0; bb != nb_dofs / 3; ++bb) {
2975 t_grad_pos_xi(
i,
I) += t_diff_base(
I) * t_data(
i);
2988 int row_side,
int col_side, EntityType row_type, EntityType col_type,
2992 const int nb_row = row_data.
getIndices().size();
2993 const int nb_col = col_data.
getIndices().size();
2995 if (nb_row && nb_col && col_type == MBVERTEX) {
2997 const int nb_gauss_pts = row_data.
getN().size1();
2998 int nb_base_fun_row = nb_row;
2999 int nb_base_fun_col = nb_col / 3;
3001 const double area_slave =
3002 commonDataSimpleContact->areaSlave;
3004 matLhs.resize(nb_row, nb_col,
false);
3007 auto get_diff_ksi = [](
auto &
m,
auto gg) {
3009 &
m(0, gg), &
m(1, gg), &
m(2, gg), &
m(3, gg), &
m(4, gg), &
m(5, gg));
3020 auto t_const_unit_n =
3021 get_tensor_from_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
3023 auto t_lagrange_slave =
3027 *(commonDataSimpleContact->gradKsiPositionAtGaussPtsPtr);
3028 auto t_grad = getFTensor2FromMat<3, 2>(xi_grad_mat);
3030 auto t_w = getFTensor0IntegrationWeightSlave();
3031 const double cn_value = *cNPtr.get();
3032 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
3034 cn_value, t_gap_gp, t_lagrange_slave) *
3037 cn_value, t_gap_gp, t_lagrange_slave) *
3040 cn_value, t_gap_gp, t_lagrange_slave) *
3047 &matLhs(0, 0), &matLhs(0, 1), &matLhs(0, 2)};
3049 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
3052 auto t_diff_convect = get_diff_ksi(*diffConvect, 3 * gg);
3054 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
3056 t_mat(
i) += t_base_lambda * val_diff_m_g * t_const_unit_n(
j) *
3057 t_grad(
j,
I) * t_diff_convect(
I,
i);
3065 ++t_base_diff_lambda;
3090 const int nb_integration_pts = getGaussPts().size2();
3092 auto t_h = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->hMat);
3093 auto t_H = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->HMat);
3095 commonDataSimpleContact->detHVec->resize(nb_integration_pts,
false);
3096 commonDataSimpleContact->invHMat->resize(9, nb_integration_pts,
false);
3097 commonDataSimpleContact->FMat->resize(9, nb_integration_pts,
false);
3099 commonDataSimpleContact->detHVec->clear();
3100 commonDataSimpleContact->invHMat->clear();
3101 commonDataSimpleContact->FMat->clear();
3104 auto t_invH = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->invHMat);
3105 auto t_F = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->FMat);
3107 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
3110 t_F(
i,
j) = t_h(
i,
k) * t_invH(
k,
j);
3129 if (faceType == ContactOp::FACEMASTER)
3136 CHKERR loopSideVolumes(sideFeName, *sideFe, 3, tri);
3153 vecF.resize(nbRows,
false);
3157 nbIntegrationPts = getGaussPtsMaster().size2();
3160 CHKERR iNtegrate(row_data);
3163 CHKERR aSsemble(row_data);
3175 if (commonDataSimpleContact->FMat->size1() != 9)
3178 const int nb_base_fun_col = nbRows / 3;
3186 auto lagrange_slave =
3189 auto t_F = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->FMat);
3191 get_tensor_vec(*(commonDataSimpleContact->normalVectorMasterPtr), 0);
3193 auto t_w = getFTensor0IntegrationWeightMaster();
3194 double &area_master = commonDataSimpleContact->areaMaster;
3195 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
3196 const double val_m = area_master * t_w;
3199 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
3201 const double s = val_m * t_base_master * lagrange_slave;
3203 auto t_assemble_s = get_tensor_vec(vecF, 3 * bbc);
3205 t_assemble_s(
i) -= s * t_F(
j,
i) * normal_at_gp(
j);
3222 const int *row_indices = &*row_data.
getIndices().data().begin();
3223 auto &data = *commonDataSimpleContact;
3224 if (data.forcesOnlyOnEntitiesRow.empty())
3227 rowIndices.resize(nbRows,
false);
3229 row_indices = &rowIndices[0];
3231 VectorDofs::iterator dit = dofs.begin();
3232 for (
int ii = 0; dit != dofs.end(); ++dit, ++ii) {
3233 if (data.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
3234 data.forcesOnlyOnEntitiesRow.end()) {
3235 rowIndices[ii] = -1;
3256 vecF.resize(nbRows,
false);
3260 nbIntegrationPts = getGaussPtsSlave().size2();
3263 CHKERR iNtegrate(row_data);
3266 CHKERR aSsemble(row_data);
3275 int nb_base_fun_col = nbRows / 3;
3283 auto lagrange_slave =
3286 auto t_F = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->FMat);
3288 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr), 0);
3289 auto t_w = getFTensor0IntegrationWeightSlave();
3290 double &area_slave = commonDataSimpleContact->areaSlave;
3291 for (
int gg = 0; gg != nbIntegrationPts; ++gg) {
3292 double val_s = t_w * area_slave;
3294 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
3295 const double s = val_s * t_base_master * lagrange_slave;
3296 auto t_assemble_s = get_tensor_vec(vecF, 3 * bbc);
3297 t_assemble_s(
i) -= s * t_F(
j,
i) * normal_at_gp(
j);
3313 const int *row_indices = &*row_data.
getIndices().data().begin();
3314 auto &data = *commonDataSimpleContact;
3315 if (data.forcesOnlyOnEntitiesRow.empty())
3318 rowIndices.resize(nbRows,
false);
3320 row_indices = &rowIndices[0];
3322 VectorDofs::iterator dit = dofs.begin();
3323 for (
int ii = 0; dit != dofs.end(); ++dit, ++ii) {
3324 if (data.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
3325 data.forcesOnlyOnEntitiesRow.end()) {
3326 rowIndices[ii] = -1;
3344 if (
type != MBVERTEX)
3351 commonDataSimpleContact->normalVectorSlavePtr->resize(3,
false);
3357 auto normal_original_slave =
3358 get_tensor_vec(*commonDataSimpleContact->normalVectorSlavePtr);
3360 commonDataSimpleContact->tangentOneVectorSlavePtr->resize(3,
false);
3361 commonDataSimpleContact->tangentOneVectorSlavePtr->clear();
3363 commonDataSimpleContact->tangentTwoVectorSlavePtr->resize(3,
false);
3364 commonDataSimpleContact->tangentTwoVectorSlavePtr->clear();
3366 auto tangent_0_slave =
3367 get_tensor_vec(*commonDataSimpleContact->tangentOneVectorSlavePtr);
3368 auto tangent_1_slave =
3369 get_tensor_vec(*commonDataSimpleContact->tangentTwoVectorSlavePtr);
3374 for (
unsigned int dd = 0;
dd != 3; ++
dd) {
3375 tangent_0_slave(
i) += t_dof(
i) * t_N(0);
3376 tangent_1_slave(
i) += t_dof(
i) * t_N(1);
3381 normal_original_slave(
i) =
3384 const double normal_length =
3385 sqrt(normal_original_slave(
i) * normal_original_slave(
i));
3386 normal_original_slave(
i) = normal_original_slave(
i) / normal_length;
3388 commonDataSimpleContact->areaSlave = 0.5 * normal_length;
3401 if (
type != MBVERTEX)
3408 commonDataSimpleContact->normalVectorMasterPtr->resize(3,
false);
3414 auto normal_original_master =
3415 get_tensor_vec(*commonDataSimpleContact->normalVectorMasterPtr);
3417 commonDataSimpleContact->tangentOneVectorMasterPtr->resize(3,
false);
3418 commonDataSimpleContact->tangentOneVectorMasterPtr->clear();
3420 commonDataSimpleContact->tangentTwoVectorMasterPtr->resize(3,
false);
3421 commonDataSimpleContact->tangentTwoVectorMasterPtr->clear();
3423 auto tangent_0_master =
3424 get_tensor_vec(*commonDataSimpleContact->tangentOneVectorMasterPtr);
3425 auto tangent_1_master =
3426 get_tensor_vec(*commonDataSimpleContact->tangentTwoVectorMasterPtr);
3431 for (
unsigned int dd = 0;
dd != 3; ++
dd) {
3432 tangent_0_master(
i) += t_dof(
i) * t_N(0);
3433 tangent_1_master(
i) += t_dof(
i) * t_N(1);
3438 normal_original_master(
i) =
3441 const double normal_length =
3442 sqrt(normal_original_master(
i) * normal_original_master(
i));
3443 normal_original_master(
i) = normal_original_master(
i) / normal_length;
3445 commonDataSimpleContact->areaMaster = 0.5 * normal_length;
3456 const int nb_row = row_data.
getIndices().size();
3459 const int nb_col = col_data.
getIndices().size();
3462 const int nb_gauss_pts = row_data.
getN().size1();
3464 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
3465 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
3467 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
3469 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
3470 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
3486 auto make_vec_der = [&](
auto t_N,
auto t_1,
auto t_2) {
3494 matLhs.resize(3 * nb_base_fun_row, 3 * nb_base_fun_col,
false);
3497 auto lagrange_slave =
3500 auto t_1 = get_tensor_vec(*commonDataSimpleContact->tangentOneVectorSlavePtr);
3501 auto t_2 = get_tensor_vec(*commonDataSimpleContact->tangentTwoVectorSlavePtr);
3502 auto t_w = getFTensor0IntegrationWeightSlave();
3504 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
3507 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
3511 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
3512 const double s = t_w * lagrange_slave * t_base_slave;
3514 auto t_d_n = make_vec_der(t_N, t_1, t_2);
3516 auto t_assemble_s = get_tensor_from_mat(matLhs, 3 * bbr, 3 * bbc);
3518 t_assemble_s(
i,
j) += 0.5 * s * t_d_n(
i,
j);
3536 const int nb_row = row_data.
getIndices().size();
3539 const int nb_col = col_data.
getIndices().size();
3542 const int nb_gauss_pts = row_data.
getN().size1();
3544 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
3545 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
3547 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
3549 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
3550 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
3566 auto make_vec_der = [&](
auto t_N,
auto t_1,
auto t_2) {
3574 auto lagrange_slave =
3577 const double area_s = commonDataSimpleContact->areaSlave;
3579 const double area_m = commonDataSimpleContact->areaMaster;
3581 auto t_1 = get_tensor_vec(*commonDataSimpleContact->tangentOneVectorSlavePtr);
3582 auto t_2 = get_tensor_vec(*commonDataSimpleContact->tangentTwoVectorSlavePtr);
3584 auto t_const_unit_slave =
3585 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
3587 auto t_w = getFTensor0IntegrationWeightMaster();
3588 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
3592 const double mult_s = 0.5 * t_w * lagrange_slave * area_m / area_s;
3594 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
3598 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
3599 const double s = mult_s * t_base_master;
3601 auto t_d_n = make_vec_der(t_N, t_1, t_2);
3603 auto t_assemble_s = get_tensor_from_mat(matLhs, 3 * bbr, 3 * bbc);
3605 t_assemble_s(
i,
j) -=
3606 s * (-t_const_unit_slave(
i) * t_d_n(
k,
j) * t_const_unit_slave(
k) +
3627 const int nb_row = row_data.
getIndices().size();
3630 const int nb_col = col_data.
getIndices().size();
3633 const int nb_gauss_pts = row_data.
getN().size1();
3635 int nb_base_fun_row = row_data.
getFieldData().size() / 3;
3636 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
3638 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
3640 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
3641 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
3657 auto make_vec_der = [&](
auto t_N,
auto t_1,
auto t_2) {
3665 matLhs.resize(3 * nb_base_fun_row, 3 * nb_base_fun_col,
false);
3668 auto lagrange_slave =
3672 get_tensor_vec(*commonDataSimpleContact->tangentOneVectorMasterPtr);
3674 get_tensor_vec(*commonDataSimpleContact->tangentTwoVectorMasterPtr);
3676 auto t_w = getFTensor0IntegrationWeightMaster();
3678 auto t_const_unit_master =
3679 get_tensor_vec(*(commonDataSimpleContact->normalVectorMasterPtr));
3681 auto t_const_unit_slave =
3682 get_tensor_vec(*(commonDataSimpleContact->normalVectorSlavePtr));
3684 const double area_m = commonDataSimpleContact->areaMaster;
3685 const double area_s = commonDataSimpleContact->areaSlave;
3687 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
3691 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
3692 const double mult_m = 0.5 * t_w * lagrange_slave;
3695 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
3696 const double s = mult_m * t_base_master;
3698 auto t_d_n = make_vec_der(t_N, t_1, t_2);
3700 auto t_assemble_s = get_tensor_from_mat(matLhs, 3 * bbr, 3 * bbc);
3702 t_assemble_s(
i,
j) -=
3703 s * t_d_n(
k,
j) * t_const_unit_master(
k) * t_const_unit_slave(
i);
3720 const int nb_row = row_data.
getIndices().size();
3723 const int nb_col = col_data.
getIndices().size();
3726 const int nb_gauss_pts = row_data.
getN().size1();
3728 int nb_base_fun_col = col_data.
getFieldData().size() / 3;
3730 matLhs.resize(nb_base_fun_row, 3 * nb_base_fun_col,
false);
3737 auto get_vec_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
3746 auto make_vec_der = [&](
auto t_N,
auto t_1,
auto t_2) {
3754 auto x_m = getFTensor1FromMat<3>(
3755 *commonDataSimpleContact->positionAtGaussPtsMasterPtr);
3756 auto x_s = getFTensor1FromMat<3>(
3757 *commonDataSimpleContact->positionAtGaussPtsSlavePtr);
3758 auto t_lagrange_slave =
3761 const double length_normal = commonDataSimpleContact->areaSlave;
3764 get_tensor_vec(*commonDataSimpleContact->normalVectorSlavePtr);
3766 auto t_w = getFTensor0IntegrationWeightSlave();
3767 auto t_1 = get_tensor_vec(*commonDataSimpleContact->tangentOneVectorSlavePtr);
3768 auto t_2 = get_tensor_vec(*commonDataSimpleContact->tangentTwoVectorSlavePtr);
3770 const double cn_value = *cNPtr.get();
3771 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
3772 double val_s = t_w * 0.5;
3775 for (
int bbc = 0; bbc != nb_base_fun_col; ++bbc) {
3778 for (
int bbr = 0; bbr != nb_base_fun_row; ++bbr) {
3779 const double s = val_s * t_base_lambda;
3781 auto t_d_n = make_vec_der(t_N, t_1, t_2);
3783 auto assemble_mat = get_vec_from_mat(matLhs, bbr, 3 * bbc);
3787 (t_d_n(
i,
j) - normal_at_gp(
i) * t_d_n(
k,
j) * normal_at_gp(
k)) *
3788 (x_s(
i) - x_m(
i)) * s * cn_value *
3790 cn_value * t_gap_gp));
3792 assemble_mat(
j) += t_d_n(
i,
j) * normal_at_gp(
i) * s *
3794 cn_value, t_gap_gp, t_lagrange_slave);
3812 int row_side,
int col_side, EntityType row_type, EntityType col_type,
3816 if (row_type != MBVERTEX)
3824 nb_gauss_pts = row_data.
getN().size1();
3826 nb_base_fun_row = row_data.
getFieldData().size() / rankRow;
3827 nb_base_fun_col = col_data.
getFieldData().size() / rankCol;
3829 matLhs.resize(rankRow * nb_base_fun_row, rankCol * nb_base_fun_col,
false);
3833 CHKERR iNtegrate(row_data, col_data);
3836 CHKERR aSsemble(row_data, col_data);
3842 int row_side,
int col_side, EntityType row_type, EntityType col_type,
3852 nb_gauss_pts = row_data.
getN().size1();
3854 nb_base_fun_row = row_data.
getFieldData().size() / rankRow;
3855 nb_base_fun_col = col_data.
getFieldData().size() / rankCol;
3857 matLhs.resize(rankRow * nb_base_fun_row, rankCol * nb_base_fun_col,
false);
3861 CHKERR iNtegrate(row_data, col_data);
3864 CHKERR aSsemble(row_data, col_data);
3877 const int nb_gauss_pts = data.
getN().size1();
3879 vecR.resize(CommonDataSimpleContact::LAST_ELEMENT,
false);
3882 commonDataSimpleContact->gaussPtsStatePtr->resize(nb_gauss_pts,
false);
3883 commonDataSimpleContact->gaussPtsStatePtr->clear();
3888 auto t_lagrange_slave =
3892 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
3893 vecR[CommonDataSimpleContact::TOTAL] += 1;
3897 vecR[CommonDataSimpleContact::ACTIVE] += 1;
3903 vecR[CommonDataSimpleContact::ACTIVE] += 1;
3912 constexpr std::array<int, 2> indices = {CommonDataSimpleContact::ACTIVE,
3913 CommonDataSimpleContact::TOTAL};
3915 indices.data(), &vecR[0], ADD_VALUES);
3927 const int *row_indices = &*row_data.
getIndices().data().begin();
3929 const int *col_indices = &*col_data.
getIndices().data().begin();
3931 auto &data = *commonDataSimpleContact;
3932 if (data.forcesOnlyOnEntitiesRow.empty())
3935 if (!data.forcesOnlyOnEntitiesRow.empty()) {
3936 rowIndices.resize(row_nb_dofs,
false);
3938 row_indices = &rowIndices[0];
3940 VectorDofs::iterator dit = dofs.begin();
3941 for (
int ii = 0; dit != dofs.end(); ++dit, ++ii) {
3942 if (data.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
3943 data.forcesOnlyOnEntitiesRow.end()) {
3944 rowIndices[ii] = -1;
3951 col_indices, &*matLhs.data().begin(), ADD_VALUES);
3963 const int *row_indices = &*row_data.
getIndices().data().begin();
3965 const int *col_indices = &*col_data.
getIndices().data().begin();
3969 col_indices, &*matLhs.data().begin(), ADD_VALUES);
3985 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
3986 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
3994 auto t_w = getFTensor0IntegrationWeight();
3996 auto t_inv_H = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->invHMat);
3998 auto lagrange_slave =
4001 auto normal_at_gp = get_tensor_vec(*normalVector);
4003 const double area_m = aRea;
4005 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
4007 double a = -t_w * lagrange_slave * area_m;
4012 for (; bbc != nb_base_fun_col; ++bbc) {
4017 for (; bbr != nb_base_fun_row; ++bbr) {
4019 auto t_assemble = get_tensor2(matLhs, 3 * bbr, 3 * bbc);
4022 t_assemble(
i,
j) +=
a * t_row_base * t_inv_H(
k,
i) *
4023 t_col_diff_base(
k) * normal_at_gp(
j);
4051 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
4052 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
4060 auto t_w = getFTensor0IntegrationWeight();
4062 auto t_h = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->hMat);
4063 auto t_inv_H = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->invHMat);
4065 auto lagrange_slave =
4068 auto normal_at_gp = get_tensor_vec(*normalVector);
4070 const double area_m = aRea;
4072 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
4074 const double a = -t_w * lagrange_slave * area_m;
4078 for (; bbc != nb_base_fun_col; ++bbc) {
4083 for (; bbr != nb_base_fun_row; ++bbr) {
4085 auto t_assemble = get_tensor2(matLhs, 3 * bbr, 3 * bbc);
4087 t_assemble(
i,
j) -=
a * t_row_base * t_inv_H(
l,
j) *
4088 t_col_diff_base(
m) * t_inv_H(
m,
i) * t_h(
k,
l) *
4116 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
4117 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
4125 auto make_vec_der = [&](
auto t_N,
auto t_1,
auto t_2) {
4133 auto t_F = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->FMat);
4135 auto t_w = getFTensor0IntegrationWeightMaster();
4136 auto lagrange_slave =
4139 get_tensor_vec(*commonDataSimpleContact->tangentOneVectorMasterPtr);
4141 get_tensor_vec(*commonDataSimpleContact->tangentTwoVectorMasterPtr);
4142 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
4145 const double val = 0.5 * t_w * lagrange_slave;
4148 for (; bbc != nb_base_fun_col; ++bbc) {
4153 for (; bbr != nb_base_fun_row; ++bbr) {
4155 auto t_assemble = get_tensor2(matLhs, 3 * bbr, 3 * bbc);
4157 auto t_d_n = make_vec_der(t_N, t_1, t_2);
4158 t_assemble(
i,
k) -= val * t_base * t_F(
j,
i) * t_d_n(
j,
k);
4184 &
m(
r + 0,
c + 0), &
m(
r + 0,
c + 1), &
m(
r + 0,
c + 2), &
m(
r + 1,
c + 0),
4185 &
m(
r + 1,
c + 1), &
m(
r + 1,
c + 2), &
m(
r + 2,
c + 0), &
m(
r + 2,
c + 1),
4193 auto make_vec_der = [&](
auto t_N,
auto t_1,
auto t_2) {
4203 auto t_F = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->FMat);
4205 auto t_w = getFTensor0IntegrationWeightMaster();
4206 auto lagrange_slave =
4208 auto t_1 = get_tensor_vec(*commonDataSimpleContact->tangentOneVectorSlavePtr);
4209 auto t_2 = get_tensor_vec(*commonDataSimpleContact->tangentTwoVectorSlavePtr);
4210 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
4213 const double val = 0.5 * t_w * lagrange_slave;
4216 for (; bbc != nb_base_fun_col; ++bbc) {
4221 for (; bbr != nb_base_fun_row; ++bbr) {
4223 auto t_assemble = get_tensor2(matLhs, 3 * bbr, 3 * bbc);
4225 auto t_d_n = make_vec_der(t_N, t_1, t_2);
4226 t_assemble(
i,
k) -= val * t_base * t_F(
j,
i) * t_d_n(
j,
k);
4254 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
4259 auto t_F = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->FMat);
4261 auto t_w = getFTensor0IntegrationWeightMaster();
4263 auto normal_master_at_gp =
4264 get_tensor_vec(*commonDataSimpleContact->normalVectorMasterPtr);
4266 const double area_m = commonDataSimpleContact->areaMaster;
4268 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
4272 const double val = t_w * area_m;
4275 for (; bbc != nb_base_fun_col; ++bbc) {
4280 for (; bbr != nb_base_fun_row; ++bbr) {
4282 auto t_assemble = get_tensor_from_mat(matLhs, 3 * bbr, bbc);
4285 val * t_row_base * t_F(
j,
i) * normal_master_at_gp(
j) * t_col_base;
4312 auto get_tensor_from_mat = [](
MatrixDouble &
m,
const int r,
const int c) {
4317 auto t_F = getFTensor2FromMat<3, 3>(*commonDataSimpleContact->FMat);
4319 auto t_w = getFTensor0IntegrationWeightSlave();
4321 auto normal_master_at_gp =
4322 get_tensor_vec(*commonDataSimpleContact->normalVectorSlavePtr);
4324 const double area_m = commonDataSimpleContact->areaSlave;
4326 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
4330 const double val = t_w * area_m;
4333 for (; bbc != nb_base_fun_col; ++bbc) {
4338 for (; bbr != nb_base_fun_row; ++bbr) {
4340 auto t_assemble = get_tensor_from_mat(matLhs, 3 * bbr, bbc);
4343 val * t_row_base * t_F(
j,
i) * normal_master_at_gp(
j) * t_col_base;
4357 int row_side,
int col_side, EntityType row_type, EntityType col_type,
4361 if (row_type != MBVERTEX)
4369 nb_gauss_pts = row_data.
getN().size1();
4374 matLhs.resize(3 * nb_base_fun_row, 3 * nb_base_fun_col,
false);
4377 normalVector->resize(3,
false);
4378 tangentOne->resize(3,
false);
4379 tangentTwo->resize(3,
false);
4382 normalVector = commonDataSimpleContact->normalVectorMasterPtr;
4383 tangentOne = commonDataSimpleContact->tangentOneVectorMasterPtr;
4384 tangentTwo = commonDataSimpleContact->tangentOneVectorMasterPtr;
4385 aRea = commonDataSimpleContact->areaMaster;
4387 normalVector = commonDataSimpleContact->normalVectorSlavePtr;
4388 tangentOne = commonDataSimpleContact->tangentOneVectorSlavePtr;
4389 tangentTwo = commonDataSimpleContact->tangentOneVectorSlavePtr;
4390 aRea = commonDataSimpleContact->areaSlave;
4394 CHKERR iNtegrate(row_data, col_data);
4397 CHKERR aSsemble(row_data, col_data);
4408 const int *row_indices = &*row_data.
getIndices().data().begin();
4410 const int *col_indices = &*col_data.
getIndices().data().begin();
4412 auto &data = *commonDataSimpleContact;
4413 if (!data.forcesOnlyOnEntitiesRow.empty()) {
4414 rowIndices.resize(row_nb_dofs,
false);
4416 row_indices = &rowIndices[0];
4418 VectorDofs::iterator dit = dofs.begin();
4419 for (
int ii = 0; dit != dofs.end(); ++dit, ++ii) {
4420 if (data.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
4421 data.forcesOnlyOnEntitiesRow.end()) {
4422 rowIndices[ii] = -1;
4429 col_indices, &*matLhs.data().begin(), ADD_VALUES);
4436 boost::shared_ptr<SimpleContactElement> fe_rhs_simple_contact_ale,
4437 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
4438 const string field_name,
const string mesh_node_field_name,
4439 const string lagrange_field_name,
const string side_fe_name) {
4442 boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnContactPrismSide>
4443 fe_mat_side_rhs_master = boost::make_shared<
4448 mesh_node_field_name, common_data_simple_contact->HMat));
4449 fe_mat_side_rhs_master->getOpPtrVector().push_back(
4451 field_name, common_data_simple_contact->hMat));
4453 boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnContactPrismSide>
4454 fe_mat_side_rhs_slave = boost::make_shared<
4459 mesh_node_field_name, common_data_simple_contact->HMat));
4460 fe_mat_side_rhs_slave->getOpPtrVector().push_back(
4462 field_name, common_data_simple_contact->hMat));
4465 "MESH_NODE_POSITIONS", common_data_simple_contact));
4467 fe_rhs_simple_contact_ale->getOpPtrVector().push_back(
4469 common_data_simple_contact));
4482 fe_rhs_simple_contact_ale->getOpPtrVector().push_back(
4484 common_data_simple_contact));
4487 mesh_node_field_name, common_data_simple_contact,
false));
4489 fe_rhs_simple_contact_ale->getOpPtrVector().push_back(
4491 fe_mat_side_rhs_master, side_fe_name,
4492 ContactOp::FACEMASTER));
4494 fe_rhs_simple_contact_ale->getOpPtrVector().push_back(
4496 common_data_simple_contact));
4499 mesh_node_field_name, common_data_simple_contact,
false));
4501 fe_rhs_simple_contact_ale->getOpPtrVector().push_back(
4503 fe_mat_side_rhs_slave, side_fe_name,
4504 ContactOp::FACESLAVE));
4506 fe_rhs_simple_contact_ale->getOpPtrVector().push_back(
4508 common_data_simple_contact));
4513 boost::shared_ptr<SimpleContactElement> fe_lhs_simple_contact_ale,
4514 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
4515 const string field_name,
const string mesh_node_field_name,
4516 const string lagrange_field_name,
const string side_fe_name) {
4520 mesh_node_field_name, common_data_simple_contact));
4522 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4524 common_data_simple_contact));
4526 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4528 common_data_simple_contact));
4530 boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnContactPrismSide>
4531 feMatSideLhs_dx = boost::make_shared<
4536 mesh_node_field_name, common_data_simple_contact->HMat));
4538 feMatSideLhs_dx->getOpPtrVector().push_back(
4540 field_name, common_data_simple_contact->hMat));
4544 mesh_node_field_name, common_data_simple_contact,
false));
4546 feMatSideLhs_dx->getOpPtrVector().push_back(
4548 mesh_node_field_name, mesh_node_field_name,
4549 common_data_simple_contact,
true));
4551 feMatSideLhs_dx->getOpPtrVector().push_back(
4553 mesh_node_field_name,
field_name, common_data_simple_contact,
true));
4555 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4557 side_fe_name, ContactOp::FACEMASTER));
4559 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4561 mesh_node_field_name, mesh_node_field_name,
4562 common_data_simple_contact, POSITION_RANK, POSITION_RANK));
4564 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4566 mesh_node_field_name, lagrange_field_name, common_data_simple_contact,
4567 POSITION_RANK, LAGRANGE_RANK));
4569 boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnContactPrismSide>
4570 feMatSideLhsSlave_dx = boost::make_shared<
4575 mesh_node_field_name, common_data_simple_contact->HMat));
4577 feMatSideLhsSlave_dx->getOpPtrVector().push_back(
4579 field_name, common_data_simple_contact->hMat));
4582 mesh_node_field_name, common_data_simple_contact,
false));
4584 feMatSideLhsSlave_dx->getOpPtrVector().push_back(
4586 mesh_node_field_name, mesh_node_field_name,
4587 common_data_simple_contact,
false));
4589 feMatSideLhsSlave_dx->getOpPtrVector().push_back(
4591 mesh_node_field_name,
field_name, common_data_simple_contact,
false));
4593 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4595 feMatSideLhsSlave_dx, side_fe_name,
4596 ContactOp::FACESLAVE));
4598 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4600 mesh_node_field_name, mesh_node_field_name,
4601 common_data_simple_contact, POSITION_RANK, POSITION_RANK));
4603 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4605 mesh_node_field_name, lagrange_field_name, common_data_simple_contact,
4606 POSITION_RANK, LAGRANGE_RANK));
4612 boost::shared_ptr<SimpleContactElement> fe_lhs_simple_contact_ale,
4613 boost::shared_ptr<CommonDataSimpleContact> common_data_simple_contact,
4614 const string field_name,
const string mesh_node_field_name,
4615 const string lagrange_field_name,
bool is_eigen_pos_field,
4616 string eigen_pos_field_name) {
4620 mesh_node_field_name, common_data_simple_contact));
4622 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4624 common_data_simple_contact));
4626 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4628 common_data_simple_contact));
4630 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4633 if (is_eigen_pos_field) {
4634 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4636 eigen_pos_field_name, common_data_simple_contact));
4638 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4640 eigen_pos_field_name, common_data_simple_contact));
4643 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4646 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4648 common_data_simple_contact));
4650 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4652 common_data_simple_contact,
4653 POSITION_RANK, POSITION_RANK));
4655 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4657 common_data_simple_contact,
4658 POSITION_RANK, POSITION_RANK));
4660 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4662 common_data_simple_contact,
4663 POSITION_RANK, POSITION_RANK));
4665 fe_lhs_simple_contact_ale->getOpPtrVector().push_back(
4667 lagrange_field_name, mesh_node_field_name, cnValuePtr,
4668 common_data_simple_contact, LAGRANGE_RANK, POSITION_RANK));
4680 if (!postProcSurface.empty()) {
4683 auto &m_field = this->getPtrFE()->mField;
4684 CHKERR m_field.get_moab().get_adjacencies(&prism_ent, 1, 2,
false, tri_ents,
4685 moab::Interface::UNION);
4686 tri_ents = tri_ents.subset_by_type(MBTRI);
4687 if (intersect(postProcSurface, tri_ents).empty())
4691 const int nb_gauss_pts = data.
getN().size1();
4694 const double area_s =
4695 commonDataSimpleContact->areaSlave;
4697 vecR.resize(CommonDataSimpleContact::LAST_ELEMENT,
false);
4700 auto t_lagrange_slave =
4703 auto t_w = getFTensor0IntegrationWeightSlave();
4705 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
4706 const double val_s = t_w * area_s;
4707 vecR[CommonDataSimpleContact::TOTAL] += val_s;
4708 bool gap_below_tolerance =
4709 postProcGapTol > std::numeric_limits<double>::epsilon() &&
4710 t_gap_gp < postProcGapTol;
4711 if (gap_below_tolerance) {
4712 vecR[CommonDataSimpleContact::ACTIVE] += val_s;
4716 vecR[CommonDataSimpleContact::ACTIVE] += val_s;
4720 vecR[CommonDataSimpleContact::ACTIVE] += val_s;
4729 constexpr std::array<int, 2> indices = {
4730 CommonDataSimpleContact::ACTIVE,
4731 CommonDataSimpleContact::TOTAL,
4734 indices.data(), &vecR[0], ADD_VALUES);