49 template<
unsigned DIM>
53 const unsigned& which_one)
57 unsigned n_dof=ndof();
59 if ((which_one==0)||(which_one==1)) press_mass_diag.assign(n_dof,0.0);
60 if ((which_one==0)||(which_one==2)) veloc_mass_diag.assign(n_dof,0.0);
67 double hang_weight=1.0;
70 unsigned n_node = nnode();
76 unsigned n_pres = this->npres_nst();
86 for(
unsigned i=0;
i<DIM;
i++)
88 u_nodal_index[
i] = this->u_index_nst(
i);
93 int p_index = this->p_nodal_index_nst();
97 bool pressure_dof_is_hanging[n_pres];
103 for(
unsigned l=0;l<n_pres;++l)
105 pressure_dof_is_hanging[l] =
106 pressure_node_pt(l)->is_hanging(p_index);
112 for(
unsigned l=0;l<n_pres;++l)
113 {pressure_dof_is_hanging[l] =
false;}
118 unsigned n_intpt = integral_pt()->nweight();
124 for(
unsigned ipt=0; ipt<n_intpt; ipt++)
128 double w = integral_pt()->weight(ipt);
131 double J = J_eulerian_at_knot(ipt);
134 for(
unsigned i=0;
i<DIM;
i++)
136 s[
i] = integral_pt()->knot(ipt,
i);
145 if ((which_one==0)||(which_one==2))
149 shape_at_knot(ipt,psi);
153 unsigned n_master=1;
double hang_weight=1.0;
157 for(
unsigned l=0;l<n_node;l++)
160 bool is_node_hanging = node_pt(l)->is_hanging();
165 hang_info_pt = node_pt(l)->hanging_pt();
168 n_master = hang_info_pt->
nmaster();
177 for(
unsigned m=0;m<n_master;m++)
180 for(
unsigned i=0;
i<DIM;
i++)
196 local_eqn = this->nodal_local_eqn(l,u_nodal_index[
i]);
221 veloc_mass_diag[local_eqn] += pow(psi[l]*hang_weight,2)*
W;
229 if ((which_one==0)||(which_one==1))
232 this->pshape_nst(s,psi_p);
235 for(
unsigned l=0;l<n_pres;l++)
238 if(pressure_dof_is_hanging[l])
242 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
245 n_master = hang_info_pt->
nmaster();
254 for(
unsigned m=0;m<n_master;m++)
258 if(pressure_dof_is_hanging[l])
268 local_eqn = this->p_local_eqn(l);
288 press_mass_diag[local_eqn] += pow(psi_p[l]*hang_weight,2) *
W;
304 template<
unsigned DIM>
312 if (ndof()==0)
return;
315 unsigned n_node = nnode();
318 unsigned n_pres = this->npres_nst();
321 unsigned u_nodal_index[DIM];
322 for(
unsigned i=0;
i<DIM;
i++) {u_nodal_index[
i] = this->u_index_nst(
i);}
327 int p_index = this->p_nodal_index_nst();
331 bool pressure_dof_is_hanging[n_pres];
336 for(
unsigned l=0;l<n_pres;++l)
338 pressure_dof_is_hanging[l] =
339 pressure_node_pt(l)->is_hanging(p_index);
347 "Pressure advection diffusion does not work in this case\n",
348 OOMPH_CURRENT_FUNCTION,
349 OOMPH_EXCEPTION_LOCATION);
351 for(
unsigned l=0;l<n_pres;++l)
352 {pressure_dof_is_hanging[l] =
false;}
357 DShape dpsidx(n_node,DIM);
360 Shape psip(n_pres), testp(n_pres);
362 DShape dtestp(n_pres,DIM);
365 unsigned n_intpt = integral_pt()->nweight();
372 double scaled_re = this->re()*this->density_ratio();
375 int local_eqn=0, local_unknown=0;
378 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
381 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
384 for(
unsigned i=0;
i<DIM;
i++) s[
i] = integral_pt()->knot(ipt,
i);
387 double w = integral_pt()->weight(ipt);
391 double J = this->dshape_eulerian_at_knot(ipt,psif,dpsidx);
394 this->dpshape_and_dptest_eulerian_nst(s,psip,dpsip,testp,dtestp);
406 for(
unsigned l=0;l<n_pres;l++)
408 for (
unsigned i=0;
i<DIM;
i++)
410 interpolated_dpdx[
i] += this->p_nst(l)*dpsip(l,
i);
417 for(
unsigned l=0;l<n_node;l++)
420 for(
unsigned i=0;
i<DIM;
i++)
423 double u_value = nodal_value(l,u_nodal_index[
i]);
424 interpolated_u[
i] += u_value*psif[l];
425 interpolated_x[
i] += nodal_position(l,i)*psif[l];
431 if (this->Press_adv_diff_source_fct_pt!=0)
433 source=this->Press_adv_diff_source_fct_pt(interpolated_x);
439 unsigned n_master=1;
double hang_weight=1.0;
443 for(
unsigned l=0;l<n_pres;l++)
446 if(pressure_dof_is_hanging[l])
450 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
453 n_master = hang_info_pt->
nmaster();
462 for(
unsigned m=0;m<n_master;m++)
466 if(pressure_dof_is_hanging[l])
476 local_eqn = this->p_local_eqn(l);
483 residuals[local_eqn] -= source*testp[l]*W*hang_weight;
484 for(
unsigned k=0;k<DIM;k++)
486 residuals[local_eqn] += interpolated_dpdx[k]*
487 (scaled_re*interpolated_u[k]*testp[l]+dtestp(l,k))*W*hang_weight;
494 unsigned n_master2=1;
double hang_weight2=1.0;
497 for(
unsigned l2=0;l2<n_pres;l2++)
500 if(pressure_dof_is_hanging[l2])
503 this->pressure_node_pt(l2)->hanging_pt(p_index);
506 n_master2 = hang_info2_pt->nmaster();
515 for(
unsigned m2=0;m2<n_master2;m2++)
519 if(pressure_dof_is_hanging[l2])
523 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
526 hang_weight2 = hang_info2_pt->master_weight(m2);
530 local_unknown = this->p_local_eqn(l2);
535 if(local_unknown >= 0)
538 if ((
int(eqn_number(local_eqn))!=
539 this->Pinned_fp_pressure_eqn)&&
540 (
int(eqn_number(local_unknown))!=
541 this->Pinned_fp_pressure_eqn))
543 for(
unsigned k=0;k<DIM;k++)
545 jacobian(local_eqn,local_unknown)+=dtestp(l2,k)*
546 (scaled_re*interpolated_u[k]*testp[l]+dtestp(l,k))*
547 W*hang_weight*hang_weight2;
552 if ((
int(eqn_number(local_eqn))==
553 this->Pinned_fp_pressure_eqn)&&
554 (int(eqn_number(local_unknown))
555 ==this->Pinned_fp_pressure_eqn))
557 jacobian(local_eqn,local_unknown)=1.0;
570 unsigned nrobin=this->Pressure_advection_diffusion_robin_element_pt.size();
571 for (
unsigned e=0;
e<nrobin;
e++)
573 this->Pressure_advection_diffusion_robin_element_pt[
e]->
574 fill_in_generic_residual_contribution_fp_press_adv_diff_robin_bc(
575 residuals,jacobian,flag);
588 template<
unsigned DIM>
596 unsigned n_node = nnode();
599 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
602 unsigned n_pres = this->npres_nst();
605 unsigned u_nodal_index[DIM];
606 for(
unsigned i=0;
i<DIM;
i++) {u_nodal_index[
i] = this->u_index_nst(
i);}
610 int p_index = this->p_nodal_index_nst();
614 bool pressure_dof_is_hanging[n_pres];
619 for(
unsigned l=0;l<n_pres;++l)
621 pressure_dof_is_hanging[l] =
622 pressure_node_pt(l)->is_hanging(p_index);
628 for(
unsigned l=0;l<n_pres;++l)
629 {pressure_dof_is_hanging[l] =
false;}
633 Shape psif(n_node), testf(n_node);
634 DShape dpsifdx(n_node,DIM), dtestfdx(n_node,DIM);
638 Shape psip(n_pres), testp(n_pres);
641 unsigned n_intpt = integral_pt()->nweight();
648 double scaled_re = this->re()*this->density_ratio();
649 double scaled_re_st = this->re_st()*this->density_ratio();
650 double scaled_re_inv_fr = this->re_invfr()*this->density_ratio();
651 double visc_ratio = this->viscosity_ratio();
655 int local_eqn=0, local_unknown=0;
658 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
664 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
668 for(
unsigned i=0;
i<DIM;
i++) {s[
i] = integral_pt()->knot(ipt,
i);}
671 double w = integral_pt()->weight(ipt);
675 this->dshape_and_dtest_eulerian_at_knot_nst(ipt,psif,dpsifdx,testf,dtestfdx);
678 this->pshape_nst(s,psip,testp);
685 double interpolated_p=0.0;
693 for(
unsigned l=0;l<n_pres;l++) {interpolated_p += this->p_nst(l)*psip[l];}
699 for(
unsigned l=0;l<n_node;l++)
702 for(
unsigned i=0;
i<DIM;
i++)
705 double u_value = this->nodal_value(l,u_nodal_index[
i]);
706 interpolated_u[
i] += u_value*psif[l];
707 interpolated_x[
i] += this->nodal_position(l,i)*psif[l];
708 dudt[
i] += this->du_dt_nst(l,i)*psif[l];
711 for(
unsigned j=0;j<DIM;j++)
713 interpolated_dudx(i,j) += u_value*dpsifdx(l,j);
718 if (!ALE_is_disabled_flag)
721 for(
unsigned l=0;l<n_node;l++)
724 for(
unsigned i=0;
i<DIM;
i++)
726 mesh_veloc[
i] += this->dnodal_position_dt(l,
i)*psif[l];
733 this->get_body_force_nst(time,ipt,s,interpolated_x,body_force);
736 double source = this->get_source_nst(time,ipt,interpolated_x);
742 unsigned n_master=1;
double hang_weight=1.0;
746 for(
unsigned l=0;l<n_node;l++)
749 bool is_node_hanging = node_pt(l)->is_hanging();
754 hang_info_pt = node_pt(l)->hanging_pt();
757 n_master = hang_info_pt->
nmaster();
766 for(
unsigned m=0;m<n_master;m++)
769 for(
unsigned i=0;
i<DIM;
i++)
785 local_eqn = this->nodal_local_eqn(l,u_nodal_index[
i]);
798 sum += body_force[
i];
801 sum += scaled_re_inv_fr*G[
i];
804 sum -= scaled_re_st*dudt[
i];
807 for(
unsigned k=0;k<DIM;k++)
809 double tmp=scaled_re*interpolated_u[k];
810 if (!ALE_is_disabled_flag)
811 {tmp -= scaled_re_st*mesh_veloc[k];}
812 sum -= tmp*interpolated_dudx(
i,k);
816 sum = (sum*testf[l] + interpolated_p*dtestfdx(l,
i))*W*hang_weight;
822 for(
unsigned k=0;k<DIM;k++)
825 (interpolated_dudx(
i,k) + this->Gamma[
i]*interpolated_dudx(k,
i))
826 *dtestfdx(l,k)*W*hang_weight;
830 residuals[local_eqn] += sum;
836 unsigned n_master2=1;
double hang_weight2=1.0;
838 for(
unsigned l2=0;l2<n_node;l2++)
841 bool is_node2_hanging = node_pt(l2)->is_hanging();
846 hang_info2_pt = node_pt(l2)->hanging_pt();
848 n_master2 = hang_info2_pt->nmaster();
857 for(
unsigned m2=0;m2<n_master2;m2++)
860 for(
unsigned i2=0;i2<DIM;i2++)
868 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
871 hang_weight2 = hang_info2_pt->master_weight(m2);
875 local_unknown = this->nodal_local_eqn(l2,u_nodal_index[i2]);
880 if(local_unknown >= 0)
883 jacobian(local_eqn,local_unknown)
884 -= visc_ratio*this->Gamma[
i]*dpsifdx(l2,
i)*
885 dtestfdx(l,i2)*W*hang_weight*hang_weight2;
888 jacobian(local_eqn,local_unknown)
889 -= scaled_re*psif[l2]*interpolated_dudx(
i,i2)*testf[l]*W*
890 hang_weight*hang_weight2;
900 mass_matrix(local_eqn,local_unknown) +=
901 scaled_re_st*psif[l2]*testf[l]*W*
902 hang_weight*hang_weight2;
906 jacobian(local_eqn,local_unknown)
908 node_pt(l2)->time_stepper_pt()->weight(1,0)*
909 psif[l2]*testf[l]*W*hang_weight*hang_weight2;
912 for(
unsigned k=0;k<DIM;k++)
914 double tmp=scaled_re*interpolated_u[k];
915 if (!ALE_is_disabled_flag)
916 {tmp -= scaled_re_st*mesh_veloc[k];}
918 jacobian(local_eqn,local_unknown) -=
919 tmp*dpsifdx(l2,k)*testf[l]*W*hang_weight*hang_weight2;
923 for(
unsigned k=0;k<DIM;k++)
925 jacobian(local_eqn,local_unknown)
926 -= visc_ratio*dpsifdx(l2,k)*
927 dtestfdx(l,k)*W*hang_weight*hang_weight2;
937 for(
unsigned l2=0;l2<n_pres;l2++)
940 if(pressure_dof_is_hanging[l2])
943 this->pressure_node_pt(l2)->hanging_pt(p_index);
946 n_master2 = hang_info2_pt->nmaster();
955 for(
unsigned m2=0;m2<n_master2;m2++)
959 if(pressure_dof_is_hanging[l2])
963 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
966 hang_weight2 = hang_info2_pt->master_weight(m2);
970 local_unknown = this->p_local_eqn(l2);
975 if(local_unknown >= 0)
977 jacobian(local_eqn,local_unknown)
978 += psip[l2]*dtestfdx(l,
i)*W*hang_weight*hang_weight2;
999 for(
unsigned l=0;l<n_pres;l++)
1002 if(pressure_dof_is_hanging[l])
1006 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
1009 n_master = hang_info_pt->
nmaster();
1018 for(
unsigned m=0;m<n_master;m++)
1022 if(pressure_dof_is_hanging[l])
1032 local_eqn = this->p_local_eqn(l);
1040 residuals[local_eqn] -= source*testp[l]*W*hang_weight;
1043 for(
unsigned k=0;k<DIM;k++)
1045 residuals[local_eqn] += interpolated_dudx(k,k)*testp[l]*W*hang_weight;
1051 unsigned n_master2=1;
double hang_weight2=1.0;
1053 for(
unsigned l2=0;l2<n_node;l2++)
1056 bool is_node2_hanging = node_pt(l2)->is_hanging();
1059 if(is_node2_hanging)
1061 hang_info2_pt = node_pt(l2)->hanging_pt();
1063 n_master2 = hang_info2_pt->nmaster();
1072 for(
unsigned m2=0;m2<n_master2;m2++)
1075 for(
unsigned i2=0;i2<DIM;i2++)
1079 if(is_node2_hanging)
1083 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
1085 hang_weight2 = hang_info2_pt->master_weight(m2);
1089 local_unknown = this->nodal_local_eqn(l2,u_nodal_index[i2]);
1094 if(local_unknown >= 0)
1096 jacobian(local_eqn,local_unknown)
1097 += dpsifdx(l2,i2)*testp[l]*W*hang_weight*hang_weight2;
1122 template <
unsigned DIM>
1125 dresidual_dnodal_coordinates)
1128 if(ndof()==0) {
return; }
1131 const unsigned n_node = nnode();
1134 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
1137 const unsigned n_pres = this->npres_nst();
1140 unsigned u_nodal_index[DIM];
1141 for(
unsigned i=0;
i<DIM;
i++) { u_nodal_index[
i] = this->u_index_nst(
i); }
1145 const int p_index = this->p_nodal_index_nst();
1149 bool pressure_dof_is_hanging[n_pres];
1155 for(
unsigned l=0;l<n_pres;++l)
1157 pressure_dof_is_hanging[l] =
1158 pressure_node_pt(l)->is_hanging(p_index);
1164 for(
unsigned l=0;l<n_pres;++l) { pressure_dof_is_hanging[l] =
false; }
1168 Shape psif(n_node), testf(n_node);
1169 DShape dpsifdx(n_node,DIM), dtestfdx(n_node,DIM);
1172 Shape psip(n_pres), testp(n_pres);
1175 const unsigned n_shape_controlling_node = nshape_controlling_nodes();
1193 const unsigned n_intpt = integral_pt()->nweight();
1200 double scaled_re = this->re()*this->density_ratio();
1201 double scaled_re_st = this->re_st()*this->density_ratio();
1202 double scaled_re_inv_fr = this->re_invfr()*this->density_ratio();
1203 double visc_ratio = this->viscosity_ratio();
1212 bool element_has_node_with_aux_node_update_fct=
false;
1214 std::map<Node*,unsigned> local_shape_controlling_node_lookup=
1215 shape_controlling_node_lookup();
1218 for(std::map<Node*,unsigned>::iterator it=
1219 local_shape_controlling_node_lookup.begin();
1220 it!=local_shape_controlling_node_lookup.end();
1224 Node* nod_pt=it->first;
1227 unsigned q=it->second;
1232 element_has_node_with_aux_node_update_fct=
true;
1236 for(
unsigned i=0;
i<DIM;
i++)
1238 u_ref[
i]=*(nod_pt->
value_pt(u_nodal_index[
i]));
1242 for(
unsigned p=0;p<DIM;p++)
1245 double backup=nod_pt->
x(p);
1249 nod_pt->
x(p)+=eps_fd;
1255 d_U_dX(p,q)=(*(nod_pt->
value_pt(u_nodal_index[p]))-u_ref[p])/eps_fd;
1258 nod_pt->
x(p)=backup;
1273 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
1276 for(
unsigned i=0;
i<DIM;
i++) { s[
i] = integral_pt()->knot(ipt,
i); }
1279 const double w = integral_pt()->weight(ipt);
1282 const double J = this->dshape_and_dtest_eulerian_at_knot_nst(
1283 ipt,psif,dpsifdx,d_dpsifdx_dX,testf,dtestfdx,d_dtestfdx_dX,dJ_dX);
1286 this->pshape_nst(s,psip,testp);
1290 double interpolated_p=0.0;
1298 for(
unsigned l=0;l<n_pres;l++) { interpolated_p += this->p_nst(l)*psip[l]; }
1303 for(
unsigned l=0;l<n_node;l++)
1306 for(
unsigned i=0;
i<DIM;
i++)
1309 const double u_value = nodal_value(l,u_nodal_index[
i]);
1310 interpolated_u[
i] += u_value*psif[l];
1311 interpolated_x[
i] += nodal_position(l,i)*psif[l];
1312 dudt[
i] += this->du_dt_nst(l,i)*psif[l];
1315 for(
unsigned j=0;j<DIM;j++)
1317 interpolated_dudx(i,j) += u_value*dpsifdx(l,j);
1325 for(
unsigned l=0;l<n_node;l++)
1328 for(
unsigned i=0;
i<DIM;
i++)
1330 mesh_velocity[
i] += this->dnodal_position_dt(l,
i)*psif[l];
1338 for(
unsigned q=0;q<n_shape_controlling_node;q++)
1341 for(
unsigned p=0;p<DIM;p++)
1343 for(
unsigned i=0;
i<DIM;
i++)
1345 for(
unsigned k=0;k<DIM;k++)
1348 for(
unsigned j=0;j<n_node;j++)
1350 aux += nodal_value(j,u_nodal_index[
i])*d_dpsifdx_dX(p,q,j,k);
1352 d_dudx_dX(p,q,
i,k) = aux;
1360 const double pos_time_weight
1361 = node_pt(0)->position_time_stepper_pt()->weight(1,0);
1362 const double val_time_weight = node_pt(0)->time_stepper_pt()->weight(1,0);
1366 this->get_body_force_nst(time,ipt,s,interpolated_x,body_force);
1369 const double source = this->get_source_nst(time,ipt,interpolated_x);
1373 this->get_body_force_gradient_nst(time,ipt,s,
1374 interpolated_x, d_body_force_dx);
1378 this->get_source_gradient_nst(time,ipt,interpolated_x, source_gradient);
1388 unsigned n_master=1;
double hang_weight=1.0;
1391 for(
unsigned l=0;l<n_node;l++)
1395 bool is_node_hanging = node_pt(l)->is_hanging();
1400 hang_info_pt = node_pt(l)->hanging_pt();
1403 n_master = hang_info_pt->
nmaster();
1412 for(
unsigned m=0;m<n_master;m++)
1416 for(
unsigned i=0;
i<DIM;
i++)
1424 local_eqn = this->local_hang_eqn(hang_info_pt->
master_node_pt(m),
1433 local_eqn = this->nodal_local_eqn(l,u_nodal_index[
i]);
1443 for (
unsigned p=0;p<DIM;p++)
1446 for (
unsigned q=0;q<n_shape_controlling_node;q++)
1452 double sum = body_force[
i]*testf[l];
1455 sum += scaled_re_inv_fr*testf[l]*G[
i];
1458 sum += interpolated_p*dtestfdx(l,
i);
1464 for(
unsigned k=0;k<DIM;k++)
1467 (interpolated_dudx(
i,k) +
1468 this->Gamma[
i]*interpolated_dudx(k,
i))*dtestfdx(l,k);
1474 sum -= scaled_re_st*dudt[
i]*testf[l];
1477 for(
unsigned k=0;k<DIM;k++)
1479 double tmp=scaled_re*interpolated_u[k];
1482 tmp-=scaled_re_st*mesh_velocity[k];
1484 sum -= tmp*interpolated_dudx(
i,k)*testf[l];
1488 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1489 sum*dJ_dX(p,q)*w*hang_weight;
1495 sum=d_body_force_dx(
i,p)*psif(q)*testf(l);
1498 sum += interpolated_p*d_dtestfdx_dX(p,q,l,
i);
1501 for (
unsigned k=0;k<DIM;k++)
1504 (interpolated_dudx(
i,k)+
1505 this->Gamma[
i]*interpolated_dudx(k,
i))
1506 *d_dtestfdx_dX(p,q,l,k)+
1507 (d_dudx_dX(p,q,
i,k) +
1508 this->Gamma[
i]*d_dudx_dX(p,q,k,
i))
1513 for(
unsigned k=0;k<DIM;k++)
1515 double tmp=scaled_re*interpolated_u[k];
1518 tmp-=scaled_re_st*mesh_velocity[k];
1520 sum -= tmp*d_dudx_dX(p,q,
i,k)*testf(l);
1524 sum+=scaled_re_st*pos_time_weight*
1525 psif(q)*interpolated_dudx(
i,p)*testf(l);
1529 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1530 sum*J*w*hang_weight;
1539 if(element_has_node_with_aux_node_update_fct)
1542 for (
unsigned q_local=0;q_local<n_node;q_local++)
1547 unsigned n_master2=1;
1548 double hang_weight2=1.0;
1552 bool is_node_hanging2 = node_pt(q_local)->is_hanging();
1554 Node* actual_shape_controlling_node_pt=node_pt(q_local);
1557 if(is_node_hanging2)
1559 hang_info2_pt = node_pt(q_local)->hanging_pt();
1562 n_master2 = hang_info2_pt->
nmaster();
1571 for(
unsigned mm=0;mm<n_master2;mm++)
1574 if(is_node_hanging2)
1576 actual_shape_controlling_node_pt=
1582 unsigned q=local_shape_controlling_node_lookup[
1583 actual_shape_controlling_node_pt];
1586 for(
unsigned p=0;p<DIM;p++)
1589 -visc_ratio*this->Gamma[
i]*dpsifdx(q_local,
i)*
1591 -scaled_re*psif(q_local)*interpolated_dudx(
i,p)*testf(l);
1594 sum-=scaled_re_st*val_time_weight*psif(q_local)*testf(l);
1595 for (
unsigned k=0;k<DIM;k++)
1597 sum-=visc_ratio*dpsifdx(q_local,k)*dtestfdx(l,k);
1598 double tmp=scaled_re*interpolated_u[k];
1601 tmp-=scaled_re_st*mesh_velocity[k];
1603 sum-=tmp*dpsifdx(q_local,k)*testf(l);
1607 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1608 sum*d_U_dX(p,q)*J*w*hang_weight*hang_weight2;
1625 for(
unsigned l=0;l<n_pres;l++)
1629 if(pressure_dof_is_hanging[l])
1633 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
1636 n_master = hang_info_pt->
nmaster();
1645 for(
unsigned m=0;m<n_master;m++)
1649 if(pressure_dof_is_hanging[l])
1659 local_eqn = this->p_local_eqn(l);
1667 for (
unsigned p=0;p<DIM;p++)
1670 for (
unsigned q=0;q<n_shape_controlling_node;q++)
1680 for(
unsigned k=0;k<DIM;k++)
1682 aux += interpolated_dudx(k,k);
1686 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1687 aux*dJ_dX(p,q)*testp[l]*w*hang_weight;
1694 aux=-source_gradient[p]*psif(q);
1695 for(
unsigned k=0;k<DIM;k++)
1697 aux += d_dudx_dX(p,q,k,k);
1700 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1701 aux*testp[l]*J*w*hang_weight;
1709 if(element_has_node_with_aux_node_update_fct)
1712 for(
unsigned q_local=0;q_local<n_node;q_local++)
1717 unsigned n_master2=1;
1718 double hang_weight2=1.0;
1722 bool is_node_hanging2 = node_pt(q_local)->is_hanging();
1724 Node* actual_shape_controlling_node_pt=node_pt(q_local);
1727 if(is_node_hanging2)
1729 hang_info2_pt = node_pt(q_local)->hanging_pt();
1732 n_master2 = hang_info2_pt->
nmaster();
1741 for(
unsigned mm=0;mm<n_master2;mm++)
1744 if(is_node_hanging2)
1746 actual_shape_controlling_node_pt=
1752 unsigned q=local_shape_controlling_node_lookup[
1753 actual_shape_controlling_node_pt];
1756 for(
unsigned p=0;p<DIM;p++)
1758 double aux=dpsifdx(q_local,p)*testp(l);
1759 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1760 aux*d_U_dX(p,q)*J*w*hang_weight*hang_weight2;
1781 if (this->tree_pt()->father_pt()!=0)
1790 if (this->internal_data_pt(this->P_nst_internal_index)->nvalue()
1791 <= this->npres_nst())
1793 this->internal_data_pt(this->P_nst_internal_index)
1794 ->resize(this->npres_nst());
1798 Data* new_data_pt =
new Data(this->npres_nst());
1799 delete internal_data_pt(this->P_nst_internal_index);
1800 internal_data_pt(this->P_nst_internal_index) = new_data_pt;
1803 if(this->tree_pt()->father_pt()!=0)
1808 (quadtree_pt()->father_pt()->object_pt());
1812 if(father_element_pt->p_order()==this->p_order())
1814 using namespace QuadTreeNames;
1817 int son_type=quadtree_pt()->son_type();
1846 "Invalid son type in",
1847 OOMPH_CURRENT_FUNCTION,
1848 OOMPH_EXCEPTION_LOCATION);
1856 for(
unsigned p=0; p<this->npres_nst(); p++)
1858 internal_data_pt(this->P_nst_internal_index)->set_value(p,0.0);
1862 if(this->npres_nst()==1)
1864 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1866 else if(this->npres_nst()==3)
1868 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1869 internal_data_pt(this->P_nst_internal_index)->set_value(1,press);
1870 internal_data_pt(this->P_nst_internal_index)->set_value(2,press);
1874 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1875 internal_data_pt(this->P_nst_internal_index)->set_value(1,press);
1876 internal_data_pt(this->P_nst_internal_index)->set_value(2,press);
1877 internal_data_pt(this->P_nst_internal_index)->set_value(3,press);
1892 if (this->tree_pt()->father_pt()!=0)
1901 if (this->internal_data_pt(this->P_nst_internal_index)->nvalue()
1902 <= this->npres_nst())
1904 this->internal_data_pt(this->P_nst_internal_index)
1905 ->resize(this->npres_nst());
1909 Data* new_data_pt =
new Data(this->npres_nst());
1910 delete internal_data_pt(this->P_nst_internal_index);
1911 internal_data_pt(this->P_nst_internal_index) = new_data_pt;
1914 if(this->tree_pt()->father_pt()!=0)
1919 (octree_pt()->father_pt()->object_pt());
1923 if(father_element_pt->p_order()==this->p_order())
1925 using namespace OcTreeNames;
1928 int son_type=octree_pt()->son_type();
1934 for(
unsigned i=0;
i<3;
i++)
1943 for(
unsigned p=0; p<this->npres_nst(); p++)
1945 internal_data_pt(this->P_nst_internal_index)->set_value(p,0.0);
1949 if(this->npres_nst()==1)
1951 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1955 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1956 internal_data_pt(this->P_nst_internal_index)->set_value(1,press);
1957 internal_data_pt(this->P_nst_internal_index)->set_value(2,press);
1958 internal_data_pt(this->P_nst_internal_index)->set_value(3,press);
1959 internal_data_pt(this->P_nst_internal_index)->set_value(4,press);
1960 internal_data_pt(this->P_nst_internal_index)->set_value(5,press);
1961 internal_data_pt(this->P_nst_internal_index)->set_value(6,press);
1962 internal_data_pt(this->P_nst_internal_index)->set_value(7,press);
bool ALE_is_disabled
Boolean flag to indicate if ALE formulation is disabled when time-derivatives are computed...
virtual void get_dresidual_dnodal_coordinates(RankThreeTensor< double > &dresidual_dnodal_coordinates)
Compute derivatives of elemental residual vector with respect to nodal coordinates. Overwrites default implementation in FiniteElement base class. dresidual_dnodal_coordinates(l,i,j) = d res(l) / dX_{ij}.
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...
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.
bool has_auxiliary_node_update_fct_pt()
Boolean to indicate if node has a pointer to and auxiliary update function.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
void further_build()
Further build, pass the pointers down to the sons.
static Vector< Vector< int > > Direction_to_vector
For each direction, i.e. a son_type (vertex), a face or an edge, this defines a vector that indicates...
Refineable version of Crouzeix Raviart elements. Generic class definitions.
A class that represents a collection of data; each Data object may contain many different individual ...
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
Class that contains data for hanging nodes.
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 fill_in_generic_residual_contribution_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Add element's contribution to elemental residual vector and/or Jacobian matrix flag=1: compute both f...
void fill_in_generic_pressure_advection_diffusion_contribution_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Compute the residuals for the associated pressure advection diffusion problem. Used by the Fp precond...
virtual double interpolated_p_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
static double Default_fd_jacobian_step
Double used for the default finite difference step in elemental jacobian calculations.