Stream function equation is a matrix equation,
but the vorticity equation is
a system of first-order differential equations.
We're going to use the power of MATLAB and
their ODE solvers to solve this equation.
In order to use the ODE solver,
we need to compute
the right-hand sides of the differential equations.
The right-hand side depends on the stream function.
We're going to need to solve for
the stream function at every time step.
We know how to do that using a matrix computation.
We're also going to need the boundary conditions
on the vorticity because
these right-hand sides then have
an i plus 1 index and a j
plus 1 index and I minus 1 index and a j minus 1 index.
How many ODEs do we have here?
This equation is only valid for
the interior points of the domain.
We have n minus 2 times m minus 2 ODEs to solve.
But we need to use the boundary conditions.
Let's review the boundary conditions.
Assuming that we've already solved the psi equation,
so we have psi on
the entire domain, including the boundaries.
But we're only going to be
computing Omega for the interior points.
We need Omega on the boundaries.
We have the boundary condition for Omega on the cylinder.
That's the first point in i and j.
We've computed what this is.
This is given in terms of the stream function,
psi at the third point away from the cylinder
minus 8 times psi at this second point.
This is the two points away from the cylinder,
but it's the third grid point and
psi at one point away from the cylinder,
but it's the second grid point divided by 2h squared.
That's the cylinder boundary condition.
We have the freestream boundary condition,
Omega n comma j equals 0.
Then we have the boundary condition in the polar angle.
We have Omega i comma 1.
The first grid point is then equal to
Omega i and the m minus one grid point.
That's the periodic boundary condition.
Finally, we have Omega i and
the m script point is equal to
Omega i and the second grid point.
These two are the periodic boundary conditions in Theta.
We put in these boundary conditions for
Omega so that we can compute the right-hand side for
all of the interior points when
ij represents an interior point.
What ODE solver should we use?
I tested the ODE45,
and I tested the ODE23.
This one turned out to be faster, more efficient.
I would recommend everybody use
ODE23.m as the ODE solver.
Let me review.
Most of the computational time will be spent
calling ODE23 in order
to integrate the vorticity equation.
To integrate the vorticity equation,
you have to compute the stream function.
You have to solve
the matrix equation for the stream function.
Then you need to compute this right-hand side for
all the interior points on the grid.
ODE23.m will do the hard work
of doing the integration in time.
I'm Jeff Chasnov,
thanks for watching, and I'll see you in the next video.