Finite Difference Methods

Slides:



Advertisements
Similar presentations
Courant and all that Consistency, Convergence Stability Numerical Dispersion Computational grids and numerical anisotropy The goal of this lecture is to.
Advertisements

Formal Computational Skills
Running a model's adjoint to obtain derivatives, while more efficient and accurate than other methods, such as the finite difference method, is a computationally.
Boyce/DiPrima 9th ed, Ch 2.8: The Existence and Uniqueness Theorem Elementary Differential Equations and Boundary Value Problems, 9th edition, by William.
Computational Modeling for Engineering MECN 6040
Chapter 8 Elliptic Equation.
(c) MSc Module MTMW14 : Numerical modelling of atmospheres and oceans Staggered schemes 3.1 Staggered time schemes.
RAMS/BRAMS Basic equations and some numerical issues.
Lecture IV of VI (Claudio Piani) 3D N-S equations: stratification and compressibility, Boussinesq approximation, geostrophic balance, thermal wind.
MATH 685/ CSI 700/ OR 682 Lecture Notes
Numerical Uncertainty Assessment Reference: P.J. Roache, Verification and Validation in Computational Science and Engineering, Hermosa Press, Albuquerque.
Total Recall Math, Part 2 Ordinary diff. equations First order ODE, one boundary/initial condition: Second order ODE.
PART 7 Ordinary Differential Equations ODEs
Chapter 8 Coordinate Systems.
Lecture 2: Numerical Differentiation. Derivative as a gradient
Atms 4320 Lab 2 Anthony R. Lupo. Lab 2 -Methodologies for evaluating the total derviatives in the fundamental equations of hydrodynamics  Recall that.
Ch 5.1: Review of Power Series
Lecture 7 Exact solutions
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Numerical Methods for Partial Differential Equations
Ordinary Differential Equations (ODEs)
Basic Concepts of Numerical Weather Prediction 6 September 2012.
Introduction to Numerical Weather Prediction 4 September 2012.
SOLUTION FOR THE BOUNDARY LAYER ON A FLAT PLATE
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Boyce/DiPrima 9th ed, Ch 8.4: Multistep Methods Elementary Differential Equations and Boundary Value Problems, 9th edition, by William E. Boyce and Richard.
Lecture 35 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
Tutorial 5: Numerical methods - buildings Q1. Identify three principal differences between a response function method and a numerical method when both.
Finite Differences Finite Difference Approximations  Simple geophysical partial differential equations  Finite differences - definitions  Finite-difference.
© Arturo S. Leon, BSU, Spring 2010
Erin Catto Blizzard Entertainment Numerical Integration.
PTT 204/3 APPLIED FLUID MECHANICS SEM 2 (2012/2013)
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Finite Element Method.
Applied NWP [1.2] “Once the initialization problem was resolved in the 1960s, models based on the primitive equations gradually supplanted those based.
1 EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu
Comparison of convective boundary layer velocity spectra calculated from large eddy simulation and WRF model data Jeremy A. Gibbs and Evgeni Fedorovich.
A cell-integrated semi-Lagrangian dynamical scheme based on a step-function representation Eigil Kaas, Bennert Machenhauer and Peter Hjort Lauritzen Danish.
A particle-gridless hybrid methods for incompressible flows
1 LES of Turbulent Flows: Lecture 12 (ME EN ) Prof. Rob Stoll Department of Mechanical Engineering University of Utah Spring 2011.
Integration of 3-body encounter. Figure taken from
3.3.3: Semi-Lagrangian schemes AOSC614 class Hong Li.
CFD Refinement By: Brian Cowley. Overview 1.Background on CFD 2.How it works 3.CFD research group on campus for which problem exists o Our current techniques.
Sensitivity Analysis of Mesoscale Forecasts from Large Ensembles of Randomly and Non-Randomly Perturbed Model Runs William Martin November 10, 2005.
The status and development of the ECMWF forecast model M. Hortal, M. Miller, C. Temperton, A. Untch, N. Wedi ECMWF.
Boundary Value Problems l Up to this point we have solved differential equations that have all of their initial conditions specified. l There is another.
Engineering Analysis – Computational Fluid Dynamics –
MECN 3500 Inter - Bayamon Lecture 9 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
CIS888.11V/EE894R/ME894V A Case Study in Computational Science & Engineering We will apply several numerical methods to find a steady state solution of.
Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory # Discretization Methods Topics Equations and The Goal Brief overview.
Discretization for PDEs Chunfang Chen,Danny Thorne Adam Zornes, Deng Li CS 521 Feb., 9,2006.
Lecture 40 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
ECE 576 – Power System Dynamics and Stability Prof. Tom Overbye Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Boyce/DiPrima 9 th ed, Ch 11.3: Non- Homogeneous Boundary Value Problems Elementary Differential Equations and Boundary Value Problems, 9 th edition, by.
Deutscher Wetterdienst Flux form semi-Lagrangian transport in ICON: construction and results of idealised test cases Daniel Reinert Deutscher Wetterdienst.
Lecture 39 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
The story so far… ATM 562 Fovell Fall, Convergence We will deploy finite difference (FD) approximations to our model partial differential equations.
Time Integration Schemes Bill Skamarock NCAR/MMM 1.Canonical equations for scheme analyses. 2.Time-integration schemes used in NWP models.
Regional Weather and Climate Modeling:
NUMERICAL ANALYSIS I. Introduction Numerical analysis is concerned with the process by which mathematical problems are solved by the operations.
Lecture 4: Numerical Stability
Convergence in Computational Science
Class Notes 19: Numerical Methods (2/2)
Finite Volume Method for Unsteady Flows
Topic 3 Discretization of PDE
Objective Numerical methods Finite volume.
Topic 3 Discretization of PDE
Topic 8 Pressure Correction
Topic 3 Discretization of PDE
Presentation transcript:

