bifurcation_tracking/pitchfork.cc File Reference
#include <iostream>
#include <fstream>
#include <cmath>
#include <typeinfo>
#include <algorithm>
#include <cstdio>
#include "generic.h"

Classes

class  Mesh1D< ELEMENT >
 
class  SSPorousChannelEquations
 
class  SSPorousChannelElement
 
class  UniformTranspiration< ELEMENT >
 

Namespaces

 Global_Physical_Variables
 Global variables.
 

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
616 {
617  //Load the namespace
618  using namespace Global_Physical_Variables;
619 
620  //Set the number of elements in each section of the mesh.
621  unsigned Nx1=50, Nx2=50;
622  //Set up the problem
624 
625  //Open output file
626  ofstream trace("trace.dat");
627 
628  //Track the node in the middle
629  //The element Nx1 contains this node
630  SSPorousChannelElement *Test_pt =
631  dynamic_cast<SSPorousChannelElement *>(problem.mesh_pt()->element_pt(Nx1));
632  //Set the position of the node within the element
633  Vector<double> s(1); s[0] = 1.0;
634 
635  //Step up in Reynolds number
636  for(unsigned i=0;i<6;i++)
637  {
638  //Increase the Reynolds number by 0.5 each time
639  Re = i*0.5;
640  problem.steady_newton_solve();
641  //Output to the trace file
642  trace << Re << " "
643  << Test_pt->interpolated_f(s,1) << " "
644  << Test_pt->interpolated_f(s,0) << std::endl;
645  }
646 
647  //Specify the symmetry the hard way
648  unsigned n_dof = problem.ndof();
649  Vector<double> backup(n_dof);
650  for(unsigned n=0;n<n_dof;n++)
651  {
652  backup[n] = problem.dof(n);
653  }
654  //Now sort out the problem
655  unsigned n_node=problem.mesh_pt()->nnode();
656  for(unsigned n=0;n<n_node;n++)
657  {
658  Node* nod_pt = problem.mesh_pt()->node_pt(n);
659  double x = nod_pt->x(0);
660  if(!nod_pt->is_pinned(1))
661  {
662  nod_pt->set_value(1,x*x);
663  }
664  if(!nod_pt->is_pinned(0))
665  {
666  nod_pt->set_value(0,0.0);
667  }
668  }
669 
670  LinearAlgebraDistribution dist(problem.communicator_pt(),n_dof,false);
671  DoubleVector symm(&dist,0.0);
672  for(unsigned n=0;n<n_dof;n++)
673  {
674  symm[n] = problem.dof(n);
675  problem.dof(n) = backup[n];
676  }
677 
678 
679  //Let's try to find the pitchfork it
680  problem.activate_pitchfork_tracking(&Re,symm);
681 
682  problem.steady_newton_solve();
683 
684  std::cout << "Pitchfork detected at " << Re << std::endl;
685  std::cout << "The slack parameter is " << problem.dof(2*n_dof+1) << std::endl;
686 
687  //Output to the trace file
688  trace << Re << " "
689  << Test_pt->interpolated_f(s,1) << " "
690  << Test_pt->interpolated_f(s,0) << std::endl;
691 
692 
693  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Definition: bifurcation_tracking/pitchfork.cc:467
double interpolated_f(const Vector< double > &s, const unsigned &i)
FE interpolated values of the arguments.
Definition: bifurcation_tracking/pitchfork.cc:433
Definition: bifurcation_tracking/pitchfork.cc:560
void set_value(const unsigned &i, const double &value_)
Definition: nodes.h:271
bool is_pinned(const unsigned &i) const
Test whether the i-th variable is pinned (1: true; 0: false).
Definition: nodes.h:417
Definition: double_vector.h:58
Definition: linear_algebra_distribution.h:64
Definition: nodes.h:906
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:1060
RealScalar s
Definition: level1_cplx_impl.h:130
Global variables.
Definition: TwenteMeshGluing.cpp:60
double Re
Reynolds number.
Definition: fibre.cc:55
list x
Definition: plotDoE.py:28
void symm(int size=Size, int othersize=OtherSize)
Definition: product_symm.cpp:13
Constructor for SteadyAxisymAdvectionDiffusion problem
Definition: steady_axisym_advection_diffusion.cc:213

References i, SSPorousChannelEquations::interpolated_f(), oomph::Data::is_pinned(), n, problem, GlobalPhysicalVariables::Re, s, oomph::Data::set_value(), symm(), plotDoE::x, and oomph::Node::x().