adaptive_pitchfork.cc File Reference
#include "generic.h"
#include "navier_stokes.h"
#include "meshes/rectangular_quadmesh.h"

Classes

class  CompareNodes
 
class  RefineablePorousChannelProblem< ELEMENT >
 Porous channel flow on a refineable mesh. More...
 

Namespaces

 Global_Physical_Variables
 Global variables.
 

Functions

int main ()
 Driver for RefineablePorousChannel test problem using a. More...
 

Variables

double Global_Physical_Variables::L = 8.0
 Length of beam. More...
 

Function Documentation

◆ main()

int main ( )

Driver for RefineablePorousChannel test problem using a.

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

493 {
494  // Build the problem with QTaylorHoodElements
496  problem;
497 
498  problem.set_boundary_conditions();
499  problem.steady_newton_solve();
500 
501 
502  //Assign memory for the eigenvalues and eigenvectors
503  Vector<std::complex<double> > eigenvalues;
504  Vector<DoubleVector> eigenvectors;
505  //Set the eigen solver to the LAPACK version which is
506  //in every distributioin of oomph-lib
507  problem.eigen_solver_pt() = new LAPACK_QZ;
508  //Solve the eigenproblem
509  problem.solve_eigenproblem(4,eigenvalues,eigenvectors);
510 
511  //Find the eigenvalue with greatest real part
512  unsigned ev_crit_index=0; double ev_crit_value=0.0;
513 
514  //Loop over the values until we get a finite one
515  for(unsigned ev=0;ev<eigenvalues.size();ev++)
516  {
517  double ev_crit_value = eigenvalues[ev].real();
518  if(std::isfinite(ev_crit_value)) {ev_crit_index = ev; break;}
519  }
520 
521  //Now loop over the other values and find the eigenvalue with
522  //greatest real part
523  for(unsigned ev=ev_crit_index+1;ev<eigenvalues.size();ev++)
524  {
525  //Get the current value
526  double real_part = eigenvalues[ev].real();
527  //If it's finite do the comparison
528  if(std::isfinite(real_part))
529  {
530  if(real_part > ev_crit_value)
531  {
532  ev_crit_value = real_part;
533  ev_crit_index = ev;
534  }
535  }
536  }
537 
538  problem.activate_pitchfork_tracking(&Global_Physical_Variables::Re,
539  eigenvectors[ev_crit_index]);
540 
541  //Solve with two rounds of adaptivity
542  problem.steady_newton_solve(2);
543 
544  //Output the solution at the bifurcation point
545  problem.mesh_pt()->output("bif_soln.dat",5);
546 
547  //Report the final answer
548  std::cout << "Pitchfork found at " << Global_Physical_Variables::Re
549  << "\n";
550  std::cout << "The slack parameter is " << problem.dof(problem.ndof()-1)
551  << "\n";
552 
553  //Write the final answer into a file
554  std::ofstream trace("trace.dat");
555  trace << Global_Physical_Variables::Re << " "
556  << problem.dof(problem.ndof()-1) << "\n";
557  trace.close();
558 
559  //Deactivate the bifurcation tracking (for neatness)
560  problem.deactivate_bifurcation_tracking();
561 
562  //Delete the eigensolver that we allocated
563  delete problem.eigen_solver_pt();
564 
565 } // end_of_main
Porous channel flow on a refineable mesh.
Definition: adaptive_pitchfork.cc:118
Class for the LAPACK eigensolver.
Definition: eigen_solver.h:224
Definition: oomph-lib/src/generic/Vector.h:58
#define isfinite(X)
Definition: main.h:111
double Re
Reynolds number.
Definition: fibre.cc:55
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References isfinite, problem, and oomph::Global_Physical_Variables::Re.