mpi/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.

424 {
425 
426 
427 #ifdef OOMPH_HAS_MPI
428  MPI_Helpers::init(argc,argv);
429 #endif
430 
431 
432  // Store command line arguments
433  CommandLineArgs::setup(argc,argv);
434 
435  // Default assignemts for flags
436  unsigned element_multiplier=1;
437  bool use_iterative_solver=true;
438  bool use_hypre_for_pressure=true;
439  bool use_block_diagonal_for_momentum=false;
440  bool use_hypre_for_momentum=true;
441  bool do_cr=true;
442  bool do_th=true;
443  oomph_info << CommandLineArgs::Argc << std::endl;
444 
445  if (CommandLineArgs::Argc==1)
446  {
447  oomph_info << "No command line arguments; running self-test"
448  << std::endl;
449  }
450  else if (CommandLineArgs::Argc==7)
451  {
452  element_multiplier=unsigned(atoi(CommandLineArgs::Argv[1]));
453  if (atoi(CommandLineArgs::Argv[2])==0)
454  {
455  use_iterative_solver=false;
456  }
457  else if (atoi(CommandLineArgs::Argv[2])==1)
458  {
459  use_iterative_solver=true;
460  }
461  else
462  {
463  oomph_info << "Second command line arg must be 0 or 1 for\n"
464  << "don't/do use iterative solver, but is"
465  << CommandLineArgs::Argv[2] << std::endl;
466  abort();
467  }
468  if (atoi(CommandLineArgs::Argv[3])==0)
469  {
470  use_hypre_for_momentum=false;
471  }
472  else if (atoi(CommandLineArgs::Argv[3])==1)
473  {
474  use_hypre_for_momentum=true;
475  }
476  else
477  {
478  oomph_info << "Third command line arg must be 0 or 1 for\n"
479  << "don't/do use hypre for momentum block solver, but is"
480  << CommandLineArgs::Argv[3] << std::endl;
481  abort();
482  }
483  if (atoi(CommandLineArgs::Argv[4])==0)
484  {
485  use_hypre_for_pressure=false;
486  }
487  else if (atoi(CommandLineArgs::Argv[4])==1)
488  {
489  use_hypre_for_pressure=true;
490  }
491  else
492  {
493  oomph_info << "Fourth command line arg must be 0 or 1 for\n"
494  << "don't/do use hypre for pressure block solver, but is"
495  << CommandLineArgs::Argv[4] << std::endl;
496  abort();
497  }
498  if (atoi(CommandLineArgs::Argv[5])==0)
499  {
500  do_cr=true;
501  do_th=true;
502  }
503  else if (atoi(CommandLineArgs::Argv[5])==1)
504  {
505  do_cr=true;
506  do_th=false;
507  }
508  else if (atoi(CommandLineArgs::Argv[5])==2)
509  {
510  do_cr=false;
511  do_th=true;
512  }
513  else
514  {
515  oomph_info << "Fifth command line arg must be 0, 1 or 2 for\n"
516  << "run both (0) or only CR (1) or TH (2) elements, but is"
517  << CommandLineArgs::Argv[5] << std::endl;
518  abort();
519  }
520  if (atoi(CommandLineArgs::Argv[6])==0)
521  {
522  use_block_diagonal_for_momentum=false;
523  }
524  else if (atoi(CommandLineArgs::Argv[6])==1)
525  {
526  use_block_diagonal_for_momentum=true;
527  }
528  else
529  {
530  oomph_info << "Sixth command line arg must be 0 or 1 for\n"
531  << "don't/do use block diagonal for pressure solver, but is"
532  << CommandLineArgs::Argv[6] << std::endl;
533  abort();
534  }
535  }
536  else
537  {
538  oomph_info << "Wrong number of command line arguments" << std::endl;
539  oomph_info << "Enter none (for default) or six" << std::endl;
540  oomph_info << "- multiplier for number of element rows/columns"
541  << std::endl;
542  oomph_info << "- flag (0/1) for (don't/do) use iterative solver"
543  << std::endl;
544  oomph_info << "- flag (0/1) for (don't/do) use hypre for pressure block"
545  << std::endl;
546  oomph_info << "- flag (0/1) for (don't/do) use hypre for momentum block"
547  << std::endl;
548  oomph_info << "- flag (0/1/2) run both (0) or only CR (1) or TH (2) "
549  << "elements" << std::endl;
550  oomph_info << "- flag (0/1) for (don't/do) use block diagonal for "
551  << "momentum block" << std::endl;
552  abort();
553  }
554 
555  oomph_info << "Running with element multiplier: "
556  << element_multiplier << std::endl;
557 
558  if (use_iterative_solver)
559  {
560  oomph_info << "Using iterative solver" << std::endl;
561  }
562  else
563  {
564  oomph_info << "Using direct solver" << std::endl;
565  }
566 
567  if (use_hypre_for_pressure)
568  {
569  oomph_info << "Using hypre for pressure block" << std::endl;
570  }
571  else
572  {
573  oomph_info << "Using SuperLU for pressure block" << std::endl;
574  }
575 
576  if (use_hypre_for_momentum)
577  {
578  oomph_info << "Using hypre for momentum block" << std::endl;
579  }
580  else
581  {
582  oomph_info << "Using SuperLU for momentum block" << std::endl;
583  }
584 
585  if (use_block_diagonal_for_momentum)
586  {
587  oomph_info << "Using block diagonal for momentum block" << std::endl;
588  }
589 
590  // Set up doc info
591  // ---------------
592 
593  // Label for output
594  DocInfo doc_info;
595 
596  // Set output directory
597  doc_info.set_directory("RESLT");
598 
599  // Step number
600  doc_info.number()=0;
601 
602  // ---------------
603  // end of Set up doc info
604 
605 
606  // Doing QCrouzeixRaviartElements
607  if (do_cr)
608  {
609  // Build the problem with QCrouzeixRaviartElements
611  problem(element_multiplier,use_iterative_solver,
612  use_hypre_for_pressure,use_hypre_for_momentum,
613  use_block_diagonal_for_momentum);
614  cout << "Doing QCrouzeixRaviartElement<2>" << std::endl;
615 
616  // Solve the problem
617  problem.newton_solve();
618 
619  // Outpt the solution
620  problem.doc_solution(doc_info);
621 
622  // Step number
623  doc_info.number()++;
624 
625  } // end of QCrouzeixRaviartElements
626 
627  // Doing QTaylorHoodElements
628  if (do_th)
629  {
630 
631  // Build the problem with QTaylorHoodElements
633  problem(element_multiplier,use_iterative_solver,
634  use_hypre_for_pressure,use_hypre_for_momentum,
635  use_block_diagonal_for_momentum);
636  cout << "Doing QTaylorHoodElement<2>" << std::endl;
637 
638  // Solve the problem
639  problem.newton_solve();
640 
641  // Outpt the solution
642  problem.doc_solution(doc_info);
643 
644  // Step number
645  doc_info.number()++;
646 
647  } // end of QTaylorHoodElements
648 
649 #ifdef OOMPH_HAS_MPI
650  MPI_Helpers::finalize();
651 #endif
652 
653 
654 
655 } // 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().