axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc File Reference

Classes

class  BaseStateProblem< BASE_ELEMENT >
 Base state problem class for Tuckerman counter-rotating lids problem. More...
 
class  PerturbedStateProblem< BASE_ELEMENT, PERTURBED_ELEMENT >
 
class  StabilityProblem< BASE_ELEMENT, PERTURBED_ELEMENT >
 

Namespaces

 GlobalPhysicalVariables
 Namespace for physical parameters.
 

Functions

int main (int argc, char *argv[])
 Driver for Tuckerman counter-rotating lids problem. More...
 

Variables

double GlobalPhysicalVariables::Re = 301.0
 Reynolds number. More...
 
double GlobalPhysicalVariables::ReSt = 301.0
 Product of Reynolds and Strouhal numbers. More...
 
double GlobalPhysicalVariables::ReInvFr = 0.0
 Product of Rynolds number and inverse of Froude number. More...
 
double GlobalPhysicalVariables::Gamma = 1.0
 Aspect ratio (cylinder height / cylinder radius) More...
 
int GlobalPhysicalVariables::k = 2
 Azimuthal mode number k in e^ik(theta) decomposition. More...
 
Vector< doubleGlobalPhysicalVariables::G (3)
 Direction of gravity. More...
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Driver for Tuckerman counter-rotating lids problem.

////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

