<<

– Stream function Solver in Cylindrical Coordinates

L. Brieda May 27, 2016

This document summarizes equations used to solve flow in a cylindrical pipe using the stream function approach as seen in https://www.particleincell.com/2016/vorticity-streamfunction-cylindrical.

1 Governing Equations 1.1 Velocity Components Velocity components of an incompressible axisymmetric flow can be described using ψ as [1]

1 ∂ψ u = u = (1) z r ∂r 1 ∂ψ u = v = − r r ∂z

The azimuthal component uθ does not depend on the stream function and can be defined independently. In this writeup, uθ = 0. Also, the volumetric flow bounded by streamtube ψ is Q = 2πψ. This formulation automatically satisfies continuity ∇ · ~u = 0, since

1 ∂(ru ) ∂u 1 ∂2ψ 1 ∂2ψ r + z = − + = 0 r ∂r ∂z r ∂r∂z r ∂z∂r 1.2 Vorticity

Vorticity is defined as ~ω = ∇ × ~v. For axisymmetric flow with ∂/∂θ = 0 and uθ = 0 only the wθ component survives and we have ∂v ∂u ω = ω = − (2) θ ∂z ∂r 1.3 Stream function governing equation By substituting definitions of velocity in terms of Stokes stream function, Eq. 1, into Eq. 2 for vorticity, we obtain ∂ 1 ∂ψ  ∂ 1 ∂ψ  ω = − − ∂z r ∂z ∂r r ∂r 1 ∂2ψ 1 ∂2ψ 1 ∂ψ = − − + r ∂z2 r ∂r2 r2 ∂r or ∂2ψ ∂2ψ 1 ∂ψ + − = −ωr (3) ∂z2 ∂r2 r ∂r The left side of this equation is not ∇2ψ due to the negative sign on the last term on the left side.

1 1.4 Vorticity Transport Equation The temporal evolution of vorticity is given by the vorticity transport equation. This equation is normally derived by taking of the momentum equation, for instance see [2] for details, and is given by

∂ω + ~v · ∇ω = ν∇2ω ∂t For the axisymmetric flow we have

∂ω ∂w ∂w ∂2ω ∂2ω 1 ∂ω  + u + v = ν + + (4) ∂t ∂z ∂r ∂z2 ∂r2 r ∂r

2 Finite Difference Form 2.1 Stream function Equation 3 is discretized using standard central difference as 1 1 1 2 (ψi−1,j − 2ψi,j + ψi+1,j) + 2 (ψi,j−1 − 2ψi,j + ψi,j+1) − (ψi,j+1 − ψi,j−1) = ωi,jri,j (5) ∆ z ∆ r 2ri,j∆r

k+1 k This equation is solved using an SOR-accelerated Jacobi solver, with convergence check ||ψ − ψ || < tol.

2.2 Vorticity The vorticity transport equation, Equation 4, is advanced using the Runge-Kutta fourth-order (RK4) method. Letting vorticity transport equation be given by

∂ω ∂2ω ∂2ω 1 ∂ω  ∂w ∂w = ν + + − u − v ∂t ∂z2 ∂r2 r ∂r ∂z ∂r ∂ω = R(ω) ∂t we have [3]

∆t w(1) = wk + Rk (6) 2 ∆t w(2) = wk + R(1) (7) 2 w(3) = wk + ∆tR(2) (8) ∆t   wk+1 = wk + Rk + 2R(1) + 2R(2) + R(3) (9) 6 3 Boundary Conditions

In order to solve this equation (using finite difference method) we need to specify boundary conditions. There are five types of boundaries to consider for the tube problem: 1) wall, 2) axis of revolution, 3) inlet, 4) outlet on zmax, and 5) outlet on rmax. These are sketched in Figure 3.

3.1 Inlet

We assume the flow entering through the inlet is parallel to the cylinder axis. Thus at the inlet ur = v = 0 or ∂ψ = 0 (10) ∂z inlet

2 Figure 1: Boundary types for pipe problem

Substituting v = 0 into the vorticity equation gives us

∂u ω = − (11) inlet ∂r

These equations are discretized using first order scheme as ψ0,j = ψ1,j and ω0,j = (u0,j−1 − u0,j+1)/(2∆r).

3.2 Axis of Revolution We require v = 0 as there can be no flow across the axis of revolution. Therefore ∂ψ/∂z = 0, and value of ψ is constant along the axis. We set this value to zero, giving us

