two_d_tilted_square.cc File Reference
#include <fenv.h>
#include <sstream>
#include <iomanip>
#include <ios>
#include "generic.h"
#include "navier_stokes.h"
#include "meshes/simple_rectangular_quadmesh.h"
#include "meshes/rectangular_quadmesh.h"
#include "meshes/simple_cubic_mesh.h"
#include "meshes/simple_cubic_tet_mesh.h"

Classes

class  oomph::SlopingQuadMesh< ELEMENT >
 
class  TiltedCavityProblem< ELEMENT >
 

Namespaces

 Global_Variables
 Namespace for physical parameters.
 
 oomph
 DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
 

Functions

double Global_Variables::degtorad (const double &ang_deg)
 Convert degrees to radians. More...
 
int main (int argc, char **argv)
 Driver for Lagrange enforced flow preconditioner. More...
 

Variables

static const unsigned Global_Variables::Dim = 2
 Problem dimension. More...
 
static const double Global_Variables::X_min = 0.0
 Min and max x value respectively. More...
 
static const double Global_Variables::X_max = 1.0
 
static const double Global_Variables::Y_min = 0.0
 Min and max y value respectively. More...
 
static const double Global_Variables::Y_max = 1.0
 
static const double Global_Variables::Lx = X_max - X_min
 The domain length in the x and y direction respectively. More...
 
static const double Global_Variables::Ly = Y_max - Y_min
 
unsigned Global_Variables::Visc = 0
 The viscous term. More...
 
double Global_Variables::Re = 100.0
 Reynolds number. More...
 
double Global_Variables::Ang_deg = 30.0
 Tilting angle of the domain with the x-axis. More...
 
double Global_Variables::Ang_rad = -1.0
 
unsigned Global_Variables::Noel = 4
 Number of elements in 1D. More...
 
bool Global_Variables::Use_trilinos = false
 Use trilinos? More...
 
bool Global_Variables::Use_lsc = false
 Use LSC preconditioner for the Navier-Stokes block? More...
 
bool Global_Variables::Use_amg_for_f = false
 Use Boomer AMG for the momentum block? More...
 
bool Global_Variables::Use_amg_for_p = false
 Use Boomer AMG for the pressure block? More...
 
unsigned Global_Variables::Soln_num = 0
 Soln number (for doc_solution) More...
 
Vector< unsignedGlobal_Variables::Iterations
 Storage for number of iterations during Newton steps. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Driver for Lagrange enforced flow preconditioner.

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

