53 unsigned n_node =
nnode();
62 unsigned u_nodal_index[3];
71 bool pressure_dof_is_hanging[n_pres];
76 for(
unsigned l=0;l<n_pres;++l)
78 pressure_dof_is_hanging[l] =
85 for(
unsigned l=0;l<n_pres;++l)
86 {pressure_dof_is_hanging[l] =
false;}
91 Shape psif(n_node), testf(n_node);
92 DShape dpsifdx(n_node,DIM), dtestfdx(n_node,DIM);
96 Shape psip(n_pres), testp(n_pres);
116 int local_eqn=0, local_unknown=0;
119 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
122 for(
unsigned ipt=0;ipt<Nintpt;ipt++)
143 double interpolated_p=0.0;
151 for(
unsigned l=0;l<n_pres;l++) {interpolated_p +=
p_axi_nst(l)*psip[l];}
157 for(
unsigned l=0;l<n_node;l++)
160 const double psif_ = psif(l);
162 for(
unsigned i=0;
i<DIM;
i++)
168 for(
unsigned i=0;
i<DIM+1;
i++)
171 interpolated_u[
i] += u_value*psif_;
174 for(
unsigned j=0;j<DIM;j++)
176 interpolated_dudx(i,j) += u_value*dpsifdx(l,j);
185 for(
unsigned l=0;l<n_node;l++)
188 for(
unsigned i=0;
i<2;
i++)
204 double r = interpolated_x[0];
209 unsigned n_master=1;
double hang_weight=1.0;
213 for(
unsigned l=0;l<n_node;l++)
224 n_master = hang_info_pt->
nmaster();
233 for(
unsigned m=0;m<n_master;m++)
236 for(
unsigned i=0;
i<DIM+1;
i++)
269 r*body_force[0]*testf[l]*W*hang_weight;
272 sum += r*scaled_re_inv_fr*testf[l]*G[0]*W*hang_weight;
276 interpolated_p*(testf[l] + r*dtestfdx(l,0))*W*hang_weight;
283 r*(1.0+
Gamma[0])*interpolated_dudx(0,0)*dtestfdx(l,0)*W
287 (interpolated_dudx(0,1) +
Gamma[0]*interpolated_dudx(1,0))*
288 dtestfdx(l,1)*W*hang_weight;
291 visc_ratio*(1.0 +
Gamma[0])*interpolated_u[0]
292 *testf[l]*W*hang_weight/r;
296 sum -= scaled_re_st*r*dudt[0]*testf[l]*W*hang_weight;
300 scaled_re*(r*interpolated_u[0]*interpolated_dudx(0,0)
301 - interpolated_u[2]*interpolated_u[2]
302 + r*interpolated_u[1]*interpolated_dudx(0,1))*testf[l]*W*
308 for(
unsigned k=0;k<2;k++)
311 scaled_re_st*r*mesh_veloc[k]*interpolated_dudx(0,k)*testf[l]*W*
318 2.0*r*scaled_re_inv_ro*interpolated_u[2]*testf[l]*W*hang_weight;
327 sum += r*body_force[1]*testf[l]*W*hang_weight;
330 sum += r*scaled_re_inv_fr*testf[l]*G[1]*W*hang_weight;
333 sum += r*interpolated_p*dtestfdx(l,1)*W*hang_weight;
340 r*(interpolated_dudx(1,0) +
341 Gamma[1]*interpolated_dudx(0,1))*dtestfdx(l,0)*W*
345 (1.0 +
Gamma[1])*interpolated_dudx(1,1)*dtestfdx(l,1)*W*
350 sum -= scaled_re_st*r*dudt[1]*testf[l]*W*hang_weight;
354 scaled_re*(r*interpolated_u[0]*interpolated_dudx(1,0)
355 + r*interpolated_u[1]*interpolated_dudx(1,1))*
356 testf[l]*W*hang_weight;
361 for(
unsigned k=0;k<2;k++)
364 scaled_re_st*r*mesh_veloc[k]*interpolated_dudx(1,k)*testf[l]*W
374 sum += r*body_force[2]*testf[l]*W*hang_weight;
377 sum += r*scaled_re_inv_fr*testf[l]*G[2]*W*hang_weight;
386 (r*interpolated_dudx(2,0) -
Gamma[0]*interpolated_u[2])
387 *dtestfdx(l,0)*W*hang_weight;
389 sum -= visc_ratio*r*interpolated_dudx(2,1)*
390 dtestfdx(l,1)*W*hang_weight;
393 ((interpolated_u[2]/r) -
Gamma[0]*interpolated_dudx(2,0))*
394 testf[l]*W*hang_weight;
399 sum -= scaled_re_st*r*dudt[2]*testf[l]*W*hang_weight;
403 scaled_re*(r*interpolated_u[0]*interpolated_dudx(2,0)
404 + interpolated_u[0]*interpolated_u[2]
405 + r*interpolated_u[1]*interpolated_dudx(2,1))*testf[l]*W
411 for(
unsigned k=0;k<2;k++)
413 sum += scaled_re_st*r*mesh_veloc[k]*
414 interpolated_dudx(2,k)*testf[l]*W*hang_weight;
420 2.0*r*scaled_re_inv_ro*interpolated_u[0]*testf[l]*W*hang_weight;
426 residuals[local_eqn] += sum;
432 unsigned n_master2=1;
double hang_weight2=1.0;
434 for(
unsigned l2=0;l2<n_node;l2++)
444 n_master2 = hang_info2_pt->
nmaster();
453 for(
unsigned m2=0;m2<n_master2;m2++)
456 for(
unsigned i2=0;i2<DIM+1;i2++)
466 hang_weight2 = hang_info2_pt->master_weight(m2);
475 if(local_unknown >= 0)
490 mass_matrix(local_eqn,local_unknown) +=
491 scaled_re_st*r*psif[l2]*testf[l]*W
492 *hang_weight*hang_weight2;
496 jacobian(local_eqn,local_unknown)
497 -= visc_ratio*r*(1.0+
Gamma[0])
498 *dpsifdx(l2,0)*dtestfdx(l,0)*W*
499 hang_weight*hang_weight2;
501 jacobian(local_eqn,local_unknown)
502 -= visc_ratio*r*dpsifdx(l2,1)*
503 dtestfdx(l,1)*W*hang_weight*hang_weight2;
505 jacobian(local_eqn,local_unknown)
506 -= visc_ratio*(1.0 +
Gamma[0])*psif[l2]*
507 testf[l]*W*hang_weight*hang_weight2/r;
511 jacobian(local_eqn,local_unknown)
513 weight(1,0)*psif[l2]*testf[l]*W
514 *hang_weight*hang_weight2;
517 jacobian(local_eqn,local_unknown) -=
518 scaled_re*(r*psif[l2]*interpolated_dudx(0,0)
519 + r*interpolated_u[0]*dpsifdx(l2,0)
520 + r*interpolated_u[1]*dpsifdx(l2,1))
521 *testf[l]*W*hang_weight*hang_weight2;
526 for(
unsigned k=0;k<2;k++)
528 jacobian(local_eqn,local_unknown)
529 += scaled_re_st*r*mesh_veloc[k]*dpsifdx(l2,k)
530 *testf[l]*W*hang_weight*hang_weight2;
537 jacobian(local_eqn,local_unknown) -=
538 visc_ratio*r*
Gamma[0]*dpsifdx(l2,0)
539 *dtestfdx(l,1)*W*hang_weight*hang_weight2;
542 jacobian(local_eqn,local_unknown) -=
543 scaled_re*r*psif[l2]*interpolated_dudx(0,1)*
544 testf[l]*W*hang_weight*hang_weight2;
550 jacobian(local_eqn,local_unknown) -=
551 - scaled_re*2.0*interpolated_u[2]*psif[l2]
552 *testf[l]*W*hang_weight*hang_weight2;
555 jacobian(local_eqn,local_unknown) +=
556 2.0*r*scaled_re_inv_ro*psif[l2]*testf[l]*W
557 *hang_weight*hang_weight2;
573 jacobian(local_eqn,local_unknown) -=
574 visc_ratio*r*
Gamma[1]*dpsifdx(l2,1)*
575 dtestfdx(l,0)*W*hang_weight*hang_weight2;
578 jacobian(local_eqn,local_unknown) -=
579 scaled_re*r*psif[l2]*interpolated_dudx(1,0)*testf[l]*W
580 *hang_weight*hang_weight2;
589 mass_matrix(local_eqn,local_unknown) +=
590 scaled_re_st*r*psif[l2]*testf[l]*W
591 *hang_weight*hang_weight2;
598 jacobian(local_eqn,local_unknown) -=
599 visc_ratio*r*dpsifdx(l2,0)*dtestfdx(l,0)*W
600 *hang_weight*hang_weight2;
602 jacobian(local_eqn,local_unknown) -=
603 visc_ratio*r*(1.0 +
Gamma[1])*dpsifdx(l2,1)*
604 dtestfdx(l,1)*W*hang_weight*hang_weight2;
608 jacobian(local_eqn,local_unknown) -=
610 weight(1,0)*psif[l2]*testf[l]*W
611 *hang_weight*hang_weight2;
614 jacobian(local_eqn,local_unknown) -=
615 scaled_re*(r*interpolated_u[0]*dpsifdx(l2,0)
616 + r*psif[l2]*interpolated_dudx(1,1)
617 + r*interpolated_u[1]*dpsifdx(l2,1))
618 *testf[l]*W*hang_weight*hang_weight2;
623 for(
unsigned k=0;k<2;k++)
625 jacobian(local_eqn,local_unknown)
626 += scaled_re_st*r*mesh_veloc[k]*dpsifdx(l2,k)
627 *testf[l]*W*hang_weight*hang_weight2;
647 jacobian(local_eqn,local_unknown) -=
648 scaled_re*(r*psif[l2]*interpolated_dudx(2,0)
649 + psif[l2]*interpolated_u[2])*testf[l]
650 *W*hang_weight*hang_weight2;
653 jacobian(local_eqn,local_unknown) -=
654 2.0*r*scaled_re_inv_ro*psif[l2]*testf[l]*W
655 *hang_weight*hang_weight2;
662 jacobian(local_eqn,local_unknown) -=
663 scaled_re*r*psif[l2]*interpolated_dudx(2,1)*testf[l]
664 *W*hang_weight*hang_weight2;
673 mass_matrix(local_eqn,local_unknown) +=
674 scaled_re_st*r*psif[l2]*testf[l]*W
675 *hang_weight*hang_weight2;
682 jacobian(local_eqn,local_unknown) -=
684 (r*dpsifdx(l2,0) -
Gamma[0]*psif[l2])
685 *dtestfdx(l,0)*W*hang_weight*hang_weight2;
687 jacobian(local_eqn,local_unknown) -=
688 visc_ratio*r*dpsifdx(l2,1)*dtestfdx(l,1)
689 *W*hang_weight*hang_weight2;
691 jacobian(local_eqn,local_unknown) -=
693 ((psif[l2]/r) -
Gamma[0]*dpsifdx(l2,0))
694 *testf[l]*W*hang_weight*hang_weight2;
698 jacobian(local_eqn,local_unknown) -=
701 psif[l2]*testf[l]*W*hang_weight*hang_weight2;
704 jacobian(local_eqn,local_unknown) -=
705 scaled_re*(r*interpolated_u[0]*dpsifdx(l2,0)
706 + interpolated_u[0]*psif[l2]
707 + r*interpolated_u[1]*dpsifdx(l2,1))
708 *testf[l]*W*hang_weight*hang_weight2;
713 for(
unsigned k=0;k<2;k++)
715 jacobian(local_eqn,local_unknown)
716 += scaled_re_st*r*mesh_veloc[k]*dpsifdx(l2,k)
717 *testf[l]*W*hang_weight*hang_weight2;
731 for(
unsigned l2=0;l2<n_pres;l2++)
734 if(pressure_dof_is_hanging[l2])
741 n_master2 = hang_info2_pt->
nmaster();
750 for(
unsigned m2=0;m2<n_master2;m2++)
754 if(pressure_dof_is_hanging[l2])
761 hang_weight2 = hang_info2_pt->master_weight(m2);
770 if(local_unknown >= 0)
777 jacobian(local_eqn,local_unknown)
778 += psip[l2]*(testf[l] + r*dtestfdx(l,0))*W*
779 hang_weight*hang_weight2;
784 jacobian(local_eqn,local_unknown)
785 += r*psip[l2]*dtestfdx(l,1)*W*hang_weight*hang_weight2;
806 for(
unsigned l=0;l<n_pres;l++)
809 if(pressure_dof_is_hanging[l])
814 n_master = hang_info_pt->
nmaster();
823 for(
unsigned m=0;m<n_master;m++)
827 if(pressure_dof_is_hanging[l])
842 residuals[local_eqn] -= r*source*testp[l]*W*hang_weight;
845 residuals[local_eqn] +=
846 (interpolated_u[0] + r*interpolated_dudx(0,0)
847 + r*interpolated_dudx(1,1))*testp[l]*W*hang_weight;
853 unsigned n_master2=1;
double hang_weight2=1.0;
855 for(
unsigned l2=0;l2<n_node;l2++)
865 n_master2 = hang_info2_pt->
nmaster();
874 for(
unsigned m2=0;m2<n_master2;m2++)
877 for(
unsigned i2=0;i2<DIM+1;i2++)
887 hang_weight2 = hang_info2_pt->master_weight(m2);
896 if(local_unknown >= 0)
902 jacobian(local_eqn,local_unknown) +=
903 (psif[l2] + r*dpsifdx(l2,0))*testp[l]*W*
904 hang_weight*hang_weight2;
909 jacobian(local_eqn,local_unknown) +=
910 r*dpsifdx(l2,1)*testp[l]*W*hang_weight*hang_weight2;
945 std::string warning_message =
"This function has not been tested.\n";
946 std::string function =
"RefineableAxisymmetricNavierStokesEquations::\n";
947 function +=
"get_dresidual_dnodal_coordinates(...)";
951 if(
ndof()==0) {
return; }
954 const unsigned n_node =
nnode();
963 unsigned u_nodal_index[3];
972 bool pressure_dof_is_hanging[n_pres];
978 for(
unsigned l=0;l<n_pres;++l)
980 pressure_dof_is_hanging[l] =
987 for(
unsigned l=0;l<n_pres;++l) { pressure_dof_is_hanging[l] =
false; }
992 Shape psif(n_node), testf(n_node);
993 DShape dpsifdx(n_node,2), dtestfdx(n_node,2);
996 Shape psip(n_pres), testp(n_pres);
1045 bool element_has_node_with_aux_node_update_fct=
false;
1047 std::map<Node*,unsigned> local_shape_controlling_node_lookup=
1051 for(std::map<Node*,unsigned>::iterator it=
1052 local_shape_controlling_node_lookup.begin();
1053 it!=local_shape_controlling_node_lookup.end();
1057 Node* nod_pt=it->first;
1060 unsigned q=it->second;
1065 element_has_node_with_aux_node_update_fct=
true;
1069 std::ostringstream warning_stream;
1070 warning_stream <<
"\nThe functionality to evaluate the additional" 1071 <<
"\ncontribution to the deriv of the residual eqn" 1072 <<
"\nw.r.t. the nodal coordinates which comes about" 1073 <<
"\nif a node's values are updated using an auxiliary" 1074 <<
"\nnode update function has NOT been tested for" 1075 <<
"\nrefineable axisymmetric Navier-Stokes elements." 1076 <<
"\nUse at your own risk" 1079 warning_stream.str(),
1080 "RefineableAxisymmetricNavierStokesEquations::get_dresidual_dnodal_coordinates",
1081 OOMPH_EXCEPTION_LOCATION);
1085 for(
unsigned i=0;
i<3;
i++)
1087 u_ref[
i]=*(nod_pt->
value_pt(u_nodal_index[
i]));
1091 for(
unsigned p=0;p<2;p++)
1094 double backup=nod_pt->
x(p);
1098 nod_pt->
x(p)+=eps_fd;
1104 for(
unsigned i=0;
i<3;
i++)
1107 d_U_dX(p,q,
i)=(*(nod_pt->
value_pt(u_nodal_index[p]))-u_ref[p])/eps_fd;
1111 nod_pt->
x(p)=backup;
1126 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
1136 ipt,psif,dpsifdx,d_dpsifdx_dX,testf,dtestfdx,d_dtestfdx_dX,dJ_dX);
1148 double interpolated_p=0.0;
1154 for(
unsigned l=0;l<n_pres;l++)
1156 interpolated_p += this->
p_axi_nst(l)*psip[l];
1163 for(
unsigned l=0;l<n_node;l++)
1166 const double psif_ = psif(l);
1169 for(
unsigned i=0;
i<2;
i++)
1175 for(
unsigned i=0;
i<3;
i++)
1178 const double u_value =
nodal_value(l,u_nodal_index[
i]);
1179 interpolated_u[
i] += u_value*psif_;
1183 for(
unsigned j=0;j<2;j++)
1185 interpolated_dudx(i,j) += u_value*dpsifdx(l,j);
1194 for(
unsigned l=0;l<n_node;l++)
1197 for(
unsigned i=0;
i<2;
i++)
1207 for(
unsigned q=0;q<n_shape_controlling_node;q++)
1210 for(
unsigned p=0;p<2;p++)
1213 for(
unsigned i=0;
i<3;
i++)
1216 for(
unsigned k=0;k<2;k++)
1221 for(
unsigned j=0;j<n_node;j++)
1223 aux +=
nodal_value(j,u_nodal_index[
i])*d_dpsifdx_dX(p,q,j,k);
1225 d_dudx_dX(p,q,
i,k) = aux;
1233 const double pos_time_weight
1242 const double source = this->
get_source_fct(time,ipt,interpolated_x);
1255 const double r = interpolated_x[0];
1265 unsigned n_master=1;
double hang_weight=1.0;
1268 for(
unsigned l=0;l<n_node;l++)
1271 const double testf_ = testf[l];
1282 n_master = hang_info_pt->
nmaster();
1291 for(
unsigned m=0;m<n_master;m++)
1322 for(
unsigned p=0;p<2;p++)
1325 for(
unsigned q=0;q<n_shape_controlling_node;q++)
1332 double sum = r*body_force[0]*testf_;
1335 sum += r*scaled_re_inv_fr*testf_*G[0];
1338 sum += interpolated_p*(testf_ + r*dtestfdx(l,0));
1345 r*(1.0+
Gamma[0])*interpolated_dudx(0,0)*dtestfdx(l,0);
1347 sum -= visc_ratio*r*
1348 (interpolated_dudx(0,1) +
Gamma[0]*interpolated_dudx(1,0))*
1351 sum -= visc_ratio*(1.0 +
Gamma[0])*interpolated_u[0]*testf_/r;
1354 sum -= scaled_re_st*r*dudt[0]*testf_;
1358 scaled_re*(r*interpolated_u[0]*interpolated_dudx(0,0)
1359 - interpolated_u[2]*interpolated_u[2]
1360 + r*interpolated_u[1]*interpolated_dudx(0,1))*testf_;
1365 for(
unsigned k=0;k<2;k++)
1367 sum += scaled_re_st*r*mesh_velocity[k]
1368 *interpolated_dudx(0,k)*testf_;
1373 sum += 2.0*r*scaled_re_inv_ro*interpolated_u[2]*testf_;
1376 dresidual_dnodal_coordinates(local_eqn,p,q)
1377 += sum*dJ_dX(p,q)*w*hang_weight;
1383 sum = r*d_body_force_dx(0,p)*psif[q]*testf_;
1384 if(p==0) { sum += body_force[0]*psif[q]*testf_; }
1387 if(p==0) { sum += scaled_re_inv_fr*G[0]*psif[q]*testf_; }
1390 sum += r*interpolated_p*d_dtestfdx_dX(p,q,l,0);
1391 if(p==0) { sum += interpolated_p*psif[q]*dtestfdx(l,0); }
1394 sum -= r*visc_ratio*(
1396 d_dudx_dX(p,q,0,0)*dtestfdx(l,0)
1397 + interpolated_dudx(0,0)*d_dtestfdx_dX(p,q,l,0))
1398 + (d_dudx_dX(p,q,0,1)
1399 +
Gamma[0]*d_dudx_dX(p,q,1,0))*dtestfdx(l,1)
1400 + (interpolated_dudx(0,1)
1401 +
Gamma[0]*interpolated_dudx(1,0))
1402 *d_dtestfdx_dX(p,q,l,1));
1407 interpolated_dudx(0,0)*psif[q]*dtestfdx(l,0)
1408 - interpolated_u[0]*psif[q]*testf_/(r*r))
1409 + (interpolated_dudx(0,1)
1410 +
Gamma[0]*interpolated_dudx(1,0))*psif[q]*dtestfdx(l,1));
1414 for(
unsigned k=0;k<2;k++)
1416 double tmp = scaled_re*interpolated_u[k];
1418 sum -= r*tmp*d_dudx_dX(p,q,0,k)*testf_;
1419 if(p==0) { sum -= tmp*interpolated_dudx(0,k)*psif[q]*testf_; }
1423 sum += scaled_re_st*r*pos_time_weight*interpolated_dudx(0,p)
1428 if(p==0) { sum -= scaled_re_st*dudt[0]*psif[q]*testf_; }
1433 sum += 2.0*scaled_re_inv_ro*interpolated_u[2]*psif[q]*testf_;
1437 dresidual_dnodal_coordinates(local_eqn,p,q)
1438 += sum*J*w*hang_weight;
1445 if(element_has_node_with_aux_node_update_fct)
1448 for (
unsigned q_local=0;q_local<n_node;q_local++)
1452 unsigned n_master2=1;
1453 double hang_weight2=1.0;
1459 Node* actual_shape_controlling_node_pt=
node_pt(q_local);
1462 if(is_node_hanging2)
1467 n_master2 = hang_info2_pt->
nmaster();
1476 for(
unsigned mm=0;mm<n_master2;mm++)
1478 if(is_node_hanging2)
1480 actual_shape_controlling_node_pt=
1486 unsigned q=local_shape_controlling_node_lookup[
1487 actual_shape_controlling_node_pt];
1490 for(
unsigned p=0;p<2;p++)
1493 double tmp = scaled_re_st*r*val_time_weight
1494 *psif[q_local]*testf_;
1495 tmp += r*scaled_re*interpolated_dudx(0,0)
1496 *psif[q_local]*testf_;
1498 for(
unsigned k=0;k<2;k++)
1500 double tmp2 = scaled_re*interpolated_u[k];
1503 tmp2 -= scaled_re_st*mesh_velocity[k];
1505 tmp += r*tmp2*dpsifdx(q_local,k)*testf_;
1508 tmp += r*visc_ratio*(1.0+
Gamma[0])*dpsifdx(q_local,0)
1510 tmp += r*visc_ratio*dpsifdx(q_local,1)*dtestfdx(l,1);
1511 tmp += visc_ratio*(1.0+
Gamma[0])*psif[q_local]*testf_/r;
1514 double sum = -d_U_dX(p,q_local,0)*tmp;
1517 tmp = scaled_re*r*interpolated_dudx(0,1)*psif[q_local]*testf_;
1518 tmp += r*visc_ratio*
Gamma[0]*dpsifdx(q_local,0)*dtestfdx(l,1);
1521 sum -= d_U_dX(p,q,1)*tmp;
1524 tmp = 2.0*(r*scaled_re_inv_ro + scaled_re*interpolated_u[2])
1525 *psif[q_local]*testf_;
1528 sum += d_U_dX(p,q,2)*tmp;
1531 dresidual_dnodal_coordinates(local_eqn,p,q) +=
1532 sum*J*w*hang_weight*hang_weight2;
1567 for(
unsigned p=0;p<2;p++)
1570 for(
unsigned q=0;q<n_shape_controlling_node;q++)
1577 double sum = r*body_force[1]*testf_;
1580 sum += r*scaled_re_inv_fr*testf_*G[1];
1583 sum += r*interpolated_p*dtestfdx(l,1);
1590 r*(interpolated_dudx(1,0) +
Gamma[1]*interpolated_dudx(0,1))
1593 sum -= visc_ratio*r*
1594 (1.0 +
Gamma[1])*interpolated_dudx(1,1)*dtestfdx(l,1);
1597 sum -= scaled_re_st*r*dudt[1]*testf_;
1601 scaled_re*(r*interpolated_u[0]*interpolated_dudx(1,0)
1602 + r*interpolated_u[1]*interpolated_dudx(1,1))*testf_;
1607 for(
unsigned k=0;k<2;k++)
1609 sum += scaled_re_st*r*mesh_velocity[k]
1610 *interpolated_dudx(1,k)*testf_;
1615 dresidual_dnodal_coordinates(local_eqn,p,q)
1616 += sum*dJ_dX(p,q)*w*hang_weight;
1622 sum = r*d_body_force_dx(1,p)*psif[q]*testf_;
1623 if(p==0) { sum += body_force[1]*psif[q]*testf_; }
1626 if(p==0) { sum += scaled_re_inv_fr*G[1]*psif[q]*testf_; }
1629 sum += r*interpolated_p*d_dtestfdx_dX(p,q,l,1);
1630 if(p==0) { sum += interpolated_p*psif[q]*dtestfdx(l,1); }
1633 sum -= r*visc_ratio*(
1634 (d_dudx_dX(p,q,1,0) +
Gamma[1]*d_dudx_dX(p,q,0,1))*dtestfdx(l,0)
1635 + (interpolated_dudx(1,0)
1636 +
Gamma[1]*interpolated_dudx(0,1))*d_dtestfdx_dX(p,q,l,0)
1637 + (1.0+
Gamma[1])*d_dudx_dX(p,q,1,1)*dtestfdx(l,1)
1638 + (1.0+
Gamma[1])*interpolated_dudx(1,1)*d_dtestfdx_dX(p,q,l,1));
1642 (interpolated_dudx(1,0)
1643 +
Gamma[1]*interpolated_dudx(0,1))*psif[q]*dtestfdx(l,0)
1644 + (1.0+
Gamma[1])*interpolated_dudx(1,1)*psif[q]*dtestfdx(l,1));
1648 for(
unsigned k=0;k<2;k++)
1650 double tmp = scaled_re*interpolated_u[k];
1652 sum -= r*tmp*d_dudx_dX(p,q,1,k)*testf_;
1653 if(p==0) { sum -= tmp*interpolated_dudx(1,k)*psif[q]*testf_; }
1657 sum += scaled_re_st*r*pos_time_weight*interpolated_dudx(1,p)
1662 if(p==0) { sum -= scaled_re_st*dudt[1]*psif[q]*testf_; }
1665 dresidual_dnodal_coordinates(local_eqn,p,q)
1666 += sum*J*w*hang_weight;
1673 if(element_has_node_with_aux_node_update_fct)
1676 for (
unsigned q_local=0;q_local<n_node;q_local++)
1680 unsigned n_master2=1;
1681 double hang_weight2=1.0;
1687 Node* actual_shape_controlling_node_pt=
node_pt(q_local);
1690 if(is_node_hanging2)
1695 n_master2 = hang_info2_pt->
nmaster();
1704 for(
unsigned mm=0;mm<n_master2;mm++)
1706 if(is_node_hanging2)
1708 actual_shape_controlling_node_pt=
1714 unsigned q=local_shape_controlling_node_lookup[
1715 actual_shape_controlling_node_pt];
1718 for(
unsigned p=0;p<2;p++)
1721 double tmp = scaled_re*r*interpolated_dudx(1,0)
1722 *psif[q_local]*testf_;
1723 tmp += r*visc_ratio*
Gamma[1]*dpsifdx(q_local,1)*dtestfdx(l,0);
1726 double sum = -d_U_dX(p,q,0)*tmp;
1729 tmp = scaled_re_st*r*val_time_weight*psif[q_local]*testf_;
1730 tmp += r*scaled_re*interpolated_dudx(1,1)
1731 *psif[q_local]*testf_;
1733 for(
unsigned k=0;k<2;k++)
1735 double tmp2 = scaled_re*interpolated_u[k];
1738 tmp2 -= scaled_re_st*mesh_velocity[k];
1740 tmp += r*tmp2*dpsifdx(q_local,k)*testf_;
1742 tmp += r*visc_ratio*(dpsifdx(q_local,0)*dtestfdx(l,0)
1743 + (1.0+
Gamma[1])*dpsifdx(q_local,1)
1747 sum -= d_U_dX(p,q,1)*tmp;
1750 dresidual_dnodal_coordinates(local_eqn,p,q) +=
1751 sum*J*w*hang_weight*hang_weight2;
1786 for(
unsigned p=0;p<2;p++)
1789 for(
unsigned q=0;q<n_shape_controlling_node;q++)
1796 double sum = r*body_force[2]*testf_;
1799 sum += r*scaled_re_inv_fr*testf_*G[2];
1807 sum -= visc_ratio*(r*interpolated_dudx(2,0) -
1808 Gamma[0]*interpolated_u[2])*dtestfdx(l,0);
1810 sum -= visc_ratio*r*interpolated_dudx(2,1)*dtestfdx(l,1);
1812 sum -= visc_ratio*((interpolated_u[2]/r)
1813 -
Gamma[0]*interpolated_dudx(2,0))*testf_;
1816 sum -= scaled_re_st*r*dudt[2]*testf_;
1820 scaled_re*(r*interpolated_u[0]*interpolated_dudx(2,0)
1821 + interpolated_u[0]*interpolated_u[2]
1822 + r*interpolated_u[1]*interpolated_dudx(2,1))*testf_;
1827 for(
unsigned k=0;k<2;k++)
1829 sum += scaled_re_st*r*mesh_velocity[k]
1830 *interpolated_dudx(2,k)*testf_;
1835 sum -= 2.0*r*scaled_re_inv_ro*interpolated_u[0]*testf_;
1838 dresidual_dnodal_coordinates(local_eqn,p,q)
1839 += sum*dJ_dX(p,q)*w*hang_weight;
1845 sum = r*d_body_force_dx(2,p)*psif[q]*testf_;
1846 if(p==0) { sum += body_force[2]*psif[q]*testf_; }
1849 if(p==0) { sum += scaled_re_inv_fr*G[2]*psif[q]*testf_; }
1854 sum -= visc_ratio*r*(
1855 d_dudx_dX(p,q,2,0)*dtestfdx(l,0)
1856 + interpolated_dudx(2,0)*d_dtestfdx_dX(p,q,l,0)
1857 + d_dudx_dX(p,q,2,1)*dtestfdx(l,1)
1858 + interpolated_dudx(2,1)*d_dtestfdx_dX(p,q,l,1));
1860 sum += visc_ratio*
Gamma[0]*d_dudx_dX(p,q,2,0)*testf_;
1865 visc_ratio*(interpolated_dudx(2,0)*psif[q]*dtestfdx(l,0)
1866 + interpolated_dudx(2,1)*psif[q]*dtestfdx(l,1)
1867 + interpolated_u[2]*psif[q]*testf_/(r*r));
1871 for(
unsigned k=0;k<2;k++)
1873 double tmp = scaled_re*interpolated_u[k];
1875 sum -= r*tmp*d_dudx_dX(p,q,2,k)*testf_;
1876 if(p==0) { sum -= tmp*interpolated_dudx(2,k)*psif[q]*testf_; }
1880 sum += scaled_re_st*r*pos_time_weight*interpolated_dudx(2,p)
1885 if(p==0) { sum -= scaled_re_st*dudt[2]*psif[q]*testf_; }
1890 sum -= 2.0*scaled_re_inv_ro*interpolated_u[0]*psif[q]*testf_;
1894 dresidual_dnodal_coordinates(local_eqn,p,q)
1895 += sum*J*w*hang_weight;
1902 if(element_has_node_with_aux_node_update_fct)
1905 for (
unsigned q_local=0;q_local<n_node;q_local++)
1909 unsigned n_master2=1;
1910 double hang_weight2=1.0;
1916 Node* actual_shape_controlling_node_pt=
node_pt(q_local);
1919 if(is_node_hanging2)
1924 n_master2 = hang_info2_pt->
nmaster();
1933 for(
unsigned mm=0;mm<n_master2;mm++)
1935 if(is_node_hanging2)
1937 actual_shape_controlling_node_pt=
1943 unsigned q=local_shape_controlling_node_lookup[
1944 actual_shape_controlling_node_pt];
1947 for(
unsigned p=0;p<2;p++)
1950 double tmp = (2.0*r*scaled_re_inv_ro
1951 + r*scaled_re*interpolated_dudx(2,0)
1952 - scaled_re*interpolated_u[2])
1953 *psif[q_local]*testf_;
1956 double sum = -d_U_dX(p,q,0)*tmp;
1960 sum -= d_U_dX(p,q,1)*scaled_re*r*interpolated_dudx(2,1)
1961 *psif[q_local]*testf_;
1964 tmp = scaled_re_st*r*val_time_weight*psif[q_local]*testf_;
1965 tmp -= scaled_re*interpolated_u[0]*psif[q_local]*testf_;
1967 for(
unsigned k=0;k<2;k++)
1969 double tmp2 = scaled_re*interpolated_u[k];
1972 tmp2 -= scaled_re_st*mesh_velocity[k];
1974 tmp += r*tmp2*dpsifdx(q_local,k)*testf_;
1976 tmp += visc_ratio*(r*dpsifdx(q_local,0)
1977 -
Gamma[0]*psif[q_local])*dtestfdx(l,0);
1978 tmp += r*visc_ratio*dpsifdx(q_local,1)*dtestfdx(l,1);
1979 tmp += visc_ratio*((psif[q_local]/r)
1980 -
Gamma[0]*dpsifdx(q_local,0))*testf_;
1983 sum -= d_U_dX(p,q,2)*tmp;
1986 dresidual_dnodal_coordinates(local_eqn,p,q) +=
1987 sum*J*w*hang_weight*hang_weight2;
2002 for(
unsigned l=0;l<n_pres;l++)
2006 if(pressure_dof_is_hanging[l])
2013 n_master = hang_info_pt->
nmaster();
2022 for(
unsigned m=0;m<n_master;m++)
2026 if(pressure_dof_is_hanging[l])
2041 const double testp_ = testp[l];
2048 for(
unsigned p=0;p<2;p++)
2051 for(
unsigned q=0;q<n_shape_controlling_node;q++)
2058 double aux = -r*source;
2061 aux += (interpolated_u[0]
2062 + r*interpolated_dudx(0,0)
2063 + r*interpolated_dudx(1,1));
2066 dresidual_dnodal_coordinates(local_eqn,p,q)
2067 += aux*dJ_dX(p,q)*testp_*w*hang_weight;
2073 aux = -r*source_gradient[p]*psif[q];
2074 if(p==0) { aux -= source*psif[q]; }
2077 aux += r*(d_dudx_dX(p,q,0,0) + d_dudx_dX(p,q,1,1));
2080 aux += (interpolated_dudx(0,0)
2081 + interpolated_dudx(1,1))*psif[q];
2085 dresidual_dnodal_coordinates(local_eqn,p,q)
2086 += aux*testp_*J*w*hang_weight;
2092 if(element_has_node_with_aux_node_update_fct)
2095 for(
unsigned q_local=0;q_local<n_node;q_local++)
2099 unsigned n_master2=1;
2100 double hang_weight2=1.0;
2106 Node* actual_shape_controlling_node_pt=
node_pt(q_local);
2109 if(is_node_hanging2)
2114 n_master2 = hang_info2_pt->
nmaster();
2123 for(
unsigned mm=0;mm<n_master2;mm++)
2126 if(is_node_hanging2)
2128 actual_shape_controlling_node_pt=
2134 unsigned q=local_shape_controlling_node_lookup[
2135 actual_shape_controlling_node_pt];
2138 for(
unsigned p=0;p<2;p++)
2141 d_U_dX(p,q,0)*(psif[q_local] + r*dpsifdx(q_local,0))
2142 + d_U_dX(p,q,1)*r*dpsifdx(q_local,1);
2146 dresidual_dnodal_coordinates(local_eqn,p,q) +=
2147 aux*testp_*J*w*hang_weight*hang_weight2;
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)
int local_hang_eqn(Node *const &node_pt, const unsigned &i)
Access function that returns the local equation number for the hanging node variables (values stored ...
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.
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.
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 ...
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
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...
virtual void get_source_fct_gradient(const double &time, const unsigned &ipt, const Vector< double > &x, Vector< double > &gradient)
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.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
unsigned nmaster() const
Return the number of master nodes.
const double & re_invro() const
Global Reynolds number multiplied by inverse Rossby number.
bool is_hanging() const
Test whether the node is geometrically hanging.
const double & density_ratio() const
Density ratio for element: Element's density relative to the viscosity used in the definition of the ...
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
virtual Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure node (Default: NULL, indicating that pressure is not based on nodal interp...
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.
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.
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}.
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.
unsigned nshape_controlling_nodes()
Number of shape-controlling nodes = the number of non-hanging nodes plus the number of master nodes a...
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
double & time()
Return the current value of the continuous time.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master 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...
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...
Class that contains data for hanging nodes.
std::map< Node *, unsigned > shape_controlling_node_lookup()
Return lookup scheme for unique number associated with any of the nodes that actively control the sha...
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.
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
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.
const double & re_invfr() const
Global inverse Froude number.
virtual int p_nodal_index_axi_nst() const
Which nodal value represents the pressure?
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...
unsigned nnode() const
Return the number of nodes.
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.
void fill_in_generic_residual_contribution_axi_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add element's contribution to the elemental residual vector and/or Jacobian matrix and mass matrix fl...
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...