71 const unsigned& which_one)
75 if ((which_one==0)||(which_one==1))
78 "Computation of diagonal of pressure mass matrix is not impmented yet.\n",
79 OOMPH_CURRENT_FUNCTION,
80 OOMPH_EXCEPTION_LOCATION);
85 veloc_mass_diag.assign(
ndof(), 0.0);
88 const unsigned n_node =
nnode();
91 const unsigned n_value = 3;
95 for(
unsigned i=0;
i<n_value;
i++)
110 for(
unsigned ipt=0; ipt<n_intpt; ipt++)
128 for(
unsigned l=0;l<n_node;l++)
137 for(
unsigned l=0; l<n_node; l++)
140 for(
unsigned i=0;
i<n_value;
i++)
148 veloc_mass_diag[local_eqn] += test[l]*test[l] *
W;
167 double& error,
double& norm)
181 outfile <<
"ZONE" << std::endl;
187 for(
unsigned ipt=0;ipt<Nintpt;ipt++)
205 (*exact_soln_pt)(time,x,exact_soln);
208 for(
unsigned i=0;
i<3;
i++)
210 norm+=exact_soln[
i]*exact_soln[
i]*
W;
216 for(
unsigned i=0;
i<2;
i++) {outfile << x[
i] <<
" ";}
219 for(
unsigned i=0;
i<3;
i++)
222 outfile << std::endl;
235 double& error,
double& norm)
249 outfile <<
"ZONE" << std::endl;
255 for(
unsigned ipt=0;ipt<Nintpt;ipt++)
274 (*exact_soln_pt)(x,exact_soln);
277 for(
unsigned i=0;
i<3;
i++)
279 norm+=exact_soln[
i]*exact_soln[
i]*
W;
285 for(
unsigned i=0;
i<2;
i++) {outfile << x[
i] <<
" ";}
288 for(
unsigned i=0;
i<3;
i++)
291 outfile << std::endl;
303 const unsigned &nplot,
321 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
331 (*exact_soln_pt)(x,exact_soln);
334 for(
unsigned i=0;
i<2;
i++)
336 outfile << x[
i] <<
" ";
340 for(
unsigned i=0;
i<exact_soln.size();
i++)
342 outfile << exact_soln[
i] <<
" ";
345 outfile << std::endl;
362 const unsigned &nplot,
381 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
391 (*exact_soln_pt)(time,x,exact_soln);
394 for(
unsigned i=0;
i<2;
i++)
396 outfile << x[
i] <<
" ";
400 for(
unsigned i=0;
i<exact_soln.size();
i++)
402 outfile << exact_soln[
i] <<
" ";
405 outfile << std::endl;
423 const unsigned &nplot,
427 unsigned n_node =
nnode();
443 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
453 for(
unsigned i=0;
i<2;
i++)
455 interpolated_x[
i]=0.0;
457 for(
unsigned l=0;l<n_node;l++)
462 for(
unsigned i=0;
i<3;
i++)
466 interpolated_u[
i]=0.0;
468 for(
unsigned l=0;l<n_node;l++)
469 {interpolated_u[
i] +=
nodal_value(t,l,u_nodal_index)*psi[l];}
473 for(
unsigned i=0;
i<2;
i++) {outfile << interpolated_x[
i] <<
" ";}
476 for(
unsigned i=0;
i<3;
i++) {outfile << interpolated_u[
i] <<
" ";}
478 outfile << std::endl;
493 const unsigned &nplot)
503 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
518 outfile << std::endl;
520 outfile << std::endl;
535 const unsigned &nplot)
545 for (
unsigned iplot=0;iplot<num_plot_points;iplot++)
552 for(
unsigned i=0;
i<2;
i++)
559 for(
unsigned i=0;
i<3;
i++)
570 fprintf(file_pt,
"\n");
573 fprintf(file_pt,
"\n");
589 "Check the dissipation calculation for axisymmetric NSt",
590 OOMPH_CURRENT_FUNCTION,
591 OOMPH_EXCEPTION_LOCATION);
603 for(
unsigned ipt=0;ipt<Nintpt;ipt++)
607 for(
unsigned i=0;
i<2;
i++)
623 double local_diss=0.0;
624 for(
unsigned i=0;
i<3;
i++)
626 for(
unsigned j=0;j<3;j++)
628 local_diss+=2.0*strainrate(
i,j)*strainrate(
i,j);
632 diss+=local_diss*w*J;
659 if ((N.size()==3)&&(N[2]!=0.0))
662 "Unit normal passed into this fct should either be 2D (r,z) or have a zero component in the theta-direction",
663 OOMPH_CURRENT_FUNCTION,
664 OOMPH_EXCEPTION_LOCATION);
676 for (
unsigned i=0;
i<3;
i++)
678 traction[
i]=-press*n_local[
i];
679 for (
unsigned j=0;j<3;j++)
681 traction[
i]+=2.0*strainrate(
i,j)*n_local[j];
693 "Check the dissipation calculation for axisymmetric NSt",
694 OOMPH_CURRENT_FUNCTION,
695 OOMPH_EXCEPTION_LOCATION);
702 double local_diss=0.0;
703 for(
unsigned i=0;
i<3;
i++)
705 for(
unsigned j=0;j<3;j++)
707 local_diss+=2.0*strainrate(
i,j)*strainrate(
i,j);
723 if ((strainrate.
ncol()!=3)||(strainrate.
nrow()!=3))
725 std::ostringstream error_message;
726 error_message <<
"The strain rate has incorrect dimensions " 727 << strainrate.
ncol() <<
" x " 728 << strainrate.
nrow() <<
" Not 3" << std::endl;
731 OOMPH_CURRENT_FUNCTION,
732 OOMPH_EXCEPTION_LOCATION);
737 unsigned n_node =
nnode();
747 double interpolated_r = 0.0;
761 unsigned u_nodal_index[3];
766 for(
unsigned l=0;l<n_node;l++)
774 durdr +=
nodal_value(l,u_nodal_index[0])*dpsidx(l,0);
775 durdz +=
nodal_value(l,u_nodal_index[0])*dpsidx(l,1);
777 duzdr +=
nodal_value(l,u_nodal_index[1])*dpsidx(l,0);
778 duzdz +=
nodal_value(l,u_nodal_index[1])*dpsidx(l,1);
780 duphidr +=
nodal_value(l,u_nodal_index[2])*dpsidx(l,0);
781 duphidz +=
nodal_value(l,u_nodal_index[2])*dpsidx(l,1);
787 strainrate(0,0)=durdr;
788 strainrate(0,1)=0.5*(durdz+duzdr);
789 strainrate(1,0)=strainrate(0,1);
791 strainrate(2,0)=strainrate(0,2);
792 strainrate(1,1)=duzdz;
793 strainrate(1,2)=0.5*duphidz;
794 strainrate(2,1)=strainrate(1,2);
800 if (std::fabs(interpolated_r)>1.0
e-16)
802 double inverse_radius=1.0/interpolated_r;
803 strainrate(0,2)=0.5*(duphidr-inverse_radius*uphi);
804 strainrate(2,0)=strainrate(0,2);
805 strainrate(2,2)=inverse_radius*ur;
819 "Check the kinetic energy calculation for axisymmetric NSt",
820 OOMPH_CURRENT_FUNCTION,
821 OOMPH_EXCEPTION_LOCATION);
833 for(
unsigned ipt=0;ipt<Nintpt;ipt++)
845 double veloc_squared=0.0;
846 for(
unsigned i=0;
i<3;
i++)
874 for(
unsigned ipt=0;ipt<Nintpt;ipt++)
878 for(
unsigned i=0;
i<2;
i++)
916 unsigned n_node =
nnode();
925 unsigned u_nodal_index[3];
930 Shape psif(n_node), testf(n_node);
931 DShape dpsifdx(n_node,2), dtestfdx(n_node,2);
934 Shape psip(n_pres), testp(n_pres);
952 int local_eqn=0, local_unknown=0;
955 for(
unsigned ipt=0;ipt<Nintpt;ipt++)
978 double interpolated_p=0.0;
984 for(
unsigned l=0;l<n_pres;l++) {interpolated_p +=
p_axi_nst(l)*psip[l];}
989 for(
unsigned l=0;l<n_node;l++)
992 const double psif_ = psif(l);
994 for(
unsigned i=0;
i<2;
i++)
1001 for(
unsigned i=0;
i<3;
i++)
1005 interpolated_u[
i] += u_value*psif_;
1008 for(
unsigned j=0;j<2;j++)
1009 {interpolated_dudx(i,j) += u_value*dpsifdx(l,j);}
1017 for(
unsigned l=0;l<n_node;l++)
1020 for(
unsigned i=0;
i<2;
i++)
1043 double r = interpolated_x[0];
1049 for(
unsigned l=0;l<n_node;l++)
1057 residuals[local_eqn] +=
1058 r*body_force[0]*testf[l]*
W;
1061 residuals[local_eqn] += r*scaled_re_inv_fr*testf[l]*G[0]*
W;
1064 residuals[local_eqn] +=
1065 interpolated_p*(testf[l] + r*dtestfdx(l,0))*W;
1071 residuals[local_eqn] -= visc_ratio*
1072 r*(1.0+
Gamma[0])*interpolated_dudx(0,0)*dtestfdx(l,0)*
W;
1074 residuals[local_eqn] -= visc_ratio*r*
1075 (interpolated_dudx(0,1) +
Gamma[0]*interpolated_dudx(1,0))*
1078 residuals[local_eqn] -=
1079 visc_ratio*(1.0 +
Gamma[0])*interpolated_u[0]*testf[l]*W/r;
1083 residuals[local_eqn] -= scaled_re_st*r*dudt[0]*testf[l]*
W;
1086 residuals[local_eqn] -=
1087 scaled_re*(r*interpolated_u[0]*interpolated_dudx(0,0)
1088 - interpolated_u[2]*interpolated_u[2]
1089 + r*interpolated_u[1]*interpolated_dudx(0,1))*testf[l]*W;
1094 for(
unsigned k=0;k<2;k++)
1096 residuals[local_eqn] +=
1097 scaled_re_st*r*mesh_velocity[k]*interpolated_dudx(0,k)*testf[l]*
W;
1102 residuals[local_eqn] +=
1103 2.0*r*scaled_re_inv_ro*interpolated_u[2]*testf[l]*
W;
1109 for(
unsigned l2=0;l2<n_node;l2++)
1113 if(local_unknown >= 0)
1118 mass_matrix(local_eqn,local_unknown) +=
1119 scaled_re_st*r*psif[l2]*testf[l]*
W;
1123 jacobian(local_eqn,local_unknown)
1124 -= visc_ratio*r*(1.0+
Gamma[0])
1125 *dpsifdx(l2,0)*dtestfdx(l,0)*
W;
1127 jacobian(local_eqn,local_unknown)
1128 -= visc_ratio*r*dpsifdx(l2,1)*dtestfdx(l,1)*
W;
1130 jacobian(local_eqn,local_unknown)
1131 -= visc_ratio*(1.0 +
Gamma[0])*psif[l2]*testf[l]*W/r;
1135 jacobian(local_eqn,local_unknown)
1137 psif[l2]*testf[l]*
W;
1140 jacobian(local_eqn,local_unknown) -=
1141 scaled_re*(r*psif[l2]*interpolated_dudx(0,0)
1142 + r*interpolated_u[0]*dpsifdx(l2,0)
1143 + r*interpolated_u[1]*dpsifdx(l2,1))*testf[l]*W;
1148 for(
unsigned k=0;k<2;k++)
1150 jacobian(local_eqn,local_unknown) +=
1151 scaled_re_st*r*mesh_velocity[k]*dpsifdx(l2,k)*testf[l]*
W;
1159 if(local_unknown >= 0)
1161 jacobian(local_eqn,local_unknown) -=
1162 visc_ratio*r*
Gamma[0]*dpsifdx(l2,0)*dtestfdx(l,1)*
W;
1165 jacobian(local_eqn,local_unknown) -=
1166 scaled_re*r*psif[l2]*interpolated_dudx(0,1)*testf[l]*
W;
1171 if(local_unknown >= 0)
1174 jacobian(local_eqn,local_unknown) -=
1175 - scaled_re*2.0*interpolated_u[2]*psif[l2]*testf[l]*
W;
1178 jacobian(local_eqn,local_unknown) +=
1179 2.0*r*scaled_re_inv_ro*psif[l2]*testf[l]*
W;
1185 for(
unsigned l2=0;l2<n_pres;l2++)
1189 if(local_unknown >= 0)
1191 jacobian(local_eqn,local_unknown)
1192 += psip[l2]*(testf[l] + r*dtestfdx(l,0))*W;
1206 residuals[local_eqn] +=
1207 r*body_force[1]*testf[l]*
W;
1210 residuals[local_eqn] += r*scaled_re_inv_fr*testf[l]*G[1]*
W;
1213 residuals[local_eqn] += r*interpolated_p*dtestfdx(l,1)*
W;
1219 residuals[local_eqn] -= visc_ratio*
1220 r*(interpolated_dudx(1,0) +
Gamma[1]*interpolated_dudx(0,1))
1223 residuals[local_eqn] -= visc_ratio*r*
1224 (1.0 +
Gamma[1])*interpolated_dudx(1,1)*dtestfdx(l,1)*
W;
1228 residuals[local_eqn] -= scaled_re_st*r*dudt[1]*testf[l]*
W;
1231 residuals[local_eqn] -=
1232 scaled_re*(r*interpolated_u[0]*interpolated_dudx(1,0)
1233 + r*interpolated_u[1]*interpolated_dudx(1,1))*testf[l]*W;
1238 for(
unsigned k=0;k<2;k++)
1240 residuals[local_eqn] +=
1241 scaled_re_st*r*mesh_velocity[k]*interpolated_dudx(1,k)*testf[l]*
W;
1249 for(
unsigned l2=0;l2<n_node;l2++)
1253 if(local_unknown >= 0)
1259 jacobian(local_eqn,local_unknown) -=
1260 visc_ratio*r*
Gamma[1]*dpsifdx(l2,1)*dtestfdx(l,0)*
W;
1263 jacobian(local_eqn,local_unknown) -=
1264 scaled_re*r*psif[l2]*interpolated_dudx(1,0)*testf[l]*
W;
1269 if(local_unknown >= 0)
1274 mass_matrix(local_eqn,local_unknown) +=
1275 scaled_re_st*r*psif[l2]*testf[l]*
W;
1283 jacobian(local_eqn,local_unknown) -=
1284 visc_ratio*r*dpsifdx(l2,0)*dtestfdx(l,0)*
W;
1286 jacobian(local_eqn,local_unknown) -=
1287 visc_ratio*r*(1.0 +
Gamma[1])*dpsifdx(l2,1)*
1292 jacobian(local_eqn,local_unknown) -=
1294 psif[l2]*testf[l]*
W;
1297 jacobian(local_eqn,local_unknown) -=
1298 scaled_re*(r*interpolated_u[0]*dpsifdx(l2,0)
1299 + r*psif[l2]*interpolated_dudx(1,1)
1300 + r*interpolated_u[1]*dpsifdx(l2,1))*testf[l]*W;
1306 for(
unsigned k=0;k<2;k++)
1308 jacobian(local_eqn,local_unknown) +=
1309 scaled_re_st*r*mesh_velocity[k]*dpsifdx(l2,k)*testf[l]*
W;
1319 for(
unsigned l2=0;l2<n_pres;l2++)
1323 if(local_unknown >= 0)
1325 jacobian(local_eqn,local_unknown)
1326 += r*psip[l2]*dtestfdx(l,1)*
W;
1339 residuals[local_eqn] +=
1340 r*body_force[2]*testf[l]*
W;
1343 residuals[local_eqn] += r*scaled_re_inv_fr*testf[l]*G[2]*
W;
1351 residuals[local_eqn] -= visc_ratio*
1352 (r*interpolated_dudx(2,0) -
1353 Gamma[0]*interpolated_u[2])*dtestfdx(l,0)*
W;
1355 residuals[local_eqn] -= visc_ratio*r*
1356 interpolated_dudx(2,1)*dtestfdx(l,1)*
W;
1358 residuals[local_eqn] -= visc_ratio*
1359 ((interpolated_u[2]/r) -
Gamma[0]*interpolated_dudx(2,0))*testf[l]*W;
1364 residuals[local_eqn] -= scaled_re_st*r*dudt[2]*testf[l]*
W;
1367 residuals[local_eqn] -=
1368 scaled_re*(r*interpolated_u[0]*interpolated_dudx(2,0)
1369 + interpolated_u[0]*interpolated_u[2]
1370 + r*interpolated_u[1]*interpolated_dudx(2,1))*testf[l]*W;
1375 for(
unsigned k=0;k<2;k++)
1377 residuals[local_eqn] +=
1378 scaled_re_st*r*mesh_velocity[k]*interpolated_dudx(2,k)*testf[l]*
W;
1383 residuals[local_eqn] -=
1384 2.0*r*scaled_re_inv_ro*interpolated_u[0]*testf[l]*
W;
1390 for(
unsigned l2=0;l2<n_node;l2++)
1394 if(local_unknown >= 0)
1397 jacobian(local_eqn,local_unknown) -=
1398 scaled_re*(r*psif[l2]*interpolated_dudx(2,0)
1399 + psif[l2]*interpolated_u[2])*testf[l]*W;
1402 jacobian(local_eqn,local_unknown) -=
1403 2.0*r*scaled_re_inv_ro*psif[l2]*testf[l]*
W;
1408 if(local_unknown >= 0)
1411 jacobian(local_eqn,local_unknown) -=
1412 scaled_re*r*psif[l2]*interpolated_dudx(2,1)*testf[l]*
W;
1417 if(local_unknown >= 0)
1422 mass_matrix(local_eqn,local_unknown) +=
1423 scaled_re_st*r*psif[l2]*testf[l]*
W;
1430 jacobian(local_eqn,local_unknown) -=
1431 visc_ratio*(r*dpsifdx(l2,0) -
1432 Gamma[0]*psif[l2])*dtestfdx(l,0)*
W;
1434 jacobian(local_eqn,local_unknown) -=
1435 visc_ratio*r*dpsifdx(l2,1)*dtestfdx(l,1)*
W;
1437 jacobian(local_eqn,local_unknown) -=
1438 visc_ratio*((psif[l2]/r) -
Gamma[0]*dpsifdx(l2,0))
1443 jacobian(local_eqn,local_unknown) -=
1445 psif[l2]*testf[l]*
W;
1448 jacobian(local_eqn,local_unknown) -=
1449 scaled_re*(r*interpolated_u[0]*dpsifdx(l2,0)
1450 + interpolated_u[0]*psif[l2]
1451 + r*interpolated_u[1]*dpsifdx(l2,1))*testf[l]*W;
1456 for(
unsigned k=0;k<2;k++)
1458 jacobian(local_eqn,local_unknown) +=
1459 scaled_re_st*r*mesh_velocity[k]*dpsifdx(l2,k)*testf[l]*
W;
1477 for(
unsigned l=0;l<n_pres;l++)
1484 residuals[local_eqn] -= r*source*testp[l]*
W;
1487 residuals[local_eqn] +=
1488 (interpolated_u[0] + r*interpolated_dudx(0,0)
1489 + r*interpolated_dudx(1,1))*testp[l]*W;
1495 for(
unsigned l2=0;l2<n_node;l2++)
1499 if(local_unknown >= 0)
1501 jacobian(local_eqn,local_unknown) +=
1502 (psif[l2] + r*dpsifdx(l2,0))*testp[l]*W;
1508 if(local_unknown >= 0)
1510 jacobian(local_eqn,local_unknown) +=
1511 r*dpsifdx(l2,1)*testp[l]*
W;
1536 if(
ndof()==0) {
return; }
1542 const unsigned n_node =
nnode();
1548 unsigned u_nodal_index[3];
1553 Shape psif(n_node), testf(n_node);
1554 DShape dpsifdx(n_node,2), dtestfdx(n_node,2);
1557 Shape psip(n_pres), testp(n_pres);
1603 bool element_has_node_with_aux_node_update_fct=
false;
1604 for(
unsigned q=0;q<n_node;q++)
1612 element_has_node_with_aux_node_update_fct=
true;
1616 std::ostringstream warning_stream;
1617 warning_stream <<
"\nThe functionality to evaluate the additional" 1618 <<
"\ncontribution to the deriv of the residual eqn" 1619 <<
"\nw.r.t. the nodal coordinates which comes about" 1620 <<
"\nif a node's values are updated using an auxiliary" 1621 <<
"\nnode update function has NOT been tested for" 1622 <<
"\naxisymmetric Navier-Stokes elements. Use at your" 1626 warning_stream.str(),
1627 "AxisymmetricNavierStokesEquations::get_dresidual_dnodal_coordinates",
1628 OOMPH_EXCEPTION_LOCATION);
1632 for(
unsigned i=0;
i<3;
i++)
1634 u_ref[
i]=*(nod_pt->
value_pt(u_nodal_index[
i]));
1638 for(
unsigned p=0;p<2;p++)
1641 double backup=nod_pt->
x(p);
1645 nod_pt->
x(p) += eps_fd;
1651 for(
unsigned i=0;
i<3;
i++)
1654 d_U_dX(p,q,
i)=(*(nod_pt->
value_pt(u_nodal_index[
i]))-u_ref[i])/eps_fd;
1658 nod_pt->
x(p)=backup;
1670 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
1680 ipt,psif,dpsifdx,d_dpsifdx_dX,testf,dtestfdx,d_dtestfdx_dX,dJ_dX);
1692 double interpolated_p=0.0;
1698 for(
unsigned l=0;l<n_pres;l++) { interpolated_p +=
p_axi_nst(l)*psip[l]; }
1704 for(
unsigned l=0;l<n_node;l++)
1707 const double psif_ = psif(l);
1710 for(
unsigned i=0;
i<2;
i++)
1716 for(
unsigned i=0;
i<3;
i++)
1720 interpolated_u[
i] += u_value*psif_;
1724 for(
unsigned j=0;j<2;j++)
1726 interpolated_dudx(i,j) += u_value*dpsifdx(l,j);
1735 for(
unsigned l=0;l<n_node;l++)
1738 for(
unsigned i=0;
i<2;
i++)
1746 for(
unsigned q=0;q<n_node;q++)
1749 for(
unsigned p=0;p<2;p++)
1752 for(
unsigned i=0;
i<3;
i++)
1755 for(
unsigned k=0;k<2;k++)
1760 for(
unsigned j=0;j<n_node;j++)
1765 d_dudx_dX(p,q,
i,k) = aux;
1773 const double pos_time_weight
1797 const double r = interpolated_x[0];
1807 for(
unsigned l=0;l<n_node;l++)
1810 const double testf_ = testf[l];
1821 for(
unsigned p=0;p<2;p++)
1824 for(
unsigned q=0;q<n_node;q++)
1831 double sum = r*body_force[0]*testf_;
1834 sum += r*scaled_re_inv_fr*testf_*G[0];
1837 sum += interpolated_p*(testf_ + r*dtestfdx(l,0));
1844 r*(1.0+
Gamma[0])*interpolated_dudx(0,0)*dtestfdx(l,0);
1846 sum -= visc_ratio*r*
1847 (interpolated_dudx(0,1) +
Gamma[0]*interpolated_dudx(1,0))*
1850 sum -= visc_ratio*(1.0 +
Gamma[0])*interpolated_u[0]*testf_/r;
1853 sum -= scaled_re_st*r*dudt[0]*testf_;
1857 scaled_re*(r*interpolated_u[0]*interpolated_dudx(0,0)
1858 - interpolated_u[2]*interpolated_u[2]
1859 + r*interpolated_u[1]*interpolated_dudx(0,1))*testf_;
1864 for(
unsigned k=0;k<2;k++)
1866 sum += scaled_re_st*r*mesh_velocity[k]
1867 *interpolated_dudx(0,k)*testf_;
1872 sum += 2.0*r*scaled_re_inv_ro*interpolated_u[2]*testf_;
1875 dresidual_dnodal_coordinates(local_eqn,p,q) += sum*dJ_dX(p,q)*w;
1881 sum = r*d_body_force_dx(0,p)*psif[q]*testf_;
1882 if(p==0) { sum += body_force[0]*psif[q]*testf_; }
1885 if(p==0) { sum += scaled_re_inv_fr*G[0]*psif[q]*testf_; }
1888 sum += r*interpolated_p*d_dtestfdx_dX(p,q,l,0);
1889 if(p==0) { sum += interpolated_p*psif[q]*dtestfdx(l,0); }
1892 sum -= r*visc_ratio*(
1894 d_dudx_dX(p,q,0,0)*dtestfdx(l,0)
1895 + interpolated_dudx(0,0)*d_dtestfdx_dX(p,q,l,0))
1896 + (d_dudx_dX(p,q,0,1)
1897 +
Gamma[0]*d_dudx_dX(p,q,1,0))*dtestfdx(l,1)
1898 + (interpolated_dudx(0,1)
1899 +
Gamma[0]*interpolated_dudx(1,0))
1900 *d_dtestfdx_dX(p,q,l,1));
1905 interpolated_dudx(0,0)*psif[q]*dtestfdx(l,0)
1906 - interpolated_u[0]*psif[q]*testf_/(r*r))
1907 + (interpolated_dudx(0,1)
1908 +
Gamma[0]*interpolated_dudx(1,0))*psif[q]*dtestfdx(l,1));
1912 for(
unsigned k=0;k<2;k++)
1914 double tmp = scaled_re*interpolated_u[k];
1916 sum -= r*tmp*d_dudx_dX(p,q,0,k)*testf_;
1917 if(p==0) { sum -= tmp*interpolated_dudx(0,k)*psif[q]*testf_; }
1921 sum += scaled_re_st*r*pos_time_weight*interpolated_dudx(0,p)
1926 if(p==0) { sum -= scaled_re_st*dudt[0]*psif[q]*testf_; }
1931 sum += 2.0*scaled_re_inv_ro*interpolated_u[2]*psif[q]*testf_;
1935 dresidual_dnodal_coordinates(local_eqn,p,q) += sum*J*w;
1939 if(element_has_node_with_aux_node_update_fct)
1942 double tmp = scaled_re_st*r*val_time_weight*psif[q]*testf_;
1943 tmp += r*scaled_re*interpolated_dudx(0,0)*psif[q]*testf_;
1944 for(
unsigned k=0;k<2;k++)
1946 double tmp2 = scaled_re*interpolated_u[k];
1948 tmp += r*tmp2*dpsifdx(q,k)*testf_;
1951 tmp += r*visc_ratio*(1.0+
Gamma[0])*dpsifdx(q,0)*dtestfdx(l,0);
1952 tmp += r*visc_ratio*dpsifdx(q,1)*dtestfdx(l,1);
1953 tmp += visc_ratio*(1.0+
Gamma[0])*psif[q]*testf_/r;
1956 sum = -d_U_dX(p,q,0)*tmp;
1959 tmp = scaled_re*r*interpolated_dudx(0,1)*psif[q]*testf_;
1960 tmp += r*visc_ratio*
Gamma[0]*dpsifdx(q,0)*dtestfdx(l,1);
1963 sum -= d_U_dX(p,q,1)*tmp;
1966 tmp = 2.0*(r*scaled_re_inv_ro
1967 + scaled_re*interpolated_u[2])*psif[q]*testf_;
1970 sum += d_U_dX(p,q,2)*tmp;
1973 dresidual_dnodal_coordinates(local_eqn,p,q) += sum*J*w;
1988 for(
unsigned p=0;p<2;p++)
1991 for(
unsigned q=0;q<n_node;q++)
1998 double sum = r*body_force[1]*testf_;
2001 sum += r*scaled_re_inv_fr*testf_*G[1];
2004 sum += r*interpolated_p*dtestfdx(l,1);
2011 r*(interpolated_dudx(1,0) +
Gamma[1]*interpolated_dudx(0,1))
2014 sum -= visc_ratio*r*
2015 (1.0 +
Gamma[1])*interpolated_dudx(1,1)*dtestfdx(l,1);
2018 sum -= scaled_re_st*r*dudt[1]*testf_;
2022 scaled_re*(r*interpolated_u[0]*interpolated_dudx(1,0)
2023 + r*interpolated_u[1]*interpolated_dudx(1,1))*testf_;
2028 for(
unsigned k=0;k<2;k++)
2031 scaled_re_st*r*mesh_velocity[k]*interpolated_dudx(1,k)*testf_;
2036 dresidual_dnodal_coordinates(local_eqn,p,q) += sum*dJ_dX(p,q)*w;
2042 sum = r*d_body_force_dx(1,p)*psif[q]*testf_;
2043 if(p==0) { sum += body_force[1]*psif[q]*testf_; }
2046 if(p==0) { sum += scaled_re_inv_fr*G[1]*psif[q]*testf_; }
2049 sum += r*interpolated_p*d_dtestfdx_dX(p,q,l,1);
2050 if(p==0) { sum += interpolated_p*psif[q]*dtestfdx(l,1); }
2053 sum -= r*visc_ratio*(
2054 (d_dudx_dX(p,q,1,0) +
Gamma[1]*d_dudx_dX(p,q,0,1))*dtestfdx(l,0)
2055 + (interpolated_dudx(1,0)
2056 +
Gamma[1]*interpolated_dudx(0,1))*d_dtestfdx_dX(p,q,l,0)
2057 + (1.0+
Gamma[1])*d_dudx_dX(p,q,1,1)*dtestfdx(l,1)
2058 + (1.0+
Gamma[1])*interpolated_dudx(1,1)*d_dtestfdx_dX(p,q,l,1));
2062 (interpolated_dudx(1,0)
2063 +
Gamma[1]*interpolated_dudx(0,1))*psif[q]*dtestfdx(l,0)
2064 + (1.0+
Gamma[1])*interpolated_dudx(1,1)*psif[q]*dtestfdx(l,1));
2068 for(
unsigned k=0;k<2;k++)
2070 double tmp = scaled_re*interpolated_u[k];
2072 sum -= r*tmp*d_dudx_dX(p,q,1,k)*testf_;
2073 if(p==0) { sum -= tmp*interpolated_dudx(1,k)*psif[q]*testf_; }
2077 sum += scaled_re_st*r*pos_time_weight*interpolated_dudx(1,p)
2082 if(p==0) { sum -= scaled_re_st*dudt[1]*psif[q]*testf_; }
2085 dresidual_dnodal_coordinates(local_eqn,p,q) += sum*J*w;
2089 if(element_has_node_with_aux_node_update_fct)
2092 double tmp = scaled_re*r*interpolated_dudx(1,0)*psif[q]*testf_;
2093 tmp += r*visc_ratio*
Gamma[1]*dpsifdx(q,1)*dtestfdx(l,0);
2096 sum = -d_U_dX(p,q,0)*tmp;
2099 tmp = scaled_re_st*r*val_time_weight*psif[q]*testf_;
2100 tmp += r*scaled_re*interpolated_dudx(1,1)*psif[q]*testf_;
2101 for(
unsigned k=0;k<2;k++)
2103 double tmp2 = scaled_re*interpolated_u[k];
2105 tmp += r*tmp2*dpsifdx(q,k)*testf_;
2107 tmp += r*visc_ratio*(dpsifdx(q,0)*dtestfdx(l,0)
2108 + (1.0+
Gamma[1])*dpsifdx(q,1)*dtestfdx(l,1));
2111 sum -= d_U_dX(p,q,1)*tmp;
2114 dresidual_dnodal_coordinates(local_eqn,p,q) += sum*J*w;
2129 for(
unsigned p=0;p<2;p++)
2132 for(
unsigned q=0;q<n_node;q++)
2139 double sum = r*body_force[2]*testf_;
2142 sum += r*scaled_re_inv_fr*testf_*G[2];
2150 sum -= visc_ratio*(r*interpolated_dudx(2,0) -
2151 Gamma[0]*interpolated_u[2])*dtestfdx(l,0);
2153 sum -= visc_ratio*r*interpolated_dudx(2,1)*dtestfdx(l,1);
2155 sum -= visc_ratio*((interpolated_u[2]/r)
2156 -
Gamma[0]*interpolated_dudx(2,0))*testf_;
2159 sum -= scaled_re_st*r*dudt[2]*testf_;
2163 scaled_re*(r*interpolated_u[0]*interpolated_dudx(2,0)
2164 + interpolated_u[0]*interpolated_u[2]
2165 + r*interpolated_u[1]*interpolated_dudx(2,1))*testf_;
2170 for(
unsigned k=0;k<2;k++)
2173 scaled_re_st*r*mesh_velocity[k]*interpolated_dudx(2,k)*testf_;
2178 sum -= 2.0*r*scaled_re_inv_ro*interpolated_u[0]*testf_;
2181 dresidual_dnodal_coordinates(local_eqn,p,q) += sum*dJ_dX(p,q)*w;
2187 sum = r*d_body_force_dx(2,p)*psif[q]*testf_;
2188 if(p==0) { sum += body_force[2]*psif[q]*testf_; }
2191 if(p==0) { sum += scaled_re_inv_fr*G[2]*psif[q]*testf_; }
2196 sum -= visc_ratio*r*(
2197 d_dudx_dX(p,q,2,0)*dtestfdx(l,0)
2198 + interpolated_dudx(2,0)*d_dtestfdx_dX(p,q,l,0)
2199 + d_dudx_dX(p,q,2,1)*dtestfdx(l,1)
2200 + interpolated_dudx(2,1)*d_dtestfdx_dX(p,q,l,1));
2202 sum += visc_ratio*
Gamma[0]*d_dudx_dX(p,q,2,0)*testf_;
2206 sum -= visc_ratio*(interpolated_dudx(2,0)*psif[q]*dtestfdx(l,0)
2207 + interpolated_dudx(2,1)*psif[q]*dtestfdx(l,1)
2208 + interpolated_u[2]*psif[q]*testf_/(r*r));
2212 for(
unsigned k=0;k<2;k++)
2214 double tmp = scaled_re*interpolated_u[k];
2216 sum -= r*tmp*d_dudx_dX(p,q,2,k)*testf_;
2217 if(p==0) { sum -= tmp*interpolated_dudx(2,k)*psif[q]*testf_; }
2221 sum += scaled_re_st*r*pos_time_weight*interpolated_dudx(2,p)
2226 if(p==0) { sum -= scaled_re_st*dudt[2]*psif[q]*testf_; }
2231 sum -= 2.0*scaled_re_inv_ro*interpolated_u[0]*psif[q]*testf_;
2235 dresidual_dnodal_coordinates(local_eqn,p,q) += sum*J*w;
2239 if(element_has_node_with_aux_node_update_fct)
2242 double tmp = (2.0*r*scaled_re_inv_ro
2243 + r*scaled_re*interpolated_dudx(2,0)
2244 - scaled_re*interpolated_u[2])*psif[q]*testf_;
2247 sum = -d_U_dX(p,q,0)*tmp;
2251 sum -= d_U_dX(p,q,1)*scaled_re*r*interpolated_dudx(2,1)
2255 tmp = scaled_re_st*r*val_time_weight*psif[q]*testf_;
2256 tmp -= scaled_re*interpolated_u[0]*psif[q]*testf_;
2257 for(
unsigned k=0;k<2;k++)
2259 double tmp2 = scaled_re*interpolated_u[k];
2261 tmp += r*tmp2*dpsifdx(q,k)*testf_;
2263 tmp += visc_ratio*(r*dpsifdx(q,0)
2264 -
Gamma[0]*psif[q])*dtestfdx(l,0);
2265 tmp += r*visc_ratio*dpsifdx(q,1)*dtestfdx(l,1);
2266 tmp += visc_ratio*((psif[q]/r) -
Gamma[0]*dpsifdx(q,0))*testf_;
2269 sum -= d_U_dX(p,q,2)*tmp;
2272 dresidual_dnodal_coordinates(local_eqn,p,q) += sum*J*w;
2286 for(
unsigned l=0;l<n_pres;l++)
2291 const double testp_ = testp[l];
2298 for(
unsigned p=0;p<2;p++)
2301 for(
unsigned q=0;q<n_node;q++)
2308 double aux = -r*source;
2311 aux += (interpolated_u[0]
2312 + r*interpolated_dudx(0,0)
2313 + r*interpolated_dudx(1,1));
2316 dresidual_dnodal_coordinates(local_eqn,p,q) +=
2317 aux*dJ_dX(p,q)*testp_*w;
2323 aux = -r*source_gradient[p]*psif[q];
2324 if(p==0) { aux -= source*psif[q]; }
2327 aux += r*(d_dudx_dX(p,q,0,0) + d_dudx_dX(p,q,1,1));
2330 aux += (interpolated_dudx(0,0) + interpolated_dudx(1,1))*psif[q];
2335 if(element_has_node_with_aux_node_update_fct)
2337 aux += d_U_dX(p,q,0)*(psif[q] + r*dpsifdx(q,0));
2338 aux += d_U_dX(p,q,1)*r*dpsifdx(q,1);
2342 dresidual_dnodal_coordinates(local_eqn,p,q) += aux*testp_*J*w;
2363 double*
const ¶meter_pt,
2370 if(parameter_pt!=this->
re_pt())
2372 std::ostringstream error_stream;
2374 "Cannot compute analytic jacobian for parameter addressed by " 2375 << parameter_pt <<
"\n";
2376 error_stream <<
"Can only compute derivatives wrt Re (" 2380 OOMPH_CURRENT_FUNCTION,
2381 OOMPH_EXCEPTION_LOCATION);
2385 bool diff_re =
false;
2386 bool diff_re_st =
false;
2387 bool diff_re_inv_fr =
false;
2388 bool diff_re_inv_ro =
false;
2391 if(parameter_pt==this->
re_pt()) {diff_re =
true;}
2392 if(parameter_pt==this->
re_st_pt()) {diff_re_st =
true;}
2393 if(parameter_pt==this->
re_invfr_pt()) {diff_re_inv_fr =
true;}
2394 if(parameter_pt==this->
re_invro_pt()) {diff_re_inv_ro =
true;}
2398 unsigned n_node =
nnode();
2404 unsigned u_nodal_index[3];
2409 Shape psif(n_node), testf(n_node);
2410 DShape dpsifdx(n_node,2), dtestfdx(n_node,2);
2413 Shape psip(n_pres), testp(n_pres);
2432 int local_eqn=0, local_unknown=0;
2435 for(
unsigned ipt=0;ipt<Nintpt;ipt++)
2458 double interpolated_p=0.0;
2464 for(
unsigned l=0;l<n_pres;l++) {interpolated_p +=
p_axi_nst(l)*psip[l];}
2469 for(
unsigned l=0;l<n_node;l++)
2472 const double psif_ = psif(l);
2474 for(
unsigned i=0;
i<2;
i++)
2481 for(
unsigned i=0;
i<3;
i++)
2485 interpolated_u[
i] += u_value*psif_;
2488 for(
unsigned j=0;j<2;j++)
2489 {interpolated_dudx(i,j) += u_value*dpsifdx(l,j);}
2497 for(
unsigned l=0;l<n_node;l++)
2500 for(
unsigned i=0;
i<2;
i++)
2523 double r = interpolated_x[0];
2530 for(
unsigned l=0;l<n_node;l++)
2546 dres_dparam[local_eqn] += r*dens_ratio*testf[l]*G[0]*
W;
2571 dres_dparam[local_eqn] -= dens_ratio*r*dudt[0]*testf[l]*
W;
2577 dres_dparam[local_eqn] -=
2578 dens_ratio*(r*interpolated_u[0]*interpolated_dudx(0,0)
2579 - interpolated_u[2]*interpolated_u[2]
2580 + r*interpolated_u[1]*interpolated_dudx(0,1))*testf[l]*W;
2588 for(
unsigned k=0;k<2;k++)
2590 dres_dparam[local_eqn] +=
2591 dens_ratio*r*mesh_velocity[k]*interpolated_dudx(0,k)*testf[l]*
W;
2599 dres_dparam[local_eqn] +=
2600 2.0*r*dens_ratio*interpolated_u[2]*testf[l]*
W;
2607 for(
unsigned l2=0;l2<n_node;l2++)
2611 if(local_unknown >= 0)
2618 dmass_matrix_dparam(local_eqn,local_unknown) +=
2619 dens_ratio*r*psif[l2]*testf[l]*
W;
2638 djac_dparam(local_eqn,local_unknown)
2640 psif[l2]*testf[l]*
W;
2646 djac_dparam(local_eqn,local_unknown) -=
2647 dens_ratio*(r*psif[l2]*interpolated_dudx(0,0)
2648 + r*interpolated_u[0]*dpsifdx(l2,0)
2649 + r*interpolated_u[1]*dpsifdx(l2,1))*testf[l]*W;
2655 for(
unsigned k=0;k<2;k++)
2659 djac_dparam(local_eqn,local_unknown) +=
2660 dens_ratio*r*mesh_velocity[k]*dpsifdx(l2,k)*testf[l]*
W;
2668 if(local_unknown >= 0)
2676 djac_dparam(local_eqn,local_unknown) -=
2677 dens_ratio*r*psif[l2]*interpolated_dudx(0,1)*testf[l]*
W;
2683 if(local_unknown >= 0)
2688 djac_dparam(local_eqn,local_unknown) -=
2689 - dens_ratio*2.0*interpolated_u[2]*psif[l2]*testf[l]*
W;
2694 djac_dparam(local_eqn,local_unknown) +=
2695 2.0*r*dens_ratio*psif[l2]*testf[l]*
W;
2729 dres_dparam[local_eqn] += r*dens_ratio*testf[l]*G[1]*
W;
2750 dres_dparam[local_eqn] -= dens_ratio*r*dudt[1]*testf[l]*
W;
2756 dres_dparam[local_eqn] -=
2757 dens_ratio*(r*interpolated_u[0]*interpolated_dudx(1,0)
2758 + r*interpolated_u[1]*interpolated_dudx(1,1))*testf[l]*W;
2766 for(
unsigned k=0;k<2;k++)
2768 dres_dparam[local_eqn] +=
2769 dens_ratio*r*mesh_velocity[k]*interpolated_dudx(1,k)*testf[l]*
W;
2778 for(
unsigned l2=0;l2<n_node;l2++)
2782 if(local_unknown >= 0)
2794 djac_dparam(local_eqn,local_unknown) -=
2795 dens_ratio*r*psif[l2]*interpolated_dudx(1,0)*testf[l]*
W;
2801 if(local_unknown >= 0)
2808 dmass_matrix_dparam(local_eqn,local_unknown) +=
2809 dens_ratio*r*psif[l2]*testf[l]*
W;
2829 djac_dparam(local_eqn,local_unknown) -=
2831 psif[l2]*testf[l]*
W;
2837 djac_dparam(local_eqn,local_unknown) -=
2838 dens_ratio*(r*interpolated_u[0]*dpsifdx(l2,0)
2839 + r*psif[l2]*interpolated_dudx(1,1)
2840 + r*interpolated_u[1]*dpsifdx(l2,1))*testf[l]*W;
2846 for(
unsigned k=0;k<2;k++)
2850 djac_dparam(local_eqn,local_unknown) +=
2851 dens_ratio*r*mesh_velocity[k]*dpsifdx(l2,k)*testf[l]*
W;
2876 dres_dparam[local_eqn] += r*dens_ratio*testf[l]*G[2]*
W;
2900 dres_dparam[local_eqn] -= dens_ratio*r*dudt[2]*testf[l]*
W;
2906 dres_dparam[local_eqn] -=
2907 dens_ratio*(r*interpolated_u[0]*interpolated_dudx(2,0)
2908 + interpolated_u[0]*interpolated_u[2]
2909 + r*interpolated_u[1]*interpolated_dudx(2,1))*testf[l]*W;
2917 for(
unsigned k=0;k<2;k++)
2919 dres_dparam[local_eqn] +=
2920 dens_ratio*r*mesh_velocity[k]*interpolated_dudx(2,k)*testf[l]*
W;
2928 dres_dparam[local_eqn] -=
2929 2.0*r*dens_ratio*interpolated_u[0]*testf[l]*
W;
2936 for(
unsigned l2=0;l2<n_node;l2++)
2940 if(local_unknown >= 0)
2945 djac_dparam(local_eqn,local_unknown) -=
2946 dens_ratio*(r*psif[l2]*interpolated_dudx(2,0)
2947 + psif[l2]*interpolated_u[2])*testf[l]*W;
2953 djac_dparam(local_eqn,local_unknown) -=
2954 2.0*r*dens_ratio*psif[l2]*testf[l]*
W;
2960 if(local_unknown >= 0)
2965 djac_dparam(local_eqn,local_unknown) -=
2966 dens_ratio*r*psif[l2]*interpolated_dudx(2,1)*testf[l]*
W;
2972 if(local_unknown >= 0)
2979 dmass_matrix_dparam(local_eqn,local_unknown) +=
2980 dens_ratio*r*psif[l2]*testf[l]*
W;
3003 djac_dparam(local_eqn,local_unknown) -=
3005 psif[l2]*testf[l]*
W;
3011 djac_dparam(local_eqn,local_unknown) -=
3012 dens_ratio*(r*interpolated_u[0]*dpsifdx(l2,0)
3013 + interpolated_u[0]*psif[l2]
3014 + r*interpolated_u[1]*dpsifdx(l2,1))*testf[l]*W;
3022 for(
unsigned k=0;k<2;k++)
3024 djac_dparam(local_eqn,local_unknown) +=
3025 dens_ratio*r*mesh_velocity[k]*dpsifdx(l2,k)*testf[l]*
W;
3057 unsigned n_node =
nnode();
3060 unsigned u_nodal_index[3];
3065 Shape psif(n_node), testf(n_node);
3066 DShape dpsifdx(n_node,2), dtestfdx(n_node,2);
3081 int local_eqn=0, local_unknown=0, local_freedom=0;
3084 const unsigned n_dof = this->
ndof();
3090 for(
unsigned ipt=0;ipt<Nintpt;ipt++)
3117 for(
unsigned l=0;l<n_node;l++)
3120 const double psif_ = psif(l);
3122 for(
unsigned i=0;
i<2;
i++)
3128 for(
unsigned i=0;
i<3;
i++)
3132 interpolated_u[
i] += u_value*psif_;
3135 for(
unsigned j=0;j<2;j++)
3136 {interpolated_dudx(i,j) += u_value*dpsifdx(l,j);}
3144 OOMPH_CURRENT_FUNCTION,
3145 OOMPH_EXCEPTION_LOCATION);
3149 double r = interpolated_x[0];
3156 for(
unsigned l=0;l<n_node;l++)
3165 for(
unsigned l3=0;l3<n_node;l3++)
3169 if(local_freedom >= 0)
3175 for(
unsigned l2=0;l2<n_node;l2++)
3179 if(local_unknown >= 0)
3182 temp -=scaled_re*(r*psif[l2]*dpsifdx(l3,0)
3183 + r*psif[l3]*dpsifdx(l2,0))*
3184 Y[local_unknown]*testf[l]*W;
3189 if(local_unknown >= 0)
3193 scaled_re*r*psif[l2]*dpsifdx(l3,1)*Y[local_unknown]*testf[l]*
W;
3197 jac_y(local_eqn,local_freedom) += temp;
3203 if(local_freedom >= 0)
3208 for(
unsigned l2=0;l2<n_node;l2++)
3212 if(local_unknown >= 0)
3215 temp -= scaled_re*(r*psif[l3]*dpsifdx(l2,1))*
3216 Y[local_unknown]*testf[l]*W;
3220 jac_y(local_eqn,local_freedom) += temp;
3225 if(local_freedom >= 0)
3230 for(
unsigned l2=0;l2<n_node;l2++)
3234 if(local_unknown >= 0)
3238 - scaled_re*2.0*psif[l3]*psif[l2]*Y[local_unknown]*testf[l]*
W;
3242 jac_y(local_eqn,local_freedom) += temp;
3255 for(
unsigned l3=0;l3<n_node;l3++)
3259 if(local_freedom >= 0)
3264 for(
unsigned l2=0;l2<n_node;l2++)
3268 if(local_unknown >= 0)
3272 scaled_re*(r*psif[l3]*dpsifdx(l2,0))*
3273 Y[local_unknown]*testf[l]*W;
3276 jac_y(local_eqn,local_freedom) += temp;
3284 if(local_freedom >= 0)
3289 for(
unsigned l2=0;l2<n_node;l2++)
3293 if(local_unknown >= 0)
3297 scaled_re*r*psif[l2]*dpsifdx(l3,0)*Y[local_unknown]*testf[l]*
W;
3302 if(local_unknown >= 0)
3307 r*psif[l2]*dpsifdx(l3,1)
3308 + r*psif[l3]*dpsifdx(l2,1))*Y[local_unknown]*testf[l]*W;
3315 jac_y(local_eqn,local_freedom) += temp;
3326 for(
unsigned l3=0;l3<n_node;l3++)
3330 if(local_freedom >= 0)
3335 for(
unsigned l2=0;l2<n_node;l2++)
3339 if(local_unknown >= 0)
3343 scaled_re*(r*psif[l3]*dpsifdx(l2,0)
3344 + psif[l3]*psif[l2])*Y[local_unknown]*testf[l]*W;
3348 jac_y(local_eqn,local_freedom) += temp;
3353 if(local_freedom >= 0)
3358 for(
unsigned l2=0;l2<n_node;l2++)
3362 if(local_unknown >= 0)
3366 scaled_re*(r*psif[l3]*dpsifdx(l2,1))*
3367 Y[local_unknown]*testf[l]*W;
3371 jac_y(local_eqn,local_freedom) += temp;
3377 if(local_freedom >= 0)
3383 for(
unsigned l2=0;l2<n_node;l2++)
3387 if(local_unknown >= 0)
3391 scaled_re*(r*psif[l2]*dpsifdx(l3,0)
3392 + psif[l2]*psif[l3])*Y[local_unknown]*testf[l]*W;
3397 if(local_unknown >= 0)
3401 scaled_re*r*psif[l2]*dpsifdx(l3,1)*Y[local_unknown]*testf[l]*
W;
3405 jac_y(local_eqn,local_freedom) += temp;
3417 const unsigned n_vec = C.
nrow();
3418 for(
unsigned i=0;
i<n_dof;
i++)
3420 for(
unsigned k=0;k<n_dof;k++)
3423 const double j_y = jac_y(
i,k);
3425 for(
unsigned v=0;v<n_vec;v++)
3427 product(v,
i) += j_y*C(v,k);
3447 std::list<std::pair<unsigned long,unsigned> >& dof_lookup_list)
const 3450 unsigned n_node = this->
nnode();
3456 std::pair<unsigned,unsigned> dof_lookup;
3459 unsigned pressure_dof_number = 3;
3462 for (
unsigned n = 0; n < n_press; n++)
3470 if (local_eqn_number >= 0)
3474 dof_lookup.first = this->
eqn_number(local_eqn_number);
3475 dof_lookup.second = pressure_dof_number;
3478 dof_lookup_list.push_front(dof_lookup);
3483 for (
unsigned n = 0; n < n_node; n++)
3489 for (
unsigned v = 0; v < nv; v++)
3495 if (local_eqn_number >= 0)
3499 dof_lookup.first = this->
eqn_number(local_eqn_number);
3500 dof_lookup.second = v;
3503 dof_lookup_list.push_front(dof_lookup);
3549 std::list<std::pair<
unsigned long,
3550 unsigned> >& dof_lookup_list)
const 3553 unsigned n_node = this->
nnode();
3556 std::pair<unsigned,unsigned> dof_lookup;
3559 for (
unsigned n = 0; n < n_node; n++)
3565 for (
unsigned v = 0; v < nv; v++)
3573 if (local_eqn_number >= 0)
3577 dof_lookup.first = this->
eqn_number(local_eqn_number);
3580 dof_lookup.second = v;
3583 dof_lookup_list.push_front(dof_lookup);
virtual void pshape_axi_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction") ...
double *& re_invro_pt()
Pointer to global inverse Froude number.
double *& re_invfr_pt()
Pointer to global inverse Froude number.
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.
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...
unsigned long nrow() const
Return the number of rows of the matrix.
static int Pressure_not_stored_at_node
Static "magic" number that indicates that the pressure is not stored at a node.
unsigned long ncol() const
Return the number of columns of the matrix.
double get_source_fct(const double &time, const unsigned &ipt, const Vector< double > &x)
Calculate the source fct at given time and Eulerian position.
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...
const double & viscosity_ratio() const
Viscosity ratio for element: Element's viscosity relative to the viscosity used in the definition of ...
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
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...
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 ...
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 fl...
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...
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...
void perform_auxiliary_node_update_fct()
Execute auxiliary update function (if any) – this can be used to update any nodal values following t...
static double Default_Physical_Ratio_Value
Static default value for the physical ratios (all are initialised to one)
virtual void get_source_fct_gradient(const double &time, const unsigned &ipt, const Vector< double > &x, Vector< double > &gradient)
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. Function prints as many components as are returned in solution Vector.
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Function pointer for function that computes Vector-valued time-dependent function as ...
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when the time-derivatives are computed...
TimeStepper *& position_time_stepper_pt()
Return a pointer to the position timestepper.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
static const unsigned Pconv[]
Static array of ints to hold conversion from pressure node numbers to actual node numbers...
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_invro() const
Global Reynolds number multiplied by inverse Rossby number.
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Strain-rate tensor: where (in that order)
static const unsigned Initial_Nvalue[]
Static array of ints to hold number of variables at node.
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...
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
const double & density_ratio() const
Density ratio for element: Element's density relative to the viscosity used in the definition of the ...
double kin_energy() const
Get integral of kinetic energy over element.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
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.
double pressure_integral() const
Integral of pressure over element.
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction") ...
static const unsigned Initial_Nvalue[]
Static array of ints to hold required number of variables at nodes.
const double & re() const
Reynolds number.
bool has_auxiliary_node_update_fct_pt()
Boolean to indicate if node has a pointer to and auxiliary update function.
unsigned ndof() const
Return the number of equations/dofs in the element.
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.
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley 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 unsigned u_index_axi_nst(const unsigned &i) const
Return the index at which the i-th unknown velocity component.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Function pointer for function that computes vector-valued steady "exact solution" as ...
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
const Vector< double > & g() const
Vector of gravitational components.
virtual unsigned npres_axi_nst() const =0
Function to return number of pressure degrees of freedom.
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...
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
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. Plot at a given number of plot points and compute L2 error and L2 norm of velocity solution over element.
virtual void shape_at_knot(const unsigned &ipt, Shape &psi) const
Return the geometric shape function at the ipt-th integration point.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
double * Re_pt
Pointer to global Reynolds number.
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"...
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number...
virtual void get_dresidual_dnodal_coordinates(RankThreeTensor< double > &dresidual_dnodal_coordinates)
Compute derivatives of elemental residual vector with respect to nodal coordinates. This function computes these terms analytically and overwrites the default implementation in the FiniteElement base class. dresidual_dnodal_coordinates(l,i,j) = d res(l) / dX_{ij}.
double & time()
Return the current value of the continuous time.
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...
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...
void interpolated_u_axi_nst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
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. NOTE: Moved to cc file because of a possible compiler bug in gcc (yes, really!). The move to the cc file avoids inlining which appears to cause problems (only) when compiled with gcc and -O3; offensive "illegal read" is in optimised-out section of code and data that is allegedly illegal is readily readable (by other means) just before this function is called so I can't really see how we could possibly be responsible for this...
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.
double *& re_pt()
Pointer to Reynolds number.
void output(std::ostream &outfile)
Output function: x,y,[z],u,v,[w],p in tecplot format. Default number of plot points.
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 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...
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
Time *const & time_pt() const
Access function for the pointer to time (const version)
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
double dissipation() const
Return integral of dissipation over element.
double interpolated_p_axi_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
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 unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at local node n.
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...
const double & re_invfr() const
Global inverse Froude 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...
int local_eqn_number(const unsigned long &ieqn_global) const
Return the local equation number corresponding to the ieqn_global-th global equation number...
unsigned nnode() const
Return the number of nodes.
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...
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
static double Default_fd_jacobian_step
Double used for the default finite difference step in elemental jacobian calculations.
virtual double J_eulerian(const Vector< double > &s) const
Return the Jacobian of mapping from local to global coordinates at local position s...
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...
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...
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...
static double Default_Physical_Constant_Value
Static default value for the physical constants (all initialised to zero)