50 const unsigned n_node =
nnode();
56 const unsigned n_veloc = 4 * DIM;
59 unsigned u_nodal_index[n_veloc];
60 for (
unsigned i = 0;
i < n_veloc; ++
i)
68 for (
unsigned i = 0;
i < 2;
i++)
75 bool pressure_dof_is_hanging[n_pres];
81 for (
unsigned l = 0; l < n_pres; ++l)
83 pressure_dof_is_hanging[l] =
90 for (
unsigned l = 0; l < n_pres; ++l)
92 pressure_dof_is_hanging[l] =
false;
98 Shape psif(n_node), testf(n_node);
99 DShape dpsifdx(n_node, DIM), dtestfdx(n_node, DIM);
102 Shape psip(n_pres), testp(n_pres);
116 const double eval_real =
lambda();
117 const double eval_imag =
omega();
119 const std::complex<double> eigenvalue(eval_real, eval_imag);
128 for (
unsigned ipt = 0; ipt < n_intpt; ipt++)
131 for (
unsigned i = 0;
i < DIM;
i++)
142 ipt, psif, dpsifdx, testf, dtestfdx);
149 const double W = w * J;
162 for (
unsigned i = 0;
i < DIM; ++
i)
164 interpolated_u[
i].real(0.0);
165 interpolated_u[
i].imag(0.0);
166 interpolated_u_normalisation[
i].real(0.0);
167 interpolated_u_normalisation[
i].imag(0.0);
171 std::complex<double> interpolated_p(0.0, 0.0);
172 std::complex<double> interpolated_p_normalisation(0.0, 0.0);
177 for (
unsigned i = 0;
i < DIM; ++
i)
179 interpolated_dudx[
i].resize(DIM);
180 for (
unsigned j = 0; j < DIM; ++j)
182 interpolated_dudx[
i][j].real(0.0);
183 interpolated_dudx[
i][j].imag(0.0);
192 for (
unsigned l = 0; l < n_pres; l++)
195 const double psip_ = psip(l);
202 interpolated_p += p_value * psip_;
207 interpolated_p_normalisation += p_norm_value * psip_;
215 for (
unsigned l = 0; l < n_node; l++)
218 const double psif_ = psif(l);
221 for (
unsigned i = 0;
i < DIM;
i++)
227 for (
unsigned i = 0;
i < DIM;
i++)
230 const std::complex<double> u_value(
235 interpolated_u[
i] += u_value * psif_;
241 for (
unsigned j = 0; j < DIM; j++)
243 interpolated_dudx[
i][j] += u_value * dpsifdx(l, j);
247 const std::complex<double> normalisation_value(
249 this->
nodal_value(l, u_nodal_index[2 * (DIM +
i) + 1]));
250 interpolated_u_normalisation[
i] += normalisation_value * psif_;
294 unsigned n_master = 1;
297 double hang_weight = 1.0;
300 for (
unsigned l = 0; l < n_node; l++)
310 n_master = hang_info_pt->
nmaster();
319 for (
unsigned m = 0; m < n_master; m++)
322 for (
unsigned i = 0;
i < DIM;
i++)
326 std::complex<double> residual_contribution =
327 -scaled_re_st * eigenvalue * interpolated_u[
i] * testf[l] *
W;
329 residual_contribution += interpolated_p * dtestfdx(l,
i) *
W;
331 for (
unsigned k = 0; k < DIM; ++k)
333 residual_contribution -=
335 (interpolated_dudx[
i][k] +
Gamma[
i] * interpolated_dudx[k][
i]) *
340 for (
unsigned k = 0; k < DIM; ++k)
342 residual_contribution -=
344 (base_flow_u[k] * interpolated_dudx[
i][k] +
345 interpolated_u[k] * base_flow_dudx(
i, k)) *
354 u_nodal_index[2 *
i]);
366 residuals[local_eqn] +=
367 residual_contribution.real() * hang_weight;
374 u_nodal_index[2 *
i + 1]);
385 residuals[local_eqn] +=
386 residual_contribution.imag() * hang_weight;
480 for (
unsigned l = 0; l < n_pres; l++)
482 if (pressure_dof_is_hanging[l])
485 n_master = hang_info_pt->
nmaster();
493 for (
unsigned m = 0; m < n_master; ++m)
496 std::complex<double> residual_contribution = 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;
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
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.
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,...
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...
const double & re() const
Reynolds number.
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....
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
virtual void pshape_linearised_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
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.
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...
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...
int eigenvalue_local_eqn(const unsigned &i)
const double & lambda() const
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....
const double & viscosity_ratio() const
Viscosity ratio for element: element's viscosity relative to the viscosity used in the definition of ...
const double & omega() const
virtual int p_index_linearised_nst(const unsigned &i) const
Which nodal value represents the pressure?
const double & density_ratio() const
Density ratio for element: element's density relative to the viscosity used in the definition of the ...
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.
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 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...
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...
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
double & time()
Return current value of continous time.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...