mpi/distribution/three_d_entry_flow/three_d_entry_flow.cc File Reference
#include "generic.h"
#include "navier_stokes.h"
#include "meshes/quarter_tube_mesh.h"

Classes

class  EntryFlowProblem< ELEMENT >
 Entry flow problem in quarter tube 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 3D entry flow into a quarter tube. If there are any command line arguments, we regard this as a validation run and perform only a single adaptation

304 {
305 #ifdef OOMPH_HAS_MPI
306  MPI_Helpers::init(argc,argv);
307 #endif
308 
309  // Store command line arguments
310  CommandLineArgs::setup(argc,argv);
311 
312  DocInfo mesh_doc_info;
313  bool report_stats=true;
314  mesh_doc_info.set_directory("RESLT_MESH");
315  mesh_doc_info.number()=10;
316 
317  // Allow (up to) five rounds of fully automatic adapation in response to
318  //-----------------------------------------------------------------------
319  // error estimate
320  //---------------
321  unsigned max_adapt;
322  double max_error_target,min_error_target;
323 
324  // Set max number of adaptations in black-box Newton solver and
325  // error targets for adaptation
326  if (CommandLineArgs::Argc==1)
327  {
328  // Up to two adaptations
329  max_adapt=2;
330 
331  // Error targets for adaptive refinement
332  max_error_target=0.005;
333  min_error_target=0.0005;
334  }
335  // Validation run: Only one adaptation. Relax error targets
336  // to ensure that not all elements are refined so we're getting
337  // some hanging nodes.
338  else
339  {
340  // Validation run: Just one round of adaptation
341  max_adapt=1;
342 
343  // Error targets for adaptive refinement
344  max_error_target=0.02;
345  min_error_target=0.002;
346  }
347  // end max_adapt setup
348 
349  // Set up doc info
350  DocInfo doc_info;
351 
352  // Do Taylor-Hood elements
353  //------------------------
354  {
355  // Set output directory
356  doc_info.set_directory("RESLT_TH");
357 
358  // Step number
359  doc_info.number()=0;
360 
361  // Build problem
363  problem(doc_info,min_error_target,max_error_target);
364 
365  cout << " Doing Taylor-Hood elements " << std::endl;
366 
367  // Initial refinement
368  problem.refine_uniformly();
369 
370  // Initial solve
371  problem.newton_solve();
372 
373 #ifdef OOMPH_HAS_MPI
374  // Distribute
375  std::ifstream input_file;
376  std::ofstream output_file;
377  char filename[100];
378 
379  // Get partition from file
380  unsigned n_partition=problem.mesh_pt()->nelement();
381  Vector<unsigned> element_partition(n_partition,0);
382  sprintf(filename,"three_d_entry_flow_1_partition.dat");
383  input_file.open(filename);
384  std::string input_string;
385  for (unsigned e=0;e<n_partition;e++)
386  {
387  getline(input_file,input_string,'\n');
388  element_partition[e]=atoi(input_string.c_str());
389  }
390 
391  // Distribute and check halo schemes
392  problem.distribute(element_partition,mesh_doc_info,report_stats);
393  problem.check_halo_schemes(mesh_doc_info);
394 
395  oomph_info << "---- Now solve TH after distribute ----" << std::endl;
396 #endif
397 
398  // Solve the problem with adaptivity
399  problem.newton_solve(max_adapt);
400 
401  // Doc solution after solving
402  problem.doc_solution();
403  }
404 
405 
406  // Do Crouzeix-Raviart elements
407  //-----------------------------
408  {
409  // Set output directory
410  doc_info.set_directory("RESLT_CR");
411 
412  // Step number
413  doc_info.number()=0;
414 
415  // Build problem
417  problem(doc_info,min_error_target,max_error_target);
418 
419  cout << " Doing Crouzeix-Raviart elements " << std::endl;
420 
421  // Initial refinement
422  problem.refine_uniformly();
423 
424  // Initial solve
425  problem.newton_solve();
426 
427 #ifdef OOMPH_HAS_MPI
428  // Distribute
429  std::ifstream input_file;
430  std::ofstream output_file;
431  char filename[100];
432 
433  // Get partition from file
434  unsigned n_partition=problem.mesh_pt()->nelement();
435  Vector<unsigned> element_partition(n_partition,0);
436  sprintf(filename,"three_d_entry_flow_2_partition.dat");
437  input_file.open(filename);
438  std::string input_string;
439  for (unsigned e=0;e<n_partition;e++)
440  {
441  getline(input_file,input_string,'\n');
442  element_partition[e]=atoi(input_string.c_str());
443  }
444 
445  // Distribute and check halo schemes
446  problem.distribute(element_partition,mesh_doc_info,report_stats);
447  problem.check_halo_schemes(mesh_doc_info);
448 
449  oomph_info << "---- Now solve CR after distribute ----" << std::endl;
450 #endif
451 
452  // Solve the problem with adaptivity
453  problem.newton_solve(max_adapt);
454 
455  // Doc solution after solving
456  problem.doc_solution();
457  }
458 
459 #ifdef OOMPH_HAS_MPI
460  MPI_Helpers::finalize();
461 #endif
462 
463 } // end_of_main
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Entry flow problem in quarter tube domain.
Definition: mpi/distribution/three_d_entry_flow/three_d_entry_flow.cc:54
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
string filename
Definition: MergeRestartFiles.py:39
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, e(), MergeRestartFiles::filename, oomph::DocInfo::number(), oomph::oomph_info, problem, oomph::DocInfo::set_directory(), Flag_definition::setup(), and oomph::Global_string_for_annotation::string().