multimesh_ref_dd_convection.cc File Reference

Classes

class  RefineableDDConvectionProblem< 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.

575 {
576 
577 
578  // Set the direction of gravity
581 
582  // Create the problem with 2D nine-node refineable elements.
586 
587 
588 
589  // Apply the boundary condition at time zero
590  problem.set_boundary_conditions(0.0);
591 
592  //Perform a single steady Newton solve
593  problem.steady_newton_solve();
594 
595  //Document the solution
596  problem.doc_solution();
597 
598  //Start a trace file
599  ofstream trace("RESLT_ref_multimesh/trace.dat");
600  //Local variables for the kinetic energy and its rate of change
601  double E=0.0, Edot = 0.0;
602 
603  //Output to the trace file
604  problem.get_kinetic_energy(E,Edot);
605  trace << problem.time_pt()->time() << " "
606  << problem.nst_mesh_pt()->boundary_node_pt(1,8)->value(1) << " "
607  << E << " " << Edot << std::endl;
608 
609  //Set the timestep
610  double dt = 0.01;
611 
612  //Initialise the value of the timestep and set an impulsive start
613  problem.assign_initial_values_impulsive(dt);
614 
615  //Set the number of timesteps to our default value
616  unsigned n_steps = 2000;
617 
618  //If we have a command line argument, perform fewer steps
619  //(used for self-test runs)
620  if(argc > 1) {n_steps = 5;}
621 
622  bool first=true;
623 
624  unsigned n_refine = 0;
625 
626  //Perform n_steps timesteps
627  for(unsigned i=0;i<n_steps;++i)
628  {
629  problem.unsteady_newton_solve(dt,n_refine,first);
630  problem.doc_solution();
631 
632  first = false;
633 
634  //Refine the last case for the demo
635  if((argc > 1) && (i==3)) {n_refine=1;}
636  //Only start to refine after 700 steps once the
637  //limit cycle has essentially settled down
638  if(i > 700) {n_refine=1;}
639 
640  //Output to the trace file
641  problem.get_kinetic_energy(E,Edot);
642  trace << problem.time_pt()->time() << " "
643  << problem.nst_mesh_pt()->boundary_node_pt(1,8)->value(1) << " "
644  << E << " " << Edot << std::endl;
645  }
646 
647  trace.close();
648 
649 
650 } // end of main
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Definition: multimesh_ref_dd_convection.cc:84
Definition: my_boussinesq_elements.h:415
Definition: db_nst_external_elements.h:49
double E
Elastic modulus.
Definition: TwenteMeshGluing.cpp:68
Vector< double > Direction_of_gravity(2)
Gravity vector.
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::Global_Physical_Variables::Direction_of_gravity, Global_Physical_Variables::E, i, and problem.