65 const unsigned& which_one)
68 if ((which_one == 0) || (which_one == 1))
70 throw OomphLibError(
"Computation of diagonal of pressure mass matrix is "
71 "not impmented yet.\n",
72 OOMPH_CURRENT_FUNCTION,
73 OOMPH_EXCEPTION_LOCATION);
78 veloc_mass_diag.assign(
ndof(), 0.0);
81 const unsigned n_node =
nnode();
84 const unsigned n_value = 3;
88 for (
unsigned i = 0;
i < n_value;
i++)
103 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
121 for (
unsigned l = 0; l < n_node; l++)
128 W *= r * r * sin(theta);
131 for (
unsigned l = 0; l < n_node; l++)
134 for (
unsigned i = 0;
i < n_value;
i++)
142 veloc_mass_diag[local_eqn] += test[l] * test[l] *
W;
157 std::ostream& outfile,
175 outfile <<
"ZONE" << std::endl;
181 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
184 for (
unsigned i = 0;
i < 2;
i++)
202 (*exact_soln_pt)(time, x, exact_soln);
205 for (
unsigned i = 0;
i < 3;
i++)
207 norm += exact_soln[
i] * exact_soln[
i] *
W;
213 for (
unsigned i = 0;
i < 2;
i++)
215 outfile << x[
i] <<
" ";
219 for (
unsigned i = 0;
i < 3;
i++)
224 outfile << std::endl;
236 std::ostream& outfile,
254 outfile <<
"ZONE" << std::endl;
260 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
263 for (
unsigned i = 0;
i < 2;
i++)
281 (*exact_soln_pt)(x, exact_soln);
284 for (
unsigned i = 0;
i < 3;
i++)
286 norm += exact_soln[
i] * exact_soln[
i] *
W;
292 for (
unsigned i = 0;
i < 2;
i++)
294 outfile << x[
i] <<
" ";
298 for (
unsigned i = 0;
i < 3;
i++)
302 outfile << std::endl;
313 std::ostream& outfile,
345 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
348 for (
unsigned i = 0;
i < 2;
i++)
366 (*exact_soln_pt)(x, exact_soln);
367 (*exact_soln_dr_pt)(x, exact_soln_dr);
368 (*exact_soln_dtheta_pt)(x, exact_soln_dth);
378 W *= r * r * sin(theta);
394 u_norm += (1 / (r * r)) * exact_soln[2] * exact_soln[2] *
W;
401 u_norm +=
cot(theta) *
cot(theta) * (1 / (r * r)) * exact_soln[2] *
405 u_norm += exact_soln_dr[2] * exact_soln_dr[2] *
W;
407 u_norm += (1 / (r * r)) * exact_soln_dth[2] * exact_soln_dth[2] *
W;
421 u_error += (1 / (r * r)) *
428 u_error += (1 / (r * r)) *
436 u_error += (1 / (r * r)) *
443 u_error += (1 / (r * r)) *
cot(theta) *
cot(theta) *
457 u_error += (1 / (r * r)) *
469 p_norm += exact_soln[3] * exact_soln[3] *
W;
476 for (
unsigned i = 0;
i < 2;
i++)
478 outfile << x[
i] <<
" ";
482 outfile << u_error <<
" " << u_norm <<
" ";
484 outfile << p_error <<
" " << p_norm <<
" ";
485 outfile << std::endl;
496 std::ostream& outfile)
512 for (
unsigned i = 0;
i < Npts;
i++)
515 s[1] = -1 + 2.0 *
i / (Npts - 1);
522 outfile << x[0] <<
" ";
523 outfile << x[1] <<
" ";
529 outfile << shear <<
" ";
531 outfile << std::endl;
553 for (
unsigned i = 0;
i < Npts;
i++)
556 s[0] = -1 + 2.0 *
i / (Npts - 1);
566 outfile << theta <<
" ";
577 outfile << shear <<
" ";
585 W *= r * r * sin(theta);
589 for (
unsigned j = 0; j < 3; j++)
593 outfile << u_int <<
" ";
598 outfile << std::endl;
605 W *= r * r * sin(theta);
609 for (
unsigned j = 0; j < 3; j++)
613 outfile << u_int <<
" ";
618 outfile << std::endl;
631 std::ostream& outfile,
632 const unsigned& nplot,
650 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
659 (*exact_soln_pt)(x, exact_soln);
662 for (
unsigned i = 0;
i < 3;
i++)
664 outfile << x[
i] <<
" ";
668 for (
unsigned i = 0;
i < exact_soln.size();
i++)
670 outfile << exact_soln[
i] <<
" ";
673 outfile << std::endl;
687 std::ostream& outfile,
688 const unsigned& nplot,
706 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
715 (*exact_soln_pt)(time, x, exact_soln);
718 for (
unsigned i = 0;
i < 3;
i++)
720 outfile << x[
i] <<
" ";
724 for (
unsigned i = 0;
i < exact_soln.size();
i++)
726 outfile << exact_soln[
i] <<
" ";
729 outfile << std::endl;
744 const unsigned& nplot,
748 unsigned n_node =
nnode();
763 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
772 for (
unsigned i = 0;
i < 3;
i++)
775 interpolated_u[
i] = 0.0;
779 for (
unsigned l = 0; l < n_node; l++)
781 interpolated_u[
i] +=
nodal_value(
t, l, u_nodal_index) * psi[l];
787 for (
unsigned i = 0;
i < 2;
i++)
793 for (
unsigned i = 0;
i < 3;
i++)
795 outfile << interpolated_u[
i] <<
" ";
798 outfile << std::endl;
812 const unsigned& nplot)
822 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
837 outfile << r * sin(theta) <<
" " << r * cos(theta) <<
" ";
843 outfile << u_r * sin(theta) + u_theta * cos(theta) <<
" "
844 << u_r * cos(theta) - u_theta * sin(theta) <<
" ";
850 for (
unsigned i = 0;
i < 3;
i++)
861 outfile << std::endl;
876 const unsigned& nplot)
886 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
892 for (
unsigned i = 0;
i < 2;
i++)
898 for (
unsigned i = 0;
i < 3;
i++)
906 fprintf(file_pt,
"\n");
920 const unsigned& nplot)
923 "Probably Broken", OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
938 unsigned n_node =
nnode();
942 DShape dpsifdx(n_node, 2);
946 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
961 for (
unsigned i = 0;
i < 3;
i++)
966 for (
unsigned j = 0; j < 2; j++)
968 interpolated_dudx(
i, j) = 0.0;
976 for (
unsigned i = 0;
i < 3;
i++)
981 for (
unsigned l = 0; l < n_node; l++)
987 for (
unsigned j = 0; j < 2; j++)
989 interpolated_dudx(
i, j) +=
997 for (
unsigned i = 0;
i < 3;
i++)
999 dudt_ALE[
i] = dudt[
i];
1000 for (
unsigned k = 0; k < 2; k++)
1002 dudt_ALE[
i] -= mesh_veloc[k] * interpolated_dudx(
i, k);
1008 for (
unsigned i = 0;
i < 2;
i++)
1014 for (
unsigned i = 0;
i < 3;
i++)
1023 for (
unsigned i = 0;
i < 3;
i++)
1025 outfile << dudt_ALE[
i] <<
" ";
1032 outfile << std::endl;
1047 const unsigned& nplot)
1060 for (
unsigned iplot = 0; iplot < num_plot_points; iplot++)
1066 for (
unsigned i = 0;
i < 2;
i++)
1074 outfile << vorticity[0] << std::endl;
1098 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1101 for (
unsigned i = 0;
i < 2;
i++)
1117 double local_diss = 0.0;
1118 for (
unsigned i = 0;
i < 3;
i++)
1120 for (
unsigned j = 0; j < 3; j++)
1122 local_diss += 2.0 * strainrate(
i, j) * strainrate(
i, j);
1126 diss += local_diss * w * J;
1149 for (
unsigned i = 0;
i < 3;
i++)
1155 traction[
i] = -press *
N[
i];
1164 for (
unsigned j = 0; j < 2; j++)
1166 traction[
i] += 2.0 * strainrate(
i, j) *
N[j];
1182 double local_diss = 0.0;
1183 for (
unsigned i = 0;
i < 3;
i++)
1185 for (
unsigned j = 0; j < 3; j++)
1187 local_diss += 2.0 * strainrate(
i, j) * strainrate(
i, j);
1203 double interpolated_r = 0.0;
1204 double interpolated_theta = 0.0;
1210 unsigned n_node =
nnode();
1214 DShape dpsidx(n_node, 2);
1220 for (
unsigned l = 0; l < n_node; l++)
1228 for (
unsigned i = 0;
i < 3;
i++)
1233 for (
unsigned l = 0; l < n_node; l++)
1236 const double nodal_u = this->
nodal_value(l, u_nodal_index);
1238 interpolated_u[
i] += nodal_u * psi(l);
1240 for (
unsigned j = 0; j < 2; j++)
1242 dudx(
i, j) += nodal_u * dpsidx(l, j);
1248 strainrate(0, 0) = dudx(0, 0);
1249 strainrate(0, 1) = 0.0;
1250 strainrate(0, 2) = 0.0;
1252 strainrate(1, 1) = 0.0;
1253 strainrate(1, 2) = 0.0;
1254 strainrate(2, 2) = 0.0;
1259 if (std::fabs(interpolated_r) > 1.0e-15)
1262 double inverse_r = 1.0 / interpolated_r;
1265 bool include_cot_terms =
false;
1266 double cot_theta = 0.0;
1268 if ((std::fabs(interpolated_theta) > 1.0e-15) &&
1269 (std::fabs(pi - interpolated_theta) > 1.0e-15))
1271 include_cot_terms =
true;
1272 cot_theta = this->
cot(interpolated_theta);
1276 0.5 * (dudx(1, 0) + (dudx(0, 1) - interpolated_u[1]) * inverse_r);
1277 strainrate(0, 2) = 0.5 * (dudx(2, 0) - interpolated_u[2] * inverse_r);
1278 strainrate(1, 1) = (dudx(1, 1) + interpolated_u[0]) * inverse_r;
1280 if (include_cot_terms)
1283 0.5 * (dudx(2, 1) - interpolated_u[2] * cot_theta) * inverse_r;
1285 (interpolated_u[0] + interpolated_u[1] * cot_theta) * inverse_r;
1290 strainrate(1, 0) = strainrate(0, 1);
1291 strainrate(2, 0) = strainrate(0, 2);
1292 strainrate(2, 1) = strainrate(1, 2);
1303 throw OomphLibError(
"Not tested for spherical Navier-Stokes elements",
1304 OOMPH_CURRENT_FUNCTION,
1305 OOMPH_EXCEPTION_LOCATION);
1308 if (vorticity.size() != 1)
1310 std::ostringstream error_message;
1311 error_message <<
"Computation of vorticity in 2D requires a 1D vector\n"
1312 <<
"which contains the only non-zero component of the\n"
1313 <<
"vorticity vector. You've passed a vector of size "
1314 << vorticity.size() << std::endl;
1317 error_message.str(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
1328 unsigned n_node =
nnode();
1332 DShape dpsidx(n_node, DIM);
1338 for (
unsigned i = 0;
i < DIM;
i++)
1340 for (
unsigned j = 0; j < DIM; j++)
1347 for (
unsigned i = 0;
i < DIM;
i++)
1352 for (
unsigned j = 0; j < DIM; j++)
1355 for (
unsigned l = 0; l < n_node; l++)
1357 dudx(
i, j) +=
nodal_value(l, u_nodal_index) * dpsidx(l, j);
1363 vorticity[0] = dudx(1, 0) - dudx(0, 1);
1373 double kin_en = 0.0;
1382 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1385 for (
unsigned i = 0;
i < 2;
i++)
1397 double veloc_squared = 0.0;
1398 for (
unsigned i = 0;
i < 3;
i++)
1404 kin_en += 0.5 * veloc_squared * w * J;
1416 throw OomphLibError(
"Not tested for spherical Navier-Stokes elements",
1417 OOMPH_CURRENT_FUNCTION,
1418 OOMPH_EXCEPTION_LOCATION);
1422 double d_kin_en_dt = 0.0;
1431 const unsigned n_node = this->
nnode();
1435 DShape dpsidx(n_node, 2);
1438 unsigned u_index[3];
1439 for (
unsigned i = 0;
i < 3;
i++)
1445 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1454 Vector<double> interpolated_u(3, 0.0), interpolated_dudt(3, 0.0);
1457 for (
unsigned l = 0; l < n_node; l++)
1460 for (
unsigned i = 0;
i < 3;
i++)
1474 for (
unsigned l = 0; l < n_node; l++)
1477 for (
unsigned i = 0;
i < 2;
i++)
1483 for (
unsigned i = 0;
i < 3;
i++)
1485 for (
unsigned j = 0; j < 2; j++)
1487 interpolated_dudx(
i, j) +=
1494 for (
unsigned i = 0;
i < 3;
i++)
1496 for (
unsigned k = 0; k < 2; k++)
1498 interpolated_dudt[
i] -= mesh_velocity[k] * interpolated_dudx(
i, k);
1506 for (
unsigned i = 0;
i < 3;
i++)
1508 sum += interpolated_u[
i] * interpolated_dudt[
i];
1511 d_kin_en_dt += sum * w * J;
1524 double press_int = 0;
1533 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1536 for (
unsigned i = 0;
i < 2;
i++)
1554 press_int += press *
W;
1573 if (
ndof() == 0)
return;
1576 const unsigned n_node =
nnode();
1585 unsigned u_nodal_index[3];
1586 for (
unsigned i = 0;
i < 3;
i++)
1592 Shape psif(n_node), testf(n_node);
1593 DShape dpsifdx(n_node, 2), dtestfdx(n_node, 2);
1596 Shape psip(n_pres), testp(n_pres);
1614 int local_eqn = 0, local_unknown = 0;
1617 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
1626 ipt, psif, dpsifdx, testf, dtestfdx);
1632 const double W = w * J;
1636 double interpolated_p = 0.0;
1644 for (
unsigned l = 0; l < n_pres; l++)
1653 for (
unsigned l = 0; l < n_node; l++)
1656 double psi_ = psif(l);
1658 for (
unsigned i = 0;
i < 2;
i++)
1664 for (
unsigned i = 0;
i < 3;
i++)
1668 interpolated_u[
i] += u_value * psi_;
1672 for (
unsigned j = 0; j < 2; j++)
1674 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
1682 "SphericalNS::fill_in...",
1683 OOMPH_EXCEPTION_LOCATION);
1685 for (
unsigned l = 0; l < n_node; l++)
1688 for (
unsigned i = 0;
i < 2;
i++)
1707 const double r2 = r * r;
1710 const double cot_theta = cos_theta / sin_theta;
1712 const double u_r = interpolated_u[0];
1713 const double u_theta = interpolated_u[1];
1714 const double u_phi = interpolated_u[2];
1717 for (
unsigned l = 0; l < n_node; l++)
1731 double conv = u_r * interpolated_dudx(0, 0) * r;
1734 conv += u_theta * interpolated_dudx(0, 1);
1737 conv -= (u_theta * u_theta + u_phi * u_phi);
1741 double sum = (scaled_re_st * r2 * dudt[0] + r * scaled_re * conv) *
1742 sin_theta * testf[l];
1747 sum -= scaled_re_st *
1748 (mesh_velocity[0] * interpolated_dudx(0, 0) * r +
1749 mesh_velocity[1] * (interpolated_dudx(0, 1) - u_theta)) *
1750 r * sin_theta * testf[l];
1754 sum -= 2.0 * scaled_re_inv_ro * sin_theta * u_phi * r2 * sin_theta *
1758 sum += (-interpolated_p + 2.0 * interpolated_dudx(0, 0)) * r2 *
1759 sin_theta * dtestfdx(l, 0);
1763 (r * interpolated_dudx(1, 0) - u_theta + interpolated_dudx(0, 1)) *
1764 sin_theta * dtestfdx(l, 1);
1768 ((-r * interpolated_p + interpolated_dudx(1, 1) + 2.0 * u_r) *
1770 u_theta * cos_theta) *
1775 residuals[local_eqn] -= sum *
W;
1781 for (
unsigned l2 = 0; l2 < n_node; l2++)
1790 if (local_unknown >= 0)
1793 double jac_conv = r * (psif(l2) * interpolated_dudx(0, 0) +
1794 u_r * dpsifdx(l2, 0));
1797 jac_conv += u_theta * dpsifdx(l2, 1);
1804 scaled_re * jac_conv * r) *
1810 jac_sum -= scaled_re_st *
1811 (mesh_velocity[0] * dpsifdx(l2, 0) * r +
1812 mesh_velocity[1] * dpsifdx(l2, 1)) *
1813 r * sin_theta * testf(l);
1819 jac_sum += 2.0 * dpsifdx(l2, 0) * dtestfdx(l, 0) * r2;
1823 jac_sum += dpsifdx(l2, 1) * dtestfdx(l, 1);
1828 jac_sum += 4.0 * psif[l2] * testf(l);
1832 jacobian(local_eqn, local_unknown) -= jac_sum * sin_theta *
W;
1837 mass_matrix(local_eqn, local_unknown) +=
1838 scaled_re_st * psif[l2] * testf[l] * r2 * sin_theta *
W;
1848 if (local_unknown >= 0)
1853 double jac_sum = scaled_re *
1854 (interpolated_dudx(0, 1) - 2.0 * u_theta) *
1855 psif(l2) * r * sin_theta * testf(l);
1860 jac_sum += scaled_re_st * mesh_velocity[1] * psif(l2) * r *
1861 sin_theta * testf(l);
1867 (r * dpsifdx(l2, 0) - psif(l2)) * dtestfdx(l, 1) * sin_theta;
1872 (dpsifdx(l2, 1) * sin_theta + psif(l2) * cos_theta) *
1876 jacobian(local_eqn, local_unknown) -= jac_sum *
W;
1885 if (local_unknown >= 0)
1888 jacobian(local_eqn, local_unknown) += 2.0 * scaled_re * u_phi *
1889 psif(l2) * r * sin_theta *
1893 jacobian(local_eqn, local_unknown) +=
1894 2.0 * scaled_re_inv_ro * sin_theta * psif(l2) * r2 *
1895 sin_theta * testf[l] *
W;
1903 for (
unsigned l2 = 0; l2 < n_pres; l2++)
1907 if (local_unknown >= 0)
1909 jacobian(local_eqn, local_unknown) +=
1910 psip(l2) * (r2 * dtestfdx(l, 0) + 2.0 * r * testf(l)) *
1929 double conv = (u_r * interpolated_dudx(1, 0) * r +
1930 u_theta * interpolated_dudx(1, 1) + u_r * u_theta) *
1932 u_phi * u_phi * cos_theta;
1937 (scaled_re_st * dudt[1] * r2 * sin_theta + scaled_re * r * conv) *
1943 sum -= scaled_re_st *
1944 (mesh_velocity[0] * interpolated_dudx(1, 0) * r +
1945 mesh_velocity[1] * (interpolated_dudx(1, 1) + u_r)) *
1946 r * sin_theta * testf(l);
1950 sum -= 2.0 * scaled_re_inv_ro * cos_theta * u_phi * r2 * sin_theta *
1955 (r * interpolated_dudx(1, 0) - u_theta + interpolated_dudx(0, 1)) *
1956 r * sin_theta * dtestfdx(l, 0);
1960 (-r * interpolated_p + 2.0 * interpolated_dudx(1, 1) + 2.0 * u_r) *
1961 dtestfdx(l, 1) * sin_theta;
1965 ((r * interpolated_dudx(1, 0) - u_theta + interpolated_dudx(0, 1)) *
1967 (-r * interpolated_p + 2.0 * u_r + 2.0 * u_theta * cot_theta) *
1973 residuals[local_eqn] -= sum *
W;
1979 for (
unsigned l2 = 0; l2 < n_node; l2++)
1988 if (local_unknown >= 0)
1993 double jac_sum = scaled_re *
1994 (r2 * interpolated_dudx(1, 0) + r * u_theta) *
1995 psif(l2) * sin_theta * testf(l);
2000 jac_sum -= scaled_re_st * mesh_velocity[1] * psif(l2) * r *
2001 sin_theta * testf(l);
2006 jac_sum += dpsifdx(l2, 1) * dtestfdx(l, 0) * sin_theta * r;
2010 jac_sum += 2.0 * psif(l2) * dtestfdx(l, 1) * sin_theta;
2015 (dpsifdx(l2, 1) * sin_theta - 2.0 * psif(l2) * cos_theta) *
2019 jacobian(local_eqn, local_unknown) -= jac_sum *
W;
2028 if (local_unknown >= 0)
2031 double jac_conv = r * u_r * dpsifdx(l2, 0) +
2032 u_theta * dpsifdx(l2, 1) +
2033 (interpolated_dudx(1, 1) + u_r) * psif(l2);
2040 scaled_re * r * jac_conv) *
2041 testf(l) * sin_theta;
2047 jac_sum -= scaled_re_st *
2048 (mesh_velocity[0] * dpsifdx(l2, 0) * r +
2049 mesh_velocity[1] * dpsifdx(l2, 1)) *
2050 r * sin_theta * testf(l);
2055 jac_sum += (r * dpsifdx(l2, 0) - psif(l2)) * r *
2056 dtestfdx(l, 0) * sin_theta;
2060 jac_sum += 2.0 * dpsifdx(l2, 1) * dtestfdx(l, 1) * sin_theta;
2064 jac_sum -= ((r * dpsifdx(l2, 0) - psif(l2)) * sin_theta -
2065 2.0 * psif(l2) * cot_theta * cos_theta) *
2069 jacobian(local_eqn, local_unknown) -= jac_sum *
W;
2074 mass_matrix(local_eqn, local_unknown) +=
2075 scaled_re_st * psif[l2] * testf[l] * r2 * sin_theta *
W;
2085 if (local_unknown >= 0)
2088 jacobian(local_eqn, local_unknown) += scaled_re * 2.0 * r *
2090 cos_theta * testf(l) *
W;
2093 jacobian(local_eqn, local_unknown) +=
2094 2.0 * scaled_re_inv_ro * cos_theta * psif(l2) * r2 *
2095 sin_theta * testf[l] *
W;
2103 for (
unsigned l2 = 0; l2 < n_pres; l2++)
2107 if (local_unknown >= 0)
2109 jacobian(local_eqn, local_unknown) +=
2111 (dtestfdx(l, 1) * sin_theta + cos_theta * testf[l]) *
W;
2129 double conv = u_r * interpolated_dudx(2, 0) * r * sin_theta;
2132 conv += u_theta * interpolated_dudx(2, 1) * sin_theta;
2135 conv += u_phi * (u_r * sin_theta + u_theta * cos_theta);
2139 (scaled_re_st * r2 * dudt[2] * sin_theta + scaled_re * conv * r) *
2145 sum -= scaled_re_st *
2146 (mesh_velocity[0] * interpolated_dudx(2, 0) * r +
2147 mesh_velocity[1] * interpolated_dudx(2, 1)) *
2148 r * sin_theta * testf(l);
2152 sum += 2.0 * scaled_re_inv_ro *
2153 (cos_theta * u_theta + sin_theta * u_r) * r2 * sin_theta *
2157 sum += (r2 * interpolated_dudx(2, 0) - r * u_phi) * dtestfdx(l, 0) *
2161 sum += (interpolated_dudx(2, 1) * sin_theta - u_phi * cos_theta) *
2165 sum -= ((r * interpolated_dudx(2, 0) - u_phi) * sin_theta +
2166 (interpolated_dudx(2, 1) - u_phi * cot_theta) * cos_theta) *
2170 residuals[local_eqn] -= sum *
W;
2177 for (
unsigned l2 = 0; l2 < n_node; l2++)
2186 if (local_unknown >= 0)
2189 jacobian(local_eqn, local_unknown) -=
2190 scaled_re * (r * interpolated_dudx(2, 0) + u_phi) * psif(l2) *
2191 testf(l) * r * sin_theta *
W;
2194 jacobian(local_eqn, local_unknown) -=
2195 2.0 * scaled_re_inv_ro * sin_theta * psif(l2) * r2 *
2196 sin_theta * testf[l] *
W;
2204 if (local_unknown >= 0)
2207 jacobian(local_eqn, local_unknown) -=
2209 (interpolated_dudx(2, 1) * sin_theta + u_phi * cos_theta) *
2210 r * psif(l2) * testf(l) *
W;
2214 jacobian(local_eqn, local_unknown) -=
2215 2.0 * scaled_re_inv_ro * cos_theta * psif(l2) * r2 *
2216 sin_theta * testf[l] *
W;
2225 if (local_unknown >= 0)
2228 double jac_conv = r * u_r * dpsifdx(l2, 0) * sin_theta;
2231 jac_conv += u_theta * dpsifdx(l2, 1) * sin_theta;
2234 jac_conv += (u_r * sin_theta + u_theta * cos_theta) * psif(l2);
2239 psif(l2) * r2 * sin_theta +
2240 scaled_re * r * jac_conv) *
2247 jac_sum -= scaled_re_st *
2248 (mesh_velocity[0] * dpsifdx(l2, 0) * r +
2249 mesh_velocity[1] * dpsifdx(l2, 1)) *
2250 r * sin_theta * testf(l);
2255 jac_sum += (r * dpsifdx(l2, 0) - psif(l2)) * dtestfdx(l, 0) *
2260 jac_sum += (dpsifdx(l2, 1) * sin_theta - psif(l2) * cos_theta) *
2266 ((r * dpsifdx(l2, 0) - psif(l2)) * sin_theta +
2267 (dpsifdx(l2, 1) - psif(l2) * cot_theta) * cos_theta) *
2271 jacobian(local_eqn, local_unknown) -= jac_sum *
W;
2276 mass_matrix(local_eqn, local_unknown) +=
2277 scaled_re_st * psif(l2) * testf[l] * r2 * sin_theta *
W;
2299 for (
unsigned l = 0; l < n_pres; l++)
2306 residuals[local_eqn] += ((2.0 * u_r + r * interpolated_dudx(0, 0) +
2307 interpolated_dudx(1, 1)) *
2309 u_theta * cos_theta) *
2316 for (
unsigned l2 = 0; l2 < n_node; l2++)
2325 if (local_unknown >= 0)
2327 jacobian(local_eqn, local_unknown) +=
2328 (2.0 * psif(l2) + r * dpsifdx(l2, 0)) * r * sin_theta *
2339 if (local_unknown >= 0)
2341 jacobian(local_eqn, local_unknown) +=
2342 r * (dpsifdx(l2, 1) * sin_theta + psif(l2) * cos_theta) *
2370 std::set<std::pair<Data*, unsigned>>& paired_load_data)
2373 unsigned u_index[3];
2374 for (
unsigned i = 0;
i < 3;
i++)
2380 unsigned n_node = this->
nnode();
2381 for (
unsigned n = 0; n < n_node; n++)
2385 for (
unsigned i = 0;
i < 3;
i++)
2387 paired_load_data.insert(std::make_pair(this->
node_pt(n), u_index[
i]));
2405 std::set<std::pair<Data*, unsigned>>& paired_pressure_data)
2409 for (
unsigned l = 0; l < n_internal; l++)
2413 for (
unsigned j = 0; j < nval; j++)
2415 paired_pressure_data.insert(
2430 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const
2433 unsigned n_node = this->
nnode();
2439 std::pair<unsigned, unsigned> dof_lookup;
2442 unsigned pressure_dof_number = 3;
2445 for (
unsigned n = 0; n < n_press; n++)
2457 dof_lookup.first = this->
eqn_number(local_eqn_number);
2458 dof_lookup.second = pressure_dof_number;
2461 dof_lookup_list.push_front(dof_lookup);
2466 for (
unsigned n = 0; n < n_node; n++)
2472 for (
unsigned v = 0; v < nv; v++)
2482 dof_lookup.first = this->
eqn_number(local_eqn_number);
2483 dof_lookup.second = v;
2486 dof_lookup_list.push_front(dof_lookup);
2500 4, 3, 4, 3, 3, 3, 4, 3, 4};
2515 std::set<std::pair<Data*, unsigned>>& paired_load_data)
2518 unsigned u_index[3];
2519 for (
unsigned i = 0;
i < 3;
i++)
2525 unsigned n_node = this->
nnode();
2526 for (
unsigned n = 0; n < n_node; n++)
2530 for (
unsigned i = 0;
i < 3;
i++)
2532 paired_load_data.insert(std::make_pair(this->
node_pt(n), u_index[
i]));
2550 std::set<std::pair<Data*, unsigned>>& paired_pressure_data)
2558 for (
unsigned l = 0; l < n_pres; l++)
2562 paired_pressure_data.insert(
2577 std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list)
const
2580 unsigned n_node = this->
nnode();
2586 std::pair<unsigned, unsigned> dof_lookup;
2589 for (
unsigned n = 0; n < n_node; n++)
2595 for (
unsigned v = 0; v < nv; v++)
2607 dof_lookup.first = this->
eqn_number(local_eqn_number);
2610 dof_lookup.second = v;
2613 dof_lookup_list.push_front(dof_lookup);
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
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 double dshape_eulerian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidx) const
Return the geometric shape functions and also first derivatives w.r.t. global coordinates at the ipt-...
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 .
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.
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Return the geometric shape function at the ipt-th integration point.
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....
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
unsigned ninternal_data() const
Return the number of internal data objects.
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.
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....
void identify_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Add to the set paired_load_data pairs containing.
int p_local_eqn(const unsigned &n) const
Return the local equation numbers for the pressure values.
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 identify_pressure_data(std::set< std::pair< Data *, unsigned >> &paired_pressure_data)
Add to the set paired_pressure_data pairs containing.
unsigned npres_spherical_nst() const
Return number of pressure values.
int p_nodal_index_spherical_nst() const
Set the value at which the pressure is stored in the nodes In this case the third index because there...
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...
static const unsigned Initial_Nvalue[]
Static array of ints to hold number of variables at node.
void identify_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Add to the set paired_load_data pairs containing.
static const unsigned Pconv[]
Static array of ints to hold conversion from pressure node numbers to actual node numbers.
void identify_pressure_data(std::set< std::pair< Data *, unsigned >> &paired_pressure_data)
Add to the set paired_pressure_data pairs containing.
unsigned npres_spherical_nst() const
Return number of pressure values.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
double d_kin_energy_dt() const
Get integral of time derivative 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....
void get_vorticity(const Vector< double > &s, Vector< double > &vorticity) const
Compute the vorticity vector at local coordinate s.
double interpolated_dudx_spherical_nst(const Vector< double > &s, const unsigned &i, const unsigned &j) const
Return matrix entry dudx(i,j) of the FE interpolated velocity derivative at local coordinate s.
virtual double dshape_and_dtest_eulerian_at_knot_spherical_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 pressure_integral() const
Integral of pressure over element.
virtual void pshape_spherical_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
void compute_error_e(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, FiniteElement::SteadyExactSolutionFctPt exact_soln_dr_pt, FiniteElement::SteadyExactSolutionFctPt exact_soln_dtheta_pt, double &u_error, double &u_norm, double &p_error, double &p_norm)
Validate against exact solution. Solution is provided direct from exact_soln function....
void output(std::ostream &outfile)
Output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points.
void full_output(std::ostream &outfile)
Full output function: x,y,[z],u,v,[w],p,du/dt,dv/dt,[dw/dt],dissipation in tecplot format....
virtual unsigned u_index_spherical_nst(const unsigned &i) const
Return the index at which the i-th unknown velocity component is stored. The default value,...
const double & re() const
Reynolds number.
static double Default_Physical_Ratio_Value
Static default value for the physical ratios (all are initialised to one)
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: 1/2 (du_i/dx_j + du_j/dx_i)
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
const double & re_invro() const
Global Reynolds number multiplied by inverse Rossby number.
virtual double p_spherical_nst(const unsigned &n_p) const =0
Pressure at local pressure "node" n_p Uses suitably interpolated value for hanging nodes.
const double & density_ratio() const
Density ratio for element: Element's density relative to the viscosity used in the definition of the ...
virtual void get_body_force_spherical_nst(const double &time, const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &result)
Calculate the body force at a given time and local and/or Eulerian position. This function is virtual...
static int Pressure_not_stored_at_node
Static "magic" number that indicates that the pressure is not stored at a node.
double du_dt_spherical_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.
double cot(const double &th) const
Include a cot function to simplify the NS momentum and jacobian expressions.
double interpolated_p_spherical_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
void compute_shear_stress(std::ostream &outfile)
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....
double kin_energy() const
Get integral of kinetic energy over element.
void output_vorticity(std::ostream &outfile, const unsigned &nplot)
Output function: x,y,[z], [omega_x,omega_y,[and/or omega_z]] in tecplot format. nplot points in each ...
double dissipation() const
Return integral of dissipation over element.
static double Default_Physical_Constant_Value
Static default value for the physical constants (all initialised to zero)
void get_traction(const Vector< double > &s, const Vector< double > &N, Vector< double > &traction)
Compute traction (on the viscous scale) exerted onto the fluid at local coordinate s....
const Vector< double > & g() const
Vector of gravitational components.
virtual void fill_in_generic_residual_contribution_spherical_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier–Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
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 unsigned npres_spherical_nst() const =0
Function to return number of pressure degrees of freedom.
void extract_velocity(std::ostream &outfile)
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed....
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...
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
void interpolated_u_spherical_nst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
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.
const double Pi
50 digits from maple
//////////////////////////////////////////////////////////////////// ////////////////////////////////...