22.520 numerical methods for pdes : video 19: introduction...
TRANSCRIPT
22.520 Numerical Methods for PDEs : Video 19:Introduction to Finite Volume Methods
David J. Willis
April 4, 2015
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 1 / 30
Table of contents
1 Conservation of Mass
2 Conservation of Mass
3 Conservation of Mass
4 General Conservation Laws
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 2 / 30
References and Acknowledgements
The following materials were used in the preparation of this lecture:
1 Randall J. LeVesque Numerical Methods for Conservation Laws.
2 16.920, lecture 11,12 Notes
3 Sethian, J.A., Level Set Methods – Evolving interfaces in Geometry,Fluid Mechanics
4 Versteeg and Malalasekera, An introduction to computational fluiddynamics – the finite volume method
The author of these slides wishes to thank these sources for making thecurrent lecture.
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 3 / 30
Table of contents
1 Conservation of Mass
2 Conservation of Mass
3 Conservation of Mass
4 General Conservation Laws
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 4 / 30
Conservation of Mass
Conservation of Mass Example
What if we had a collection of volumes attached by pipes:
What happens over time?
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 5 / 30
Conservation of Mass
Conservation of Mass Example
We know the finite volumes solely gaining/loosing fluid will rise/fallrespectively:
How can we assess the volumes with inflow and outflow?
du
dt=? (1)
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 6 / 30
Conservation of Mass
Conservation of Mass Example
We know the finite volumes solely gaining/loosing fluid will rise/fallrespectively:
How can we assess the volumes with inflow and outflow?
du
dt= flowin − flowout (2)
This is the idea behind finite volumes...David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 7 / 30
Conservation of Mass
Control Volume Mathematics
We could recall from fluid dynamics that there is a control volumerepresentation for this situation:
0 =∂
∂t
∫∫∫ΩρdV +
∫∫Γρ~u · ndS (3)
This expression relates the change in mass inside the volume with therate at which it is entering/leaving the volume. We can impose thedivergence theorem to transform the second integral (boundaryintegral):
0 =∂
∂t
∫∫∫ΩρdV +
∫∫∫Ω∇ · (ρ~u)dV (4)
If we then combining the two integrals:
0 =
∫∫∫Ω
[∂ρ
∂t+∇ · (ρ~u)
]dV (5)
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 8 / 30
Conservation of Mass
Control Volume Mathematics
The result is the familiar conservation of mass in differential form
0 =∂ρ
∂t+∇ · (ρ~u) (6)
Core Ideas:The differential conservation of mass equation is a PDEThe differential conservation of mass equation describes conservationGoing backwards through the steps, we can derive a finite volumerepresentation.
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 9 / 30
Conservation of Mass
Table of contents
1 Conservation of Mass
2 Conservation of Mass
3 Conservation of Mass
4 General Conservation Laws
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 10 / 30
General Conservation Laws
General Conservation Laws
In general, many physical phenomena that change with respect totime are conserved.
Conservation of mass (ρ is mass per unit volume)Conservation of Momentum (ρ~u is momentum per unit volume →Newtons Law )Conservation of Energy (ρu · uT is energy per unit volume → Energyequation)
The underlying conservation form in 1-Dimension is:
∂u
∂t+∂(f (u))
∂x= 0 (7)
Where:
u = the unknown property under consideration – this is the desiredsolution in each cellf (u) = The flux of the quantity between the control volumes
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 11 / 30
General Conservation Laws
General Conservation Laws
The basic conservation form:
∂u
∂t+∂(f (u))
∂x= 0 (8)
ASIDE, this can be re-written or expressed as:
∂u
∂t+
df
du︸︷︷︸a(u)
∂u
∂x= 0 (9)
or the (non-linear) advection/wave equation. We saw the linearversion (a(u) = C ) of this last module (hyperbolic PDEs).
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 12 / 30
General Conservation Laws
Finite Volume Method
Let’s define a 1-D finite volume geometry and discretization:
We will need to define 1-D ”volumes” and ”boundaries”:
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 13 / 30
General Conservation Laws
Finite Volume Method
Our original conservation law in 1-Dimension is:
∂u
∂t+∂(f (u))
∂x= 0 (10)
To begin, we integrate over the domain.
0 =
∫Ω
[∂u
∂t+∂(f (u))
∂x
]dV (11)
For our conservation law expression, the integration is the sum of theintegrals over the individual elements:∑
i
∫ xR
xL
[∂ui
∂t+∂(f (ui ))
∂x
]dx = 0 (12)
The conservation law on the i-th individual line element:∫ xR
xL
[∂ui
∂t+∂(f (ui ))
∂x
]dx = 0 (13)
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 14 / 30
General Conservation Laws
Finite Volume Method
Discussion: By taking this integral, have we changed the nature ofthe conservation law at all?
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 15 / 30
General Conservation Laws
Finite Volume Method
The second integral simply becomes the flux evaluated at the left andright boundaries of the element/cell:
0 =∂
∂t
∫ xR
xL
udx +
∫ xR
xL
∂f (u)
∂xdx
=∂
∂t
∫ xR
xL
udx + f (u)R − f (u)L
We can re-arrange this a little as:
∂
∂t
∫ xR
xL
udx = −[f (u)R − f (u)L] (14)
This expression says: The change in the property integrated acrossour control volume is balanced by the flux in and out of the LHS andRHS boundaries of the element.
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 16 / 30
General Conservation Laws
Finite Volume Method
Let’s focus on the left hand side now.
∂
∂t
∫ xR
xL
udx (15)
We may notice that the average value of the property u across thecell is:
1
∆x
∫ xR
xL
udx = uavg →∫ xR
xL
udx = ∆xuavg (16)
We can re-write our previous expression now as:
∂
∂t
∫ xR
xL
udx =∂
∂t(∆xuavg ) = −[f (u)R − f (u)L] (17)
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 17 / 30
General Conservation Laws
Finite Volume Method
Pictorially, the average value vs. the actual value. What we haveeffectively done, is assumed a constant value function across eachelement (most crude approximation we could make, but lets go withit).
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 18 / 30
General Conservation Laws
Finite Volume Method
Let’s define the time derivative:
∂
∂t(∆xuavg ) = −[f (u)R − f (u)L] (18)
Discretizing with a forward Euler equation:
(∆xuavg )k+1 − (∆xuavg )k
∆t= −[f (u)R − f (u)L] (19)
Rearranging to find the new u:
uk+1 = uk − ∆t
∆x[f (u)R − f (u)L] (20)
Now we can find the updated u value at some future time.
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 19 / 30
General Conservation Laws
Finite Volume Method
Let’s Recap:
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 20 / 30
General Conservation Laws
Finite Volume Method
Let’s try an example. Traffic flow prediction in one-dimension.
The conservation of cars (mass) equation is:
∂ρ
∂t+∂ (f (ρ))
∂x= 0
∂ρ
∂t+∂(ρu)
∂x= 0
ρ : Density of cars on the road
u : velocity of the cars
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 21 / 30
General Conservation Laws
Finite Volume Method
Traffic Flow Example (Leveque):
We are going to claim there is a relationship between the velocity ofthe cars and the density:
u(ρ) = umax(1− ρ
ρmax) (21)
This equation says that the velocity of cars is faster when ρ→ 0 andslower when ρ→ 1.
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 22 / 30
General Conservation Laws
Finite Volume Method
Calculate flow of cars using the velocity-density relationship
Assume that umax = 1 and ρmax = 1:
f (ρ) = ρumax(1− ρ
ρmax)
f (ρ) = ρ− ρ2
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 23 / 30
General Conservation Laws
Finite Volume Method
Let’s try to implement this for our problem:
From before, we have:
ρk+1 = ρk − ∆t
∆x[f (ρ)R − f (ρ)L] (22)
Where we need to figure out the f (ρ)R and f (ρ)L:
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 24 / 30
General Conservation Laws
Finite Volume Method
Godunov proposed the following first order flux function:
F (ρl , ρr ) =
min(ρl≤ρ≤ρr ) f (ρ) if ρl ≤ ρrmax(ρr≤ρ≤ρl ) f (ρ) if ρl > ρr
(23)
It basically says, at a boundary between two volumes, you considerthe car density/solution values on either side to figure out whetherthe flow enters/leaves the volume.
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 25 / 30
General Conservation Laws
Finite Volume Method
Let’s examine a few cases:
ρk+1 = ρk − ∆t
∆x[f (ρ)R − f (ρ)L] & f (ρ) = ρ− ρ2 (24)
F (ρl , ρr ) =
min(ρl≤ρ≤ρr ) f (ρ) if ρl ≤ ρrmax(ρr≤ρ≤ρl ) f (ρ) if ρl > ρr
(25)
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 26 / 30
General Conservation Laws
Finite Volume Method
Let’s examine a few cases:
ρk+1 = ρk − ∆t
∆x[f (ρ)R − f (ρ)L] & f (ρ) = ρ− ρ2 (26)
F (ρl , ρr ) =
min(ρl≤ρ≤ρr ) f (ρ) if ρl ≤ ρrmax(ρr≤ρ≤ρl ) f (ρ) if ρl > ρr
(27)
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 27 / 30
General Conservation Laws
Finite Volume Method
Let’s examine a few cases:
ρk+1 = ρk − ∆t
∆x[f (ρ)R − f (ρ)L] & f (ρ) = ρ− ρ2 (28)
F (ρl , ρr ) =
min(ρl≤ρ≤ρr ) f (ρ) if ρl ≤ ρrmax(ρr≤ρ≤ρl ) f (ρ) if ρl > ρr
(29)
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 28 / 30
General Conservation Laws
Finite Volume Method
Let’s put this all together now:
ρk+1 = ρk − ∆t
∆x[f (ρ)R − f (ρ)L] & f (ρ) = ρ− ρ2 (30)
F (ρl , ρr ) =
min(ρl≤ρ≤ρr ) f (ρ) if ρl ≤ ρrmax(ρr≤ρ≤ρl ) f (ρ) if ρl > ρr
(31)
We know the current density of cars
We can calculate the flux of cars from one volume to the next (bycomparing R and L cells’ fluxes and density vals).
We can then calculate the new value for car density in a block
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 29 / 30
General Conservation Laws
What have we learned?
We know that a conservation law can be evaluated as a finite volumemethod.
The change of a quantity (ρ) in a volume is related to the flux (f (ρ))of that quantity through the boundary of the cell.
The flux of the quantity of interest (ρ) through the cell boundaries isdetermined using a flux function.
Once the fluxes are known, new values of the solution (ρ) can bedetermined.
David J. Willis 22.520 Numerical Methods for PDEs : Video 19: Introduction to Finite Volume MethodsApril 4, 2015 30 / 30