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;
305 template<
unsigned DIM>
313 unsigned n_node = nnode();
316 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
319 unsigned n_pres = this->npres_nst();
322 unsigned u_nodal_index[DIM];
323 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);
345 for(
unsigned l=0;l<n_pres;++l)
346 {pressure_dof_is_hanging[l] =
false;}
350 Shape psif(n_node), testf(n_node);
351 DShape dpsifdx(n_node,DIM), dtestfdx(n_node,DIM);
355 Shape psip(n_pres), testp(n_pres);
358 unsigned n_intpt = integral_pt()->nweight();
365 double scaled_re = this->re()*this->density_ratio();
366 double scaled_re_st = this->re_st()*this->density_ratio();
367 double scaled_re_inv_fr = this->re_invfr()*this->density_ratio();
368 double visc_ratio = this->viscosity_ratio();
372 int local_eqn=0, local_unknown=0;
375 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
381 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
385 for(
unsigned i=0;
i<DIM;
i++) {s[
i] = integral_pt()->knot(ipt,
i);}
388 double w = integral_pt()->weight(ipt);
392 this->dshape_and_dtest_eulerian_at_knot_nst(ipt,psif,dpsifdx,testf,dtestfdx);
395 this->pshape_nst(s,psip,testp);
402 double interpolated_p=0.0;
410 for(
unsigned l=0;l<n_pres;l++) {interpolated_p += this->p_nst(l)*psip[l];}
416 for(
unsigned l=0;l<n_node;l++)
419 for(
unsigned i=0;
i<DIM;
i++)
422 double u_value = this->nodal_value(l,u_nodal_index[
i]);
423 interpolated_u[
i] += u_value*psif[l];
424 interpolated_x[
i] += this->nodal_position(l,i)*psif[l];
425 dudt[
i] += this->du_dt_nst(l,i)*psif[l];
428 for(
unsigned j=0;j<DIM;j++)
430 interpolated_dudx(i,j) += u_value*dpsifdx(l,j);
435 if (!ALE_is_disabled_flag)
438 for(
unsigned l=0;l<n_node;l++)
441 for(
unsigned i=0;
i<DIM;
i++)
443 mesh_veloc[
i] += this->dnodal_position_dt(l,
i)*psif[l];
454 if(!this->Use_extrapolated_strainrate_to_compute_second_invariant)
456 this->strain_rate(s,strainrate_to_compute_second_invariant);
460 this->extrapolated_strain_rate(ipt,strainrate_to_compute_second_invariant);
465 strainrate_to_compute_second_invariant);
468 double viscosity=this->Constitutive_eqn_pt->viscosity(second_invariant);
472 this->get_body_force_nst(time,ipt,s,interpolated_x,body_force);
475 double source = this->get_source_nst(time,ipt,interpolated_x);
481 if(!this->Use_extrapolated_strainrate_to_compute_second_invariant)
484 double dviscosity_dsecond_invariant=
485 this->Constitutive_eqn_pt->dviscosity_dinvariant(second_invariant);
489 this->strain_rate(s,strainrate);
499 for(
unsigned i=0;
i<DIM;
i++)
501 for(
unsigned j=0;j<DIM;j++)
506 kroneckerdelta(
i,
i)=1.0;
509 for(
unsigned k=0;k<DIM;k++)
513 tmp+=strainrate(k,k);
516 dinvariant_dstrainrate(
i,
i)=tmp;
520 dinvariant_dstrainrate(
i,j)=-strainrate(j,
i);
530 for(
unsigned l=0;l<n_node;l++)
533 for(
unsigned k=0;k<DIM;k++)
536 for(
unsigned i=0;
i<DIM;
i++)
538 for(
unsigned j=0;j<DIM;j++)
541 dstrainrate_dunknown(
i,j,k,l)=0.0;
544 for(
unsigned m=0;m<DIM;m++)
546 for(
unsigned n=0;n<DIM;n++)
548 dstrainrate_dunknown(
i,j,k,l)+=
549 0.5*(kroneckerdelta(
i,m)*kroneckerdelta(j,n)+
550 kroneckerdelta(
i,n)*kroneckerdelta(j,m))*
551 kroneckerdelta(m,k)*dpsifdx(l,n);
561 for(
unsigned l=0;l<n_node;l++)
564 for(
unsigned k=0;k<DIM;k++)
567 for(
unsigned i=0;
i<DIM;
i++)
569 for(
unsigned j=0;j<DIM;j++)
571 dviscosity_dunknown(k,l)+=dviscosity_dsecond_invariant*
572 dinvariant_dstrainrate(
i,j)*dstrainrate_dunknown(
i,j,k,l);
585 unsigned n_master=1;
double hang_weight=1.0;
589 for(
unsigned l=0;l<n_node;l++)
592 bool is_node_hanging = node_pt(l)->is_hanging();
597 hang_info_pt = node_pt(l)->hanging_pt();
600 n_master = hang_info_pt->
nmaster();
609 for(
unsigned m=0;m<n_master;m++)
612 for(
unsigned i=0;
i<DIM;
i++)
628 local_eqn = this->nodal_local_eqn(l,u_nodal_index[
i]);
641 sum += body_force[
i];
644 sum += scaled_re_inv_fr*G[
i];
647 sum -= scaled_re_st*dudt[
i];
650 for(
unsigned k=0;k<DIM;k++)
652 double tmp=scaled_re*interpolated_u[k];
653 if (!ALE_is_disabled_flag)
654 {tmp -= scaled_re_st*mesh_veloc[k];}
655 sum -= tmp*interpolated_dudx(
i,k);
660 if(this->Pre_multiply_by_viscosity_ratio)
662 sum = visc_ratio*viscosity*
663 (sum*testf[l] + interpolated_p*dtestfdx(l,
i))*W*hang_weight;
667 sum = (sum*testf[l] + interpolated_p*dtestfdx(l,
i))*W*hang_weight;
674 for(
unsigned k=0;k<DIM;k++)
676 sum -= visc_ratio*viscosity*
677 (interpolated_dudx(
i,k) + this->Gamma[
i]*interpolated_dudx(k,
i))
678 *dtestfdx(l,k)*W*hang_weight;
682 residuals[local_eqn] += sum;
688 unsigned n_master2=1;
double hang_weight2=1.0;
690 for(
unsigned l2=0;l2<n_node;l2++)
693 bool is_node2_hanging = node_pt(l2)->is_hanging();
698 hang_info2_pt = node_pt(l2)->hanging_pt();
700 n_master2 = hang_info2_pt->nmaster();
709 for(
unsigned m2=0;m2<n_master2;m2++)
712 for(
unsigned i2=0;i2<DIM;i2++)
720 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
723 hang_weight2 = hang_info2_pt->master_weight(m2);
727 local_unknown = this->nodal_local_eqn(l2,u_nodal_index[i2]);
732 if(local_unknown >= 0)
735 jacobian(local_eqn,local_unknown)
736 -= visc_ratio*viscosity*this->Gamma[
i]*dpsifdx(l2,
i)*
737 dtestfdx(l,i2)*W*hang_weight*hang_weight2;
740 jacobian(local_eqn,local_unknown)
741 -= scaled_re*psif[l2]*interpolated_dudx(
i,i2)*testf[l]*W*
742 hang_weight*hang_weight2;
745 Use_extrapolated_strainrate_to_compute_second_invariant)
747 for(
unsigned k=0;k<DIM;k++)
749 jacobian(local_eqn,local_unknown) -=
750 visc_ratio*dviscosity_dunknown(i2,l2)*
751 (interpolated_dudx(
i,k) +
752 this->Gamma[
i]*interpolated_dudx(k,
i))
753 *dtestfdx(l,k)*W*hang_weight*hang_weight2;
765 mass_matrix(local_eqn,local_unknown) +=
766 scaled_re_st*psif[l2]*testf[l]*W*
767 hang_weight*hang_weight2;
771 jacobian(local_eqn,local_unknown)
773 node_pt(l2)->time_stepper_pt()->weight(1,0)*
774 psif[l2]*testf[l]*W*hang_weight*hang_weight2;
777 for(
unsigned k=0;k<DIM;k++)
779 double tmp=scaled_re*interpolated_u[k];
780 if (!ALE_is_disabled_flag)
781 {tmp -= scaled_re_st*mesh_veloc[k];}
783 jacobian(local_eqn,local_unknown) -=
784 tmp*dpsifdx(l2,k)*testf[l]*W*hang_weight*hang_weight2;
788 for(
unsigned k=0;k<DIM;k++)
790 jacobian(local_eqn,local_unknown)
791 -= visc_ratio*viscosity*dpsifdx(l2,k)*
792 dtestfdx(l,k)*W*hang_weight*hang_weight2;
802 for(
unsigned l2=0;l2<n_pres;l2++)
805 if(pressure_dof_is_hanging[l2])
808 this->pressure_node_pt(l2)->hanging_pt(p_index);
811 n_master2 = hang_info2_pt->nmaster();
820 for(
unsigned m2=0;m2<n_master2;m2++)
824 if(pressure_dof_is_hanging[l2])
828 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
831 hang_weight2 = hang_info2_pt->master_weight(m2);
835 local_unknown = this->p_local_eqn(l2);
840 if(local_unknown >= 0)
842 if(this->Pre_multiply_by_viscosity_ratio)
844 jacobian(local_eqn,local_unknown)
845 += visc_ratio*viscosity*
846 psip[l2]*dtestfdx(l,
i)*W*hang_weight*hang_weight2;
850 jacobian(local_eqn,local_unknown)
851 += psip[l2]*dtestfdx(l,
i)*W*hang_weight*hang_weight2;
873 for(
unsigned l=0;l<n_pres;l++)
876 if(pressure_dof_is_hanging[l])
880 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
883 n_master = hang_info_pt->
nmaster();
892 for(
unsigned m=0;m<n_master;m++)
896 if(pressure_dof_is_hanging[l])
906 local_eqn = this->p_local_eqn(l);
914 residuals[local_eqn] -= source*testp[l]*W*hang_weight;
917 for(
unsigned k=0;k<DIM;k++)
920 if(this->Pre_multiply_by_viscosity_ratio)
922 residuals[local_eqn] += visc_ratio*viscosity*
923 interpolated_dudx(k,k)*testp[l]*W*hang_weight;
927 residuals[local_eqn] +=
928 interpolated_dudx(k,k)*testp[l]*W*hang_weight;
935 unsigned n_master2=1;
double hang_weight2=1.0;
937 for(
unsigned l2=0;l2<n_node;l2++)
940 bool is_node2_hanging = node_pt(l2)->is_hanging();
945 hang_info2_pt = node_pt(l2)->hanging_pt();
947 n_master2 = hang_info2_pt->nmaster();
956 for(
unsigned m2=0;m2<n_master2;m2++)
959 for(
unsigned i2=0;i2<DIM;i2++)
967 this->local_hang_eqn(hang_info2_pt->master_node_pt(m2),
969 hang_weight2 = hang_info2_pt->master_weight(m2);
973 local_unknown = this->nodal_local_eqn(l2,u_nodal_index[i2]);
978 if(local_unknown >= 0)
980 if(this->Pre_multiply_by_viscosity_ratio)
982 jacobian(local_eqn,local_unknown)+= visc_ratio*viscosity*
983 dpsifdx(l2,i2)*testp[l]*W*hang_weight*hang_weight2;
987 jacobian(local_eqn,local_unknown)
988 += dpsifdx(l2,i2)*testp[l]*W*hang_weight*hang_weight2;
1014 template <
unsigned DIM>
1017 dresidual_dnodal_coordinates)
1020 if(ndof()==0) {
return; }
1023 const unsigned n_node = nnode();
1026 double time=node_pt(0)->time_stepper_pt()->time_pt()->time();
1029 const unsigned n_pres = this->npres_nst();
1032 unsigned u_nodal_index[DIM];
1033 for(
unsigned i=0;
i<DIM;
i++) { u_nodal_index[
i] = this->u_index_nst(
i); }
1037 const int p_index = this->p_nodal_index_nst();
1041 bool pressure_dof_is_hanging[n_pres];
1047 for(
unsigned l=0;l<n_pres;++l)
1049 pressure_dof_is_hanging[l] =
1050 pressure_node_pt(l)->is_hanging(p_index);
1056 for(
unsigned l=0;l<n_pres;++l) { pressure_dof_is_hanging[l] =
false; }
1060 Shape psif(n_node), testf(n_node);
1061 DShape dpsifdx(n_node,DIM), dtestfdx(n_node,DIM);
1064 Shape psip(n_pres), testp(n_pres);
1067 const unsigned n_shape_controlling_node = nshape_controlling_nodes();
1085 const unsigned n_intpt = integral_pt()->nweight();
1092 double scaled_re = this->re()*this->density_ratio();
1093 double scaled_re_st = this->re_st()*this->density_ratio();
1094 double scaled_re_inv_fr = this->re_invfr()*this->density_ratio();
1095 double visc_ratio = this->viscosity_ratio();
1104 bool element_has_node_with_aux_node_update_fct=
false;
1106 std::map<Node*,unsigned> local_shape_controlling_node_lookup=
1107 shape_controlling_node_lookup();
1110 for(std::map<Node*,unsigned>::iterator it=
1111 local_shape_controlling_node_lookup.begin();
1112 it!=local_shape_controlling_node_lookup.end();
1116 Node* nod_pt=it->first;
1119 unsigned q=it->second;
1124 element_has_node_with_aux_node_update_fct=
true;
1128 for(
unsigned i=0;
i<DIM;
i++)
1130 u_ref[
i]=*(nod_pt->
value_pt(u_nodal_index[
i]));
1134 for(
unsigned p=0;p<DIM;p++)
1137 double backup=nod_pt->
x(p);
1141 nod_pt->
x(p)+=eps_fd;
1147 d_U_dX(p,q)=(*(nod_pt->
value_pt(u_nodal_index[p]))-u_ref[p])/eps_fd;
1150 nod_pt->
x(p)=backup;
1165 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
1168 for(
unsigned i=0;
i<DIM;
i++) { s[
i] = integral_pt()->knot(ipt,
i); }
1171 const double w = integral_pt()->weight(ipt);
1174 const double J = this->dshape_and_dtest_eulerian_at_knot_nst(
1175 ipt,psif,dpsifdx,d_dpsifdx_dX,testf,dtestfdx,d_dtestfdx_dX,dJ_dX);
1178 this->pshape_nst(s,psip,testp);
1182 double interpolated_p=0.0;
1190 for(
unsigned l=0;l<n_pres;l++) { interpolated_p += this->p_nst(l)*psip[l]; }
1195 for(
unsigned l=0;l<n_node;l++)
1198 for(
unsigned i=0;
i<DIM;
i++)
1201 const double u_value = nodal_value(l,u_nodal_index[
i]);
1202 interpolated_u[
i] += u_value*psif[l];
1203 interpolated_x[
i] += nodal_position(l,i)*psif[l];
1204 dudt[
i] += this->du_dt_nst(l,i)*psif[l];
1207 for(
unsigned j=0;j<DIM;j++)
1209 interpolated_dudx(i,j) += u_value*dpsifdx(l,j);
1217 for(
unsigned l=0;l<n_node;l++)
1220 for(
unsigned i=0;
i<DIM;
i++)
1222 mesh_velocity[
i] += this->dnodal_position_dt(l,
i)*psif[l];
1230 for(
unsigned q=0;q<n_shape_controlling_node;q++)
1233 for(
unsigned p=0;p<DIM;p++)
1235 for(
unsigned i=0;
i<DIM;
i++)
1237 for(
unsigned k=0;k<DIM;k++)
1240 for(
unsigned j=0;j<n_node;j++)
1242 aux += nodal_value(j,u_nodal_index[
i])*d_dpsifdx_dX(p,q,j,k);
1244 d_dudx_dX(p,q,
i,k) = aux;
1252 const double pos_time_weight
1253 = node_pt(0)->position_time_stepper_pt()->weight(1,0);
1254 const double val_time_weight = node_pt(0)->time_stepper_pt()->weight(1,0);
1258 this->get_body_force_nst(time,ipt,s,interpolated_x,body_force);
1261 const double source = this->get_source_nst(time,ipt,interpolated_x);
1265 this->get_body_force_gradient_nst(time,ipt,s,
1266 interpolated_x, d_body_force_dx);
1270 this->get_source_gradient_nst(time,ipt,interpolated_x, source_gradient);
1280 unsigned n_master=1;
double hang_weight=1.0;
1283 for(
unsigned l=0;l<n_node;l++)
1287 bool is_node_hanging = node_pt(l)->is_hanging();
1292 hang_info_pt = node_pt(l)->hanging_pt();
1295 n_master = hang_info_pt->
nmaster();
1304 for(
unsigned m=0;m<n_master;m++)
1308 for(
unsigned i=0;
i<DIM;
i++)
1316 local_eqn = this->local_hang_eqn(hang_info_pt->
master_node_pt(m),
1325 local_eqn = this->nodal_local_eqn(l,u_nodal_index[
i]);
1335 for (
unsigned p=0;p<DIM;p++)
1338 for (
unsigned q=0;q<n_shape_controlling_node;q++)
1344 double sum = body_force[
i]*testf[l];
1347 sum += scaled_re_inv_fr*testf[l]*G[
i];
1350 sum += interpolated_p*dtestfdx(l,
i);
1356 for(
unsigned k=0;k<DIM;k++)
1359 (interpolated_dudx(
i,k) +
1360 this->Gamma[
i]*interpolated_dudx(k,
i))*dtestfdx(l,k);
1366 sum -= scaled_re_st*dudt[
i]*testf[l];
1369 for(
unsigned k=0;k<DIM;k++)
1371 double tmp=scaled_re*interpolated_u[k];
1374 tmp-=scaled_re_st*mesh_velocity[k];
1376 sum -= tmp*interpolated_dudx(
i,k)*testf[l];
1380 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1381 sum*dJ_dX(p,q)*w*hang_weight;
1387 sum=d_body_force_dx(
i,p)*psif(q)*testf(l);
1390 sum += interpolated_p*d_dtestfdx_dX(p,q,l,
i);
1393 for (
unsigned k=0;k<DIM;k++)
1396 (interpolated_dudx(
i,k)+
1397 this->Gamma[
i]*interpolated_dudx(k,
i))
1398 *d_dtestfdx_dX(p,q,l,k)+
1399 (d_dudx_dX(p,q,
i,k) +
1400 this->Gamma[
i]*d_dudx_dX(p,q,k,
i))
1405 for(
unsigned k=0;k<DIM;k++)
1407 double tmp=scaled_re*interpolated_u[k];
1410 tmp-=scaled_re_st*mesh_velocity[k];
1412 sum -= tmp*d_dudx_dX(p,q,
i,k)*testf(l);
1416 sum+=scaled_re_st*pos_time_weight*
1417 psif(q)*interpolated_dudx(
i,p)*testf(l);
1421 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1422 sum*J*w*hang_weight;
1431 if(element_has_node_with_aux_node_update_fct)
1434 for (
unsigned q_local=0;q_local<n_node;q_local++)
1439 unsigned n_master2=1;
1440 double hang_weight2=1.0;
1444 bool is_node_hanging2 = node_pt(q_local)->is_hanging();
1446 Node* actual_shape_controlling_node_pt=node_pt(q_local);
1449 if(is_node_hanging2)
1451 hang_info2_pt = node_pt(q_local)->hanging_pt();
1454 n_master2 = hang_info2_pt->
nmaster();
1463 for(
unsigned mm=0;mm<n_master2;mm++)
1466 if(is_node_hanging2)
1468 actual_shape_controlling_node_pt=
1474 unsigned q=local_shape_controlling_node_lookup[
1475 actual_shape_controlling_node_pt];
1478 for(
unsigned p=0;p<DIM;p++)
1481 -visc_ratio*this->Gamma[
i]*dpsifdx(q_local,
i)*
1483 -scaled_re*psif(q_local)*interpolated_dudx(
i,p)*testf(l);
1486 sum-=scaled_re_st*val_time_weight*psif(q_local)*testf(l);
1487 for (
unsigned k=0;k<DIM;k++)
1489 sum-=visc_ratio*dpsifdx(q_local,k)*dtestfdx(l,k);
1490 double tmp=scaled_re*interpolated_u[k];
1493 tmp-=scaled_re_st*mesh_velocity[k];
1495 sum-=tmp*dpsifdx(q_local,k)*testf(l);
1499 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1500 sum*d_U_dX(p,q)*J*w*hang_weight*hang_weight2;
1517 for(
unsigned l=0;l<n_pres;l++)
1521 if(pressure_dof_is_hanging[l])
1525 hang_info_pt = this->pressure_node_pt(l)->hanging_pt(p_index);
1528 n_master = hang_info_pt->
nmaster();
1537 for(
unsigned m=0;m<n_master;m++)
1541 if(pressure_dof_is_hanging[l])
1551 local_eqn = this->p_local_eqn(l);
1559 for (
unsigned p=0;p<DIM;p++)
1562 for (
unsigned q=0;q<n_shape_controlling_node;q++)
1572 for(
unsigned k=0;k<DIM;k++)
1574 aux += interpolated_dudx(k,k);
1578 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1579 aux*dJ_dX(p,q)*testp[l]*w*hang_weight;
1586 aux=-source_gradient[p]*psif(q);
1587 for(
unsigned k=0;k<DIM;k++)
1589 aux += d_dudx_dX(p,q,k,k);
1592 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1593 aux*testp[l]*J*w*hang_weight;
1601 if(element_has_node_with_aux_node_update_fct)
1604 for(
unsigned q_local=0;q_local<n_node;q_local++)
1609 unsigned n_master2=1;
1610 double hang_weight2=1.0;
1614 bool is_node_hanging2 = node_pt(q_local)->is_hanging();
1616 Node* actual_shape_controlling_node_pt=node_pt(q_local);
1619 if(is_node_hanging2)
1621 hang_info2_pt = node_pt(q_local)->hanging_pt();
1624 n_master2 = hang_info2_pt->
nmaster();
1633 for(
unsigned mm=0;mm<n_master2;mm++)
1636 if(is_node_hanging2)
1638 actual_shape_controlling_node_pt=
1644 unsigned q=local_shape_controlling_node_lookup[
1645 actual_shape_controlling_node_pt];
1648 for(
unsigned p=0;p<DIM;p++)
1650 double aux=dpsifdx(q_local,p)*testp(l);
1651 dresidual_dnodal_coordinates(local_eqn,p,q)+=
1652 aux*d_U_dX(p,q)*J*w*hang_weight*hang_weight2;
1673 if (this->tree_pt()->father_pt()!=0)
1682 if (this->internal_data_pt(this->P_nst_internal_index)->nvalue()
1683 <= this->npres_nst())
1685 this->internal_data_pt(this->P_nst_internal_index)
1686 ->resize(this->npres_nst());
1690 Data* new_data_pt =
new Data(this->npres_nst());
1691 delete internal_data_pt(this->P_nst_internal_index);
1692 internal_data_pt(this->P_nst_internal_index) = new_data_pt;
1695 if(this->tree_pt()->father_pt()!=0)
1700 (quadtree_pt()->father_pt()->object_pt());
1704 if(father_element_pt->p_order()==this->p_order())
1706 using namespace QuadTreeNames;
1709 int son_type=quadtree_pt()->son_type();
1738 "Invalid son type in",
1739 OOMPH_CURRENT_FUNCTION,
1740 OOMPH_EXCEPTION_LOCATION);
1748 for(
unsigned p=0; p<this->npres_nst(); p++)
1750 internal_data_pt(this->P_nst_internal_index)->set_value(p,0.0);
1754 if(this->npres_nst()==1)
1756 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1758 else if(this->npres_nst()==3)
1760 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1761 internal_data_pt(this->P_nst_internal_index)->set_value(1,press);
1762 internal_data_pt(this->P_nst_internal_index)->set_value(2,press);
1766 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1767 internal_data_pt(this->P_nst_internal_index)->set_value(1,press);
1768 internal_data_pt(this->P_nst_internal_index)->set_value(2,press);
1769 internal_data_pt(this->P_nst_internal_index)->set_value(3,press);
1784 if (this->tree_pt()->father_pt()!=0)
1793 if (this->internal_data_pt(this->P_nst_internal_index)->nvalue()
1794 <= this->npres_nst())
1796 this->internal_data_pt(this->P_nst_internal_index)
1797 ->resize(this->npres_nst());
1801 Data* new_data_pt =
new Data(this->npres_nst());
1802 delete internal_data_pt(this->P_nst_internal_index);
1803 internal_data_pt(this->P_nst_internal_index) = new_data_pt;
1806 if(this->tree_pt()->father_pt()!=0)
1811 (octree_pt()->father_pt()->object_pt());
1815 if(father_element_pt->p_order()==this->p_order())
1817 using namespace OcTreeNames;
1820 int son_type=octree_pt()->son_type();
1826 for(
unsigned i=0;
i<3;
i++)
1835 for(
unsigned p=0; p<this->npres_nst(); p++)
1837 internal_data_pt(this->P_nst_internal_index)->set_value(p,0.0);
1841 if(this->npres_nst()==1)
1843 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1847 internal_data_pt(this->P_nst_internal_index)->set_value(0,press);
1848 internal_data_pt(this->P_nst_internal_index)->set_value(1,press);
1849 internal_data_pt(this->P_nst_internal_index)->set_value(2,press);
1850 internal_data_pt(this->P_nst_internal_index)->set_value(3,press);
1851 internal_data_pt(this->P_nst_internal_index)->set_value(4,press);
1852 internal_data_pt(this->P_nst_internal_index)->set_value(5,press);
1853 internal_data_pt(this->P_nst_internal_index)->set_value(6,press);
1854 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 double interpolated_p_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
void further_build()
Further build, pass the pointers down to the sons.
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.
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 & x(const unsigned &i)
Return the i-th nodal coordinate.
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...
A class that represents a collection of data; each Data object may contain many different individual ...
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...
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...
double second_invariant(const DenseMatrix< double > &tensor)
Compute second invariant of tensor.
Refineable version of Crouzeix Raviart elements. Generic class definitions.
static double Default_fd_jacobian_step
Double used for the default finite difference step in elemental jacobian calculations.