CppNoddy  0.92
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
ArcShootFalknerSkan.cpp File Reference

Arc-length continue the Falkner-Skan equation. More...

#include <cassert>
#include <IVP_bundle.h>
#include <Newton_bundle.h>

Go to the source code of this file.

Classes

class  CppNoddy::Example::FS_eqn
 Define the Falkner-Skan equation. More...
 
class  CppNoddy::Example::FS_residual
 Define a residual function using the boundary conditions for the Blasius profile. More...
 

Namespaces

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

Functions

int main ()
 

Detailed Description

Arc-length continue the Falkner-Skan equation.

\[ f'''(y) + f(y) f''(y) + \beta \left ( 1 - f'(y)^2 \right )= 0\,, \]

for varying values of the Hartree parameter $ \beta $ – around the well known limit point. The boundary conditions are $ f(0)=f'(0)=0 $ and $ f'(\infty) = 1 $. We start from the Blasius solution, then arc-length continue to find the limit point at $ \beta \approx -0.19 $.

Using Runge-Kutta to solve a BVP is not a great method, but here it's used to demo the arc-length continuation for scalar problems.

Definition in file ArcShootFalknerSkan.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 85 of file ArcShootFalknerSkan.cpp.

86{
87 cout << "\n";
88 cout << "=== ARC: arc-length continuation of the FS equation =\n";
89 cout << "\n";
90
91 // the residual function to be satisfied
92 Example::FS_residual problem;
93
94 // initial conditions
95 problem.eqn -> beta = -0.11;
96 DenseVector<double> stress( 1, 0.4 );
97 // Scalar Newton iteration problem
98 Newton<double> newton( &problem );
99
100 newton.set_monitor_det( true );
101 // initialise a state for arc length continuation
102 newton.init_arc( stress, &problem.eqn -> beta, -0.01, 0.1 );
103
104 // output for the data
105 std::string dirname("./DATA");
106 mkdir( dirname.c_str(), S_IRWXU );
107 TrackerFile my_file( "./DATA/FSarc_path.dat" );
108 my_file.push_ptr( &problem.eqn -> beta, "Hartree parameter" );
109 my_file.push_ptr( &stress, "Shear stress at the wall" );
110 my_file.header();
111
112 // seek out the limit point in an ad hoc way
113 double approx_limit_point = 0.0;
114 do
115 {
116 double last_beta = problem.eqn -> beta;
117 try
118 {
119 try
120 {
121 newton.arclength_solve( stress );
122 //cout << problem.eqn -> beta << " " << stress[0] << "\n";
123 }
124 catch ( const std::runtime_error &error )
125 {
126 cout << " \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
127 return 1;
128 }
129 }
130 catch ( const ExceptionBifurcation &bifn )
131 {
132 cout << " Bifurcation detected between beta = " << last_beta
133 << " and beta = " << problem.eqn -> beta << "\n";
134 cout << " Continuing further.\n";
135 newton.set_monitor_det( false );
136 approx_limit_point = 0.5 * ( problem.eqn -> beta + last_beta );
137 }
138 my_file.update();
139 }
140 while ( problem.eqn -> beta < -0.1 );
141
142 if ( abs( approx_limit_point + 0.1988 ) > 0.0005 )
143 {
144 cout << "\033[1;31;48m * FAILED \033[0m\n";
145 return 1;
146 }
147 else
148 {
149 cout << "\033[1;32;48m * PASSED \033[0m\n";
150 return 0;
151 }
152}
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
A vector NEWTON iteration class.
Definition: Newton.h:25

References CppNoddy::Newton< _Type >::arclength_solve(), CppNoddy::Example::FS_residual::eqn, CppNoddy::TrackerFile::header(), CppNoddy::ArcLength_base< _Type >::init_arc(), CppNoddy::TrackerFile::push_ptr(), CppNoddy::Newton< _Type >::set_monitor_det(), and CppNoddy::TrackerFile::update().

© 2012

R.E. Hewitt