60 unsigned n_node =
nnode();
66 unsigned u_nodal_index[2];
75 bool pressure_dof_is_hanging[n_pres];
80 for(
unsigned l=0;l<n_pres;++l)
82 pressure_dof_is_hanging[l] =
89 for(
unsigned l=0;l<n_pres;++l)
90 {pressure_dof_is_hanging[l] =
false;}
94 Shape psif(n_node), testf(n_node);
95 DShape dpsifdx(n_node,2), dtestfdx(n_node,2);
98 Shape psip(n_pres), testp(n_pres);
107 const double Re =
re();
108 const double Alpha =
alpha();
109 const double Re_St =
re_st();
112 int local_eqn=0, local_unknown=0;
115 HangInfo *hang_info_pt=0, *hang_info2_pt=0;
118 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
137 double interpolated_p=0.0;
144 for(
unsigned i=0;
i<2;
i++)
147 interpolated_u[
i] = 0.0;
148 interpolated_x[
i] = 0.0;
149 for(
unsigned j=0;j<2;j++)
151 interpolated_dudx(
i,j) = 0.0;
156 for(
unsigned l=0;l<n_pres;l++) interpolated_p += this->
p_pnst(l)*psip[l];
161 for(
unsigned l=0;l<n_node;l++)
164 for(
unsigned i=0;
i<2;
i++)
168 interpolated_u[
i] += u_value*psif[l];
173 for(
unsigned j=0;j<2;j++)
175 interpolated_dudx(i,j) += u_value*dpsifdx(l,j);
183 unsigned n_master=1;
double hang_weight=1.0;
185 for(
unsigned l=0;l<n_node;l++)
195 n_master = hang_info_pt->
nmaster();
204 for(
unsigned m=0;m<n_master;m++)
234 residuals[local_eqn] += ((interpolated_p/interpolated_x[0])
235 - ((1.+
Gamma[i])/pow(interpolated_x[0],2.))*((1./Alpha)*interpolated_dudx(1,1)+interpolated_u[0]))
236 *testf[l]*interpolated_x[0]*Alpha*W*hang_weight;
239 residuals[local_eqn] += (interpolated_p - (1.+
Gamma[
i])*interpolated_dudx(0,0))
240 *dtestfdx(l,0)*interpolated_x[0]*Alpha*W*hang_weight;
243 residuals[local_eqn] -= ((1./(interpolated_x[0]*Alpha))*interpolated_dudx(0,1)
244 - (interpolated_u[1]/interpolated_x[0])
245 +
Gamma[i]*interpolated_dudx(1,0))
246 *(1./(interpolated_x[0]*Alpha))*dtestfdx(l,1)*interpolated_x[0]*Alpha*W*hang_weight;
249 residuals[local_eqn] -= Re*(interpolated_u[0]*interpolated_dudx(0,0)
250 +(interpolated_u[1]/(interpolated_x[0]*Alpha))*interpolated_dudx(0,1)
251 -(pow(interpolated_u[1],2.)/interpolated_x[0]))
252 *testf[l]*interpolated_x[0]*Alpha*W*hang_weight;
259 unsigned n_master2=1;
double hang_weight2=1.0;
261 for(
unsigned l2=0;l2<n_node;l2++)
271 n_master2 = hang_info2_pt->
nmaster();
280 for(
unsigned m2=0;m2<n_master2;m2++)
295 hang_weight2 = hang_info2_pt->master_weight(m2);
304 if(local_unknown >= 0)
307 jacobian(local_eqn,local_unknown)
308 -= (1.+
Gamma[
i])*(psif[l2]/pow(interpolated_x[0],2.))*testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
310 jacobian(local_eqn,local_unknown)
311 -= (1.+
Gamma[
i])*dpsifdx(l2,0)*dtestfdx(l,0)*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
313 jacobian(local_eqn,local_unknown)
314 -= (1./(interpolated_x[0]*Alpha))*dpsifdx(l2,1)*(1./(interpolated_x[0]*Alpha))*dtestfdx(l,1)*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
317 jacobian(local_eqn,local_unknown)
318 -= Re*(psif[l2]*interpolated_dudx(0,0)+interpolated_u[0]*dpsifdx(l2,0)
319 +(interpolated_u[1]/(interpolated_x[0]*Alpha))*dpsifdx(l2,1))*testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
324 mass_matrix(local_eqn, local_unknown) +=
325 Re_St*psif[l2]*testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
342 hang_weight2 = hang_info2_pt->master_weight(m2);
351 if(local_unknown >= 0)
354 jacobian(local_eqn,local_unknown)
355 -= ((1.+
Gamma[
i])/(pow(interpolated_x[0],2.)*Alpha))*dpsifdx(l2,1)*testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
357 jacobian(local_eqn,local_unknown)
358 -= (-(psif[l2]/interpolated_x[0])+
Gamma[i]*dpsifdx(l2,0))
359 *(1./(interpolated_x[0]*Alpha))*dtestfdx(l,1)*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
362 jacobian(local_eqn,local_unknown)
363 -= Re*((psif[l2]/(interpolated_x[0]*Alpha))*interpolated_dudx(0,1)-2*interpolated_u[1]*(psif[l2]/interpolated_x[0]))
364 *testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
374 for(
unsigned l2=0;l2<n_pres;l2++)
377 if(pressure_dof_is_hanging[l2])
383 n_master2 = hang_info2_pt->
nmaster();
392 for(
unsigned m2=0;m2<n_master2;m2++)
396 if(pressure_dof_is_hanging[l2])
403 hang_weight2 = hang_info2_pt->master_weight(m2);
412 if(local_unknown >= 0)
414 jacobian(local_eqn,local_unknown)
415 += (psip[l2]/interpolated_x[0])*testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
417 jacobian(local_eqn,local_unknown)
418 += psip[l2]*dtestfdx(l,0)*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
455 residuals[local_eqn] += ((1./(pow(interpolated_x[0],2.)*Alpha))*interpolated_dudx(0,1)
456 -(interpolated_u[1]/pow(interpolated_x[0],2.))
457 +
Gamma[i]*(1./interpolated_x[0])*interpolated_dudx(1,0))
458 *testf[l]*interpolated_x[0]*Alpha*W*hang_weight;
461 residuals[local_eqn] -= (interpolated_dudx(1,0)
462 +
Gamma[
i]*((1./(interpolated_x[0]*Alpha))*interpolated_dudx(0,1)-(interpolated_u[1]/interpolated_x[0])))
463 *dtestfdx(l,0)*interpolated_x[0]*Alpha*W*hang_weight;
466 residuals[local_eqn] += (interpolated_p
467 -(1.+
Gamma[
i])*((1./(interpolated_x[0]*Alpha))*interpolated_dudx(1,1)+(interpolated_u[0]/interpolated_x[0])))
468 *(1./(interpolated_x[0]*Alpha))*dtestfdx(l,1)*interpolated_x[0]*Alpha*W*hang_weight;
471 residuals[local_eqn] -= Re*(interpolated_u[0]*interpolated_dudx(1,0)
472 +(interpolated_u[1]/(interpolated_x[0]*Alpha))*interpolated_dudx(1,1)
473 +((interpolated_u[0]*interpolated_u[1])/interpolated_x[0]))
474 *testf[l]*interpolated_x[0]*Alpha*W*hang_weight;
480 unsigned n_master2=1;
double hang_weight2=1.0;
483 for(
unsigned l2=0;l2<n_node;l2++)
493 n_master2 = hang_info2_pt->
nmaster();
502 for(
unsigned m2=0;m2<n_master2;m2++)
517 hang_weight2 = hang_info2_pt->master_weight(m2);
526 if(local_unknown >= 0)
529 jacobian(local_eqn,local_unknown)
530 += (1./(pow(interpolated_x[0],2.)*Alpha))*dpsifdx(l2,1)
531 *testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
533 jacobian(local_eqn,local_unknown)
534 -=
Gamma[
i]*(1./(interpolated_x[0]*Alpha))*dpsifdx(l2,1)
535 *dtestfdx(l,0)*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
537 jacobian(local_eqn,local_unknown)
538 -= (1+
Gamma[
i])*(psif[l2]/interpolated_x[0])*(1./(interpolated_x[0]*Alpha))
539 *dtestfdx(l,1)*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
542 jacobian(local_eqn,local_unknown)
543 -= Re*(psif[l2]*interpolated_dudx(1,0)+(psif[l2]*interpolated_u[1]/interpolated_x[0]))
544 *testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
560 hang_weight2 = hang_info2_pt->master_weight(m2);
569 if(local_unknown >= 0)
572 jacobian(local_eqn,local_unknown)
573 += (-(psif[l2]/pow(interpolated_x[0],2.))+
Gamma[i]*(1./interpolated_x[0])*dpsifdx(l2,0))
574 *testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
576 jacobian(local_eqn,local_unknown)
577 -= (dpsifdx(l2,0)-
Gamma[
i]*(psif[l2]/interpolated_x[0]))
578 *dtestfdx(l,0)*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
580 jacobian(local_eqn,local_unknown)
581 -= (1.+
Gamma[
i])*(1./(interpolated_x[0]*Alpha))*dpsifdx(l2,1)
582 *(1./(interpolated_x[0]*Alpha))*dtestfdx(l,1)*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
585 jacobian(local_eqn,local_unknown)
586 -= Re*(interpolated_u[0]*dpsifdx(l2,0)+(psif[l2]/(interpolated_x[0]*Alpha))*interpolated_dudx(1,1)
587 +(interpolated_u[1]/(interpolated_x[0]*Alpha))*dpsifdx(l2,1)+(interpolated_u[0]*psif[l2]/interpolated_x[0]))
588 *testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
593 mass_matrix(local_eqn, local_unknown)
594 += Re_St*psif[l2]*testf[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
605 for(
unsigned l2=0;l2<n_pres;l2++)
608 if(pressure_dof_is_hanging[l2])
614 n_master2 = hang_info2_pt->
nmaster();
623 for(
unsigned m2=0;m2<n_master2;m2++)
627 if(pressure_dof_is_hanging[l2])
634 hang_weight2 = hang_info2_pt->master_weight(m2);
644 if(local_unknown >= 0)
646 jacobian(local_eqn,local_unknown)
647 += (psip[l2]/interpolated_x[0])*(1./Alpha)*dtestfdx(l,1)*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
667 for(
unsigned l=0;l<n_pres;l++)
670 if(pressure_dof_is_hanging[l])
676 n_master = hang_info_pt->
nmaster();
685 for(
unsigned m=0;m<n_master;m++)
689 if(pressure_dof_is_hanging[l])
706 residuals[local_eqn] += (interpolated_dudx(0,0)+(interpolated_u[0]/interpolated_x[0])+(1./(interpolated_x[0]*Alpha))*interpolated_dudx(1,1))
707 *testp[l]*interpolated_x[0]*Alpha*W*hang_weight;
712 unsigned n_master2=1;
double hang_weight2=1.0;
714 for(
unsigned l2=0;l2<n_node;l2++)
724 n_master2 = hang_info2_pt->
nmaster();
733 for(
unsigned m2=0;m2<n_master2;m2++)
746 hang_weight2 = hang_info2_pt->master_weight(m2);
754 if(local_unknown >= 0)
756 jacobian(local_eqn,local_unknown)
757 += (dpsifdx(l2,0)+(psif[l2]/interpolated_x[0]))*testp[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
771 hang_weight2 = hang_info2_pt->master_weight(m2);
780 if(local_unknown >= 0)
782 jacobian(local_eqn,local_unknown)
783 += (1./(interpolated_x[0]*Alpha))*dpsifdx(l2,1)*testp[l]*interpolated_x[0]*Alpha*W*hang_weight*hang_weight2;
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 unsigned npres_pnst() const =0
Function to return number of pressure degrees of freedom.
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 const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
const double & alpha() const
Alpha.
unsigned nmaster() const
Return the number of master nodes.
virtual void pshape_pnst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
virtual double p_pnst(const unsigned &n_p) const =0
Pressure at local pressure "node" n_p Uses suitably interpolated value for hanging nodes...
bool is_hanging() const
Test whether the node is geometrically hanging.
virtual void fill_in_generic_residual_contribution(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...
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
virtual int p_nodal_index_pnst()
Which nodal value represents the pressure? (Default: negative, indicating that pressure is not based ...
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.
virtual unsigned u_index_pnst(const unsigned &i) const
Return the index at which the i-th unknown velocity component.
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
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.
const double & re() const
Reynolds number.
virtual double dshape_and_dtest_eulerian_at_knot_pnst(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...
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...
virtual int p_local_eqn(const unsigned &n)=0
Access function for the local equation number information for the pressure. p_local_eqn[n] = local eq...
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
unsigned nnode() const
Return the number of nodes.
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...