interaction/fsi_osc_ring/osc_ring_alg.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

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