37 #include "navier_stokes.h"    40 #include "axisym_navier_stokes.h"    43 #include "meshes/rectangular_quadmesh.h"    47 using namespace oomph;
    74 template <
class ELEMENT, 
class TIMESTEPPER>
    83                          const double& l_r, 
const double& l_z);
    89  void set_initial_condition();
    92  void set_boundary_conditions();
    95  void doc_solution(DocInfo &doc_info);
    98  void unsteady_run(
const double& t_max, 
const double& dt,
    99                    const string dir_name);
   102  RefineableRectangularQuadMesh<ELEMENT>* 
mesh_pt() 
   104    return dynamic_cast<RefineableRectangularQuadMesh<ELEMENT>*
>   105     (Problem::mesh_pt());
   122    RefineableAxisymmetricNavierStokesEquations::
   123     unpin_all_pressure_dofs(mesh_pt()->element_pt());
   126    RefineableAxisymmetricNavierStokesEquations::
   127     pin_redundant_nodal_pressures(mesh_pt()->element_pt());
   130    fix_pressure(0,0,0.0);
   136                    const unsigned& pdof, 
   137                    const double& pvalue)
   140    dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e))->
   141     fix_pressure(pdof,pvalue);
   151 template <
class ELEMENT, 
class TIMESTEPPER>
   154                         const double& l_r, 
const double& l_z)
   158  add_time_stepper_pt(
new TIMESTEPPER);
   161  Problem::mesh_pt() = 
new RefineableRectangularQuadMesh<ELEMENT>
   162   (n_r,n_z,l_r,l_z,time_stepper_pt());
   165  mesh_pt()->spatial_error_estimator_pt() = 
new Z2ErrorEstimator;
   168  mesh_pt()->max_refinement_level() = 4;
   171  mesh_pt()->max_permitted_error() = 1.0e-2;
   172  mesh_pt()->min_permitted_error() = 1.0e-3;
   182  const unsigned n_boundary = mesh_pt()->nboundary();
   185  for(
unsigned b=0;b<n_boundary;b++)
   188    const unsigned n_node = mesh_pt()->nboundary_node(b);
   191    for(
unsigned n=0;n<n_node;n++)
   194      mesh_pt()->boundary_node_pt(b,n)->pin(0);
   197      if(b!=3) { mesh_pt()->boundary_node_pt(b,n)->pin(1); }
   200      mesh_pt()->boundary_node_pt(b,n)->pin(2);
   210  const unsigned n_element = mesh_pt()->nelement();
   213  for(
unsigned e=0;e<n_element;e++)
   216    ELEMENT* el_pt = 
dynamic_cast<ELEMENT*
>(mesh_pt()->element_pt(e));
   225    el_pt->disable_ALE();
   230  RefineableAxisymmetricNavierStokesEquations::
   231   pin_redundant_nodal_pressures(mesh_pt()->element_pt());
   234  fix_pressure(0,0,0.0);
   237  cout << 
"Number of equations: " << assign_eqn_numbers() << std::endl; 
   247 template <
class ELEMENT, 
class TIMESTEPPER>
   251  const unsigned n_node = mesh_pt()->nnode();
   254  for(
unsigned n=0;n<n_node;n++)
   257    for(
unsigned i=0;i<3;i++)
   260      mesh_pt()->node_pt(n)->set_value(i,0.0);
   266  assign_initial_values_impulsive();
   277 template <
class ELEMENT, 
class TIMESTEPPER>
   281  const unsigned n_boundary = mesh_pt()->nboundary();
   284  for(
unsigned b=0;b<n_boundary;b++)
   287    const unsigned n_node = mesh_pt()->nboundary_node(b);
   290    for(
unsigned n=0;n<n_node;n++)
   296        const double r_pos = mesh_pt()->boundary_node_pt(b,n)->x(0);
   299        mesh_pt()->boundary_node_pt(b,n)->set_value(0,0,0.0); 
   300        mesh_pt()->boundary_node_pt(b,n)->set_value(0,1,0.0); 
   301        mesh_pt()->boundary_node_pt(b,n)->set_value(0,2,r_pos); 
   309        mesh_pt()->boundary_node_pt(b,n)->set_value(0,0,0.0);
   310        mesh_pt()->boundary_node_pt(b,n)->set_value(0,2,0.0);
   322 template <
