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

Solving the unsteady Karman rotating-disk equations for the flow above an infinite rotating disk in a rotating fluid: More...

#include <IBVP_bundle.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

double CppNoddy::Example::W_inf (0.0)
 
double CppNoddy::Example::W_disk (1.0)
 
int main ()
 

Detailed Description

Solving the unsteady Karman rotating-disk equations for the flow above an infinite rotating disk in a rotating fluid:

\[ -U_t + U_{yy} = U^2 + VU_y - W^2 - W_\infty^2 \]

\[ -W_t + W_{yy} = 2U W + V W_y  \]

\[ 2U + V_y = 0 \]

with boundary conditions $ U(y=0)=V(y=0)=0 $, $ W(y=0)=\Omega(t) $ and $ U(y \to \infty ) \to 0 $, $ W(y \to \infty ) \to 0 $. The initial condition corresponds to rigid rotation of the fluid and boundary at the frequency $ W_{\infty} $ The class constructs and solves the IBVP using 2nd order finite-differencing in both space and time over a non-uniform spatial mesh. The example shows the case $ W_\infty = 0 $ and

\[ \Omega(t) = 1 - (1 - W_\infty) \exp( -10t )\]

and simply checks for convergence to the correct steady state solution.

Definition in file IBVPKarman.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Ud 
Wd 

Definition at line 21 of file IBVPKarman.cpp.

21{ U, Ud, V, W, Wd };
@ V
Definition: IBVPKarman.cpp:21
@ Wd
Definition: IBVPKarman.cpp:21
@ W
Definition: IBVPKarman.cpp:21
@ U
Definition: IBVPKarman.cpp:21
@ Ud
Definition: IBVPKarman.cpp:21

Function Documentation

◆ main()

int main ( )

Definition at line 119 of file IBVPKarman.cpp.

120{
121 cout << "\n";
122 cout << "=== IBVP: The unsteady Karman equations ============\n";
123 cout << "\n";
124
125 // define the system
126 Example::Karman_equations problem;
127 // define the boundary conditions
128 Example::Karman_left_BC BC_left;
129 Example::Karman_right_BC BC_right;
130
131 // domain definition
132 double left = 0.0;
133 double right = 40.0;
134 // number of (spatial) nodal points
135 unsigned ny = 400;
136 // time step
137 double dt = 0.005;
138 // number of time steps
139 unsigned max_steps = ( unsigned ) ( 30.0 / dt );
140
141 // construct our IBVP with more nodes near the boundary
142 PDE_IBVP<double> karman( &problem, Utility::power_node_vector( left, right, ny, 2.0 ), &BC_left, &BC_right );
143 //
144 for ( unsigned i = 0; i < ny; ++i )
145 {
146 karman.solution()( i, U ) = 0.0;
147 karman.solution()( i, Ud ) = 0.0;
148 karman.solution()( i, V ) = 0.0;
149 karman.solution()( i, W ) = Example::W_inf;
150 karman.solution()( i, Wd ) = 0.0;
151 }
152
153 // set up output details
154 std::string dirname("./DATA");
155 mkdir( dirname.c_str(), S_IRWXU );
156 TrackerFile metric( "./DATA/IBVP_Karman_metric.dat" );
157 metric.push_ptr( &karman.coord(), "time" );
158 metric.push_ptr( &karman.solution()( ny - 1, V ), "Ekman suction" );
159 metric.header();
160 TrackerFile profs( "./DATA/IBVP_Karman_profs.dat" );
161 profs.push_ptr( &karman.coord(), "time" );
162 profs.push_ptr( &karman.solution(), "solution" );
163 profs.header();
164
165 // time step
166 for ( unsigned i = 1; i < max_steps; ++i )
167 {
168 // take a time step
169 try
170 {
171 karman.step2( dt );
172 }
173 catch (const std::runtime_error &error )
174 {
175 cout << " \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
176 return 1;
177 }
178 metric.update();
179 }
180
181 const double tol( 1.e-4 );
182 // check the BL transpiration vs the known solution
183 if ( abs( karman.solution()( ny - 1, V ) + 0.88447 ) > tol )
184 {
185 cout << "\033[1;31;48m * FAILED \033[0m\n";
186 cout << " Difference = " << abs( karman.solution()( ny - 1, V ) + 0.88447 ) << "\n";
187 return 1;
188 }
189 else
190 {
191 cout << "\033[1;32;48m * PASSED \033[0m\n";
192 return 0;
193 }
194
195}
A templated object for real/complex vector system of unsteady equations.
Definition: PDE_IBVP.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::PDE_IBVP< _Type >::coord(), CppNoddy::TrackerFile::header(), CppNoddy::Utility::power_node_vector(), CppNoddy::TrackerFile::push_ptr(), CppNoddy::PDE_IBVP< _Type >::solution(), CppNoddy::PDE_IBVP< _Type >::step2(), U, Ud, CppNoddy::TrackerFile::update(), V, W, and Wd.

© 2012

R.E. Hewitt