CppNoddy  0.92
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
BVPKarmanArclength.cpp File Reference

Arc-length continuation of the Karman rotating-disk equations for the flow above an infinite rotating disk: More...

#include <BVP_bundle.h>
#include "../Utils_Fill.h"

Go to the source code of this file.

Classes

class  CppNoddy::Example::Karman_equations
 Define the Karman equations. More...
 
class  CppNoddy::Example::Karman_left_BC
 Define the boundary conditions. More...
 
class  CppNoddy::Example::Karman_right_BC
 

Namespaces

namespace  CppNoddy
 A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechanics.
 
namespace  CppNoddy::Example
 

Enumerations

enum  {
  U , Ud , V , W ,
  Wd
}
 

Functions

int main ()
 

Variables

double CppNoddy::Example::s
 relative rotation rate More...
 

Detailed Description

Arc-length continuation of the Karman rotating-disk equations for the flow above an infinite rotating disk:

\[ U''(y) = U^2(y) + V(y)U'(y) - W^2(y) + s^2 \]

\[ W''(y) = 2U(y)W(y) + V(y)W'(y)  \]

\[ 2U(y) + V'(y) = 0 \]

with boundary conditions $ U(0)=V(0)=0 $, $ W(0)=1 $ and $ U(\infty ) \to 0 $, $ W(\infty ) \to s $. The class constructs and solves the global matrix problem using 2nd-order finite differences and employs arc-length continuation to obtain the first three solution branches in the neighbourhood of $ s=0 $. The validation of the results is based upon the approximate location of the second limit point.

Definition in file BVPKarmanArclength.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Ud 
Wd 

Definition at line 23 of file BVPKarmanArclength.cpp.

23{U, Ud, V, W, Wd};

Function Documentation

◆ main()

int main ( )

Definition at line 92 of file BVPKarmanArclength.cpp.

93{
94 cout << "\n";
95 cout << "=== BVP: Arc-length continuation of the Karman eqns =\n";
96 cout << "\n";
97
98 Example::Karman_equations problem;
99 Example::Karman_left_BC BC_left;
100 Example::Karman_right_BC BC_right;
101
102 // Boundary layer is from 0 to 20
103 double left = 0.0;
104 //need a large domain for the higher branch modes
105 double right = 150.0;
106 Example::s = 1.0;
107 // number of nodal points
108 unsigned N = 2001;
109 // use a non-uniform mesh
110 DenseVector<double> nodes = Utility::power_node_vector( left, right, N, 1.2 );
111
112 ODE_BVP<double> ode( &problem, nodes, &BC_left, &BC_right );
113
114 // initial state is rigid-body rotation
115 for ( unsigned i = 0; i < N; ++i )
116 {
117 ode.solution()( i, W ) = Example::s;
118 }
119
120 // output to check the adapted mesh
121 std::string dirname("./DATA");
122 mkdir( dirname.c_str(), S_IRWXU );
123 TrackerFile my_file( "./DATA/BVP_Karman_arc.dat", 8 );
124 my_file.push_ptr( &Example::s, "s" );
125 my_file.push_ptr( &ode.solution()( N - 1, V ), "V_inf" );
126
127 // initialise the arc-length routine
128 double ds( -0.02 );
129 ode.init_arc( &Example::s, ds, 0.01 );
130 ode.rescale_theta() = true;
131 ode.desired_arc_proportion() = 0.25;
132 my_file.update();
133
134 double last_approx_lp( 0.0 );
135 // take 101 arc-length steps
136 for ( int i = 0; i < 101; ++i )
137 {
138 try
139 {
140 ds = ode.arclength_solve( ds );
141 cout << Example::s << " " << ode.solution()( N-1, V ) << "\n";
142 }
143 catch (const ExceptionBifurcation &error )
144 {
145 cout << " Bifurcation detected near p = " << Example::s << "\n";
146 last_approx_lp = Example::s;
147 break;
148 }
149 my_file.update();
150 }
151 if ( std::abs( last_approx_lp + 0.1605 ) > 1.e-3 )
152 {
153 cout << "\033[1;31;48m * FAILED \033[0m\n";
154 cout << " Difference = " << abs( last_approx_lp + 0.1605 ) << "\n";
155 return 1;
156 }
157 else
158 {
159 cout << "\033[1;32;48m * PASSED \033[0m\n";
160 return 0;
161 }
162}
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
A templated object for real/complex vector system of first-order ordinary differential equations.
Definition: ODE_BVP.h:37
DenseVector< double > power_node_vector(const double &lower, const double &upper, const std::size_t &N, const double &power)
Return a DENSE vector with the nodal points of a non-uniform mesh distributed between the upper/lower...
Definition: Utility.cpp:123

References CppNoddy::ODE_BVP< _Type, _Xtype >::arclength_solve(), CppNoddy::ArcLength_base< _Type >::desired_arc_proportion(), CppNoddy::ODE_BVP< _Type, _Xtype >::init_arc(), CppNoddy::Utility::power_node_vector(), CppNoddy::TrackerFile::push_ptr(), CppNoddy::ArcLength_base< _Type >::rescale_theta(), CppNoddy::ODE_BVP< _Type, _Xtype >::solution(), CppNoddy::TrackerFile::update(), V, and W.

© 2012

R.E. Hewitt