59 auto get_material_dofs_from_coords = [&]() {
65 conn, num_nodes,
true);
72 auto get_dofs_data_for_slave_and_master = [&] {
77 for (
size_t n = 0;
n != 3; ++
n) {
78 for (
size_t d = 0;
d != 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);
117 auto get_slave_material_coords = [&]() ->
MatrixDouble & {
126 return fePtr->gaussPtsMaster;
128 return fePtr->gaussPtsSlave;
131 auto get_slave_spatial_coords = [&]() ->
MatrixDouble & {
138 auto get_master_spatial_coords = [&]() ->
MatrixDouble & {
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 = []() {
185 &Tools::diffShapeFunMBTRI[0], &Tools::diffShapeFunMBTRI[1]};
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) =
276 Tools::shapeFunMBTRI0(t_xi_master(0), t_xi_master(1));
277 get_master_n()(gg, 1) =
278 Tools::shapeFunMBTRI1(t_xi_master(0), t_xi_master(1));
279 get_master_n()(gg, 2) =
280 Tools::shapeFunMBTRI2(t_xi_master(0), t_xi_master(1));
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();
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);