mpi/multi_domain/turek_flag/turek_flag.cc File Reference
#include "generic.h"
#include "solid.h"
#include "navier_stokes.h"
#include "multi_physics.h"
#include "meshes/cylinder_with_flag_mesh.h"
#include "meshes/rectangular_quadmesh.h"

Classes

class  TurekProblem< FLUID_ELEMENT, SOLID_ELEMENT >
 Problem class. More...
 

Namespaces

 Global_Parameters
 Namespace for global parameters.
 

Functions

void Global_Parameters::gravity (const double &time, const Vector< double > &xi, Vector< double > &b)
 Non-dimensional gravity as body force. More...
 
double Global_Parameters::flux (const double &t)
 Flux: Pulsatile flow. More...
 
void Global_Parameters::set_parameters (const string &case_id)
 Set parameters for the various test cases. More...
 
int main (int argc, char *argv[])
 Driver. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Driver.

1406 {
1407 
1408 #ifdef OOMPH_HAS_MPI
1409  MPI_Helpers::init(argc,argv);
1410 #endif
1411 
1412  // Store command line arguments
1413  CommandLineArgs::setup(argc,argv);
1414 
1415  // Get case id as string
1416  string case_id="FSI1";
1417  if (CommandLineArgs::Argc==1)
1418  {
1419  oomph_info << "No command line arguments; running self-test FSI1"
1420  << std::endl;
1421  }
1422  else if (CommandLineArgs::Argc==2)
1423  {
1424  case_id=CommandLineArgs::Argv[1];
1425  }
1426  else
1427  {
1428  oomph_info << "Wrong number of command line arguments" << std::endl;
1429  oomph_info << "Enter none (for default) or one (namely the case id"
1430  << std::endl;
1431  oomph_info << "which should be one of: FSI1, FSI2, FSI3, CSM1"
1432  << std::endl;
1433  }
1434  std::cout << "Running case " << case_id << std::endl;
1435 
1436  // Setup parameters for case identified by command line
1437  // argument
1439 
1440  // Length and height of domain
1441  double length=25.0;
1442  double height=4.1;
1443 
1444  //Set up the problem
1447 
1448  // Prepare output
1449  DocInfo doc_info;
1450  ofstream trace_file;
1451  char filename[100];
1452  doc_info.set_directory("RESLT_TUREK");
1453  sprintf(filename,"%s/trace_on_proc%i.dat",doc_info.directory().c_str(),
1454  problem.communicator_pt()->my_rank());
1455  trace_file.open(filename);
1456 
1457  // Default number of timesteps
1458  unsigned nstep=4000;
1459  if (Global_Parameters::Case_ID=="FSI1")
1460  {
1461  std::cout << "Reducing number of steps for FSI1 " << std::endl;
1462  nstep=400;
1463  }
1464 
1465  if (CommandLineArgs::Argc==1)
1466  {
1467  std::cout << "Reducing number of steps for validation " << std::endl;
1468  nstep=2;
1469  }
1470 
1471  //Timestep:
1472  double dt=Global_Parameters::Dt;
1473 
1474  // Initialise timestep
1475  problem.initialise_dt(dt);
1476 
1477  // Impulsive start
1478  problem.assign_initial_values_impulsive(dt);
1479 
1480  // Doc the initial condition
1481  problem.doc_solution(doc_info,trace_file);
1482  doc_info.number()++;
1483 
1484 #ifdef OOMPH_HAS_MPI
1485  // Distribute the problem
1486  bool report_stats=true;
1487 
1488  // Are there command-line arguments?
1489  if (CommandLineArgs::Argc==1)
1490  {
1491  // No arguments, so it's a validation run
1492  std::ifstream input_file;
1493 
1494  // All meshes are partitioned
1495  unsigned n_partition=problem.mesh_pt()->nelement();
1496  Vector<unsigned> in_element_partition(n_partition,0);
1497 
1498  // Get partition from file
1499  sprintf(filename,"turek_flag_partition.dat");
1500  input_file.open(filename);
1501  std::string input_string;
1502  for (unsigned e=0;e<n_partition;e++)
1503  {
1504  getline(input_file,input_string,'\n');
1505  in_element_partition[e]=atoi(input_string.c_str());
1506  }
1507 
1508  // Now distribute the (still uniformly refined) problem
1509  problem.distribute(in_element_partition,report_stats);
1510  }
1511  else
1512  {
1513  // There were command-line arguments, so distribute without
1514  // reference to any partition vector
1515  problem.distribute(report_stats);
1516  }
1517 
1518 
1519 #endif
1520 
1521  // Don't re-set the initial conditions when adapting during first
1522  // timestep
1523  bool first = false;
1524 
1525  // Max number of adaptation for time-stepping
1526  unsigned max_adapt=1;
1527 
1528  for(unsigned i=0;i<nstep;i++)
1529  {
1530  // Solve the problem
1531  problem.unsteady_newton_solve(dt,max_adapt,first);
1532 
1533  // Output the solution
1534  problem.doc_solution(doc_info,trace_file);
1535 
1536  // Step number
1537  doc_info.number()++;
1538  }
1539 
1540  trace_file.close();
1541 
1542 #ifdef OOMPH_HAS_MPI
1543  MPI_Helpers::finalize();
1544 #endif
1545 
1546 }//end of main
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Problem class.
Definition: interaction/turek_flag/turek_flag.cc:371
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
Class for refineable QPVDElement elements.
Definition: refineable_solid_elements.h:181
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
string Case_ID
Default case ID.
Definition: interaction/turek_flag/turek_flag.cc:55
void set_parameters(const string &case_id)
Set parameters for the various test cases.
Definition: interaction/turek_flag/turek_flag.cc:143
double Dt
Timestep.
Definition: interaction/pseudo_solid_collapsible_tube/pseudo_solid_collapsible_tube.cc:415
double height(const double &x)
Height of domain.
Definition: simple_spine_channel.cc:429
string filename
Definition: MergeRestartFiles.py:39
char ** Argv
Arguments themselves.
Definition: oomph_utilities.cc:410
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
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, Global_Parameters::Case_ID, oomph::DocInfo::directory(), Global_Parameters::Dt, e(), MergeRestartFiles::filename, Global_Physical_Variables::height(), i, oomph::DocInfo::number(), oomph::oomph_info, problem, oomph::DocInfo::set_directory(), Global_Parameters::set_parameters(), Flag_definition::setup(), and oomph::Global_string_for_annotation::string().