atm 265, spring 2019 lecture 4 numerical methods: …outline. paul ullrich atm 265: lecture 04 april...
TRANSCRIPT
![Page 1: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/1.jpg)
ATM 265, Spring 2019Lecture 4
Numerical Methods:Temporal Discretizations
April 10, 2019
Paul A. Ullrich (HH 251)[email protected]
![Page 2: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/2.jpg)
2Paul Ullrich ATM 265: Lecture 04 April 10, 2019
CESM Project
• The CESM project has been posted on the course webpage. Please have a look and let me know if you have any questions. The project will be due on April 26th, 2019.
• Office hours for the class: Monday 1:30pm-2:30pm. Also available for virtual meetings on Tuesdays, Thursdays and Fridays.
![Page 3: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/3.jpg)
3Paul Ullrich ATM 265: Lecture 04 April 10, 2019
1. Introduction / Motivation
2. Explicit / Implicit Methods
3. Runge-Kutta Methods
4. Lagrangian / Semi-Lagrangian Methods
5. Numerical Stability
Outline
![Page 4: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/4.jpg)
Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Introduction
![Page 5: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/5.jpg)
5Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Atmospheric Modeling – Question One
Eulerian Frame
�q
�t+ u ·�q = 0
We considered this term.
Last Time: Spatial Discretizations
• How do we best represent continuous data when only a (very) limited amount of information can be stored?
• Equivalently, what is the best way to represent continuous data discretely?
![Page 6: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/6.jpg)
6Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Atmospheric Modeling – Question Two
Eulerian Frame
�q
�t+ u ·�q = 0
Let’s look at this term.
• How do we best represent the dynamic evolution of the atmosphere? (how to deal with time?)
This Time: Temporal Discretizations
![Page 7: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/7.jpg)
7Paul Ullrich ATM 265: Lecture 04 April 10, 2019
• How do we best represent continuous data when only a (very) limited amount of information can be stored?
Atmospheric Modeling – Question One
Atmospheric Modeling – Question Two
• How do we best represent the dynamic evolution of the atmosphere? (how to deal with time?)
These questions are inherently linked
Spatial and Temporal Discretizations
![Page 8: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/8.jpg)
8Paul Ullrich ATM 265: Lecture 04 April 10, 2019
So far we have discretized the spatial component of the equations:
Time evolution of data point j
Some function applied to all other
data points
q is the vector of all discrete data values
�qj�t
=u
2�xqj�1 �
u
2�xqj+1
Example from finite-differences:
�qj�t
= Fj(q)
Spatial and Temporal Discretizations
![Page 9: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/9.jpg)
9Paul Ullrich ATM 265: Lecture 04 April 10, 2019
All the methods discussed in Lecture 3 are linear:For a linear differential equation (e.g. advection equation) the function f can be represented as a matrix multiply.
Time evolution of data point j. “Spatial
discretization” matrix.
q is the vector of all discrete data
values.
�q
�t= Aq
Spatial and Temporal Discretizations
![Page 10: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/10.jpg)
10Paul Ullrich ATM 265: Lecture 04 April 10, 2019
A =u
2�x
0
BBBBBB@
0 �1 0 0 0 +1+1 0 �1 0 0 00 +1 0 �1 0 00 0 +1 0 �1 00 0 0 +1 0 �1�1 0 0 0 +1 0
1
CCCCCCA
�qj�t
=u
2�xqj�1 �
u
2�xqj+1
Example from finite-differences:�q
�t= Aq
Spatial and Temporal Discretizations
![Page 11: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/11.jpg)
11Paul Ullrich ATM 265: Lecture 04 April 10, 2019
A =u
2�x
0
BBBBBB@
0 �1 0 0 0 +1+1 0 �1 0 0 00 +1 0 �1 0 00 0 +1 0 �1 00 0 0 +1 0 �1�1 0 0 0 +1 0
1
CCCCCCA
�qj�t
=u
2�xqj�1 �
u
2�xqj+1
• Example from finite-differences:�q
�t= Aq
Matrix is mostly zeroes!
Banded structure!
Spatial and Temporal Discretizations
![Page 12: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/12.jpg)
12Paul Ullrich ATM 265: Lecture 04 April 10, 2019
• An evolution matrix which consist mostly of zeroes are
referred to as sparse matrices.
• Finite-difference, finite-volume, spectral element
methods all (typically) lead to a sparse evolution
matrix.
• The spectral transform method leads to a dense
evolution matrix. That is, there are very few zeros.
Applications to Spatial Discretizations
![Page 13: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/13.jpg)
13Paul Ullrich ATM 265: Lecture 04 April 10, 2019
• As the accuracy of a numerical method increases, there are fewer zeros in the evolution matrix (they make use of more information).
• That is, accuracy implies the need for a dense matrix.
• But! A more dense matrix is more computationally expense to apply in calculations.
• Hence, there is a trade-off between accuracy and efficiency.
Applications to Spatial Discretizations
![Page 14: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/14.jpg)
Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Explicit / Implicit Methods
![Page 15: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/15.jpg)
15Paul Ullrich ATM 265: Lecture 04 April 10, 2019
�q
�t= Aq
Integrate these discretizations with respect to time:
�q
�t= F(q)
qn+1 � qn =
Z tn+1
tnAqdt qn+1 � qn =
Z tn+1
tnF(q)dt
The Time Step
![Page 16: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/16.jpg)
16Paul Ullrich ATM 265: Lecture 04 April 10, 2019
qn+1 � qn =
Z tn+1
tnAqdt
qn+1 � qn =
Z tn+1
tnF(q)dt
The Time Step
![Page 17: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/17.jpg)
17Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Consider the non-linear discretization of the evolution equation.
qn+1 � qn =
Z tn+1
tnF(q)dttn+1
tn
Time
xj
qn+1j
qnj
Space
The Time Step
![Page 18: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/18.jpg)
18Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Non-linear discretization.
qn+1 � qn =
Z tn+1
tnF(q)dt
tn+1
tn
Time
xj
qn+1j
qnj
Space
Z tn+1
tnF(q)dt ⇡ �t F(qn)
qn+1 = qn +�t F(qn)
�t = tn+1 � tn
A First Explicit Scheme
![Page 19: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/19.jpg)
19Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Non-linear discretization.
qn+1 � qn =
Z tn+1
tnF(q)dt
tn+1
tn
Time
xj
qn+1j
qnj
Space
qn+1 = qn +�t F(qn)
Under the explicit discretization, the unknown is written explicitly in terms of known values.
�t = tn+1 � tn
A First Explicit Scheme
![Page 20: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/20.jpg)
20Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Non-linear discretization.
qn+1 � qn =
Z tn+1
tnF(q)dt
tn+1
tn
Time
xj
qn+1j
qnj
Space
Z tn+1
tnF(q)dt ⇡ �t F(qn+1)
qn+1 = qn +�t F(qn+1)
�t = tn+1 � tn
A First Implicit Scheme
![Page 21: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/21.jpg)
21Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Non-linear discretization.
qn+1 � qn =
Z tn+1
tnF(q)dt
tn+1
tn
Time
xj
qn+1j
qnj
Space
Under the implicit discretization, one needs to solve a system of equations to find qn+1.
qn+1 = qn +�t F(qn+1)
�t = tn+1 � tn
A First Implicit Scheme
![Page 22: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/22.jpg)
22Paul Ullrich ATM 265: Lecture 04 April 10, 2019
In the linear case, the backward Euler method simplifies to
qn+1 � qn =
Z tn+1
tnAqdtqn+1 = qn +�t A qn+1
We can directly rewrite this in terms of qn+1:
qn+1 = (I ��t A)�1qn
Solving the linear system is potentially an expensive operation.
A First Implicit Scheme
![Page 23: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/23.jpg)
23Paul Ullrich ATM 265: Lecture 04 April 10, 2019
In the non-linear case, we can also linearize the update:
qn+1 � qn =
Z tn+1
tnF(q)dt
F(qn+1) ⇡ F(qn) +dF
dq(qn+1 � qn)
qn+1 = qn +�t F(qn+1)
qn+1 = qn +�t
✓I ��t
dF
dq(qn)
◆�1
F(qn)
A First Implicit Scheme
![Page 24: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/24.jpg)
24Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Q: Clearly the explicit method is
significantly more straightforward to
evaluate. Why would we choose an
implicit method?
A: Stability! We will see this more
later, but the basic difference is as
follows:
qn+1 = qn +�t F(qn+1)
qn+1 = qn +�t F(qn)
• Implicit schemes have no limit on the size of the time step size .
However, a larger time step size is less accurate. Also: Implicit
schemes generally require global communication.
• Explicit schemes impose a (strict) limit on the time step size .
Exceeding this limit will cause the method to “blow up”.
�t
�t
Explicit / Implicit Schemes
![Page 25: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/25.jpg)
25Paul Ullrich ATM 265: Lecture 04 April 10, 2019
tn+1tnTime
F(q(xj , t)) Z tn+1
tnF(q(xj , t))dt
Accuracy
![Page 26: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/26.jpg)
26Paul Ullrich ATM 265: Lecture 04 April 10, 2019
tn+1tn
Z tn+1
tnF(q(xj , t))dt
tn+1tn
Forward Euler Backward Euler
Z tn+1
tnF(q)dt ⇡ �t F(qn)
Z tn+1
tnF(q)dt ⇡ �t F(qn+1)
F(q(xj , t))
Accuracy
![Page 27: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/27.jpg)
27Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Forward Euler Backward Euler
Both the forward Euler method and backward Euler method are first-order accurate: They are only exact when F is a constant.
First-order accuracy is typically insufficient. We need to do better.
F(q(xj , t))
Accuracy
![Page 28: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/28.jpg)
28Paul Ullrich ATM 265: Lecture 04 April 10, 2019
The leap frog scheme is a traditional second-order accurate explicit method. This means that the integral is exact if F is either constant or linear in time.
tn+1
tn
Time
xj
qn+1j
qnj
Space
tn�1
qn+1 � qn�1 =
Z tn+1
tn�1
F(q)dt
qn�1j
Leap frog requires knowledge of q from two time levels prior to the unknown level.
Leap Frog
![Page 29: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/29.jpg)
29Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Leap Frog
Second-order accuracy for the leap frog method is attained by using the midpoint value.
F(q(xj , t))
tn+1tntn�1
qn+1 � qn�1 =
Z tn+1
tn�1
F(q)dt
Accuracy of Leap Frog
![Page 30: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/30.jpg)
30Paul Ullrich ATM 265: Lecture 04 April 10, 2019
The leap frog scheme has traditionally been used in combination with the spectral transform method.
tn+1
tn
Time
xj
qn+1j
qnj
Space
tn�1 qn�1j
The leap frog scheme possesses a computational mode since the odd and even time levels can separate.
This is usually fixed by using off-centering (Asselin filtering)
Leap Frog
![Page 31: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/31.jpg)
Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Runge-Kutta Methods
![Page 32: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/32.jpg)
32Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Runge-Kutta methods are a popular method for attaining high-order
accuracy in time without the need to store data from multiple time steps.
tn+1
tn
Time
xj
qn+1j
qnj
Space
• Runge-Kutta methods are multi-stage, which
means in order to advance by the
function Fmust be evaluated multiple times.
�q
�t= F(q)
�t
Runge-Kutta Methods
![Page 33: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/33.jpg)
33Paul Ullrich ATM 265: Lecture 04 April 10, 2019
The second-order accurate predictor-corrector method is one of the most basic Runge-Kutta methods.
tn+1
tn
Time
xj
qn+1j
qnj
Space
A first-order approximation to is first computed (prediction step):
q⇤j
qn+1j
q⇤ = qn +�t F(qn)
A second-order correction is then computed:
qn+1 =1
2qn +
1
2q⇤ +
�t
2F(q⇤)
Predictor / Corrector
![Page 34: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/34.jpg)
34Paul Ullrich ATM 265: Lecture 04 April 10, 2019
The predictor corrector scheme can also be written as follows:
qn+1 = qn +�t
2F(qn) +
�t
2F(q⇤)
F(q(xj , t))
tn+1tn
qn+1 = qn +
Z tn+1
tnF(q)dt
q⇤jqnj
Predictor / Corrector
![Page 35: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/35.jpg)
35Paul Ullrich ATM 265: Lecture 04 April 10, 2019
One of the more popular Runge-Kutta methods is the SSPRK3 scheme, which is a third-order accurate, three stage Runge-Kutta method.
tn+1
tn
Time
xj
qn+1j
qnj
Space
tn+1/2
q(1)j
q(2)j
q(1)j = qn
j +�tF(qn)
q(2)j =
3
4qnj +
1
4q(1)j +
�t
4F(q(1))
qn+1j =
1
3qnj +
2
3q(2)j +
2�t
3F(q(2))
Stage one:
Stage two:
Final update:
Strong Stability Preserving RK3 (SSPRK3)
![Page 36: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/36.jpg)
36Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Writing as a one-stage update equation:
qn+1 = qn +
Z tn+1
tnF(q)dt
qn+1j = qn
j +�t
6
hF(qn) + 4 F(q(2)) + F(q(1))
i
F(q(xj , t))
tn+1tn tn+1/2
qnj q(1)j
q(2)j
Strong Stability Preserving RK3 (SSPRK3)
![Page 37: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/37.jpg)
37Paul Ullrich ATM 265: Lecture 04 April 10, 2019
The CAM Spectral Element (CAM-SE) model uses a Runge-Kutta scheme closely modeled on the leap frog scheme discussed earlier:
tn+1
tn
Time
xj
qn+1j
qnj
Space
q(1)j
q(2)j
Stage one:
Stage k+1:
Final update:
q(1)j = qn
j +�t0
2F(qn
j )
q(k+1) = q(k�1)j +�t0F(q(k)
j )
q(0) = qnj
tn +�t0/2
tn +�t0
tn + 3�t0/2 q(3)j
qn+1 = q(N)
Synchronized Leap Frog
![Page 38: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/38.jpg)
Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Lagrangian and Semi-LagrangianMethods
![Page 39: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/39.jpg)
39Paul Ullrich ATM 265: Lecture 04 April 10, 2019
What does this mean?
q Tracer mixing ratio is constant following a fluid parcel.
q
Dq
Dt= 0
Lagrangian Frame
Recall Lagrangian reference frame (follows a fluid parcel).
Lagrangian Methods
![Page 40: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/40.jpg)
40Paul Ullrich ATM 265: Lecture 04 April 10, 2019
…in the finite difference context
Lagrangian Methods
q1,1
q2,1
q3,1
q1,2
q2,2
q3,2
q1,3
q2,3
q3,3
q1,4
q2,4
q3,4
u
Uniform wind field
How is the field propagating in
time?
Lagrangian Frame
Continuous:
Discrete:
![Page 41: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/41.jpg)
41Paul Ullrich ATM 265: Lecture 04 April 10, 2019
…in the finite difference context
Lagrangian Methods
u
Uniform wind field
Location of the data at the
previous time step
q1,1
q2,1
q3,1
q1,2
q2,2
q3,2
q1,3
q2,3
q3,3
q1,4
q2,4
q3,4
Lagrangian Frame
Continuous:
Discrete:
![Page 42: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/42.jpg)
42Paul Ullrich ATM 265: Lecture 04 April 10, 2019
…in the finite difference context
Semi-Lagrangian Methods
!3,3
u
Uniform wind field q1,1
q2,1
q3,1
q1,2
q3,2
q1,3
q2,3
q3,3
q1,4
q2,4
q3,4The value of the field at the
previous time step at the parcel’s old location can be
interpolated from the gridded field at the previous time step.
Lagrangian Frame
Continuous:
Discrete:
![Page 43: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/43.jpg)
43Paul Ullrich ATM 265: Lecture 04 April 10, 2019
• The Lagrangian frame is, in some sense, the most natural way to think about the advection equation.
Dq
Dt= 0
Lagrangian Frame• But: In practice it is difficult to follow around
fluid parcels in presence of deforming flow.
Source: R.A. Pielke and M. Uliasz (1997).
Lagrangian Methods…in the finite volume context
![Page 44: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/44.jpg)
44Paul Ullrich ATM 265: Lecture 04 April 10, 2019
• Instead: Semi-Lagrangian methods follow a fluid parcel in time, then remap to a regular mesh.
Evolve Remap
Remap De-evolve
tntn+1 tn+1
tn+1
tntn
Semi-Lagrangian Methods
![Page 45: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/45.jpg)
45Paul Ullrich ATM 265: Lecture 04 April 10, 2019
The flux across the highlighted edge is
desired.
Step 1: Project velocity field backwards in time to obtain a “flux area.”
Step 2: Integrate over the flux area to obtain the flux through the
edge.
Flux-Form Lagrangian Transport
![Page 46: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/46.jpg)
46Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Deformational Flow Test
![Page 47: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/47.jpg)
Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Stability
![Page 48: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/48.jpg)
48Paul Ullrich ATM 265: Lecture 04 April 10, 2019
Numerical instability in a high-frequency computational mode:
Introduction to Stability
![Page 49: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/49.jpg)
49Paul Ullrich ATM 265: Lecture 04 April 10, 2019
• Recall definition of eigenvectors of B: If v is an eigenvector of B, then it
satisfies where is the (complex) eigenvalue associated with v.
• Theory: If B is well behaved, then it will have N eigenvector /
eigenvalue pairs, where N is the number of free parameters.
qn+1 = Bqn
Bv = �v �
qn =NX
i=1
ani vi
Apply both time and space discretization:
Introduction to Stability
![Page 50: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/50.jpg)
50Paul Ullrich ATM 265: Lecture 04 April 10, 2019
qn+1 = Bqn
qn =NX
i=1
ani vi
• Substitute this solution into the update equation:
qn+1 =NX
i=1
ani Bvi
qn+1 =NX
i=1
�iani vi
• Use properties of eigenvectors:
vi eigenvectors of B, withassociated eigenvalues λi.
Introduction to Stability
![Page 51: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/51.jpg)
51Paul Ullrich ATM 265: Lecture 04 April 10, 2019
qn+1 = Bqn
qn =NX
i=1
ani vi
where
qn+1 =NX
i=1
an+1i vi
an+1i = �ia
ni
vi eigenvectors of B, withassociated eigenvalues λi.
Introduction to Stability
![Page 52: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/52.jpg)
52Paul Ullrich ATM 265: Lecture 04 April 10, 2019
qn+1 = Bqn
qn =NX
i=1
ani vi
where
Take absolute values:
qn+1 =NX
i=1
an+1i vi
an+1i = �ia
ni
|an+1i | = |�i| |ani |
|�i| > 1? |�i| < 1?
vi eigenvectors of B, withassociated eigenvalues λi.
Introduction to Stability
![Page 53: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/53.jpg)
53Paul Ullrich ATM 265: Lecture 04 April 10, 2019
qn+1 = Bqnvi eigenvectors of B, withassociated eigenvalues λi.
|�i| > 1 Instability! The corresponding computational mode will blow up.
|�i| � 1 Stable! The corresponding computational mode will either maintain its amplitude, or will decay with time (lose energy?)
Introduction to Stability
![Page 54: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/54.jpg)
54Paul Ullrich ATM 265: Lecture 04 April 10, 2019
qn+1 = BqnExample: Forward Euler plus upwinding (first-order finite volume).
Corresponding evolution matrix:
B =
0
BBB@
1� � . . . �� 1� �
� 1� �. . .
. . .
1
CCCA
qn+1j = qnj +
u�t
�x(qnj � qnj�1) � =
u�t
�x
(vk)j = exp(ijk)
Eigenvectors and eigenvalues:
�k = 1� ⇥(1 + exp(�ik))
Stability: An Example
![Page 55: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/55.jpg)
55Paul Ullrich ATM 265: Lecture 04 April 10, 2019
qn+1 = BqnExample: Forward Euler plus upwinding (first-order finite volume).
qn+1j = qnj +
u�t
�x(qnj � qnj�1) � =
u�t
�x
(vk)j = exp(ijk)
Eigenvectors and eigenvalues:
�k = 1� ⇥(1 + exp(�ik))
Absolute value of eigenvalues:
|�k|2 = 1� 2⇥(⇥ � 1)(cos(k)� 1)
maxk
|�k|2 = 1 + 4⌫(⌫ � 1)
Maximum eigenvalue:
Stability: An Example
![Page 56: ATM 265, Spring 2019 Lecture 4 Numerical Methods: …Outline. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 Introduction. Paul Ullrich ATM 265: Lecture 04 April 10, 2019 5 Atmospheric](https://reader036.vdocuments.site/reader036/viewer/2022070716/5edac884ceb8760df365f3ce/html5/thumbnails/56.jpg)
56Paul Ullrich ATM 265: Lecture 04 April 10, 2019
qn+1 = BqnExample: Forward Euler plus upwinding (first-order finite volume).
qn+1j = qnj +
u�t
�x(qnj � qnj�1) � =
u�t
�x
maxk
|�k|2 = 1 + 4⌫(⌫ � 1)
Maximum eigenvalue:
0 ⌫ 1
Stability: An Example