Reduction of Temporal Discretization Error in an Atmospheric General Circulation Model (AGCM) Daisuke Hotta Advisor: Prof. Eugenia Kalnay Dept. of Atmospheric and Oceanic Science, University of Maryland, College Park
Numerical Weather Prediction (NWP): = Initial Value Problem of PDE Atmospheric Phenomena Governing Equations Numerical Discretization Solve ! (Simulate) (Real Atmosphere) (from JMA website) Simulated Atmosphere from php Hydrodynamic PDE O(10 9 )-dimensional ODE from a-eng/jma-center/nwp/nwp- top.htm AGCM: Atmospheric General Circulation Model = a computer program which simulates the flow of global atmosphere by numerically integrating the governing fluid dynamical PDEs
Introduction: Motivation Due to computational restrictions … most AGCMs adopt low-order time-integration schemes, such as -Leap-frog with Robert-Asselin filter (1 st order) -Explicit Backward Euler (aka. Matsuno; 1 st order) Often, Δt is taken as the largest value for which computational instability is suppressed, under the premise that temporal discretization errors are negligible compared to those associated with spatial discretization or Physical Parameterizations.
Introduction: Motivation However … Spatial resolutions become finer and finer as the supercomputers become faster. Is the premise that time truncation errors are negligible justified ? If not, how can we alleviate such errors ? Goal of the Project: Reduction of such model errors Approaches : Phase 1: Use a more accurate scheme with the same computational cost Phase 2: Identify and parameterize the error, and reduce it using data assimilation
Phase 1 : A Better integration scheme (Lorenz N-cycle) Lorenz (1971) proposed an incredibly smart time-integration scheme which: requires only 1 function evaluation per step but yet (every N steps) it is of - (up to) 4 th -order accuracy (for nonlinear systems) - arbitrary order of accuracy (for linear systems) However, this scheme seems to have remained forgotten. No applications have been made to AGCMs. Apply Lorenz N-cycle to an AGCM (Phase 1)
Phase 1: Approach Implement Lorenz N-cycle to an existing AGCM Implement 4 th order Runge-Kutta (RK4) as well as a reference Compare the accuracy and efficiency of the newly introduced schemes with the original scheme Perform verification by the Jablonowski- Williamson (2006) Dynamical-core Tests
Phase 1: Algorithms Lorenz N-cycle (existing) Leap-frog with Robert-Asselin Filter 4 th order Runge-Kutta Memory consumption: 2 x dim{model state} Memory consumption: 2 x dim{model state} Memory consumption: 5 x dim{model state} F-evaluation: 1 per time step F-evaluation: 4 per time step accuracy: (N <= 4) O((NΔt) N ) (every N steps) O(NΔt ) (in between) accuracy: O(Δt ) accuracy: O(Δt 4 ) ODE to be solved:
AGCM: SPEEDY model A fast AGCM with simplified physical parameterizations Developed in ICTP (Italy) by Drs. F. Molteni and F. Kucharski Horizontal Discretization: Spectral Representation with Spherical Harmonics truncated at total wavenumber 30 (T30) ≈ 400km mesh Vertical Discretization: 8-layers Finite Difference on σ-coordinate Temporal Discretization: Leap-Frog scheme with Robert-Asselin Filter (1 st order Forward Euler for the physical parameterizations)
The equations solved: the “primitive” equation system (PDEs) on a spherical geometry + parametrized processes Dynamical Core ….. Sub-grid Parametrizations
AGCM: SPEEDY model Language: Fortran77 Platform: Any machine which supports Fortan77 compiler (a Linux server will be used in this study) Code statistics: 10,000 lines, 73 files # predicted variables: Implementation to be made: Add new subroutines for N-cycle and RK4 schemes (for validation) Add an Option to Switch-off Physical Parameterizations Add an Option to run with flat orography
Achievements of the semester 1.Implementation of Lorenz N-cycle and RK4 schemes to SPEEDY 2.Code Validations 3.Options for the Dynamical-Core tests (=Verification) 4.Results of the Dynamical-Core tests (=Verification) 5.Several Formulations of Semi-implicit scheme and their stability analysis tested with toy models
Code Validation: Idea Lorenz N-cycle: – Lorenz 1-cycle is equivalent to Forward Euler, which is built-in in the SPEEDY model. – Compare Lorenz 1-cycle with Forward Euler. RK4 : – For a linear system, RK4 with 4Δt is equivalent to Lorenz 4-cycle with Δt. – Remove all nonlinear terms from SPEEDY and Compare RK4 (4Δt) with Lorenz 4-cycle (Δt).
Code Validation: Results Outputs of single step integrations of Lorenz 1- cycle and Forward Euler from the same initial condition are compared using UNIX diff command. – Result no difference (Success)! Similarly, outputs of single step integration of RK4 and four-step integration of Lorenz 4-cycle from the same initial condition are compared using UNIX diff command. – Result no difference (Success)!
Verification: Dynamical-Core test cases Standardized tests for dynamical cores of AGCM proposed by Jablonowski and Williamson (2006) which consists of two tests: 1.Steady-State test: – A model is integrated from an analytical steady-state solution of the primitive equation – The model evaluated by how well it can keep the steady- state intact. 2.Baroclinic-Wave test: – The model is integrated with initial and boundary conditions which is designed to produce an idealized baroclinic wave (= extratropic cyclones and highs)
Baroclinic-wave Test: Result (Lorenz 4-cycle)
Snapshots of surface-pressure at Day 9 Hi-res. reference solution Leapfrog (dt=20min) Leapfrog (dt=1min) RK4 (dt=1min) N-cycle (dt=20min)
Quantitative Comparison: RMSE of surface pressure (vs. RK4) Time(Days)
Deliverables (Phase 1) Upgraded code for SPEEDY model – subroutines for Lorenz N-cycle – 4 th order Runge-Kutta Test-case results for the SPEEDY model (both for the original scheme and the new schemes) ✔ ✔ ✔
Schedule and Milestones Phase 1: Implement RK4 and N-cycle, Nov. Write the mid-year report, prepare the oral presentation, Dec. Switch-off physical parameterizations, prepare flat topography, Jan. perform the dynamical core tests. Feb. Phase 2: Generate initial values from the NCEP/NCAR reanalysis, end of Feb. build the bias and covariance matrix, Mar. Code and test a program for SVD, Apr. Compare the model errors for the new and the original shcemes, May. Write the final report (paper draft), May. ✔ ✔ ✔ ✔
Unexpected Problem: N-cycle, RK4 and Euler-forward blow up when physical parameterizations are on Temperature Vorticity Divergence RK4 N-cycle Leapfrog
(Possible) Modification to the Plan The original plan for the Phase 2 is to identify and correct model errors of N-cycle SPEEDY with physics, using NCEP/NCAR reanalysis as truth which is impossible if N-cycle with physics blows up. Plan: – Continue working on the issue with physics for one more month. – If the issue is fixed, then continue Phase 2 as planned. – If not, modify the Phase 2: Use RK4 without physics as Truth. Try to identify and correct model errors of N-cycle without physics.
Summary Implemented and tested Lorenz N-cycle and RK4 for the SPEEDY AGCM Code validation was successful Verification with the Dynamical Core test confirmed that Lorenz N-cycle is much more accurate than the conventional Leapfrog. However, SPEEDY with full physics blows up if the temporal discretization is Lorenz N-cycle, RK4 or forward Euler (i.e. anything other than leapfrog). Modification to the Phase 2 may be in order.
Bibliography Lorenz N-cycle Lorenz, Edward N., 1971: An N-cycle time-differencing scheme for stepwise numerical integration. Mon. Wea. Rev., 99, 644–648. SPEEDY model Molteni, Franco, 2003: Atmospheric simulations using a GCM with simplified physical parameterizations. I. Model climatology and variability in multi-decadal experiments. Clim. Dyn., 20, Kucharski F, Molteni F, and Bracco A, 2006: Decadal interactions between the western tropical Pacific and the North Atlantic Oscillation. Clim. Dyn., 26, SPEEDY-LETKF Miyoshi, T., 2005: Ensemble Kalman filter experiments with a primitive-equation global model. Ph.D. dissertation, University of Maryland, College Park, 197pp. Atmospheric GCM Dynamical Core test cases Jablonowski, C. and D. L. Williamson 2006: A baroclinic instability test case for atmospheric model dynamical cores, Q. J. R. Metorol. Soc., 132, NCEP/NCAR reanalysis Kalnay, E., and Coauthors, 1996: The NCEP/NCAR 40-Year Reanalysis Project. Bull. Amer. Meteor. Soc., 77, 437–471. Model Error Correction Danforth, Christopher M., Eugenia Kalnay, Takemasa Miyoshi, 2007: Estimating and Correcting Global Weather Model Error. Mon. Wea. Rev., 135, 281–299. Danforth, Christopher M., Eugenia Kalnay, 2008: Using Singular Value Decomposition to Parameterize State- Dependent Model Errors. J. Atmos. Sci., 65, 1467–1478.
back-up slides
Lorenz N-cycle with semi-implicit integration
Motivation For a practical AGCM, semi-implicit treatment of fast inertia-gravity wave is indispensable to allow for a large time stepping. Semi-implicit treatment “unlocks” CFL constraint associated with the fast waves. However, for some schemes (including Forward Euler or 3 rd -order Adans-Bashforth), semi-implicit treatment does not help stabilize integration Examine the stability for Lorenz N-cycle
Method Following Durran (1991, 1999; MWR) and Williamson (2011; MWR), apply semi-implicit modification to the second term of the equation: Examine the modulus of Amplification factor A. If |A| < 1, the scheme is stable. Range of interest: i.e., CFL condition is met for low-frequency part but is violated for high-frequency part.
Approach 1: Semi-implicit correction on every time step Algorithm By choosing β=1/2 (Crank-Nicolson), the scheme becomes second-order Truncation Error:
Plots of |A|-1 (β=1/2: Crank-Nicolson) Leapfrog with R/A filter: Stable almost everywhere Lorenz 1-cycle (=Forward Euler): Unstable everywhere Lorenz 2-cycle: Unstable everywhere Lorenz 3-cycle: Absolutely Unstable for > 1.5 Lorenz 4-cycle: Absolutely Unstable for > 2.7 Stable Unstable Stable Unstable
Plots of |A|-1 (β=1: Backward Euler) Ref: Leapfrog+R/A filter Lorenz 1-cycle (=Forward Euler): Lorenz 2-cycle: Lorenz 3-cycle: Lorenz 4-cycle: Stable Unstable Stable Unstable Stable Unstable Stable Unstable Stable Stability is good, but damping is too strong ( 50%)
Approach 2: Semi-implicit correction on every N time steps Algorithm The scheme is only 1 st order, even for β=1/2 (Crank-Nicolson) Stability is also horrible (not shown) Truncation Error:
After trial and errors, I found that the following algorithm: gives the truncation error which, for β=1/2, makes the scheme 2 nd order.
Plots of |A|-1 (β=1/2: Crank-Nicolson) Reference: Leapfrog wirh R/A filter Lorenz 1-cycle (=Forward Euler): Unstable everywhere Lorenz 2-cycle: Unstable everywhere Lorenz 3-cycle: Stable for < 0.5 Stable Unstable Stable Unstable Lorenz 4-cycle: Stable for < 0.7
Stability for larger N Stable Unstable Stable Unstable 5-cycle: stable only in the band 0.4< < cycle: everywhere unstable 7-cycle: stable only for < cycle: stable only for < cycle: stable only in the band 0.2< < 0.5
Phase error (β=1/2: Crank-Nicolson) Reference: Leapfrog wirh R/A filter Lorenz 3-cycleLorenz 4-cycle
Swinging-pendulum problem A simple nonlinear test-bed for semi-implicit schemes. Fast oscillation = elastic spring Slow oscillation = pendulum Fast mode is treated implicitly, slow mode explicitly. For this test, I use Δt=0.075 which gives ω LOW Δt=0.225, ω HIGH Δt=2.25, From Williams (2011)
Leapfrog with RA filter (α=0.01) RK4 with Δt= Leapfrog θ η Energy
4-cycle with semi-implicit correction on every 4 steps (Crank-Nicolson) θ η Energy RK4 with Δt= Leapfrog
4-cycle with semi-implicit correction on every 4 steps (Backward) stable but very dissipative θ η Energy RK4 with Δt= Leapfrog
4-cycle with semi-implicit correction on every time step unstable θ η Energy RK4 with Δt= Leapfrog
Explicit 4-cycle unstable θ η Energy RK4 with Δt= Leapfrog
Summary Consistent with the linear analysis, N-cycle with semi-implicit on each time step unstable N-cycle with semi-implicit on every N steps Crank-Nicolson: stable, but comparable accuracy with Leapfrog Backward Euler: stable, very dissipative
Reference: Williams, P. D. 2011: The RAW Filter: An Improvement to the Robert–Asselin Filter in Semi-Implicit Integrations, Mon. Weath. Rev., 139,
Runge-Kutta 4 th -order scheme with semi-implicit correction
Introduction I implemented semi-implicit Runge-Kutta 4 th -order scheme to SPEEDY model and found that – for Crank-Nicolson, the model blows up, even for very small dt (1min). – for Backward Euler, the model is too diffusive that the baroclinic-wave dynamical core test fails to produce the baroclinic wave. Explicit Runge-Kutta 4 th -order scheme with small dt (5min) works fine for the dynamical core test. examine stability using the toy-model
Method Following Durran (1991, 1999; MWR) and Williamson (2011; MWR), apply semi-implicit modification to the second term of the equation: Examine the modulus of Amplification factor A. If |A| < 1, the scheme is stable. Range of interest: i.e., CFL condition is met for low-frequency part but is violated for high-frequency part.
Algorithm: RK4 for ω L, Crank-Nicolson for ω H Truncation Error: the accuracy is only 1 st order
Plot of |A|-1 β=1/2: Crank-Nicolson -> Absolutely unstable β=1: backward Euler -> Absolutely stable,but extremely dissipative
Summary Runge-Kutta 4 th -order scheme with semi- implicit time is – only of first order (with respect to fast modes) – absolutely unstable if Crank-Nicolson is used – absolutely stable if Backward Euler is used, but the numerical damping is too strong (more than halving on every time step) all of the above are consistent with what I found for the SPEEDY model.
Conclusion Runge-Kutta 4 th -order scheme with semi-implicit time-stepping for gravity waves is impossible (either unstable or too dissipative) The accuracy becomes only of 1 st order. Since the motivation for implementing Runge- Kutta 4 th -order scheme is to produce a reference solution, I will not try to resolve this issue, and use the explicit scheme with small dt.
Stability analysis of Forward Euler “split physics” for Leapfrog, Lorenz 4-cycle and RK4
Toy model: linear advection-diffusion equation Undiscretized equation: The first term of the RHS simulates the dynamics of AGCM, and the second the physics.
Discretization: Leapfrog(dyn) + Euler(phys) Discretized equation: The amplification factor A satisfies the following equation: (+) and (-) correspond, respectively, to physical and computational modes. The scheme is stable if the maximum of the moduli of them is less than 1.
Discretization: Leapfrog for both dyn & phys Discretized equation: The amplification factor A satisfies the following equation: (+) and (-) correspond, respectively, to physical and computational modes. The scheme is stable if the maximum of the moduli of them is less than 1.
Discretization: Lorenz 4-cycle (dyn) + Euler(phys) Discretized equation: Amplification factor (per time step):
Discretization: Lorenz 4-cycle for both dyn & phys Discretized equation: Amplification factor (per time step):
Discretization: RK4(dyn) + Euler(phys) Discretized equation: Amplification factor :
Discretization: RK4 for both dyn&phys Discretized equation: Amplification factor (per time step):
Leapfrog: “split physics” stabilizes the otherwise absolutely unstable scheme Leapfrog for both dyn & phys: absolutely unstable Leapfrog (dyn) + Euler (phys): Stable within the triangle unstable stable
Lorenz 4-cyle: “split physics” destabilizes the scheme Lorenz 4-cycle for dyn & phys: absolutely unstable L4-cycle (dyn) + Euler (phys): Stable within the triangle unstable stable unstable stable
RK4: again, “split physics” destabilizes the scheme unstable stable unstable stable RK4 for dyn & phys: absolutely unstable RK4 (dyn) + Euler (phys): Stable within the triangle
Summary For leapfrog, doing “split physics” works very well (stabilizes the scheme) However, for Lorenz 4-cycle (and equivalently, for RK4), “split physics” acts to destabilized the scheme. The latter is consistent with what I found by doing “split physics” with SPEEDY model.
Next to do I found that “symmetric splitting” semi- implicit scheme significantly stabilizes Lorenz N-cycle. Analogously, there is a hope that doing “symmetric splitting” for physics may help stabilized the model. Examine this possibility with the “Toy model” and SPEEDY.