navier_stokes/osc_ring/osc_ring_alg.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[])
 

Variables

double SarahBL::epsilon
 
double SarahBL::alpha
 
double SarahBL::A
 
double SarahBL::Omega
 
double SarahBL::N
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

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

1813 {
1814 
1815  // Store command line arguments
1816  CommandLineArgs::setup(argc,argv);
1817 
1818  //Do a certain number of timesteps per period
1819  unsigned nstep_per_period=40; // 80; // ADJUST_PRIORITY
1820  unsigned nperiod=3;
1821 
1822  // Work out total number of steps and timestep
1823  unsigned nstep=nstep_per_period*nperiod;
1824  double dt=1.0/double(nstep_per_period);
1825 
1826  // Set up the problem: Pass timestep and Sarah's asymptotic solution for
1827  // generation of initial condition
1830 
1831 
1832  // Restart?
1833  //---------
1834  bool restarted=false;
1835 
1836  // Pointer to restart file
1837  ifstream* restart_file_pt=0;
1838 
1839  // No restart
1840  //-----------
1841  if (CommandLineArgs::Argc!=2)
1842  {
1843  cout << "No restart" << std::endl;
1844  restarted=false;
1845 
1846  // Refine uniformly
1847  problem.refine_uniformly();
1848  problem.refine_uniformly();
1849  problem.refine_uniformly();
1850 
1851  // Set initial condition on uniformly refined domain (if this isn't done
1852  // then the mesh contains the interpolation of the initial guess
1853  // on the original coarse mesh -- if the nodal values were zero in
1854  // the interior and nonzero on the boundary, then the the waviness of
1855  // of the interpolated i.g. between the nodes on the coarse mesh
1856  // gets transferred onto the fine mesh where we can do better
1857  problem.set_initial_condition();
1858  }
1859 
1860  // Restart
1861  //--------
1862  else if (CommandLineArgs::Argc==2)
1863  {
1864  restarted=true;
1865 
1866  // Open restart file
1867  restart_file_pt=new ifstream(CommandLineArgs::Argv[1],ios_base::in);
1868  if (restart_file_pt!=0)
1869  {
1870  cout << "Have opened " << CommandLineArgs::Argv[1] <<
1871  " for restart. " << std::endl;
1872  }
1873  else
1874  {
1875  std::ostringstream error_stream;
1876  error_stream
1877  << "ERROR while trying to open " << CommandLineArgs::Argv[1] <<
1878  " for restart." << std::endl;
1879 
1880  throw OomphLibError(error_stream.str(),
1883  }
1884  // Do the actual restart
1885  problem.restart(*restart_file_pt);
1886  }
1887 
1888 
1889  // Two command line arguments: do validation run
1890  if (CommandLineArgs::Argc==3)
1891  {
1892  nstep=3;
1893  cout << "Only doing nstep steps for validation: " << nstep << std::endl;
1894  }
1895 
1896 
1897 
1898 
1899  // Setup labels for output
1900  DocInfo doc_info;
1901 
1902  // Output directory
1903  doc_info.set_directory("RESLT");
1904 
1905  // Do unsteady run of the problem for nstep steps
1906  //-----------------------------------------------
1907  problem.unsteady_run(nstep,restarted,doc_info);
1908 
1909 
1910  // Validate the restart procedure
1911  //-------------------------------
1912  if (CommandLineArgs::Argc==3)
1913  {
1914 
1915  // Build coarser problem
1916 
1917  // Set up the problem: Pass timestep and Sarah's asymptotic solution for
1918  // generation of initial condition
1920  BDF<4> > restarted_problem(dt,&SarahBL::full_exact_soln);
1921 
1922  // Setup labels for output
1923  DocInfo restarted_doc_info;
1924 
1925  // Output directory
1926  restarted_doc_info.set_directory("RESLT_restarted");
1927 
1928  // Step number
1929  restarted_doc_info.number()=0;
1930 
1931  // Copy by performing a restart from old problem
1932  restart_file_pt=new ifstream("RESLT/restart2.dat");
1933 
1934  // Do the actual restart
1935  restarted_problem.restart(*restart_file_pt);
1936 
1937  // Do unsteady run of the problem for one step
1938  unsigned nstep=2;
1939  bool restarted=true;
1940  restarted_problem.unsteady_run(nstep,restarted,restarted_doc_info);
1941 
1942  }
1943 
1944 }
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().