ψ axis = 0 (12) Zero radial velocity also implies that along the axis ω = −∂u/∂r. Axial symmetry implies ∂()/∂r = 0 at r = 0, and

ω axis = 0 (13)

3.3 Wall

Q = 2π(ψ2 − ψ1) is the volumetric flow rate between two stream tubes. With ψ1 = 0 being the axis of revolution, we have Dirichlet 1 2 ψ = u0r (14) wall 2 inlet along the outer wall. Vorticity boundaries along the wall are derived using similar approach to [2]. Since the stream function is constant along a wall, of ψ in Equation 3 vanish in the wall direction. Along a left wall we have ∂2ψ = −ωr ∂z2 wall Assuming the wall is at i = L, we can write the following Taylor series expansion

∂ψ ∂2ψ ∆z2 ψL+1,j = ψL,j + ∆z + ∂z L,j ∂z2 L,j 2

Since ∂ψ/∂z = −vr ∂2ψ ∆z2 ψL+1,j = ψL,j − vL,jr∆z + ∂z2 L,j 2 or ∂2ψ 2(ψ − ψ ) 2v r = L+1,j L,j + L,j ∂z2 L,j ∆z2 ∆z and finally 2(ψL,j − ψL+1,j) 2vL,j ω = − (15) L,j r∆z2 ∆z

3 Using similar approach, the boundary condition for a right wall at i = R is found to be

2(ψR,j − ψR−1,j) 2vR,j ω = + (16) R,j r∆z2 ∆z Along the top wall, ∂ψ/∂z = 0 and Equation 3 reduces to ∂2ψ 1 ∂ψ  2 − = −ωr ∂r r ∂r wall Again we start by expanding the second , ∂ψ ∂2ψ ∆r2 ψi,T −1 = ψi,T − ∆r + ∂r i,T ∂r2 i,T 2 Using ∂ψ/∂r = ur, the above reduces to ∂2ψ 2(ψ − ψ 2u r = i,T −1 i,T + T,j ∂r2 i,T ∆r2 ∆r Substituting into the original equation, 2(ψ − ψ ) 2u r i,T −1 i,T + i,T − u = −ωr ∆r2 ∆r i,T or 2(ψi,T − ψi,T −1) 2ui,T ui,T ω = − + (17) i,T r∆r2 ∆r r There is no bottom wall in this problem, but for generality, the matching boundary condition can be found to be 2(ψi,B − ψi,B+1) 2ui,B ui,B ω = + + (18) i,B r∆r2 ∆r r 3.4 Zmax outlet In general, the flow will be aligned with the z-axis, however, there may be some non-zero v component due to jet expansion. As such, simply setting ∂ψ/∂z|zmax = 0 may not be valid. Following approach in [2], on zmax we let ∂ψ = −vr (19) ∂z zmax which is differenced as ψni−1,j = ψni−2,j − ∆zvni−1,jrj. Vorticity boundary condition on the outlet is set as ∂ω = 0 (20) ∂z zmax

or ωni−1,j = ωni−2,j

3.5 Rmax outlet This is the trickiest of all boundaries and I am not particularly sure what boundary condition is most applicable. Generally, we expect there to be very little / no flow here. Setting no-flow boundary is analogous to making this boundary a wall, with ψ = ψwall and ω set from Equation 17. However, I think more appropriate boundary may be requiring that any flow there may be is perpendicular to the wall, hence u = 0 and ∂ψ = 0 (21) ∂r rmax which is differenced as ψi,nj−1 = ψi,nj−2. Vorticity boundary condition is set similarly to the zmax outlet ∂ω = 0 (22) ∂r rmax

or ωni−1,j = ωni−2,j

4 References

[1] Wikipedia, “Stokes Stream Function”, Accessed May 10th, 2016, https://en.wikipedia.org/wiki/Stokes_stream_ function [2] Salih, A., “Streamfunction-Vorticity Formulation”, Department of Aerospace Engineering Indian Institute of Space Science and Technology, March 2013, https://www.iist.ac.in/sites/default/files/people/psi-omega.pdf [3] Tannehill, J., Anderson, D., Pletcher, R., Computational Fluid Mechanics and Heat Transfer, Taylor & Francis, 2nd ed., 1997

5