Finite Difference Methods 18-20 September 2012

Thematic Outline Methods for computing temporal finite differences Methods for computing spatial finite differences Applications of grid staggering Impacts of truncation error that arises from the finite difference approximations

Temporal Finite Differences Note: the temporal differencing methods to be discussed apply to grid-point and spectral models. Two types of time differencing schemes… Explicit: all future time terms appear on one side of an equation Implicit: future time terms appear on both sides of an equation Hybrid explicit/implicit schemes also exist. Explicit differences can be solved directly; implicit differences must be solved iteratively.

Explicit Temporal Differences Two methods… Single step (forward and centered differences) Multiple step (predictor-corrector methods) Single step example, centered difference: where f is some dependent field (u, v, T, etc.) and F is the forcing on that field

Explicit Temporal Differences Single step example, forward-in-time difference: Let us consider these in the context of a real-world example, a one-dimensional advection equation…

Explicit Temporal Differences Centered difference: Forward-in-time difference: Note: in both cases, we applied a second-order centered finite difference in space. We’ll discuss this method further shortly.

Explicit Temporal Differences In predictor-corrector schemes, a prediction for the dependent field at some future time is first made using some finite difference approximation. From this, the forcing at that future time is obtained, whether from finite difference or spectral methods. That forcing is then used, often with a forward-in-time difference, to integrate to the next time.

Explicit Temporal Differences Example: Runge-Kutta type scheme… Predict: With f*, obtain F*. With fτ, obtain Fτ. Correct: Predictor-corrector methods provide superior accuracy at the expense of efficiency.

Explicit Temporal Differences Issue: acoustic and other fast-moving waves These waves require small time steps to maintain computational stability in the advection terms (CFL) If not filtered, how to handle need for a small time step? Potential method: split-explicit schemes Small ∆t for terms representing fast-moving waves Large ∆t for terms representing slower-moving waves Reduces number of computations on short time steps Commonly used with current mesoscale model systems

Implicit Temporal Differences In explicit schemes, the forcing terms (spatial derivatives) are evaluated only at the initial time t. In implicit schemes, these terms are evaluated at the future time t+1 and the initial time t. In other words, they are valid at t+1/2. Thus, terms at t+1 appear on both sides of the equation and the time derivative must be solved iteratively.

Implicit Temporal Differences Let us again consider the example of a one-dimensional advection equation… Explicit, forward-in-time approximation: Instead of representing the spatial derivative exclusively at t=t, let us represent it as the average of its values at the initial (t) and future (t+1) times…

Implicit Temporal Differences Spatial finite difference approximation: If we substitute and apply a second-order centered spatial finite difference, this gives us equation (3.21),

Implicit Temporal Differences Advantage: implicit schemes are typically unconditionally stable CFL criterion for advection terms is thus not a concern Enables us to use a longer time step to handle all waves Disadvantage: iterative nature requires more computations per time step than explicit schemes Longer time step savings < iterative computational expense

Implicit Temporal Differences To alleviate these issues, semi-implicit methods may be used. Meteorological terms: handled explicitly Non-meteorological terms: handled implicitly Alleviating the need for a small time step to maintain linear stability that arises with explicit methods. A common, long time step may be used for all terms because implicit terms are stable for all time steps. Advantage over split-explicit schemes. Iterative computational expense is still present, however.

Spatial Differencing We must first establish our frame of reference: fixed to the Earth or fixed to air parcels. Thus far, we have considered a frame of reference tied to the Earth, an Eulerian reference frame. All terms are defined and computed on a fixed grid. Example: 1-D advection equation… ∆x ∆x x-1 x x+1

Spatial Differencing But, as we’ve discussed before, the CFL criterion applies to the advection terms in this framework. Can we utilize a reference frame that encompasses the advection terms and eliminates this issue? Yes – if we use a reference frame tied to the motion (i.e., fixed to air parcels)!

