Numerical Frameworks 11-13 September 2012 Thematic Outline • Considerations related to grid-point methods for numerical weather prediction • The underlying formulation of spectral methods for numerical weather prediction Grid Point Methods • Grid-point methods rely on the atmosphere being represented by some form of a computational grid. • Such a grid typically takes one of two forms… – Structured: defined by an array of cells arranged in a regular two- or three-dimensional pattern – Unstructured: defined by collections of polygonal elements in an irregular pattern Structured Grid Example (Image obtained from Penn St. University E-Education: “A World of Weather”) Unstructured Grid Example A Note on Unstructured Grids • Unstructured grids are quite flexible in nature, particularly for complex domains. • They are useful for models using adaptive meshes. – In an adaptive mesh, a higher density of grid points is clustered in a region of particular interest – Contrast to a fixed mesh, where grid points are evenly spaced across the entire model domain • But, they also require information to be carried in the model about how their elements are connected. How do we relate our choice of computational grid to the geography of the Earth? Via the selection of an appropriate map projection! Note that we aren’t (yet) saying anything about how we solve the primitive equations on a chosen computational grid. That comes later when we discuss spatial derivative methods. Map Projection Fundamentals • The Earth is approximately spherical, with known area, shape, and angle properties. • We desire to convert the sphere to a “flat” grid. • But, in so doing, we cannot preserve all of the properties of the sphere! • Instead, we must choose what is most important to us to preserve and minimize the impacts of the rest. Map Projection Fundamentals • For meteorological applications, we want to preserve angles first and foremost. • Why? Our kinematic fields (wind, vorticity, etc.) are all vector fields – in other words, they are angledependent. • Aside: here, “preserve” means that angles on the map projection equal those on the sphere/Earth. Map Projection Fundamentals • Conformal map projections preserve angles, making them a popular choice for modern NWP. • Areas are not preserved, however, while shapes are only approximately conserved when the area covered by the map is relatively small. • Examples of conformal projections: Mercator Lambert Conic Polar Stereographic Mercator Projection • Wrap the globe in a cylinder tangent to the Earth at the standard parallel (typically the equator). • Project the Earth’s surface onto the cylinder. • Distance and shape distortion is greatest at high latitudes. It is zero at the standard parallel. Mercator Projection Example Note the increasingly “stretched” look at higher latitudes as shape and distance are distorted. Lambert Conic Projection • “Top” the Earth with a cone that bisects the Earth at two latitudes (the standard parallels). • Project the Earth’s surface onto the surface of the cone. • Distance and shape distortion is greatest far from the standard parallels. Lambert Conic Projection Example Note the curved shape to the map with minimal distortion. The standard parallels used to create this map are 43.75°N and 60°N. Polar Stereographic Projection • Place a horizontal plane tangent to the Earth at either pole. – Example at left is for a more generic stereographic projection secant to the Earth at sub-polar latitudes. • Project the Earth’s surface onto the surface of the horizontal plane. • Distortion is largest at lower latitudes well away from the poles. Northern Polar Stereographic Example Note the similar shape to that given by the Lambert conic projection. Map Projection Fundamentals • Each map projection is associated with distance distortion. • For a structured computational grid, we specify the distance between grid points on the chosen grid. • But, the actual distance on the Earth between these grid points varies with latitude as a result of projecting the data onto the grid. Projection Distances • ∆xg, the distance between grid points, is fixed. • ∆xe, the distance between the corresponding points on the Earth, varies with latitude. Map Projection Fundamentals • To address this, we utilize a measure of the distortion known as the map-scale factor: xG m x E • This ratio varies between each of the different types of map projections as a function of latitude. • Why? Because of how the Earth is projected onto each planar surface with the various projections. Map-Scale Factors by Projection m = 1 (unity) indicates no distortion from projection. Map-Scale Factor Considerations • Since the map projection results in varying ∆xe over the computational grid, we must modify the primitive equations to account for this. – a/k/a “coupling” the equations to the map projection • Example: equation (3.3)… du m ' m m uw ( f u v )v ew cos Du dt x y x r time deriv. density/pres. and total gradient term advection Coriolis terms (e and f) curvature diffusion Map-Scale Factor Considerations • We desire m ≈ 1 to minimize distance and shape distortion due to projection. • We also desire the spatial derivative of m to be ≈ 0 to minimize numerical impacts due to grid “stretching.” • Recommendations for practical NWP experiments: – Tropics (30°S-30°N): Mercator – Mid-latitudes (30°-60° N/S): Lambert conic – Polar latitudes (60°-90° N/S): Polar stereographic Map-Scale Factor Considerations • Because of the map projection, we must also ensure that observations are appropriately mapped to the model / computational grid. • This is particularly important for directional / vector fields, namely our u and v wind components. Map-Scale Factor Considerations • Finally, recall the CFL stability criterion for advection terms in an Eulerian framework: Ut 1 x • ∆x is this case is equal to ∆xe and is latitude-variant. • For a given ∆xg, ∆xe will be largest away from the standard parallels of the chosen map projection. – Thus enabling the CFL criterion to be more easily violated! Latitude-Longitude Grids • Partition the Earth into grid cells by increments of latitude and longitude. • Because the distance between longitudes decreases with increasing latitude, these grids have very densely packed grid points near the poles. • The poles themselves are singularities that must also be dealt with in some fashion. Latitude-Longitude Grids Density near the poles is computationally inefficient: too many points are clustered over a very small area. Latitude-Longitude Grids To address this, we can filter the data to remove fast modes near the poles or utilize non-constant longitude intervals (above). Spherical Geodesic Grids • Start with an icosahedron (20 faces, 30 edges, 12 vertices) and subdivide it using multiple polygons. • Triangles, pentagons, and hexagons are the most common polygonal choices. • Unstructured grid allows for local mesh refinement by adding polygons in an area (or areas) of interest. • Best-known example: the NOAA/ESRL FIM model. Other Considerations: Nesting • Oftentimes, we have a reason for focusing in on a specific area within a model simulation… – To focus upon a specific region of interest – To focus upon a specific feature of interest – To better represent processes in regions of complex terrain • The easiest way to do so: use a small enough horizontal grid spacing over the entire domain to sufficiently resolve the feature / region of interest. – This is very computationally inefficient, however! Other Considerations: Nesting • The most common way to do so: embed higherresolution domains inside of a larger, coarser domain – Outer domain provides initial and lateral boundary conditions for the inner domain – Both two-way and one-way feedback between domains is possible within current models • The change in horizontal grid spacing between domains should be relatively small to minimize wave reflection issues at the domain edges. – Typical nest ratios: 3:1, 5:1, 7:1 Nested Domain Example 3:1 ratio Other Considerations: Nesting • Another means of doing so: stretched grids. • Feature gradual, rather than abrupt, changes of horizontal grid spacing. • Grid stretching can remain static or evolve during a model simulation. • “Grid” need not be a grid; recall: spherical geodesic Stretched Grid Example Other Considerations: Nesting • Most modern models use vertical grid stretching to concentrate vertical levels over specified layers. • This often impacts the boundary layer, tropopause, and other areas of greatest interest and horizontal / vertical gradients in meteorological fields. • How this is accomplished varies slightly based upon the choice of vertical coordinate, however. Vertical Grid Spacing • Since the atmosphere is three-dimensional, we need to also discuss vertical grid spacing selection. • Why is vertical grid spacing important? – Many atmospheric features are either sloped (fronts, etc.) or have substantial vertical structure. – If you decrease horizontal grid spacing to better resolve these features, you must also decrease the vertical grid spacing to better resolve the features’ vertical structure(s). – Not doing so may result in spurious and/or noisy solutions. Vertical Grid Spacing Example 75 layers 25 layers Note that inappropriate vertical grid spacing is not the only possible source of forecast degradation when only the horizontal grid spacing is decreased! Vertical Grid Spacing • The ideal relationship between horizontal and vertical grid spacing remains unclear, however… – Simulations often encompass features with varying slopes – Horizontal numerical diffusion limits the “effective” horizontal resolution of simulated features – Vertical grid structure is often far more unstructured than the horizontal grid structure (choice of vertical coordinate) – While nested grids can have finer horizontal grid spacing, the same is not necessarily true in the vertical • Resource issue: double levels, double computations Vertical Grid Spacing • General recommendation: increase the number of vertical levels as you decrease horizontal grid spacing • Practical manifestation: – For coarse horizontal grid spacing (∆x ≥ 30 km), many simulations use ~30 vertical levels in the troposphere. – For storm-scale horizontal grid spacing (∆x ≤ 4-10 km), many simulations use 50-70+ vertical levels. – As in the horizontal, just because we can resolve features does not mean that we have the data to accurately represent / initialize or verify them! Spectral Methods Background • Primarily used for global NWP, though some regional spectral models do exist • Pioneered in the 1970s in response to limitations in then-state of the art grid-point methods – Singularity and computational inefficiency near the poles – Numerical issues (aliasing, representation of derivatives) • Most current global models (namely the GFS and ECMWF) are spectral models Overview • To first order, spectral methods involve the transform of continuous, dependent atmospheric fields (u, v, T, etc.) from physical into spectral space. • Methods: Fourier series and Legendre functions • This enables us to solve spatial derivatives (in x and y) analytically, wherein the structure of the field is stated in a mathematical form. Example • To illustrate the spectral transform methods, let us first consider a generic one-dimensional field… • Equation (3.5), also below, is a Fourier series representation for a generic field A(x). • The structure of A in the x direction is given as the linear superposition of an infinite number of waves. Example A( x) (am cos(m kx) bm sin(m kx)) m 0 • am and bm are Fourier coefficients (amplitudes) • m is the zonal wavenumber (and is an integer) • k = 2π/L, where L is the domain length Example • Euler’s identity: e i cos i sin • If we let θ = mkx, then… e imkx cos(m kx) i sin(m kx) where... eimkx cos(m kx) i sin(m kx) e imkx cos(m kx) i sin(m kx) Example • If we add these expressions, we get… eimkx eimkx 2 cos(mkx) • If we subtract these expressions, we get… eimkx eimkx 2i sin(mkx) • Now, substitute these expressions into (3.5)… am imkx imkx bm imkx imkx A( x) ( (e e ) (e e )) 2i m 0 2 Example • Rearrange this result to group like exponentials… bm bm imkx am imkx am A( x) (e ( ) e ( )) 2 2i 2 2i m 0 • Let us consider the special case of m=0. With m=0, the exponentials are all 1. With simplification, A( x) a0 • We’ll let a0 = C0. Example • Now, consider the positive and negative exponential. Combine the fractional coefficients on each, i.e., imkx 2iam 2bm imkx 2iam 2bm A( x) (e ( )e ( )) 4i 4i m 0 imkx am ibm imkx am ibm A( x) (e ( )e ( )) 2 2 m 0 • We define the coefficients on each as Cm and C-m, respectively (note slight difference from text). Example • This allows us to write: m 1 m 1 A( x) C0 (Cm eimkx ) (Cm e imkx ) • Multiply the index in the second summation by -1… A( x) C0 (Cm eimkx ) m 1 1 imkx ( C e m ) m • Put C0 back into sum form and combine to obtain… A( x) C m m e imkx Example • Thus, A(x) is represented analytically by the summation of an infinite number of waves. • For meteorological applications, we allow the Fourier coefficients (am, bm, Cm) to vary in time. • We also need to limit the number of waves for computational reasons; this is known as truncation. Example • To continue our example, consider the shallow water equations as functions of x and t only... u u h u g 0 t x x h h u u h 0 t x x • We can analytically express u and h in terms of the previously-derived Fourier series expression for A: u( x, t ) imkx U ( t ) e m m K h( x, t ) imkx H ( t ) e m m K Example • We have truncated the series from (-∞,∞) to (-K,K), where K is the highest permitted wavenumber. • The time dependence of u and h is given by the Fourier coefficients Um and Hm. • Their spatial dependence is given by the waveform implied by eimkx, for which the derivative in x is known – imk*eimkx! Example • Thus, we do not need to approximate the spatial dependence with finite difference methods. – You can prove this to yourself by plugging in for u and h into the two shallow water equations and simplifying. • Method of solving… – – – – Convert initial data from physical to spectral space Solve for spatial derivatives analytically Solve temporal and vertical derivatives w/finite differences Back transform data at desired times for physical analysis Advanced Considerations: Overview • Multiple Dimensions: not just (x,t) but (x,y,t) • Non-linear and local terms: issues in spectral space • Truncation: number of allowable waves and spectral resolution considerations • Advantages and disadvantages of spectral modeling Multiple Dimensions • In global models, the dependent variables are more complex because they need to not just be in 1-D. – i.e., they have zonal and meridional structure • Zonal variation: handled with Fourier series • Meridional variation: handled with Legendre functions (next slide) and recurrence relations (not discussed) Multiple Dimensions • For any field ψ(x,y) (or, in Earth coordinates, ψ(λ,φ)… ( , , t ) K N (m) m K n m m n (t )Y ( , ) m n Ynm ( , ) eim Pnm (sin ) • The Ynm are the spherical harmonics. The Ψnm are the spectral coefficients. The Pnm are Legendre functions. • N(M) is the highest order of the Legendre functions. Non-Linear and Local Forcing Terms • Examples: u u x . (non-linear), Q (diabatic heating) • Non-linear terms are very computationally expensive to compute in spectral space. • Local terms cannot be represented spectrally because they are discontinuous variables. • These terms are handled in physical space, while the spatial derivatives are still computed analytically. Non-Linear Terms: Solving Example • Transform dependent variables to spectral space • Calculate spatial derivative in spectral space • Inverse transform variable and its spatial derivative • Compute non-linear term via multiplication • Transform the product back to spectral space • Integrate tendency equation for spectral coefficients Non-Linear and Local Forcing Terms • Local forcing terms are computed similarly – inverse transform the needed fields to physical space, compute the forcing, then transform to spectral space • These ideas are expanded upon and applied to current global NWP models on pg. 45 of the text. Truncation • We limit the number of waves comprising the analytical expressions for the dependent variables. • Why? Computational power is limited and there is not the data to represent all fields on the smallest scales. • The limiting of the number of waves, in both the zonal and meridional directions, is known as truncation. Truncation • The chosen truncation determines the form that N(m) takes in our Fourier-Legendre spectral function. • Two predominant types of truncation… – Triangular: N(m) = K • Number of zonal waves is equal to the number of meridional waves. • Spectral resolution uniform across the globe and in each direction. – Rhomboidal: N(m) = |m| + K • Number of meridional waves is greater than the number of zonal waves by a constant value. • Higher spectral resolution near the poles; varies between zonal and meridional directions. Truncation K -K K K -K K • Triangular: n = |m| -> K • Rhomboidal: n = |m| -> |m| + K • Prove to yourself: choose an m and find the n above. Truncation • Aliasing issues with the wave-like structures may arise if the spectral transform grid is not carefully defined. • For alias-free solutions, – Zonal grid points: 3N+1 – Meridional points: (3N+1)/2 triangular, 5N/2 rhomboidal – Points equally spaced in zonal, not in meridional direction Truncation • Why do we need a spectral transform grid? – Initial data are in physical, not spectral space. – Data in spectral space are not physically interpretable. • But, we moved to spectral space to avoid issues with latitude-longitude grids! – – – – Need to address: use a “reduced” Gaussian grid Reduces grid points near the poles Leads to error in calculation of non-linear terms, however Error minimized via knowledge of underlying mathematics Truncation • There are various ways of assessing model resolution in spectral space (i.e., L1 -> L4 in the text). • All of these methods relate directly to the radius of the Earth (a) and number of waves (K). • Example in the text: T799 (triangular w/ 799 waves)… – Equivalent grid spacings of 16.7 -> 35.4 km – All because of varying interpretations of spectral resolution! Advantages of Spectral Models • No spatial truncation error from finite difference approximations for spatial derivatives. • No non-linear instability (addressed later). • Minimal need for numerical diffusion (addressed later). • Easy to implement appropriate time differencing schemes. Shortcomings of Spectral Models • Discontinuous / local fields and non-linear terms must be or are best computed in physical space. • Not necessarily mass or energy conserving. • At higher resolutions, spectral models are more computationally expensive than grid point models. • Possibility of spurious waves and forecast degradation developing due to the representation of dependent fields by a linear superposition of waves.