two_layer_interface_nonaxisym_perturbations.cc File Reference

Classes

class  ElementCmp
 Function-type-object to perform comparison of elements. More...
 
class  BaseStateProblem< BASE_ELEMENT >
 Base state problem class for Tuckerman counter-rotating lids problem. More...
 
class  PerturbedStateProblem< BASE_ELEMENT, PERTURBED_ELEMENT >
 

Namespaces

 GlobalPhysicalVariables
 Namespace for physical parameters.
 

Functions

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

Variables

double GlobalPhysicalVariables::Viscosity_Ratio = 0.1
 
double GlobalPhysicalVariables::Density_Ratio = 1.0
 
double GlobalPhysicalVariables::Ca = 1.0
 Capillary number. More...
 
Vector< intGlobalPhysicalVariables::Vector_of_azimuthal_mode_numbers
 Vector of azimuthal mode numbers to investigate. More...
 
Vector< doubleGlobalPhysicalVariables::G (3)
 Direction of gravity. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// Driver for two-layer rotating cylinder problem, where we directly simulate the instability by kicking off the base and perturbed state problems together and watching to see whether the perturbation grows or decays.

1363 {
1364  // Store command line arguments
1365  CommandLineArgs::setup(argc,argv);
1366 
1367  // Set duration of timestep
1368  const double dt = 0.05;
1369 
1370  // Set number of elements in radial (r) direction
1371  const unsigned base_n_r = 10;
1372  const unsigned perturbed_n_r = 10;
1373 
1374  // Set number of elements in axial (z) direction in lower fluid
1375  const unsigned base_n_z1 = 10;
1376  const unsigned perturbed_n_z1 = 10;
1377 
1378  // Set number of elements in axial (z) direction in upper fluid
1379  const unsigned base_n_z2 = 10;
1380  const unsigned perturbed_n_z2 = 10;
1381 
1382  // Height of lower fluid layer
1383  const double h1 = 1.0;
1384 
1385  // Height of upper fluid layer
1386  const double h2 = 1.0;
1387 
1388  // Compute the Womersley number
1391 
1392  // Set direction of gravity (vertically downwards)
1393  GlobalPhysicalVariables::G[0] = 0.0;
1394  GlobalPhysicalVariables::G[1] = -1.0;
1395  GlobalPhysicalVariables::G[2] = 0.0;
1396 
1397  // Set azimuthal mode numbers to investigate
1398  for(int i=0;i<3;i++)
1399  {
1401  }
1402 
1403  // Set maximum time to run simulation for
1404  double t_max = 8.0;
1405 
1406  // If we are doing a validation run, set maximum time to be lower
1407  if(CommandLineArgs::Argc>1) { t_max = 0.1; }
1408 
1409  // Build base state problem
1411  base_problem(base_n_r,base_n_z1,base_n_z2,h1,h2);
1412 
1413  // Determine the size of the azimuthal mode number vector
1414  const unsigned n_perturbed_problems =
1416 
1417  // Initialise vector of pointers to perturbation problems
1422  BDF<2> >* > perturbed_problem_pt(n_perturbed_problems);
1423 
1424  // Build perturbed state problems
1425  for(unsigned i=0;i<n_perturbed_problems;i++)
1426  {
1427  perturbed_problem_pt[i] = new
1431  BDF<2> > (perturbed_n_r,perturbed_n_z1,perturbed_n_z2,h1,h2,
1432  base_problem.bulk_mesh_pt(),
1434  }
1435 
1436  // Create interface elements (this has to be done after
1437  // interaction is set up in perturbed state problem constructor)
1438  for(unsigned i=0;i<n_perturbed_problems;i++)
1439  {
1440  perturbed_problem_pt[i]->create_interface_elements();
1441  }
1442 
1443  // Rebuild global mesh from the sub-meshes
1444  base_problem.rebuild_global_mesh();
1445  for(unsigned i=0;i<n_perturbed_problems;i++)
1446  {
1447  perturbed_problem_pt[i]->rebuild_global_mesh();
1448  }
1449 
1450  // Assign equation numbers
1451  base_problem.assign_eqn_numbers();
1452  for(unsigned i=0;i<n_perturbed_problems;i++)
1453  {
1454  perturbed_problem_pt[i]->assign_eqn_numbers();
1455  }
1456 
1457  // Sort the elements in the base state problem (for frontal solver)
1458  std::sort(base_problem.mesh_pt()->element_pt().begin(),
1459  base_problem.mesh_pt()->element_pt().end(),
1460  ElementCmp());
1461 
1462  // Sort the elements in the perturbed state problem (for frontal solver)
1463  for(unsigned i=0;i<n_perturbed_problems;i++)
1464  {
1465  std::sort(perturbed_problem_pt[i]->mesh_pt()->element_pt().begin(),
1466  perturbed_problem_pt[i]->mesh_pt()->element_pt().end(),
1467  ElementCmp());
1468  }
1469 
1470  // Doc number of elements in both problems
1471  cout << "Number of elements:" << endl;
1472  cout << " - base, bulk = "
1473  << base_problem.bulk_mesh_pt()->nelement() << endl;
1474  cout << " - base, surface = "
1475  << base_problem.surface_mesh_pt()->nelement() << endl;
1476  for(unsigned i=0;i<n_perturbed_problems;i++)
1477  {
1478  cout << " - perturbed (" << i+1 << " of "
1479  << n_perturbed_problems << "), bulk = "
1480  << perturbed_problem_pt[i]->bulk_mesh_pt()->nelement() << endl;
1481  cout << " - perturbed (" << i+1 << " of "
1482  << n_perturbed_problems << "), surface = "
1483  << perturbed_problem_pt[i]->surface_mesh_pt()->nelement() << endl;
1484  }
1485 
1486  // Initialise doc_info object
1487  DocInfo* doc_info_pt = new DocInfo();
1488 
1489  // Set output directory for solutions
1490  doc_info_pt->set_directory("RESLT");
1491 
1492  // Initialise counter for solutions
1493  doc_info_pt->number()=0;
1494 
1495  // Create and initialise trace file
1496  for(unsigned i=0;i<n_perturbed_problems;i++)
1497  {
1498  perturbed_problem_pt[i]->create_trace_file(doc_info_pt);
1499  }
1500 
1501  // Initialise timestep (also sets weights for all timesteppers)
1502  base_problem.initialise_dt(dt);
1503  for(unsigned i=0;i<n_perturbed_problems;i++)
1504  {
1505  perturbed_problem_pt[i]->initialise_dt(dt);
1506  }
1507 
1508  // Set initial conditions
1509  base_problem.set_initial_condition();
1510  for(unsigned i=0;i<n_perturbed_problems;i++)
1511  {
1512  perturbed_problem_pt[i]->set_initial_condition();
1513  }
1514 
1515  // Create info file
1516  ofstream info_file;
1517  char info_filename[100];
1518  sprintf(info_filename,"%s/info.dat",doc_info_pt->directory().c_str());
1519  info_file.open(info_filename);
1520  info_file.close();
1521 
1522  // Output base state solution
1523  base_problem.doc_solution(doc_info_pt);
1524 
1525  // Doc perturbed state initial conditions
1526  for(unsigned i=0;i<n_perturbed_problems;i++)
1527  {
1528  perturbed_problem_pt[i]->doc_solution(doc_info_pt,true);
1529  }
1530 
1531  // Increment counter for solutions
1532  doc_info_pt->number()++;
1533 
1534  // Determine number of timesteps
1535  const unsigned n_timestep = unsigned(t_max/dt);
1536 
1537  // Timestepping loop
1538  for(unsigned t=0;t<n_timestep;t++)
1539  {
1540  // Output timestep and global time to screen
1541  cout << " Timestep " << t << " of " << n_timestep
1542  << "; Time is " << perturbed_problem_pt[0]->time_pt()->time()
1543  << endl;
1544 
1545  // Output timestep and global time to oomph output
1546  oomph_info << "================================"
1547  << "==============================\n"
1548  << " Timestep " << t << " of " << n_timestep
1549  << "; Time is " << perturbed_problem_pt[0]->time_pt()->time()
1550  << "\n=============================="
1551  << "================================"
1552  << std::endl;
1553 
1554  // Solve perturbed problems
1555  for(unsigned i=0;i<n_perturbed_problems;i++)
1556  {
1557  oomph_info << "\nPerturbed problem (" << i+1 << " of "
1558  << n_perturbed_problems
1559  << "):\n-----------------------------\n" << endl;
1560  perturbed_problem_pt[i]->unsteady_newton_solve(dt);
1561  }
1562 
1563  // Doc all problems
1564  base_problem.doc_solution(doc_info_pt);
1565  for(unsigned i=0;i<n_perturbed_problems;i++)
1566  {
1567  perturbed_problem_pt[i]->doc_solution(doc_info_pt,true);
1568  }
1569 
1570  // Increment counter for solutions
1571  doc_info_pt->number()++;
1572 
1573  } // End of loop over timesteps
1574 
1575  // Clear and close trace files
1576  for(unsigned i=0;i<n_perturbed_problems;i++)
1577  {
1578  perturbed_problem_pt[i]->close_trace_file();
1579  }
1580 
1581 } // End of main
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Base state problem class for Tuckerman counter-rotating lids problem.
Definition: axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:93
Function-type-object to perform comparison of elements.
Definition: elastic_bretherton.cc:317
Definition: demo_drivers/axisym_navier_stokes/counter_rotating_disks/multi_domain_linearised_axisym_navier_stokes_elements.h:186
Definition: axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:371
Definition: axisym_navier_stokes_elements.h:1234
Definition: oomph_utilities.h:499
std::string directory() const
Output directory.
Definition: oomph_utilities.h:524
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: perturbed_spines.h:395
Definition: spines.h:477
Definition: oomph-lib/src/generic/Vector.h:58
static constexpr lastp1_t end
Definition: IndexedViewHelper.h:79
void setup(Time *time_pt)
Create all GeomObjects needed to define the cylinder and the flag.
Definition: turek_flag_non_fsi.cc:277
Vector< int > Vector_of_azimuthal_mode_numbers
Vector of azimuthal mode numbers to investigate.
Definition: two_layer_interface_nonaxisym_perturbations.cc:98
double St
Strouhal number.
Definition: linearised_axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:62
double Re
Reynolds number.
Definition: axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:61
Vector< double > G(3)
Direction of gravity.
double ReSt
Product of Reynolds and Strouhal numbers.
Definition: axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:64
int Argc
Number of arguments + 1.
Definition: oomph_utilities.cc:407
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
t
Definition: plotPSD.py:36

References oomph::CommandLineArgs::Argc, oomph::Problem::assign_eqn_numbers(), BaseStateProblem< BASE_ELEMENT >::bulk_mesh_pt(), oomph::DocInfo::directory(), BaseStateProblem< BASE_ELEMENT >::doc_solution(), Eigen::placeholders::end, GlobalPhysicalVariables::G, i, oomph::Problem::initialise_dt(), BaseStateProblem< BASE_ELEMENT >::mesh_pt(), oomph::Mesh::nelement(), oomph::DocInfo::number(), oomph::oomph_info, GlobalPhysicalVariables::Re, oomph::Problem::rebuild_global_mesh(), GlobalPhysicalVariables::ReSt, oomph::DocInfo::set_directory(), BaseStateProblem< BASE_ELEMENT >::set_initial_condition(), Flag_definition::setup(), GlobalPhysicalVariables::St, BaseStateProblem< BASE_ELEMENT >::surface_mesh_pt(), plotPSD::t, and GlobalPhysicalVariables::Vector_of_azimuthal_mode_numbers.