66 const unsigned& which_one)
69 if ((which_one == 0) || (which_one == 1))
71 throw OomphLibError(
"Computation of diagonal of pressure mass matrix is "
72 "not impmented yet.\n",
73 OOMPH_CURRENT_FUNCTION,
74 OOMPH_EXCEPTION_LOCATION);
79 veloc_mass_diag.assign(
ndof(), 0.0);
82 const unsigned n_node =
nnode();
85 const unsigned n_value = 3;
89 for (
unsigned i = 0;
i < n_value;
i++)
104 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
121 for (
unsigned l = 0; l < n_node; l++)
130 for (
unsigned l = 0; l < n_node; l++)
133 for (
unsigned i = 0;
i < n_value;
i++)
141 veloc_mass_diag[local_eqn] += test[l] * test[l] *
W;
156 std::ostream& outfile,
174 outfile <<
"ZONE" << std::endl;
180 for (
unsigned ipt = 0; ipt < Nintpt; ipt++)
183 for (
unsigned i = 0;
i < 2;
i++)
198 double W = w * J * x[0];
201 (*exact_soln_pt)(time, x, exact_soln);
204 for (
unsigned i = 0;
i < 3;
i++)
206 norm += exact_soln[
i] * exact_soln[
i] *
W;
212 for (
unsigned i = 0;
i < 2;
i++)
214 outfile << x[
i] <<
" ";
218 for (
unsigned i = 0;
i < 3;
i++)
223 outfile << std::endl;
234 std::ostream& outfile,
251 outfile <<
"ZONE" << std::endl;
257 for (
unsigned ipt = 0; ipt < Nintpt; ipt++)
260 for (
unsigned i = 0;
i < 2;
i++)
275 double W = w * J * x[0];
278 (*exact_soln_pt)(x, exact_soln);
281 for (
unsigned i = 0;
i < 3;
i++)
283 norm += exact_soln[
i] * exact_soln[
i] *
W;
289 for (
unsigned i = 0;
i < 2;
i++)
291 outfile << x[
i] <<
" ";
295 for (
unsigned i = 0;
i < 3;
i++)
300 outfile << std::endl;
311 std::ostream& outfile,
312 const unsigned& nplot,
329 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
338 (*exact_soln_pt)(x, exact_soln);
341 for (
unsigned i = 0;
i < 2;
i++)
343 outfile << x[
i] <<
" ";
347 for (
unsigned i = 0;
i < exact_soln.size();
i++)
349 outfile << exact_soln[
i] <<
" ";
352 outfile << std::endl;
366 std::ostream& outfile,
367 const unsigned& nplot,
385 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
394 (*exact_soln_pt)(time, x, exact_soln);
397 for (
unsigned i = 0;
i < 2;
i++)
399 outfile << x[
i] <<
" ";
403 for (
unsigned i = 0;
i < exact_soln.size();
i++)
405 outfile << exact_soln[
i] <<
" ";
408 outfile << std::endl;
423 const unsigned& nplot,
427 unsigned n_node =
nnode();
443 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
452 for (
unsigned i = 0;
i < 2;
i++)
456 for (
unsigned l = 0; l < n_node; l++)
463 for (
unsigned i = 0;
i < 3;
i++)
467 interpolated_u[
i] = 0.0;
469 for (
unsigned l = 0; l < n_node; l++)
471 interpolated_u[
i] +=
nodal_value(
t, l, u_nodal_index) * psi[l];
476 for (
unsigned i = 0;
i < 2;
i++)
482 for (
unsigned i = 0;
i < 3;
i++)
484 outfile << interpolated_u[
i] <<
" ";
487 outfile << std::endl;
501 const unsigned& nplot)
511 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
517 for (
unsigned i = 0;
i < 2;
i++)
523 for (
unsigned i = 0;
i < 3;
i++)
531 outfile << std::endl;
533 outfile << std::endl;
547 const unsigned& nplot)
557 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
563 for (
unsigned i = 0;
i < 2;
i++)
570 for (
unsigned i = 0;
i < 3;
i++)
581 fprintf(file_pt,
"\n");
584 fprintf(file_pt,
"\n");
597 "Check the dissipation calculation for axisymmetric NSt",
598 OOMPH_CURRENT_FUNCTION,
599 OOMPH_EXCEPTION_LOCATION);
611 for (
unsigned ipt = 0; ipt < Nintpt; ipt++)
614 for (
unsigned i = 0;
i < 2;
i++)
630 double local_diss = 0.0;
631 for (
unsigned i = 0;
i < 3;
i++)
633 for (
unsigned j = 0; j < 3; j++)
635 local_diss += 2.0 * strainrate(
i, j) * strainrate(
i, j);
639 diss += local_diss * w * J;
665 if ((
N.size() == 3) && (
N[2] != 0.0))
668 "Unit normal passed into this fct should either be 2D (r,z) or have a "
669 "zero component in the theta-direction",
670 OOMPH_CURRENT_FUNCTION,
671 OOMPH_EXCEPTION_LOCATION);
683 for (
unsigned i = 0;
i < 3;
i++)
686 for (
unsigned j = 0; j < 3; j++)
688 traction[
i] += 2.0 * strainrate(
i, j) * n_local[j];
700 "Check the dissipation calculation for axisymmetric NSt",
701 OOMPH_CURRENT_FUNCTION,
702 OOMPH_EXCEPTION_LOCATION);
709 double local_diss = 0.0;
710 for (
unsigned i = 0;
i < 3;
i++)
712 for (
unsigned j = 0; j < 3; j++)
714 local_diss += 2.0 * strainrate(
i, j) * strainrate(
i, j);
729 if ((strainrate.
ncol() != 3) || (strainrate.
nrow() != 3))
731 std::ostringstream error_message;
732 error_message <<
"The strain rate has incorrect dimensions "
733 << strainrate.
ncol() <<
" x " << strainrate.
nrow()
734 <<
" Not 3" << std::endl;
737 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
742 unsigned n_node =
nnode();
752 double interpolated_r = 0.0;
762 double duphidr = 0.0;
763 double duphidz = 0.0;
766 unsigned u_nodal_index[3];
767 for (
unsigned i = 0;
i < 3; ++
i)
774 for (
unsigned l = 0; l < n_node; l++)
782 durdr +=
nodal_value(l, u_nodal_index[0]) * dpsidx(l, 0);
783 durdz +=
nodal_value(l, u_nodal_index[0]) * dpsidx(l, 1);
785 duzdr +=
nodal_value(l, u_nodal_index[1]) * dpsidx(l, 0);
786 duzdz +=
nodal_value(l, u_nodal_index[1]) * dpsidx(l, 1);
788 duphidr +=
nodal_value(l, u_nodal_index[2]) * dpsidx(l, 0);
789 duphidz +=
nodal_value(l, u_nodal_index[2]) * dpsidx(l, 1);
795 strainrate(0, 0) = durdr;
796 strainrate(0, 1) = 0.5 * (durdz + duzdr);
797 strainrate(1, 0) = strainrate(0, 1);
798 strainrate(0, 2) = 0.0;
799 strainrate(2, 0) = strainrate(0, 2);
800 strainrate(1, 1) = duzdz;
801 strainrate(1, 2) = 0.5 * duphidz;
802 strainrate(2, 1) = strainrate(1, 2);
803 strainrate(2, 2) = 0.0;
808 if (std::fabs(interpolated_r) > 1.0e-16)
810 double inverse_radius = 1.0 / interpolated_r;
811 strainrate(0, 2) = 0.5 * (duphidr - inverse_radius * uphi);
812 strainrate(2, 0) = strainrate(0, 2);
813 strainrate(2, 2) = inverse_radius * ur;
824 "Check the kinetic energy calculation for axisymmetric NSt",
825 OOMPH_CURRENT_FUNCTION,
826 OOMPH_EXCEPTION_LOCATION);
838 for (
unsigned ipt = 0; ipt < Nintpt; ipt++)
841 for (
unsigned i = 0;
i < 2;
i++)
853 double veloc_squared = 0.0;
854 for (
unsigned i = 0;
i < 3;
i++)
872 double press_int = 0;
881 for (
unsigned ipt = 0; ipt < Nintpt; ipt++)
884 for (
unsigned i = 0;
i < 2;
i++)
902 press_int += press *
W;
921 unsigned n_node =
nnode();
930 unsigned u_nodal_index[3];
931 for (
unsigned i = 0;
i < 3; ++
i)
938 Shape psif(n_node), testf(n_node);
939 DShape dpsifdx(n_node, 2), dtestfdx(n_node, 2);
942 Shape psip(n_pres), testp(n_pres);
960 int local_eqn = 0, local_unknown = 0;
963 for (
unsigned ipt = 0; ipt < Nintpt; ipt++)
972 ipt, psif, dpsifdx, testf, dtestfdx);
986 double interpolated_p = 0.0;
992 for (
unsigned l = 0; l < n_pres; l++)
994 interpolated_p +=
p_axi_nst(l) * psip[l];
1000 for (
unsigned l = 0; l < n_node; l++)
1003 const double psif_ = psif(l);
1005 for (
unsigned i = 0;
i < 2;
i++)
1012 for (
unsigned i = 0;
i < 3;
i++)
1016 interpolated_u[
i] += u_value * psif_;
1019 for (
unsigned j = 0; j < 2; j++)
1021 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
1030 for (
unsigned l = 0; l < n_node; l++)
1033 for (
unsigned i = 0;
i < 2;
i++)
1059 for (
unsigned l = 0; l < n_node; l++)
1067 residuals[local_eqn] += r * body_force[0] * testf[l] *
W;
1070 residuals[local_eqn] += r * scaled_re_inv_fr * testf[l] * G[0] *
W;
1073 residuals[local_eqn] +=
1074 interpolated_p * (testf[l] + r * dtestfdx(l, 0)) *
W;
1080 residuals[local_eqn] -= visc_ratio * r * (1.0 +
Gamma[0]) *
1081 interpolated_dudx(0, 0) * dtestfdx(l, 0) *
W;
1083 residuals[local_eqn] -=
1085 (interpolated_dudx(0, 1) +
Gamma[0] * interpolated_dudx(1, 0)) *
1088 residuals[local_eqn] -= visc_ratio * (1.0 +
Gamma[0]) *
1089 interpolated_u[0] * testf[l] *
W / r;
1093 residuals[local_eqn] -= scaled_re_st * r * dudt[0] * testf[l] *
W;
1096 residuals[local_eqn] -=
1098 (r * interpolated_u[0] * interpolated_dudx(0, 0) -
1099 interpolated_u[2] * interpolated_u[2] +
1100 r * interpolated_u[1] * interpolated_dudx(0, 1)) *
1106 for (
unsigned k = 0; k < 2; k++)
1108 residuals[local_eqn] += scaled_re_st * r * mesh_velocity[k] *
1109 interpolated_dudx(0, k) * testf[l] *
W;
1114 residuals[local_eqn] +=
1115 2.0 * r * scaled_re_inv_ro * interpolated_u[2] * testf[l] *
W;
1121 for (
unsigned l2 = 0; l2 < n_node; l2++)
1125 if (local_unknown >= 0)
1130 mass_matrix(local_eqn, local_unknown) +=
1131 scaled_re_st * r * psif[l2] * testf[l] *
W;
1135 jacobian(local_eqn, local_unknown) -=
1136 visc_ratio * r * (1.0 +
Gamma[0]) * dpsifdx(l2, 0) *
1139 jacobian(local_eqn, local_unknown) -=
1140 visc_ratio * r * dpsifdx(l2, 1) * dtestfdx(l, 1) *
W;
1142 jacobian(local_eqn, local_unknown) -=
1143 visc_ratio * (1.0 +
Gamma[0]) * psif[l2] * testf[l] *
W / r;
1147 jacobian(local_eqn, local_unknown) -=
1153 jacobian(local_eqn, local_unknown) -=
1155 (r * psif[l2] * interpolated_dudx(0, 0) +
1156 r * interpolated_u[0] * dpsifdx(l2, 0) +
1157 r * interpolated_u[1] * dpsifdx(l2, 1)) *
1163 for (
unsigned k = 0; k < 2; k++)
1165 jacobian(local_eqn, local_unknown) +=
1166 scaled_re_st * r * mesh_velocity[k] * dpsifdx(l2, k) *
1175 if (local_unknown >= 0)
1177 jacobian(local_eqn, local_unknown) -=
1178 visc_ratio * r *
Gamma[0] * dpsifdx(l2, 0) * dtestfdx(l, 1) *
1182 jacobian(local_eqn, local_unknown) -= scaled_re * r * psif[l2] *
1183 interpolated_dudx(0, 1) *
1189 if (local_unknown >= 0)
1192 jacobian(local_eqn, local_unknown) -= -scaled_re * 2.0 *
1194 psif[l2] * testf[l] *
W;
1197 jacobian(local_eqn, local_unknown) +=
1198 2.0 * r * scaled_re_inv_ro * psif[l2] * testf[l] *
W;
1204 for (
unsigned l2 = 0; l2 < n_pres; l2++)
1208 if (local_unknown >= 0)
1210 jacobian(local_eqn, local_unknown) +=
1211 psip[l2] * (testf[l] + r * dtestfdx(l, 0)) *
W;
1225 residuals[local_eqn] += r * body_force[1] * testf[l] *
W;
1228 residuals[local_eqn] += r * scaled_re_inv_fr * testf[l] * G[1] *
W;
1231 residuals[local_eqn] += r * interpolated_p * dtestfdx(l, 1) *
W;
1237 residuals[local_eqn] -=
1239 (interpolated_dudx(1, 0) +
Gamma[1] * interpolated_dudx(0, 1)) *
1242 residuals[local_eqn] -= visc_ratio * r * (1.0 +
Gamma[1]) *
1243 interpolated_dudx(1, 1) * dtestfdx(l, 1) *
W;
1247 residuals[local_eqn] -= scaled_re_st * r * dudt[1] * testf[l] *
W;
1250 residuals[local_eqn] -=
1252 (r * interpolated_u[0] * interpolated_dudx(1, 0) +
1253 r * interpolated_u[1] * interpolated_dudx(1, 1)) *
1259 for (
unsigned k = 0; k < 2; k++)
1261 residuals[local_eqn] += scaled_re_st * r * mesh_velocity[k] *
1262 interpolated_dudx(1, k) * testf[l] *
W;
1270 for (
unsigned l2 = 0; l2 < n_node; l2++)
1274 if (local_unknown >= 0)
1280 jacobian(local_eqn, local_unknown) -=
1281 visc_ratio * r *
Gamma[1] * dpsifdx(l2, 1) * dtestfdx(l, 0) *
1285 jacobian(local_eqn, local_unknown) -= scaled_re * r * psif[l2] *
1286 interpolated_dudx(1, 0) *
1292 if (local_unknown >= 0)
1297 mass_matrix(local_eqn, local_unknown) +=
1298 scaled_re_st * r * psif[l2] * testf[l] *
W;
1306 jacobian(local_eqn, local_unknown) -=
1307 visc_ratio * r * dpsifdx(l2, 0) * dtestfdx(l, 0) *
W;
1309 jacobian(local_eqn, local_unknown) -=
1310 visc_ratio * r * (1.0 +
Gamma[1]) * dpsifdx(l2, 1) *
1315 jacobian(local_eqn, local_unknown) -=
1321 jacobian(local_eqn, local_unknown) -=
1323 (r * interpolated_u[0] * dpsifdx(l2, 0) +
1324 r * psif[l2] * interpolated_dudx(1, 1) +
1325 r * interpolated_u[1] * dpsifdx(l2, 1)) *
1332 for (
unsigned k = 0; k < 2; k++)
1334 jacobian(local_eqn, local_unknown) +=
1335 scaled_re_st * r * mesh_velocity[k] * dpsifdx(l2, k) *
1346 for (
unsigned l2 = 0; l2 < n_pres; l2++)
1350 if (local_unknown >= 0)
1352 jacobian(local_eqn, local_unknown) +=
1353 r * psip[l2] * dtestfdx(l, 1) *
W;
1366 residuals[local_eqn] += r * body_force[2] * testf[l] *
W;
1369 residuals[local_eqn] += r * scaled_re_inv_fr * testf[l] * G[2] *
W;
1377 residuals[local_eqn] -=
1379 (r * interpolated_dudx(2, 0) -
Gamma[0] * interpolated_u[2]) *
1382 residuals[local_eqn] -=
1383 visc_ratio * r * interpolated_dudx(2, 1) * dtestfdx(l, 1) *
W;
1385 residuals[local_eqn] -=
1387 ((interpolated_u[2] / r) -
Gamma[0] * interpolated_dudx(2, 0)) *
1393 residuals[local_eqn] -= scaled_re_st * r * dudt[2] * testf[l] *
W;
1396 residuals[local_eqn] -=
1398 (r * interpolated_u[0] * interpolated_dudx(2, 0) +
1399 interpolated_u[0] * interpolated_u[2] +
1400 r * interpolated_u[1] * interpolated_dudx(2, 1)) *
1406 for (
unsigned k = 0; k < 2; k++)
1408 residuals[local_eqn] += scaled_re_st * r * mesh_velocity[k] *
1409 interpolated_dudx(2, k) * testf[l] *
W;
1414 residuals[local_eqn] -=
1415 2.0 * r * scaled_re_inv_ro * interpolated_u[0] * testf[l] *
W;
1421 for (
unsigned l2 = 0; l2 < n_node; l2++)
1425 if (local_unknown >= 0)
1428 jacobian(local_eqn, local_unknown) -=
1430 (r * psif[l2] * interpolated_dudx(2, 0) +
1431 psif[l2] * interpolated_u[2]) *
1435 jacobian(local_eqn, local_unknown) -=
1436 2.0 * r * scaled_re_inv_ro * psif[l2] * testf[l] *
W;
1441 if (local_unknown >= 0)
1444 jacobian(local_eqn, local_unknown) -= scaled_re * r * psif[l2] *
1445 interpolated_dudx(2, 1) *
1451 if (local_unknown >= 0)
1456 mass_matrix(local_eqn, local_unknown) +=
1457 scaled_re_st * r * psif[l2] * testf[l] *
W;
1464 jacobian(local_eqn, local_unknown) -=
1465 visc_ratio * (r * dpsifdx(l2, 0) -
Gamma[0] * psif[l2]) *
1468 jacobian(local_eqn, local_unknown) -=
1469 visc_ratio * r * dpsifdx(l2, 1) * dtestfdx(l, 1) *
W;
1471 jacobian(local_eqn, local_unknown) -=
1472 visc_ratio * ((psif[l2] / r) -
Gamma[0] * dpsifdx(l2, 0)) *
1477 jacobian(local_eqn, local_unknown) -=
1483 jacobian(local_eqn, local_unknown) -=
1485 (r * interpolated_u[0] * dpsifdx(l2, 0) +
1486 interpolated_u[0] * psif[l2] +
1487 r * interpolated_u[1] * dpsifdx(l2, 1)) *
1493 for (
unsigned k = 0; k < 2; k++)
1495 jacobian(local_eqn, local_unknown) +=
1496 scaled_re_st * r * mesh_velocity[k] * dpsifdx(l2, k) *
1515 for (
unsigned l = 0; l < n_pres; l++)
1522 residuals[local_eqn] -= r * source * testp[l] *
W;
1525 residuals[local_eqn] +=
1526 (interpolated_u[0] + r * interpolated_dudx(0, 0) +
1527 r * interpolated_dudx(1, 1)) *
1534 for (
unsigned l2 = 0; l2 < n_node; l2++)
1538 if (local_unknown >= 0)
1540 jacobian(local_eqn, local_unknown) +=
1541 (psif[l2] + r * dpsifdx(l2, 0)) * testp[l] *
W;
1546 if (local_unknown >= 0)
1548 jacobian(local_eqn, local_unknown) +=
1549 r * dpsifdx(l2, 1) * testp[l] *
W;
1580 const unsigned n_node =
nnode();
1586 unsigned u_nodal_index[3];
1587 for (
unsigned i = 0;
i < 3;
i++)
1594 Shape psif(n_node), testf(n_node);
1595 DShape dpsifdx(n_node, 2), dtestfdx(n_node, 2);
1598 Shape psip(n_pres), testp(n_pres);
1644 bool element_has_node_with_aux_node_update_fct =
false;
1645 for (
unsigned q = 0; q < n_node; q++)
1653 element_has_node_with_aux_node_update_fct =
true;
1657 std::ostringstream warning_stream;
1658 warning_stream <<
"\nThe functionality to evaluate the additional"
1659 <<
"\ncontribution to the deriv of the residual eqn"
1660 <<
"\nw.r.t. the nodal coordinates which comes about"
1661 <<
"\nif a node's values are updated using an auxiliary"
1662 <<
"\nnode update function has NOT been tested for"
1663 <<
"\naxisymmetric Navier-Stokes elements. Use at your"
1664 <<
"\nown risk" << std::endl;
1666 warning_stream.str(),
1667 "AxisymmetricNavierStokesEquations::get_dresidual_dnodal_coordinates",
1668 OOMPH_EXCEPTION_LOCATION);
1672 for (
unsigned i = 0;
i < 3;
i++)
1674 u_ref[
i] = *(nod_pt->
value_pt(u_nodal_index[
i]));
1678 for (
unsigned p = 0; p < 2; p++)
1681 double backup = nod_pt->
x(p);
1685 nod_pt->
x(p) += eps_fd;
1691 for (
unsigned i = 0;
i < 3;
i++)
1695 (*(nod_pt->
value_pt(u_nodal_index[
i])) - u_ref[
i]) / eps_fd;
1699 nod_pt->
x(p) = backup;
1711 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1714 for (
unsigned i = 0;
i < 2;
i++)
1742 double interpolated_p = 0.0;
1748 for (
unsigned l = 0; l < n_pres; l++)
1750 interpolated_p +=
p_axi_nst(l) * psip[l];
1757 for (
unsigned l = 0; l < n_node; l++)
1760 const double psif_ = psif(l);
1763 for (
unsigned i = 0;
i < 2;
i++)
1769 for (
unsigned i = 0;
i < 3;
i++)
1773 interpolated_u[
i] += u_value * psif_;
1777 for (
unsigned j = 0; j < 2; j++)
1779 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
1788 for (
unsigned l = 0; l < n_node; l++)
1791 for (
unsigned i = 0;
i < 2;
i++)
1799 for (
unsigned q = 0; q < n_node; q++)
1802 for (
unsigned p = 0; p < 2; p++)
1805 for (
unsigned i = 0;
i < 3;
i++)
1808 for (
unsigned k = 0; k < 2; k++)
1813 for (
unsigned j = 0; j < n_node; j++)
1816 d_dpsifdx_dX(p, q, j, k);
1818 d_dudx_dX(p, q,
i, k) = aux;
1826 const double pos_time_weight =
1828 const double val_time_weight =
1861 for (
unsigned l = 0; l < n_node; l++)
1864 const double testf_ = testf[l];
1876 for (
unsigned p = 0; p < 2; p++)
1879 for (
unsigned q = 0; q < n_node; q++)
1885 double sum = r * body_force[0] * testf_;
1888 sum += r * scaled_re_inv_fr * testf_ * G[0];
1891 sum += interpolated_p * (testf_ + r * dtestfdx(l, 0));
1897 sum -= visc_ratio * r * (1.0 +
Gamma[0]) *
1898 interpolated_dudx(0, 0) * dtestfdx(l, 0);
1902 (interpolated_dudx(0, 1) +
Gamma[0] * interpolated_dudx(1, 0)) *
1906 visc_ratio * (1.0 +
Gamma[0]) * interpolated_u[0] * testf_ / r;
1909 sum -= scaled_re_st * r * dudt[0] * testf_;
1913 (r * interpolated_u[0] * interpolated_dudx(0, 0) -
1914 interpolated_u[2] * interpolated_u[2] +
1915 r * interpolated_u[1] * interpolated_dudx(0, 1)) *
1921 for (
unsigned k = 0; k < 2; k++)
1923 sum += scaled_re_st * r * mesh_velocity[k] *
1924 interpolated_dudx(0, k) * testf_;
1929 sum += 2.0 * r * scaled_re_inv_ro * interpolated_u[2] * testf_;
1932 dresidual_dnodal_coordinates(local_eqn, p, q) +=
1933 sum * dJ_dX(p, q) * w;
1939 sum = r * d_body_force_dx(0, p) * psif[q] * testf_;
1942 sum += body_force[0] * psif[q] * testf_;
1948 sum += scaled_re_inv_fr * G[0] * psif[q] * testf_;
1952 sum += r * interpolated_p * d_dtestfdx_dX(p, q, l, 0);
1955 sum += interpolated_p * psif[q] * dtestfdx(l, 0);
1962 (d_dudx_dX(p, q, 0, 0) * dtestfdx(l, 0) +
1963 interpolated_dudx(0, 0) * d_dtestfdx_dX(p, q, l, 0)) +
1964 (d_dudx_dX(p, q, 0, 1) +
Gamma[0] * d_dudx_dX(p, q, 1, 0)) *
1966 (interpolated_dudx(0, 1) +
1967 Gamma[0] * interpolated_dudx(1, 0)) *
1968 d_dtestfdx_dX(p, q, l, 1));
1973 (interpolated_dudx(0, 0) * psif[q] * dtestfdx(l, 0) -
1974 interpolated_u[0] * psif[q] * testf_ / (r * r)) +
1975 (interpolated_dudx(0, 1) +
1976 Gamma[0] * interpolated_dudx(1, 0)) *
1977 psif[q] * dtestfdx(l, 1));
1981 for (
unsigned k = 0; k < 2; k++)
1983 double tmp = scaled_re * interpolated_u[k];
1986 tmp -= scaled_re_st * mesh_velocity[k];
1988 sum -= r * tmp * d_dudx_dX(p, q, 0, k) * testf_;
1991 sum -= tmp * interpolated_dudx(0, k) * psif[q] * testf_;
1996 sum += scaled_re_st * r * pos_time_weight *
1997 interpolated_dudx(0, p) * psif[q] * testf_;
2003 sum -= scaled_re_st * dudt[0] * psif[q] * testf_;
2010 2.0 * scaled_re_inv_ro * interpolated_u[2] * psif[q] * testf_;
2014 dresidual_dnodal_coordinates(local_eqn, p, q) += sum * J * w;
2018 if (element_has_node_with_aux_node_update_fct)
2022 scaled_re_st * r * val_time_weight * psif[q] * testf_;
2024 r * scaled_re * interpolated_dudx(0, 0) * psif[q] * testf_;
2025 for (
unsigned k = 0; k < 2; k++)
2027 double tmp2 = scaled_re * interpolated_u[k];
2030 tmp2 -= scaled_re_st * mesh_velocity[k];
2032 tmp += r * tmp2 * dpsifdx(q, k) * testf_;
2035 tmp += r * visc_ratio * (1.0 +
Gamma[0]) * dpsifdx(q, 0) *
2037 tmp += r * visc_ratio * dpsifdx(q, 1) * dtestfdx(l, 1);
2038 tmp += visc_ratio * (1.0 +
Gamma[0]) * psif[q] * testf_ / r;
2041 sum = -d_U_dX(p, q, 0) * tmp;
2045 scaled_re * r * interpolated_dudx(0, 1) * psif[q] * testf_;
2047 r * visc_ratio *
Gamma[0] * dpsifdx(q, 0) * dtestfdx(l, 1);
2050 sum -= d_U_dX(p, q, 1) * tmp;
2054 (r * scaled_re_inv_ro + scaled_re * interpolated_u[2]) *
2058 sum += d_U_dX(p, q, 2) * tmp;
2061 dresidual_dnodal_coordinates(local_eqn, p, q) += sum * J * w;
2077 for (
unsigned p = 0; p < 2; p++)
2080 for (
unsigned q = 0; q < n_node; q++)
2086 double sum = r * body_force[1] * testf_;
2089 sum += r * scaled_re_inv_fr * testf_ * G[1];
2092 sum += r * interpolated_p * dtestfdx(l, 1);
2100 (interpolated_dudx(1, 0) +
Gamma[1] * interpolated_dudx(0, 1)) *
2103 sum -= visc_ratio * r * (1.0 +
Gamma[1]) *
2104 interpolated_dudx(1, 1) * dtestfdx(l, 1);
2107 sum -= scaled_re_st * r * dudt[1] * testf_;
2111 (r * interpolated_u[0] * interpolated_dudx(1, 0) +
2112 r * interpolated_u[1] * interpolated_dudx(1, 1)) *
2118 for (
unsigned k = 0; k < 2; k++)
2120 sum += scaled_re_st * r * mesh_velocity[k] *
2121 interpolated_dudx(1, k) * testf_;
2126 dresidual_dnodal_coordinates(local_eqn, p, q) +=
2127 sum * dJ_dX(p, q) * w;
2133 sum = r * d_body_force_dx(1, p) * psif[q] * testf_;
2136 sum += body_force[1] * psif[q] * testf_;
2142 sum += scaled_re_inv_fr * G[1] * psif[q] * testf_;
2146 sum += r * interpolated_p * d_dtestfdx_dX(p, q, l, 1);
2149 sum += interpolated_p * psif[q] * dtestfdx(l, 1);
2155 ((d_dudx_dX(p, q, 1, 0) +
Gamma[1] * d_dudx_dX(p, q, 0, 1)) *
2157 (interpolated_dudx(1, 0) +
2158 Gamma[1] * interpolated_dudx(0, 1)) *
2159 d_dtestfdx_dX(p, q, l, 0) +
2160 (1.0 +
Gamma[1]) * d_dudx_dX(p, q, 1, 1) * dtestfdx(l, 1) +
2161 (1.0 +
Gamma[1]) * interpolated_dudx(1, 1) *
2162 d_dtestfdx_dX(p, q, l, 1));
2166 visc_ratio * ((interpolated_dudx(1, 0) +
2167 Gamma[1] * interpolated_dudx(0, 1)) *
2168 psif[q] * dtestfdx(l, 0) +
2169 (1.0 +
Gamma[1]) * interpolated_dudx(1, 1) *
2170 psif[q] * dtestfdx(l, 1));
2174 for (
unsigned k = 0; k < 2; k++)
2176 double tmp = scaled_re * interpolated_u[k];
2179 tmp -= scaled_re_st * mesh_velocity[k];
2181 sum -= r * tmp * d_dudx_dX(p, q, 1, k) * testf_;
2184 sum -= tmp * interpolated_dudx(1, k) * psif[q] * testf_;
2189 sum += scaled_re_st * r * pos_time_weight *
2190 interpolated_dudx(1, p) * psif[q] * testf_;
2196 sum -= scaled_re_st * dudt[1] * psif[q] * testf_;
2200 dresidual_dnodal_coordinates(local_eqn, p, q) += sum * J * w;
2204 if (element_has_node_with_aux_node_update_fct)
2208 scaled_re * r * interpolated_dudx(1, 0) * psif[q] * testf_;
2210 r * visc_ratio *
Gamma[1] * dpsifdx(q, 1) * dtestfdx(l, 0);
2213 sum = -d_U_dX(p, q, 0) * tmp;
2216 tmp = scaled_re_st * r * val_time_weight * psif[q] * testf_;
2218 r * scaled_re * interpolated_dudx(1, 1) * psif[q] * testf_;
2219 for (
unsigned k = 0; k < 2; k++)
2221 double tmp2 = scaled_re * interpolated_u[k];
2224 tmp2 -= scaled_re_st * mesh_velocity[k];
2226 tmp += r * tmp2 * dpsifdx(q, k) * testf_;
2228 tmp += r * visc_ratio *
2229 (dpsifdx(q, 0) * dtestfdx(l, 0) +
2230 (1.0 +
Gamma[1]) * dpsifdx(q, 1) * dtestfdx(l, 1));
2233 sum -= d_U_dX(p, q, 1) * tmp;
2236 dresidual_dnodal_coordinates(local_eqn, p, q) += sum * J * w;
2252 for (
unsigned p = 0; p < 2; p++)
2255 for (
unsigned q = 0; q < n_node; q++)
2261 double sum = r * body_force[2] * testf_;
2264 sum += r * scaled_re_inv_fr * testf_ * G[2];
2274 (r * interpolated_dudx(2, 0) -
Gamma[0] * interpolated_u[2]) *
2277 sum -= visc_ratio * r * interpolated_dudx(2, 1) * dtestfdx(l, 1);
2281 ((interpolated_u[2] / r) -
Gamma[0] * interpolated_dudx(2, 0)) *
2285 sum -= scaled_re_st * r * dudt[2] * testf_;
2289 (r * interpolated_u[0] * interpolated_dudx(2, 0) +
2290 interpolated_u[0] * interpolated_u[2] +
2291 r * interpolated_u[1] * interpolated_dudx(2, 1)) *
2297 for (
unsigned k = 0; k < 2; k++)
2299 sum += scaled_re_st * r * mesh_velocity[k] *
2300 interpolated_dudx(2, k) * testf_;
2305 sum -= 2.0 * r * scaled_re_inv_ro * interpolated_u[0] * testf_;
2308 dresidual_dnodal_coordinates(local_eqn, p, q) +=
2309 sum * dJ_dX(p, q) * w;
2315 sum = r * d_body_force_dx(2, p) * psif[q] * testf_;
2318 sum += body_force[2] * psif[q] * testf_;
2324 sum += scaled_re_inv_fr * G[2] * psif[q] * testf_;
2330 sum -= visc_ratio * r *
2331 (d_dudx_dX(p, q, 2, 0) * dtestfdx(l, 0) +
2332 interpolated_dudx(2, 0) * d_dtestfdx_dX(p, q, l, 0) +
2333 d_dudx_dX(p, q, 2, 1) * dtestfdx(l, 1) +
2334 interpolated_dudx(2, 1) * d_dtestfdx_dX(p, q, l, 1));
2336 sum += visc_ratio *
Gamma[0] * d_dudx_dX(p, q, 2, 0) * testf_;
2341 (interpolated_dudx(2, 0) * psif[q] * dtestfdx(l, 0) +
2342 interpolated_dudx(2, 1) * psif[q] * dtestfdx(l, 1) +
2343 interpolated_u[2] * psif[q] * testf_ / (r * r));
2347 for (
unsigned k = 0; k < 2; k++)
2349 double tmp = scaled_re * interpolated_u[k];
2352 tmp -= scaled_re_st * mesh_velocity[k];
2354 sum -= r * tmp * d_dudx_dX(p, q, 2, k) * testf_;
2357 sum -= tmp * interpolated_dudx(2, k) * psif[q] * testf_;
2362 sum += scaled_re_st * r * pos_time_weight *
2363 interpolated_dudx(2, p) * psif[q] * testf_;
2369 sum -= scaled_re_st * dudt[2] * psif[q] * testf_;
2376 2.0 * scaled_re_inv_ro * interpolated_u[0] * psif[q] * testf_;
2380 dresidual_dnodal_coordinates(local_eqn, p, q) += sum * J * w;
2384 if (element_has_node_with_aux_node_update_fct)
2387 double tmp = (2.0 * r * scaled_re_inv_ro +
2388 r * scaled_re * interpolated_dudx(2, 0) -
2389 scaled_re * interpolated_u[2]) *
2393 sum = -d_U_dX(p, q, 0) * tmp;
2397 sum -= d_U_dX(p, q, 1) * scaled_re * r *
2398 interpolated_dudx(2, 1) * psif[q] * testf_;
2401 tmp = scaled_re_st * r * val_time_weight * psif[q] * testf_;
2402 tmp -= scaled_re * interpolated_u[0] * psif[q] * testf_;
2403 for (
unsigned k = 0; k < 2; k++)
2405 double tmp2 = scaled_re * interpolated_u[k];
2408 tmp2 -= scaled_re_st * mesh_velocity[k];
2410 tmp += r * tmp2 * dpsifdx(q, k) * testf_;
2412 tmp += visc_ratio * (r * dpsifdx(q, 0) -
Gamma[0] * psif[q]) *
2414 tmp += r * visc_ratio * dpsifdx(q, 1) * dtestfdx(l, 1);
2415 tmp += visc_ratio * ((psif[q] / r) -
Gamma[0] * dpsifdx(q, 0)) *
2419 sum -= d_U_dX(p, q, 2) * tmp;
2422 dresidual_dnodal_coordinates(local_eqn, p, q) += sum * J * w;
2436 for (
unsigned l = 0; l < n_pres; l++)
2441 const double testp_ = testp[l];
2447 for (
unsigned p = 0; p < 2; p++)
2450 for (
unsigned q = 0; q < n_node; q++)
2456 double aux = -r * source;
2459 aux += (interpolated_u[0] + r * interpolated_dudx(0, 0) +
2460 r * interpolated_dudx(1, 1));
2463 dresidual_dnodal_coordinates(local_eqn, p, q) +=
2464 aux * dJ_dX(p, q) * testp_ * w;
2470 aux = -r * source_gradient[p] * psif[q];
2473 aux -= source * psif[q];
2477 aux += r * (d_dudx_dX(p, q, 0, 0) + d_dudx_dX(p, q, 1, 1));
2481 (interpolated_dudx(0, 0) + interpolated_dudx(1, 1)) * psif[q];
2486 if (element_has_node_with_aux_node_update_fct)
2488 aux += d_U_dX(p, q, 0) * (psif[q] + r * dpsifdx(q, 0));
2489 aux += d_U_dX(p, q, 1) * r * dpsifdx(q, 1);
2493 dresidual_dnodal_coordinates(local_eqn, p, q) +=
2494 aux * testp_ * J * w;
2511 double*
const& parameter_pt,
2518 if (parameter_pt != this->
re_pt())
2520 std::ostringstream error_stream;
2522 <<
"Cannot compute analytic jacobian for parameter addressed by "
2523 << parameter_pt <<
"\n";
2524 error_stream <<
"Can only compute derivatives wrt Re (" <<
Re_pt <<
")\n";
2526 error_stream.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
2530 bool diff_re =
false;
2531 bool diff_re_st =
false;
2532 bool diff_re_inv_fr =
false;
2533 bool diff_re_inv_ro =
false;
2536 if (parameter_pt == this->
re_pt())
2540 if (parameter_pt == this->
re_st_pt())
2546 diff_re_inv_fr =
true;
2550 diff_re_inv_ro =
true;
2555 unsigned n_node =
nnode();
2561 unsigned u_nodal_index[3];
2562 for (
unsigned i = 0;
i < 3; ++
i)
2569 Shape psif(n_node), testf(n_node);
2570 DShape dpsifdx(n_node, 2), dtestfdx(n_node, 2);
2573 Shape psip(n_pres), testp(n_pres);
2592 int local_eqn = 0, local_unknown = 0;
2595 for (
unsigned ipt = 0; ipt < Nintpt; ipt++)
2604 ipt, psif, dpsifdx, testf, dtestfdx);
2618 double interpolated_p = 0.0;
2624 for (
unsigned l = 0; l < n_pres; l++)
2626 interpolated_p +=
p_axi_nst(l) * psip[l];
2632 for (
unsigned l = 0; l < n_node; l++)
2635 const double psif_ = psif(l);
2637 for (
unsigned i = 0;
i < 2;
i++)
2644 for (
unsigned i = 0;
i < 3;
i++)
2648 interpolated_u[
i] += u_value * psif_;
2651 for (
unsigned j = 0; j < 2; j++)
2653 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
2662 for (
unsigned l = 0; l < n_node; l++)
2665 for (
unsigned i = 0;
i < 2;
i++)
2692 for (
unsigned l = 0; l < n_node; l++)
2707 dres_dparam[local_eqn] += r * dens_ratio * testf[l] * G[0] *
W;
2732 dres_dparam[local_eqn] -= dens_ratio * r * dudt[0] * testf[l] *
W;
2738 dres_dparam[local_eqn] -=
2740 (r * interpolated_u[0] * interpolated_dudx(0, 0) -
2741 interpolated_u[2] * interpolated_u[2] +
2742 r * interpolated_u[1] * interpolated_dudx(0, 1)) *
2751 for (
unsigned k = 0; k < 2; k++)
2753 dres_dparam[local_eqn] += dens_ratio * r * mesh_velocity[k] *
2754 interpolated_dudx(0, k) * testf[l] *
2763 dres_dparam[local_eqn] +=
2764 2.0 * r * dens_ratio * interpolated_u[2] * testf[l] *
W;
2771 for (
unsigned l2 = 0; l2 < n_node; l2++)
2775 if (local_unknown >= 0)
2782 dmass_matrix_dparam(local_eqn, local_unknown) +=
2783 dens_ratio * r * psif[l2] * testf[l] *
W;
2802 djac_dparam(local_eqn, local_unknown) -=
2811 djac_dparam(local_eqn, local_unknown) -=
2813 (r * psif[l2] * interpolated_dudx(0, 0) +
2814 r * interpolated_u[0] * dpsifdx(l2, 0) +
2815 r * interpolated_u[1] * dpsifdx(l2, 1)) *
2822 for (
unsigned k = 0; k < 2; k++)
2826 djac_dparam(local_eqn, local_unknown) +=
2827 dens_ratio * r * mesh_velocity[k] * dpsifdx(l2, k) *
2836 if (local_unknown >= 0)
2844 djac_dparam(local_eqn, local_unknown) -=
2845 dens_ratio * r * psif[l2] * interpolated_dudx(0, 1) *
2852 if (local_unknown >= 0)
2857 djac_dparam(local_eqn, local_unknown) -=
2858 -dens_ratio * 2.0 * interpolated_u[2] * psif[l2] *
2864 djac_dparam(local_eqn, local_unknown) +=
2865 2.0 * r * dens_ratio * psif[l2] * testf[l] *
W;
2899 dres_dparam[local_eqn] += r * dens_ratio * testf[l] * G[1] *
W;
2920 dres_dparam[local_eqn] -= dens_ratio * r * dudt[1] * testf[l] *
W;
2926 dres_dparam[local_eqn] -=
2928 (r * interpolated_u[0] * interpolated_dudx(1, 0) +
2929 r * interpolated_u[1] * interpolated_dudx(1, 1)) *
2938 for (
unsigned k = 0; k < 2; k++)
2940 dres_dparam[local_eqn] += dens_ratio * r * mesh_velocity[k] *
2941 interpolated_dudx(1, k) * testf[l] *
2951 for (
unsigned l2 = 0; l2 < n_node; l2++)
2955 if (local_unknown >= 0)
2967 djac_dparam(local_eqn, local_unknown) -=
2968 dens_ratio * r * psif[l2] * interpolated_dudx(1, 0) *
2975 if (local_unknown >= 0)
2982 dmass_matrix_dparam(local_eqn, local_unknown) +=
2983 dens_ratio * r * psif[l2] * testf[l] *
W;
3003 djac_dparam(local_eqn, local_unknown) -=
3012 djac_dparam(local_eqn, local_unknown) -=
3014 (r * interpolated_u[0] * dpsifdx(l2, 0) +
3015 r * psif[l2] * interpolated_dudx(1, 1) +
3016 r * interpolated_u[1] * dpsifdx(l2, 1)) *
3023 for (
unsigned k = 0; k < 2; k++)
3027 djac_dparam(local_eqn, local_unknown) +=
3028 dens_ratio * r * mesh_velocity[k] * dpsifdx(l2, k) *
3054 dres_dparam[local_eqn] += r * dens_ratio * testf[l] * G[2] *
W;
3079 dres_dparam[local_eqn] -= dens_ratio * r * dudt[2] * testf[l] *
W;
3085 dres_dparam[local_eqn] -=
3087 (r * interpolated_u[0] * interpolated_dudx(2, 0) +
3088 interpolated_u[0] * interpolated_u[2] +
3089 r * interpolated_u[1] * interpolated_dudx(2, 1)) *
3098 for (
unsigned k = 0; k < 2; k++)
3100 dres_dparam[local_eqn] += dens_ratio * r * mesh_velocity[k] *
3101 interpolated_dudx(2, k) * testf[l] *
3110 dres_dparam[local_eqn] -=
3111 2.0 * r * dens_ratio * interpolated_u[0] * testf[l] *
W;
3118 for (
unsigned l2 = 0; l2 < n_node; l2++)
3122 if (local_unknown >= 0)
3127 djac_dparam(local_eqn, local_unknown) -=
3129 (r * psif[l2] * interpolated_dudx(2, 0) +
3130 psif[l2] * interpolated_u[2]) *
3137 djac_dparam(local_eqn, local_unknown) -=
3138 2.0 * r * dens_ratio * psif[l2] * testf[l] *
W;
3144 if (local_unknown >= 0)
3149 djac_dparam(local_eqn, local_unknown) -=
3150 dens_ratio * r * psif[l2] * interpolated_dudx(2, 1) *
3157 if (local_unknown >= 0)
3164 dmass_matrix_dparam(local_eqn, local_unknown) +=
3165 dens_ratio * r * psif[l2] * testf[l] *
W;
3188 djac_dparam(local_eqn, local_unknown) -=
3197 djac_dparam(local_eqn, local_unknown) -=
3199 (r * interpolated_u[0] * dpsifdx(l2, 0) +
3200 interpolated_u[0] * psif[l2] +
3201 r * interpolated_u[1] * dpsifdx(l2, 1)) *
3210 for (
unsigned k = 0; k < 2; k++)
3212 djac_dparam(local_eqn, local_unknown) +=
3213 dens_ratio * r * mesh_velocity[k] * dpsifdx(l2, k) *
3245 unsigned n_node =
nnode();
3248 unsigned u_nodal_index[3];
3249 for (
unsigned i = 0;
i < 3; ++
i)
3256 Shape psif(n_node), testf(n_node);
3257 DShape dpsifdx(n_node, 2), dtestfdx(n_node, 2);
3272 int local_eqn = 0, local_unknown = 0, local_freedom = 0;
3275 const unsigned n_dof = this->
ndof();
3281 for (
unsigned ipt = 0; ipt < Nintpt; ipt++)
3290 ipt, psif, dpsifdx, testf, dtestfdx);
3308 for (
unsigned l = 0; l < n_node; l++)
3311 const double psif_ = psif(l);
3313 for (
unsigned i = 0;
i < 2;
i++)
3319 for (
unsigned i = 0;
i < 3;
i++)
3323 interpolated_u[
i] += u_value * psif_;
3326 for (
unsigned j = 0; j < 2; j++)
3328 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
3337 OOMPH_CURRENT_FUNCTION,
3338 OOMPH_EXCEPTION_LOCATION);
3349 for (
unsigned l = 0; l < n_node; l++)
3357 for (
unsigned l3 = 0; l3 < n_node; l3++)
3361 if (local_freedom >= 0)
3367 for (
unsigned l2 = 0; l2 < n_node; l2++)
3371 if (local_unknown >= 0)
3375 (r * psif[l2] * dpsifdx(l3, 0) +
3376 r * psif[l3] * dpsifdx(l2, 0)) *
3377 Y[local_unknown] * testf[l] *
W;
3382 if (local_unknown >= 0)
3385 temp -= scaled_re * r * psif[l2] * dpsifdx(l3, 1) *
3386 Y[local_unknown] * testf[l] *
W;
3390 jac_y(local_eqn, local_freedom) += temp;
3396 if (local_freedom >= 0)
3401 for (
unsigned l2 = 0; l2 < n_node; l2++)
3405 if (local_unknown >= 0)
3408 temp -= scaled_re * (r * psif[l3] * dpsifdx(l2, 1)) *
3409 Y[local_unknown] * testf[l] *
W;
3413 jac_y(local_eqn, local_freedom) += temp;
3418 if (local_freedom >= 0)
3423 for (
unsigned l2 = 0; l2 < n_node; l2++)
3427 if (local_unknown >= 0)
3430 temp -= -scaled_re * 2.0 * psif[l3] * psif[l2] *
3431 Y[local_unknown] * testf[l] *
W;
3435 jac_y(local_eqn, local_freedom) += temp;
3448 for (
unsigned l3 = 0; l3 < n_node; l3++)
3452 if (local_freedom >= 0)
3457 for (
unsigned l2 = 0; l2 < n_node; l2++)
3461 if (local_unknown >= 0)
3464 temp -= scaled_re * (r * psif[l3] * dpsifdx(l2, 0)) *
3465 Y[local_unknown] * testf[l] *
W;
3468 jac_y(local_eqn, local_freedom) += temp;
3476 if (local_freedom >= 0)
3481 for (
unsigned l2 = 0; l2 < n_node; l2++)
3485 if (local_unknown >= 0)
3488 temp -= scaled_re * r * psif[l2] * dpsifdx(l3, 0) *
3489 Y[local_unknown] * testf[l] *
W;
3494 if (local_unknown >= 0)
3498 (r * psif[l2] * dpsifdx(l3, 1) +
3499 r * psif[l3] * dpsifdx(l2, 1)) *
3500 Y[local_unknown] * testf[l] *
W;
3507 jac_y(local_eqn, local_freedom) += temp;
3518 for (
unsigned l3 = 0; l3 < n_node; l3++)
3522 if (local_freedom >= 0)
3527 for (
unsigned l2 = 0; l2 < n_node; l2++)
3531 if (local_unknown >= 0)
3536 (r * psif[l3] * dpsifdx(l2, 0) + psif[l3] * psif[l2]) *
3537 Y[local_unknown] * testf[l] *
W;
3541 jac_y(local_eqn, local_freedom) += temp;
3546 if (local_freedom >= 0)
3551 for (
unsigned l2 = 0; l2 < n_node; l2++)
3555 if (local_unknown >= 0)
3558 temp -= scaled_re * (r * psif[l3] * dpsifdx(l2, 1)) *
3559 Y[local_unknown] * testf[l] *
W;
3563 jac_y(local_eqn, local_freedom) += temp;
3569 if (local_freedom >= 0)
3575 for (
unsigned l2 = 0; l2 < n_node; l2++)
3579 if (local_unknown >= 0)
3584 (r * psif[l2] * dpsifdx(l3, 0) + psif[l2] * psif[l3]) *
3585 Y[local_unknown] * testf[l] *
W;
3590 if (local_unknown >= 0)
3593 temp -= scaled_re * r * psif[l2] * dpsifdx(l3, 1) *
3594 Y[local_unknown] * testf[l] *
W;
3598 jac_y(local_eqn, local_freedom) += temp;
3610 const unsigned n_vec = C.
nrow();
3611 for (
unsigned i = 0;
i < n_dof;
i++)
3613 for (
unsigned k = 0; k < n_dof; k++)
3616 const double j_y = jac_y(
i, k);
3618 for (
unsigned v = 0; v < n_vec; v++)
3620 product(v,
i) += j_y * C(v, k);
3640 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const
3643 unsigned n_node = this->
nnode();
3649 std::pair<unsigned, unsigned> dof_lookup;
3652 unsigned pressure_dof_number = 3;
3655 for (
unsigned n = 0; n < n_press; n++)
3667 dof_lookup.first = this->
eqn_number(local_eqn_number);
3668 dof_lookup.second = pressure_dof_number;
3671 dof_lookup_list.push_front(dof_lookup);
3676 for (
unsigned n = 0; n < n_node; n++)
3682 for (
unsigned v = 0; v < nv; v++)
3692 dof_lookup.first = this->
eqn_number(local_eqn_number);
3693 dof_lookup.second = v;
3696 dof_lookup_list.push_front(dof_lookup);
3706 3, 3, 3, 3, 3, 3, 3, 3, 3};
3712 const unsigned& n)
const
3742 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const
3745 unsigned n_node = this->
nnode();
3748 std::pair<unsigned, unsigned> dof_lookup;
3751 for (
unsigned n = 0; n < n_node; n++)
3757 for (
unsigned v = 0; v < nv; v++)
3769 dof_lookup.first = this->
eqn_number(local_eqn_number);
3772 dof_lookup.second = v;
3775 dof_lookup_list.push_front(dof_lookup);
3785 4, 3, 4, 3, 3, 3, 4, 3, 4};
double dissipation() const
Return integral of dissipation over element.
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
double pressure_integral() const
Integral of pressure over element.
void traction(const Vector< double > &s, const Vector< double > &N, Vector< double > &traction) const
Compute traction (on the viscous scale) at local coordinate s for outer unit normal N.
virtual void fill_in_generic_dresidual_contribution_axi_nst(double *const ¶meter_pt, Vector< double > &dres_dparam, DenseMatrix< double > &djac_dparam, DenseMatrix< double > &dmass_matrix_dparam, unsigned flag)
Compute the derivative of residuals for the Navier–Stokes equations; with respect to a parameeter fla...
const double & density_ratio() const
Density ratio for element: Element's density relative to the viscosity used in the definition of the ...
void fill_in_contribution_to_hessian_vector_products(Vector< double > const &Y, DenseMatrix< double > const &C, DenseMatrix< double > &product)
Compute the hessian tensor vector products required to perform continuation of bifurcations analytica...
const double & re_invro() const
Global Reynolds number multiplied by inverse Rossby number.
void output_veloc(std::ostream &outfile, const unsigned &nplot, const unsigned &t)
Output function: x,y,[z],u,v,[w] in tecplot format. nplot points in each coordinate direction at time...
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.
double *& re_invro_pt()
Pointer to global inverse Froude number.
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Output exact solution specified via function pointer at a given number of plot points....
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.
double * Re_pt
Pointer to global Reynolds number.
virtual void pshape_axi_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
double *& re_pt()
Pointer to Reynolds number.
virtual void get_viscosity_ratio_axisym_nst(const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, double &visc_ratio)
Calculate the viscosity ratio relative to the viscosity used in the definition of the Reynolds number...
void interpolated_u_axi_nst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley number)
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.
static int Pressure_not_stored_at_node
Static "magic" number that indicates that the pressure is not stored at a node.
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.
static double Default_Physical_Ratio_Value
Static default value for the physical ratios (all are initialised to one)
double kin_energy() const
Get integral of kinetic energy over element.
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Validate against exact solution at given time Solution is provided via function pointer....
double *& re_invfr_pt()
Pointer to global inverse Froude number.
virtual unsigned npres_axi_nst() const =0
Function to return number of pressure degrees of freedom.
static double Default_Physical_Constant_Value
Static default value for the physical constants (all initialised to zero)
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when the time-derivatives are computed....
virtual void fill_in_generic_residual_contribution_axi_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=2 or 1 or 0: compute the Jacobian and/or ...
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.
double interpolated_p_axi_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
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...
void get_pressure_and_velocity_mass_matrix_diagonal(Vector< double > &press_mass_diag, Vector< double > &veloc_mass_diag, const unsigned &which_one=0)
Compute the diagonal of the velocity/pressure mass matrices. If which one=0, both are computed,...
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Strain-rate tensor: where (in that order)
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 void get_dresidual_dnodal_coordinates(RankThreeTensor< double > &dresidual_dnodal_coordinates)
Compute derivatives of elemental residual vector with respect to nodal coordinates....
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,...
void output(std::ostream &outfile)
Output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points.
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Create a list of pairs for all unknowns in this element, so that the first entry in each pair contain...
void get_traction(const Vector< double > &s, const Vector< double > &N, Vector< double > &traction) const
Compute traction at local coordinate s for outer unit normal N.
static const unsigned Initial_Nvalue[]
Static array of ints to hold required number of variables at nodes.
unsigned npres_axi_nst() const
Return number of pressure values.
int p_local_eqn(const unsigned &n) const
Overload the access function for the pressure's local equation numbers.
virtual unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at local node n.
static const unsigned Pconv[]
Static array of ints to hold conversion from pressure node numbers to actual node numbers.
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Create a list of pairs for all unknowns in this element, so that the first entry in each pair contain...
void get_traction(const Vector< double > &s, const Vector< double > &N, Vector< double > &traction) const
Compute traction at local coordinate s for outer unit normal N.
static const unsigned Initial_Nvalue[]
Static array of ints to hold number of variables at node.
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.
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
unsigned long nrow() const
Return the number of rows of the matrix.
unsigned long ncol() const
Return the number of columns of the matrix.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s.
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 std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction")
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
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.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as .
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction")
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 dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Compute the geometric shape functions and also first derivatives w.r.t. global coordinates at local c...
virtual double J_eulerian_at_knot(const unsigned &ipt) const
Return the Jacobian of the mapping from local to global coordinates at the ipt-th integration point.
double raw_dnodal_position_dt(const unsigned &n, const unsigned &i) const
Return the i-th component of nodal velocity: dx/dt at local node n. Do not use the hanging node repre...
double raw_nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n but do NOT take hanging nodes into account.
double raw_nodal_position(const unsigned &n, const unsigned &i) const
Return the i-th coordinate at local node n. Do not use the hanging node representation....
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Add tecplot zone "footer" to output stream (when plotting nplot points in each "coordinate direction"...
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as .
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Return the geometric shape function at the ipt-th integration point.
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.
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number.
int local_eqn_number(const unsigned long &ieqn_global) const
Return the local equation number corresponding to the ieqn_global-th global equation number....
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.
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.
An OomphLibError object which should be thrown when an run-time error is encountered....
An OomphLibWarning object which should be created as a temporary object to issue a warning....
////////////////////////////////////////////////////////////////// //////////////////////////////////...
////////////////////////////////////////////////////////////////// //////////////////////////////////...
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.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...