fsi_driven_cavity_segregated_driver.cc File Reference

Classes

class  SegregatedFSIDrivenCavityProblem< ELEMENT >
 

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// Driver code for a driven cavity problem with FSI. Presence of command line arguments indicates validation run with coarse resolution and small number of steps.

385 {
386  // Store command line arguments
387  CommandLineArgs::setup(argc,argv);
388 
389  // Number of elements in the domain (W. Wall standard resolution)
390  unsigned nx=16; //32;
391  unsigned ny=16; //32;
392 
393  // Length of the domain
394  double lx=1.0;
395  double ly=1.0;
396 
397  // Fractional height of the gap next to the moving lid
398  double gap_fraction=1.0/16.0;
399 
400  // Period of lid oscillation
401  double period=5.0;
402 
403  // Build the problem
405  problem(nx, ny, lx, ly, gap_fraction, period);
406 
407  // Timestep.
408  double dt=period/40.0;
409 
410  // Maximum time for simulation
411  double t_max=50.0;
412 
413  // Initialise timestep
414  problem.initialise_dt(dt);
415 
416  // Apply initial condition
417  problem.set_initial_condition();
418 
419  //Set output directory
420  DocInfo doc_info;
421  doc_info.set_directory("RESLT");
422 
423  // Open a trace file
424  ofstream trace_file;
425  char filename[100];
426  sprintf(filename,"%s/trace.dat",doc_info.directory().c_str());
427  trace_file.open(filename);
428 
429  // Output the initial solution
430  problem.doc_solution(doc_info, trace_file);
431 
432  // Increment step number
433  doc_info.number()++;
434 
435  // Find number of timesteps (reduced for validation)
436  unsigned nstep = unsigned(t_max/dt);
437  if (CommandLineArgs::Argc>1)
438  {
439  nstep=3;
440  }
441 
442  // Timestepping loop
443  for (unsigned istep=0;istep<nstep;istep++)
444  {
445 
446  // Object that stores the convergence data for Picard iteration
447  PicardConvergenceData conv_data;
448 
449  // Number iterations taken
450  //unsigned niter=0;
451 
452  // Setup segregated solver in either case
453  problem.setup_segregated_solver();
454 
455  // Solve the problem
456  //------------------
457 
458  conv_data=problem.unsteady_segregated_solve(dt);
459 
460  //niter=conv_data.niter();
461  if (conv_data.cpu_total()!=0.0)
462  {
463  std::cout
464  << std::endl << std::endl << std::endl
465  << "PERCENTAGE OF CPU TIME SPENT IN COMPUTATION OF GLOBAL RESIDUAL="
466  << double(conv_data.cpu_for_global_residual()/
467  conv_data.cpu_total())*100.0
468  << std::endl << std::endl << std::endl <<std::endl;
469 
470  std::cout
471  <<"PERCENTAGE OF CPU TIME SPENT IN COMPUTATION OF NON-ESSENTIAL BITS="
472  << double((conv_data.cpu_total()-conv_data.essential_cpu_total())/
473  conv_data.cpu_total())*100.0 << " "
474  << conv_data.cpu_total() << " "
475  << conv_data.essential_cpu_total() << " "
476  << std::endl << std::endl << std::endl <<std::endl;
477  }
478 
479 
480 
481  // Solve the problem
482  // problem.unsteady_newton_solve(dt);
483 
484  // Outpt the solution
485  problem.doc_solution(doc_info, trace_file);
486 
487  // Step number
488  doc_info.number()++;
489  }
490 
491 
492  // Close trace file.
493  trace_file.close();
494 
495 
496 
497 }//end of main
Definition: fsi_driven_cavity_segregated_driver.cc:48
Definition: oomph_utilities.h:499
std::string directory() const
Output directory.
Definition: oomph_utilities.h:524
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
Object that collates convergence data of Picard iteration.
Definition: segregated_fsi_solver.h:40
double & cpu_for_global_residual()
Definition: segregated_fsi_solver.h:80
double & essential_cpu_total()
Definition: segregated_fsi_solver.h:71
double & cpu_total()
Total CPU time for segregated solve.
Definition: segregated_fsi_solver.h:63
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
string filename
Definition: MergeRestartFiles.py:39
const double ly
Definition: ConstraintElementsUnitTest.cpp:34
const double lx
Definition: ConstraintElementsUnitTest.cpp:33
const unsigned nx
Definition: ConstraintElementsUnitTest.cpp:30
const unsigned ny
Definition: ConstraintElementsUnitTest.cpp:31
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::CommandLineArgs::Argc, oomph::PicardConvergenceData::cpu_for_global_residual(), oomph::PicardConvergenceData::cpu_total(), oomph::DocInfo::directory(), oomph::PicardConvergenceData::essential_cpu_total(), MergeRestartFiles::filename, Mesh_Parameters::lx, Mesh_Parameters::ly, oomph::DocInfo::number(), Mesh_Parameters::nx, Mesh_Parameters::ny, problem, oomph::DocInfo::set_directory(), and Flag_definition::setup().