612 {
613 #ifdef OOMPH_HAS_MPI
614  MPI_Helpers::init(argc,argv);
615 #endif
616 
617  // Alias the namespace for convenience.
618  namespace GV = Global_Variables;
619 
620  // Store command line arguments
621  CommandLineArgs::setup(argc,argv);
622 
623  // Store the viscous term, default is simple form.
625 
626  // Default is 100.0
628 
629  // Defaults to 30 degrees
631 
632  // Defaults to 4
634 
635  // Use trilinos solver?
637 
638  // Use the LSC preconditioner for the Navier-Stokes block?
640 
641  // Use the amg for the momentum block?
643 
644  // Use the amg for the pressure block?
646 
648 
649  // Parse the above flags.
652 
654 
655  if(GV::Visc == 0)
656  {
657  oomph_info << "Doing simple form" << std::endl;
658  for (unsigned d = 0; d < GV::Dim; d++)
659  {
661  }
662  }
663  else
664  {
665  oomph_info << "Doing stress divergence form" << std::endl;
666  for (unsigned d = 0; d < GV::Dim; d++)
667  {
669  }
670  }
671 
672  // Set the flag for trilinos solver
674  {
675 #ifdef OOMPH_HAS_TRILINOS
676  GV::Use_trilinos = true;
677 #else
678  std::ostringstream warning_stream;
679  warning_stream << "WARNING: \n"
680  << "No trilinos installed, using oomphlib's GMRES solver.\n";
681  OomphLibWarning(warning_stream.str(),
684 
685  GV::Use_trilinos = false;
686 #endif
687  }
688  else
689  {
690  GV::Use_trilinos = false;
691  }
692 
693  // Set the flag for lsc
695  {
696  GV::Use_lsc = true;
697  }
698  else
699  {
700  GV::Use_lsc = false;
701  }
702 
703  // Set the flag for amg for the momentum block
705  {
706  GV::Use_amg_for_f = true;
707  }
708  else
709  {
710  GV::Use_amg_for_f = false;
711  }
712 
713  // Set the flag for amg for the pressure block
715  {
716  GV::Use_amg_for_p = true;
717  }
718  else
719  {
720  GV::Use_amg_for_f = false;
721  }
722 
724 
725  // Solve the problem
726  problem.newton_solve();
727 
729  {
730  problem.doc_solution();
731 
732  // Create the soln file name string.
733  std::stringstream filename;
734  filename <<"RESLT/iter"<<GV::Soln_num<<".dat";
735  std::ofstream some_file;
736  some_file.open(filename.str().c_str());
737 
738  // Print out the iteration counts
739  const unsigned num_newton_steps = GV::Iterations.size();
740  some_file << num_newton_steps << "\n";
741  for (unsigned stepi = 0; stepi < num_newton_steps; stepi++)
742  {
743  some_file << GV::Iterations[stepi] << "\n";
744  }
745  some_file << "\n";
746  some_file.close();
747 
748  }
749 
750 
751 #ifdef OOMPH_HAS_MPI
752  MPI_Helpers::finalize();
753 #endif
754 
755 } // end_of_main
Definition: two_d_tilted_square.cc:165
Definition: navier_stokes_elements.h:395
Definition: oomph_definitions.h:267
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
Namespace for physical parameters.
Definition: two_d_tilted_square.cc:59
bool Use_trilinos
Use trilinos?
Definition: two_d_tilted_square.cc:90
double degtorad(const double &ang_deg)
Convert degrees to radians.
Definition: two_d_tilted_square.cc:105
bool Use_lsc
Use LSC preconditioner for the Navier-Stokes block?
Definition: two_d_tilted_square.cc:93
Vector< unsigned > Iterations
Storage for number of iterations during Newton steps.
Definition: two_d_tilted_square.cc:111
double Ang_deg
Tilting angle of the domain with the x-axis.
Definition: two_d_tilted_square.cc:83
unsigned Visc
The viscous term.
Definition: two_d_tilted_square.cc:77
bool Use_amg_for_p
Use Boomer AMG for the pressure block?
Definition: two_d_tilted_square.cc:99
bool Use_amg_for_f
Use Boomer AMG for the momentum block?
Definition: two_d_tilted_square.cc:96
unsigned Noel
Number of elements in 1D.
Definition: two_d_tilted_square.cc:87
static const unsigned Dim
Problem dimension.
Definition: two_d_tilted_square.cc:62
double Ang_rad
Definition: two_d_tilted_square.cc:84
double Re
Reynolds number.
Definition: two_d_tilted_square.cc:80
unsigned Soln_num
Soln number (for doc_solution)
Definition: two_d_tilted_square.cc:102
string filename
Definition: MergeRestartFiles.py:39
bool command_line_flag_has_been_set(const std::string &flag)
Definition: oomph_utilities.cc:501
void specify_command_line_flag(const std::string &command_line_flag, const std::string &doc)
Specify possible argument-free command line flag.
Definition: oomph_utilities.cc:451
void parse_and_assign(int argc, char *argv[], const bool &throw_on_unrecognised_args)
Definition: oomph_utilities.cc:760
void doc_specified_flags()
Document specified command line flags.
Definition: oomph_utilities.cc:610
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References Global_Variables::Ang_deg, Global_Variables::Ang_rad, oomph::CommandLineArgs::command_line_flag_has_been_set(), Global_Variables::degtorad(), Global_Variables::Dim, oomph::CommandLineArgs::doc_specified_flags(), MergeRestartFiles::filename, Global_Variables::Iterations, Global_Variables::Noel, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::CommandLineArgs::parse_and_assign(), problem, Global_Variables::Re, Flag_definition::setup(), Global_Variables::Soln_num, oomph::CommandLineArgs::specify_command_line_flag(), Global_Variables::Use_amg_for_f, Global_Variables::Use_amg_for_p, Global_Variables::Use_lsc, Global_Variables::Use_trilinos, and Global_Variables::Visc.