Foundation of Computational Fluid Dynamics Dr. S. Vengadesan Department of Applied Mechanics Indian Institute of Technology, Madras Lecture - 15
Foundation of Computational Fluid Dynamics Dr. S. Vengadesan Department of Applied Mechanics Indian Institute of Technology, Madras Lecture - 15
Dr. S. Vengadesan
Department of Applied Mechanics
Indian Institute of Technology, Madras
Lecture – 15
Greetings to all of you, today’s class will be the last class for this week on this course
CFD. So far, we have done information about different approximation methods,
properties associated with the numerical scheme, then how to analyze a numerical
scheme for consistency, convergence and stability. In today’s class, we will get
explanation of these with some more example equations. First, let us consider as shows
∂u ∂2 u
in the past 1D unsteady diffusion equation −α 2 =0 . We also learnt in the
∂t ∂x
previous lecture, different scheme available for this model equation; one of thing is
explicit scheme and forward in time central in space.
u n+1 n
i −u i uni−1−2 uni +uni+1 2
t=α x . We mentioned forward in time, so the superscript n is
Δ Δ
between n+1 and n, central in space so the subscript i which is used for space and it is
central, so we have node of interest i, and left node and right node i+1 and i-1. It is also
possible to write different other schemes, for example, forward in time forward in space,
forward in
time backward in space, central in time and central in space. And it is also possible to
write different order in any of these schemes and analyze appropriately. Order of this
scheme order of accuracy of this particular scheme is Δt and Δ x 2 . And we
1 Δt
already learned this scheme is stable for r≤ , where r is defined as α that is
2 Δ x2
α is here, and Δ t is moved from left hand side to the other side, and this is
Δt
α this is what we learned through von-Neumann’s stability analysis.
Δ x2
We can also write same forward in time central in space, but in explicit form. So we at
that time we mentioned what is explicit and what is implicit, and here also we are going
to reemphasize that point. So, this is forward in time on the left hand side for time
u n+1 n
i −u i
derivative this term is same as what is explained here. There is the small
Δt
difference on the right hand side term for spatial differencing and here you can observe it
is central in space because ui−1 u ni ui +1 we consider, but it is implicit which means it is
evaluated or it is consider at the same time level, the time level here is n+1. So, all this
variables are considered at the same time level. So, you observe the superscript as n+1 in
all the three terms, such a scheme is called implicit scheme.
And both these schemes you can understand by the sketch here. So, explicit scheme is
what is shown here value at n+1 is evaluated based on values at n level, but using central
differencing scheme i+1 i and i-1 and this is for explicit scheme. And this figure
demonstrate, how it is for implicit scheme, we consider again values at i+1 at i-1, but at
n+1 level.
(Refer Slide Time: 05:28)
Now we have try to understand, how to get different explicit scheme, there is a scheme
called DuFort-Frankel scheme, which is central in time and space. So, if we look at time
un+ 1 n−1
derivative discretization, we observe here i −ui . So, it is actually evaluated as
central scheme, but in time that is why you get superscript n+1 and n-1 corresponding
denominator two is appearing. And for spatial derivative, it is central in space, but there
is a small difference uni−1 , so it is explicit; the last term ui+1 at n th level, hence it is
un+ 1
also explicit; the middle term is evaluated using central, so this is i and un−1
i .
This happens to be unconditionally stable.
Δt
and Δ x2 and . So, if we compare against forward in time central in space,
Δ x2
where it is conditionally stable and order of accuracy is Δt and Δ x 2 . So, the
middle term, which is shown here for the FTCS u of i n which is completely explicit is
un+ 1
replaced with i and un−1
i . So, for changing this slightly, you are able to get a
conditionally stable to unconditionally stable, and order of accuracy is also improved
you can observe that.
There is also small note to be observed that is for the same scheme DuFort-Frankel
scheme which is central in time and space, if you observe here un+
i
1
and un−1
i , when
you are starting the calculation that is the time equal to zero level for example, then this
quantity that is un−1
i is not available, because we have not done the calculation when
you say n-1, it is before zero and that time it is not available. So, this particular scheme
DuFort-Frankel scheme self-starting at time equal to zero level is not possible, as data at
n-1 level is not available. So, at time is equal to zero alone, we do a calculation based on
any other scheme once that quantity is available then you can switch to DuFort-Frankel
scheme.
We move onto the next that is implicit scheme. So, general discretization for the same
u n+1
i – uni
model equation, so this is time derivative which is forward in time . There is
Δt
small difference here on the right hand side for the spatial derivative, you get two
components here, first bracket term ui+1 ui and ui−1 , so it is central in space, but
on the superscript, you see n+1 for all the quantity. So, it is central in space, but implicit.
Now we move onto the next bracket term that is here, second central in space, but it
evaluated as explicitly at nth level. So, we can see all the superscript for all the three
terms as n.
1
This scheme is unconditionally stable for value of θ≥ . So, we have a factor called
2
θ , which is multiplying one part 1−θ the factor multiplying another part. Now
there are multiple variations for different values of θ , if θ =0 for that is if you
look at the first term if θ =0 , and implicit in time is not there, and you get one
multiplying the second part of the equation, the second part of the equation happens to be
fully explicit. So for θ =0 , it will results in forward in time central in space explicit,
1
this we have already seen. And for θ= , 0.5 value, we get weightage actually,
2
weightage of equal weightage equal weightage of implicit scheme and equal weightage
of explicit scheme such a scheme is called crank Nicholson scheme, because it is
proposed by both this people and it is neither explicit completely nor implicit completely.
So, it is referred as semi explicit.
And for θ =1 , so if you substitute θ =1 in the second term 1 minus 1 cancels all.
So, the explicit part goes to 0, only the implicit part remains, so becomes fully implicit
scheme. So, you understand by writing this generalized
discretization equation, you are able to get three different scheme forward in time fully
explicit, then crank Nicholson scheme semi implicit fully implicit also you are able to
get. So, fully explicit, fully implicit and semi implicit all the three schemes are possible.
Next we take two-dimensional equation and try to get information about these quantities.
Again we will take explicit forward in time and central in space. So, you write down the
equation. Now the index for subscript, we have used i for x direction, now use i and j
correspondingly x and y direction. So, forward in time, this we have already known and
central in space, but we have two terms one for x, another one term for y. So, this term in
the first bracket is for derivative in x, and second term is for derivative in y. We write
accordingly central in space in x direction, so i-1 i and i+1 central in space in y direction,
so it is i,j-1 i,j i,j+1 and it is explicit. So, you observed all superscripts are n. So, all this
quantities are evaluated at n time level.
You can rewrite this equation, by bringing all the known terms on one side and the
un+ 1
quantity all variable that we determined on other side. So, in this case i, j is the
quantity to be evaluated and that is retained on the left hand side as you can see here
un+ d
un+ 1
i, j and you bring all other quantity to the right hand side. So, i, j
x
on set of term
+d y another set of term. It is also again you can rewrite, because you observed uni , j
appears two other places. So, you bring all uni , j together, you will get a coefficient for
Δt
coding purpose. And the dx is explained as α ; similarly, dy is explained
Δ x2
Δt
as α .
Δ y2
Now, let us look at this little more detail. Order of accuracy for this scheme is Δt in
time and Δ x2 and Δ y2 for two different spatial direction we also learnt through
as summed up condition and we also mentioned if you extend this for 3D you get one
more term here and it becomes restitute α is given in the equation Δt if you fix
then you have the limited option on Δx or Δ y . So, that you satisfy stability
condition now we can rewrite the same in fully implicit form still following forward in
time and central in space. So, you get superscript on all the right hand side term as n+1
which means you are actually evaluating at the current time level some of them are not
evaluated some of them are part of the equation and if you rearrange as with it in the
previous case rearrange all the term accordingly.
So, in this case the only term that is known is uni , j . So, you move that to one side. So,
that is what is taken here, than all other terms are brought other side which are not known
because all are to be get to remain or to be evaluated at n+1 time level. So, you get
rearrange and you get this step of equation. So, this particular equation is run
through entire computational domain are along a line nodes along a line then you get
simultaneous equation for every node you will get one set of equation and you need to
put them together and invert the matrix. So, you get simultaneous equation is to be
solved because variables at different nodes are coupled with each other and this set of
equation will result in what is known as the pentadiagonal matrix.
In the next slide, I am going to show what is pentadiagonal matrix usually either you
adopt a separate procedure to invert a pentadiagonal matrix, it takes definitely time
consuming. There is an alternate way of doing the same that is same equation we are
using multiple methods of doing the same equation. The second have full dimensional
diffusion equation; first we have seen explicit forward in time and central in space then
we have seen implicit forward in time central in space we understand like order of
accuracy as well as stability condition.
Now, let us look at different matrices what we shown here is just diagonal matrix, only
one along the diagonal only one quantity is remaining, all other elements in the matrix
are have 0 value then there is another matrix called tridiagonal matrix, this will
extremely useful, we see later how it is used in CFD. In this the diagonal, main diagonal
what is shown in the red, there is a value along the main diagonal then there is
immediately there is one diagonal element one diagonal parallel to the which is called
super diagonal and we have values along that. Similarly immediately below there is
diagonal called sub diagonal and we have values along that all other elements in this
matrix is zero such a matrix is called tri diagonal matrix then we will see pentadiagonal
matrix. So, this has the same structure as tri diagonal matrix, so that is we have one
diagonal immediately below sub diagonal immediately above is a super diagonal, then
the one more column or one more diagonal which is called super super diagonal which is
following a super diagonal.
And we have values along the similarly on the lower side, one more diagonal, one more
line following closely the main diagonal, but just below the sub diagonal were values are
available. So, we have a pattern and this is what is called pentadiagonal that regular
pattern. Now if you look at it is also possible to have pentadiagonal of different pattern.
So, we can see main diagonal is there sub diagonal is also there super diagonal is also
there the next sub sub diagonal or super super diagonal is not there, but it is after there.
So, you get one more line with values another line with values. Now why I need to bring
this, because you may get what is known as different lap structured matrix for different
problem and solution procedures are different for each of this matrix structure.
Now, we will see little more detail about what we mentioned in the previous slide that is for
two-dimensional diffusion equations. If we do completely implicit scheme then it results in
pentadiagonal matrix inverting A, such a matrix is difficult. And there is alternative way of
doing what is known as splitting and that is referred here as alternating
direction implicit method. So, you solve the same equation, but in two steps in the first
step equation is discretized and implicitly solved in x direction and explicitly solved in y
direction. In the second step, equation is discretized and implicitly solved in y-direction
explicitly solved in x-direction.
1
So, each time step solution is advanced by n+ level, which means to go from n time
2
level to n+1 time level, it is obtained in two steps. Now such a matrix results in two
tridiagonal matrices, and there is a standard easy procedure available to invert such a
matrix. And this is easier compare to penta diagonal matrix. If it is a three dimensional
equation, we extend the same logic that is to go from n time level to n+1 time level
1 1 2
solution is advanced by step. So, n, n+ , and n+ and n+1, so that results
3 3 3
in three tridiagonal matrices.
Now we look at the equation. So, first step equation discretized and implicitly solved in x
direction, explicitly in y direction. If we look at the expression for the time derivative, we
mention it advances by half. So, superscript is actually n plus half then it is implicit in x
direction. So, all the quantities which are corresponding to derivative in x direction
∂2 u
the scheme is central in space. So, you get i+1 i and i-1 as a subscript, but it is
∂ x2
1
implicit in time here evaluating at n+ and that n plus half appears in spatial
2
derivative term that is why becomes implicit in x direction. So, we have n plus half as a
∂2 u
superscript on terms corresponding to second derivative still central in space and
∂ x2
∂2 u
it is explicit in y direction. So, terms corresponds to y direction that is you are
∂ y2
evaluating central in space. So, we have j+1 j and j-1, but it is explicit in time. So, we
have superscript appearing here.
Now once you solve this equation that quantity that is becoming to be known that is
1
n+
2
ui , j . So, in the second step the equation discretized and it is implicit in y direction
explicit in x direction. So, we switch implicit and explicit direction. Now we write down
the equation as I mentioned when we solve the first equation, the quantity that is coming
1
n+
to be known is ui , j 2 at and that is taken and we mention it is explicit in x direction.
∂2 u
So, if we look at the derivative in the x direction term so that is . All the
∂ x2
quantities are with the superscript n plus half which means it is explicit in x direction and
you have moved you actually come to correct time level n+1 and we mention it is
implicit in y direction.
So, term that corresponds to y direction is here when we look at the superscript where all
at n+1 level. So, same equation is split in first step it is x implicit in x direction explicit
in y direction and the second step we switch the direction It becomes implicit in y
direction and explicit in x direction. Now if you look at the order of accuracy, it is
Δ t Δ x2 and Δ y2 and it is unconditionally stable. Whereas, fully explicit forward
in time central in space still is conditionally stable. So, we get advantage by doing this
alternating direction implicit that is we get matrix simplified from pentadiagonal to
tridiagonal matrix order of accuracy improved and it becomes unconditionally stable
now let us understand this by graphical sketch.
(Refer Slide Time: 26:48)
So, fully implicit forward in time central in space suppose these are the quantity grid and
this are nodes and nth level. So, i and j is here i, j is here and to evaluate i,j at n+1 time
level that is what displayed we moved we take all the quantities corresponding n+1 level
for this same problem, but if we do forward in time central in space by ADI method we
introduce one more plane at n plus half level and plane at n plus half level we do x sweep
and then at n+1 level we do y sweep. So, in today’s class, we particularly looked at how
to do different finite difference scheme or how to improve order of accuracy or how to
get conditionally stable unconditionally stable and very important topic alternating
direction implicit advantage associate with that.
(Refer Slide Time: 28:16)
With this class, we come to end of this week. And we have touched upon the initial
aspects of CFD that is basic information about finite volume, finite difference, and finite
element method, properties associated with the numerical scheme, conservativeness
transportiveness boundedness, how to analyze numerical scheme, consistency,
convergence and stability, and explanation with different model equations.
Thank you.