Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
(2D Version)
Jiannan(Jay) Tan
Highlights
• 1. Based on MATLAB.
• 2. Aiming on 2D, Steady, Laminar, viscous flow.
• 3. Using unstructured, arbitrary-shape,
collocated grids.
• 4. Navier-Stokes equations are solved and
velocity and pressure are calculated.
• 5. Results are compared with those results
from FLUENT.
• 6. A few benchmarking cases are tested.
How does the code work
2D Code
1. Point ID (x, y)
2. Face ID (A, B, P, nb, property ) 2.Face velocity components
3. Cell ID (3, face1, face2, face3) 4.Face normal
1.Flow flux
Cell ID = P
U,V,P
3.Face area
C(xc, yc)
5.Face velocity components’ gradient
6.Volume
7.Presssure gradient A(xa, ya)
The N-S Euqation Solver
Steady flow
( U ) ( ()) P
Momentum
equation:
t
Continuity
equation: ( U ) 0
1. Discretization: Gauss Theorem
2. Face Mass Flux and Face Scalar
3. SIMPLE Method
4. Least Square Method
5. Pressure-Correction Equation
6. Convergence Criteria
Methodology-SIMPLE Method
Initial guess of u, v and p
Convergence reached?
Post-processing
Discretizing Momentum Equations
Using Gauss Theorem
( U ) ( ( )) P
( U ) dv ( ()) dv P dv
( U ) nˆ ds ( ()) nˆ ds P V
(F ) [ D ( ) D ] P
nb. face
n
nb. face
d E P Cross V
(a p p )n [
nb. face
ae e S p ]n (P V )n1
Interim velocity u, v
MIM
Pressure-Correcton Equation
(anb unb )e ( Su )e
ye
ue nb. face
( PP PE )
(a ) ue
u
p e
nb. face
(anb unb )e ( Su )e ( PP PE ) ye (a up )e (a up )e
(a )
p e (a ) p e
ye
ue' ( PP' PE' )
(a up )e
xe
ve' ( PP' Pe' ) Nb
y2 x2
(a vp )e [(
e 1 a u
a v
)( PP' PE' ) ( u ' y)e ( v ' x)e ] 0
P P
Continuity Equation, Nb
assume u=u’+u*
Nb
a P (aE PE' ) Mass.imbalance.in.to.cell.P
P P
'
[( u
e 1
*
y )e ( v* x)e ( u ' y ) e ( v ' x) e ] 0 e 1
Momentum Interpolation Method
1. Used after interim velocity is achieved after solving
momentum equations.
2. Applied in order to eliminate oscillating pressure field.
Sometimes called ‘pressure smooth term’.
3. Used to calculate mass imbalance into each cell in this
code.
Least Square Method
Backup slide: A failed try using LSM
Covergence Criteria
• The ratio of Maximum imbalance rate into a
single cell over the inlet mass flow rate
Validation & Verification
U(max)=1.47
Test Case 1: Flow in a straight channel
U(max)=1.46
Test Case 2: Sudden Expansion-Jet
Flow
Case 2: FLUENT solution: Velocity vector
U(max)=1.33
Case 2: FLUENT solution: Vortex pattern
Test Case 2: My code solution
U(max)=1.34
Case 2: Comparison of vortex length
Test case 3: Flow in a Z-pipe
Case 3: FLUENT solution: Velocity vector
U(max)=1.44
Case 3: FLUENT solution: Vortex pattern
Test case 3: My code solution
U(max)=1.44
Case 3: Comparison of vortex length
Test case 4: Flow past a square cylinder
Case 4: FLUENT solution: Velocity vector
U(max)=1.43
Case 4: FLUENT solution: Vortex pattern
Test case 4: My code solution
U(max)=1.41
Case 4: Comparison of vortex length
Case 4: Comparison of Cd
FLUENT My Code
Cd 3.752 3.680