If you are not familiar with FORTRAN, you should get a paperback book on FORTRAN-77 or FORTRAN-90. An example is D. M. Etter,
Structured FORTRAN 77 for Engineers and Scientists . The following is a tutorial from the CAAM 211 webpage.
(External Link)
Computer facilities that have compilers usually have an interactive debugger. However, I have not found how to access the debugger on
owlnet . The debugger with the Microsoft FORTRAN Powerstation (now HP FORTRAN) is very easy to use.
Transients and finite reynolds number
The development of numerical simulators should start with a problem for which exact solutions exist so that the numerical algorithm can be verified. Steady, creeping flow has many exact solutions and thus it was used as the starting point for developing a numerical simulator for the Navier-Stokes equations. The student should verify that their code is able to duplicate exact solutions to any desired degree of accuracy.
The next stage in the development of the code is to add transients and finite Reynolds numbers. Finite Reynolds number results in nonlinear terms in the Navier-Stokes equation. Algorithms for solving linear systems of equations such as the conjugate gradient methods solves linear systems in one call to the routine. Nonlinear terms need to be iterated or lagged during the transient solution. Thus nonlinear steady state flow may be solved as the evolution of a transient solution from initial conditions to steady state.
The transient and nonlinear terms now need to be included when making the vorticity equation dimensionless.
$$\begin{array}{c}\frac{Dw}{Dt}=\frac{\partial w}{\partial t}+{v}_{x}\frac{\partial w}{\partial x}+{v}_{y}\frac{\partial w}{\partial y}=\frac{\mu}{\rho}\left[\frac{{\partial}^{2}w}{\partial {x}^{2}}+\frac{{\partial}^{2}w}{\partial {y}^{2}}\right]\hfill \\ t*=\frac{t}{{t}_{o}}\hfill \\ \frac{\partial w*}{\partial t*}+\left[\frac{U\phantom{\rule{0.166667em}{0ex}}{t}_{o}}{{L}_{x}}\right]\phantom{\rule{0.166667em}{0ex}}{v}_{x}^{*}\frac{\partial w*}{\partial x*}+\alpha \left[\frac{U\phantom{\rule{0.166667em}{0ex}}{t}_{o}}{{L}_{x}}\right]\phantom{\rule{0.166667em}{0ex}}{v}_{y}^{*}\frac{\partial w*}{\partial y*}=\left[\frac{\mu \phantom{\rule{0.166667em}{0ex}}{t}_{o}}{\rho \phantom{\rule{0.166667em}{0ex}}{L}_{x}^{2}}\right]\phantom{\rule{0.166667em}{0ex}}\left[\frac{{\partial}^{2}w*}{\partial x{*}^{2}}+{\alpha}^{2}\frac{{\partial}^{2}w*}{\partial y{*}^{2}}\right]\hfill \end{array}$$
Two of the dimensionless groups can be set to unity by expressing the reference time in terms of the ratio of the characteristic velocity and characteristic length. The remaining dimensionless group is the Reynolds number.
$$\begin{array}{c}\left[\frac{U\phantom{\rule{0.166667em}{0ex}}{t}_{o}}{{L}_{x}}\right]=1\phantom{\rule{1.em}{0ex}}\Rightarrow \phantom{\rule{0.277778em}{0ex}}{t}_{o}=\frac{{L}_{x}}{U}\hfill \\ \left[\frac{\mu \phantom{\rule{0.166667em}{0ex}}{t}_{o}}{\rho \phantom{\rule{0.166667em}{0ex}}{L}_{x}^{2}}\right]=\left[\frac{\mu \phantom{\rule{0.166667em}{0ex}}}{\rho \phantom{\rule{0.166667em}{0ex}}U\phantom{\rule{0.166667em}{0ex}}{L}_{x}^{}}\right]=\frac{1}{\mathrm{Re}}\hfill \end{array}$$
The dimensionless equation for vorticity with the * dropped is
$$Re\phantom{\rule{0.166667em}{0ex}}\left[\frac{\partial w}{\partial t}+{v}_{x}\frac{\partial w}{\partial x}+\alpha \phantom{\rule{0.166667em}{0ex}}{v}_{y}\frac{\partial w}{\partial y}\right]=\frac{{\partial}^{2}w}{\partial {x}^{2}}+{\alpha}^{2}\frac{{\partial}^{2}w}{\partial {y}^{2}}$$
The convective derivative can be written in conservative form by use of the continuity equation.
$$\begin{array}{c}{\left({v}_{i}\phantom{\rule{0.166667em}{0ex}}{w}_{j}\right)}_{,i}={v}_{i,i}\phantom{\rule{0.166667em}{0ex}}{w}_{j}+{v}_{i}\phantom{\rule{0.166667em}{0ex}}{w}_{j,i}\hfill \\ \mathrm{but}\hfill \\ {v}_{i,i}=0,\phantom{\rule{1.em}{0ex}}\mathrm{for}\phantom{\rule{0.277778em}{0ex}}\mathrm{incompressible}\phantom{\rule{0.277778em}{0ex}}\mathrm{flow}\hfill \\ \mathrm{thus}\hfill \\ {v}_{i}\phantom{\rule{0.166667em}{0ex}}{w}_{j,i}={\left({v}_{i}\phantom{\rule{0.166667em}{0ex}}{w}_{j}\right)}_{,i}\hfill \\ \mathrm{or}\hfill \\ \mathbf{v}\phantom{\rule{0.166667em}{0ex}}\nabla \mathbf{w}=\nabla \u2022\mathbf{v}\phantom{\rule{0.166667em}{0ex}}\mathbf{w}\hfill \\ Re\phantom{\rule{0.166667em}{0ex}}\left[\frac{\partial w}{\partial t}+\frac{\partial {v}_{x}w}{\partial x}+\alpha \phantom{\rule{0.166667em}{0ex}}\frac{\partial {v}_{y}w}{\partial y}\right]=\frac{{\partial}^{2}w}{\partial {x}^{2}}+{\alpha}^{2}\frac{{\partial}^{2}w}{\partial {y}^{2}}\hfill \end{array}$$
We will first illustrate how to compute the transient, linear problem before tackling the nonlinear terms. Stability of the transient finite difference equations is greatly improved if the spatial differences are evaluated at the new,
$n+1$ , time level while the time derivative is evaluated with a backward-difference method.
$$\begin{array}{c}\frac{\partial w}{\partial t}\approx \frac{{w}_{i,j}^{n+1}-{w}_{i,j}^{n}}{\Delta t}+O\left(\Delta t\right)=\frac{\Delta {w}_{i,j}}{\Delta t}+O\left(\Delta t\right)\hfill \\ \Delta {w}_{i,j}={w}_{i,j}^{n+1}-{w}_{i,j}^{n}\hfill \end{array}$$
Recall that the finite difference form of the steady state equations were expressed as a system of equations with coefficients,
$a$ ,
$b$ , , ect. The vorticity equation for the
$i$ ,
$j$ grid point will be rewritten but now with the transient term included. It is convenient to solve for
$\Delta w$ rather than
${w}^{n+1}$ at each time step.
$$\begin{array}{c}a\phantom{\rule{0.166667em}{0ex}}\Delta {w}_{i+1,j}^{n+1}+b\Delta \phantom{\rule{0.166667em}{0ex}}{w}_{i-1,j}^{n+1}+c\phantom{\rule{0.166667em}{0ex}}\Delta \phantom{\rule{0.166667em}{0ex}}{w}_{i,j+1}^{n+1}+d\phantom{\rule{0.166667em}{0ex}}\Delta {w}_{i,j-1}^{n+1}+e\phantom{\rule{0.166667em}{0ex}}\Delta {w}_{i,j}^{n+1}-\frac{{\delta}^{2}\mathrm{Re}}{\Delta t}\Delta {w}_{i,j}^{n+1}\hfill \\ =f-a\phantom{\rule{0.166667em}{0ex}}{w}_{i+1,j}^{n}-b\phantom{\rule{0.166667em}{0ex}}{w}_{i-1,j}^{n}-c\phantom{\rule{0.166667em}{0ex}}\phantom{\rule{0.166667em}{0ex}}{w}_{i,j+1}^{n}-d\phantom{\rule{0.166667em}{0ex}}{w}_{i,j-1}^{n}-e\phantom{\rule{0.166667em}{0ex}}{w}_{i,j}^{n}\hfill \end{array}$$