interaction/fsi_osc_ring/osc_ring_macro.cc File Reference

Classes

class  OscRingNStProblem< ELEMENT >
 

Namespaces

 Global_Physical_Variables
 Global variables.
 

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Demonstrate how to solve OscRingNSt problem in deformable domain with mesh adaptation

923 {
924  // Store command line arguments
925  CommandLineArgs::setup(argc,argv);
926 
927  //Do a certain number of timesteps per period
928  unsigned nstep_per_period=40; // 80; // ADJUST_PRIORITY
929  unsigned nperiod=3;
930 
931  // Work out total number of steps and timestep
932  unsigned nstep=nstep_per_period*nperiod;
933  double dt=1.0/double(nstep_per_period);
934 
935  // Set up the problem: Pass timestep and Sarah's asymptotic solution for
936  // generation of initial condition
939 
940 
941  // Restart?
942  //---------
943  bool restarted=false;
944 
945  // Pointer to restart file
946  ifstream* restart_file_pt=0;
947 
948  // No restart
949  //-----------
950  if (CommandLineArgs::Argc!=2)
951  {
952  cout << "No restart" << std::endl;
953  restarted=false;
954 
955  // Refine uniformly
956  problem.refine_uniformly();
957  problem.refine_uniformly();
958 
959  // Set initial condition on uniformly refined domain (if this isn't done
960  // then the mesh contains the interpolation of the initial guess
961  // on the original coarse mesh -- if the nodal values were zero in
962  // the interior and nonzero on the boundary, then the the waviness of
963  // of the interpolated i.g. between the nodes on the coarse mesh
964  // gets transferred onto the fine mesh where we can do better
965  problem.set_initial_condition();
966 
967  }
968 
969  // Restart
970  //--------
971  else if (CommandLineArgs::Argc==2)
972  {
973  restarted=true;
974 
975  // Open restart file
976  restart_file_pt=new ifstream(CommandLineArgs::Argv[1],ios_base::in);
977  if (restart_file_pt!=0)
978  {
979  cout << "Have opened " << CommandLineArgs::Argv[1] <<
980  " for restart. " << std::endl;
981  }
982  else
983  {
984  std::ostringstream error_stream;
985  error_stream << "ERROR while trying to open "
986  << CommandLineArgs::Argv[2]
987  << " for restart." << std::endl;
988 
989  throw OomphLibError(error_stream.str(),
992  }
993  // Do the actual restart
994  problem.restart(*restart_file_pt);
995  }
996 
997 
998  // Two command line arguments: do validation run
999  if (CommandLineArgs::Argc==3)
1000  {
1001  nstep=3;
1002  cout << "Only doing nstep steps for validation: " << nstep << std::endl;
1003  }
1004 
1005 
1006 
1007 
1008  // Setup labels for output
1009  DocInfo doc_info;
1010 
1011  // Output directory
1012  doc_info.set_directory("RESLT");
1013 
1014 
1015  // Do unsteady run of the problem for nstep steps
1016  //-----------------------------------------------
1017  problem.unsteady_run(nstep,restarted,doc_info);
1018 
1019 
1020  // Validate the restart procedure
1021  //-------------------------------
1022  if (CommandLineArgs::Argc==3)
1023  {
1024 
1025  // Build problem and restart
1026 
1027  // Set up the problem: Pass timestep and Sarah's asymptotic solution for
1028  // generation of initial condition
1031  restarted_problem(dt,&SarahBL::full_exact_soln);
1032 
1033  // Setup labels for output
1034  DocInfo restarted_doc_info;
1035 
1036  // Output directory
1037  restarted_doc_info.set_directory("RESLT_restarted");
1038 
1039  // Step number
1040  restarted_doc_info.number()=0;
1041 
1042  // Copy by performing a restart from old problem
1043  restart_file_pt=new ifstream("RESLT/restart2.dat");
1044 
1045  // Do the actual restart
1046  restarted_problem.restart(*restart_file_pt);
1047 
1048  // Do unsteady run of the problem for one step
1049  unsigned nstep=2;
1050  bool restarted=true;
1051  restarted_problem.unsteady_run(nstep,restarted,restarted_doc_info);
1052 
1053  }
1054 
1055 }
Definition: interaction/fsi_osc_ring/osc_ring_alg.cc:86
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
Definition: macro_element_node_update_element.h:265
Definition: oomph_definitions.h:222
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
void full_exact_soln(const double &time, const Vector< double > &x, Vector< double > &soln)
Full exact solution: x,y,u,v,p,du/dt,dv/dt,diss.
Definition: navier_stokes/osc_ring/osc_ring_alg.cc:539
char ** Argv
Arguments themselves.
Definition: oomph_utilities.cc:410
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References oomph::CommandLineArgs::Argc, oomph::CommandLineArgs::Argv, SarahBL::full_exact_soln(), oomph::DocInfo::number(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, problem, oomph::DocInfo::set_directory(), and Flag_definition::setup().