mpi/multi_domain/boussinesq_convection/multi_domain_ref_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.

496 {
497 
498 #ifdef OOMPH_HAS_MPI
499  MPI_Helpers::init(argc,argv);
500 #endif
501 
502  // Switch off output modifier
504 
505  // Define processor-labeled output file for all on-screen stuff
506  std::ofstream output_stream;
507  char filename[100];
508  sprintf(filename,"OUTPUT.%i",MPI_Helpers::communicator_pt()->my_rank());
509  output_stream.open(filename);
510  oomph_info.stream_pt() = &output_stream;
511  OomphLibWarning::set_stream_pt(&output_stream);
512  OomphLibError::set_stream_pt(&output_stream);
513 
514  // Store command line arguments
515  CommandLineArgs::setup(argc,argv);
516 
517  // Set the direction of gravity
520 
521  // Create the problem with 2D nine-node refineable elements.
529  > problem;
530 
531  // Apply a perturbation to the upper boundary condition to
532  // force the solution into the symmetry-broken state.
533  problem.enable_imperfection();
534 
535  // Distribute the problem
536 #ifdef OOMPH_HAS_MPI
537 
538  DocInfo mesh_doc_info;
539  mesh_doc_info.number()=0;
540  mesh_doc_info.set_directory("RESLT_MULTI");
541  bool report_stats=true;
542 
543  // Are there command-line arguments?
544  if (CommandLineArgs::Argc==1)
545  {
546  // No arguments, so distribute without reference to partition vector
547  problem.distribute(mesh_doc_info,report_stats);
548  }
549  else
550  {
551  // Make up some distribution in which both meshes get some elements
552  unsigned n_element=problem.mesh_pt()->nelement();
553  Vector<unsigned> element_partition(n_element);
554  std::string input_string;
555  for (unsigned e=0;e<n_element;e++)
556  {
557 
558  unsigned target_part=0;
559  if ( (e<unsigned(0.25*double(n_element))) ||
560  ( (e>unsigned(0.5*double(n_element))) &&
561  (e<unsigned(0.75*double(n_element))) ) )
562  {
563  target_part=1;
564  }
565  element_partition[e]=target_part;
566  }
567  problem.distribute(element_partition,mesh_doc_info,report_stats);
568  }
569 #endif
570 
571  //Document the solution
572  problem.doc_solution();
573 
574  //Solve the problem with (up to) two levels of adaptation
575  problem.newton_solve(2);
576 
577  //Document the solution
578  problem.doc_solution();
579 
580  // Make the boundary conditions perfect and solve again.
581  // Now the slightly perturbed symmetry broken state computed
582  // above is used as the initial condition and the Newton solver
583  // converges to the symmetry broken solution, even without
584  // the perturbation
585  problem.disable_imperfection();
586  problem.newton_solve(2);
587  problem.doc_solution();
588 
589  // Refine unformly to give us something to prune
590  oomph_info << "About to refine uniformly\n";
591  problem.refine_uniformly();
592  problem.doc_solution();
593 
594  oomph_info << "About to prune\n";
595  problem.prune_halo_elements_and_nodes();
596  problem.doc_solution();
597 
598  oomph_info << "About to solve again\n";
599  problem.newton_solve(1);
600  problem.doc_solution();
601 
602 #ifdef OOMPH_HAS_MPI
603  MPI_Helpers::finalize();
604 #endif
605 
606 } // 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: 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
std::ostream *& stream_pt()
Access function for the stream pointer.
Definition: oomph_definitions.h:464
OutputModifier *& output_modifier_pt()
Access function for the output modifier pointer.
Definition: oomph_definitions.h:476
Definition: multi_domain_boussinesq_elements.h:378
Definition: multi_domain_boussinesq_elements.h:66
Definition: refineable_advection_diffusion_elements.h:355
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
OutputModifier default_output_modifier
Single global instatiation of the default output modifier.
Definition: oomph_definitions.cc:325
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::CommandLineArgs::Argc, oomph::MPI_Helpers::communicator_pt(), oomph::default_output_modifier, oomph::Global_Physical_Variables::Direction_of_gravity, e(), MergeRestartFiles::filename, oomph::MPI_Helpers::finalize(), oomph::MPI_Helpers::init(), oomph::DocInfo::number(), oomph::oomph_info, oomph::OomphInfo::output_modifier_pt(), problem, oomph::DocInfo::set_directory(), oomph::OomphLibError::set_stream_pt(), oomph::OomphLibWarning::set_stream_pt(), oomph::CommandLineArgs::setup(), oomph::OomphInfo::stream_pt(), and oomph::Global_string_for_annotation::string().