The governing equations for incompressible laminar fluid flows are the Navier-Stokes momentum equation and the continuity equation. We will use the Fasttalk syntax to set up a basic operator-splitting algorithm to solve the 3D governing equations.
The Navier-Stokes momentum equation is:
| |
(1) |
For the unsteady Navier-Stokes equation, we solve (1) as an initial
value problem, that is, at time step
, we know the velocity value
, and we obtain the velocity at time step
by solving for the
velocity increment
so that
. From the Navier-Stokes
equation, we see that
satisfies:
| |
(2) |
The left-hand side of (1) can be split into two principal operators as follows:
| |
(3) |
This equation for velocity increment can be split as follows:
| |
(4) |
![]()
| |
(5) |
![]()
| |
(6) |
The numerical scheme
will be a fully implicit backward
Crank-Nicolson method. The three components
of velocity
vector
can be solved separately by
. In this way, less
computer memory is required for inverting the linear matrices.
For the
-component
,
can be shown to be
![]() |
(7) |
![]()
A cony % name of the equation
% Nc for Uy Component
e {1/DT} U1 \ % first term on LHS
+{V100}_jD_j U1 \ % convective operator on LHS
-D_j{1.0/Re}D_j U1 \ % diffusive term on LHS
= {-1.0/DT} {V302} \ % first term on RHS
-{V100}_jD_j {V102} \ % pressure gradient, Y dir'n
+D_j{1.0/Re}D_j{V102} \ % diffusive term on RHS
%
b Uy=0 U1 = {0.0} % b.c.: Uy = 0.0
b Uy=1 U1 = {1.0} % b.c.: Uy = 1.0
b Uy=-1 U1 = {-1.0) % b.c.: Uy =-1.0
b Uy=outlet n.grad U1 = {0.0} % b.c.: Neumann Condition
%
|
Here the boundary conditions use symbolic tags such as Uy = 0. These have to be related to the numerical tags by previous D statements such as
D Uy=0 2 D Uy=0 3A symbolic tag can stand for several numerical tags, and each numerical tag can have several symbolic tags associated with it.
The numerical scheme
for solving the convection equation is
constructed in Fasttalk as follows:
< solcony
!# convection operator for Uy % print out message
cony 1 100 V100 200 V200 300 V300 % assemble Y conv eqn
M_rhs_L1 = L1 V101 % L1 norm of RHS
show M_rhs_L1 % show RHS L1 norm
itsolve 1 % call GMRES solver
show V101 % show solution value
V202 = V202 + V101 % U^{n+1}=U^{n+1}+dU^k
V402 = V101 + V402 % dU^{k+1}=dU^{k-1}+dU^k
popp % push vector stack back
>
|
Similarly, the numerical scheme
can be set up for the
component in a fully implicit backward Crank-Nicolson approach:
![]() |
(8) |
A dify % name of the equation
% Nd for Uy Component
e {1/DT} U1 \ % first term on LHS
-D_j{1.0/Re}D_j U1 \ % diffusive term on LHS.
= {-1.0/DT} {V302} \ % first term on RHS
-{V100}_j D_j {V102} \ % convective operator on RHS
-{0.0,1,0,0.0}_jD_j{V201}\ % pressure gradient, Y dir'n
+D_j{1.0/Re} D_j {V102} \ % diffusive term on RHS
%
b Uy=0 U1 = {0.0} % b.c.: Uy = 0.0
b Uy=1 U1 = {1.0} % b.c.: Uy = 1.0
b Uy=-1 U1 = {-1.0} % b.c.: Uy =-1.0
b Uy=outlet n.grad U1 = {0.0} % b.c.: Neumann condition
%
|
< soldify
!# diffusion operator for Uy % print out message
dify 1 100 V100 200 V200 300 V300 % Y diffusive eqn
M_rhs_L1 = L1 V101 % L1 norm of RHS
show M_rhs_L1 % show RHS L1 norm
itsolve 1 % call GMRES solver
show V101 % show solution value
V202 = V202 + V101 % U^{n+1}=U^{n+1}+dU^k
V402 = V101 + V402 % dU^{k+1}=dU^{k-1}+dU^k
popp % push vector stack back
>
|
After all the macros for the velocity components are constructed, they can be put together to produce a single macro for all velocity components, namely
< solcon
solconx
solcony
solconz
>
where solconx and solconz are the macros for solving the
convective equations of
< soldif
soldifx
soldify
soldifz
>
where soldifx and soldifz are the macros for solving the
diffusive equations of As a summary, in accordance to equation (6), the operator-splitting algorithm for the momentum Navier-Stokes equation can be written in Fasttalk in the following macro opsplit.
< opsplit
solcon
soldif
soldif
solcon
>
In this algorithm, we have assumed that pressure ![]()
![]()
![]()
A masscon % name of the cty eqn
e {1.0}U1 \% first term of eqn
-D_j{0.5*Dtau*Dtau*beta}D_jU1\% Laplace operator
= -{beta*Dtau}D_j{V100}_j % div of velocity V100
b inlet U1 = {0.0} % bc for flow inlet
b outlet U1 = {0.0} % bc for flow outlet
b wall n.grad U1 = {0.0} % bc for wall
|
After the pressure equation has been defined as shown above in
Fasttalk, we can set up a Fasttalk macro to solve this equation.
The macro command for solving the continuity equation is given the
name solmass and it is defined in Fasttalk as follows:
< solmass
masscon 1 100 V100 % continuity eqn assembled
CON_rhs_L1 = L1 V101 % L1 norm of RHS of eqn
CON_rhs_L1 = CON_rhsL1/Nodes % average residual per node
show CON_rhs_L1 % show L1 norm of RHS
itsolve 3 % call iterative CG solver
show V101 % show max/min values of
% pressure increment
V301 = V101 + V301 % add increment to pressure
popp % push vector stack down
>
|
< opsplit
solcon % solving the convective operator
zero % after first iteration, bc's are set zero
solmass % solving for pressure
soldif % solving for diffusive operator
soldif % solving for diffusive operator
solcon % solving the convective operator
solmass % solving for pressure
>
|
< one_step % name of this macro
while(CON_rhs_L1 > 0.0001)% cty cnvgnce criterion
opsplit % call o-s algorithm
endwhile % end of while loop
show Time % print on screen the time
store Time % store Time in rhs.out
store V100 % store vel vector V100 in
% file rhs.out
>
|
< run % name of this macro
Time = T0 % starting time
while (Time < Tn)
one_step % calls operator-splitting algorithm
% at this time step
Time = Time + DT % a new time step is started
V300=0.0 % velocity increment is reset to
% zero at new time step
endwhile
>
|