Foundation of Computational Fluid Dynamics Dr. S. Vengadesan Department of Applied Mechanics Indian Institute of Technology, Madras Lecture - 09
Foundation of Computational Fluid Dynamics Dr. S. Vengadesan Department of Applied Mechanics Indian Institute of Technology, Madras Lecture - 09
Dr. S. Vengadesan
Department of Applied Mechanics
Indian Institute of Technology, Madras
Lecture - 09
Greetings to you all, we are now onto module four of this course in this week. We have seen
so far finite differences scheme and how to obtain forward, backward, central differences
scheme for first derivative and same by to get higher order finite difference formula. In
today’s class, we will particularly find out how to get derivation for non-uniform mesh, and
how to get mixed derivative and how to obtain finite difference formula for higher
derivatives.
(Refer Slide Time: 01:02)
So, this is necessary in the sense you do not have always an options of getting a uniform
mesh throughout the domain; you want have finer mesh at some location and coarser mesh at
some other location. So, in such situation, you need to have a formula derived based on non-
uniform spacing mesh. And this graphically shown here situation, where function and i is a
point of interest, and i+1 and i+2 unlike other case, distance between i+1 and i is Δ x, and
distance between i+2 and i+1 is α Δ x. And if you look from i, i+2 is at a distance of
(1+ α ) Δ x . So, we follow the same procedure, write down Taylor series expansion
formula, but now with α as a coefficient for Δ x, so that is also given here, this is already
known f ( x + Δ x ) as f ( x + Δ x ) and so on – equation 1.
Now, the new difference here is for f of for the second point, which is α Δ x between i+1 and
i+2 or with respect to i, it is at distance of . (1+ α ) Δ x So, if you write the expansion for
the function at i with respect to i+2 then you get formula written here f ( x + ( 1+α ) Δ x ) as this.
The only difference between equation 1 and equation 2 is Δx is replaced by x is replaced by (1+ α ) Δ x ;
everywhere also, it is Δ x 2for example, is replaced by ( 1+α )2 and Δ x 2 and so on. So, as we
did in previous case, here also we are interested only the first derivative, so we consider only
the first term and follow some arithmetic operation to get derivative. And if you consider
higher term then you get corresponding either higher order derivatives, or higher derivatives
difference formula.
(Refer Slide Time: 03:58)
This equation 1 and this equation 2 by multiply equation 1 by 1+α and add it to equation 2
and we get the equation in this form f 1+2 − ( 1+α ) f i+1 +α f iequal to this. And we are interested
with second derivative here, so we retain that term, remaining terms are brought to the other
side so that is given here as f 1+2 − ( 1+α ) f i+1 +α f iand this coefficient is brought to the
denominator, and this is of O ( Δ x 3 ) and if you divide by Δ x 2 then you get of O ( Δ x ). So, we
obtain second derivative forward difference formula for non-uniform mesh, and this is the
O ( Δ x ). Now, if you substitute this expression into the equation 1, which is basically equation
for forward difference; after simplification, we get first derivative forward difference formula
with non-uniform spacing and that is alpha is here. So, this of O ( Δ x 2 ).
(Refer Slide Time: 05:30)
Now, you also have mixed derivative; that means, derivatives with two independent
∂2u
variables. So, for example, ; in this case, u is the function of x and y. So, there should
∂x ∂ y
be a procedure to obtain finite difference formula for this mixed derivative also. Now, we are
going to see how to get derivatives with two variables; otherwise, it is called mixed
derivative. Again function f is dependent on x and y, so we do the expansion – Taylor series
expansion with f ( x + Δ x , y+ Δ y ). And we see here the Taylor series expansion formula
∂f ∂f
written f ( x , y )+ Δ x with new term here for the other direction Δ y , so this comes as a
∂x ∂y
Δ x 2 ∂2 f Δ y 2 ∂ 2 f
pair. Now, again next term, , and other term. We are actually interested to
2 ! ∂ x 2 2! ∂ y 2
∂2 f
find out , this is what is called mixed derivative or derivative in two direction. So, if
∂x ∂ y
you write in i form and j form, so i is for x-direction, and j is for y-direction and written here
∂2 f
as f i+1 , j+1 corresponding to f ( x + Δ x , y+ Δ y ). And we are actually interested in . Now,
∂x ∂ y
we have written this expression for considering i+1 and j+1.
(Refer Slide Time: 07:53)
We can repeat this for different combination of i and j and that is what is given here, f i −1 , j− 1,
f i+1 , j −1; and f i −1 , j+1. So, in all the three expression here, and one expression in the previous
∂2 f
slide, we have a mixed derivative term , and so we have four equations where the
∂x ∂ y
mixed derivative is appearing. So, we do simple arithmetic, add all of them and take a
∂2 f
average and you get finally, expression for mixed derivative as shown here. So, which
∂x ∂ y
is evaluated at i, j with function values consider from neighboring points that is
f i +1 , j +1 − f i +1 , j − 1 − f i −1 , j+ 1+ f i −1 , j −1
. And this is of O ( Δ x 2 , Δ y 2 ). So, it is second order accurate
4 Δx Δ y
in both x-direction as well as y-direction.
Once again, we have written only for a uniform mesh, it is possible to obtain mixed
derivative expression also for non-uniform mesh, and for any combination of non-uniform
mesh. In the sense, it maybe uniform in x-direction, non-uniform in y-direction vice versa is
also true. And it maybe non-uniform in one way in x-direction and non-uniform in another
way in y-direction, so any possible combination of mesh is arrangement is possible. And it is
possible to obtain derivative for any arrangement of mesh.
(Refer Slide Time: 10:03)
The last slide we had seen how to obtain different scheme for the mixed derivative. I rewrite
∂f ∂2 f
derivative , second derivative , now we are interested to get third derivative as an
∂x ∂ x2
example of higher derivative that is why we have consider three expressions. So, multiply
equation 1 by 3 and subtract from equation 3; so we are going to do two small arithmetic
operations equation 1 by 3, and equation subtracted from equation 3.
(Refer Slide Time: 13:40)
So, if you do that we get expression like this, three times 3 f ( x + Δ x ) − f ( x +3 Δ x ) on the left
hand side; on the right hand side, we have the remaining terms. We name this as equation 4.
Then one more small operation multiply equation 1 by 2 and subtract it from equation 2, then
we get one more equation that is shown here f ( x +2 Δ x ) − 2 f ( x+ Δ x ) on the left hand side; on
the right hand side, − f ( x ) and remaining term, and we name this equation as number 5. Now,
between 4 and 5, again we have to do small arithmetic operation, we are only interested in
∂3 f
third derivative term that is , and that is appearing in both equation 4 and 5. This second
∂ x3
derivative term appearing in equation 4 and 5 needs to be removed; so, we do a small
arithmetic operation, solving the above two equation that is multiply equation 5 by 3 and add
it to equation 4, because the secondary derivative term that is here has coefficient one.
So, if you multiply this by 3 and if you add this corresponding term here, then you can
observe that this term also this term gets cancelled that is why this equation 5 is multiplied by
∂3 f
3 and add it to equation 4, so you get as
∂ x3
f ( x+ 3 Δ x ) − 3 f ( x+2 Δ x ) +3 f ( x + Δ x ) − f ( x )
+O ( Δ x ). So, in this class, what we have done, we
( Δ x )3
have done how to obtain finite difference procedure on a non-uniform mesh, and how to
obtain finite difference procedure or finite difference formula for mixed derivative that is
derivative in two direction. And third important subject was how to obtain finite difference
∂3 f
formula for higher derivative as on sample we took the third derivative .
∂ x3
In next class, we will see how to obtain finite difference formula by other procedure that is
we have seen getting all finite difference formula only from Taylor series expansion, there
are also other procedures available, and we are going to see one such procedure in next class.
Thank you.