class ELEMENT, 
class TIMESTEPPER>
   328  cout << 
"Time is now " << time_pt()->time() << std::endl;
   334  const unsigned npts = 5;
   337  sprintf(filename,
"%s/soln%i.dat",
   338          doc_info.directory().c_str(),doc_info.number());
   339  some_file.open(filename);
   342  mesh_pt()->output(some_file,npts);
   354 template <
class ELEMENT, 
class TIMESTEPPER>
   356 unsteady_run(
const double& t_max, 
const double& dt, 
const string dir_name)
   363  doc_info.set_directory(dir_name);
   372  set_initial_condition();
   375  unsigned max_adapt = 4;
   378  for(
unsigned i=0;i<2;i++) { refine_uniformly(); }
   381  const unsigned n_timestep = unsigned(t_max/dt);
   384  doc_solution(doc_info);
   390  bool first_timestep = 
true;
   393  Z2ErrorEstimator* error_pt = 
dynamic_cast<Z2ErrorEstimator*
>   394   (mesh_pt()->spatial_error_estimator_pt());
   395  error_pt->reference_flux_norm() = 0.01;
   398  for(
unsigned t=1;t<=n_timestep;t++)
   401    cout << 
"\nTimestep " << t << 
" of " << n_timestep << std::endl;
   404    unsteady_newton_solve(dt,max_adapt,first_timestep);
   407    first_timestep = 
false; 
   413    doc_solution(doc_info);
   431 int main(
int argc, 
char* argv[])
   434  CommandLineArgs::setup(argc,argv);
   440  const double dt = 0.01;
   443  if(CommandLineArgs::Argc>1) { t_max = 0.02; }
   446  const unsigned n_r = 2;
   449  const unsigned n_z = 2;
   452  const double l_r = 1.0;
   455  const double l_z = 1.4;
   461   cout << 
"Doing RefineableAxisymmetricQTaylorHoodElement" << std::endl;
   465    <RefineableAxisymmetricQTaylorHoodElement, BDF<2> > 
   466    problem(n_r,n_z,l_r,l_z);
   469   problem.unsteady_run(t_max,dt,
"RESLT_TH");
   476   cout << 
"Doing RefineableAxisymmetricQCrouzeixRaviartElement" << std::endl;
   480    <RefineableAxisymmetricQCrouzeixRaviartElement, BDF<2> >
   481    problem(n_r,n_z,l_r,l_z);
   484   problem.unsteady_run(t_max,dt,
"RESLT_CR");
 RotatingCylinderProblem(const unsigned &n_r, const unsigned &n_z, const double &l_r, const double &l_z)
Constructor for refineable rotating cylinder problem. 
 
~RotatingCylinderProblem()
Destructor (empty) 
 
void unsteady_run(const double &t_max, const double &dt, const string dir_name)
Do unsteady run up to maximum time t_max with given timestep dt. 
 
double ReSt
Womersley number. 
 
void actions_after_adapt()
After adaptation: Pin pressure again (the previously pinned value might have disappeared) and pin red...
 
void set_boundary_conditions()
Set boundary conditions. 
 
RefineableRectangularQuadMesh< ELEMENT > * mesh_pt()
Access function for the specific mesh. 
 
double Re
Reynolds number. 
 
Namespace for physical parameters. 
 
int main(int argc, char *argv[])
Driver code for axisymmetric spin-up problem. 
 
void fix_pressure(const unsigned &e, const unsigned &pdof, const double &pvalue)
Fix pressure in element e at pressure dof pdof and set to pvalue. 
 
void actions_after_newton_solve()
No actions required after solve step. 
 
void set_initial_condition()
Set initial conditions. 
 
void doc_solution(DocInfo &doc_info)
Document the solution. 
 
void actions_before_newton_solve()
Update the problem specs before solve. Reset velocity boundary conditions just to be on the safe side...
 
Refineable rotating cylinder problem in a rectangular axisymmetric domain.