Lecture 33 : Multistep Schemes, MATLAB Linear I

IIT Kanpur July 201
20 followers
Sep 6, 2024
[Music]
hello everyone welcome
back in the last class we looked at some
Advanced
schemes uh we looked at the schemes uh
which are basically LAX fedick lip frog
uh LAX pendro B in and so on and so
forth and we saw that uh basically there
are kind of variations of uh ftcs scheme
forward in time and cter in space and
then uh basically because of those
variations these schemes become stable
the other interesting thing that we saw
about these schemes is that U you can
basically um control the diffusion and
the dispersion error by uh basically
smartly manipulating the uh the first uh
error term right so the leading error
term and we found that for example Le
fed vend of uh is a scheme which does
not have dissipation error in the
leading term it's a dispersive error so
it is supposed to give you a better uh
accuracy compared to let's say FTB
scheme and also it is stable unlike the
ftcs scheme which is unstable right but
it has dispersive eror that means you
should not have
any any mistake in the initial condition
or even if the some pations come from
the initial condition it might grow it
will not Decay because it has got the
dispersive
error and Lex Fredick at the same hand
same time we saw that highly dissipative
it is also stable but it is first order
and then we had the leaf frog scheme
which was the three LEL time stepping
scheme and uh we found that this is also
stable uh for Lambda less than equal to
one and uh uh it was like the uh the
order of ACC was Delta x square okay so
today we are going to see some more
schemes so why we need more schemes that
most of the schemes that you saw
actually they have been derived if you
look at closely so we have like d by DT
plus c d by DX equal to Z this is the
linear convection scheme uh so you would
knowe that many of the schemes have been
derived by considering U equal to minus
u x and then utt I mean by manipulating
this become cuu
CX right if you go from the non linear
problem to nonlinear problem d by DT
plus now it is u d by d x equal to 0
okay so this is
linear and this is
nonlinear okay we have talked about uh
this uh great deal uh there are many
ways to look at it uh the nonlinear in
this only that you can write it d s by 2
Delta x = 0 okay that's a nonlinear
problem okay secondly you can look at
the corrector the the coefficient of the
gradient term and that depends
uh uh so the speed that which it is
convecting also uh depends on the
solution of the
problem uh third way to look at it is
that if you let's say U1 and U2 are two
solutions for this okay U1 U2 will also
be a solution okay here okay here the
same is not true okay if U1 and U2 are
separately solution for this U1 plus U2
will not be the solution right now if
you want to derive uh schemes like let's
say Le frog or the Le F of schemes the
first road block that you'll hit is that
now this U equal to minus uuux okay and
if you take the second derivative utt
you'll have to take the derivative of
both basically U and X okay it will have
four I mean two three terms right so you
cannot get this relation like you have
this = to c uxx so that means the
relations that you have derived are not
so straightforward okay for example uh
in the beam warming scheme or even the
in The Lex font of scheme if you recall
we what we have used that uh we had this
uxx ter Theta by 2 uxx ter this is the
value dissipation that we had added uh
on the right hand side and we found that
uh to in order scheme become stable the
L Theta should be equal to Lambda Square
okay so this was
ftcs and plus this part right and for
uxx we had basically used the uh our uh
UI + 1 - 2 UI + UI - 1 by Delta x² right
and this is was our X1 scheme uh it
cannot be easily derived for the
nonlinear problem because your UT is not
equal to C c² uxx okay that is not true
for the nonlinear
problem okay so but we can basically
what we can do we can uh break this
problem into two steps okay uh this is
came into two steps and that is what we
are going to do so this is will be
called the multi-step method okay so uh
what advantage you will have so it will
have two steps okay step one
and step
two okay so first we can use some scheme
okay let's say scheme
one okay and you can basically
use intermediate value you are getting
so you can use maybe the time of delta T
by 2 here and then Delta 2 by two maybe
the perhaps in the second step and you
can combine it to get your method right
so this kind of approaches are called
multi-step
methods okay I'm going doing it showing
it for two but you can also have three
steps okay now you can uh basically
combine different different schemes and
get maybe one of the schemes for a
linear problem right for the nonlinear
problem it will be very different but
for the linear problem you can let's say
go back to let's say la one of a scheme
and I'll give you some examples
today okay so the another advantage of
this multi-step method is that when the
problem is nonlinear let's say uh look
at this example okay okay so uh your
variable uh the speed at which the
variable is traveling also depends on
the variable itself right so that means
it will uh eventually develop a shock
okay so it is traveling and as it
increases so it will become closer and
closer and closer and it will ultimately
become a sock right and in these kind of
socks many of the methods that we have
discussed earlier uh the simple method
will not work right so we can can have
we can combine two steps for example uh
in one step we can go forward and we can
other step we can go backward so if you
use that kind of methods then that
approach may work for this uh problems
which are highly nonlinear okay so that
is another beauty of the multi-step
method that they work good for nonlinear
problems okay uh in fact all the schemes
that we have discussed so far if you try
using those schemes for solving uh
problems like the burgers equation or is
equation or even a nonlinear convection
equation okay you would see that those
methods will fail okay uh the scheme
will I mean blow up very quickly right
so uh in order to solve those problems
you have to go to the multi-step method
this is a very important discussion
because most of the system that we going
to solve will be nonlinear including the
no equations right so let's look at some
of the multistep methods okay so
multistep will have two step okay the
first step we'll call as the predictor
step
okay so that is the you'll get some
value which is not correct okay we are
just predicting some value and then in
the Second Step what you'll do we'll
call it the corrector
step okay so first we predict and then
using that predicted value we'll correct
it okay and uh for the nonlinear problem
uh uh the uh equations uh these
different disc schemes in the predict
corrector will provide stability but for
the linear problem they may be
equivalent to let's say LAX one scheme
okay for whatever cases that we're
discussing today okay so I'll be
discussing twostep LAX bandr why it is
called Two Step LAX bandr because
eventually if you combine the two steps
for a linear problem it will lead to a
LX of scheme okay so now we are
splitting the LX scheme into two steps
then there'll be RM scheme okay uh this
also leads to LAX with the slight change
okay the Mac scheme this also if you
combine it will lead to Lex F and the
final is two step beam warming that also
leads to the two step Le one scheme so
I'll discuss these three schemes today
and this I will leave it to you to
basically go back and read about it okay
there it is also very similar to what
schemes that we have okay so the first
step is the Lex fun of scheme okay so
let's discuss the LAX
scheme so the
schemes I will discuss for the linear
problem
but we can basically change you to the
nonlinear problem also the scheme
Remains the Same okay so if this is
linear
problem okay the nonlinear problem can
become d by DT and typically it is
written as d f by D X okay this is x
equal to zero where if it is uh let's
say nonlinear convection then f is equal
to U ² by 2 right then if you put it
there then it will become D DT plus u
DX okay so whatever scheme that you're
deriving let's say I'm deriving an ftcs
scheme or writing an ftcs scheme for
this or FBS rather because that ftcs is
not stable this is UI n + 1 minus UI
n by Delta t+ C
UI uh N - UI -1 n by Delta X = zero the
same thing if you write for the
nonlinear problem you would write I'll
follow this one and why I'm following
this one recall we had some discussions
about the conservative form and the
non-conservative form earlier okay this
is the non-conservative form and this is
the conservative form
right and we found that there are some
properties uh if you use the
conservative form what are the
properties one is that uh if you use the
non- conative form in the discretize
form here you can use the ftcs or FBS or
whatever scheme that you want it is FBS
this is UI minus UI - one so in that
case what will be the value of U is it
UI or UI minus
one right so that confusion is there
secondly we have talked about we had
talked about this uh uh telescopic
collapse when you have when you're using
this form uh the conservative form
instead of the uh non-conservative form
right so so basically uh if you add it
from end to end uh the discr scheme in a
conservative form uh so all intermed
fluxes will vanish on only the the bond
conditions or the the end fluxes will
remain basically the things going in is
what is coming out right if you use the
non-conservative form you cannot
basically guarantee that okay so if you
use a conservative form so let's remove
this non-conservative from now
okay if you use a conserva form this
equation can be written as UI n +
1 minus u i n by delta T plus let's say
it is Ft BS this is f i n minus F i1
minus n by Delta X okay so you can see
this is for the linear equation this is
for the nonlinear equation where I used
the conservative
form okay so all the discussions all the
schemes that I'll be writing is for the
conservative for the linear but you can
write equivalent nonlinear form
okay so um we were talking about the
twostep Lex
B
okay so what we do in this is that so
we'll have two steps right so this is
let's say my i
n and
then we'll have something in between
okay I'll call it n+
half okay and then we are supposed to go
to n+1 so I created an artificial step
in between okay and then this is my grid
point this is
I this is I +
1 and this
is IUS
one right in the two step leand we'll
also create uh two intermediate grid
points
okay which will be I +
half
and be I minus
half
okay so if you use this scheme now first
step in this is basically that's the LAX
scheme or basically LAX Frederick
scheme okay that is step one
okay so you know that what is La ftic
scheme so for this problem if you write
the LA ftic scheme that will be u i n +
1 minus UI n will be half of UI + 1
n and U Yus n right n by delta T is
equal to minus C and this is Central on
the right side u i + 1 N - U -1
n by Delta X okay so now use the LA F
scheme but do it on I by 2 okay I + half
okay and also n + half right so we are
using delta T by 2 because we're going
for the first step and we also using
Delta X by2 okay so if you use this two
so this thing so now if if I'm doing it
let's say I + half okay so when we doing
this I n+ 1 what were the notes that
we're participating so for the full one
we are participating this I + 1 I + 1
and IUS one right to get the n+ one now
if you're doing it for I + half then the
notes participating will be I + 1 and I
right because we are trying to get it
for I +
half so write the same thing for delta T
by2 and Delta X by2 okay so it will
become
uh let me use a different pen so this is
u i + half will be n + half
minus half okay this
is uh now the notes participating will I
+ 1 and I okay so u i + 1
n+ UI - 1
n by delta T now is delta T by 2 right
because you're doing for the only half
the GD size right this minus C
and then this will become UI + 1 n minus
UI n by this will be Delta X by 2 okay
so it was 2 Delta X here so this will
become 2 Delta X by
right so you can get the value u i +
half n+ half would be equal to half UI +
1
this will be I
right n + UI
n minus so this two two will cancel out
so you can write it this will
be Lambda by
2 UI +
1 n and minus u i n right so this is my
uh first equation okay let me just see
if I have done it
correctly okay so this is I + 1 and I
Delta X by 2 and this becomes C Delta by
2 okay looks fine okay let's go to the
Second Step okay I'll I'll do it here
only because I'm not uh basically kept
many pages so let me just clear this
out okay so the step two
okay step two will be the lip
frogging at n+
half
okay so let's do the Lea frogging at n
plus
half and so LIF frogging scheme that you
have will
be if you have a full stencil okay in
the normal condition your Le frog scheme
looks like
u i n + 1 - u i n -1 by delta T this
will be 2 delta T will be minus c u i +
1 N - u i -1 n by 2 Delta X right this
Li frogging Center in time and Center in
space okay but now we are doing it n
plus half and we are only doing for
Delta by 2 so now it looks uh so when we
had uh this is a three LEL scheme so we
had n n minus one and this was n + 1
right to get the value at n+ 1 we needed
the value at n as well as n minus one
now if you're doing at n+ half so the
three levels that we have is n n+ half
and n+ 1 right so write the scheme for
that so this will become
UI n + 1 minus UI
nus 1 in this case will be n right- UI n
by 2 into delta T by 2 right that will
become minus
C and then you
have you'll use u i +
half okay n minus UI -
half this is n + 1 by 2 and n + 1 by 2
okay so we are doing this s frogging at
n + 1 by 2 by 2
into Delta X by 2 right so this is our
TST scheme so finally you can write your
uy n +
1 would
become so all these things will cancel
out okay this will become u n minus C
delta T by Delta X which is basically
nothing but Lambda u i +
half n + half - UI - half and plus
half right so this is how you will
obtain
your uh the correct step so this is my
corrector
step okay and this is my predictor
step
okay now for a linear problem you can
combine uh both of these and uh you can
see that uh it leads to basically
nothing but your LAX Wonder scheme I'll
just uh show it
okay
so um let's try to write u n +
1 is u
n
minus C delta T Delta X that I'll write
Lambda okay and that UI + half and plus
half so what will be the value you can
write this value okay
okay so the value will be half UI + 1 n
+ u n - Lambda by
2 okay u i + 1 n minus u i n right this
is the value of UI + half now do it for
UI minus half okay so that will be minus
use the bracket here and for uu i- half
what will the no participating okay in
this case if you change it for u-- half
that be I - 1 and I right so this is u i
n + u i - 1 n minus Lambda by 2 okay u i
n minus u i -1 n right so this is your
second
term okay so you can combine both of
them so u n I'm collecting all the
Lambda terms
okay minus so this is my Lambda term
this is my Lambda term so minus Lambda
by 2
okay and that will
become u i + 1
n and that
is minus U i- One n right this is and
then we have Lambda Square by 2
right and that you can combine this two
so this is UI + 1 n - 2 UI n and plus UI
- 1 n right and you can see that this is
your nothing but LAX V of
scheme
okay so for a linear problem uh the two
step lexr goes back to the Lex scheme
okay but in in this we have two two uh
steps one is the predictor and one is
the corrector the first we use the LAX
fed and second we use the lip
frog right and because it leads to the
Lex up scheme uh it has the same
stability as the Le up scheme that means
it is stable for um is the second order
accurity scheme and this is uh single
step X drop and stability limit is
basically Lambda less than equal to one
as we have discussed earlier
okay now let's go to the Rick Mar scheme
okay
now uh in La B off we saw that we have
to do a lot of bookkeeping okay so we
have to basically uh use I and then you
have to use I +
half okay and then I minus
half okay and so on so forth right so
basically even though your grid is I I
+1 IUS one and so on and so forth you
need to basically create intermediate uh
grid points and store the values there
and they use that in the next step and
so on so forth right what rickm did is
basically remove this dependency on I
plus half and IUS half and he basically
used this both LAX fedick and the lip
frog in the regular stencil only right
so this is the scheme that they have
okay so the first step this is my
n okay let me write this is n+
half this is
n this is n +
one this is my I
I +
1 and this is IUS one okay so first step
same thing okay do the L fedc at n plus
half so this is my n plus half that we
are trying to calculate
okay so um if you use this at n plus
half okay so uh this distance uh will be
at I + 1 and ius1 and then you instead
of delta T you are just marching the
delta T by two right so we are just
going here okay this and this we're
going here earlier we are going from IUS
half to i+ half so this is the scheme
that you'll get and next you do the lip
frogging uh with Delta T2 at n plus half
as we did earlier right so if you do the
same thing so now your this is your
central point this is forward this is
backward so you can use this uh this
will become u i n + 1 - u i n by delta T
by 2 right
and that will become
minus
uh uh UI + 1 and + half minus UI - 1 and
+ half okay and that will be Delta X
right uh this will be two deltax okay I
think there's two missing here okay yeah
so then uh if you combine that this two
okay it will become a Le frog like a
scheme but there'll be slight difference
okay so uh
first we go from this to this and then
you do the Lea frogging uh for the next
delta T by2 okay so first you use the
delta T by2 to only arrive here and then
use these values to get the value at n
plus one okay at this
point okay so this is my uh UI in + one
you you'll get UI + 1 and +1 UI -1 and +
one use this value to get the next step
okay so this is the RIS Mar scheme and
if you combine both of them okay so uh
you will get a scheme which looks like
Lex VR but now it is instead of uh three
points It's Five Points okay this this
is I I + 1 and IUS one this is what our
last one was it was I i- + one IUS one
this is I + 1 i-1 and 2 UI now instead
of that please go back and combine this
you'll get I -2 and I + 2 okay so this
is the kind of uh scheme that you'll get
okay and uh because now you are jumping
four steny so this will become four
Delta instead of 2 Delta X and here
correspondingly it will become uh8 okay
the denet will become eight okay and if
you go and plot the stability for this
and you will see that this is stable for
Lambda less than equal to 2 okay so you
can go up to
the uh value of 2 but remember because
we are uh using this uh uh taking I +1
and I minus one on both the steps okay
so your uh accuracy may go down at the
boundary okay because there you cannot
use one-sided step okay and uh you
combining basically I +2 and IUS 2 okay
so uh this scheme is stable for Lambda
less than equal to 2 this is also a
second scheme Delta x² delta T Square
okay like the two step Le leer okay and
this is a very popular scheme especially
uh if you have socks okay or um any
nonlinear problem any hyper nonlinear
problem this is scheme is very very
popular okay in the next class we'll
look at the uh macmic scheme and I'll
also show you some examples uh uh using
the schemes first I will show you the
examples for the linear problem I'll
take you through this ftcs uh ftps and
all schemes that we discussed in the
last class okay and then I'll show you
for the nonlinear problem so I'll see
you in the next next class thank you
very much
[Music]
[Music]
[Music]
