54 unsigned n_node =
nnode();
60 unsigned u_nodal_index[2];
61 for (
unsigned i = 0;
i < 2;
i++)
72 bool pressure_dof_is_hanging[n_pres];
77 for (
unsigned l = 0; l < n_pres; ++l)
85 for (
unsigned l = 0; l < n_pres; ++l)
87 pressure_dof_is_hanging[l] =
false;
92 Shape psif(n_node), testf(n_node);
93 DShape dpsifdx(n_node, 2), dtestfdx(n_node, 2);
96 Shape psip(n_pres), testp(n_pres);
105 const double Re =
re();
106 const double Alpha =
alpha();
107 const double Re_St =
re_st();
110 int local_eqn = 0, local_unknown = 0;
113 HangInfo *hang_info_pt = 0, *hang_info2_pt = 0;
116 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
125 ipt, psif, dpsifdx, testf, dtestfdx);
135 double interpolated_p = 0.0;
142 for (
unsigned i = 0;
i < 2;
i++)
145 interpolated_u[
i] = 0.0;
147 for (
unsigned j = 0; j < 2; j++)
149 interpolated_dudx(
i, j) = 0.0;
154 for (
unsigned l = 0; l < n_pres; l++)
155 interpolated_p += this->
p_pnst(l) * psip[l];
160 for (
unsigned l = 0; l < n_node; l++)
163 for (
unsigned i = 0;
i < 2;
i++)
166 double u_value = this->
nodal_value(l, u_nodal_index[
i]);
167 interpolated_u[
i] += u_value * psif[l];
172 for (
unsigned j = 0; j < 2; j++)
174 interpolated_dudx(
i, j) += u_value * dpsifdx(l, j);
182 unsigned n_master = 1;
183 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++)
233 residuals[local_eqn] +=
236 ((1. / Alpha) * interpolated_dudx(1, 1) +
237 interpolated_u[0])) *
241 residuals[local_eqn] +=
242 (interpolated_p - (1. +
Gamma[
i]) * interpolated_dudx(0, 0)) *
246 residuals[local_eqn] -=
249 Gamma[
i] * interpolated_dudx(1, 0)) *
254 residuals[local_eqn] -=
256 (interpolated_u[0] * interpolated_dudx(0, 0) +
258 interpolated_dudx(0, 1) -
267 unsigned n_master2 = 1;
268 double hang_weight2 = 1.0;
270 for (
unsigned l2 = 0; l2 < n_node; l2++)
276 if (is_node2_hanging)
280 n_master2 = hang_info2_pt->
nmaster();
289 for (
unsigned m2 = 0; m2 < n_master2; m2++)
297 if (is_node2_hanging)
301 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
303 hang_weight2 = hang_info2_pt->master_weight(m2);
313 if (local_unknown >= 0)
316 jacobian(local_eqn, local_unknown) -=
322 jacobian(local_eqn, local_unknown) -=
323 (1. +
Gamma[
i]) * dpsifdx(l2, 0) * dtestfdx(l, 0) *
327 jacobian(local_eqn, local_unknown) -=
334 jacobian(local_eqn, local_unknown) -=
336 (psif[l2] * interpolated_dudx(0, 0) +
337 interpolated_u[0] * dpsifdx(l2, 0) +
341 hang_weight * hang_weight2;
346 mass_matrix(local_eqn, local_unknown) +=
348 Alpha *
W * hang_weight * hang_weight2;
359 if (is_node2_hanging)
363 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
365 hang_weight2 = hang_info2_pt->master_weight(m2);
375 if (local_unknown >= 0)
378 jacobian(local_eqn, local_unknown) -=
382 Alpha *
W * hang_weight * hang_weight2;
384 jacobian(local_eqn, local_unknown) -=
386 Gamma[
i] * dpsifdx(l2, 0)) *
392 jacobian(local_eqn, local_unknown) -=
395 interpolated_dudx(0, 1) -
396 2 * interpolated_u[1] *
399 hang_weight * hang_weight2;
410 for (
unsigned l2 = 0; l2 < n_pres; l2++)
413 if (pressure_dof_is_hanging[l2])
419 n_master2 = hang_info2_pt->
nmaster();
428 for (
unsigned m2 = 0; m2 < n_master2; m2++)
432 if (pressure_dof_is_hanging[l2])
436 hang_info2_pt->master_node_pt(m2), p_index);
438 hang_weight2 = hang_info2_pt->master_weight(m2);
447 if (local_unknown >= 0)
449 jacobian(local_eqn, local_unknown) +=
454 jacobian(local_eqn, local_unknown) +=
456 W * hang_weight * hang_weight2;
494 residuals[local_eqn] +=
496 interpolated_dudx(0, 1) -
499 interpolated_dudx(1, 0)) *
503 residuals[local_eqn] -=
504 (interpolated_dudx(1, 0) +
506 interpolated_dudx(0, 1) -
511 residuals[local_eqn] +=
514 interpolated_dudx(1, 1) +
520 residuals[local_eqn] -=
522 (interpolated_u[0] * interpolated_dudx(1, 0) +
524 interpolated_dudx(1, 1) +
525 ((interpolated_u[0] * interpolated_u[1]) /
533 unsigned n_master2 = 1;
534 double hang_weight2 = 1.0;
537 for (
unsigned l2 = 0; l2 < n_node; l2++)
543 if (is_node2_hanging)
547 n_master2 = hang_info2_pt->
nmaster();
556 for (
unsigned m2 = 0; m2 < n_master2; m2++)
564 if (is_node2_hanging)
568 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
570 hang_weight2 = hang_info2_pt->master_weight(m2);
580 if (local_unknown >= 0)
583 jacobian(local_eqn, local_unknown) +=
586 Alpha *
W * hang_weight * hang_weight2;
588 jacobian(local_eqn, local_unknown) -=
591 Alpha *
W * hang_weight * hang_weight2;
593 jacobian(local_eqn, local_unknown) -=
600 jacobian(local_eqn, local_unknown) -=
602 (psif[l2] * interpolated_dudx(1, 0) +
605 hang_weight * hang_weight2;
615 if (is_node2_hanging)
619 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
621 hang_weight2 = hang_info2_pt->master_weight(m2);
631 if (local_unknown >= 0)
634 jacobian(local_eqn, local_unknown) +=
639 hang_weight * hang_weight2;
641 jacobian(local_eqn, local_unknown) -=
645 hang_weight * hang_weight2;
647 jacobian(local_eqn, local_unknown) -=
651 hang_weight * hang_weight2;
654 jacobian(local_eqn, local_unknown) -=
656 (interpolated_u[0] * dpsifdx(l2, 0) +
658 interpolated_dudx(1, 1) +
663 hang_weight * hang_weight2;
668 mass_matrix(local_eqn, local_unknown) +=
670 Alpha *
W * hang_weight * hang_weight2;
682 for (
unsigned l2 = 0; l2 < n_pres; l2++)
685 if (pressure_dof_is_hanging[l2])
691 n_master2 = hang_info2_pt->
nmaster();
700 for (
unsigned m2 = 0; m2 < n_master2; m2++)
704 if (pressure_dof_is_hanging[l2])
708 hang_info2_pt->master_node_pt(m2), p_index);
710 hang_weight2 = hang_info2_pt->master_weight(m2);
720 if (local_unknown >= 0)
722 jacobian(local_eqn, local_unknown) +=
725 hang_weight * hang_weight2;
746 for (
unsigned l = 0; l < n_pres; l++)
749 if (pressure_dof_is_hanging[l])
755 n_master = hang_info_pt->
nmaster();
764 for (
unsigned m = 0; m < n_master; m++)
768 if (pressure_dof_is_hanging[l])
785 residuals[local_eqn] +=
786 (interpolated_dudx(0, 0) +
794 unsigned n_master2 = 1;
795 double hang_weight2 = 1.0;
797 for (
unsigned l2 = 0; l2 < n_node; l2++)
803 if (is_node2_hanging)
807 n_master2 = hang_info2_pt->
nmaster();
816 for (
unsigned m2 = 0; m2 < n_master2; m2++)
822 if (is_node2_hanging)
826 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
827 hang_weight2 = hang_info2_pt->master_weight(m2);
836 if (local_unknown >= 0)
838 jacobian(local_eqn, local_unknown) +=
849 if (is_node2_hanging)
853 hang_info2_pt->master_node_pt(m2), u_nodal_index[i2]);
854 hang_weight2 = hang_info2_pt->master_weight(m2);
864 if (local_unknown >= 0)
866 jacobian(local_eqn, local_unknown) +=
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
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...
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
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.
unsigned nnode() const
Return the number of nodes.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
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 ...
Class that contains data for hanging nodes.
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
Node *const & master_node_pt(const unsigned &i) const
Return a pointer to the i-th master node.
unsigned nmaster() const
Return the number of master nodes.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
HangInfo *const & hanging_pt() const
Return pointer to hanging node data (this refers to the geometric hanging node status) (const version...
bool is_hanging() const
Test whether the node is geometrically hanging.
virtual void pshape_pnst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
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...
const double & alpha() const
Alpha.
virtual double p_pnst(const unsigned &n_p) const =0
Pressure at local pressure "node" n_p Uses suitably interpolated value for hanging nodes.
virtual int p_nodal_index_pnst()
Which nodal value represents the pressure? (Default: negative, indicating that pressure is not based ...
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 unsigned u_index_pnst(const unsigned &i) const
Return the index at which the i-th unknown velocity component is stored. The default value,...
const double & re() const
Reynolds number.
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
virtual unsigned npres_pnst() const =0
Function to return number of pressure degrees of freedom.
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 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 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...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...