spherical_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 // Header file for Navier Stokes elements
27 
28 #ifndef OOMPH_SPHERICAL_NAVIER_STOKES_ELEMENTS_HEADER
29 #define OOMPH_SPHERICAL_NAVIER_STOKES_ELEMENTS_HEADER
30 
31 // Config header generated by autoconfig
32 #ifdef HAVE_CONFIG_H
33 #include <oomph-lib-config.h>
34 #endif
35 
36 
37 // OOMPH-LIB headers
38 #include "../generic/Qelements.h"
39 #include "../generic/fsi.h"
40 //#include "generic/block_preconditioner.h"
41 
42 namespace oomph
43 {
44  //======================================================================
53  //======================================================================
55  : public virtual FSIFluidElement,
57  {
58  public:
62  const double& time, const Vector<double>& x, Vector<double>& body_force);
63 
66  typedef double (*SphericalNavierStokesSourceFctPt)(const double& time,
67  const Vector<double>& x);
68 
69  private:
73 
77 
81 
84 
85  protected:
86  // Physical constants
87 
91 
95 
96  // Pointers to global physical constants
97 
99  double* Re_pt;
100 
102  double* ReSt_pt;
103 
106  double* ReInvFr_pt;
107 
110  double* ReInvRo_pt;
111 
114 
117 
120 
125 
129  virtual int p_local_eqn(const unsigned& n) const = 0;
130 
135  const Vector<double>& s,
136  Shape& psi,
137  DShape& dpsidx,
138  Shape& test,
139  DShape& dtestdx) const = 0;
140 
145  const unsigned& ipt,
146  Shape& psi,
147  DShape& dpsidx,
148  Shape& test,
149  DShape& dtestdx) const = 0;
150 
152  virtual void pshape_spherical_nst(const Vector<double>& s,
153  Shape& psi) const = 0;
154 
157  virtual void pshape_spherical_nst(const Vector<double>& s,
158  Shape& psi,
159  Shape& test) const = 0;
160 
161 
166  virtual void get_body_force_spherical_nst(const double& time,
167  const unsigned& ipt,
168  const Vector<double>& s,
169  const Vector<double>& x,
170  Vector<double>& result)
171  {
172  // If the function pointer is zero return zero
173  if (Body_force_fct_pt == 0)
174  {
175  // Loop over three spatial dimensions and set body forces to zero
176  for (unsigned i = 0; i < 3; i++)
177  {
178  result[i] = 0.0;
179  }
180  }
181  // Otherwise call the function
182  else
183  {
184  (*Body_force_fct_pt)(time, x, result);
185  }
186  }
187 
190  virtual double get_source_spherical_nst(double time,
191  const unsigned& ipt,
192  const Vector<double>& x)
193  {
194  // If the function pointer is zero return zero
195  if (Source_fct_pt == 0)
196  {
197  return 0;
198  }
199  // Otherwise call the function
200  else
201  {
202  return (*Source_fct_pt)(time, x);
203  }
204  }
205 
209  Vector<double>& residuals,
210  DenseMatrix<double>& jacobian,
211  DenseMatrix<double>& mass_matrix,
212  unsigned flag);
213 
214 
215  public:
218  inline double cot(const double& th) const
219  {
220  return (1 / tan(th));
221  }
222 
223 
228  {
229  // Set all the Physical parameter pointers to the default value zero
235  // Set the Physical ratios to the default value of 1
238  }
239 
241  // N.B. This needs to be public so that the intel compiler gets things
242  // correct somehow the access function messes things up when going to
243  // refineable navier--stokes
245 
246  // Access functions for the physical constants
247 
249  const double& re() const
250  {
251  return *Re_pt;
252  }
253 
255  const double& re_st() const
256  {
257  return *ReSt_pt;
258  }
259 
261  double*& re_pt()
262  {
263  return Re_pt;
264  }
265 
267  double*& re_st_pt()
268  {
269  return ReSt_pt;
270  }
271 
274  const double& viscosity_ratio() const
275  {
276  return *Viscosity_Ratio_pt;
277  }
278 
281  {
282  return Viscosity_Ratio_pt;
283  }
284 
287  const double& density_ratio() const
288  {
289  return *Density_Ratio_pt;
290  }
291 
293  double*& density_ratio_pt()
294  {
295  return Density_Ratio_pt;
296  }
297 
299  const double& re_invfr() const
300  {
301  return *ReInvFr_pt;
302  }
303 
305  double*& re_invfr_pt()
306  {
307  return ReInvFr_pt;
308  }
309 
311  const double& re_invro() const
312  {
313  return *ReInvRo_pt;
314  }
315 
317  double*& re_invro_pt()
318  {
319  return ReInvRo_pt;
320  }
321 
323  const Vector<double>& g() const
324  {
325  return *G_pt;
326  }
327 
330  {
331  return G_pt;
332  }
333 
336  {
337  return Body_force_fct_pt;
338  }
339 
342  {
343  return Body_force_fct_pt;
344  }
345 
348  {
349  return Source_fct_pt;
350  }
351 
354  {
355  return Source_fct_pt;
356  }
357 
359  virtual unsigned npres_spherical_nst() const = 0;
360 
367  double u_spherical_nst(const unsigned& n, const unsigned& i) const
368  {
370  }
371 
374  double u_spherical_nst(const unsigned& t,
375  const unsigned& n,
376  const unsigned& i) const
377  {
379  }
380 
387  virtual inline unsigned u_index_spherical_nst(const unsigned& i) const
388  {
389  return i;
390  }
391 
392 
395  double du_dt_spherical_nst(const unsigned& n, const unsigned& i) const
396  {
397  // Get the data's timestepper
399 
400  // Initialise dudt
401  double dudt = 0.0;
402 
403  // Loop over the timesteps, if there is a non Steady timestepper
404  if (time_stepper_pt->type() != "Steady")
405  {
406  // Find the index at which the dof is stored
407  const unsigned u_nodal_index = this->u_index_spherical_nst(i);
408 
409  // Number of timsteps (past & present)
410  const unsigned n_time = time_stepper_pt->ntstorage();
411  // Loop over the timesteps
412  for (unsigned t = 0; t < n_time; t++)
413  {
414  dudt +=
415  time_stepper_pt->weight(1, t) * nodal_value(t, n, u_nodal_index);
416  }
417  }
418 
419  return dudt;
420  }
421 
424  void disable_ALE()
425  {
426  ALE_is_disabled = true;
427  }
428 
433  void enable_ALE()
434  {
435  ALE_is_disabled = false;
436  }
437 
440  virtual double p_spherical_nst(const unsigned& n_p) const = 0;
441 
443  virtual void fix_pressure(const unsigned& p_dof, const double& p_value) = 0;
444 
448  virtual int p_nodal_index_spherical_nst() const
449  {
451  }
452 
454  double pressure_integral() const;
455 
457  double dissipation() const;
458 
460  double dissipation(const Vector<double>& s) const;
461 
463  void get_vorticity(const Vector<double>& s,
464  Vector<double>& vorticity) const;
465 
467  double kin_energy() const;
468 
470  double d_kin_energy_dt() const;
471 
473  void strain_rate(const Vector<double>& s,
475 
479  void get_traction(const Vector<double>& s,
480  const Vector<double>& N,
481  Vector<double>& traction);
482 
483 
492  void get_load(const Vector<double>& s,
493  const Vector<double>& N,
495  {
496  // Note: get_traction() computes the traction onto the fluid
497  // if N is the outer unit normal onto the fluid; here we're
498  // exepcting N to point into the fluid so we're getting the
499  // traction onto the adjacent wall instead!
500  get_traction(s, N, load);
501  }
502 
510  Vector<double>& press_mass_diag,
511  Vector<double>& veloc_mass_diag,
512  const unsigned& which_one = 0);
513 
514 
517  void output(std::ostream& outfile)
518  {
519  unsigned nplot = 5;
520  output(outfile, nplot);
521  }
522 
525  void output(std::ostream& outfile, const unsigned& nplot);
526 
529  void output(FILE* file_pt)
530  {
531  unsigned nplot = 5;
532  output(file_pt, nplot);
533  }
534 
537  void output(FILE* file_pt, const unsigned& nplot);
538 
542  void full_output(std::ostream& outfile)
543  {
544  unsigned nplot = 5;
545  full_output(outfile, nplot);
546  }
547 
551  void full_output(std::ostream& outfile, const unsigned& nplot);
552 
553 
557  void output_veloc(std::ostream& outfile,
558  const unsigned& nplot,
559  const unsigned& t);
560 
561 
564  void output_vorticity(std::ostream& outfile, const unsigned& nplot);
565 
569  void output_fct(std::ostream& outfile,
570  const unsigned& nplot,
572 
576  void output_fct(std::ostream& outfile,
577  const unsigned& nplot,
578  const double& time,
580 
585  void compute_error(std::ostream& outfile,
587  const double& time,
588  double& error,
589  double& norm);
590 
595  void compute_error(std::ostream& outfile,
597  double& error,
598  double& norm);
599 
604  void compute_error_e(
605  std::ostream& outfile,
608  FiniteElement::SteadyExactSolutionFctPt exact_soln_dtheta_pt,
609  double& u_error,
610  double& u_norm,
611  double& p_error,
612  double& p_norm);
613 
614  // Listing for the shear stress function
615  void compute_shear_stress(std::ostream& outfile);
616 
617  // Listing for the velocity extraction function
618  void extract_velocity(std::ostream& outfile);
619 
620  // Calculate the analytic solution at the point x and output a vector
622  {
623  const double Re = this->re();
624 
625  double r = x[0];
626  double theta = x[1];
627  Vector<double> ans(4, 0.0);
628 
629  ans[2] = r * sin(theta);
630  ans[3] = 0.5 * Re * r * r * sin(theta) * sin(theta);
631 
632  return (ans);
633  }
634 
635  // Calculate the r-derivatives of the analytic solution at the point x and
636  // output a vector
638  {
639  const double Re = this->re();
640 
641  double r = x[0];
642  double theta = x[1];
643  Vector<double> ans(4, 0.0);
644 
645  ans[2] = sin(theta);
646  ans[3] = Re * r * sin(theta) * sin(theta);
647 
648  return (ans);
649  }
650 
651  // Calculate the theta-derivatives of the analytic solution at the point x
652  // and output a vector
654  {
655  const double Re = this->re();
656 
657  double r = x[0];
658  double theta = x[1];
659  Vector<double> ans(4, 0.0);
660 
661  ans[2] = r * cos(theta);
662  ans[3] = Re * r * r * sin(theta) * cos(theta);
663 
664  return (ans);
665  }
666 
669  {
670  // Call the generic residuals function with flag set to 0
671  // and using a dummy matrix argument
673  residuals,
676  0);
677  }
678 
679  // Compute the element's residual Vector and the jacobian matrix
680  // Virtual function can be overloaded by hanging-node version
682  DenseMatrix<double>& jacobian)
683  {
684  // Call the generic routine with the flag set to 1
686  residuals, jacobian, GeneralisedElement::Dummy_matrix, 1);
687  }
688 
692  Vector<double>& residuals,
693  DenseMatrix<double>& jacobian,
694  DenseMatrix<double>& mass_matrix)
695  {
696  // Call the generic routine with the flag set to 2
698  residuals, jacobian, mass_matrix, 2);
699  }
700 
703  Vector<double>& veloc) const
704  {
705  // Find number of nodes
706  unsigned n_node = nnode();
707  // Local shape function
708  Shape psi(n_node);
709  // Find values of shape function
710  shape(s, psi);
711 
712  for (unsigned i = 0; i < 3; i++)
713  {
714  // Index at which the nodal value is stored
715  unsigned u_nodal_index = u_index_spherical_nst(i);
716  // Initialise value of u
717  veloc[i] = 0.0;
718  // Loop over the local nodes and sum
719  for (unsigned l = 0; l < n_node; l++)
720  {
721  veloc[i] += nodal_value(l, u_nodal_index) * psi[l];
722  }
723  }
724  }
725 
728  const unsigned& i) const
729  {
730  // Find number of nodes
731  unsigned n_node = nnode();
732  // Local shape function
733  Shape psi(n_node);
734  // Find values of shape function
735  shape(s, psi);
736 
737  // Get nodal index at which i-th velocity is stored
738  unsigned u_nodal_index = u_index_spherical_nst(i);
739 
740  // Initialise value of u
741  double interpolated_u = 0.0;
742  // Loop over the local nodes and sum
743  for (unsigned l = 0; l < n_node; l++)
744  {
745  interpolated_u += nodal_value(l, u_nodal_index) * psi[l];
746  }
747 
748  return (interpolated_u);
749  }
750 
754  const unsigned& i,
755  const unsigned& j) const
756  {
757  // Find number of nodes
758  unsigned n_node = nnode();
759  // Local shape function
760  Shape psi(n_node);
761  DShape dpsidx(n_node, 2);
762  // Find values of shape function
763  (void)dshape_eulerian(s, psi, dpsidx);
764 
765  // Get nodal index at which i-th velocity is stored
766  unsigned u_nodal_index = u_index_spherical_nst(i);
767 
768  // Initialise value of u
769  double interpolated_dudx = 0.0;
770  // Loop over the local nodes and sum
771  for (unsigned l = 0; l < n_node; l++)
772  {
773  interpolated_dudx += nodal_value(l, u_nodal_index) * dpsidx(l, j);
774  }
775 
776  return (interpolated_dudx);
777  }
778 
781  {
782  // Find number of nodes
783  unsigned n_pres = npres_spherical_nst();
784  // Local shape function
785  Shape psi(n_pres);
786  // Find values of shape function
787  pshape_spherical_nst(s, psi);
788 
789  // Initialise value of p
790  double interpolated_p = 0.0;
791  // Loop over the local nodes and sum
792  for (unsigned l = 0; l < n_pres; l++)
793  {
794  interpolated_p += p_spherical_nst(l) * psi[l];
795  }
796 
797  return (interpolated_p);
798  }
799  };
800 
804 
805 
806  //==========================================================================
811  //==========================================================================
813  : public virtual QElement<2, 3>,
814  public virtual SphericalNavierStokesEquations
815  {
816  private:
818  static const unsigned Initial_Nvalue[];
819 
820  protected:
824 
825 
830  const Vector<double>& s,
831  Shape& psi,
832  DShape& dpsidx,
833  Shape& test,
834  DShape& dtestdx) const;
835 
840  const unsigned& ipt,
841  Shape& psi,
842  DShape& dpsidx,
843  Shape& test,
844  DShape& dtestdx) const;
845 
847  inline void pshape_spherical_nst(const Vector<double>& s, Shape& psi) const;
848 
850  inline void pshape_spherical_nst(const Vector<double>& s,
851  Shape& psi,
852  Shape& test) const;
853 
855  inline int p_local_eqn(const unsigned& n) const
856  {
857  return this->internal_local_eqn(P_spherical_nst_internal_index, n);
858  }
859 
860  public:
864  {
865  // Allocate and add one Internal data object that stored 2+1 pressure
866  // values;
868  }
869 
871  inline unsigned required_nvalue(const unsigned& n) const
872  {
873  return 3;
874  }
875 
876 
880  double p_spherical_nst(const unsigned& i) const
881  {
882  return this->internal_data_pt(P_spherical_nst_internal_index)->value(i);
883  }
884 
886  unsigned npres_spherical_nst() const
887  {
888  return 3;
889  }
890 
892  void fix_pressure(const unsigned& p_dof, const double& p_value)
893  {
894  this->internal_data_pt(P_spherical_nst_internal_index)->pin(p_dof);
895  this->internal_data_pt(P_spherical_nst_internal_index)
896  ->set_value(p_dof, p_value);
897  }
898 
906  void identify_load_data(
907  std::set<std::pair<Data*, unsigned>>& paired_load_data);
908 
917  std::set<std::pair<Data*, unsigned>>& paired_pressure_data);
918 
920  void output(std::ostream& outfile)
921  {
923  }
924 
926  void output(std::ostream& outfile, const unsigned& nplot)
927  {
929  }
930 
931 
933  void output(FILE* file_pt)
934  {
936  }
937 
939  void output(FILE* file_pt, const unsigned& nplot)
940  {
942  }
943 
944 
948  void full_output(std::ostream& outfile)
949  {
951  }
952 
956  void full_output(std::ostream& outfile, const unsigned& nplot)
957  {
959  }
960 
961 
964  unsigned ndof_types() const
965  {
966  return 4;
967  }
968 
976  std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list) const;
977  };
978 
979  // Inline functions
980 
981  //=======================================================================
985  //=======================================================================
988  Shape& psi,
989  DShape& dpsidx,
990  Shape& test,
991  DShape& dtestdx) const
992  {
993  // Call the geometrical shape functions and derivatives
994  double J = this->dshape_eulerian(s, psi, dpsidx);
995  // Loop over the test functions and derivatives and set them equal to the
996  // shape functions
997  for (unsigned i = 0; i < 9; i++)
998  {
999  test[i] = psi[i];
1000  dtestdx(i, 0) = dpsidx(i, 0);
1001  dtestdx(i, 1) = dpsidx(i, 1);
1002  }
1003  // Return the jacobian
1004  return J;
1005  }
1006 
1007  //=======================================================================
1011  //=======================================================================
1014  Shape& psi,
1015  DShape& dpsidx,
1016  Shape& test,
1017  DShape& dtestdx) const
1018  {
1019  // Call the geometrical shape functions and derivatives
1020  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
1021  // Loop over the test functions and derivatives and set them equal to the
1022  // shape functions
1023  for (unsigned i = 0; i < 9; i++)
1024  {
1025  test[i] = psi[i];
1026  dtestdx(i, 0) = dpsidx(i, 0);
1027  dtestdx(i, 1) = dpsidx(i, 1);
1028  }
1029  // Return the jacobian
1030  return J;
1031  }
1032 
1033 
1034  //=======================================================================
1036  //=======================================================================
1038  const Vector<double>& s, Shape& psi) const
1039  {
1040  psi[0] = 1.0;
1041  psi[1] = s[0];
1042  psi[2] = s[1];
1043  }
1044 
1047  const Vector<double>& s, Shape& psi, Shape& test) const
1048  {
1049  // Call the pressure shape functions
1050  pshape_spherical_nst(s, psi);
1051  // Loop over the test functions and set them equal to the shape functions
1052  for (unsigned i = 0; i < 3; i++) test[i] = psi[i];
1053  }
1054 
1055  //=======================================================================
1057  //=======================================================================
1058  template<>
1060  : public virtual QElement<1, 3>
1061  {
1062  public:
1063  FaceGeometry() : QElement<1, 3>() {}
1064  };
1065 
1066  //=======================================================================
1069  //=======================================================================
1070  template<>
1072  : public virtual PointElement
1073  {
1074  public:
1076  };
1077 
1078 
1081 
1082 
1083  //=======================================================================
1088  //=======================================================================
1090  : public virtual QElement<2, 3>,
1091  public virtual SphericalNavierStokesEquations
1092  {
1093  private:
1095  static const unsigned Initial_Nvalue[];
1096 
1097  protected:
1100  static const unsigned Pconv[];
1101 
1106  const Vector<double>& s,
1107  Shape& psi,
1108  DShape& dpsidx,
1109  Shape& test,
1110  DShape& dtestdx) const;
1111 
1116  const unsigned& ipt,
1117  Shape& psi,
1118  DShape& dpsidx,
1119  Shape& test,
1120  DShape& dtestdx) const;
1121 
1123  inline void pshape_spherical_nst(const Vector<double>& s, Shape& psi) const;
1124 
1126  inline void pshape_spherical_nst(const Vector<double>& s,
1127  Shape& psi,
1128  Shape& test) const;
1129 
1131  inline int p_local_eqn(const unsigned& n) const
1132  {
1133  return this->nodal_local_eqn(Pconv[n], p_nodal_index_spherical_nst());
1134  }
1135 
1136  public:
1140  {
1141  }
1142 
1145  inline virtual unsigned required_nvalue(const unsigned& n) const
1146  {
1147  return Initial_Nvalue[n];
1148  }
1149 
1153  {
1154  return 3;
1155  }
1156 
1159  double p_spherical_nst(const unsigned& n_p) const
1160  {
1161  return this->nodal_value(Pconv[n_p], this->p_nodal_index_spherical_nst());
1162  }
1163 
1165  unsigned npres_spherical_nst() const
1166  {
1167  return 4;
1168  }
1169 
1171  void fix_pressure(const unsigned& p_dof, const double& p_value)
1172  {
1173  this->node_pt(Pconv[p_dof])->pin(this->p_nodal_index_spherical_nst());
1174  this->node_pt(Pconv[p_dof])
1175  ->set_value(this->p_nodal_index_spherical_nst(), p_value);
1176  }
1177 
1178 
1186  void identify_load_data(
1187  std::set<std::pair<Data*, unsigned>>& paired_load_data);
1188 
1189 
1198  std::set<std::pair<Data*, unsigned>>& paired_pressure_data);
1199 
1201  void output(std::ostream& outfile)
1202  {
1204  }
1205 
1207  void output(std::ostream& outfile, const unsigned& nplot)
1208  {
1210  }
1211 
1213  void output(FILE* file_pt)
1214  {
1216  }
1217 
1219  void output(FILE* file_pt, const unsigned& nplot)
1220  {
1222  }
1223 
1224 
1227  unsigned ndof_types() const
1228  {
1229  return 4;
1230  }
1231 
1239  std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list) const;
1240  };
1241 
1242  // Inline functions
1243 
1244  //==========================================================================
1249  //==========================================================================
1252  Shape& psi,
1253  DShape& dpsidx,
1254  Shape& test,
1255  DShape& dtestdx) const
1256  {
1257  // Call the geometrical shape functions and derivatives
1258  double J = this->dshape_eulerian(s, psi, dpsidx);
1259  // Loop over the test functions and derivatives and set them equal to the
1260  // shape functions
1261  for (unsigned i = 0; i < 9; i++)
1262  {
1263  test[i] = psi[i];
1264  dtestdx(i, 0) = dpsidx(i, 0);
1265  dtestdx(i, 1) = dpsidx(i, 1);
1266  }
1267  // Return the jacobian
1268  return J;
1269  }
1270 
1271 
1272  //==========================================================================
1276  //==========================================================================
1279  Shape& psi,
1280  DShape& dpsidx,
1281  Shape& test,
1282  DShape& dtestdx) const
1283  {
1284  // Call the geometrical shape functions and derivatives
1285  double J = this->dshape_eulerian_at_knot(ipt, psi, dpsidx);
1286  // Loop over the test functions and derivatives and set them equal to the
1287  // shape functions
1288  for (unsigned i = 0; i < 9; i++)
1289  {
1290  test[i] = psi[i];
1291  dtestdx(i, 0) = dpsidx(i, 0);
1292  dtestdx(i, 1) = dpsidx(i, 1);
1293  }
1294  // Return the jacobian
1295  return J;
1296  }
1297 
1298  //==========================================================================
1300  //==========================================================================
1302  const Vector<double>& s, Shape& psi) const
1303  {
1304  // Local storage
1305  double psi1[2], psi2[2];
1306  // Call the OneDimensional Shape functions
1307  OneDimLagrange::shape<2>(s[0], psi1);
1308  OneDimLagrange::shape<2>(s[1], psi2);
1309 
1310  // Now let's loop over the nodal points in the element
1311  // s1 is the "x" coordinate, s2 the "y"
1312  for (unsigned i = 0; i < 2; i++)
1313  {
1314  for (unsigned j = 0; j < 2; j++)
1315  {
1316  /*Multiply the two 1D functions together to get the 2D function*/
1317  psi[2 * i + j] = psi2[i] * psi1[j];
1318  }
1319  }
1320  }
1321 
1322 
1323  //==========================================================================
1325  //==========================================================================
1327  const Vector<double>& s, Shape& psi, Shape& test) const
1328  {
1329  // Call the pressure shape functions
1330  pshape_spherical_nst(s, psi);
1331  // Loop over the test functions and set them equal to the shape functions
1332  for (unsigned i = 0; i < 4; i++) test[i] = psi[i];
1333  }
1334 
1335 
1336  //=======================================================================
1338  //=======================================================================
1339  template<>
1341  : public virtual QElement<1, 3>
1342  {
1343  public:
1344  FaceGeometry() : QElement<1, 3>() {}
1345  };
1346 
1347  //=======================================================================
1349  //=======================================================================
1350  template<>
1352  : public virtual PointElement
1353  {
1354  public:
1356  };
1357 
1358 
1359 } // namespace oomph
1360 
1361 #endif
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
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
TimeStepper *& time_stepper_pt()
Return the pointer to the timestepper.
Definition: nodes.h:238
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
double value(const unsigned &i) const
Definition: nodes.h:293
Definition: fsi.h:63
FaceGeometry()
Definition: spherical_navier_stokes_elements.h:1075
FaceGeometry()
Definition: spherical_navier_stokes_elements.h:1355
FaceGeometry()
Definition: spherical_navier_stokes_elements.h:1063
FaceGeometry()
Definition: spherical_navier_stokes_elements.h:1344
Definition: elements.h:4998
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
virtual double dshape_eulerian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidx) const
Definition: elements.cc:3325
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: elements.h:3439
Definition: Qelements.h:459
Definition: spherical_navier_stokes_elements.h:815
void identify_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Definition: spherical_navier_stokes_elements.cc:2369
void full_output(std::ostream &outfile, const unsigned &nplot)
Definition: spherical_navier_stokes_elements.h:956
void output(std::ostream &outfile, const unsigned &nplot)
Redirect output to SphericalNavierStokesEquations output.
Definition: spherical_navier_stokes_elements.h:926
void output(std::ostream &outfile)
Redirect output to SphericalNavierStokesEquations output.
Definition: spherical_navier_stokes_elements.h:920
void output(FILE *file_pt, const unsigned &nplot)
Redirect output to SphericalNavierStokesEquations output.
Definition: spherical_navier_stokes_elements.h:939
int p_local_eqn(const unsigned &n) const
Return the local equation numbers for the pressure values.
Definition: spherical_navier_stokes_elements.h:855
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: spherical_navier_stokes_elements.h:892
unsigned required_nvalue(const unsigned &n) const
Number of values (pinned or dofs) required at local node n.
Definition: spherical_navier_stokes_elements.h:871
double dshape_and_dtest_eulerian_at_knot_spherical_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: spherical_navier_stokes_elements.h:1013
void full_output(std::ostream &outfile)
Definition: spherical_navier_stokes_elements.h:948
double p_spherical_nst(const unsigned &i) const
Definition: spherical_navier_stokes_elements.h:880
void output(FILE *file_pt)
Redirect output to SphericalNavierStokesEquations output.
Definition: spherical_navier_stokes_elements.h:933
QSphericalCrouzeixRaviartElement()
Constructor, there are 3 internal values (for the pressure)
Definition: spherical_navier_stokes_elements.h:862
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Definition: spherical_navier_stokes_elements.cc:2429
void identify_pressure_data(std::set< std::pair< Data *, unsigned >> &paired_pressure_data)
Definition: spherical_navier_stokes_elements.cc:2404
static const unsigned Initial_Nvalue[]
Static array of ints to hold required number of variables at nodes.
Definition: spherical_navier_stokes_elements.h:818
unsigned npres_spherical_nst() const
Return number of pressure values.
Definition: spherical_navier_stokes_elements.h:886
void pshape_spherical_nst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
Definition: spherical_navier_stokes_elements.h:1037
unsigned ndof_types() const
Definition: spherical_navier_stokes_elements.h:964
unsigned P_spherical_nst_internal_index
Definition: spherical_navier_stokes_elements.h:823
double dshape_and_dtest_eulerian_spherical_nst(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: spherical_navier_stokes_elements.h:987
Definition: spherical_navier_stokes_elements.h:1092
QSphericalTaylorHoodElement()
Constructor, no internal data points.
Definition: spherical_navier_stokes_elements.h:1138
double p_spherical_nst(const unsigned &n_p) const
Definition: spherical_navier_stokes_elements.h:1159
unsigned ndof_types() const
Definition: spherical_navier_stokes_elements.h:1227
int p_local_eqn(const unsigned &n) const
Return the local equation numbers for the pressure values.
Definition: spherical_navier_stokes_elements.h:1131
int p_nodal_index_spherical_nst() const
Definition: spherical_navier_stokes_elements.h:1152
virtual unsigned required_nvalue(const unsigned &n) const
Definition: spherical_navier_stokes_elements.h:1145
void output(FILE *file_pt)
Redirect output to SphericalNavierStokesEquations output.
Definition: spherical_navier_stokes_elements.h:1213
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Definition: spherical_navier_stokes_elements.cc:2576
static const unsigned Initial_Nvalue[]
Static array of ints to hold number of variables at node.
Definition: spherical_navier_stokes_elements.h:1095
void output(std::ostream &outfile, const unsigned &nplot)
Redirect output to SphericalNavierStokesEquations output.
Definition: spherical_navier_stokes_elements.h:1207
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: spherical_navier_stokes_elements.h:1171
void pshape_spherical_nst(const Vector< double > &s, Shape &psi) const
Pressure shape functions at local coordinate s.
Definition: spherical_navier_stokes_elements.h:1301
double dshape_and_dtest_eulerian_at_knot_spherical_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: spherical_navier_stokes_elements.h:1278
double dshape_and_dtest_eulerian_spherical_nst(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const
Definition: spherical_navier_stokes_elements.h:1251
void output(FILE *file_pt, const unsigned &nplot)
Redirect output to SphericalNavierStokesEquations output.
Definition: spherical_navier_stokes_elements.h:1219
void identify_load_data(std::set< std::pair< Data *, unsigned >> &paired_load_data)
Definition: spherical_navier_stokes_elements.cc:2514
static const unsigned Pconv[]
Definition: spherical_navier_stokes_elements.h:1100
void output(std::ostream &outfile)
Redirect output to SphericalNavierStokesEquations output.
Definition: spherical_navier_stokes_elements.h:1201
void identify_pressure_data(std::set< std::pair< Data *, unsigned >> &paired_pressure_data)
Definition: spherical_navier_stokes_elements.cc:2549
unsigned npres_spherical_nst() const
Return number of pressure values.
Definition: spherical_navier_stokes_elements.h:1165
Definition: shape.h:76
Definition: spherical_navier_stokes_elements.h:57
SphericalNavierStokesSourceFctPt & source_fct_pt()
Access function for the source-function pointer.
Definition: spherical_navier_stokes_elements.h:347
double d_kin_energy_dt() const
Get integral of time derivative of kinetic energy over element.
Definition: spherical_navier_stokes_elements.cc:1414
void compute_error(std::ostream &outfile, FiniteElement::UnsteadyExactSolutionFctPt exact_soln_pt, const double &time, double &error, double &norm)
Definition: spherical_navier_stokes_elements.cc:156
void get_vorticity(const Vector< double > &s, Vector< double > &vorticity) const
Compute the vorticity vector at local coordinate s.
Definition: spherical_navier_stokes_elements.cc:1300
SphericalNavierStokesSourceFctPt Source_fct_pt
Pointer to volumetric source function.
Definition: spherical_navier_stokes_elements.h:119
double interpolated_dudx_spherical_nst(const Vector< double > &s, const unsigned &i, const unsigned &j) const
Definition: spherical_navier_stokes_elements.h:753
virtual double dshape_and_dtest_eulerian_at_knot_spherical_nst(const unsigned &ipt, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
double pressure_integral() const
Integral of pressure over element.
Definition: spherical_navier_stokes_elements.cc:1521
virtual void pshape_spherical_nst(const Vector< double > &s, Shape &psi) const =0
Compute the pressure shape functions at local coordinate s.
void compute_error_e(std::ostream &outfile, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt, FiniteElement::SteadyExactSolutionFctPt exact_soln_dr_pt, FiniteElement::SteadyExactSolutionFctPt exact_soln_dtheta_pt, double &u_error, double &u_norm, double &p_error, double &p_norm)
Definition: spherical_navier_stokes_elements.cc:312
void output(std::ostream &outfile)
Definition: spherical_navier_stokes_elements.h:517
void full_output(std::ostream &outfile)
Definition: spherical_navier_stokes_elements.h:542
virtual unsigned u_index_spherical_nst(const unsigned &i) const
Definition: spherical_navier_stokes_elements.h:387
double * Density_Ratio_pt
Definition: spherical_navier_stokes_elements.h:94
const double & re() const
Reynolds number.
Definition: spherical_navier_stokes_elements.h:249
SphericalNavierStokesSourceFctPt source_fct_pt() const
Access function for the source-function pointer. Const version.
Definition: spherical_navier_stokes_elements.h:353
virtual double dshape_and_dtest_eulerian_spherical_nst(const Vector< double > &s, Shape &psi, DShape &dpsidx, Shape &test, DShape &dtestdx) const =0
static double Default_Physical_Ratio_Value
Navier–Stokes equations static data.
Definition: spherical_navier_stokes_elements.h:80
void get_pressure_and_velocity_mass_matrix_diagonal(Vector< double > &press_mass_diag, Vector< double > &veloc_mass_diag, const unsigned &which_one=0)
Definition: spherical_navier_stokes_elements.cc:62
double * ReSt_pt
Pointer to global Reynolds number x Strouhal number (=Womersley)
Definition: spherical_navier_stokes_elements.h:102
void strain_rate(const Vector< double > &s, DenseMatrix< double > &strain_rate) const
Strain-rate tensor: 1/2 (du_i/dx_j + du_j/dx_i)
Definition: spherical_navier_stokes_elements.cc:1197
static Vector< double > Gamma
Vector to decide whether the stress-divergence form is used or not.
Definition: spherical_navier_stokes_elements.h:244
double *& viscosity_ratio_pt()
Pointer to Viscosity Ratio.
Definition: spherical_navier_stokes_elements.h:280
const double & re_invro() const
Global Reynolds number multiplied by inverse Rossby number.
Definition: spherical_navier_stokes_elements.h:311
double u_spherical_nst(const unsigned &n, const unsigned &i) const
Definition: spherical_navier_stokes_elements.h:367
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: spherical_navier_stokes_elements.h:681
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute the element's residual Vector.
Definition: spherical_navier_stokes_elements.h:668
virtual double p_spherical_nst(const unsigned &n_p) const =0
double *& re_invfr_pt()
Pointer to global inverse Froude number.
Definition: spherical_navier_stokes_elements.h:305
const double & density_ratio() const
Definition: spherical_navier_stokes_elements.h:287
Vector< double > * G_pt
Pointer to global gravity Vector.
Definition: spherical_navier_stokes_elements.h:113
virtual void get_body_force_spherical_nst(const double &time, const unsigned &ipt, const Vector< double > &s, const Vector< double > &x, Vector< double > &result)
Definition: spherical_navier_stokes_elements.h:166
static int Pressure_not_stored_at_node
Definition: spherical_navier_stokes_elements.h:72
double du_dt_spherical_nst(const unsigned &n, const unsigned &i) const
Definition: spherical_navier_stokes_elements.h:395
double * ReInvRo_pt
Definition: spherical_navier_stokes_elements.h:110
double *& re_pt()
Pointer to Reynolds number.
Definition: spherical_navier_stokes_elements.h:261
void output(FILE *file_pt)
Definition: spherical_navier_stokes_elements.h:529
virtual int p_nodal_index_spherical_nst() const
Definition: spherical_navier_stokes_elements.h:448
double * Re_pt
Pointer to global Reynolds number.
Definition: spherical_navier_stokes_elements.h:99
double * Viscosity_Ratio_pt
Definition: spherical_navier_stokes_elements.h:90
Vector< double > actual_dr(const Vector< double > &x)
Definition: spherical_navier_stokes_elements.h:637
const double & re_invfr() const
Global inverse Froude number.
Definition: spherical_navier_stokes_elements.h:299
virtual void pshape_spherical_nst(const Vector< double > &s, Shape &psi, Shape &test) const =0
void disable_ALE()
Definition: spherical_navier_stokes_elements.h:424
SphericalNavierStokesBodyForceFctPt body_force_fct_pt() const
Access function for the body-force pointer. Const version.
Definition: spherical_navier_stokes_elements.h:341
double cot(const double &th) const
Definition: spherical_navier_stokes_elements.h:218
double *& re_invro_pt()
Pointer to global inverse Froude number.
Definition: spherical_navier_stokes_elements.h:317
double interpolated_p_spherical_nst(const Vector< double > &s) const
Return FE interpolated pressure at local coordinate s.
Definition: spherical_navier_stokes_elements.h:780
void compute_shear_stress(std::ostream &outfile)
Definition: spherical_navier_stokes_elements.cc:495
void output_fct(std::ostream &outfile, const unsigned &nplot, FiniteElement::SteadyExactSolutionFctPt exact_soln_pt)
Definition: spherical_navier_stokes_elements.cc:630
double kin_energy() const
Get integral of kinetic energy over element.
Definition: spherical_navier_stokes_elements.cc:1370
void output_vorticity(std::ostream &outfile, const unsigned &nplot)
Definition: spherical_navier_stokes_elements.cc:1046
double dissipation() const
Return integral of dissipation over element.
Definition: spherical_navier_stokes_elements.cc:1086
static double Default_Physical_Constant_Value
Navier–Stokes equations static data.
Definition: spherical_navier_stokes_elements.h:76
void get_traction(const Vector< double > &s, const Vector< double > &N, Vector< double > &traction)
Definition: spherical_navier_stokes_elements.cc:1137
double(* SphericalNavierStokesSourceFctPt)(const double &time, const Vector< double > &x)
Definition: spherical_navier_stokes_elements.h:66
Vector< double > actual_dth(const Vector< double > &x)
Definition: spherical_navier_stokes_elements.h:653
const Vector< double > & g() const
Vector of gravitational components.
Definition: spherical_navier_stokes_elements.h:323
double * ReInvFr_pt
Definition: spherical_navier_stokes_elements.h:106
void fill_in_contribution_to_jacobian_and_mass_matrix(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix)
Definition: spherical_navier_stokes_elements.h:691
virtual void fill_in_generic_residual_contribution_spherical_nst(Vector< double > &residuals, DenseMatrix< double > &jacobian, DenseMatrix< double > &mass_matrix, unsigned flag)
Definition: spherical_navier_stokes_elements.cc:1566
static Vector< double > Default_Gravity_vector
Static default value for the gravity vector.
Definition: spherical_navier_stokes_elements.h:83
SphericalNavierStokesBodyForceFctPt Body_force_fct_pt
Pointer to body force function.
Definition: spherical_navier_stokes_elements.h:116
double *& re_st_pt()
Pointer to product of Reynolds and Strouhal number (=Womersley number)
Definition: spherical_navier_stokes_elements.h:267
double u_spherical_nst(const unsigned &t, const unsigned &n, const unsigned &i) const
Definition: spherical_navier_stokes_elements.h:374
virtual int p_local_eqn(const unsigned &n) const =0
SphericalNavierStokesEquations()
Definition: spherical_navier_stokes_elements.h:226
virtual unsigned npres_spherical_nst() const =0
Function to return number of pressure degrees of freedom.
void extract_velocity(std::ostream &outfile)
Definition: spherical_navier_stokes_elements.cc:540
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.
double interpolated_u_spherical_nst(const Vector< double > &s, const unsigned &i) const
Return FE interpolated velocity u[i] at local coordinate s.
Definition: spherical_navier_stokes_elements.h:727
bool ALE_is_disabled
Definition: spherical_navier_stokes_elements.h:124
void output_veloc(std::ostream &outfile, const unsigned &nplot, const unsigned &t)
Definition: spherical_navier_stokes_elements.cc:743
void get_load(const Vector< double > &s, const Vector< double > &N, Vector< double > &load)
Definition: spherical_navier_stokes_elements.h:492
void(* SphericalNavierStokesBodyForceFctPt)(const double &time, const Vector< double > &x, Vector< double > &body_force)
Definition: spherical_navier_stokes_elements.h:61
void enable_ALE()
Definition: spherical_navier_stokes_elements.h:433
const double & re_st() const
Product of Reynolds and Strouhal number (=Womersley number)
Definition: spherical_navier_stokes_elements.h:255
void interpolated_u_spherical_nst(const Vector< double > &s, Vector< double > &veloc) const
Compute vector of FE interpolated velocity u at local coordinate s.
Definition: spherical_navier_stokes_elements.h:702
Vector< double > *& g_pt()
Pointer to Vector of gravitational components.
Definition: spherical_navier_stokes_elements.h:329
SphericalNavierStokesBodyForceFctPt & body_force_fct_pt()
Access function for the body-force pointer.
Definition: spherical_navier_stokes_elements.h:335
virtual double get_source_spherical_nst(double time, const unsigned &ipt, const Vector< double > &x)
Definition: spherical_navier_stokes_elements.h:190
const double & viscosity_ratio() const
Definition: spherical_navier_stokes_elements.h:274
Vector< double > actual(const Vector< double > &x)
Definition: spherical_navier_stokes_elements.h:621
double *& density_ratio_pt()
Pointer to Density ratio.
Definition: spherical_navier_stokes_elements.h:293
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
double theta
Definition: two_d_biharmonic.cc:236
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 tan(const bfloat16 &a)
Definition: BFloat16.h:633
double Re
Reynolds number.
Definition: axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:61
void body_force(const double &time, const Vector< double > &x, Vector< double > &result)
Definition: axisym_linear_elasticity/cylinder/cylinder.cc:96
r
Definition: UniformPSDSelfTest.py:20
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