These are our steady flow equations.
I set the time derivative in
the vorticity equation to zero,
and then rearrange the terms.
We have something that looks like
a Cartesian Laplacian operator on
the left-hand side of
this equation with a negative sign,
and everything else on the right-hand side.
Now we want to put these equations on
our grid and write iteration equations.
We're going to define Psi at the i,
j grid point,
to be Psi at Xi sub i, Theta sub j.
Similarly, Omega at the i,
j grid point,
is going to be the value of Omega at Xi i,
and Theta sub j.
Then we write down the SOR method,
the successive over-relaxation method that I
discussed in detail in my numerical methods course.
I won't rederive that here,
but we want to start with this first equation.
We have Psi sub i, j.
This will be at the k plus 1 iteration,
will be equal to 1 minus
the relaxation parameter in the Psi equation,
I'll call that r sub Psi,
times Psi i,
j at the kth iteration,
plus the relaxation parameter divided by 4.
Now, basically I'm just doing
the Laplacian like operator here.
This will be Psi i plus 1,
j plus Psi i minus 1,
j plus Psi i,
j plus 1 plus Psi i, j minus 1.
That completes the Laplacian part of the equation,
and then the right-hand side.
This has a 1 over h squared,
we multiply through by h squared,
so we'll come on this side.
This term will be an h squared times
e^2 Psi i times Omega i, j.
Remember this is at the k plus 1 iteration,
and everything on the right-hand side will
be at the k iteration.
Given Psi and Omega at the k iteration,
this equation then computes it at the k plus 1 iteration.
You'll have to set the relaxation parameter r sub Psi,
so that it converges the smaller value of r,
the easier it is to converge,
except that the smaller value of r,
the more iterations you'll need to get it to converge.
You want fast convergence,
but you want it to converge.
Now, how about the Omega equation?
Very similar, Omega i,
j, that will be at the k plus 1 iteration,
is equal to 1 minus r Omega,
a different relaxation parameter,
times Omega i,
j plus the relaxation parameter,
r Omega divided by 4.
Again, I'm just writing
the Laplacian like operator here.
Omega i plus 1,
j plus Omega i minus 1,
j plus Omega i,
j plus 1 plus Omega i, j minus 1.
Then we have the right-hand side here.
The right-hand side here,
this one had a 1 over h squared.
Each of these derivatives have a 1 over h,
so we also have a 1 over h squared here also.
The h squared cancels.
We're doing a centered derivatives.
This has a 1 over 2h,
so there's a 2 and a 2 which is a 4,
and this 2 is an 8,
so this term then will
have Reynolds number divided by 8,
times the numerators then for all of these derivatives.
I'm just going to call that F for now.
F sub i, j,
and we'll write down what F is in the next line.
Again, this is at k plus 1 iteration,
and each of these are at k. This is k,
this is k,
this is k and the F is that
k. The F's then are these derivatives.
F_i, j,
that is going to be the derivative of Psi,
so it's going to be Psi
with respect to the first index CoPsi,
so Psi i plus 1,
j minus i,
i minus 1,
j the derivative of Omega,
that's with respect to the second index,
so i, j plus 1,
minus Omega i,
j minus 1,
minus the derivative of
Psi with respect to the second index,
so Psi i,
j plus one minus Psi i,
j minus 1,
and then the derivative of Omega and
that's with respect to the first index,
so omega i plus 1,
j minus Omega i minus 1,
j, and that's our f here.
The way I coded,
is I always put an f
here and then define this separately.
This is at the kth iteration.
Each of these fields are at the kth iteration.
Here's our full iteration equations in all their glory.
This is exactly what you need to code.
Make sure that you do it carefully because
any error you introduce in the code will give you a bug.
The way it works, again,
is that you have these fields at some starting value,
k equals 1, say,
and then you compute them at k equals 2, step 2.
Then you put it back in and you get it
at iteration step 3,
and then put it back in and you get it at
iteration step 4, and so on.
You keep iterating until the fields
converge to what we hope is the solution to the problem.
How do you test convergence?
Well, you have to have some error parameter.
I'm going to define the error parameter for
the Psi equation to be the maximum value over the grid.
The maximum value over all the i's and
j's of the absolute value of Psi of i,
j at the k plus 1 iteration minus Psi of i,
j at k iteration.
This Epsilon of Psi will tell
us the maximum that Psi changes with each iteration.
Similarly, we've have an error parameter in
the vorticity defined in almost the same way,
the maximum over all the grid points,
the vorticity at the k plus
1 iteration minus the vorticity at the k iteration.
This will give us the convergence error
in the Omega equation.
The idea then is that we iterate these,
we measure epsilon Psi and epsilon Omega,
and when these are smaller than some tolerance,
we can stop the iteration and
say the solutions converged.
Typically I set the tolerance
to something like 10 to the minus 8.
When the largest change on
the grid is less than 10 to the minus 8th,
the iteration will stop and we'll have our solution.
Let me summarize.
We've taken now
two partial differential equations and converted them
into their discrete form by
representing the derivatives using
a central difference approximation.
Then we've put them into
an iteration equation that's called the SOR method,
the successive over-relaxation method.
To implement that iteration scheme efficiently,
you have to choose these relaxation parameters
rPsi and rOmega.
Then to test convergence,
you want to compute these error parameters,
Epsilon Psi and Epsilon Omega.
When these variables are small enough,
we say the solution has converged,
and then we can plot the result.
I'm Jeff Chasnov.
Thanks for watching,
and I'll see you in the next video.