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

Solving the fourth-order Berman (porous channel) similarity equation. More...

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

Go to the source code of this file.

Classes

class  CppNoddy::Example::Berman_equation
 Define the Berman equation by inheriting Equation base class. More...
 
class  CppNoddy::Example::Berman_residual
 Define a residual function using the boundary conditions for the Berman equation. 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

Solving the fourth-order Berman (porous channel) similarity equation.

\[ f'''(y) = Re \left ( f(y)f''(y) - f'(y)^2 - K \right )\]

where $y\in [-1,1]$ and $K$ is a pressure constant and $Re$ is the Reynolds number based on the channel half-height and the wall suction. The boundary conditions are that $f(\pm 1) = \pm 1$ and $f'(\pm 1 ) = 0$. This BVP is solved via Runge-Kutta and (vector) Newton iteration. This similarity form is an exact reduction of the Navier-Stokes equations.

Solving a BVP by converting it to an IVP like this is generally not a smart move!

Definition in file BermanShooting.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 100 of file BermanShooting.cpp.

101{
102
103 cout << "\n";
104 cout << "=== BVP_Shoot: vector Newton solution of Berman eqn =\n";
105 cout << "\n";
106
107 Example::Berman_residual problem;
108 // instantiate a Vector Newton class for the Biharmonic
109 Newton<double> Berman( &problem );
110
111 DenseVector<double> guess( 2, 0.0 );
112 guess[ 0 ] = -2.0;
113 guess[ 1 ] = 1.0;
114
115 try
116 {
117 Berman.iterate( guess );
118 }
119 catch ( const std::runtime_error &error )
120 {
121 cout << " \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
122 return 1;
123 }
124
125 // output the data
126 std::string dirname("./DATA");
127 mkdir( dirname.c_str(), S_IRWXU );
128 TrackerFile my_file( "./DATA/Berman.dat" );
129 my_file.push_ptr( &( problem.ode -> get_mesh() ) );
130 my_file.update();
131
132 // check against the known pressure constant K for Re=1.
133 if ( std::abs( guess[ 1 ] - 0.70457 ) > 1.e-5 )
134 {
135 cout << "\033[1;31;48m * FAILED \033[0m\n";
136 cout.precision( 14 );
137 cout << guess[ 0 ] << " " << guess[ 1 ] << "\n";
138 return 1;
139 }
140 else
141 {
142 cout << "\033[1;32;48m * PASSED \033[0m\n";
143 return 0;
144 }
145
146
147}
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
A vector NEWTON iteration class.
Definition: Newton.h:25

References CppNoddy::Newton< _Type >::iterate(), CppNoddy::Example::Berman_residual::ode, CppNoddy::TrackerFile::push_ptr(), and CppNoddy::TrackerFile::update().

© 2012

R.E. Hewitt