Professional Documents
Culture Documents
v
+ (v )v = 2 v 1 p,
and v =0 (1)
t
We solve this non-trivial task hydrodynamic numerically. For this we give away the skeleton of the model
program, where only the boundary conditions and the discretized equations must be supplemented.
1
2 = (2)
2 = (3)
y x x y
2 2
1 2 2 2
p = 2 2
, (4)
2 x y xy
where the vorticity and the stream function are given by,
vx = vy = = ( v)z (5)
y x
In the problem we are only interested in the scalar functions and , the uncoupled equation (4) need not
to be considered. Additionally because of the mirror symmetry of the problem, the functions and satisfy
(x, y) = (x, y) and (x, y) = (x, y), thus we only need to simulate the upper half of the system.
p H 2
y 2
v0 (y) = v0 1 ex with v0 = (6)
H l 2
where p/l is the pressure gradient. The respective stream function and vorticity yield,
1 y 2
0 (y) = v0 y 1 , 0 (y) = 2v0 y/H 2 (7)
3 H
2 =
(8)
" !#
2 R
= 0 (9)
y x
x y
where R = v0h is the Reynolds number for our discretization. Note that the differential operators are also
affected with the new spatial coordinates x
and y. We also use the Finite Differences method to numerically
solve the above equations; We use symmetrical form for the derivatives,
2 f = fi(j+1) + fi(j1) + f(i+1)j + f(i1)j 4fij
f = f(i+1)j f(i1)j /2 (10)
ij x
ij
If one writes the discretized Eq. (8-9) in matrix form, one obtains in multi-index notation,
2
and (for
1. Initialize 0 and0 );
example, by
= q and obtain the new stream function ;
2. Solve A
Figure 2: Discretization of the problem, only the upper half is shown; W = wh, T = th.
Boundary conditions
The stream function has been chosen to have the value 0 on the axis of symmetry y = 0. The edges of the
object, together with the symmetry axis, form a single stream line, hence on the object edges must be equal
to 0. The upper edge at y = H is also a stream line, since we can also use the Dirichlet boundary condition
(y = H) = 0 (y = H) = (2v0 H)/3. For the left and right edges, we can write the Neumann boundary
condition x = 0 (translation invariance).
1
The vorticity must vanish on the axis of symmetry on the basis of the symmetry, ie. (y = 0) = 0. For the
left and right edges, we use Neumann boundary conditions x = 0 (translation invariance). Slightly less obvious
are the conditions for the stream boundaries at the object and at the upper edge. For this reason the non-slip
condition for viscous liquid with Taylor expansion of the stream function comes to the aid - for the upper edge
of the object , for example, the vorticity is
2 2
iw = = (12)
y2 iw
iw
1 2
i(w+1) = iw + + + .... (13)
y iw 2 y2 iw
Let us now consider that the non-slip condition at the upper object edge states that y = vx = 0 , we get
condition
iw = 2 i(w+1) iw (14)
Similar conditions are to be applied to other edges. For the corners of the object, a symmetrical form is
offered by the condition for the upper and the respective side edge, for the left corner
1 Note: a Dirichlet boundary condition using the asymptotic solution 0 could also be used.
3
aw = a(w+1) + (a1)w 2aw
inside the object - a
We need additional (fictitious) boundary conditions for the apparent variable ,
Dirichlet condition that fixes the value to 0 satisfies this.
The Python libraries NumPy, SciPy and Matplotlib are used for this purpose. To start the program, down-
load the 4 files from the continuum mechanics web page, save them to a directory, and execute the command
python main.py in the directory.
Instructions
Complete the missing lines with discretized equations and the boundary conditions for the upper, lower,
left, and right edges, and test the program in debug_mode (i.e., without the object). 2
Complete the boundary conditions for the object, switch off debug_mode, and make test simulations for
the problem with H = 4W , W = T with (physical) Reynolds number Re 2W v0 / equal to 3 and 24.
Increase the precision of the self-consistent calculation, given by variable aimed_precision in the module
main.py (to about 108 ).
Investigate the effect of the boundary conditions - increase the distance in front of the object upstream
(ah F ) together with the length to the right edge (L F T ) and find suitable F and L.
Investigate the effect of discretization by increasing the node points density (points_per_unit_length
in the module parameters.py ).
2 Note: the analytical solution in Eq.(7) for problem without object is not an exact solution of the discretized problem.