Adjoint Models as Analytical Tools Dr. Ronald M. Errico Goddard Earth Sciences and Technology Center (UMBC) Global Modeling and Assimilation Office (NASA) Outline 1. Sensitivity analysis: The basis for adjoint model applications 2. Examples of adjoint-derived sensitivity 3. Code construction: an example 4. Nonlinear validation 5. Efficient solution of optimization problems 6. Adjoint models as paradigm changers 7. Singular vectors 8. Observation sensitivity 9. Other applications 10. Other considerations 11. Summary Sensitivity Analysis: The basis for adjoint model applications Impacts vs. Sensitivity xi xj Adjoint Sensitivity Analysis Impacts vs. Sensitivities A single impact study yields exact response measures (J) for all forecast aspects with respect to the particular perturbation investigated. A single adjoint-derived sensitivity yields linearized estimates of the particular measure (J) investigated with respect to all possible perturbations. Examples of Adjoint-Derived Sensitivities Example Sensitivity Field Errico and Vukicevic 1992 MWR Contour interval 0.02 Pa/m M=0.1 Pa/m Lewis et al. 2001 J=average surface pressure in a small box centered at P From Errico and Vukicevic 1992 J=barotropic component of vorticity at point P Development of Adjoint Model From Line by Line Analysis of Computer Code Development of Adjoint Model From Line by Line Analysis of Computer Code Development of Adjoint Model From Line by Line Analysis of Computer Code Parent NLM : TLM : Y = X * (W**A) Z=Y*X Ytlm = Xtlm * (W**A) + Wtlm *A* X *(W**(A-1)) Ztlm = Ytlm * X + Xtlm * Y Xadj = Xadj + Zadj * Y Yadj = Yadj + Zadj * X Adjoint : Xadj = Xadj + Yadj * (W**A) Wadj = Wadj + Yadj * X *(W**(A-1)) Development of Adjoint Model From Line by Line Analysis of Computer Code Parent NLM : TLM : Y = X * (W**A) Z=Y*X Ytlm = Xtlm * (W**A) + Wtlm *A* X *(W**(A-1)) Ztlm = Ytlm * X + Xtlm * Y Xadj = Xadj + Zadj * Y Yadj = Yadj + Zadj * X Adjoint : Xadj = Xadj + Yadj * (W**A) Wadj = Wadj + Yadj * X *(W**(A-1)) Development of Adjoint Model From Line by Line Analysis of Computer Code Automatic Differentiation TAMC Ralf Giering (superceded by TAF) TAF FastOpt.com ADIFOR Rice University TAPENADE INRIA, Nice OPENAD Argonne Others www.autodiff.org See http://imgi.uibk.ac.at/MEhrendorfer/ work_7/present/session3/giering.pdf Development of Adjoint Model From Line by Line Analysis of Computer Code 1. 2. 3. 4. 5. 6. TLM and Adjoint models are straight-forward to derive from NLM code, and actually simpler to develop. Intelligent approximations can be made to improve efficiency. TLM and (especially) Adjoint codes are simple to test rigorously. Some outstanding errors and problems in the NLM are typically revealed when the TLM and Adjoint are developed from it. It is best to start from clean NLM code. The TLM and Adjoint can be formally correct but useless! Nonlinear Validation Does the TLM or Adjoint model tell us anything about the behavior of meaningful perturbations in the nonlinear model that may be of interest? Linear vs. Nonlinear Results in Moist Model 24-hour SV1 from case W1 Initialized with T’=1K Final ps field shown Contour interval 0.5 hPa Errico and Raeder 1999 QJRMS Linear vs. Nonlinear Results in Moist Model Non-Conv Precip. ci=0.5mm Convective Precip. ci=2mm Non-Conv Precip. ci=0.5mm Convective Precip. ci=2mm Comparison of TLM and Nonlinearly Produced Precip Rates 12-Hour Forecasts with SV#1 NonConvective Convective. Errico et al. QJRMS 2004 Linear Nonlinear Linear Nonlinear Contours: 0.1, 0.3, 1., 3., 10. mm/day Linear vs. Nonlinear Results In general, agreement between TLM and NLM results will depend on: 1. 2. 3. 4. 5. 6. Amplitude of perturbations Stability properties of the reference state Structure of perturbations Physics involved Time period over which perturbation evolves Measure of agreement The agreement of the TLM and NLM is exactly that of the Adjoint and NLM if the Adjoint is exact with respect to the TLM. Efficient solution of optimization problems Gradient at point P Contours of J in phase (x) space P M Adjoint models as paradigm changers 100 hPa Sensitivity field for J=ps with respect to T for an idealized cyclone 500 hPa 1000 hPa From Langland and Errico 1996 MWR Bao and Errico: MWR 1997 Adjoint of Nudging Fields Contour 0.1 unit Contour 1.0 unit t=0 0.4 units t=48 hours 5.0 units Errico et al. Tellus 1993 What is the modeled precipitation rate sensitive to? Errico, Raeder, Fillion: 2003 Tellus Non-Convective Forecast Precipitation Rate Contour interval 2 cm/day Vort optimized Errico et al. 2003 Tellus Rc optimized Impacts for adjointderived optimal perturbations for forecasts starting indicated hours in the past. Rn Optimized Perturbations in Different Fields Can Produce the Same Result 12-hour v TLM forecasts Initial u, v, T, ps Perturbation Errico et al. QJRMS 2004 Initial q Perturbation Singular Vectors Gelaro et al. MWR 2000 Bred Modes (LVs) And SVs Results for Leading 10 SVs Gelaro et al. QJRMS 2002 Balance of Singular Vectors Vertical modes of the 10-level MAMS model (from Errico, 2000 QJRMS) H1 10216m H2 2060m H 7 14m Balance of Singular Vectors E=E_t, K=KE, A=APE, R=R mode E, G=G mode E A,G t=0 E,K,R t=24 hours Errico 2000 The Balance of Singular Vectors v( 0.55) T( 0.55) Initial R mode Contour 2 units Initial G mode Contour 1 unit Errico 2000 How Many SVs are Growing Ones? EM ED TM TD E-norm Moist Model E-norm Dry Model R-norm Moist Model R-norm Dry Model Singular Value Squared Errico et al. Tellus 2001 Mode Index From Novakovskaia et al. 2007 and Errico et al. 2007 Sensitivity to Observations The use of an adjoint of a data analysis algorithm Sensitivity to analyzed potential temperature at 500 hPa J = mean squared 24 hour forecast error using E-norm Sensitivity to raob temperatures at 500 hPa From Gelaro and Zhu 2006 Baker 2000 PhD. Thesis Impacts of various observing systems Totals GEOS-5 July 2005 15 NH observations 10 Observation Count (millions) 5 tw ind s sp ss mi air cra ft su rfa ce qk sw nd bs sa rao u ms s hir air s b su am -10 go es eo s_ am su a (J/Kg) am e -5 su a 0 e 0 -15 -20 15 SH observations 10 Observation Count (millions) …all observing systems provide total monthly benefit 5 From R. Gelaro -15 -20 s sp ss mi air cra ft su rfa ce qk sw nd sa tw i nd bs rao u ms go es eo s_ am su a s hir air s su b -10 am (J/Kg) am e -5 su a 0 e 0 Diagnosing impact of hyper-spectral observing systems GEOS-5 July 2005 00z Totals AMSU-A (15 ch) AIRS (153 ch) Forecast degradation -7.0 Channel Channel H2O Channels e (J/Kg) 0 -0.6 eError Forecast (J/Kg) Reduction (J/Kg)0 …some AIRS water vapor channels currently degrade the 24h forecast in GEOS-5… From R. Gelaro Other Applications 1. 2. 3. 4. 4DVAR (P. Courtier) Ensemble Forecasting (R. Buizza, T. Palmer) Key analysis errors (F. Rabier, L. Isaksen) Targeting (R. Langland, R. Gelaro) Problems with Physics Problems with Physics Consider Parameterization of Stratiform Precipitation NLM R Modified NLM TLM 0 TLM qs q Example of a failed adjoint model development Sensitivity of forecast J with respect to earlier T in lowest model model level Time= -3 hours; contour int.=0.00025 Time= -9 hours; contour int.=10000. From R. Errico, unpublished MAMS2 development Tangent linear vs. nonlinear model solutions TLM NLM 60x small pert NLM Errico and Raeder 1999 QJRMS Jacobians of Precipitation RAS scheme ECMWF scheme BM scheme Fillion and Mahfouf 1999 MWR Problems with Physics 1. The model may be non-differentiable. 2. Unrealistic discontinuities should be smoothed after reconsideration of the physics being parameterized. 3. Perhaps worse than discontinuities are numerical instabilities that can be created from physics linearization. 4. It is possible to test the suitability of physics components for adjoint development before constructing the adjoint. 5. Development of an adjoint provides a fresh and complementary look at parameterization schemes. Other Considerations Physically-based norms and the interpretations of sensitivity fields Sensitivity of J with respect to u 5 days earlier at 45ON, where J is the zonal mean of zonal wind within a narrow band centered on 10 hPa and 60ON. (From E. Novakovskaia) 0.1 hPa 1 hPa 10 hPa 100 hPa 1000 hPa - 180 0 Longitude + 180 Continuous vs. grid-point representations of sensitivity Rescaling options for a vertical grid Delta log p 1 hPa 10 hPa 100 hPa 500 hPa Delta p 850 hPa 2 Re-scalings of the adjoint results Mass weighting Volume weighting 0.1 hPa 10 hPa 1000 hPa From E. Novakovskaia Summary Unforeseen Results Leading to New Paradigms 1. Atmospheric flows are very sensitive to low-level T perturbations. 2. Evolution of a barotropic flow can be very sensitive to perturbations having small vertical scale. 3. Error structures can propagate and amplify rapidly. 4. Forecast barotropic vorticity can be sensitive to initial water vapor. 5. When significant R is present, moist enthalpy appears a key field. 6. Nudging has strange properties. 7. Relatively few perturbation structures are initially growing ones. 8. Sensitivities to observations differ from sensitivities to analyses. 9. A TLM including physics can be useful. Misunderstanding #1 False: Adjoint models are difficult to understand. True: Understanding of adjoints of numerical models primarily requires concepts taught in early college mathematics. Misunderstanding #2 False: Adjoint models are difficult to develop. True: Adjoint models of dynamical cores are simpler to develop than their parent models, and almost trivial to check, but adjoints of model physics can pose difficult problems. Misunderstanding #3 False: Automatic adjoint generators easily generate perfect and useful adjoint models. True: Problems can be encountered with automatically generated adjoint codes that are inherent in the parent model. Do these problems also have a bad effect in the parent model? Misunderstanding #4 False: An adjoint model is demonstrated useful and correct if it reproduces nonlinear results for ranges of very small perturbations. True: To be truly useful, adjoint results must yield good approximations to sensitivities with respect to meaningfully large perturbations. This must be part of the validation process. Misunderstanding #5 False: Adjoints are not needed because the EnKF is better than 4DVAR and adjoint results disagree with our notions of atmospheric behavior. True: Adjoint models are more useful than just for 4DVAR. Their results are sometimes profound, but usually confirmable, thereby requiring new theories of atmospheric behavior. It is rare that we have a tool that can answer such important questions so directly! What is happening and where are we headed? 1. There are several adjoint models now, with varying portions of physics and validation. 2. Utilization and development of adjoint models has been slow to expand, for a variety of reasons. 3. Adjoint models are powerful tools that are under-utilized. 4. Adjoint models are like gold veins waiting to be mined. Recommendations 1. Develop adjoint models. 2. Include more physics in adjoint models. 3. Develop parameterization schemes suitable for linearized applications. 4. Always validate adjoint results (linearity). 4. Consider applications wherever sensitivities would be useful. Adjoint Workshop The 8th will be in fall 2008 or spring 2009. Contact Dr. R. Errico rerrico@gmao.gsfc.nasa.gov to be put on mailing list