Spatial Differencing Such a reference frame is known as a Lagrangian reference frame. Because Lagrangian methods follow air parcels, the spatial and vertical resolutions of the model are flow-dependent. Finer resolution is found in convergent regions. Coarser resolution is found in divergent regions. This is not ideal.

Spatial Differencing Alternative: semi-Lagrangian methods In a Lagrangian framework, only one set of parcels is followed, but is followed over all time steps. In a semi-Lagrangian framework, a new set of parcels (defined by the chosen grid) is followed at each time step. Parcels are followed utilizing parcel trajectories. Either forward or backward trajectories may be used. The spatial derivatives (advection terms) are implicitly accounted for by the along-trajectory evolution. The bold & italic statement is important to note here. Our finite difference representations to come will look a lot like temporal differences, and yet they implicitly account for the spatial differences (advection terms) as well!

Semi-Lagrangian Differencing Example: forward trajectories Evenly-spaced grid (black) is defined at t=t. Trajectories (red lines) are released from each grid point and followed forward in time to t=t+1 (red dots). Non-advection terms in the primitive equations change the values of atmospheric fields along the trajectories. The values of these fields at t=t+1 are then interpolated back to a uniform grid and the process repeated. x-1 x x+1

Semi-Lagrangian Differencing Example: backward trajectories Evenly-spaced grid (black) is defined at t=t+1. Trajectories (red lines) are released from each grid point and followed backward in time to t=t (red dots). Non-advection terms in the primitive equations change the values of atmospheric fields along the trajectories. Need to interpolate from evenly-spaced grid valid at t=t to obtain this forcing. But, no interpolation needed for t=t+1 – already on uniform grid! x-1 x x+1

Semi-Lagrangian Differencing Backward trajectory methods are preferred. Easier to interpolate from evenly-spaced grids to non-gridded trajectory locations than the inverse. But, how can we represent the example on the previous slide numerically (and not just graphically)?

Semi-Lagrangian Differencing Imagine a two-dimensional grid, as below, at t=t+1. Our parcel location at this time is given by (i,j). (i,j)

Semi-Lagrangian Differencing The backward trajectory from (i,j) is given by the red line. The parcel locations at t=t-1 (x) and t=t (+) are noted in blue. X + (i,j)

Semi-Lagrangian Differencing Let the location of X be and the location of + be . X + (i,j)

Semi-Lagrangian Differencing Let the dependent variable in question be given by f and the forcing by F. We want ft+1 and know ft-1 and ft by interpolation between grid points at the previous times. F is computed locally using Eulerian finite difference methods and then interpolated between grid points. The finite difference can then be explicit or implicit.

Semi-Lagrangian Differencing Explicit: recall our centered-in-time difference... The values of ft+1, ft-1, and Ft are taken at their locations along the trajectory, i.e.,

Semi-Lagrangian Differencing Implicit: a generic example can be expressed as... As for the explicit case, the values of ft+1, ft, Ft+1, and Ft are taken at their locations along the trajectory,

Semi-Lagrangian Differencing Advantages of semi-Lagrangian schemes... Loss of advection terms eliminates CFL criterion, enabling the usage of a longer time step. Can be used for either grid point or spectral methods. Can also be used with semi-implicit differencing schemes. Minimizes non-linear instability (to be discussed soon). Disadvantage of semi-Lagrangian schemes… Not energy or mass conserving (a particular problem over long model integrations)

Grid Staggering For some applications, it can be useful to define our dependent variables on two slightly offset grids. This is known as grid staggering. Both horizontal and vertical grid staggering are possible. A typical staggering increment is ½ the grid interval. Which variables apply to each grid depends upon the desired computational characteristics.

simple 1-D example for u and θ Grid Staggering simple 1-D example for u and θ (a): must use θj+1 and θj-1 (over 2∆x) to compute a centered finite difference (b): can use θj+½ and θj-½ (over ∆x) to compute a centered finite difference Staggering halves the effective grid increment and minimizes the impacts of truncation error on the solution.

Grid Staggering There are many examples of staggered grids in current NWP models. Arakawa C-grid: mass variables staggered from kinematic variables; used in WRF-ARW model

Grid Staggering Other staggers… Arakawa B-grid: akin to C grid, but with mass and kinematic variables staggered on grid centers and corners rather than grid centers and sides Arakawa E-grid: akin to C grid, except rotated 45° These grids are used by the MM5/NMM-B and WRF-NMM mesoscale models, respectively.

Grid Staggering Grid staggering increases effective resolution but does not increase the number of grid points. Increase in effective resolution requires a smaller time step to meet CFL criterion. Only if Eulerian differencing methods are used, however. Recall: as ∆x decreases, Courant number increases. The benefit from reduced truncation error outweighs time step considerations, however.

