Lecture 25 : Numerical Schemes: MPDE II

IIT Kanpur July 201
20 followers
Sep 6, 2024
[Music]
hello everyone uh welcome back so we
looked at some of the implicit schemes
in the last class and we saw that uh the
implicit scheme allows for a high Del T
we'll look into the theory of why
implicity schemes allows the high Del t
uh but uh before that we I'd like to
introduce some more numerical schemes to
you and then we'll go into the
theoretical part of uh uh something
called LAX equivalence theorem where we
say that uh uh there are some properties
of the scheme uh or the solution uh
which are basically the consistency
stability and so on and so forth which
basically tells you uh and what
conditions you will have the uh stable
and accurate solution
okay so before uh going into that let's
look at some of the more popular schemes
uh that we introduced uh at the end of
the last class so one is the Lea
frogging scheme okay so Lea frogging
scheme is also called the uh basically
Central in time and Central in space
okay so if you take the convection
scheme for
example C by delx equal to Z okay this
is your conviction problem so use a Lea
frogging scheme
okay this is basically Central in time
and Central in space so if you Central
in time this is u i n + 1 minus UI n -1
by 2 delta T
right plus C
UI + 1 N - u i -1 n by Delta x equal to
0 right so if you reorganize it okay you
can get u n +
1 will be equal to u y n -
1 uh minus C Delta X that 2 this will be
2 2 two will cancel out so minus Lambda
UI + 1 n
minus UI - 1 n
right now if you look at this scheme
closely you can uh basically derive any
scheme that you want as we have
discussed you have the general scheme
you can take as many Sten as you want
and derive your scheme but that scheme
should have some meaning okay and it
should serve some purpose so here the
leap frogging scheme uh is if you look
at the structure of this scheme okay so
this is my nth point so this is let's
say this is my uh X and this is my
T right so if you're starting you know
the value at n right so let's say this
is my point
I and this is I + 1 and this is IUS one
okay but this is uh scheme requires you
value at n minus one right so of course
you don't know the if you are starting a
simulation you don't know the value of n
minus one right so this is not a selfish
in
scheme what does it mean that means that
you have to start uh solving this
problem using some other scheme maybe
the forward in Central in space or
forward in time and backward in space
whatever and so that you can get the
values of uh some time steps and after
that you can start using this Li frog
scheme because then you have the value
at n minus one also so let's say you
started at t equal to uh 1 2 3 and up to
10 you have solved the using the
approach which is
Ft uh let's say ftvs okay and then from
time Step 11 you can switch to the ctcs
or lip frogging scheme because you know
the value of uh 10 as well as 9 okay to
get the value of 11 right so you know
the value you need the value at uh so if
you want to calculate the value at 11 so
let's say this is the value at 11 so you
need the value at 9 right so n+1 if you
want to calculate you need to get get
the value of n minus1 right so this is
not a selfish starting scheme but you
can use another scheme to start your
simulation and then you can switch to
this scheme and you have to do a big
bookkeeping so that you have the value
that nus one available when you're
trying to use this scheme right so if
you want to calculate the value at n + 1
so this is your n and this is your n +
one
okay and this will be your value so this
is my I at n + 1 I + 1 and I
-1 okay and this is the value at n minus
one right this I I + 1 and I - one right
so what is the value that you want to
get you want to get this value I'll use
the red color here u n + 1 and what is
the values that you need you are need UI
n minus one and you are basically you
have the
unit value at at any time step IUS one
and I + 1 right so if you connect this
okay to get these values you need this
and this and this okay so it's basically
it looks like a frog and basically jumps
the step right you can see that uh it is
you want to get the value at n+ one it
is jumping from n minus one right so
that's why it's called the lip frogging
scheme it lips
okay so this is called Lea frogging
scheme and there are some stability
properties of this scheme which is uh uh
superior to the explicit scheme and
that's why these schemes are used in the
simulation we'll look at the stability
of criter of these schemes also perhaps
solve some
problem okay the another scheme that you
have is basically The Lex Frederick
scheme okay so this Lex fed scheme this
is uh forward in time and Center in
space okay but we take the average of I
+1 and IUS one so why we need that see
you know that ftcs is not stable right
forward in time in certain space is not
a stable that we have seen for a linear
convection problem right not for the
diffusion problem so we they are using
this for the linear convection problem
okay so uh let's look at that scheme
let's fedick scheme okay we'll call it
LF okay so your problem is d by DT plus
c d by DX = to Z okay and uh you can
write it as d by DT equal to minus c d
by X okay and what Le does the usual
approach let's see if you use
ftcs right so this will be u i n + 1 - u
i n by delta T will be equal to minus c
u i + 1 n
minus u i - 1
n by 2 Delta X right this is your ftcs
scheme or you can write it as UI n + 1
will be equal to UI
n and minus C delta T by 2x 2 Delta
X okay UI + 1 n minus UI - 1
n okay so this is your ftcs scheme but
if you use this scheme as we know we
have seen that uh for example the
problem that you have solved okay we had
a lot of Wiggles here and this portion
right and eventually if you keep on
running this problem this will
eventually blow up right so ftcs scheme
is not suitable for the conviction
problem so what the LAX and Frederick
proposed they were to famous
scientist they said that instead of
using u n we use so now it is called The
Lex fedick scheme so UI n + one so you
use the average of
uy n and u n +
1 right let me just
see no so average of central not the
time okay so the time is St Remains the
Same
okay so this is basically u i + 1 n plus
u i -1 n minus C delta T by 2 Delta x u
i + 1 N - UI - one
n okay so that means so you are taking
this value as u i n this is your I and
you're taking the value of UI n so we
replace it back with this is I + 1 this
is i - one so you replace the u n
value as half of UI + 1 and and plus UI
-1
n okay and then you got a new scheme and
this scheme is
basically stable okay conditionally
stable but it's stable it is not
unconditionally uh unstable like the
ftcs scheme okay so we'll look at uh the
property of these schemes also so I'm
just introducing a class of schemes
which are very popular okay and we'll
look at the stability uh properties of
these schemes in future classes okay the
last one that I want to introduce of
course there are many more schemes than
what is uh uh written here okay uh I'm
just introducing a few to you okay which
are very very popular so the third one
is The Lax VR scheme okay and uh this
again LAX and VR have proposed this
scheme so this is also ftcs for when
time Center in space but we use a second
order numerical diffusion so these terms
are basically additionally added
okay so uh let's look at the ftcs scheme
okay so I can work it here only so this
is my ftcs
scheme right so return that but add a
second order term so that will become
your LAX vandr scheme okay there are two
kinds of LAX vandr scheme one is the two
step Lex vandr okay we will uh look at
that scheme also later so this is the
one step Le scheme this is UI n + one
will be
u y n minus C delta T by Delta
x u y + 1 N - UI - 1 n and then you add
some basically numerical diffusion
because this is not stable by itself
okay
so Delta t² by Delta x² okay and uh if
you are adding a diffusion the diffusion
terms are normally the second order
accurate terms that is basically u xx
okay or Delta U by DX squ okay this is
nature we have seen in the diffusion
problem also when you have dlu by DT
equal to New D to U by D x² right so new
is basically you can equivalent it as c²
Delta d by delx square and that you have
to use the central defening scheme for
that that will become u i + 1 N - 2 u i
n + U u i -1 n by Delta
x² okay so this is your LAX V
scheme okay so this is
the uh ftcs forward in time and center
and space but then you have added some
defent ter here okay so that Delta x² I
it twice okay so this is how it will
look like okay you can have sign you can
use other sign
also okay so c² delta T okay there will
be you can use the two term okay or you
can replace this entire thing with a
another diffusion term of your choice
okay uh so the purpose of this term is
to basically make the scheme uh stable
okay the central defensing scheme is not
stable because it does not have any
diffusion okay for any scheme to be
stable it should have some diffusion but
if you have it has got too much of
diffusion or too much of dissipation it
will basically smear out any nonlinear
phenomena
okay which is also uh not something that
you want so you want the scheme to be
stable but at the same time it should be
accurate enough to predict the flows
accurately okay so uh we will discuss
these schemes stability characteristic
in the letter classes okay for now what
I want to do I want to go to something
called understanding these schemes and
want to see that when we discretize the
scheme what is the actual PD that you're
solving okay we are trying to solve this
PD okay but then uh when we discretize
it we are actually not solving this PD
but a modified PD okay so we'll look at
uh those approaches I mean uh those
equations and that will give us some
understanding that why uh some schemes
are stable and some schemes are not
stable we have been talking about the
diffusion term right what do you mean by
diffusion term okay how does it add
stability when we use the backward
differencing backward differencing or
forward differencing basically the
upwinding scheme but when we use the
center differencing that disappears and
we get an unstable solution why that
that happen right so let's look at that
uh MPD scheme uh basically modified PD
equations so we'll start with the the
convection problem again uh d by DT plus
c d by d x equal to0 okay because this
is the most complicated problem the
diffusion problem is stable because
there's uh anyway it is just diffusing
and as long as your viscosity or the
numerical diffusion term is positive uh
it will be stable but uh the more
critical problem is your uh the linear
conviction okay in the diffusion also
you have to honor this uh the diffusion
Quran number but that is normally not
that restrictive in a flow
problem okay so uh if you write this in
ftcs
okay so if you try to do this in ftcs
work this out out okay so we have a
scheme d by DT + C D by DX = to
Zer
okay and we are doing it using the
forwarding time Center and space so this
is basically UI n + 1 - UI n by Delta t
+ C UI + 1 N - u i - 1 n by 2 Delta x
equal to 0
okay so there's something called
consistency of the scheme okay so the
any scheme that you we are using should
be
consistent
okay uh what do you mean by consistent
that means that if you reduce the delta
T and Delta X to Zero basically if they
tend to zero your uh the discretize
equation okay should lead to your
PD that you're trying to
solve
okay so uh that means uh in other words
so when we we have discretized in this
form we have basically let go of some of
the tration error terms right remember
there will be tration ER term in this
also which will be order of delta T and
there'll be tration ER this term the
leading TR eror will be order of Delta
x² right
so we have basically let go of those
terms right so we have to make sure that
if we uh in those terms if we put Delta
t ending to zero and Delta X tending to
zero it should become zero the
truncation error should go to zero so
tration error should go to zero as delta
T and Delta X goes to zero okay that is
what uh mean by the consistency of the
scheme okay so let's uh look at this
problem okay and look at what is the
tration error of this scheme okay so
earlier we have taken the seen the
tration error for let's say d by DT
separately and for d by DX separately
okay but now we looking at the tration
error of the scheme itself the entire
thing when we consider together what is
the tration error that we are getting
okay so how do you do that same our good
old friend Tor series will use that and
we'll find out what is the tration error
of the scheme so this is UI n + 1 will
become UI
n okay and plus delta T so now you see
when you are writing this uh Tor series
we used U Prime and so on so forth but
now we have derivative with respect to
time also and with respect to uh space
also you will have d by DT term and
you'll have d by DX ter and all their
higher orders and and so on and so forth
right so what I'll do I'll use a
notation so I'll say U that represent d
by DT and when I say ux it represent d
by DX and similarly if I said u xx then
it delt U by DX Square u tt will become
delt U by DT sare okay so I use this
representation for my T expansion okay
so this will become Del t u i
okay and uh this will be at n Del t²
factorial 2
okay U TTI I okay I is at I place at n
plus delt Cube by factorial 3 u t t t i
n and so on and so forth right so what
we did we expanded uh our n + one around
n okay and we know our delta T is
basically the jump from n to n+1 that's
our timeing St similarly these things we
already know U + 1 n will be basically u
n so everything I want to expand around
u
n okay plus Delta X this will be u x i n
plus Delta x² factorial 2 u xx i n plus
Delta x q by factorial 3 u x x x i n and
so on and so forth and you have u i -1 n
will be UI
n minus Delta X ux
i n plus Delta x² factorial 2 uxxx i
n and minus Delta x q by factorial 3 u x
x x i n and so on and so forth right so
now use this and put it back in this
one right so when you do that so what
I'll do I will basically rearrange this
term so I'll take this minus this and
divide by delta T okay and that will
give us the term so if I use that term
so I'm trying to approximate this
portion first so that will look like uh
u t i
n plus delta T by 2 okay u t t i n delta
T Square will get cancel with delta T
here because I'm dividing by delta T
also okay and uh plus Delta t²
by factorial 3 or 6 u t t t i n okay and
plus some other term okay just let's
return up to this third term only okay
and then we'll have
plus C and I'm now expanding this okay
what I'm doing so I have let's if I call
this a b and c okay so I'm doing b - c
by 2 Delta X okay I'm using the value
that gives us the this values okay so
that will become
C
uxi okay and this thing will anyway get
canceled out okay uh plus Delta X Cub by
3 u xx I and and then will be the next
term will also get canceled out and you
will have something like Delta X5 to
Delta x 5 by factorial 5 right u x x x x
x i n and so on and so
forth
right so uh this is our value okay now
if you uh rearrange
it this will become so I'm collecting
this term and this term okay so this is
U + CX I
okay U plus c x is What U is plus CX is
basically d by
DT plus c d by
DX
okay is equal
to this entire thing is zero okay so
that will become minus delta T by 2 U
TTI i
n and
uh
minus Delta xqb by 3 u xx i n and then
plus or minus doesn't matter okay order
of Delta
t² and Delta x to the
power 4 okay so there is an error here
because we are dividing by Delta X so
this will become Delta x² and this will
become Delta x
4
okay this is the Delta x square and
Delta x
4 okay so this is what our ter looks
like okay by just putting this value and
putting our T expansion right so if you
look at this is the equation that you
want to solve and the right hand things
that you see is basically our track
error
right so um for this particular scheme
so when you take Delta T tends to Z and
Delta x ts to Z you would see that the
entire term on the right hand side goes
to zero that means that equation is
consistent okay so our forward in time
and s in space is a consistent scheme it
may not be stable but it is a consistent
scheme because as we reduce our time
step to zero and our spatial uh size to
zero we recover our scheme which is Del
UT plus c xal i equal to
zero okay now when we are saying uh that
we are using this scheme to approximate
our uh linear convection equation right
so basically we are solving this
problem right so let me just write it in
the next one so we are solving d by DT +
C D by DX I is equal
to minus delta T by
2 okay U DT i
n okay and uh minus uh let's leave other
terms okay
so that will become ordered or
just just let us let me just see a
second
okay so that will become Delta x²
okay we have written Delta x² by 3 so
just return that term so order Delta
t² Delta
x² right so now what we have done we
have put all these THS together and we
have just ring the first term
here so uh when we are trying to solve
uh using our ftcs scheme we're basically
solving this
problem okay and you can see that we
wanted to solve d by dt+ c d x equal to
Z okay but the right hand side actually
not zero it has got certain
terms right now what we'll do we will
write everything in terms of the space
okay so this is utti so
UT is we want to put in in terms of
space so you have U + c x =
to0 that means U equal to minus CU X
okay so I'll take another derivative of
with respect to time u tt = to minus c u
x
t right and you can replace it minus
C uh Del
by D X U this is what it
means that minus c d by D X and UT will
become minus c d by DX right same thing
so that become C c²
uxx right so u u tt is equal to c² uxx
okay so this equation can be written as
d u by
dt+ c d by DX
I is equal to minus c² delta T by 2 u xx
i n plus order Delta
t² Delta x²
okay so we wanted to solve a problem
which was basically d by DT plus C D to
Z but because of our choice of our disc
scheme which is forward in time here and
centrer in space here we got a scheme uh
we got a uh we are solving an equation
which is looking like
this okay so this equation is called the
modified or exact sometimes exact also
modified partial differential equation
modified PD or
MPD what is it exactly this is basically
when we are using a certain Des scheme
it actually modifies the PD okay and
instead of solving this problem we are
solving this problem right now if you
look at this equation closely okay
ignore this uh the higher order terms
but look at the just the the first term
okay so this you will see it looks like
d by DT plus c d by DX
is equal to new Del to U by D x²
right so u xx is this term this is U XT
so this is not we are not solving a
convection linear convection problem but
we are solving a convection diffusion
problem we cause our choice of the
diffusion scheme not only that you will
see this term the new here if you
compare to this one new is equal to
minus c² delta T by 2
c² is a positive number delta T is a
positive number and there's two so this
entire thing new is a new is
negative so that means you have negative
diffusion right your scheme has got a
negative diffusion and earlier we have
seen when we're trying to solve the
problem of the diffusion we saw that
when the new is negative the numerical
differ term is negative it basically
blows up very very fast
and that is precisely the reason why you
are not able to use the ftcs scheme in
solving uh your problem your linear
connection problem because the schemes
gives you a negative
diffusion okay and that leads to the
blow up of the
scheme in the next class what we'll do
we'll look at the ftps forward in time
and backward in space and we'll get this
same modified PD okay for that uh
particular problem okay and we'll see uh
at what condition uh they become stable
so we know that fbh is stable okay from
our experience for a linear contion
problem if the C delta T by DX is less
than 1 right by just solving the problem
we know that right but can we also
notice in our modified PD okay so we'll
look at that ttbs scheme in the next
class okay for now you should uh go back
with the message is that when we are
trying to use a disc scheme on a given
differential equation okay we basically
when what we solving is a modified
differential equation and we have to
look at those terms closely to know
about how the schemes would actually
behave okay with that we'll stop here
thank you very much
[Music]
[Music]
[Music]
