polar_navier_stokes_elements.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // Created (18/03/08) by recopying from my_oomph-codes/polar_navier_stokes.h
27 // Now I know what I'm doing it needs updating to current oomph conventions.
28 
29 // 17/06/08 - Weakform adjusted to "correct" traction version
30 
31 // "_pnst" added to: - npres()
32 // - pshape()
33 // - u()
34 // - p()
35 // - du_dt()
36 // - interpolated_u()
37 // - interpolated_p()
38 // - interpolated_dudx()
39 // - dshape_and_dtest_eulerian()
40 // - dshape_and_dtest_eulerian_at_knot()
41 
42 // The following generality is necessary for elements with multiple physics.
43 // That is where we can't just assume that values one and two at the nodes
44 // are velocities and the third a pressure.
45 
46 // Then renamed "index_of_nodal_pressure_value to p_nodal_index_pnst.
47 
48 // Added u_index_pnst (by default just returns the value you give it)
49 
50 // The internal pressure data in Crouzeix Raviart elements is now stored
51 // as one data object with three values:
52 // Added P_pnst_internal_index which stores the index of that internal
53 // data, specified in the constructor.
54 // Adjusted: - p_pnst
55 // - fix_pressure
56 // - get_load_data
57 // To reflect this change in internal data storage.
58 
59 // Plus added Pressure_not_stored_at_node, default = -100.
60 
61 // assign_additional_local_eqn_numbers removed in favour of
62 // - p_local_eqn
63 // And we have:
64 // - local_eqn = nodal_local_eqn(l,u_nodal_index[i]);
65 // - local_eqn = p_local_eqn(l);
66 // in fill_in_generic_residual_contribution
67 
68 // Also removed the following functions for pinning/unpinning pressures
69 // as they're only needed in the refineable case:
70 //----------------------------------------------------------------------
71 // - unpin_all_nodal_pressure_dofs()
72 // - unpin_all_internal_pressure_dofs()
73 // - pin_all_nodal_pressure_dofs()
74 // - unpin_proper_nodal_pressure_dofs()
75 // - pin_redundant_nodal_pressures()
76 // - unpin_all_pressure_dofs()
77 // - pressure_dof_is_hanging()
78 //----------------------------------------------------------------------
79 
80 // strain_rate adapted to return the polar strain components.
81 
82 // interpolated positions / velocities now assembled using nodal_position
83 // and nodal_value - both of which should cope with hanging nodes.
84 
85 // Also stokes_output() added to compute convergence rates when exact
86 // (Stokes) solution is known.
87 
88 #ifndef OOMPH_POLAR_NAVIER_STOKES
89 #define OOMPH_POLAR_NAVIER_STOKES
90 
91 // Config header generated by autoconfig
92 #ifdef HAVE_CONFIG_H
93 #include <oomph-lib-config.h>
94 #endif
95 
96 // OOMPH-LIB headers
97 #include "../generic/Qelements.h"
98 
99 
100 namespace oomph
101 {
102  //=====================================================================
106  //======================================================================
108  {
109  public:
112  typedef void (*NavierStokesBodyForceFctPt)(const double& time,
113  const Vector<double>& x,
115 
118  typedef double (*NavierStokesSourceFctPt)(const double& time,
119  const Vector<double>& x);
120 
121  private:
125 
129 
133 
136 
137  protected:
138  // Physical constants
139 
143 
147 
148  // Pointers to global physical constants
149 
151  double* Alpha_pt;
152 
154  double* Re_pt;
155 
157  double* ReSt_pt;
158 
161  double* ReInvFr_pt;
162 
165 
168 
171 
175  virtual int p_local_eqn(const unsigned& n) = 0;
176 
181  Shape& psi,
182  DShape& dpsidx,
183  Shape& test,
184  DShape& dtestdx) const = 0;
185 
190  const unsigned& ipt,
191  Shape& psi,
192  DShape& dpsidx,
193  Shape& test,
194  DShape& dtestdx) const = 0;
195 
197  virtual void pshape_pnst(const Vector<double>& s, Shape& psi) const = 0;
198 
201  virtual void pshape_pnst(const Vector<double>& s,
202  Shape& psi,
203  Shape& test) const = 0;
204 
205 
207  void get_body_force(double time,
208  const Vector<double>& x,
209  Vector<double>& result)
210  {
211  // If the function pointer is zero return zero
212  if (Body_force_fct_pt == 0)
213  {
214  // Loop over dimensions and set body forces to zero
215  for (unsigned i = 0; i < 2; i++)
216  {
217  result[i] = 0.0;
218  }
219  }
220  // Otherwise call the function
221  else
222  {
223  (*Body_force_fct_pt)(time, x, result);
224  }
225  }
226 
229  double get_source_fct(double time, const Vector<double>& x)
230  {
231  // If the function pointer is zero return zero
232  if (Source_fct_pt == 0)
233  {
234  return 0;
235  }
236  // Otherwise call the function
237  else
238  {
239  return (*Source_fct_pt)(time, x);
240  }
241  }
242 
243  public:
246  {
247  // Set all the Physical parameter pointers to the default value zero
252  // Set the Physical ratios to the default value of 1
255  }
256 
258  // N.B. This needs to be public so that the intel compiler gets things
259  // correct somehow the access function messes things up when going to
260  // refineable navier--stokes
262 
263  // Access functions for the physical constants
264 
266  const double& re() const
267  {
268  return *Re_pt;
269  }
270 
272  const double& alpha() const
273  {
274  return *Alpha_pt;
275  }
276 
278  const double& re_st() const
279  {
280  return *ReSt_pt;
281  }
282 
284  double*& re_pt()
285  {
286  return Re_pt;
287  }
288 
290  double*& alpha_pt()
291  {
292  return Alpha_pt;
293  }
294 
296  double*& re_st_pt()
297  {
298  return ReSt_pt;
299  }
300 
303  const double& viscosity_ratio() const
304  {
305  return *Viscosity_Ratio_pt;
306  }
307 
310  {
311  return Viscosity_Ratio_pt;
312  }
313 
316  const double& density_ratio() const
317  {
318  return *Density_Ratio_pt;
319  }
320 
322  double*& density_ratio_pt()
323  {
324  return Density_Ratio_pt;
325  }
326 
328  const double& re_invfr() const
329  {
330  return *ReInvFr_pt;
331  }
332 
334  double*& re_invfr_pt()
335  {
336  return ReInvFr_pt;
337  }
338 
340  const Vector<double>& g() const
341  {
342  return *G_pt;
343  }
344 
347  {
348  return G_pt;
349  }
350 
353  {
354  return Body_force_fct_pt;
355  }
356 
359  {
360  return Body_force_fct_pt;
361  }
362 
365  {
366  return Source_fct_pt;
367  }
368 
371  {
372  return Source_fct_pt;
373  }
374 
376  virtual unsigned npres_pnst() const = 0;
377 
380  virtual double u_pnst(const unsigned& n, const unsigned& i) const = 0;
381 
384  virtual double u_pnst(const unsigned& t,
385  const unsigned& n,
386  const unsigned& i) const = 0;
387 
394  virtual inline unsigned u_index_pnst(const unsigned& i) const
395  {
396  return i;
397  }
398 
401  double du_dt_pnst(const unsigned& n, const unsigned& i) const
402  {
403  // Get the data's timestepper
405 
406  // Number of timsteps (past & present)
407  unsigned n_time = time_stepper_pt->ntstorage();
408 
409  // Initialise dudt
410  double dudt = 0.0;
411  // Loop over the timesteps, if there is a non Steady timestepper
412  if (time_stepper_pt->type() != "Steady")
413  {
414  for (unsigned t = 0; t < n_time; t++)
415  {
416  dudt += time_stepper_pt->weight(1, t) * u_pnst(t, n, i);
417  }
418  }
419 
420  return dudt;
421  }
422 
425  virtual double p_pnst(const unsigned& n_p) const = 0;
426 
428  virtual void fix_pressure(const unsigned& p_dof, const double& p_value) = 0;
429 
432  virtual int p_nodal_index_pnst()
433  {
435  }
436 
439  virtual Node* pressure_node_pt(const unsigned& n_p)
440  {
441  return NULL;
442  }
443 
445  double pressure_integral() const;
446 
448  double dissipation() const;
449 
451  double dissipation(const Vector<double>& s) const;
452 
454  double kin_energy() const;
455 
457  void strain_rate(const Vector<double>& s,
459 
461  void strain_rate_by_r(const Vector<double>& s,
463 
466  void get_traction(const Vector<double>& s,
467  const Vector<double>& N,
468  Vector<double>& traction);
469 
472  void get_load(const Vector<double>& s,
473  const Vector<double>& xi,
474  const Vector<double>& x,
475  const Vector<double>& N,
477  {
478  get_traction(s, N, load);
479  }
480 
481 
485  void output(std::ostream& outfile)
486  {
487  unsigned nplot = 5;
488  output(outfile, nplot);
489  }
490 
493  void output(std::ostream& outfile, const unsigned& nplot);
494 
497  void output(FILE* file_pt)
498  {
499  unsigned nplot = 5;
500  output(file_pt, nplot);
501  }
502 
505  void output(FILE* file_pt, const unsigned& nplot);
506 
510  void full_output(std::ostream& outfile)
511  {
512  unsigned nplot = 5;
513  full_output(outfile, nplot);
514  }
515 
519  void full_output(std::ostream& outfile, const unsigned& nplot);
520 
521 
525  void output_veloc(std::ostream& outfile,
526  const unsigned& nplot,
527  const unsigned& t);
528 
532  void output_fct(std::ostream& outfile,
533  const unsigned& nplot,
535 
539  void output_fct(std::ostream& outfile,
540  const unsigned& nplot,
541  const double& time,
543 
548  void compute_error(std::ostream& outfile,
550  const double& time,
551  double& error,
552  double& norm);
553 
558  void compute_error(std::ostream& outfile,
560  double& error,
561  double& norm);
562 
565  {
566  // Call the generic residuals function with flag set to 0
570  0);
571  }
572 
576  DenseMatrix<double>& jacobian)
577  {
578  // Call the generic routine with the flag set to 1
580  residuals, jacobian, GeneralisedElement::Dummy_matrix, 1);
581 
582  /*
583  // Only needed for test purposes
584  //Create a new matrix
585  unsigned n_dof = ndof();
586  DenseMatrix<double> jacobian_fd(n_dof,n_dof,0.0);
587  fill_in_jacobian_from_internal_by_fd(residuals,jacobian_fd);
588  fill_in_jacobian_from_nodal_by_fd(residuals,jacobian_fd);
589 
590  if(n_dof==21)
591  {
592  for(unsigned i=0;i<n_dof;i++)
593  {
594  for(unsigned j=0;j<n_dof;j++)
595  {
596  if(std::fabs(jacobian(i,j) - jacobian_fd(i,j)) > 1.0e-3)
597  {
598  std::cout << i << " " << j << " " << std::fabs(jacobian(i,j) -
599  jacobian_fd(i,j)) << std::endl;
600  }
601  }
602  }
603  }
604  // Only needed for test purposes
605 
606  // Only needed for test purposes
607  //Create a new matrix
608  unsigned n_dof = ndof();
609  DenseMatrix<double>
610  jacobian_new(n_dof,n_dof,0.0),jacobian_old(n_dof,n_dof,0.0);
611  Vector<double> residuals_new(n_dof,0.0),residuals_old(n_dof,0.0);
612 
613  //Call the generic routine with the flag set to 1
614  PolarNavierStokesEquations::fill_in_generic_residual_contribution(residuals_old,jacobian_old,
615  GeneralisedElement::Dummy_matrix,1);
616  //Call the generic routine with the flag set to 1
617  fill_in_generic_residual_contribution(residuals_new,jacobian_new,
618  GeneralisedElement::Dummy_matrix,1);
619 
620  if(n_dof==21)
621  {
622  for(unsigned i=0;i<n_dof;i++)
623  {
624  if(std::fabs(residuals_new[i] - residuals_old[i])>1.0e-8) std::cout << i
625  << " " << std::fabs(residuals_new[i] - residuals_old[i]) << std::endl;
626  //std::cout << residuals_new[i] << std::endl;
627  for(unsigned j=0;j<n_dof;j++)
628  {
629  if(std::fabs(jacobian_new(i,j) - jacobian_old(i,j)) > 1.0e-8)
630  {
631  std::cout << i << " " << j << " " << std::fabs(jacobian_new(i,j) -
632  jacobian_old(i,j)) << std::endl;
633  }
634  }
635  }
636  }
637  // Only needed for test purposes
638  */
639  } // End of fill_in_contribution_to_jacobian
640 
644  Vector<double>& residuals,
645  DenseMatrix<double>& jacobian,
646  DenseMatrix<double>& mass_matrix)
647  {
648  // Call the generic routine with the flag set to 2
650  residuals, jacobian, mass_matrix, 2);
651  }
652 
656  Vector<double>& residuals,
657  DenseMatrix<double>& jacobian,
658  DenseMatrix<double>& mass_matrix,
659  unsigned flag);
660 
663  Vector<double>& veloc) const
664  {
665  // Find number of nodes
666  unsigned n_node = nnode();
667  // Local shape function
668  Shape psi(n_node);
669  // Find values of shape function
670  shape(s, psi);
671 
672  for (unsigned i = 0; i < 2; i++)
673  {
674  // Initialise value of u
675  veloc[i] = 0.0;
676  // Loop over the local nodes and sum
677  for (unsigned l = 0; l < n_node; l++)
678  {
679  veloc[i] += u_pnst(l, i) * psi[l];
680  }
681  }
682  }
683 
685  double interpolated_u_pnst(const Vector<double>& s, const unsigned& i) const
686  {
687  // Find number of nodes
688  unsigned n_node = nnode();
689  // Local shape function
690  Shape psi(n_node);
691  // Find values of shape function
692  shape(s, psi);
693 
694  // Initialise value of u
695  double interpolated_u = 0.0;
696  // Loop over the local nodes and sum
697  for (unsigned l = 0; l < n_node; l++)
698  {
699  interpolated_u += u_pnst(l, i) * psi[l];
700  }
701 
702  return (interpolated_u);
703  }
704 
706  double interpolated_p_pnst(const Vector<double>& s) const
707  {
708  // Find number of nodes
709  unsigned n_pres = npres_pnst();
710  // Local shape function
711  Shape psi(n_pres);
712  // Find values of shape function
713  pshape_pnst(s, psi);
714 
715  // Initialise value of p
716  double interpolated_p = 0.0;
717  // Loop over the local nodes and sum
718  for (unsigned l = 0; l < n_pres; l++)
719  {
720  interpolated_p += p_pnst(l) * psi[l];
721  }
722 
723  return (interpolated_p);
724  }
725 
732  const unsigned& i,
733  const unsigned& j) const
734  {
735  // Find number of nodes
736  unsigned n_node = nnode();
737 
738  // Set up memory for the shape and test functions
739  Shape psif(n_node);
740  DShape dpsifdx(n_node, 2);
741 
742  // double J =
743  dshape_eulerian(s, psif, dpsifdx);
744 
745  // Initialise to zero
746  double interpolated_dudx = 0.0;
747 
748  // Calculate velocity derivative:
749 
750  // Loop over nodes
751  for (unsigned l = 0; l < n_node; l++)
752  {
753  interpolated_dudx += u_pnst(l, i) * dpsifdx(l, j);
754  }
755 
756  return (interpolated_dudx);
757  }
758  };
759 
763 
764 
765  //==========================================================================
769  //==========================================================================
770  class PolarCrouzeixRaviartElement : public virtual QElement<2, 3>,
771  public virtual PolarNavierStokesEquations
772  {
773  private:
775  static const unsigned Initial_Nvalue[];
776 
777  protected:
781 
785  inline double dshape_and_dtest_eulerian_pnst(const Vector<double>& s,
786  Shape& psi,
787  DShape& dpsidx,
788  Shape& test,
789  DShape& dtestdx) const;
790 
794  inline double dshape_and_dtest_eulerian_at_knot_pnst(const unsigned& ipt,
795  Shape& psi,
796  DShape& dpsidx,
797  Shape& test,
798  DShape& dtestdx) const;
799 
801  inline void pshape_pnst(const Vector<double>& s, Shape& psi) const;
802 
804  inline void pshape_pnst(const Vector<double>& s,
805  Shape& psi,
806  Shape& test) const;
807 
809  inline int p_local_eqn(const unsigned& n)
810  {
811  return this->internal_local_eqn(P_pnst_internal_index, n);
812  }
813 
814  public:
818  {
819  // Allocate and add one Internal data object that stores 3 pressure
820  // values;
822  }
823 
825  virtual unsigned required_nvalue(const unsigned& n) const;
826 
829  double u_pnst(const unsigned& n, const unsigned& i) const
830  {
831  return this->nodal_value(n, i);
832  }
833 
837  double u_pnst(const unsigned& t, const unsigned& n, const unsigned& i) const
838  {
839  return this->nodal_value(t, n, i);
840  }
841 
845  double p_pnst(const unsigned& i_internal) const
846  {
847  return *this->internal_data_pt(P_pnst_internal_index)
848  ->value_pt(i_internal);
849  }
850 
852  unsigned npres_pnst() const
853  {
854  return 3;
855  }
856 
858  void fix_pressure(const unsigned& p_dof, const double& p_value)
859  {
860  this->internal_data_pt(P_pnst_internal_index)->pin(p_dof);
861  *this->internal_data_pt(P_pnst_internal_index)->value_pt(p_dof) = p_value;
862  }
863 
868  void get_load_data(std::set<std::pair<Data*, unsigned>>& paired_load_data);
869 
871  void output(std::ostream& outfile)
872  {
874  }
875 
877  void output(std::ostream& outfile, const unsigned& Nplot)
878  {
879  PolarNavierStokesEquations::output(outfile, Nplot);
880  }
881 
882 
884  void output(FILE* file_pt)
885  {
887  }
888 
890  void output(FILE* file_pt, const unsigned& Nplot)
891  {
892  PolarNavierStokesEquations::output(file_pt, Nplot);
893  }
894 
895 
899  void full_output(std::ostream& outfile)
900  {
902  }
903 
907  void full_output(std::ostream& outfile, const unsigned& nplot)
908  {
910  }
911  };
912 
913  // Inline functions
914 
915  //=======================================================================
920  //=======================================================================
922  const Vector<double>& s,
923  Shape& psi,
924  DShape& dpsidx,
925  Shape& test,
926  DShape& dtestdx) const
927  {
928  // Call the geometrical shape functions and derivatives
929  double J = QElement<2, 3>::dshape_eulerian(s, psi, dpsidx);
930  // Loop over the test functions and derivatives and set them equal to the
931  // shape functions
932  for (unsigned i = 0; i < 9; i++)
933  {
934  test[i] = psi[i];
935  dtestdx(i, 0) = dpsidx(i, 0);
936  dtestdx(i, 1) = dpsidx(i, 1);
937  }
938  // Return the jacobian
939  return J;
940  }
941 
942 
943  //=======================================================================
948  //=======================================================================
950  dshape_and_dtest_eulerian_at_knot_pnst(const unsigned& ipt,
951  Shape& psi,
952  DShape& dpsidx,
953  Shape& test,
954  DShape& dtestdx) const
955  {
956  // Call the geometrical shape functions and derivatives
957  double J = QElement<2, 3>::dshape_eulerian_at_knot(ipt, psi, dpsidx);
958  // Loop over the test functions and derivatives and set them equal to the
959  // shape functions
960  for (unsigned i = 0; i < 9; i++)
961  {
962  test[i] = psi[i];
963  dtestdx(i, 0) = dpsidx(i, 0);
964  dtestdx(i, 1) = dpsidx(i, 1);
965  }
966  // Return the jacobian
967  return J;
968  }
969 
970  //=======================================================================
973  //=======================================================================
975  Shape& psi) const
976  {
977  psi[0] = 1.0;
978  psi[1] = s[0];
979  psi[2] = s[1];
980  }
981 
984  Shape& psi,
985  Shape& test) const
986  {
987  // Call the pressure shape functions
988  pshape_pnst(s, psi);
989  // Loop over the test functions and set them equal to the shape functions
990  for (unsigned i = 0; i < 3; i++) test[i] = psi[i];
991  }
992 
993  //=======================================================================
995  //=======================================================================
996  template<>
998  : public virtual QElement<1, 3>
999  {
1000  public:
1001  FaceGeometry() : QElement<1, 3>() {}
1002  };
1003 
1006 
1007  //=======================================================================
1011  //=======================================================================
1012  class PolarTaylorHoodElement : public virtual QElement<2, 3>,
1013  public virtual PolarNavierStokesEquations
1014  {
1015  private:
1017  static const unsigned Initial_Nvalue[];
1018 
1019  protected:
1022  static const unsigned Pconv[];
1023 
1027  inline double dshape_and_dtest_eulerian_pnst(const Vector<double>& s,
1028  Shape& psi,
1029  DShape& dpsidx,
1030  Shape& test,
1031  DShape& dtestdx) const;
1032 
1036  inline double dshape_and_dtest_eulerian_at_knot_pnst(const unsigned& ipt,
1037  Shape& psi,
1038  DShape& dpsidx,
1039  Shape& test,
1040  DShape& dtestdx) const;
1041 
1043  inline void pshape_pnst(const Vector<double>& s, Shape& psi) const;
1044 
1046  inline void pshape_pnst(const Vector<double>& s,
1047  Shape& psi,
1048  Shape& test) const;
1049 
1051  inline int p_local_eqn(const unsigned& n)
1052  {
1053  return this->nodal_local_eqn(Pconv[n], p_nodal_index_pnst());
1054  }
1055 
1056  public:
1059 
1062  inline virtual unsigned required_nvalue(const unsigned& n) const
1063  {
1064  return Initial_Nvalue[n];
1065  }
1066 
1068  virtual int p_nodal_index_pnst()
1069  {
1070  return 2;
1071  }
1072 
1074  Node* pressure_node_pt(const unsigned& n_p)
1075  {
1076  return this->node_pt(Pconv[n_p]);
1077  }
1078 
1081  double u_pnst(const unsigned& n, const unsigned& i) const
1082  {
1083  return this->nodal_value(n, i);
1084  }
1085 
1089  double u_pnst(const unsigned& t, const unsigned& n, const unsigned& i) const
1090  {
1091  return this->nodal_value(t, n, i);
1092  }
1093 
1096  double p_pnst(const unsigned& n_p) const
1097  {
1098  return this->nodal_value(Pconv[n_p], 2);
1099  }
1100  // {return this->nodal_value(Pconv[n_p],this->p_nodal_index_pnst());}
1101 
1103  unsigned npres_pnst() const
1104  {
1105  return 4;
1106  }
1107 
1109  void fix_pressure(const unsigned& p_dof, const double& p_value)
1110  {
1111  this->node_pt(Pconv[p_dof])->pin(this->p_nodal_index_pnst());
1112  *this->node_pt(Pconv[p_dof])->value_pt(this->p_nodal_index_pnst()) =
1113  p_value;
1114  }
1115 
1116 
1121  void get_load_data(std::set<std::pair<Data*, unsigned>>& paired_load_data);
1122 
1124  void output(std::ostream& outfile)
1125  {
1127  }
1128 
1130  void output(std::ostream& outfile, const unsigned& Nplot)
1131  {
1132  PolarNavierStokesEquations::output(outfile, Nplot);
1133  }
1134 
1136  void output(FILE* file_pt)
1137  {
1139  }
1140 
1142  void output(FILE* file_pt, const unsigned& Nplot)
1143  {
1144  PolarNavierStokesEquations::output(file_pt, Nplot);
1145  }
1146  };
1147 
1148  // Inline functions
1149 
1150  //==========================================================================
1155  //==========================================================================
1157  const Vector<double>& s,
1158  Shape& psi,
1159  DShape& dpsidx,
1160  Shape& test,
1161  DShape& dtestdx) const
1162  {
1163  // Call the geometrical shape functions and derivatives
1164  double J = QElement<2, 3>::dshape_eulerian(s, psi, dpsidx);
1165  // Loop over the test functions and derivatives and set them equal to the
1166  // shape functions
1167  for (unsigned i = 0; i < 9; i++)
1168  {
1169  test[i] = psi[i];
1170  dtestdx(i, 0) = dpsidx(i, 0);
1171  dtestdx(i, 1) = dpsidx(i, 1);
1172  }
1173  // Return the jacobian
1174  return J;
1175  }
1176 
1177 
1178  //==========================================================================
1183  //==========================================================================
1185  const unsigned& ipt,
1186  Shape& psi,
1187  DShape& dpsidx,
1188  Shape& test,
1189  DShape& dtestdx) const
1190  {
1191  // Call the geometrical shape functions and derivatives
1192  double J = QElement<2, 3>::dshape_eulerian_at_knot(ipt, psi, dpsidx);
1193  // Loop over the test functions and derivatives and set them equal to the
1194  // shape functions
1195  for (unsigned i = 0; i < 9; i++)
1196  {
1197  test[i] = psi[i];
1198  dtestdx(i, 0) = dpsidx(i, 0);
1199  dtestdx(i, 1) = dpsidx(i, 1);
1200  }
1201  // Return the jacobian
1202  return J;
1203  }
1204 
1205 
1206  //==========================================================================
1209  //==========================================================================
1211  Shape& psi) const
1212  {
1213  // Call the OneDimensional Shape functions
1214  // Local storage
1215  double psi1[2], psi2[2];
1216  // Call the OneDimensional Shape functions
1217  OneDimLagrange::shape<2>(s[0], psi1);
1218  OneDimLagrange::shape<2>(s[1], psi2);
1219 
1220  // Now let's loop over the nodal points in the element
1221  // s1 is the "x" coordinate, s2 the "y"
1222  for (unsigned i = 0; i < 2; i++)
1223  {
1224  for (unsigned j = 0; j < 2; j++)
1225  {
1226  /*Multiply the two 1D functions together to get the 2D function*/
1227  psi[2 * i + j] = psi2[i] * psi1[j];
1228  }
1229  }
1230  }
1231 
1232 
1233  //==========================================================================
1236  //==========================================================================
1238  Shape& psi,
1239  Shape& test) const
1240  {
1241  // Call the pressure shape functions
1242  pshape_pnst(s, psi);
1243  // Loop over the test functions and set them equal to the shape functions
1244  for (unsigned i = 0; i < 4; i++) test[i] = psi[i];
1245  }
1246 
1247  //=======================================================================
1249  //=======================================================================
1250  template<>
1251  class FaceGeometry<PolarTaylorHoodElement> : public virtual QElement<1, 3>
1252  {
1253  public:
1254  FaceGeometry() : QElement<1, 3>() {}
1255  };
1256 
1257 } // namespace oomph
1258 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
JacobiRotation< float > J
Definition: Jacobi_makeJacobi.cpp:3
void load(Archive &ar, ParticleHandler &handl)
Definition: Particles.h:21
Definition: shape.h:278
Definition: nodes.h:86
void pin(const unsigned &i)
Pin the i-th stored variable.
Definition: nodes.h:385
double * value_pt(const unsigned &i) const
Definition: nodes.h:324
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Definition: nodes.h:238
FaceGeometry()
Definition: polar_navier_stokes_elements.h:1001
FaceGeometry()
Definition: polar_navier_stokes_elements.h:1254
Definition: elements.h:4998
Definition: elements.h:1313
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
double nodal_value(const unsigned &n, const unsigned &i) const
Definition: elements.h:2593
virtual void shape(const Vector< double > &s, Shape &psi) const =0
int nodal_local_eqn(const unsigned &n, const unsigned &i) const
Definition: elements.h:1432
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
void(* SteadyExactSolutionFctPt)(const Vector< double > &, Vector< double > &)
Definition: elements.h:1759
void(* UnsteadyExactSolutionFctPt)(const double &, const Vector< double > &, Vector< double > &)
Definition: elements.h:1765
double dshape_eulerian(const Vector< double > &s, Shape &psi, DShape &dpsidx) const
Definition: elements.cc:3298
Data *& internal_data_pt(const unsigned &i)
Return a pointer to i-th internal data object.
Definition: elements.h:622
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Definition: elements.h:267
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:62
TimeStepper *& time_stepper_pt()
Definition: geom_objects.h:192
Definition: nodes.h:906
Definition: polar_navier_stokes_elements.h:772
double u_pnst(const unsigned &t, const unsigned &n, const unsigned &i) const
Definition: polar_navier_stokes_elements.h:837
void output(FILE *file_pt, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
Definition: polar_navier_stokes_elements.h:890
void fix_pressure(const unsigned &p_dof, const double &p_value)
Pin p_dof-th pressure dof and set it to value specified by p_value.
Definition: polar_navier_stokes_elements.h:858
int p_local_eqn(const unsigned &n)
Return the local equation numbers for the pressure values.
Definition: polar_navier_stokes_elements.h:809
PolarCrouzeixRaviartElement()
Constructor, there are DIM+1 internal values (for the pressure)
Definition: polar_navier_stokes_elements.h:816
void pshape_pnst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
Definition: polar_navier_stokes_elements.h:974
unsigned npres_pnst() const
Return number of pressure values.
Definition: polar_navier_stokes_elements.h:852
virtual unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at local node n.
Definition: polar_navier_stokes_elements.cc:1566
void output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
Definition: polar_navier_stokes_elements.h:884
void get_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Definition: polar_navier_stokes_elements.cc:1577
unsigned P_pnst_internal_index
Definition: polar_navier_stokes_elements.h:780
void full_output(std::ostream &outfile, const unsigned &nplot)
Definition: polar_navier_stokes_elements.h:907
double u_pnst(const unsigned &n, const unsigned &i) const
Definition: polar_navier_stokes_elements.h:829
double dshape_and_dtest_eulerian_at_knot_pnst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: polar_navier_stokes_elements.h:950
double p_pnst(const unsigned &i_internal) const
Definition: polar_navier_stokes_elements.h:845
void output(std::ostream &outfile, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
Definition: polar_navier_stokes_elements.h:877
double dshape_and_dtest_eulerian_pnst(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: polar_navier_stokes_elements.h:921
void output(std::ostream &outfile)
Redirect output to NavierStokesEquations output.
Definition: polar_navier_stokes_elements.h:871
static const unsigned Initial_Nvalue[]
Static array of ints to hold required number of variables at nodes.
Definition: polar_navier_stokes_elements.h:775
void full_output(std::ostream &outfile)
Definition: polar_navier_stokes_elements.h:899
Definition: polar_navier_stokes_elements.h:108
PolarNavierStokesEquations()
Constructor: NULL the body force and source function.
Definition: polar_navier_stokes_elements.h:245
double dissipation() const
Return integral of dissipation over element.
Definition: polar_navier_stokes_elements.cc:721
double *& density_ratio_pt()
Pointer to Density ratio.
Definition: polar_navier_stokes_elements.h:322
double interpolated_u_pnst(const Vector< double > &s, const unsigned &i) const
Return FE interpolated velocity u[i] at local coordinate s.
Definition: polar_navier_stokes_elements.h:685
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute the element's residual Vector.
Definition: polar_navier_stokes_elements.h:564
double *& re_invfr_pt()
Pointer to global inverse Froude number.
Definition: polar_navier_stokes_elements.h:334
virtual void pshape_pnst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
NavierStokesBodyForceFctPt & body_force_fct_pt()
Access function for the body-force pointer.
Definition: polar_navier_stokes_elements.h:352
double kin_energy() const
Get integral of kinetic energy over element.
Definition: polar_navier_stokes_elements.cc:1006
static double Default_Physical_Constant_Value
Navier–Stokes equations static data.
Definition: polar_navier_stokes_elements.h:128
double * ReSt_pt
Pointer to global Reynolds number x Strouhal number (=Womersley)
Definition: polar_navier_stokes_elements.h:157
double * Viscosity_Ratio_pt
Definition: polar_navier_stokes_elements.h:142
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: polar_navier_stokes_elements.h:575
const Vector< double > & g() const
Vector of gravitational components.
Definition: polar_navier_stokes_elements.h:340
virtual void pshape_pnst(const Vector< double > &s, Shape &psi, Shape &test) const =0
Vector< double > * G_pt
Pointer to global gravity Vector.
Definition: polar_navier_stokes_elements.h:164
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
Definition: polar_navier_stokes_elements.h:261
const double & viscosity_ratio() const
Definition: polar_navier_stokes_elements.h:303
virtual int p_local_eqn(const unsigned &n)=0
const double & re_invfr() const
Global inverse Froude number.
Definition: polar_navier_stokes_elements.h:328
void get_load(const Vector< double > &s, const Vector< double > &xi, const Vector< double > &x, const Vector< double > &N, Vector< double > &load)
Definition: polar_navier_stokes_elements.h:472
NavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
Definition: polar_navier_stokes_elements.h:167
static double Default_Physical_Ratio_Value
Navier–Stokes equations static data.
Definition: polar_navier_stokes_elements.h:132
const double & alpha() const
Alpha.
Definition: polar_navier_stokes_elements.h:272
virtual double p_pnst(const unsigned &n_p) const =0
void get_traction(const Vector< double > &s, const Vector< double > &N, Vector< double > &traction)
Definition: polar_navier_stokes_elements.cc:772
virtual double dshape_and_dtest_eulerian_pnst(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Strain-rate tensor: Now returns polar strain.
Definition: polar_navier_stokes_elements.cc:822
double get_source_fct(double time, const Vector< double > &x)
Definition: polar_navier_stokes_elements.h:229
double *& alpha_pt()
Pointer to Alpha.
Definition: polar_navier_stokes_elements.h:290
void output(std::ostream &outfile)
Definition: polar_navier_stokes_elements.h:485
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: polar_navier_stokes_elements.cc:216
virtual int p_nodal_index_pnst()
Definition: polar_navier_stokes_elements.h:432
void get_body_force(double time, const Vector< double > &x, Vector< double > &result)
Calculate the body force at a given time and Eulerian position.
Definition: polar_navier_stokes_elements.h:207
virtual double dshape_and_dtest_eulerian_at_knot_pnst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
virtual void fix_pressure(const unsigned &p_dof, const double &p_value)=0
Pin p_dof-th pressure dof and set it to value specified by p_value.
NavierStokesSourceFctPt & source_fct_pt()
Access function for the source-function pointer.
Definition: polar_navier_stokes_elements.h:364
double * Re_pt
Pointer to global Reynolds number.
Definition: polar_navier_stokes_elements.h:154
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
Definition: polar_navier_stokes_elements.h:135
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley number)
Definition: polar_navier_stokes_elements.h:296
static int Pressure_not_stored_at_node
Definition: polar_navier_stokes_elements.h:124
double(* NavierStokesSourceFctPt)(const double &time, const Vector< double > &x)
Definition: polar_navier_stokes_elements.h:118
void output_veloc(std::ostream &outfile, const unsigned &nplot, const unsigned &t)
Definition: polar_navier_stokes_elements.cc:328
void strain_rate_by_r(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Function to return polar strain multiplied by r.
Definition: polar_navier_stokes_elements.cc:909
double *& re_pt()
Pointer to Reynolds number.
Definition: polar_navier_stokes_elements.h:284
virtual unsigned u_index_pnst(const unsigned &i) const
Definition: polar_navier_stokes_elements.h:394
double * Density_Ratio_pt
Definition: polar_navier_stokes_elements.h:146
void output(FILE *file_pt)
Definition: polar_navier_stokes_elements.h:497
NavierStokesSourceFctPt Source_fct_pt
Pointer to volumetric source function.
Definition: polar_navier_stokes_elements.h:170
double * ReInvFr_pt
Definition: polar_navier_stokes_elements.h:161
void full_output(std::ostream &outfile)
Definition: polar_navier_stokes_elements.h:510
const double & re() const
Reynolds number.
Definition: polar_navier_stokes_elements.h:266
double *& viscosity_ratio_pt()
Pointer to Viscosity Ratio.
Definition: polar_navier_stokes_elements.h:309
void interpolated_u_pnst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
Definition: polar_navier_stokes_elements.h:662
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
Definition: polar_navier_stokes_elements.h:278
double du_dt_pnst(const unsigned &n, const unsigned &i) const
Definition: polar_navier_stokes_elements.h:401
virtual double u_pnst(const unsigned &t, const unsigned &n, const unsigned &i) const =0
virtual void fill_in_generic_residual_contribution(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Definition: polar_navier_stokes_elements.cc:1100
double pressure_integral() const
Integral of pressure over element.
Definition: polar_navier_stokes_elements.cc:1048
void(* NavierStokesBodyForceFctPt)(const double &time, const Vector< double > &x, Vector< double > &body_force)
Definition: polar_navier_stokes_elements.h:112
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
Definition: polar_navier_stokes_elements.h:643
virtual double u_pnst(const unsigned &n, const unsigned &i) const =0
const double & density_ratio() const
Definition: polar_navier_stokes_elements.h:316
virtual Node * pressure_node_pt(const unsigned &n_p)
Definition: polar_navier_stokes_elements.h:439
NavierStokesSourceFctPt source_fct_pt() const
Access function for the source-function pointer. Const version.
Definition: polar_navier_stokes_elements.h:370
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Definition: polar_navier_stokes_elements.cc:61
double * Alpha_pt
Pointer to the angle alpha.
Definition: polar_navier_stokes_elements.h:151
virtual unsigned npres_pnst() const =0
Function to return number of pressure degrees of freedom.
NavierStokesBodyForceFctPt body_force_fct_pt() const
Access function for the body-force pointer. Const version.
Definition: polar_navier_stokes_elements.h:358
double interpolated_dudx_pnst(const Vector< double > &s, const unsigned &i, const unsigned &j) const
Definition: polar_navier_stokes_elements.h:731
double interpolated_p_pnst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
Definition: polar_navier_stokes_elements.h:706
Vector< double > *& g_pt()
Pointer to Vector of gravitational components.
Definition: polar_navier_stokes_elements.h:346
Definition: polar_navier_stokes_elements.h:1014
void pshape_pnst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
Definition: polar_navier_stokes_elements.h:1210
double p_pnst(const unsigned &n_p) const
Definition: polar_navier_stokes_elements.h:1096
void get_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Definition: polar_navier_stokes_elements.cc:1622
virtual unsigned required_nvalue(const unsigned &n) const
Definition: polar_navier_stokes_elements.h:1062
static const unsigned Pconv[]
Definition: polar_navier_stokes_elements.h:1022
void output(FILE *file_pt, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
Definition: polar_navier_stokes_elements.h:1142
static const unsigned Initial_Nvalue[]
Static array of ints to hold number of variables at node.
Definition: polar_navier_stokes_elements.h:1017
unsigned npres_pnst() const
Return number of pressure values.
Definition: polar_navier_stokes_elements.h:1103
double dshape_and_dtest_eulerian_pnst(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: polar_navier_stokes_elements.h:1156
double u_pnst(const unsigned &n, const unsigned &i) const
Definition: polar_navier_stokes_elements.h:1081
Node * pressure_node_pt(const unsigned &n_p)
Pointer to n_p-th pressure node.
Definition: polar_navier_stokes_elements.h:1074
double dshape_and_dtest_eulerian_at_knot_pnst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: polar_navier_stokes_elements.h:1184
void output(FILE *file_pt)
Redirect output to NavierStokesEquations output.
Definition: polar_navier_stokes_elements.h:1136
int p_local_eqn(const unsigned &n)
Return the local equation numbers for the pressure values.
Definition: polar_navier_stokes_elements.h:1051
void output(std::ostream &outfile, const unsigned &Nplot)
Redirect output to NavierStokesEquations output.
Definition: polar_navier_stokes_elements.h:1130
double u_pnst(const unsigned &t, const unsigned &n, const unsigned &i) const
Definition: polar_navier_stokes_elements.h:1089
PolarTaylorHoodElement()
Constructor, no internal data points.
Definition: polar_navier_stokes_elements.h:1058
void output(std::ostream &outfile)
Redirect output to NavierStokesEquations output.
Definition: polar_navier_stokes_elements.h:1124
void fix_pressure(const unsigned &p_dof, const double &p_value)
Pin p_dof-th pressure dof and set it to value specified by p_value.
Definition: polar_navier_stokes_elements.h:1109
virtual int p_nodal_index_pnst()
Which nodal value represents the pressure?
Definition: polar_navier_stokes_elements.h:1068
Definition: Qelements.h:459
Definition: shape.h:76
Definition: timesteppers.h:231
unsigned ntstorage() const
Definition: timesteppers.h:601
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
Definition: timesteppers.h:594
std::string type() const
Definition: timesteppers.h:490
@ N
Definition: constructor.cpp:22
RealScalar s
Definition: level1_cplx_impl.h:130
void body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:96
int error
Definition: calibrate.py:297
void shape< 2 >(const double &s, double *Psi)
1D shape functions specialised to linear order (2 Nodes)
Definition: shape.h:608
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
list x
Definition: plotDoE.py:28
t
Definition: plotPSD.py:36
Definition: indexed_view.cpp:20
void set(Container &c, Position position, const Value &value)
Definition: stdlist_overload.cpp:36
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2