Lecture 38 : Introduction to FV II

IIT Kanpur July 201
20 followers
Sep 6, 2024
[Music]
hello everyone welcome back in the last
class we started the the pet volume
technique and we derived the state
update formula so basically instead of
uh using the values of the grid points
we basically created cells okay stored
the value at the Sal Center okay and uh
the state upate formula uh we got was
something like uh if you have a cell
centered value which is a so this is our
cell I okay these are my faces I + half
i- half and this is the next cell I + 1
this is the cell in the left is i - one
right so um the state update formula
that we had was basically if you want to
get u n + 1 which is basically I want to
get the sale average value at the next
iteration was u i n okay minus delta T
by Delta
X okay f i + 1
12 okay and minus f i minus
half n right of course the problem that
we're trying to solve is d by
DT plus d f by DX = to
0 right and we stop that uh U the only
question that we have is that uh how to
calculate this I5 plus half and fius
half which get I mean which results in
another question is that how the U is
varying so fi + half is nothing but F
calculated using the value of U Okay so
if it is I equation U is basically what
you have row row U and row
e right in the coner variable form right
so this is basically F evaluated at x i
+
half
right so if you know how the U varies
within the cell we will be able to
calculate right uh similarly if you want
to do f i - half that is f value of U at
x i - half
okay or in another way this is U XI
minus Delta XI by
2
right so uh gen in general let's say if
you know the gradient somehow this da
Delux that how the U is varying okay
within the cell then you can evaluate at
any point of time so let's say if you
want to get it u i +
1 half n x you can is this if you know
the value at cell center which is u n
and plus let's say somehow you know the
gradient how the U is wearing okay so
from cell you have to go to the face
okay this cell to this face okay this is
I and this is I + half
okay I N and this is x i + half - x i
right and you calcul that right so you
need this gradient how it is varying
within the cell now there are any ways
you can uh basically think how your
value is varying within the cell so one
is like us the constant value okay so
let's say that uh I have three
interfaces okay
so this is one this is
two and this is
three
okay and uh you have basically
the sales here okay
okay so one thing you can say that okay
uh within one Cale the variation is just
uniform okay so that means you have
constant value so in this cell you have
got a constant value let's in this
cell let's call this
I I minus one and I + one
okay and we are seeing that my variation
within a sale is constant okay so
whatever value we have at the sale
Center same value we have we are having
at everywhere in the cell okay this is
one value within the cell uh the other
one let's say in this we have some value
this is UI + 1 this is uh UI okay so
this is I have no variation so basically
it's constant okay and last one
is
okay this is how it is wearing in the
next set
okay so you can see that if you're using
a constant variation so that means your
value is not changing within the cell so
at the interface so these are the
interfaces okay uh this is the interface
this is the interface this is the
interface this is the interface okay uh
so this is between I minus one and I
this is it between I and I + 1 okay so
uh you have some value of the flux
coming from the left and some value of
the flux coming from the right okay this
is a problem because uh you are seeing
that uh so what is flux basically it is
what is basically going across a face
right or going coming in across the face
from the next cell right so you have
something smaller going out and bigger
coming in right so the flux should be
constant at the face which is not
happening here if you're assuming a
fixed variation no variation within the
set basically the constant value right
similarly at the next one also okay here
also you have one value from the left
and one from the right okay what you
need is a constant value the the value
at the flux is constant right so what
you can do you can assume a linear
variation okay which is what actually
works in uh uh most of the basically
finite volume so let's say this is my
value here and this is the value here
okay
so one variation is here okay and
similarly you can have another variation
which is from here to
here okay so this is basically the value
is linearly varying so uh this is the
linear
variation within the
cell okay so that you are getting a
constant value at the interface okay it
will it will be linearly varing but
you'll be getting a constant uh
basically fixed value uh at the
interface
okay so this is how basically your uh uh
variation will look like okay you will
have something coming here something
coming from the right and you have to
basically make sure that you use a
formula so that your flux is whatever
you are calculating from left and right
is basically the same you have to use
the values from left and right and
calculate the flux
okay so you assume the linear variation
you can also assume the quadratic
variation that means let's say that you
from uh within this cell okay let's say
in IUS one your variation is something
like this okay or something like this
okay so uh you can use quadratic or
cubic but that will result in uh
basically some problem in the uh
formalism okay some of the properties uh
that you want to preserve uh in the
finite volume as you will see in some
time okay uh for example the positivity
of the conservation they will not be uh
obeyed when you assume a quadratic or
high variations here in the finite
volume okay so the linear variation you
can choose and you can basically March
it so basically if you know the linear
varation you can calculate this du by DX
right so that the your du by DX value
yeah if you have the linear variation
okay so you know the value at I + 1 you
know the value at IUS one you this can
be par okay and this is your Delta X the
distance between I +1 and ius1 and you
can calculate the gradient here okay of
course there are more sophisticated way
of calculating the green gooss
calculating the gradient you can use the
green gooss or the least Square I'm not
going going into the details there so
basically if you have the problem which
is two dimensional or three dimensional
this simple formulation of calculating
the gradient will not work okay uh you
can uh uh basically if let's say if you
have a triangle here okay and you want
to calculate what is the value on this
face and this face and this face okay
the gradient so this is my U Bar I and
you want to calculate this uh U Bar I uh
at this face let's call it fub1 okay UI
FS2
and uf3 okay so how do you go from this
point to this point right so one way is
like you use the green cost theorem to
calculate the gradient here another way
is that you basically uh write it so you
have neing sales here
okay okay so uh and you have this ning
cell centers so you write your gradient
so you write your formula UI equal to
let's say if it is u
plus uh Delta U by
dxj and Delta XJ okay and you try
writing for this also and this also okay
and you'll have d by d y j d y and Delta
XJ
okay so you write for all of these
directions and then you take a list
Square because you have uh more number
of equations than the uh information
that require you require only two
gradient Del DX and Del Y in 2D for
example but you have many sales neing it
if it's a quality element you'll have
four sales nevering it right so you
basically write it and uh you try to get
the best value of d by DX by using the
list Square I'm sure you might have read
about the list Square where you
calculate the error okay and then you
see that in the L2 Norm uh how you can
minimize the error okay so without going
into the detail if you it becomes the 2D
and 3D you have to use uh these two
schemes are very very popular okay uh
for the Reconstruction one is the green
gos and the the least Square okay so now
you got the gradient this D by DX okay
and you can calculate the value of this
let's say uh U
uh x i + Delta x i by 2 right so this is
my
I and this is I + half right so this
will become u n x i plus d by
DX okay at I and
Bally X
right so if you want to calculate the
value of I5 + half you can take the
gradient uh and use the value of uxi and
calculate that right the other way to do
it is basically take the value of UI + 1
okay so you have a cell I + one also
okay so you get from the right side okay
so x i + 1us Delta x i+ uh x i + 1 by 2
so this is Delta x i +
1 and see Delta
XI soorry by two because you'll have
face on the left also and face on the
right also
okay so uh this is another way to get
that so and the last one is you can take
the basically average of this what you
calculate from the left and what you
calculate from the right and just take
the average of to okay so this one is
very equivalent to the central defening
scheme okay on a uniform grid but this
is uh as we have seen that for the kind
of conviction problem this is not stable
so this option is usually not used even
if you're using this then you have you
have to use some kind of limiter
okay uh basically it is to make sure
that the value does not go very high
okay and you have to basically limit the
value okay so uh we can use one of these
two schemes and they depending on what
kind of Direction you have like uh uh
you recall that when we had C greater
than zero okay we we had used this FBS
okay backward
step uh backward in space when we had C
less than zero then we had use ftfs okay
but we respected the direction of
propagation and accordingly with the
scheme okay so similar idea comes here
also so if it is C is greater than zero
the flow is going from left to right you
can uh use this this is fi +
half and this is fi minus half okay so
you can uh use the First Choice which is
basically uh calculating from the left
to right okay basically it's kind of the
backward stepping okay if it is I + 1
you calculate from i+1 then it's a
forward stepping right so this way you
can calculate the FI + half this is uh
the way you can calculate the FI minus
half okay and uh then you calculate the
value of uh the UI n +1 so this is how
the finite volume works so ultimately
you got all of the elements that you
want delta T Delta X is fixed by your
grid delta T is based on the similar CFL
criter that we had for the finite
difference okay same rules that we had
for example if you want to use the
explicit formulation the most cases the
CFL number is less than one the same
kind of uh approach will work here also
okay and calculate the fluxes uh I +
half and IUS half updated and you can
get the value okay uh if you go to 2D
the like trick that we have to use okay
because you have more directions here
okay we have Del by DT plus d f by D X
plus d g by d y = to0 let's in 2D okay
so uh in 1D what we had done we had just
taken this uh uh integrated exive volume
so this gave us this a i + half and a i
minus half okay if you go to a i + half
and
IUS
okay but if it is 2D
okay so you have two directions for
example this is I and this is J okay so
we need to introduce the concept of
volume okay instead of distance in each
Direction I and J we'll rather put a
sale volume here okay so you have the
sale which defines uh uh the 2D uh
element in this particular case so what
we can do we can write this as d by DT
plus d do
F equal to Zer and like we did for 1D
we'll use in 2D also we'll use the
integration uh in each cell right so now
it is d by DT plus d do F equal to Z
we'll integrate it around the cell right
this is no longer 1 D okay so this Omega
I cannot be Delta x i okay so you can
take a two part D by DT Omega
I uh this has to be multiplied by the
small volume right because we
integrating the Omega and plus d do
f d Omega to Z Omega I
right now uh this part is easy right
because uh you can again uh use the same
uh assumption that my Sal centered value
is basically the average of the entire
value in the volume right so if you use
that you can write it as
um D Bar by Del T and you'll have maybe
some Delta Omega okay the S volume okay
we can just call it Omega
okay how do we convert this one uh uh so
that we can uh make use of the faces
that we have right so uh I'm sure you
must have read in your Calculus that
there's a famous theorem called G
diverence theorem it's also known as the
green theorem okay I think there's some
difference on uh the textbook sometimes
when you convert from 3D to 2D they call
it green theorum to dt1 do they call it
uh uh the Divergence Theorem right but
it's all the same okay so what it says
is that uh if you have a value any value
okay let's say this del. F okay uh which
is around a volume okay you can
basically uh uh write it terms of the F
do n da okay so this is your cost diver
theorem
what does it mean physically let's say
let's try to understand it let's say
this is
your volume okay and uh there's some
Divergence here the del. have value here
and you want to integrate it across this
volume
okay so what you can do that uh uh
instead of integrating Ross this volume
you can just see that what happens uh on
the faces right so
you can just use uh so this is my normal
let's say this is my normal in this
direction normal in this direction okay
this is the normal in this direction
this normal in this direction right
normal is outward
okay so you can see uh that the fluxes
that we have at the interface okay that
app. n uh you basically quantify here
okay and then you quantify here then
quantify here and quantify here and
basically integrate across the area and
that will be the same value as you have
like if you want to calculate this D do
F inti volume so we converted our uh
information in the volume to the
information on interfaces the faces that
we have it can be done for the 3D also
in the triangle also right so let's say
if you have like this then what you can
do you can use it like this
okay
so uh that way you can basically
calculate
this is
f.n so if you use that so you can write
your formula like this okay here of
course this D Omega so this is uh called
area normal okay so what I have done I
I've taken area as a vector so which is
nothing but so your
f.n da can also be written as F Doda
right what where what is a DA is
basically it's an normal vectors now
it's a vector which represents the area
in the normal Direction
okay so uh now there is no approximation
till now okay now uh what we can do is
that uh you uh this is in integral form
and we are using different sale volumes
right triangles or rectangles or uh
quadrilaterals different kind of things
right so you basically go across a all
the faces and add this value so you can
change this integral sign into the uh
summation sign okay where J is the
number of faces so you go to each face
calculate this f.n multiply with Delta s
area on that okay and keep on adding
across all the faces
okay and finally you'll get this state
update formula D by DT is equal to 1 by
Omega F Delta J Delta SJ we have the
same problem now see Delta SJ is uh
defined using our geometry okay the kind
of M element using only thing that we
need to calculate is the F perpendicular
J which is the interfacial flux okay and
as we discussed uh that you have to
Define how the variation of the U is
across the cell and if you assume the
linear variation you can calculate the
gradient d by DX d by d y in this
particular case Okay and then uh from
that you can calculate the value of U at
the interface once you have the value at
the interface you can calculate the FL
at the interface okay and you can use
either green gos or the lift Square to
calculate the gradient d by DX and D by
d y
okay uh this is just the representation
of that this is Delta s uh in this case
uh so uh because this is your face so
this is the information of Delta s keep
on multiplying this side okay and this
Omega is basically the uh the area
inside this entire domain okay that's
the you can see that here there is one
two 2 3 4 5 6 7 okay no there are eight
faces right so you can use any kind of
element okay uh and you will basically
be doing the same conservation that we
have been doing okay so yeah uh because
I talked about the conservation Let's uh
talk about what is conservation and why
it is important
okay so this right hand side is called
the residue okay and and uh if uh your
the problem is stady State then this
will go to zero that means your du by DT
is going to zero okay and if it is not a
stady state okay then this will keep on
changing okay and that uh change in the
interface okay uh reflects that uh you
have basically nonzero Del by DT uh DX
okay this information
okay so it should only depend on the on
uh let's see uh if we are doing the same
thing uh in our finet volume so we are
doing this uh Del by delt uh DX and we
are doing it across each uh cell and add
it up okay let's say you have some
elements like this okay very complicated
element okay of course there are
consideration that your R should not
have very high spec ratio because uh
then let's say your expect is very very
high okay let's say this is
your um cell okay and if you have the S
Center defining here okay so uh of
course in One Direction uh the variation
is very very high right so this kind of
sales will create problem so uh there
are some consideration when you try are
trying to make a grid uh this kind of
sales will have problems in basically
getting the convergence okay or it
may uh blow up also Okay so so of course
those con are there but let's say that
uh uh you are calculating this D by DT
DX and you have this uh 0 1 2 3 4 5 6
let's say you have 10 elements right so
you can uh consider it across each of
the volume okay this volume this volume
each of the volume and sum it up and you
can see that across each volume you can
write it d by DT DX is d by DX DX right
so you can write it uh across each of
them but uh d by DX DX so this is uh I
mean 1D 2D it Remains the Same okay it
is basically this is I + half and IUS
half this is fi + half and this is fi
minus half what is the difference in the
flux okay so for a given cell so you
take any cell okay let's say I'm taking
this cell this this particular cell okay
and you want to calculate this du by DT
DX Omega 0 okay so that will become
across each so this will become f f
perpendicular J Delta
s j okay and for all J and it will
become negative right so basically we'll
Loop over all the
faces and calculate the changes that is
happening in the interface if it is 1D
then you can just see that okay this is
my uh I + half and this is IUS half you
just have to consider the difference
there right so what you're doing is
basically whatever changes it is
happening inside the body with time Del
delx is basically depending only on the
bond flux for that particular cell right
in this case it depends on all three
faces in one depends on only I + half
and IUS half right that means you have
the local conservation right so we want
to ensure that my du by
DT is only depend it should only depend
on the uh interfacial flux on the
boundage
okay so that is what is happening here
that uh uh you're doing a getting a
local conservation because you can see
that it depends only on I plus and I
minus right if you integrate it also
okay let's say that I want to do it for
the entire domain right so this will be
uh see if we can write here
okay so this value for example this will
be uh let me write in 1 D because this
is easy to explain this is basically
f i + half - f i - half okay and then
you will have basically uh I + 1 by 2
this is I + 32 minus I + 1 12 okay and
plus you will have uh uh f i + 52 - I +
32 and so on so forth right so all these
terms will get cancelling out okay uh
and what you'll ultimately get is
basically f n + half Min - F minus half
okay that means if you have a domain
like this okay so this goes from uh your
cell
center this is my cell center one
okay uh and this is my Center n this is
my n+
half okay and this is my f minus half
okay this is the first one so if you
integrate the uh the values of fluxes
everywhere all the second term I mean
here it will be uh for this cell you
will have these faces and these
faces okay uh for the second second you
have this pH and this pH so this term
will cancel out okay and similarly you
will have n minus one uh so this will
cancel out with this one so ultimately
what willing is minus half and N plus
half okay so the for the entire domain
also the DU by DD depends only on the
bond fluxes that means you are having
the global conservation okay so you are
basically having uh both the local
conservation and the global conservation
in the finite volume this is not true in
the finite difference formulation
okay uh finite difference formulation uh
in some cases depending on what kind of
bonding concerns you have okay you may
get the global conservation but not the
local conservation okay maybe if you're
using a a uniform grid okay uh then you
may probably uh get the global
conservation because as we discussed
that uh you have this uh collapse of the
terms inside we have discussed in the
fin difference when you use the
conserved conservative formulation
conserv so you'll get this Global
conservation right but in general it is
not true in the fin difference similarly
if you're using a bonding condition
let's say some kind of dis bonding
condition let's say the wall bonding
conditions again on those boundaries you
don't have this conservation being
applied in the finite difference case
okay in the finite volume case we apply
it even on the boundaries okay so the
the conservation is guaranteed in the
finite volume both the local
conservation as well as the global
conservation now the last point that I
want to cover today is that why is
conservation important right so
typically uh what you have is you talk
about the consistent
scheme right so what what is what do you
mean is basically let's say you have a
scheme uh which uh which gives like d by
d h plus order h to^ n okay which is
basically the an order scheme and as the
H TS to zero uh it uh it will basically
approximate your whatever value whatever
True Value you have okay let's say my
true value is Delta F okay so it will
approach to that value as Z so this is
there in your fining difference also you
have to look at the scheme which is
consistent okay most of the schemes are
derived through T Series and we found
that they are consistent schemes so if
the consistency is there then why and if
you're using proper stability criteria
then you should be happy right so why
you need conservation right why
conservation is important uh in finite
volume so you will see it its importance
typically when you have fluxes uh when
you have socks right so if you have a
sock so you know that there's a large
jump in the in the values for example if
this is pressure here uh the the
pressure on the right will be very high
compared to press on the left okay so
here there is solve discontinuity at
this point
right your variables may have very
different value uh across the sock but
the
fluxes will be unique okay even at the
sof okay if you have a conservative
scheme
right so if you are not having that okay
so then what will happen is that if you
do not have the conservation scheme then
you will get something called the
artificial Source or sync in the
competitional domain and that will
basically uh make the sock uh uh behave
in a very different way which is which
may lead to be non-physical sock okay or
basically uh socks with wrong strength
or at the wrong location okay so the so
conservation schemes or sock capturing
schemes what they do that they ensure
that the conservation property uh is
over there okay so uh that's why the
finite volume is a very good approach if
you want to resolve shocks okay compared
to the finite difference approach
because finite volume approach uh by
default basic gu guarante is
conservation okay so uh uh what we
learned today is that U even in 2D or in
3D we can use the similar approaches 1D
in terms of finite formulation of the
finite volume what you need to do is to
use the C D formulation write that d.f
in terms of the f.n uh so basically
fluxes normal fluxes at the interface
sum that up that will give you the the
total change in fluxes across the
interface okay take it on the right hand
side that is your residue and use your
favorite time time scheme uh on the left
hand side and basically get your
straight update
formula okay uh that's one thing second
thing is that your finite volume uh
guarantees both the local conservation
as well as the global conservation so
that's a very very good thing especially
if you have flow which has got a strong
discontinuities because despite of the
fact that the discontinuities uh at
given location uh your fluxes will
remain constant okay that's so that's
what uh your conservation says okay so
we'll look into more detail about finite
volume we'll solve some problems for
example the convection diffusion scheme
or even the sock problem in the next
class okay with that I'll stop here
thank you very much
[Music]
[Music]