910 {
911  // Number of elements in radial (r) direction
912  const unsigned base_n_r = 36;
913  const unsigned perturbed_n_r = 16;
914 
915  // Number of elements in axial (z) direction
916  const unsigned base_n_z = 36;
917  const unsigned perturbed_n_z = 16;
918 
919  // Determine height of computational domain (this is just the aspect
920  // ratio since we take the cylinder radius to always be one)
921  const double domain_height = GlobalPhysicalVariables::Gamma;
922 
923  // Set direction of gravity (vertically downwards)
925  GlobalPhysicalVariables::G[1] = -1.0;
927 
928  // Set up labels for output
929  DocInfo doc_info;
930 
931  // Determine length of timestep
932  const double dt = 0.01;
933 
934  // Set number of timesteps to perform during a single iteration of the
935  // power method
936  const unsigned nstep = 1;
937 
938  // Cache tolerance for power method convergence
939  // Note that we are using a very large tolerance for the purposes of
940  // this demo driver so that it converges in a very small number of steps
941  const double power_method_tolerance = 1e-4;
942 
943  // Set maximum number of iterations of the power method
944  const unsigned max_iter = 1000;
945 
946  // For the purposes of code validation we will solve this problem twice.
947  // The first time we shall use Taylor-Hood elements and the second time
948  // Crouzeix-Raviart elements.
949 
950  // --------------------------------------------------------------------
951  // Taylor-Hood elements
952  // --------------------------------------------------------------------
953  {
954  // Build stability problem (this creates base and perturbed state problems)
957  problem_TH(base_n_r,base_n_z,perturbed_n_r,perturbed_n_z,domain_height);
958 
959  // Output directory
960  doc_info.set_directory("RESLT_TH");
961 
962  // Create and initialise trace file
963  ofstream trace;
964  char filename[256];
965  sprintf(filename,"%s/trace.dat",
966  doc_info.directory().c_str());
967  trace.open(filename);
968  trace << "Re, dominating eigenvalue, n_power_method_iterations" << std::endl;
969 
970  // Initialise timestep for perturbed state problem
971  // (also sets weights for all timesteppers)
972  problem_TH.perturbed_state_problem_pt()->initialise_dt(dt);
973 
974  // Set initial conditions
975  problem_TH.set_initial_condition();
976 
977  // Set up storage for dominant eigenvector and eigenvalue
978  DoubleVector eigenvector;
979  double eigenvalue = 0.0;
980 
981  // Get initial guess for eigenvector (these are the initial conditions
982  // set up in PerturbedStateProblem::set_initial_conditions())
983  problem_TH.perturbed_state_problem_pt()->get_dofs(eigenvector);
984 
985  // Initialise counter for solutions
986  doc_info.number()=0;
987 
988  // Set base state problem's boundary conditions
989  problem_TH.base_state_problem_pt()->set_boundary_conditions();
990 
991  // Perform a steady base flow solve
992  problem_TH.base_state_problem_pt()->steady_newton_solve();
993 
994  // Doc the base flow solution
995  problem_TH.base_state_problem_pt()->doc_solution(doc_info);
996 
997  // Enable Jacobian reuse in the perturbed state problem. Note that this
998  // can only be done since the problem is linear and the base state is
999  // steady, and so the Jacobian will be the same at each timestep.
1000  problem_TH.perturbed_state_problem_pt()->enable_jacobian_reuse();
1001 
1002  // Perform power method and store number of iterations
1003  const unsigned n_power_method_iterations =
1004  problem_TH.perform_power_method(dt,nstep,doc_info,power_method_tolerance,
1005  max_iter,eigenvalue,eigenvector);
1006 
1007  cout << "\nDominating eigenvalue is " << eigenvalue << endl;
1008 
1009  // Document in trace file
1010  trace << GlobalPhysicalVariables::Re << " "
1011  << eigenvalue << " "
1012  << n_power_method_iterations << std::endl;
1013  }
1014 
1015 
1016  // --------------------------------------------------------------------
1017  // Crouzeix-Raviart elements
1018  // --------------------------------------------------------------------
1019  {
1020  // Build stability problem (this creates base and perturbed state problems)
1023  problem_CR(base_n_r,base_n_z,perturbed_n_r,perturbed_n_z,domain_height);
1024 
1025  // Output directory
1026  doc_info.set_directory("RESLT_CR");
1027 
1028  // Create and initialise trace file
1029  ofstream trace;
1030  char filename[256];
1031  sprintf(filename,"%s/trace.dat",
1032  doc_info.directory().c_str());
1033  trace.open(filename);
1034  trace << "Re, dominating eigenvalue, n_power_method_iterations" << std::endl;
1035 
1036  // Initialise timestep for perturbed state problem
1037  // (also sets weights for all timesteppers)
1038  problem_CR.perturbed_state_problem_pt()->initialise_dt(dt);
1039 
1040  // Set initial conditions
1041  problem_CR.set_initial_condition();
1042 
1043  // Set up storage for dominant eigenvector and eigenvalue
1044  DoubleVector eigenvector;
1045  double eigenvalue = 0.0;
1046 
1047  // Get initial guess for eigenvector (these are the initial conditions
1048  // set up in PerturbedStateProblem::set_initial_conditions())
1049  problem_CR.perturbed_state_problem_pt()->get_dofs(eigenvector);
1050 
1051  // Initialise counter for solutions
1052  doc_info.number()=0;
1053 
1054  // Set base state problem's boundary conditions
1055  problem_CR.base_state_problem_pt()->set_boundary_conditions();
1056 
1057  // Perform a steady base flow solve
1058  problem_CR.base_state_problem_pt()->steady_newton_solve();
1059 
1060  // Doc the base flow solution
1061  problem_CR.base_state_problem_pt()->doc_solution(doc_info);
1062 
1063  // Enable Jacobian reuse in the perturbed state problem. Note that this
1064  // can only be done since the problem is linear and the base state is
1065  // steady, and so the Jacobian will be the same at each timestep.
1066  problem_CR.perturbed_state_problem_pt()->enable_jacobian_reuse();
1067 
1068  // Perform power method and store number of iterations
1069  const unsigned n_power_method_iterations =
1070  problem_CR.perform_power_method(dt,nstep,doc_info,power_method_tolerance,
1071  max_iter,eigenvalue,eigenvector);
1072 
1073  cout << "\nDominating eigenvalue is " << eigenvalue << endl;
1074 
1075  // Document in trace file
1076  trace << GlobalPhysicalVariables::Re << " "
1077  << eigenvalue << " "
1078  << n_power_method_iterations << std::endl;
1079  }
1080 
1081 } // End of main
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Definition: demo_drivers/axisym_navier_stokes/counter_rotating_disks/multi_domain_linearised_axisym_navier_stokes_elements.h:186
Definition: demo_drivers/axisym_navier_stokes/counter_rotating_disks/multi_domain_linearised_axisym_navier_stokes_elements.h:54
Definition: axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:702
Definition: axisym_navier_stokes_elements.h:1234
Definition: axisym_navier_stokes_elements.h:1532
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: double_vector.h:58
double Re
Reynolds number.
Definition: axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:61
double Gamma
Aspect ratio (cylinder height / cylinder radius)
Definition: axisym_navier_stokes/counter_rotating_disks/counter_rotating_disks.cc:70
Vector< double > G(3)
Direction of gravity.
string filename
Definition: MergeRestartFiles.py:39

References oomph::DocInfo::directory(), e(), MergeRestartFiles::filename, GlobalPhysicalVariables::G, GlobalPhysicalVariables::Gamma, oomph::DocInfo::number(), GlobalPhysicalVariables::Re, and oomph::DocInfo::set_directory().