linear_solvers/driven_cavity.cc File Reference

Classes

class  RectangularDrivenCavityProblem< ELEMENT >
 Driven cavity problem in rectangular domain. More...
 

Namespaces

 Global_Physical_Variables
 Global variables.
 

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Driver for RectangularDrivenCavity test problem – test drive with two different types of element. Optional command line args specify multiplier for number of element rows/columns and flag to indicate if iterative solver is used. Multiplier and flag both default to 1.

415 {
416 
417  // Store command line arguments
418  CommandLineArgs::setup(argc,argv);
419 
420  // Default assignemts for flags
421  unsigned element_multiplier=1;
422  bool use_iterative_solver=true;
423  bool use_hypre_for_pressure=true;
424  bool use_block_diagonal_for_momentum=false;
425  bool use_hypre_for_momentum=true;
426  bool do_cr=true;
427  bool do_th=true;
428  oomph_info << CommandLineArgs::Argc << std::endl;
429 
430  if (CommandLineArgs::Argc==1)
431  {
432  oomph_info << "No command line arguments; running self-test"
433  << std::endl;
434  }
435  else if (CommandLineArgs::Argc==7)
436  {
437  element_multiplier=unsigned(atoi(CommandLineArgs::Argv[1]));
438  if (atoi(CommandLineArgs::Argv[2])==0)
439  {
440  use_iterative_solver=false;
441  }
442  else if (atoi(CommandLineArgs::Argv[2])==1)
443  {
444  use_iterative_solver=true;
445  }
446  else
447  {
448  oomph_info << "Second command line arg must be 0 or 1 for\n"
449  << "don't/do use iterative solver, but is"
450  << CommandLineArgs::Argv[2] << std::endl;
451  abort();
452  }
453  if (atoi(CommandLineArgs::Argv[3])==0)
454  {
455  use_hypre_for_momentum=false;
456  }
457  else if (atoi(CommandLineArgs::Argv[3])==1)
458  {
459  use_hypre_for_momentum=true;
460  }
461  else
462  {
463  oomph_info << "Third command line arg must be 0 or 1 for\n"
464  << "don't/do use hypre for momentum block solver, but is"
465  << CommandLineArgs::Argv[3] << std::endl;
466  abort();
467  }
468  if (atoi(CommandLineArgs::Argv[4])==0)
469  {
470  use_hypre_for_pressure=false;
471  }
472  else if (atoi(CommandLineArgs::Argv[4])==1)
473  {
474  use_hypre_for_pressure=true;
475  }
476  else
477  {
478  oomph_info << "Fourth command line arg must be 0 or 1 for\n"
479  << "don't/do use hypre for pressure block solver, but is"
480  << CommandLineArgs::Argv[4] << std::endl;
481  abort();
482  }
483  if (atoi(CommandLineArgs::Argv[5])==0)
484  {
485  do_cr=true;
486  do_th=true;
487  }
488  else if (atoi(CommandLineArgs::Argv[5])==1)
489  {
490  do_cr=true;
491  do_th=false;
492  }
493  else if (atoi(CommandLineArgs::Argv[5])==2)
494  {
495  do_cr=false;
496  do_th=true;
497  }
498  else
499  {
500  oomph_info << "Fifth command line arg must be 0, 1 or 2 for\n"
501  << "run both (0) or only CR (1) or TH (2) elements, but is"
502  << CommandLineArgs::Argv[5] << std::endl;
503  abort();
504  }
505  if (atoi(CommandLineArgs::Argv[6])==0)
506  {
507  use_block_diagonal_for_momentum=false;
508  }
509  else if (atoi(CommandLineArgs::Argv[6])==1)
510  {
511  use_block_diagonal_for_momentum=true;
512  }
513  else
514  {
515  oomph_info << "Sixth command line arg must be 0 or 1 for\n"
516  << "don't/do use block diagonal for pressure solver, but is"
517  << CommandLineArgs::Argv[6] << std::endl;
518  abort();
519  }
520  }
521  else
522  {
523  oomph_info << "Wrong number of command line arguments" << std::endl;
524  oomph_info << "Enter none (for default) or six" << std::endl;
525  oomph_info << "- multiplier for number of element rows/columns"
526  << std::endl;
527  oomph_info << "- flag (0/1) for (don't/do) use iterative solver"
528  << std::endl;
529  oomph_info << "- flag (0/1) for (don't/do) use hypre for pressure block"
530  << std::endl;
531  oomph_info << "- flag (0/1) for (don't/do) use hypre for momentum block"
532  << std::endl;
533  oomph_info << "- flag (0/1/2) run both (0) or only CR (1) or TH (2) "
534  << "elements" << std::endl;
535  oomph_info << "- flag (0/1) for (don't/do) use block diagonal for "
536  << "momentum block" << std::endl;
537  abort();
538  }
539 
540  oomph_info << "Running with element multiplier: "
541  << element_multiplier << std::endl;
542 
543  if (use_iterative_solver)
544  {
545  oomph_info << "Using iterative solver" << std::endl;
546  }
547  else
548  {
549  oomph_info << "Using direct solver" << std::endl;
550  }
551 
552  if (use_hypre_for_pressure)
553  {
554  oomph_info << "Using hypre for pressure block" << std::endl;
555  }
556  else
557  {
558  oomph_info << "Using SuperLU for pressure block" << std::endl;
559  }
560 
561  if (use_hypre_for_momentum)
562  {
563  oomph_info << "Using hypre for momentum block" << std::endl;
564  }
565  else
566  {
567  oomph_info << "Using SuperLU for momentum block" << std::endl;
568  }
569 
570  if (use_block_diagonal_for_momentum)
571  {
572  oomph_info << "Using block diagonal for momentum block" << std::endl;
573  }
574 
575  // Set up doc info
576  // ---------------
577 
578  // Label for output
579  DocInfo doc_info;
580 
581  // Set output directory
582  doc_info.set_directory("RESLT");
583 
584  // Step number
585  doc_info.number()=0;
586 
587  // ---------------
588  // end of Set up doc info
589 
590 
591  // Doing QCrouzeixRaviartElements
592  if (do_cr)
593  {
594  // Build the problem with QCrouzeixRaviartElements
596  problem(element_multiplier,use_iterative_solver,
597  use_hypre_for_pressure,use_hypre_for_momentum,
598  use_block_diagonal_for_momentum);
599  cout << "Doing QCrouzeixRaviartElement<2>" << std::endl;
600 
601  // Solve the problem
602  problem.newton_solve();
603 
604  // Outpt the solution
605  problem.doc_solution(doc_info);
606 
607  // Step number
608  doc_info.number()++;
609 
610  } // end of QCrouzeixRaviartElements
611 
612  // Doing QTaylorHoodElements
613  if (do_th)
614  {
615 
616  // Build the problem with QTaylorHoodElements
618  problem(element_multiplier,use_iterative_solver,
619  use_hypre_for_pressure,use_hypre_for_momentum,
620  use_block_diagonal_for_momentum);
621  cout << "Doing QTaylorHoodElement<2>" << std::endl;
622 
623  // Solve the problem
624  problem.newton_solve();
625 
626  // Outpt the solution
627  problem.doc_solution(doc_info);
628 
629  // Step number
630  doc_info.number()++;
631 
632  } // end of QTaylorHoodElements
633 
634 } // end_of_main
Driven cavity problem in rectangular domain.
Definition: linear_solvers/driven_cavity.cc:77
Definition: oomph_utilities.h:499
void set_directory(const std::string &directory)
Definition: oomph_utilities.cc:298
unsigned & number()
Number used (e.g.) for labeling output files.
Definition: oomph_utilities.h:554
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
char ** Argv
Arguments themselves.
Definition: oomph_utilities.cc:410
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::CommandLineArgs::Argc, oomph::CommandLineArgs::Argv, oomph::DocInfo::number(), oomph::oomph_info, problem, oomph::DocInfo::set_directory(), and Flag_definition::setup().