46 int LinearisedNavierStokesEquations::
47 Pressure_not_stored_at_node = -100;
50 double LinearisedNavierStokesEquations::
51 Default_Physical_Constant_Value = 0.0;
54 double LinearisedNavierStokesEquations::
55 Default_Physical_Ratio_Value = 1.0;
66 std::ostream &outfile,
const unsigned &nplot,
const unsigned &
t)
69 const unsigned n_node =
nnode();
87 for(
unsigned iplot=0;iplot<n_plot_points;iplot++)
96 for(
unsigned i=0;
i<DIM;
i++)
99 interpolated_x[
i]=0.0;
102 for(
unsigned l=0;l<n_node;l++)
109 for(
unsigned i=0;
i<(2*DIM);
i++)
115 interpolated_u[
i]=0.0;
118 for(
unsigned l=0;l<n_node;l++)
120 interpolated_u[
i] +=
nodal_value(t,l,u_nodal_index)*psi[l];
125 for(
unsigned i=0;
i<DIM;
i++) { outfile << interpolated_x[
i] <<
" "; }
128 for(
unsigned i=0;
i<(2*DIM);
i++) { outfile << interpolated_u[
i] <<
" "; }
130 outfile << std::endl;
147 std::ostream &outfile,
const unsigned &nplot)
159 for(
unsigned iplot=0;iplot<n_plot_points;iplot++)
168 for(
unsigned i=0;
i<(4*DIM);
i++)
174 for(
unsigned i=0;
i<2;
i++)
179 outfile << std::endl;
181 outfile << std::endl;
197 FILE* file_pt,
const unsigned &nplot)
209 for(
unsigned iplot=0;iplot<n_plot_points;iplot++)
218 for(
unsigned i=0;
i<(2*DIM);
i++)
224 for(
unsigned i=0;
i<2;
i++)
229 fprintf(file_pt,
"\n");
232 fprintf(file_pt,
"\n");
250 const unsigned &real)
const 253 if ((strainrate.
ncol()!=DIM)||(strainrate.
nrow()!=DIM))
255 std::ostringstream error_message;
256 error_message <<
"The strain rate has incorrect dimensions " 257 << strainrate.
ncol() <<
" x " 258 << strainrate.
nrow() <<
" Not " << DIM << std::endl;
261 OOMPH_CURRENT_FUNCTION,
262 OOMPH_EXCEPTION_LOCATION);
271 double cosomegat = 1.0/sqrt(2.0);
272 double sinomegat = cosomegat;
275 unsigned n_node =
nnode();
279 DShape dpsifdx(n_node,DIM);
287 for(
unsigned i=0;
i<DIM;++
i)
290 for(
unsigned j=0;j<DIM;++j)
292 dudx[
i][j].real(0.0);
293 dudx[
i][j].imag(0.0);
298 unsigned n_veloc = 2*DIM;
299 unsigned u_nodal_index[n_veloc];
300 for(
unsigned i=0;
i<n_veloc;++
i)
306 for(
unsigned l=0;l<n_node;l++)
309 for(
unsigned i=0;
i<DIM;
i++)
312 const std::complex<double>
317 for(
unsigned j=0;j<DIM;j++)
319 dudx[
i][j] += u_value*dpsifdx(l,j);
326 if(real==0) {cosomegat = 1.0; sinomegat = 0.0;}
327 else {cosomegat = 0.0; sinomegat = 1.0;}
329 for(
unsigned i=0;
i<DIM;++
i)
331 for(
unsigned j=0;j<DIM;++j)
334 dudx[
i][j].real()*cosomegat + dudx[
i][j].imag()*sinomegat;
342 for(
unsigned i=0;
i<DIM;
i++)
345 for(
unsigned j=0;j<DIM;j++)
347 strainrate(
i,j)=0.5*(real_dudx(
i,j)+real_dudx(j,
i));
370 const unsigned n_node =
nnode();
376 const unsigned n_veloc = 4*DIM;
379 unsigned u_nodal_index[n_veloc];
380 for(
unsigned i=0;
i<n_veloc;++
i)
386 Shape psif(n_node), testf(n_node);
387 DShape dpsifdx(n_node,DIM), dtestfdx(n_node,DIM);
390 Shape psip(n_pres), testp(n_pres);
404 const double eval_real =
lambda();
405 const double eval_imag =
omega();
407 const std::complex<double> eigenvalue(eval_real,eval_imag);
413 for(
unsigned ipt=0;ipt<n_intpt;ipt++)
432 const double W = w*J;
445 for(
unsigned i=0;
i<DIM;++
i)
447 interpolated_u[
i].real(0.0); interpolated_u[
i].imag(0.0);
448 interpolated_u_normalisation[
i].real(0.0);
449 interpolated_u_normalisation[
i].imag(0.0);
453 std::complex<double> interpolated_p(0.0,0.0);
454 std::complex<double> interpolated_p_normalisation(0.0,0.0);
459 for(
unsigned i=0;
i<DIM;++
i)
461 interpolated_dudx[
i].resize(DIM);
462 for(
unsigned j=0;j<DIM;++j)
464 interpolated_dudx[
i][j].real(0.0);
465 interpolated_dudx[
i][j].imag(0.0);
474 for(
unsigned l=0;l<n_pres;l++)
477 const double psip_ = psip(l);
480 const std::complex<double>
484 interpolated_p += p_value*psip_;
487 const std::complex<double>
489 interpolated_p_normalisation += p_norm_value*psip_;
497 for(
unsigned l=0;l<n_node;l++)
500 const double psif_ = psif(l);
503 for(
unsigned i=0;
i<DIM;
i++)
509 for(
unsigned i=0;
i<DIM;
i++)
512 const std::complex<double>
517 interpolated_u[
i] += u_value*psif_;
523 for(
unsigned j=0;j<DIM;j++)
525 interpolated_dudx[
i][j] += u_value*dpsifdx(l,j);
529 const std::complex<double>
532 u_nodal_index[2*(DIM+
i)+1]));
533 interpolated_u_normalisation[
i] += normalisation_value*psif_;
577 for(
unsigned l=0;l<n_node;l++)
580 for(
unsigned i=0;
i<DIM;
i++)
584 std::complex<double> residual_contribution
585 = -scaled_re_st*eigenvalue*interpolated_u[
i]*testf[l]*
W;
587 residual_contribution += interpolated_p*dtestfdx(l,
i)*
W;
589 for(
unsigned k=0;k<DIM;++k)
591 residual_contribution -= visc_ratio*
592 (interpolated_dudx[
i][k] +
Gamma[
i]*interpolated_dudx[k][
i])*
597 for(
unsigned k=0;k<DIM;++k)
599 residual_contribution -= scaled_re*(
600 base_flow_u[k]*interpolated_dudx[
i][k]
601 + interpolated_u[k]*base_flow_dudx(
i,k))*testf[l]*W;
612 residuals[local_eqn] += residual_contribution.real();
618 residuals[local_eqn] += residual_contribution.imag();
712 for(
unsigned l=0;l<n_pres;l++)
715 std::complex<double> residual_contribution
716 = interpolated_dudx[0][0];
717 for(
unsigned k=1;k<DIM;++k)
719 residual_contribution += interpolated_dudx[k][k];
726 residuals[local_eqn] += residual_contribution.real()*testp[l]*
W;
733 residuals[local_eqn] += residual_contribution.imag()*testp[l]*
W;
739 std::complex<double> residual_contribution =
740 interpolated_p_normalisation*interpolated_p;
741 for(
unsigned k=0;k<DIM;++k)
743 residual_contribution +=
744 interpolated_u_normalisation[k]*interpolated_u[k];
750 residuals[local_eqn] += residual_contribution.real()*
W;
756 residuals[local_eqn] += residual_contribution.imag()*
W;
777 const unsigned LinearisedQCrouzeixRaviartElement::
778 Initial_Nvalue[9]={8,8,8,8,8,8,8,8,8};
802 const unsigned LinearisedQTaylorHoodElement::
803 Initial_Nvalue[9]={12,8,12,8,8,8,12,8,12};
810 const unsigned LinearisedQTaylorHoodElement::
virtual std::string tecplot_zone_string(const unsigned &nplot) const
Return string for tecplot zone header (when plotting nplot points in each "coordinate direction") ...
int eigenvalue_local_eqn(const unsigned &i)
double raw_nodal_value(const unsigned &n, const unsigned &i) const
Return the i-th value stored at local node n but do NOT take hanging nodes into account.
unsigned long nrow() const
Return the number of rows of the matrix.
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...
unsigned long ncol() const
Return the number of columns of the matrix.
virtual void get_s_plot(const unsigned &i, const unsigned &nplot, Vector< double > &s, const bool &shifted_to_interior=false) const
Get cector of local coordinates of plot point i (when plotting nplot points in each "coordinate direc...
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 ...
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...
const double & lambda() const
virtual unsigned required_nvalue(const unsigned &n) const
Return number of values (pinned or dofs) required at local node n.
virtual double weight(const unsigned &i) const =0
Return weight of i-th integration point.
double interpolated_p_linearised_nst(const Vector< double > &s, const unsigned &i) const
Return the i-th component of the FE interpolated pressure p[i] at local coordinate s...
virtual unsigned nplot_points(const unsigned &nplot) const
Return total number of plot points (when plotting nplot points in each "coordinate direction") ...
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Compute the geometric shape functions and also first derivatives w.r.t. global coordinates at local c...
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.
virtual void write_tecplot_zone_footer(std::ostream &outfile, const unsigned &nplot) const
Add tecplot zone "footer" to output stream (when plotting nplot points in each "coordinate direction"...
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
virtual void fill_in_generic_residual_contribution_linearised_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Compute the residuals for the Navier-Stokes equations; flag=1(or 0): do (or don't) compute the Jacobi...
void output(std::ostream &outfile)
Output function: r, z, U^C, U^S, V^C, V^S, W^C, W^S, P^C, P^S in tecplot format. Default number of pl...
virtual unsigned npres_linearised_nst() const =0
Return the number of pressure degrees of freedom associated with a single pressure component in the e...
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate, const unsigned &real) const
Strain-rate tensor: where (in that order)
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 void pshape_linearised_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
double interpolated_u_linearised_nst(const Vector< double > &s, const unsigned &i) const
Compute the element's residual Vector and the jacobian matrix. Virtual function can be overloaded by ...
double raw_nodal_position(const unsigned &n, const unsigned &i) const
Return the i-th coordinate at local node n. Do not use the hanging node representation. NOTE: Moved to cc file because of a possible compiler bug in gcc (yes, really!). The move to the cc file avoids inlining which appears to cause problems (only) when compiled with gcc and -O3; offensive "illegal read" is in optimised-out section of code and data that is allegedly illegal is readily readable (by other means) just before this function is called so I can't really see how we could possibly be responsible for this...
virtual unsigned nweight() const =0
Return the number of integration points of the scheme.
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
void output_veloc(std::ostream &outfile, const unsigned &nplot, const unsigned &t)
Output function: r, z, U^C, U^S, V^C, V^S, W^C, W^S, in tecplot format. nplot points in each coordina...
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
virtual void shape(const Vector< double > &s, Shape &psi) const =0
Calculate the geometric shape functions at local coordinate s. This function must be overloaded for e...
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...