So.
Now what we will do is to we are going to solve burgers equations by basically updating the solution
every time step.
So to do so, let's start by well, write the code basically.
And it's for N in range.
In range two.
In this is we're talking about the time.
So the first thing is we need to loop through the time.
This is again, it's explicit means every every time step we need to update the solution every time
step and we march like this until the end of will.
The numerical time the end of time is not good way to say it, but at the end of numerical time, UN
equals u dot copy.
A copy and v.
N.
V.
N equals equals v dot copy.
This way.
So the first thing is what we did is we need to keep the last time step.
Now, of course, the last time step we have is only U, which is the current and v, n and u n for
and v n.
This is what the basically the initial condition in the first run.
And as we go we keep adding the last time step here.
So after that what we need to do for I in range.
Between one and n x minus one.
And what we are basically doing here is we need to go through the whole mesh.
And in order to go to in the the whole mesh, we need to go from I and scan all the X.
So basically at X and we go from all the points in the in the Y.
So this is in Y minus one.
And we start from.
Well, start from not zero from one.
And why we need to start from one.
Because if we start from zero, then we don't have initial condition.
We see start from one because we already know zero.
Zero is our initial condition.
And this is why here we put zero.
The what is the solution?
This one we put zero because we need to start from the from one because we don't know the the solution
at one.
Is sorry.
This is I'm talking about here is basically one, two and three.
But here is like basically, it's.
Sorry, I just this is not correct.
It's just we don't start.
Also, we should not start from from zero.
It's different reason.
But this is the for the time.
But for this one, we should not start from zero because we we we have a boundary condition.
The zero is boundary condition.
So we don't start from zero because simply we cannot have any boundary condition at that point.
And sometimes we need to start even from two or more because we are using a the central difference scheme.
We have only one point, but if we use a scheme that requires more points around the the point we need
to calculate, we have to be careful.
So here the reason we start from one is simply because the boundary condition is exist at zero.
And, and if we start from zero, the boundary condition, there is no boundary behind it.
It's just there is nothing like the whole mesh is outside the mesh.
But but for the time, of course, we have to start from one because zero is a initial condition.
So here is the update.
And here I will basically copy paste the discretized form of the equations and why I'm copying pasting
because it's there are a lot.
It's a central difference scheme and there are a lot of basically.
The.
There are a lot of variables that I'm sure if I type them, I will have mistakes and this class will
be very long.
So it is just these are only, um, basically.
Discretized form of the two equations.
It's a central difference scheme applied for for both diffusion and convection term that is will show
on this.
So this term, this one basically DVD, DVD, Dee Dee Dee Dee, why all of this?
This is we call it convection, convection, convection term.
And this is we call diffusion term.
So they both use central difference and this is the time update So time.
Yeah.
Temporal difference or the temporal factor.
So this is the the the all of this is just the discretized form of the equation.
We already discretized an equation in the previous class.
So if you want to know how to discretize the equations, please.
Go back and see how we did.
Smaller equation.
So now what we do is if we need to update our.
A like we need to save our solution.
So in and I and J.
Equals.
This one, the current one, and we do the same and we take it.
Here is the and this is here is the same thing.
And see.
Yeah, it's just.
Yeah, it's just something.
Is it finished?
Not no, it's not finished because we didn't.
I said before, it's the boundary condition.
We have to update the boundary condition.
We should not allow any of this.
What, like to, to update the boundary condition.
So to do that, every time step, we have to keep the boundary condition the same or if you like, maybe
later, if you want to change the code to have a changing boundary, you can also do it from here,
from this place.
So here you at zero.
At the beginning and you at minus one means at the last point is going to be one.
I write it this way.
And.
The same thing for in the Y direction.
So this is the in the all this is you put zero and all the X line.
So u is zero and you go for all the X lines and you put them one one, one one and this is here the
same thing, but you just opens like reverse the thing.
And.
Take the same thing here.
And this one minus one.
And basically this is everything.
This is, of course, the you we need to repeat.
The thing's the same.
It's just same thing with v v v.
And.
It seems.
Seems looks good.
Zero.
Minus one.
Zero.
Minus one zero.
Minus one.
Okay.
So basically, this is.
This is it.
And we just.
Need to compute this and hopefully it will converge again because this is a little bit basic course
for all delivers converge mean is we get a final answer diverge means the numerical like the computation
will will never reach to a either it will give us error or the values become very high like.
Very high, like ten to the power, 110 to the power more.
It's a numerical number.
So it will it can go very far, very high.
And sometimes it's just never finish or just keep on going.
But nothing has happening for some reason, of course.
So so this is now is calculated and the next class, what we are going to do is we are going to check
our solution.
And of course, if there are a problem, we have to know how to solve it.