ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2...
Transcript of ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2...
![Page 1: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/1.jpg)
ATM 265, Spring 2019Lecture 3
Numerical Methods:Horizontal Discretizations
April 8, 2019
Paul A. Ullrich (HH 251)[email protected]
![Page 2: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/2.jpg)
2Paul Ullrich ATM 265: Lecture 03 April 8, 2019
1. Introduction / Motivation
2. Finite Difference Methods
3. Finite Volume Methods
4. The Spectral Transform Method
5. Spectral Element / Discontinuous Galerkin
Outline
![Page 3: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/3.jpg)
Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Introduction
![Page 4: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/4.jpg)
4Paul Ullrich ATM 265: Lecture 03 April 8, 2019
• How do we best represent continuous data when only a (very) limited amount of information can be stored?
Atmospheric Modeling – Question Number One
• Equivalently, what is the best way to represent continuous data discretely?
Continuous vs. Discrete
![Page 5: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/5.jpg)
5Paul Ullrich ATM 265: Lecture 03 April 8, 2019
The Regular Latitude-Longitude Grid
Grid lines are represented by lines of constant latitude and longitude.
Polar singularity leads to accumulation of elements and increase of resolution near the pole.
Grid faces individually regular
Orthogonal coordinate lines
![Page 6: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/6.jpg)
6Paul Ullrich ATM 265: Lecture 03 April 8, 2019
The Cubed-Sphere
The cubed-sphere grid is obtained by placing a cube inside a sphere and �inflating� it to occupy the total volume of the sphere.
No polar singularities
Grid faces individually regular
Some difficulty at panel edges
Non-orthogonal coordinate lines
![Page 7: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/7.jpg)
7Paul Ullrich ATM 265: Lecture 03 April 8, 2019
The Icosahedral Geodesic Grid
The grid is the “dual” grid of the refined icoahedron, consisting of hexagonal and pentagonal elements.
No polar singularities
Grid largely unstructured
Most uniform element spacing
![Page 8: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/8.jpg)
8Paul Ullrich ATM 265: Lecture 03 April 8, 2019
GFDL FV3
CAM-SECAM-EUL
CAM-FV
Numerical Methods: Issues
![Page 9: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/9.jpg)
9Paul Ullrich ATM 265: Lecture 03 April 8, 2019
GFDL FV3
CAM-SECAM-EUL
CAM-FV
Numerical Methods: Issues
Although it is a standard in climate modeling, the CAM-FV model is known to possess a strong diffusive signature. Diffusion is enhanced as one approaches the poles in order to maintain stability.
![Page 10: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/10.jpg)
10Paul Ullrich ATM 265: Lecture 03 April 8, 2019
GFDL FV3
CAM-SE
Numerical Methods: Issues
Both the GFDL FV3 (FVcubed) model and CAM-SE (spectral element) model are built on the cubed-sphere. This leads to an enhancement of the k=4 wave mode. The use of high-order numerics in CAM-SE is more effective at repressing this mode.
![Page 11: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/11.jpg)
11Paul Ullrich ATM 265: Lecture 03 April 8, 2019
ICON
CSU
Numerical Methods: Issues
Both the ICON model CSU model are
built on an icosahedral grid (results
from 2008 workshop). This leads to
an enhancement of the k=5 wave
mode.
![Page 12: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/12.jpg)
12Paul Ullrich ATM 265: Lecture 03 April 8, 2019
CAM-SECAM-EUL
Numerical Methods: Issues
CAM-EUL (Eulerian) and CAM-SE (spectral element) use spectral methods, which are known to be prone to spectral ringing. This ringing is characterized by rapid oscillations due to enhancement of the high-frequency mode.
![Page 13: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/13.jpg)
13Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Summary: When it comes to designing
discretizations, there’s no free lunch!
Numerical Methods: Staggering
Unstaggered (Arakawa A-grid) finite-difference
and finite-volume methods are known to
support artificially support high-frequency
modes. Additional diffusion is typically required
to eliminate high-frequency imprinting.
![Page 14: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/14.jpg)
14Paul Ullrich ATM 265: Lecture 03 April 8, 2019
10-day adiabatic runs with 1 tracer on Cray machine Jaguar XT4 (#4). The resolution
is ~ 1 degree in the horizontal with 26 vertical levels. Source: Art Mirin (LLNL)
FV3CAM-SECAM-FV
Parallel Performance
Methods which make the most use of local data will perform better on massively parallel computers (compact schemes). Conversely, methods which make use of global data (spectral transform) tend to perform more poorly in parallel.
![Page 15: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/15.jpg)
The Atmospheric Equations
Material derivative:
Du
Dt� uv tan�
r+
uw
r= � 1
⇢r cos�
@p
@�+ 2⌦v sin�� 2⌦w cos�+ ⌫r2u
Dv
Dt+
u2 tan�
r+
vw
r= � 1
⇢r
@p
@�� 2⌦u sin�+ ⌫r2v
Dw
Dt� u2 + v2
r= �1
⇢
@p
@r� g + 2⌦u cos�+ ⌫r2w
D⇢
Dt= �⇢ ·ru
cpDT
Dt� 1
⇢
Dp
Dt= J
p = ⇢RdT
DqiDt
= Si
D
Dt=
@
@t+ u ·r
15Paul Ullrich ATM 265: Lecture 03 April 8, 2019
![Page 16: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/16.jpg)
Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Finite Difference Methods
![Page 17: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/17.jpg)
17Paul Ullrich ATM 265: Lecture 03 April 8, 2019
We are interested in solving the advection equation:
For now, we only consider 1D:
Dq
Dt= 0
�q
�t+ u ·�q = 0
�q
�t+ u
�q
�x= 0
q represents the mixing ratio of a certain tracer
species.
Advection of a Tracer
![Page 18: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/18.jpg)
18Paul Ullrich ATM 265: Lecture 03 April 8, 2019
What does this mean?
�q
�t+ u ·�q = 0
q
q
Dq
Dt= 0
Lagrangian Frame Eulerian Frame
Advection of a Tracer
Tracer mixing ratio is constant following a fluid parcel.
![Page 19: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/19.jpg)
19Paul Ullrich ATM 265: Lecture 03 April 8, 2019
What does this mean?
q
Dq
Dt= 0
Lagrangian Frame Eulerian Frame
�q
�t+ u ·�q = 0
q
u
Advection of a Tracer
Local change in mixing ratio is determined by “rate of change” of q in the upstream wind direction.
![Page 20: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/20.jpg)
20Paul Ullrich ATM 265: Lecture 03 April 8, 2019
qj-1 qj qj+1 qj+2
How do we understand the CONTINUOUS behavior of q? �q
�t+ u
�q
�x= 0
Eulerian Frame
Basic Finite Differences
![Page 21: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/21.jpg)
21Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
Consider some arbitrary values associated with q at each point. Grid points are distance Δx apart.
qj-1 qj
qj+1
qj+2
qj-2
�x
Basic Finite Differences
![Page 22: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/22.jpg)
22Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
• The simplest approximation to the continuous field is obtained by connecting nodal points by straight lines.
qj-1 qj
qj+1
qj+2
qj-2
�x
Basic Finite Differences
![Page 23: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/23.jpg)
23Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
• We need first derivatives in space to approximate the advection equation
qj-1 qj
qj+1
qj+2
qj-2
�q
�t+ u
�q
�x= 0
Eulerian Frame
�x
Basic Finite Differences
![Page 24: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/24.jpg)
24Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
qj-1 qj
qj+1
qj+2
qj-2
�x
✓�q
�x
◆�
j
=qj � qj�1
�x
✓�q
�x
◆+
j
=qj+1 � qj
�x
“Left” Derivative “Right” Derivative
Basic Finite Differences
![Page 25: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/25.jpg)
25Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
qj-1 qj
qj+1
qj+2
�x
A more accurate approximation can be made by fitting a parabola through three neighboring points.
q(x) =
✓qj+1 � 2qj + qj�1
�x2
◆(x� xj)2
2+
✓qj+1 � qj�1
2�x
◆(x� xj) + qj
✓�q
�x
◆0
j
=qj+1 � qj�1
2�x
“Central” Derivative
Basic Finite Differences
The “central” derivative is just the average of the “left” and “right” derivatives.
![Page 26: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/26.jpg)
26Paul Ullrich ATM 265: Lecture 03 April 8, 2019
�q
�t+ u
�q
�x= 0
Eulerian Frame
�qj�t
= �uj
✓qj � qj�1
�x
◆
�qj�t
= �uj
✓qj+1 � qj�1
2�x
◆
The previously mentioned discrete derivatives then lead to two discrete approximations of the advection equation.
Upwind Scheme
Central Scheme
Basic Finite Differences
![Page 27: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/27.jpg)
27Paul Ullrich ATM 265: Lecture 03 April 8, 2019
A bit more complicated (two coupled equations):
Used to model small amplitude gravity waves in a shallow ocean basin.
�h
�t+H
�u
�x= 0
�u
�t+ g
�h
�x= 0
h
Hu
1D Wave Equation
![Page 28: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/28.jpg)
28Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
�x
Assume h and u are both stored at the same points (Arakawa A-grid)
hj-2 hj-1 hjhj+1 hj+2
uj-2uj-1 uj
uj+1 uj+2
1D Linear Wave Equation
![Page 29: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/29.jpg)
29Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Again using the central difference approximation we derived earlier, the wave equation takes the following discrete form:
�uj
�t+ g
hj+1 � hj�1
2�x= 0
�hj
�t+H
uj+1 � uj�1
2�x= 0
1D Linear Wave Equation
![Page 30: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/30.jpg)
30Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
�x
Other arrangements of h and u nodes are possible (Arakawa C-grid)
hj-2 hj-1 hjhj+1 hj+2
uj-3/2uj-1/2 uj+1/2
uj+3/2 uj+5/2
1D Linear Wave Equation
![Page 31: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/31.jpg)
31Paul Ullrich ATM 265: Lecture 03 April 8, 2019
With staggered velocities, we can tighten the discretization:
�hj
�t+H
uj+1/2 � uj�1/2
�x= 0
�uj+1/2
�t+ g
hj+1 � hj
�x= 0
This choice tends to greatly improve errors associated with the discretization.
1D Linear Wave Equation
![Page 32: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/32.jpg)
32Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Image: http://trac.mcs.anl.gov/projects/parvis/wiki/Discretizations
Arakawa Grid Types (2D)
![Page 33: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/33.jpg)
33Paul Ullrich ATM 265: Lecture 03 April 8, 2019
• Finite-difference methods are easy to implement, and consequently are typically fast.
• These methods are very easy to implement implicitly or semi-implicitly (to avoid issues with fast wave).
• One needs to be careful to ensure conservation (not guaranteed by the finite-difference method) and avoid spurious wave solutions.
Finite Difference Methods
![Page 34: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/34.jpg)
Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Finite Volume Methods
![Page 35: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/35.jpg)
35Paul Ullrich ATM 265: Lecture 03 April 8, 2019
• Scalar variables (density, energy, tracers) are stored as
element-averaged values (conservation)
• Velocities can be stored as pointwise values or as
element-averaged momentum.
CAM-FV GFDL FV3
Finite Volume Methods
![Page 36: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/36.jpg)
36Paul Ullrich ATM 265: Lecture 03 April 8, 2019
h Fluid heightu Fluid velocity vectorp Fluid pressureS Source terms (geometry, Coriolis, topography)
�h
�t+⇥ · (hu) = 0
�hu
�t+⇥ · (hu� u+ 1
2gh2) = S
Conservative Shallow Water Eqn’s
![Page 37: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/37.jpg)
37Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Given conservation law
Integrate over an element with boundary and apply Gauss� divergence theorem. This gives
Time evolution of element-averaged state
Flux throughelement boundary
Element-averaged source term
Finite Volume Methods
![Page 38: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/38.jpg)
38Paul Ullrich ATM 265: Lecture 03 April 8, 2019
• Scalar variables (density, energy, tracers) are stored as
element-averaged values.
• Neighboring values are needed to build a sub-grid-
scale reconstruction.
Example: Surface
temperature data
Sub-Grid Scale Reconstruction
![Page 39: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/39.jpg)
39Paul Ullrich ATM 265: Lecture 03 April 8, 2019
• State variables (density, energy, tracers) are stored as
element-averaged values.
• Neighboring values are needed to build a sub-grid-
scale reconstruction.
j – 2 j – 1 j j + 1 j + 2
Sub-Grid Scale Reconstruction
![Page 40: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/40.jpg)
40Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
• A linear profile:
• An approximation to the slope in element j can be obtained by differencing neighboring elements.
Sub-Grid Scale Reconstruction
![Page 41: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/41.jpg)
41Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
When applied to all elements, our sub-grid scale
reconstruction captures features which are not apparent at
the grid scale.
Sub-Grid Scale Reconstruction
![Page 42: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/42.jpg)
42Paul Ullrich ATM 265: Lecture 03 April 8, 2019
j – 2 j – 1 j j + 1 j + 2
A reconstructed cubic
polynomial through an
element and its four
nearest neighbors
provides very accurate
sub-grid accuracy.
2D Stencil
In higher dimensions
the reconstruction
stencil incorporates
neighboring elements
in both directions.
Sub-Grid Scale Reconstruction
![Page 43: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/43.jpg)
43Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Using polynomials information on the sub-grid-scale (continuous) behavior of each state variable is recovered.
Sub-Grid Scale Reconstruction
![Page 44: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/44.jpg)
44Paul Ullrich ATM 265: Lecture 03 April 8, 2019
qLqR
Since the sub-grid reconstruction can be discontinuous at cell interfaces (we have a left value qL and right value qR), we have several options for computing the flux (Riemann solver).
Solving for Fluxes
![Page 45: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/45.jpg)
45Paul Ullrich ATM 265: Lecture 03 April 8, 2019
• With appropriately defined fluxes, finite-volume methods do not generally suffer from �spectral ringing� and generally only realize physically attainable states (diffusive errors are dominant)
• Finite-volume methods can be easily made to satisfy monotonicity and positivity constraints (i.e. to avoid negative tracer densities)
• These methods are generally very robust, and are heavily used in other fields.
Finite Volume Methods
![Page 46: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/46.jpg)
46Paul Ullrich ATM 265: Lecture 03 April 8, 2019
2D Shallow Water EquationsContinuous Equations (Flux Form) Semi-Discrete Equations
Flux terms
![Page 47: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/47.jpg)
Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Spectral Methods
![Page 48: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/48.jpg)
48Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Instead of writing state variables as pointwisequantities, we can instead write the continuous field as a linear combination of modes:
�(x, t) =NX
k=1
ak(t)⇥k(x)
�1(x)
�2(x)
�3(x)
�4(x)
�5(x)
�6(x)
�0(x)0
�k(x) = exp(ikx)
Z
S⇥k⇥ndS =
⇢2�, if m = n0, if m 6= n
Linear Harmonics
![Page 49: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/49.jpg)
49Paul Ullrich ATM 265: Lecture 03 April 8, 2019
On the sphere there is a natural basis of modes known as spherical harmonics.
Z
S��,m�k,ndS =
⇢I�,m, k = ⇥ and m = n0, k 6= ⇥ or m 6= n
Spherical Harmonics
![Page 50: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/50.jpg)
50Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Expand q in terms of basis functions:�q
�t+ u
�q
�x= 0
Substitute into the 1D advection equation:
Multiply by and integrate over domain :
q(x, t) =NX
n=1
an(t)�n(x)
kNX
n=1
dandt
Z
S�n�kdx = �u
NX
n=1
an
Z
S
⇥�n
⇥x�kdx
NX
n=1
dandt
�n = �uNX
n=1
an⇥�n
⇥x
Spectral Methods: Advection
![Page 51: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/51.jpg)
51Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Use orthogonality. For a linear differential equation, this leads to an exact separation of wave modes:
Observe for exact time integration:
�k(x) = exp(ikx)
q(x, t) =NX
n=1
an�n =NX
n=1
an,0 exp(in(x� ut))
dandt
= �inuan
an = an,0 exp(�inut)
And so q(x,t) is computed exactly!
Spectral Methods: Advection
![Page 52: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/52.jpg)
52Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Wavenumber is proportional to the inverse wavelength. Hence, larger
wavenumbers = shorter waves.
Source: WRF Decomposed Spectra Spring Experiment 2005 Forecast. Courtesy of Bill Skamarock.
Energy Spectrum
![Page 53: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/53.jpg)
53Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Non-linear differential equations, such as the ones that govern atmospheric motions include products of state variables with themselves:
⇥u
⇥t+ u ·⇥u = �1
�⇥p+ g
Non-Linear Equations
![Page 54: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/54.jpg)
54Paul Ullrich ATM 265: Lecture 03 April 8, 2019
• The spatial component of the spectral transform method is “perfect” for linear differential equations. Errors are only introduced by the temporal discretization.
• In practice, the spectral transform method is not used for tracer advection since it is difficult to maintain monotonicity and positivity.
• Errors typically emerge as“spectral ringing.”
Spectral Methods
![Page 55: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/55.jpg)
55Paul Ullrich ATM 265: Lecture 03 April 8, 2019
• Non-linear mixing can cause an accumulation of energy at the
smallest grid scales, so additional diffusion is typically needed to
remove energy here.
• The spectral transform method requires global communication to
accurately handle non-linear terms. This tends to hurt the parallel
performance of this method.
Spectral Methods
![Page 56: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/56.jpg)
Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Finite Element Methods
![Page 57: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/57.jpg)
57Paul Ullrich ATM 265: Lecture 03 April 8, 2019
• Finite element methods take the benefits of the spectral transform
method with the locality principal of finite-volume methods.
• Can be thought of as spectral transform “in an element”
j j+1
Finite Element Methods
![Page 58: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/58.jpg)
58Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Image: http://trac.mcs.anl.gov/projects/parvis/wiki/Discretizations
• A nth order finite element method requires nd basis functions within each element (dimension d).
• To construct basis functions, use GLL nodes within a 2D element.
• Fit polynomials so that each basis function is 1 at one node and 0 at all other nodes.
Spectral Element Method
![Page 59: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/59.jpg)
59Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Expand q in terms of basis functions within an element:
q(x, t) =NX
n=1
an(t)�n(x)
�1(x)�2(x) �3(x)
�4(x)
xj,1 xj,2 xj,3 xj,4
Finite Element Method
![Page 60: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/60.jpg)
60Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Note that the use of GLL nodes means that there is an implicit discrete integration rule:Z
Sj
�(x, t)dx ⇡ w1�j,1 + w2�j,2 + w3�j,3 + w4�j,4
�j,1 �j,2 �j,3 �j,4
Finite Element Methods
![Page 61: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/61.jpg)
61Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Expand q in terms of basis functions within an element:
Substitute into the 1D conservation equation:
Multiply by and integrate over an element:
q(x, t) =NX
n=1
an(t)�n(x)
k
�q
�t+
�
�xF (q) = 0
NX
n=1
dandt
�n = � ⇥
⇥xF
NX
n=1
an�n
!
NX
n=1
dandt
Z
Sj
�n�kdx = �Z
Sj
⇥F
⇥x�kdx
Finite Element Methods
![Page 62: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/62.jpg)
62Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Apply integration by parts:
�q
�t+
�
�xF (q) = 0
NX
n=1
dandt
Mn,k = �F (x)�k
�����Sj
+
Z
Sj
F (x)d�k
dxdx
Mn,k =
Z
Sj
�n�kdxWith mass matrix:
Finite Element Methods
![Page 63: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/63.jpg)
63Paul Ullrich ATM 265: Lecture 03 April 8, 2019
�q
�t+
�
�xF (q) = 0
NX
n=1
dandt
Mn,k = �F (x)�k
�����Sj
+
Z
Sj
F (x)d�k
dxdx
To evaluate internal exchange term, use integration property on interior:Z
Sj
�(x, t)dx ⇡ w1�j,1 + w2�j,2 + w3�j,3 + w4�j,4
Finite Element Methods
![Page 64: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/64.jpg)
64Paul Ullrich ATM 265: Lecture 03 April 8, 2019
NX
n=1
dandt
Mn,k = �F (x)�k
�����Sj
+
Z
Sj
F (x)d�k
dxdx
• Spectral Element method: Enforce continuity at element boundaries. Flux function is simple function evaluation.
• Discontinuous Galerkin method: Discontinuous at element edges. A Riemann solver must be applied to evaluate flux here.
Finite Element Methods
![Page 65: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/65.jpg)
65Paul Ullrich ATM 265: Lecture 03 April 8, 2019
Q: How does Spectral Element method enforce continuity?
A: Easy! Evolve nodal values in both elements. Then take average:
�j,1 �j,2 �j,3 �j,4
= �j+1,1= �j�1,4
�n+1j,1 = �n+1
j�1,4 =�⇤j,1 + �⇤
j�1,4
2
Finite Element Methods
![Page 66: ATM 265, Spring 2019 Lecture 3 Numerical Methods ...Paul Ullrich ATM 265: Lecture 03 April 8, 2019 2 1.Introduction / Motivation 2.Finite Difference Methods 3.Finite Volume Methods](https://reader036.fdocuments.in/reader036/viewer/2022070716/5edb6ebead6a402d6665a694/html5/thumbnails/66.jpg)
66Paul Ullrich ATM 265: Lecture 03 April 8, 2019
xj,1 xj,2 xj,3 xj,4
The spectral element method can be interpreted as a finite difference scheme.
�q
�t+ u
�q
�x= 0
“Spectral” Derivative✓⇥q
⇥x
◆
x=xj,3
=NX
n=1
and�
dx(xj,3)
Equivalence with Finite Difference