mpi/multi_domain/boussinesq_convection/refineable_b_convection.cc File Reference
#include "generic.h"
#include "advection_diffusion.h"
#include "navier_stokes.h"
#include "multi_physics.h"
#include "meshes/rectangular_quadmesh.h"

Classes

class  RefineableConvectionProblem< NST_ELEMENT, AD_ELEMENT >
 

Namespaces

 Global_Physical_Variables
 Global variables.
 

Functions

int main (int argc, char **argv)
 

Variables

Vector< doubleGlobal_Physical_Variables::Direction_of_gravity (2)
 Gravity vector. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Driver code for 2D Boussinesq convection problem with adaptivity.

351 {
352 
353 #ifdef OOMPH_HAS_MPI
354  MPI_Helpers::init(argc,argv);
355 #endif
356 
357  // Store command line arguments
358  CommandLineArgs::setup(argc,argv);
359 
360  // Set the direction of gravity
363 
364  // Create the problem with 2D nine-node refineable elements.
367 
368  // Apply a perturbation to the upper boundary condition to
369  // force the solution into the symmetry-broken state.
370  problem.enable_imperfection();
371 
372 
373 #ifdef OOMPH_HAS_MPI
374 
375  bool report_stats=true;
376  // Are there command-line arguments?
377  if (CommandLineArgs::Argc==1)
378  {
379  // No arguments, so distribute without reference to partition vector
380  problem.distribute(report_stats);
381  }
382  else
383  {
384  // Command line argument(s), so read in partition vector from file
385  unsigned n_element=problem.mesh_pt()->nelement();
386  Vector<unsigned> in_element_partition(n_element);
387 
388  std::ifstream input_file;
389  char filename[100];
390  sprintf(filename,"refineable_b_convection_partition.dat");
391  input_file.open(filename);
392  std::string input_string;
393  for (unsigned e=0;e<n_element;e++)
394  {
395  getline(input_file,input_string,'\n');
396  in_element_partition[e]=atoi(input_string.c_str());
397  }
398 
399  // Distribute the problem
400  problem.distribute(in_element_partition,report_stats);
401  }
402 
403 #endif
404 
405  //Solve the problem with (up to) two levels of adaptation
406  problem.newton_solve(2);
407 
408  //Document the solution
409  problem.doc_solution();
410 
411  // Make the boundary conditions perfect and solve again.
412  // Now the slightly perturbed symmetry broken state computed
413  // above is used as the initial condition and the Newton solver
414  // converges to the symmetry broken solution, even without
415  // the perturbation
416  problem.disable_imperfection();
417  problem.newton_solve(2);
418  problem.doc_solution();
419 
420 
421 #ifdef OOMPH_HAS_MPI
422  MPI_Helpers::finalize();
423 #endif
424 
425 } // end of main
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Definition: mpi/multi_domain/boussinesq_convection/multi_domain_ref_b_convection.cc:80
Definition: boussinesq_elements.h:803
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
Vector< double > Direction_of_gravity(2)
Gravity vector.
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
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::CommandLineArgs::Argc, Global_Physical_Variables::Direction_of_gravity, e(), MergeRestartFiles::filename, problem, Flag_definition::setup(), and oomph::Global_string_for_annotation::string().