Professional Documents
Culture Documents
11-Useful Datastructure Convection and Diffusion
11-Useful Datastructure Convection and Diffusion
We will
z Discuss implementation issues and data structures
z Start looking at adding convection terms to our
transport equation
z Start looking at two different schemes for discretizing
the convection terms
» Central difference scheme
» Upwind difference scheme
Data Structures
Cell
I,J Face (I,J) I,J
1 2 NI
I =1,2,…NI
Continuous Cell Numbering
NI*NJ
Finding L from I,J:
J=1,2,…,NJ L = I+ (J-1)*NI
Reverse:
I,J
J=L/NI +1
I = L-(J-1)*NI
1 2 NI
I =1,2,…NI
Typical Loop for Structured Meshes
COEFF
Face-Based Storage for Unstructured
Meshes
z Each face would know its two cells.
z Say you’re at face 50 – the two cells are 2 and 3.
z Go to CINDEX [2] – read off “3”
z The neighbor indices of cell 2 lie in locations 3 and 4 of
NBINDEX. The cell neighbor indices are 1 and 3.
z COEFF [3] and COEFF[4] store coeffs for cells 1 and 3. Find
value of the coeff for face 50 (connecting cells 2 and 3) and put it
in COEFF[4]. Also put it in COEFF[5].
50
Unstructured Gauss-Seidel Pseudo Code
+
Solution Loop
Solution Loop (Cont’d)
Steady 2D Convection-Diffusion Equation
z Governing equation:
Nothing different
so far !
Discretization (Cont’d)
z Area vectors:
Units?
Multiplies face
value φe: How to
evaluate?
Assuming
uniform mesh
z Note possibility of
negative
coefficients
z Note extra flow
rate term in aP
Closure
In this lecture:
z We considered useful data structures for structured
and unstructured meshes
z We considered the steady 2D convection-diffusion
equation
z Convection term requires evaluation of φ on the faces
z Developed CDS scheme