Truncation Error Many of the primitive equations are differential equations with partial derivative terms. If we utilize grid point methods, these terms must be approximated with finite differences. These approximations introduce error, however, depending upon their complexity. This error is known as truncation error.

Finite Difference Approximations First, however, it is useful to revisit how finite difference approximations are obtained. Any function over an interval – i.e., a partial derivative – can be approximated by a Taylor series. Generally, for a function in x,

Finite Difference Approximations Expanded to several terms, we obtain (3.24), Here, a is our point of interest and x is some point of reference. R is a residual term representing the error.

Finite Difference Approximations This equation is used to obtain finite difference approximations for the function f. The accuracy of each approximation is dependent upon the highest power/order terms retained in the equation. Retain higher order terms: increased accuracy. Keep only lower order terms: decreased accuracy.

Finite Difference Approximations Example: first order / two point, forward in space Let x = a+∆x and truncate 2nd order and higher terms… Solve for the derivative…

Finite Difference Approximations Example: first order / two point, backward in space Let x = a-∆x and truncate 2nd order and higher terms… Solve for the derivative… First order schemes are typically not used, however, because they have large truncation errors.

Finite Difference Approximations Example: second order / three point, centered Let x = a+∆x and truncate 3nd order and higher terms… Let x = a-∆x and truncate 3nd order and higher terms…

Finite Difference Approximations Subtract the 2nd equation from the first… Solve for the first derivative…

Finite Difference Approximations A five point / 4th order approximation is given by… where the two closest points on each side of a are used in the calculation of the derivative. Any of these – or even higher-order – expressions may be used in numerical models to compute spatial derivatives in physical / grid-point space.

Truncation Error Example: let f be a function for which the derivative is exactly known and compare that result to the finite difference approximations. As in the text, let f = A cos kx, where k = 2π/L and L is the wavelength. Analytic Centered Difference

Truncation Error The ratio of the approximation to the exact value gives the truncation error, where a value of 1 indicates no error. As in the text, trig identities can be used to show: Since k = 2π/L, this ratio varies with ∆x and L.

Truncation Error How does this ratio vary with ∆x and L? If L is fixed (e.g., depicting some meteorological feature), as ∆x -> 0, ∆x/L -> 0. As ∆x/L -> 0, k∆x -> 0. By identity, as k∆x -> 0, sin (k∆x) -> k∆x. Thus, for small ∆x (fine grid spacing), the ratio approaches 1 and the truncation error is small (i.e., the wave is well-resolved).

Truncation Error If n = # of grid points, then L = n∆x.

Truncation Error As ∆x gets smaller, n gets larger (for fixed L). Ratio asymptotes to 1 as n increases.

Truncation Error As L gets smaller, n gets smaller (for fixed ∆x). Ratio asymptotes to 1 (0) for very large (small) waves.

Truncation Error Let’s consider a practical example. Let f = A cos kx represent a ridge-trough pattern. If L = 1000 km, what ∆x is needed for n = 10 (i.e., fairly small truncation error)? Since L = n∆x, ∆x = L/n = 1000 km / 10 = 100 km. Similarly, if L = 50 km (e.g., mesohigh-wake low), we need ∆x = 5 km for n = 10.

Truncation Error Thus, to reasonably “resolve” a wave of length L, you need a horizontal grid spacing of at most L/10. Ideally, you want an even-finer grid spacing to better resolve the wave and minimize truncation error. Similar arguments can be made in the inverse to describe the wave(s) that can be resolved for a given horizontal grid spacing.

Grid Spacing Versus Resolution Grid spacing and resolution are NOT interchangeable! Resolution: defined by the wave that the model can resolve for a given grid spacing. The resolution depends upon the grid spacing, yes, but also upon the accuracy of the finite difference approximation used (if using grid point methods). Better approximation -> less error -> finer resolution

Truncation Error Consider n=6… 4th order X X 2nd order

Truncation Error The ratio does not approach 0.96 for the 2nd order scheme until beyond the limits of the chart. Thus, if simpler finite difference methods are desired, many more grid points n (smaller ∆x) are/is needed to achieve an acceptable truncation error!

Truncation Error With either 4th or 2nd order schemes, the error is still unacceptably large at small scales (n<5). We’ll discuss how we can deal with this later. Errors end up manifest in all fields that evolve depending upon gradients… Geostrophic wind (pressure gradient) Advection terms (kinematic gradients) Vertical motion from continuity (kinematic gradients) …and grow upscale and with increasing time!

Truncation Error: Take-Home Points Must consider the length of feature to be resolved. Must consider the # of grid points (or grid spacing) needed to resolve that feature. Must consider the error inherent to the desired finite difference approximation to be used. Aside: this is partially why spectral modeling evolved, but that has its own unique issues that creep up…