navier_stokes/osc_ring/osc_ring_macro.cc File Reference
#include "generic.h"
#include "navier_stokes.h"
#include "meshes/quarter_circle_sector_mesh.h"
#include <math.h>

Classes

class  OscRingNStProblem< ELEMENT >
 

Namespaces

 Global_Physical_Variables
 Global variables.
 
 SarahBL
 Sarah's boundary layer solution for flow in oscillating ring.
 

Functions

double SarahBL::Diss_sarah (double rho, double zeta, double t)
 
double SarahBL::Kin_energy_sarah (double t)
 
double SarahBL::P_sarah (double rho, double zeta, double t)
 
double SarahBL::Total_Diss_lead_sarah (double t)
 
double SarahBL::Total_Diss_sarah (double t)
 
double SarahBL::U_sarah (double rho, double zeta, double t)
 
double SarahBL::V_sarah (double rho, double zeta, double t)
 
double SarahBL::X_sarah (double rho, double zeta, double t)
 
double SarahBL::Y_sarah (double rho, double zeta, double t)
 
void SarahBL::buckled_ring_residual (const Vector< double > &params, const Vector< double > &unknowns, Vector< double > &residuals)
 Residual function for buckled ring. More...
 
void SarahBL::exact_soln (const double &time, const Vector< double > &x, Vector< double > &soln)
 Exact solution: x,y,u,v,p. More...
 
void SarahBL::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. More...
 
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

1383 {
1384 
1385  // Store command line arguments
1386  CommandLineArgs::setup(argc,argv);
1387 
1388  //Do a certain number of timesteps per period
1389  unsigned nstep_per_period=40; // 80; // ADJUST_PRIORITY
1390  unsigned nperiod=3;
1391 
1392  // Work out total number of steps and timestep
1393  unsigned nstep=nstep_per_period*nperiod;
1394  double dt=1.0/double(nstep_per_period);
1395 
1396  // Set up the problem: Pass timestep and Sarah's asymptotic solution for
1397  // generation of initial condition
1400 
1401 
1402  // Restart?
1403  //---------
1404  bool restarted=false;
1405 
1406  // Pointer to restart file
1407  ifstream* restart_file_pt=0;
1408 
1409  // No restart
1410  //-----------
1411  if (CommandLineArgs::Argc!=2)
1412  {
1413  cout << "No restart" << std::endl;
1414  restarted=false;
1415 
1416  // Refine uniformly
1417  problem.refine_uniformly();
1418  problem.refine_uniformly();
1419  problem.refine_uniformly();
1420 
1421  // Set initial condition on uniformly refined domain (if this isn't done
1422  // then the mesh contains the interpolation of the initial guess
1423  // on the original coarse mesh -- if the nodal values were zero in
1424  // the interior and nonzero on the boundary, then the the waviness of
1425  // of the interpolated i.g. between the nodes on the coarse mesh
1426  // gets transferred onto the fine mesh where we can do better
1427  problem.set_initial_condition();
1428  }
1429 
1430  // Restart (single command line argument)
1431  //---------------------------------------
1432  else if (CommandLineArgs::Argc==2)
1433  {
1434  restarted=true;
1435 
1436  // Open restart file
1437  restart_file_pt=new ifstream(CommandLineArgs::Argv[1],ios_base::in);
1438  if (restart_file_pt!=0)
1439  {
1440  cout << "Have opened " << CommandLineArgs::Argv[1] <<
1441  " for restart. " << std::endl;
1442  }
1443  else
1444  {
1445  std::ostringstream error_stream;
1446  error_stream
1447  << "ERROR while trying to open " << CommandLineArgs::Argv[1] <<
1448  " for restart." << std::endl;
1449 
1450  throw OomphLibError(error_stream.str(),
1453  }
1454  // Do the actual restart
1455  problem.restart(*restart_file_pt);
1456  }
1457 
1458 
1459  // Two command line arguments: do validation run
1460  //----------------------------------------------
1461  if (CommandLineArgs::Argc==3)
1462  {
1463  nstep=3;
1464  cout << "Only doing nstep steps for validation: " << nstep << std::endl;
1465  }
1466 
1467 
1468  // Setup labels for output
1469  DocInfo doc_info;
1470 
1471  // Output directory
1472  doc_info.set_directory("RESLT");
1473 
1474 
1475  // Do unsteady run of the problem for nstep steps
1476  //-----------------------------------------------
1477  problem.unsteady_run(nstep,restarted,doc_info);
1478 
1479 
1480 
1481  // Validate the restart procedure
1482  //-------------------------------
1483  if (CommandLineArgs::Argc==3)
1484  {
1485 
1486  // Build coarser problem
1487 
1488  // Set up the problem: Pass timestep and Sarah's asymptotic solution for
1489  // generation of initial condition
1491  BDF<4> > restarted_problem(dt,&SarahBL::full_exact_soln);
1492 
1493  // Setup labels for output
1494  DocInfo restarted_doc_info;
1495 
1496  // Output directory
1497  restarted_doc_info.set_directory("RESLT_restarted");
1498 
1499  // Step number
1500  restarted_doc_info.number()=0;
1501 
1502  // Copy by performing a restart from old problem
1503  restart_file_pt=new ifstream("RESLT/restart2.dat");
1504 
1505  // Do the actual restart
1506  restarted_problem.restart(*restart_file_pt);
1507 
1508  // Do unsteady run of the problem for one step
1509  unsigned nstep=2;
1510  bool restarted=true;
1511  restarted_problem.unsteady_run(nstep,restarted,restarted_doc_info);
1512 
1513  }
1514 }
Definition: interaction/fsi_osc_ring/osc_ring_alg.cc:86
Definition: timesteppers.h:1165
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().