in order to start calculating the
how the solution will programs with time we need to
use will calculate the U
in which
we have a loop that is going to be updated every
time step and
of course we'll calculate at every space
step so we start for
in in range
in range of starting from 1 not from 0 because in is
already computed the time step
and un
like n zero is already
we define it here
so it's an initial condition
which we don't want to calculate
and un equals u dot copy
and for I
enrange
of from 1 to
inx minus 1
minus 1 y
because we don't want to calculate the final
point and when we discritize we will put an X
well the I plus 1
so
once we reach the final I we don't want to get out of
bond
UI
we need now to discritize
so
let's first consider the
the first thing which is the UI
minus well basically this one
well I think you can just put it this way
like a little bit
so basically I just want to show
the equation
and discritize this thing
yep I think this is gonna work
work this way
we want to see the equation but we don't
yeah
we need to discritize
so u over U t is what will be is u t
multiplied while u n
the old value UN
of
I
of course
this delta t it will be
will put a TT
now this has to be multiplied by by what
by
the value of the discartisation of
well the basically this guy in in here
do over DX so we need to
these values UN and DT has to be
also
computed so we will start with the over the X
that everything going to be multiplied
or this one
will un
going first multiplied by UT
like
this
UT it will be u minus u n
which is the old then u minus the old
or the current
and this will be minus
so it will go here it will become positive
and the DT is going to be multiplied by
this part
of equation and this part of equation because this one
it this guy will move to here so it will be the
second derivative of the X minus this
turn so we have to be careful
and this is going to be un
as we can see it
here
so
now what we will need to do is DT
we have to multiply it by start discritizing this one
the first one is well we need U itself so un
and then we go to I
and we need to divide it by
d X because we said this is our
well TX is the our
computation here what we need to divide
and after that we will multiply again
with
U in
the difference so the final difference U and I
no I will just make it bigger
minus U N
I minus 1
so this is going to be our
well first U I
and then
minus DT
or
yeah minus well UI it bit better to write it this way
UI and the whole DT
over DX
and then is going to be multiplied by
the
discotization
after that we need
we will compute it here
the second
direction which is the diffusion turn
and the first thing is we will have is
the new which is diffusion
coordinate or the diffusion
this going to be multiplied by DT and divided by
d X square
and all of them
let's put them into
one bucket
this is going to be also multiplied by
the discartisation
the discartisation as we
said here is
well if a x delta x like I plus 1 and minus 2 x I and
minus I again
and everything as we said we divide by delta x square
here is going to be
well we open it make it a little bit tidy u n
I plus 1
- 2
multiplied you in
I
plus
multiply yeah
over you and
I minus 1
so this way
and this is going to be the diffusion turn
and again we can see
that
well basically just I want to check everything is okay
this is the old term
this is going to be minus U and multiplied DT over DX
multiplied same correct Sims correct
so here is the discretized
form of the Berglers equation
and the last thing is u f
of u n the time domain has to be saved for every I
and will equals u
I the new one
so
basically that's it
this is how we compute it it's a little bit
might be confusing but it's basically just
rewriting the equation in which we have to do
it will become
delta U minus
the the current the future minus the current is forward
forward difference in
time of course
and
Delta t plus
this guy will go here and then this will be
multiplied by all of these two and then this one
we have d u over delta
well u1 minus or u I minus u I minus 1 or u I plus 1
minus u I this will go here
and this is how we compute
or this is actually UI plus 1
minus UI this will go like this and this is
just forward spacing in time
and this is delta t has to be everywhere
like in the conviction and the diffusion term
and then we just
save the thing
with that we put shift enter and it computed
hopefully our competition is correct
and in the next step what we will do is we are going to
see our computation and assess our competition
results ★★★ Download from www.koudaizy.com ★★★