48 unsigned n_node =
nnode();
57 unsigned u_nodal_index[3];
58 for (
unsigned i = 0;
i < 3; ++
i)
69 bool pressure_dof_is_hanging[n_pres];
74 for (
unsigned l = 0; l < n_pres; ++l)
82 for (
unsigned l = 0; l < n_pres; ++l)
84 pressure_dof_is_hanging[l] =
false;
90 Shape psif(n_node), testf(n_node);
91 DShape dpsifdx(n_node, DIM), dtestfdx(n_node, DIM);
95 Shape psip(n_pres), testp(n_pres);
115 int local_eqn = 0, local_unknown = 0;
118 HangInfo *hang_info_pt = 0, *hang_info2_pt = 0;
121 for (
unsigned ipt = 0; ipt < Nintpt; ipt++)
124 for (
unsigned i = 0;
i < DIM;
i++)
134 ipt, psif, dpsifdx, testf, dtestfdx);
144 double interpolated_p = 0.0;
152 for (
unsigned l = 0; l < n_pres; l++)
154 interpolated_p +=
p_axi_nst(l) * psip[l];
161 for (
unsigned l = 0; l < n_node; l++)
164 const double psif_ = psif(l);
166 for (
unsigned i = 0;
i < DIM;
i++)
172 for (
unsigned i = 0;
i < DIM + 1;
i++)
174 const double u_value =
nodal_value(l, u_nodal_index[
i]);
175 interpolated_u[
i] += u_value * psif_;
178 for (
unsigned j = 0; j < DIM; j++)
180 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
189 for (
unsigned l = 0; l < n_node; l++)
192 for (
unsigned i = 0;
i < 2;
i++)
213 unsigned n_master = 1;
214 double hang_weight = 1.0;
218 for (
unsigned l = 0; l < n_node; l++)
229 n_master = hang_info_pt->
nmaster();
238 for (
unsigned m = 0; m < n_master; m++)
241 for (
unsigned i = 0;
i < DIM + 1;
i++)
273 sum += r * body_force[0] * testf[l] *
W * hang_weight;
277 r * scaled_re_inv_fr * testf[l] * G[0] *
W * hang_weight;
280 sum += interpolated_p * (testf[l] + r * dtestfdx(l, 0)) *
W *
287 sum -= visc_ratio * r * (1.0 +
Gamma[0]) *
288 interpolated_dudx(0, 0) * dtestfdx(l, 0) *
W *
291 sum -= visc_ratio * r *
292 (interpolated_dudx(0, 1) +
293 Gamma[0] * interpolated_dudx(1, 0)) *
294 dtestfdx(l, 1) *
W * hang_weight;
296 sum -= visc_ratio * (1.0 +
Gamma[0]) * interpolated_u[0] *
297 testf[l] *
W * hang_weight / r;
302 scaled_re_st * r * dudt[0] * testf[l] *
W * hang_weight;
306 (r * interpolated_u[0] * interpolated_dudx(0, 0) -
307 interpolated_u[2] * interpolated_u[2] +
308 r * interpolated_u[1] * interpolated_dudx(0, 1)) *
309 testf[l] *
W * hang_weight;
314 for (
unsigned k = 0; k < 2; k++)
316 sum += scaled_re_st * r * mesh_veloc[k] *
317 interpolated_dudx(0, k) * testf[l] *
W *
323 sum += 2.0 * r * scaled_re_inv_ro * interpolated_u[2] *
324 testf[l] *
W * hang_weight;
333 sum += r * body_force[1] * testf[l] *
W * hang_weight;
337 r * scaled_re_inv_fr * testf[l] * G[1] *
W * hang_weight;
340 sum += r * interpolated_p * dtestfdx(l, 1) *
W * hang_weight;
346 sum -= visc_ratio * r *
347 (interpolated_dudx(1, 0) +
348 Gamma[1] * interpolated_dudx(0, 1)) *
349 dtestfdx(l, 0) *
W * hang_weight;
351 sum -= visc_ratio * r * (1.0 +
Gamma[1]) *
352 interpolated_dudx(1, 1) * dtestfdx(l, 1) *
W *
358 scaled_re_st * r * dudt[1] * testf[l] *
W * hang_weight;
362 (r * interpolated_u[0] * interpolated_dudx(1, 0) +
363 r * interpolated_u[1] * interpolated_dudx(1, 1)) *
364 testf[l] *
W * hang_weight;
369 for (
unsigned k = 0; k < 2; k++)
371 sum += scaled_re_st * r * mesh_veloc[k] *
372 interpolated_dudx(1, k) * testf[l] *
W *
382 sum += r * body_force[2] * testf[l] *
W * hang_weight;
386 r * scaled_re_inv_fr * testf[l] * G[2] *
W * hang_weight;
395 (r * interpolated_dudx(2, 0) -
396 Gamma[0] * interpolated_u[2]) *
397 dtestfdx(l, 0) *
W * hang_weight;
399 sum -= visc_ratio * r * interpolated_dudx(2, 1) *
400 dtestfdx(l, 1) *
W * hang_weight;
403 ((interpolated_u[2] / r) -
404 Gamma[0] * interpolated_dudx(2, 0)) *
405 testf[l] *
W * hang_weight;
411 scaled_re_st * r * dudt[2] * testf[l] *
W * hang_weight;
415 (r * interpolated_u[0] * interpolated_dudx(2, 0) +
416 interpolated_u[0] * interpolated_u[2] +
417 r * interpolated_u[1] * interpolated_dudx(2, 1)) *
418 testf[l] *
W * hang_weight;
423 for (
unsigned k = 0; k < 2; k++)
425 sum += scaled_re_st * r * mesh_veloc[k] *
426 interpolated_dudx(2, k) * testf[l] *
W *
432 sum -= 2.0 * r * scaled_re_inv_ro * interpolated_u[0] *
433 testf[l] *
W * hang_weight;
439 residuals[local_eqn] += sum;
445 unsigned n_master2 = 1;
446 double hang_weight2 = 1.0;
448 for (
unsigned l2 = 0; l2 < n_node; l2++)
454 if (is_node2_hanging)
458 n_master2 = hang_info2_pt->
nmaster();
467 for (
unsigned m2 = 0; m2 < n_master2; m2++)
470 for (
unsigned i2 = 0; i2 < DIM + 1; i2++)
474 if (is_node2_hanging)
478 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
479 hang_weight2 = hang_info2_pt->master_weight(m2);
489 if (local_unknown >= 0)
504 mass_matrix(local_eqn, local_unknown) +=
505 scaled_re_st * r * psif[l2] * testf[l] *
W *
506 hang_weight * hang_weight2;
510 jacobian(local_eqn, local_unknown) -=
511 visc_ratio * r * (1.0 +
Gamma[0]) *
512 dpsifdx(l2, 0) * dtestfdx(l, 0) *
W *
513 hang_weight * hang_weight2;
515 jacobian(local_eqn, local_unknown) -=
516 visc_ratio * r * dpsifdx(l2, 1) *
517 dtestfdx(l, 1) *
W * hang_weight *
520 jacobian(local_eqn, local_unknown) -=
521 visc_ratio * (1.0 +
Gamma[0]) * psif[l2] *
522 testf[l] *
W * hang_weight * hang_weight2 / r;
526 jacobian(local_eqn, local_unknown) -=
529 psif[l2] * testf[l] *
W * hang_weight *
533 jacobian(local_eqn, local_unknown) -=
535 (r * psif[l2] * interpolated_dudx(0, 0) +
536 r * interpolated_u[0] * dpsifdx(l2, 0) +
537 r * interpolated_u[1] * dpsifdx(l2, 1)) *
538 testf[l] *
W * hang_weight * hang_weight2;
543 for (
unsigned k = 0; k < 2; k++)
545 jacobian(local_eqn, local_unknown) +=
546 scaled_re_st * r * mesh_veloc[k] *
547 dpsifdx(l2, k) * testf[l] *
W *
548 hang_weight * hang_weight2;
555 jacobian(local_eqn, local_unknown) -=
556 visc_ratio * r *
Gamma[0] * dpsifdx(l2, 0) *
557 dtestfdx(l, 1) *
W * hang_weight *
561 jacobian(local_eqn, local_unknown) -=
562 scaled_re * r * psif[l2] *
563 interpolated_dudx(0, 1) * testf[l] *
W *
564 hang_weight * hang_weight2;
570 jacobian(local_eqn, local_unknown) -=
571 -scaled_re * 2.0 * interpolated_u[2] *
572 psif[l2] * testf[l] *
W * hang_weight *
576 jacobian(local_eqn, local_unknown) +=
577 2.0 * r * scaled_re_inv_ro * psif[l2] *
578 testf[l] *
W * hang_weight * hang_weight2;
595 jacobian(local_eqn, local_unknown) -=
596 visc_ratio * r *
Gamma[1] * dpsifdx(l2, 1) *
597 dtestfdx(l, 0) *
W * hang_weight *
601 jacobian(local_eqn, local_unknown) -=
602 scaled_re * r * psif[l2] *
603 interpolated_dudx(1, 0) * testf[l] *
W *
604 hang_weight * hang_weight2;
613 mass_matrix(local_eqn, local_unknown) +=
614 scaled_re_st * r * psif[l2] * testf[l] *
W *
615 hang_weight * hang_weight2;
623 jacobian(local_eqn, local_unknown) -=
624 visc_ratio * r * dpsifdx(l2, 0) *
625 dtestfdx(l, 0) *
W * hang_weight *
628 jacobian(local_eqn, local_unknown) -=
629 visc_ratio * r * (1.0 +
Gamma[1]) *
630 dpsifdx(l2, 1) * dtestfdx(l, 1) *
W *
631 hang_weight * hang_weight2;
635 jacobian(local_eqn, local_unknown) -=
638 psif[l2] * testf[l] *
W * hang_weight *
642 jacobian(local_eqn, local_unknown) -=
644 (r * interpolated_u[0] * dpsifdx(l2, 0) +
645 r * psif[l2] * interpolated_dudx(1, 1) +
646 r * interpolated_u[1] * dpsifdx(l2, 1)) *
647 testf[l] *
W * hang_weight * hang_weight2;
652 for (
unsigned k = 0; k < 2; k++)
654 jacobian(local_eqn, local_unknown) +=
655 scaled_re_st * r * mesh_veloc[k] *
656 dpsifdx(l2, k) * testf[l] *
W *
657 hang_weight * hang_weight2;
677 jacobian(local_eqn, local_unknown) -=
679 (r * psif[l2] * interpolated_dudx(2, 0) +
680 psif[l2] * interpolated_u[2]) *
681 testf[l] *
W * hang_weight * hang_weight2;
684 jacobian(local_eqn, local_unknown) -=
685 2.0 * r * scaled_re_inv_ro * psif[l2] *
686 testf[l] *
W * hang_weight * hang_weight2;
693 jacobian(local_eqn, local_unknown) -=
694 scaled_re * r * psif[l2] *
695 interpolated_dudx(2, 1) * testf[l] *
W *
696 hang_weight * hang_weight2;
705 mass_matrix(local_eqn, local_unknown) +=
706 scaled_re_st * r * psif[l2] * testf[l] *
W *
707 hang_weight * hang_weight2;
715 jacobian(local_eqn, local_unknown) -=
717 (r * dpsifdx(l2, 0) -
Gamma[0] * psif[l2]) *
718 dtestfdx(l, 0) *
W * hang_weight *
721 jacobian(local_eqn, local_unknown) -=
722 visc_ratio * r * dpsifdx(l2, 1) *
723 dtestfdx(l, 1) *
W * hang_weight *
726 jacobian(local_eqn, local_unknown) -=
728 ((psif[l2] / r) -
Gamma[0] * dpsifdx(l2, 0)) *
729 testf[l] *
W * hang_weight * hang_weight2;
733 jacobian(local_eqn, local_unknown) -=
736 psif[l2] * testf[l] *
W * hang_weight *
740 jacobian(local_eqn, local_unknown) -=
742 (r * interpolated_u[0] * dpsifdx(l2, 0) +
743 interpolated_u[0] * psif[l2] +
744 r * interpolated_u[1] * dpsifdx(l2, 1)) *
745 testf[l] *
W * hang_weight * hang_weight2;
750 for (
unsigned k = 0; k < 2; k++)
752 jacobian(local_eqn, local_unknown) +=
753 scaled_re_st * r * mesh_veloc[k] *
754 dpsifdx(l2, k) * testf[l] *
W *
755 hang_weight * hang_weight2;
769 for (
unsigned l2 = 0; l2 < n_pres; l2++)
772 if (pressure_dof_is_hanging[l2])
778 n_master2 = hang_info2_pt->
nmaster();
787 for (
unsigned m2 = 0; m2 < n_master2; m2++)
791 if (pressure_dof_is_hanging[l2])
795 hang_info2_pt->master_node_pt(m2), p_index);
797 hang_weight2 = hang_info2_pt->master_weight(m2);
806 if (local_unknown >= 0)
813 jacobian(local_eqn, local_unknown) +=
814 psip[l2] * (testf[l] + r * dtestfdx(l, 0)) *
W *
815 hang_weight * hang_weight2;
820 jacobian(local_eqn, local_unknown) +=
821 r * psip[l2] * dtestfdx(l, 1) *
W * hang_weight *
843 for (
unsigned l = 0; l < n_pres; l++)
846 if (pressure_dof_is_hanging[l])
851 n_master = hang_info_pt->
nmaster();
860 for (
unsigned m = 0; m < n_master; m++)
864 if (pressure_dof_is_hanging[l])
880 residuals[local_eqn] -= r * source * testp[l] *
W * hang_weight;
883 residuals[local_eqn] +=
884 (interpolated_u[0] + r * interpolated_dudx(0, 0) +
885 r * interpolated_dudx(1, 1)) *
886 testp[l] *
W * hang_weight;
892 unsigned n_master2 = 1;
893 double hang_weight2 = 1.0;
895 for (
unsigned l2 = 0; l2 < n_node; l2++)
901 if (is_node2_hanging)
905 n_master2 = hang_info2_pt->
nmaster();
914 for (
unsigned m2 = 0; m2 < n_master2; m2++)
917 for (
unsigned i2 = 0; i2 < DIM + 1; i2++)
921 if (is_node2_hanging)
925 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
926 hang_weight2 = hang_info2_pt->master_weight(m2);
936 if (local_unknown >= 0)
942 jacobian(local_eqn, local_unknown) +=
943 (psif[l2] + r * dpsifdx(l2, 0)) * testp[l] *
W *
944 hang_weight * hang_weight2;
949 jacobian(local_eqn, local_unknown) +=
950 r * dpsifdx(l2, 1) * testp[l] *
W * hang_weight *
986 std::string warning_message =
"This function has not been tested.\n";
987 std::string function =
"RefineableAxisymmetricNavierStokesEquations::\n";
988 function +=
"get_dresidual_dnodal_coordinates(...)";
998 const unsigned n_node =
nnode();
1007 unsigned u_nodal_index[3];
1008 for (
unsigned i = 0;
i < 3;
i++)
1019 bool pressure_dof_is_hanging[n_pres];
1025 for (
unsigned l = 0; l < n_pres; ++l)
1033 for (
unsigned l = 0; l < n_pres; ++l)
1035 pressure_dof_is_hanging[l] =
false;
1041 Shape psif(n_node), testf(n_node);
1042 DShape dpsifdx(n_node, 2), dtestfdx(n_node, 2);
1045 Shape psip(n_pres), testp(n_pres);
1053 2, n_shape_controlling_node, n_node, 2);
1095 bool element_has_node_with_aux_node_update_fct =
false;
1097 std::map<Node*, unsigned> local_shape_controlling_node_lookup =
1101 for (std::map<Node*, unsigned>::iterator it =
1102 local_shape_controlling_node_lookup.begin();
1103 it != local_shape_controlling_node_lookup.end();
1107 Node* nod_pt = it->first;
1110 unsigned q = it->second;
1115 element_has_node_with_aux_node_update_fct =
true;
1119 std::ostringstream warning_stream;
1120 warning_stream <<
"\nThe functionality to evaluate the additional"
1121 <<
"\ncontribution to the deriv of the residual eqn"
1122 <<
"\nw.r.t. the nodal coordinates which comes about"
1123 <<
"\nif a node's values are updated using an auxiliary"
1124 <<
"\nnode update function has NOT been tested for"
1125 <<
"\nrefineable axisymmetric Navier-Stokes elements."
1126 <<
"\nUse at your own risk" << std::endl;
1128 "RefineableAxisymmetricNavierStokesEquations::get_"
1129 "dresidual_dnodal_coordinates",
1130 OOMPH_EXCEPTION_LOCATION);
1134 for (
unsigned i = 0;
i < 3;
i++)
1136 u_ref[
i] = *(nod_pt->
value_pt(u_nodal_index[
i]));
1140 for (
unsigned p = 0; p < 2; p++)
1143 double backup = nod_pt->
x(p);
1147 nod_pt->
x(p) += eps_fd;
1153 for (
unsigned i = 0;
i < 3;
i++)
1157 (*(nod_pt->
value_pt(u_nodal_index[p])) - u_ref[p]) / eps_fd;
1161 nod_pt->
x(p) = backup;
1176 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1179 for (
unsigned i = 0;
i < 2;
i++)
1208 double interpolated_p = 0.0;
1214 for (
unsigned l = 0; l < n_pres; l++)
1216 interpolated_p += this->
p_axi_nst(l) * psip[l];
1223 for (
unsigned l = 0; l < n_node; l++)
1226 const double psif_ = psif(l);
1229 for (
unsigned i = 0;
i < 2;
i++)
1235 for (
unsigned i = 0;
i < 3;
i++)
1238 const double u_value =
nodal_value(l, u_nodal_index[
i]);
1239 interpolated_u[
i] += u_value * psif_;
1243 for (
unsigned j = 0; j < 2; j++)
1245 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
1254 for (
unsigned l = 0; l < n_node; l++)
1257 for (
unsigned i = 0;
i < 2;
i++)
1267 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1270 for (
unsigned p = 0; p < 2; p++)
1273 for (
unsigned i = 0;
i < 3;
i++)
1276 for (
unsigned k = 0; k < 2; k++)
1281 for (
unsigned j = 0; j < n_node; j++)
1284 nodal_value(j, u_nodal_index[
i]) * d_dpsifdx_dX(p, q, j, k);
1286 d_dudx_dX(p, q,
i, k) = aux;
1294 const double pos_time_weight =
1296 const double val_time_weight =
1326 unsigned n_master = 1;
1327 double hang_weight = 1.0;
1330 for (
unsigned l = 0; l < n_node; l++)
1333 const double testf_ = testf[l];
1339 if (is_node_hanging)
1344 n_master = hang_info_pt->
nmaster();
1353 for (
unsigned m = 0; m < n_master; m++)
1361 if (is_node_hanging)
1383 for (
unsigned p = 0; p < 2; p++)
1386 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1392 double sum = r * body_force[0] * testf_;
1395 sum += r * scaled_re_inv_fr * testf_ * G[0];
1398 sum += interpolated_p * (testf_ + r * dtestfdx(l, 0));
1404 sum -= visc_ratio * r * (1.0 +
Gamma[0]) *
1405 interpolated_dudx(0, 0) * dtestfdx(l, 0);
1407 sum -= visc_ratio * r *
1408 (interpolated_dudx(0, 1) +
1409 Gamma[0] * interpolated_dudx(1, 0)) *
1412 sum -= visc_ratio * (1.0 +
Gamma[0]) * interpolated_u[0] *
1416 sum -= scaled_re_st * r * dudt[0] * testf_;
1420 (r * interpolated_u[0] * interpolated_dudx(0, 0) -
1421 interpolated_u[2] * interpolated_u[2] +
1422 r * interpolated_u[1] * interpolated_dudx(0, 1)) *
1428 for (
unsigned k = 0; k < 2; k++)
1430 sum += scaled_re_st * r * mesh_velocity[k] *
1431 interpolated_dudx(0, k) * testf_;
1436 sum += 2.0 * r * scaled_re_inv_ro * interpolated_u[2] * testf_;
1439 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1440 sum * dJ_dX(p, q) * w * hang_weight;
1446 sum = r * d_body_force_dx(0, p) * psif[q] * testf_;
1449 sum += body_force[0] * psif[q] * testf_;
1455 sum += scaled_re_inv_fr * G[0] * psif[q] * testf_;
1459 sum += r * interpolated_p * d_dtestfdx_dX(p, q, l, 0);
1462 sum += interpolated_p * psif[q] * dtestfdx(l, 0);
1469 (d_dudx_dX(p, q, 0, 0) * dtestfdx(l, 0) +
1470 interpolated_dudx(0, 0) * d_dtestfdx_dX(p, q, l, 0)) +
1471 (d_dudx_dX(p, q, 0, 1) +
Gamma[0] * d_dudx_dX(p, q, 1, 0)) *
1473 (interpolated_dudx(0, 1) +
1474 Gamma[0] * interpolated_dudx(1, 0)) *
1475 d_dtestfdx_dX(p, q, l, 1));
1481 (interpolated_dudx(0, 0) * psif[q] * dtestfdx(l, 0) -
1482 interpolated_u[0] * psif[q] * testf_ / (r * r)) +
1483 (interpolated_dudx(0, 1) +
1484 Gamma[0] * interpolated_dudx(1, 0)) *
1485 psif[q] * dtestfdx(l, 1));
1489 for (
unsigned k = 0; k < 2; k++)
1491 double tmp = scaled_re * interpolated_u[k];
1494 tmp -= scaled_re_st * mesh_velocity[k];
1496 sum -= r * tmp * d_dudx_dX(p, q, 0, k) * testf_;
1499 sum -= tmp * interpolated_dudx(0, k) * psif[q] * testf_;
1504 sum += scaled_re_st * r * pos_time_weight *
1505 interpolated_dudx(0, p) * psif[q] * testf_;
1511 sum -= scaled_re_st * dudt[0] * psif[q] * testf_;
1517 sum += 2.0 * scaled_re_inv_ro * interpolated_u[2] * psif[q] *
1522 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1523 sum * J * w * hang_weight;
1530 if (element_has_node_with_aux_node_update_fct)
1533 for (
unsigned q_local = 0; q_local < n_node; q_local++)
1537 unsigned n_master2 = 1;
1538 double hang_weight2 = 1.0;
1544 Node* actual_shape_controlling_node_pt =
node_pt(q_local);
1547 if (is_node_hanging2)
1552 n_master2 = hang_info2_pt->
nmaster();
1561 for (
unsigned mm = 0; mm < n_master2; mm++)
1563 if (is_node_hanging2)
1565 actual_shape_controlling_node_pt =
1571 unsigned q = local_shape_controlling_node_lookup
1572 [actual_shape_controlling_node_pt];
1575 for (
unsigned p = 0; p < 2; p++)
1578 double tmp = scaled_re_st * r * val_time_weight *
1579 psif[q_local] * testf_;
1580 tmp += r * scaled_re * interpolated_dudx(0, 0) *
1581 psif[q_local] * testf_;
1583 for (
unsigned k = 0; k < 2; k++)
1585 double tmp2 = scaled_re * interpolated_u[k];
1588 tmp2 -= scaled_re_st * mesh_velocity[k];
1590 tmp += r * tmp2 * dpsifdx(q_local, k) * testf_;
1593 tmp += r * visc_ratio * (1.0 +
Gamma[0]) *
1594 dpsifdx(q_local, 0) * dtestfdx(l, 0);
1596 r * visc_ratio * dpsifdx(q_local, 1) * dtestfdx(l, 1);
1597 tmp += visc_ratio * (1.0 +
Gamma[0]) * psif[q_local] *
1601 double sum = -d_U_dX(p, q_local, 0) * tmp;
1604 tmp = scaled_re * r * interpolated_dudx(0, 1) *
1605 psif[q_local] * testf_;
1606 tmp += r * visc_ratio *
Gamma[0] * dpsifdx(q_local, 0) *
1610 sum -= d_U_dX(p, q, 1) * tmp;
1615 (r * scaled_re_inv_ro + scaled_re * interpolated_u[2]) *
1616 psif[q_local] * testf_;
1619 sum += d_U_dX(p, q, 2) * tmp;
1622 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1623 sum * J * w * hang_weight * hang_weight2;
1636 if (is_node_hanging)
1658 for (
unsigned p = 0; p < 2; p++)
1661 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1667 double sum = r * body_force[1] * testf_;
1670 sum += r * scaled_re_inv_fr * testf_ * G[1];
1673 sum += r * interpolated_p * dtestfdx(l, 1);
1679 sum -= visc_ratio * r *
1680 (interpolated_dudx(1, 0) +
1681 Gamma[1] * interpolated_dudx(0, 1)) *
1684 sum -= visc_ratio * r * (1.0 +
Gamma[1]) *
1685 interpolated_dudx(1, 1) * dtestfdx(l, 1);
1688 sum -= scaled_re_st * r * dudt[1] * testf_;
1692 (r * interpolated_u[0] * interpolated_dudx(1, 0) +
1693 r * interpolated_u[1] * interpolated_dudx(1, 1)) *
1699 for (
unsigned k = 0; k < 2; k++)
1701 sum += scaled_re_st * r * mesh_velocity[k] *
1702 interpolated_dudx(1, k) * testf_;
1707 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1708 sum * dJ_dX(p, q) * w * hang_weight;
1714 sum = r * d_body_force_dx(1, p) * psif[q] * testf_;
1717 sum += body_force[1] * psif[q] * testf_;
1723 sum += scaled_re_inv_fr * G[1] * psif[q] * testf_;
1727 sum += r * interpolated_p * d_dtestfdx_dX(p, q, l, 1);
1730 sum += interpolated_p * psif[q] * dtestfdx(l, 1);
1736 ((d_dudx_dX(p, q, 1, 0) +
Gamma[1] * d_dudx_dX(p, q, 0, 1)) *
1738 (interpolated_dudx(1, 0) +
1739 Gamma[1] * interpolated_dudx(0, 1)) *
1740 d_dtestfdx_dX(p, q, l, 0) +
1741 (1.0 +
Gamma[1]) * d_dudx_dX(p, q, 1, 1) * dtestfdx(l, 1) +
1742 (1.0 +
Gamma[1]) * interpolated_dudx(1, 1) *
1743 d_dtestfdx_dX(p, q, l, 1));
1747 visc_ratio * ((interpolated_dudx(1, 0) +
1748 Gamma[1] * interpolated_dudx(0, 1)) *
1749 psif[q] * dtestfdx(l, 0) +
1750 (1.0 +
Gamma[1]) * interpolated_dudx(1, 1) *
1751 psif[q] * dtestfdx(l, 1));
1755 for (
unsigned k = 0; k < 2; k++)
1757 double tmp = scaled_re * interpolated_u[k];
1760 tmp -= scaled_re_st * mesh_velocity[k];
1762 sum -= r * tmp * d_dudx_dX(p, q, 1, k) * testf_;
1765 sum -= tmp * interpolated_dudx(1, k) * psif[q] * testf_;
1770 sum += scaled_re_st * r * pos_time_weight *
1771 interpolated_dudx(1, p) * psif[q] * testf_;
1777 sum -= scaled_re_st * dudt[1] * psif[q] * testf_;
1781 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1782 sum * J * w * hang_weight;
1789 if (element_has_node_with_aux_node_update_fct)
1792 for (
unsigned q_local = 0; q_local < n_node; q_local++)
1796 unsigned n_master2 = 1;
1797 double hang_weight2 = 1.0;
1803 Node* actual_shape_controlling_node_pt =
node_pt(q_local);
1806 if (is_node_hanging2)
1811 n_master2 = hang_info2_pt->
nmaster();
1820 for (
unsigned mm = 0; mm < n_master2; mm++)
1822 if (is_node_hanging2)
1824 actual_shape_controlling_node_pt =
1830 unsigned q = local_shape_controlling_node_lookup
1831 [actual_shape_controlling_node_pt];
1834 for (
unsigned p = 0; p < 2; p++)
1837 double tmp = scaled_re * r * interpolated_dudx(1, 0) *
1838 psif[q_local] * testf_;
1839 tmp += r * visc_ratio *
Gamma[1] * dpsifdx(q_local, 1) *
1843 double sum = -d_U_dX(p, q, 0) * tmp;
1846 tmp = scaled_re_st * r * val_time_weight * psif[q_local] *
1848 tmp += r * scaled_re * interpolated_dudx(1, 1) *
1849 psif[q_local] * testf_;
1851 for (
unsigned k = 0; k < 2; k++)
1853 double tmp2 = scaled_re * interpolated_u[k];
1856 tmp2 -= scaled_re_st * mesh_velocity[k];
1858 tmp += r * tmp2 * dpsifdx(q_local, k) * testf_;
1862 (dpsifdx(q_local, 0) * dtestfdx(l, 0) +
1863 (1.0 +
Gamma[1]) * dpsifdx(q_local, 1) * dtestfdx(l, 1));
1866 sum -= d_U_dX(p, q, 1) * tmp;
1869 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1870 sum * J * w * hang_weight * hang_weight2;
1883 if (is_node_hanging)
1905 for (
unsigned p = 0; p < 2; p++)
1908 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
1914 double sum = r * body_force[2] * testf_;
1917 sum += r * scaled_re_inv_fr * testf_ * G[2];
1927 (r * interpolated_dudx(2, 0) -
Gamma[0] * interpolated_u[2]) *
1931 visc_ratio * r * interpolated_dudx(2, 1) * dtestfdx(l, 1);
1934 ((interpolated_u[2] / r) -
1935 Gamma[0] * interpolated_dudx(2, 0)) *
1939 sum -= scaled_re_st * r * dudt[2] * testf_;
1943 (r * interpolated_u[0] * interpolated_dudx(2, 0) +
1944 interpolated_u[0] * interpolated_u[2] +
1945 r * interpolated_u[1] * interpolated_dudx(2, 1)) *
1951 for (
unsigned k = 0; k < 2; k++)
1953 sum += scaled_re_st * r * mesh_velocity[k] *
1954 interpolated_dudx(2, k) * testf_;
1959 sum -= 2.0 * r * scaled_re_inv_ro * interpolated_u[0] * testf_;
1962 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1963 sum * dJ_dX(p, q) * w * hang_weight;
1969 sum = r * d_body_force_dx(2, p) * psif[q] * testf_;
1972 sum += body_force[2] * psif[q] * testf_;
1978 sum += scaled_re_inv_fr * G[2] * psif[q] * testf_;
1984 sum -= visc_ratio * r *
1985 (d_dudx_dX(p, q, 2, 0) * dtestfdx(l, 0) +
1986 interpolated_dudx(2, 0) * d_dtestfdx_dX(p, q, l, 0) +
1987 d_dudx_dX(p, q, 2, 1) * dtestfdx(l, 1) +
1988 interpolated_dudx(2, 1) * d_dtestfdx_dX(p, q, l, 1));
1990 sum += visc_ratio *
Gamma[0] * d_dudx_dX(p, q, 2, 0) * testf_;
1995 (interpolated_dudx(2, 0) * psif[q] * dtestfdx(l, 0) +
1996 interpolated_dudx(2, 1) * psif[q] * dtestfdx(l, 1) +
1997 interpolated_u[2] * psif[q] * testf_ / (r * r));
2001 for (
unsigned k = 0; k < 2; k++)
2003 double tmp = scaled_re * interpolated_u[k];
2006 tmp -= scaled_re_st * mesh_velocity[k];
2008 sum -= r * tmp * d_dudx_dX(p, q, 2, k) * testf_;
2011 sum -= tmp * interpolated_dudx(2, k) * psif[q] * testf_;
2016 sum += scaled_re_st * r * pos_time_weight *
2017 interpolated_dudx(2, p) * psif[q] * testf_;
2023 sum -= scaled_re_st * dudt[2] * psif[q] * testf_;
2029 sum -= 2.0 * scaled_re_inv_ro * interpolated_u[0] * psif[q] *
2034 dresidual_dnodal_coordinates(local_eqn, p, q) +=
2035 sum * J * w * hang_weight;
2042 if (element_has_node_with_aux_node_update_fct)
2045 for (
unsigned q_local = 0; q_local < n_node; q_local++)
2049 unsigned n_master2 = 1;
2050 double hang_weight2 = 1.0;
2056 Node* actual_shape_controlling_node_pt =
node_pt(q_local);
2059 if (is_node_hanging2)
2064 n_master2 = hang_info2_pt->
nmaster();
2073 for (
unsigned mm = 0; mm < n_master2; mm++)
2075 if (is_node_hanging2)
2077 actual_shape_controlling_node_pt =
2083 unsigned q = local_shape_controlling_node_lookup
2084 [actual_shape_controlling_node_pt];
2087 for (
unsigned p = 0; p < 2; p++)
2090 double tmp = (2.0 * r * scaled_re_inv_ro +
2091 r * scaled_re * interpolated_dudx(2, 0) -
2092 scaled_re * interpolated_u[2]) *
2093 psif[q_local] * testf_;
2096 double sum = -d_U_dX(p, q, 0) * tmp;
2100 sum -= d_U_dX(p, q, 1) * scaled_re * r *
2101 interpolated_dudx(2, 1) * psif[q_local] * testf_;
2104 tmp = scaled_re_st * r * val_time_weight * psif[q_local] *
2107 scaled_re * interpolated_u[0] * psif[q_local] * testf_;
2109 for (
unsigned k = 0; k < 2; k++)
2111 double tmp2 = scaled_re * interpolated_u[k];
2114 tmp2 -= scaled_re_st * mesh_velocity[k];
2116 tmp += r * tmp2 * dpsifdx(q_local, k) * testf_;
2120 (r * dpsifdx(q_local, 0) -
Gamma[0] * psif[q_local]) *
2123 r * visc_ratio * dpsifdx(q_local, 1) * dtestfdx(l, 1);
2126 ((psif[q_local] / r) -
Gamma[0] * dpsifdx(q_local, 0)) *
2130 sum -= d_U_dX(p, q, 2) * tmp;
2133 dresidual_dnodal_coordinates(local_eqn, p, q) +=
2134 sum * J * w * hang_weight * hang_weight2;
2149 for (
unsigned l = 0; l < n_pres; l++)
2152 if (pressure_dof_is_hanging[l])
2159 n_master = hang_info_pt->
nmaster();
2168 for (
unsigned m = 0; m < n_master; m++)
2172 if (pressure_dof_is_hanging[l])
2187 const double testp_ = testp[l];
2193 for (
unsigned p = 0; p < 2; p++)
2196 for (
unsigned q = 0; q < n_shape_controlling_node; q++)
2202 double aux = -r * source;
2205 aux += (interpolated_u[0] + r * interpolated_dudx(0, 0) +
2206 r * interpolated_dudx(1, 1));
2209 dresidual_dnodal_coordinates(local_eqn, p, q) +=
2210 aux * dJ_dX(p, q) * testp_ * w * hang_weight;
2216 aux = -r * source_gradient[p] * psif[q];
2219 aux -= source * psif[q];
2223 aux += r * (d_dudx_dX(p, q, 0, 0) + d_dudx_dX(p, q, 1, 1));
2226 aux += (interpolated_dudx(0, 0) + interpolated_dudx(1, 1)) *
2231 dresidual_dnodal_coordinates(local_eqn, p, q) +=
2232 aux * testp_ * J * w * hang_weight;
2238 if (element_has_node_with_aux_node_update_fct)
2241 for (
unsigned q_local = 0; q_local < n_node; q_local++)
2245 unsigned n_master2 = 1;
2246 double hang_weight2 = 1.0;
2252 Node* actual_shape_controlling_node_pt =
node_pt(q_local);
2255 if (is_node_hanging2)
2260 n_master2 = hang_info2_pt->
nmaster();
2269 for (
unsigned mm = 0; mm < n_master2; mm++)
2271 if (is_node_hanging2)
2273 actual_shape_controlling_node_pt =
2279 unsigned q = local_shape_controlling_node_lookup
2280 [actual_shape_controlling_node_pt];
2283 for (
unsigned p = 0; p < 2; p++)
2285 double aux = d_U_dX(p, q, 0) *
2286 (psif[q_local] + r * dpsifdx(q_local, 0)) +
2287 d_U_dX(p, q, 1) * r * dpsifdx(q_local, 1);
2291 dresidual_dnodal_coordinates(local_eqn, p, q) +=
2292 aux * testp_ * J * w * hang_weight * hang_weight2;
const double & density_ratio() const
Density ratio for element: Element's density relative to the viscosity used in the definition of the ...
const double & re_invro() const
Global Reynolds number multiplied by inverse Rossby number.
virtual double p_axi_nst(const unsigned &n_p) const =0
Pressure at local pressure "node" n_p Uses suitably interpolated value for hanging nodes.
virtual int p_nodal_index_axi_nst() const
Which nodal value represents the pressure?
const double & viscosity_ratio() const
Viscosity ratio for element: Element's viscosity relative to the viscosity used in the definition of ...
const Vector< double > & g() const
Vector of gravitational components.
const double & re() const
Reynolds number.
virtual void pshape_axi_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
virtual double dshape_and_dtest_eulerian_at_knot_axi_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Compute the shape functions and derivatives w.r.t. global coords at ipt-th integration point Return J...
double get_source_fct(const double &time, const unsigned &ipt, const Vector< double > &x)
Calculate the source fct at given time and Eulerian position.
double du_dt_axi_nst(const unsigned &n, const unsigned &i) const
i-th component of du/dt at local node n. Uses suitably interpolated value for hanging nodes.
virtual unsigned npres_axi_nst() const =0
Function to return number of pressure degrees of freedom.
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when the time-derivatives are computed....
virtual void get_source_fct_gradient(const double &time, const unsigned &ipt, const Vector< double > &x, Vector< double > &gradient)
Get gradient of source term at (Eulerian) position x. Computed via function pointer (if set) or by fi...
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
const double & re_invfr() const
Global inverse Froude number.
virtual void get_body_force_gradient_axi_nst(const double &time, const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, DenseMatrix< double > &d_body_force_dx)
Get gradient of body force term at (Eulerian) position x. Computed via function pointer (if set) or b...
virtual int p_local_eqn(const unsigned &n) const =0
Access function for the local equation number information for the pressure. p_local_eqn[n] = local eq...
virtual void get_body_force_axi_nst(const double &time, const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &result)
Calculate the body force fct at a given time and Eulerian position.
virtual unsigned u_index_axi_nst(const unsigned &i) const
Return the index at which the i-th unknown velocity component is stored. The default value,...
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
double * value_pt(const unsigned &i) const
Return the pointer to the i-the stored value. Typically this is required when direct access to the st...
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
double nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n. Produces suitably interpolated values for hanging nodes...
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Return the local equation number corresponding to the i-th value at the n-th local node.
unsigned nnode() const
Return the number of nodes.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
double nodal_position(const unsigned &n, const unsigned &i) const
Return the i-th coordinate at local node n. If the node is hanging, the appropriate interpolation is ...
double dnodal_position_dt(const unsigned &n, const unsigned &i) const
Return the i-th component of nodal velocity: dx/dt at local node n.
static double Default_fd_jacobian_step
Double used for the default finite difference step in elemental jacobian calculations.
unsigned ndof() const
Return the number of equations/dofs in the element.
Class that contains data for hanging nodes.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
unsigned nmaster() const
Return the number of master nodes.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
double & x(const unsigned &i)
Return the i-th nodal coordinate.
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
void perform_auxiliary_node_update_fct()
Execute auxiliary update function (if any) – this can be used to update any nodal values following th...
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
bool has_auxiliary_node_update_fct_pt()
Boolean to indicate if node has a pointer to and auxiliary update function.
bool is_hanging() const
Test whether the node is geometrically hanging.
An OomphLibWarning object which should be created as a temporary object to issue a warning....
////////////////////////////////////////////////////////////////// //////////////////////////////////...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
void fill_in_generic_residual_contribution_axi_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add element's contribution to the elemental residual vector and/or Jacobian matrix and mass matrix fl...
virtual Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure node (Default: NULL, indicating that pressure is not based on nodal interp...
virtual void get_dresidual_dnodal_coordinates(RankThreeTensor< double > &dresidual_dnodal_coordinates)
Compute derivatives of elemental residual vector with respect to nodal coordinates....
unsigned nshape_controlling_nodes()
Number of shape-controlling nodes = the number of non-hanging nodes plus the number of master nodes a...
std::map< Node *, unsigned > shape_controlling_node_lookup()
Return lookup scheme for unique number associated with any of the nodes that actively control the sha...
int local_hang_eqn(Node *const &node_pt, const unsigned &i)
Access function that returns the local equation number for the hanging node variables (values stored ...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
Time *const & time_pt() const
Access function for the pointer to time (const version)
double & time()
Return the current value of the continuous time.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...