55 const unsigned n_node =
nnode();
61 const unsigned n_veloc = 4*DIM;
64 unsigned u_nodal_index[n_veloc];
65 for(
unsigned i=0;
i<n_veloc;++
i)
73 for(
unsigned i=0;
i<2;
i++)
80 bool pressure_dof_is_hanging[n_pres];
86 for(
unsigned l=0;l<n_pres;++l)
88 pressure_dof_is_hanging[l] =
95 for(
unsigned l=0;l<n_pres;++l)
97 pressure_dof_is_hanging[l] =
false;
103 Shape psif(n_node), testf(n_node);
104 DShape dpsifdx(n_node,DIM), dtestfdx(n_node,DIM);
107 Shape psip(n_pres), testp(n_pres);
121 const double eval_real =
lambda();
122 const double eval_imag =
omega();
124 const std::complex<double> eigenvalue(eval_real,eval_imag);
133 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
152 const double W = w*J;
165 for(
unsigned i=0;
i<DIM;++
i)
167 interpolated_u[
i].real(0.0); interpolated_u[
i].imag(0.0);
168 interpolated_u_normalisation[
i].real(0.0);
169 interpolated_u_normalisation[
i].imag(0.0);
173 std::complex<double> interpolated_p(0.0,0.0);
174 std::complex<double> interpolated_p_normalisation(0.0,0.0);
179 for(
unsigned i=0;
i<DIM;++
i)
181 interpolated_dudx[
i].resize(DIM);
182 for(
unsigned j=0;j<DIM;++j)
184 interpolated_dudx[
i][j].real(0.0);
185 interpolated_dudx[
i][j].imag(0.0);
194 for(
unsigned l=0;l<n_pres;l++)
197 const double psip_ = psip(l);
200 const std::complex<double>
204 interpolated_p += p_value*psip_;
207 const std::complex<double>
209 interpolated_p_normalisation += p_norm_value*psip_;
217 for(
unsigned l=0;l<n_node;l++)
220 const double psif_ = psif(l);
223 for(
unsigned i=0;
i<DIM;
i++)
229 for(
unsigned i=0;
i<DIM;
i++)
232 const std::complex<double>
237 interpolated_u[
i] += u_value*psif_;
243 for(
unsigned j=0;j<DIM;j++)
245 interpolated_dudx[
i][j] += u_value*dpsifdx(l,j);
249 const std::complex<double>
250 normalisation_value(this->
nodal_value(l,u_nodal_index[2*(DIM+
i)]),
252 u_nodal_index[2*(DIM+
i)+1]));
253 interpolated_u_normalisation[
i] += normalisation_value*psif_;
297 unsigned n_master = 1;
300 double hang_weight = 1.0;
303 for(
unsigned l=0;l<n_node;l++)
313 n_master = hang_info_pt->
nmaster();
322 for(
unsigned m=0;m<n_master;m++)
325 for(
unsigned i=0;
i<DIM;
i++)
329 std::complex<double> residual_contribution
330 = -scaled_re_st*eigenvalue*interpolated_u[
i]*testf[l]*
W;
332 residual_contribution += interpolated_p*dtestfdx(l,
i)*
W;
334 for(
unsigned k=0;k<DIM;++k)
336 residual_contribution -= visc_ratio*
337 (interpolated_dudx[
i][k] +
Gamma[
i]*interpolated_dudx[k][
i])*
342 for(
unsigned k=0;k<DIM;++k)
344 residual_contribution -= scaled_re*(
345 base_flow_u[k]*interpolated_dudx[
i][k]
346 + interpolated_u[k]*base_flow_dudx(
i,k))*testf[l]*W;
366 residuals[local_eqn] += residual_contribution.real()*hang_weight;
373 u_nodal_index[2*
i+1]);
384 residuals[local_eqn] += residual_contribution.imag()*hang_weight;
479 for(
unsigned l=0;l<n_pres;l++)
481 if(pressure_dof_is_hanging[l])
484 n_master = hang_info_pt->
nmaster();
492 for(
unsigned m=0;m<n_master;++m)
495 std::complex<double> residual_contribution
496 = interpolated_dudx[0][0];
497 for(
unsigned k=1;k<DIM;++k)
499 residual_contribution += interpolated_dudx[k][k];
502 if(pressure_dof_is_hanging[l])
517 residuals[local_eqn] +=
518 residual_contribution.real()*testp[l]*W*hang_weight;
521 if(pressure_dof_is_hanging[l])
536 residuals[local_eqn] +=
537 residual_contribution.imag()*testp[l]*W*hang_weight;
545 std::complex<double> residual_contribution =
546 interpolated_p_normalisation*interpolated_p;
547 for(
unsigned k=0;k<DIM;++k)
549 residual_contribution +=
550 interpolated_u_normalisation[k]*interpolated_u[k];
556 residuals[local_eqn] += residual_contribution.real()*
W;
562 residuals[local_eqn] += residual_contribution.imag()*
W;
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 ...
int eigenvalue_local_eqn(const unsigned &i)
virtual double dshape_and_dtest_eulerian_at_knot_linearised_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
Compute the shape functions and their derivatives w.r.t. global coordinates at the ipt-th integration...
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 & time()
Return current value of continous time.
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
const double & density_ratio() const
Density ratio for element: element's density relative to the viscosity used in the definition of the ...
virtual double p_linearised_nst(const unsigned &n_p, const unsigned &i) const =0
Return the i-th pressure value at local pressure "node" n_p. Uses suitably interpolated value for han...
double const & master_weight(const unsigned &i) const
Return weight for dofs on i-th master node.
unsigned nmaster() const
Return the number of master nodes.
bool is_hanging() const
Test whether the node is geometrically hanging.
const double & lambda() const
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.
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
virtual unsigned u_index_linearised_nst(const unsigned &i) const
Return the index at which the i-th unknown velocity component is stored. The default value...
virtual void get_base_flow_dudx(const double &time, const unsigned &ipt, const Vector< double > &x, DenseMatrix< double > &result) const
Calculate the derivatives of the velocity components of the base flow solution w.r.t. global coordinates (r and z) at a given time and Eulerian position.
virtual double knot(const unsigned &i, const unsigned &j) const =0
Return local coordinate s[j] of i-th integration point.
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
virtual unsigned npres_linearised_nst() const =0
Return the number of pressure degrees of freedom associated with a single pressure component in the e...
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.
virtual void pshape_linearised_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
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 unsigned nweight() const =0
Return the number of integration points of the scheme.
virtual int p_index_linearised_nst(const unsigned &i) const
Which nodal value represents the pressure?
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
virtual int p_local_eqn(const unsigned &n, const unsigned &i)=0
Access function for the local equation number information for the i-th component of the pressure...
virtual void get_base_flow_u(const double &time, const unsigned &ipt, const Vector< double > &x, Vector< double > &result) const
Calculate the velocity components of the base flow solution at a given time and Eulerian position...
const double & re() const
Reynolds number.
const double & viscosity_ratio() const
Viscosity ratio for element: element's viscosity relative to the viscosity used in the definition of ...
unsigned nnode() const
Return the number of nodes.
const double & omega() const
void fill_in_generic_residual_contribution_linearised_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 flag=1: compute bo...
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...