2005 ROMS/TOMS Workshop Scripps Institution of Oceanography La Jolla, CA, October 25, 2005 How Does One Build an Adjoint for ROMS/TOMS? Hernan G. Arango.

Slides:



Advertisements
Similar presentations
Weather Research & Forecasting: A General Overview
Advertisements

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.
Assimilation Algorithms: Tangent Linear and Adjoint models Yannick Trémolet ECMWF Data Assimilation Training Course March 2006.
A Discrete Adjoint-Based Approach for Optimization Problems on 3D Unstructured Meshes Dimitri J. Mavriplis Department of Mechanical Engineering University.
The Inverse Regional Ocean Modeling System:
Prediction of Ocean Circulation in the Gulf of Mexico and Caribbean Sea An application of the ROMS/TOMS Data Assimilation Models Hernan G. Arango (IMCS,
GEOS-CHEM adjoint development using TAF
ROMS/TOMS Tangent Linear and Adjoint Models Andrew Moore, CU Hernan Arango, Rutgers U Arthur Miller, Bruce Cornuelle, Emanuele Di Lorenzo, Doug Neilson.
The ROMS TL and ADJ Models: Tools for Generalized Stability Analysis and Data Assimilation Hernan Arango, Rutgers U Emanuele Di Lorenzo, GIT Arthur Miller,
October, Scripps Institution of Oceanography An Alternative Method to Building Adjoints Julia Levin Rutgers University Andrew Bennett “Inverse Modeling.
ROMS/TOMS Web Sites David Robertson IMCS, Rutgers University New Brunswick, NJ, USA.
1 NGGPS Dynamic Core Requirements Workshop NCEP Future Global Model Requirements and Discussion Mark Iredell, Global Modeling and EMC August 4, 2014.
Advance the understanding and the prediction of mesoscale precipitation systems and to promote closer ties between the research and operational forecasting.
Community Terrain-Following Ocean Modeling System (TOMS) An overview of the collaboration between the modeling communities of Princeton (Ezer) and Rutgers.
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
1 Web Based Interface for Numerical Simulations of Nonlinear Evolution Equations Ryan N. Foster & Thiab Taha Department of Computer Science The University.
Exercise problems for students taking the Programming Parallel Computers course. Janusz Kowalik Piotr Arlukowicz Tadeusz Puzniakowski Informatics Institute.
Configuring ROMS for South of Java Kate Hedstrom, ARSC/UAF October, 2007.
ECE 720T5 Winter 2014 Cyber-Physical Systems Rodolfo Pellizzoni.
4D Variational Data Assimilation Observation Operators 4D Variational Data Assimilation Observation Operators Hernan G. Arango.
ROMS/TOMS TL and ADJ Models: Tools for Generalized Stability Analysis and Data Assimilation Andrew Moore, CU Hernan Arango, Rutgers U Arthur Miller, Bruce.
The Inverse Regional Ocean Modeling System: Development and Application to Data Assimilation of Coastal Mesoscale Eddies. Di Lorenzo, E., Moore, A., H.
1 Tips for solving Project 1 Reactor SO 3 SO 2 +O 2.
CCA Common Component Architecture Manoj Krishnan Pacific Northwest National Laboratory MCMD Programming and Implementation Issues.
1 Addressing Critical Skills Shortages at the NWS Environmental Modeling Center S. Lord and EMC Staff OFCM Workshop 23 April 2009.
Oceanic and Atmospheric Modeling of the Big Bend Region Steven L. Morey, Dmitry S. Dukhovksoy, Donald Van Dyke, and Eric P. Chassignet Center for Ocean.
An Introduction to Programming and Algorithms. Course Objectives A basic understanding of engineering problem solving process. A basic understanding of.
NOCS: NEMO activities in 2006 Preliminary tests of a full “LOBSTER” biogechemical model within the ORCA1 configuration. (6 extra passive tracers). Developed.
Ocean Data Variational Assimilation with OPA: Ongoing developments with OPAVAR and implementation plan for NEMOVAR Sophie RICCI, Anthony Weaver, Nicolas.
The Fujin Development of Parallel Coupler Takashi Arakawa Research Organization for Information Science & Technology.
Weak and Strong Constraint 4DVAR in the R egional O cean M odeling S ystem ( ROMS ): Development and Applications Di Lorenzo, E. Georgia Institute of Technology.
Progress in the implementation of the adjoint of the Ocean model NEMO by using the YAO software M. Berrada, C. Deltel, M. Crépon, F. Badran, S. Thiria.
Dale haidvogel Nested Modeling Studies on the Northeast U.S. Continental Shelves Dale B. Haidvogel John Wilkin, Katja Fennel, Hernan.
© 2011 Autodesk Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the.
Mass Transfer Coefficient
_______________________________________________________________CMAQ Libraries and Utilities ___________________________________________________Community.
Variational Data Assimilation - Adjoint Sensitivity Analysis Yan Ding, Ph.D. National Center for Computational Hydroscience and Engineering The University.
ROMS 4D-Var: The Complete Story Andy Moore Ocean Sciences Department University of California Santa Cruz & Hernan Arango IMCS, Rutgers University.
Sensitivity Analysis of Mesoscale Forecasts from Large Ensembles of Randomly and Non-Randomly Perturbed Model Runs William Martin November 10, 2005.
The I nverse R egional O cean M odeling S ystem Development and Application to Variational Data Assimilation of Coastal Mesoscale Eddies. Di Lorenzo, E.
© 2011 Autodesk Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the.
Modeling the biological response to the eddy-resolved circulation in the California Current Arthur J. Miller SIO, La Jolla, CA John R. Moisan NASA.
ROMS/TOMS European Workshop Alcala de Henares, Spain, November 7, 2006 ROMS Framework and Algorithms Andrew M. Moore UCSC Emanuele Di Lorenzo Georgia Tech.
22-24 Feb 05 Workshop DKRZ / M&D Stephanie Legutke Introduction to the Standard Compile Environment (SCE) of the Integrated Model & Data Infrastructure.
Test Specifications A Specification System for Multi-Platform Test Suite Configuration, Build, and Execution Greg Cooksey.
August 2001 Parallelizing ROMS for Distributed Memory Machines using the Scalable Modeling System (SMS) Dan Schaffer NOAA Forecast Systems Laboratory (FSL)
ATmospheric, Meteorological, and Environmental Technologies RAMS Parallel Processing Techniques.
Weak Constraint 4DVAR in the R egional O cean M odeling S ystem ( ROMS ): Development and application for a baroclinic coastal upwelling system Di Lorenzo,
Variational data assimilation: examination of results obtained by different combinations of numerical algorithms and splitting procedures Zahari Zlatev.
Connections to Other Packages The Cactus Team Albert Einstein Institute
Recap Cubic Spline Interpolation Multidimensional Interpolation Curve Fitting Linear Regression Polynomial Regression The Polyval Function The Interactive.
2005 ROMS/TOMS Workshop Scripps Institution of Oceanography La Jolla, CA, October 25, D Variational Data Assimilation Drivers Hernan G. Arango IMCS,
1 Observation Impact Using a Variational Adjoint System PI: Dr. James Cummings, Code Co-PIs: Dr. Hans.
An Overview of ROMS Code Kate Hedstrom, ARSC April 2007.
WRF Software Development and Performance John Michalakes, NCAR NCAR: W. Skamarock, J. Dudhia, D. Gill, A. Bourgeois, W. Wang, C. Deluca, R. Loft NOAA/NCEP:
Final Review – Exam 4. Radius and Interval of Convergence (11.1 & 11.2) Given the power series, Refer to lecture notes or textbook of section 11.1 and.
ESMF,WRF and ROMS. Purposes Not a tutorial Not a tutorial Educational and conceptual Educational and conceptual Relation to our work Relation to our work.
Weak and Strong Constraint 4D variational data assimilation: Methods and Applications Di Lorenzo, E. Georgia Institute of Technology Arango, H. Rutgers.
The I nverse R egional O cean M odeling S ystem Development and Application to Variational Data Assimilation of Coastal Mesoscale Eddies. Di Lorenzo, E.
MATLAB Lecture 1 염익준. Introduction MATLAB (MATrix LABoratory) a special purpose computer program optimized to perform engineering and scientific calculations.
V.M. Sliusar, V.I. Zhdanov Astronomical Observatory, Taras Shevchenko National University of Kyiv Observatorna str., 3, Kiev Ukraine
Slide 1 NEMOVAR-LEFE Workshop 22/ Slide 1 Current status of NEMOVAR Kristian Mogensen.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Improving Swift Hal Levison (PI), SwRI Martin Duncan (CoI), Queen’s University Mark Lewis (CoI), Trinity University David Kaufmann, SwRI.
Mode Superposition Module 7. Training Manual January 30, 2001 Inventory # Module 7 Mode Superposition A. Define mode superposition. B. Learn.
Adjoint models: Theory ATM 569 Fovell Fall 2015 (See course notes, Chapter 15) 1.
June 20, 2005Workshop on Chemical data assimilation and data needs Data Assimilation Methods Experience from operational meteorological assimilation John.
ROMS Framework: Kernel
Assimilating Tropospheric Emission Spectrometer profiles in GEOS-Chem
Adjoint Sensitivity Analysis of the California Current Circulation and Ecosystem using the Regional Ocean Modeling System (ROMS) Andy Moore, Emanuele.
Presentation transcript:

2005 ROMS/TOMS Workshop Scripps Institution of Oceanography La Jolla, CA, October 25, 2005 How Does One Build an Adjoint for ROMS/TOMS? Hernan G. Arango IMCS, Rutgers Andrew M. Moore PAOS, U. Colorado Emanuele Di Lorenzo Georgia Tech Bruce D. Cornuelle SIO, UCSD Arthur J. Miller SIO, UCSD

To design, develop, and test an expert ocean modeling system for high-resolution scientific and operational applications over a wide range of scales from estuaries to regional to global.To design, develop, and test an expert ocean modeling system for high-resolution scientific and operational applications over a wide range of scales from estuaries to regional to global. To provide the ocean modeling community with analysis and prediction tools that are available in meteorology and Numerical Weather Prediction (NWP).To provide the ocean modeling community with analysis and prediction tools that are available in meteorology and Numerical Weather Prediction (NWP). Long-Term Goals Are we closer to operational weather prediction systems?

Objectives To explore the factors that limit the predictability of the circulation in regional models in a variety of dynamical regimes To explore the factors that limit the predictability of the circulation in regional models in a variety of dynamical regimes To build 4D variational assimilation platforms: strong and weak constraint 4DVAR To build 4D variational assimilation platforms: strong and weak constraint 4DVAR To build a Generalized Stability Theory (GST) analysis platforms to study the dynamics, sensitivity and stability of the ocean circulation to naturally occurring perturbations To build a Generalized Stability Theory (GST) analysis platforms to study the dynamics, sensitivity and stability of the ocean circulation to naturally occurring perturbations To build an ensemble prediction platform by perturbing forcing, initial, and boundary conditions with GST singular vectors To build an ensemble prediction platform by perturbing forcing, initial, and boundary conditions with GST singular vectors

ROMS/TOMS Framework

ROMS/TOMS version 2.2 released to full user community and version 3.0 released beta testers on May 26, Currently, ROMS and TOMS are identical.ROMS/TOMS version 2.2 released to full user community and version 3.0 released beta testers on May 26, Currently, ROMS and TOMS are identical. Rewrote tangent linear (TLM), representer (RPM) and adjoint (ADM) models in Fortran 90 to improve the efficiency and multiple levels of nesting.Rewrote tangent linear (TLM), representer (RPM) and adjoint (ADM) models in Fortran 90 to improve the efficiency and multiple levels of nesting. Parallelized TLM, RPM and ADM.Parallelized TLM, RPM and ADM. Designed a single makefile structure to facilitate compiling in any computer architecture:Designed a single makefile structure to facilitate compiling in any computer architecture: Accomplishments Accomplishments 477 files, lines of code, words, characters Continued to develop web-based documentationContinued to develop web-based documentation

How to Build and Adjoint Build tangent linear model by linearizing the nonlinear model around a small perturbationBuild tangent linear model by linearizing the nonlinear model around a small perturbation It is called tangent because the linearization is around a time-evolving solution which geometrically represents the tangent slopes to the NLM trajectory in phase space.It is called tangent because the linearization is around a time-evolving solution which geometrically represents the tangent slopes to the NLM trajectory in phase space. The TLM is hand-coded using Giering and Kaminski (1998) recipes.The TLM is hand-coded using Giering and Kaminski (1998) recipes. NLM TLM

Adjoint Operator Adjoint Operator The discrete adjoint model operator relative to the L2-norm can be derived by multiplying each line of the tangent linear model code by the corresponding adjoint variable,, and then differentiate with respect to the tangent linear variable, :The discrete adjoint model operator relative to the L2-norm can be derived by multiplying each line of the tangent linear model code by the corresponding adjoint variable,, and then differentiate with respect to the tangent linear variable, : ADM

A Simple Example Let’s consider a simple 1D horizontal diffusion codeLet’s consider a simple 1D horizontal diffusion code The hand-coding of the tangent linear, adjoint, and representer codes is illustrated in the following FLASH animationsThe hand-coding of the tangent linear, adjoint, and representer codes is illustrated in the following FLASH animations (Need to install Swiff Point Player to insert and play flash movies in PowerPoint, check Alternatively,

f = c f = x f = c * x f = x n f = x * y f = 1 / x f = 1 / sqrt(x) f = c / x f = x / y f = 1 / (x + y) f = 1 / ((x + y) * (u + v)) f = (c + u) / (x + y) f = max(x, y) f = min(x, y) f = max(x, c) f = max(c, x) f = min(x, c) f = min(c, x) f = abs(x) f = sqrt(x) f = sqrt(x 2 + y 2 ) f = log(x) f = 1 / log(x) f = exp(x) f = sin(x) f = cos(x) f = tan(x) f = sinh(x) f = cosh(x) f = asin(x) f = acos(x) f = atan(x) f = atan2(x, y) tl_f = 0 tl_f = tl_x tl_f = c * tl_x tl_f = n * x n-1 * tl_x tl_f = tl_x * y + x * tl_y tl_f = - f 2 * tl_x tl_f = - f 3 * 0.5 * tl_x tl_f = - c * tl_x / x 2 = - f * tl_x * x tl_f = (y * tl_x – x * tl_y) / y 2 tl_f = - f 2 * (tl_x + tl_y) tl_f = - f 2 * ((tl_x + tl_y) * (u + v) - (x + y) * (tl_u + tl_v)) tl_f = + tl_u / (x + y) - f 2 * (tl_x + tl_y) tl_f = (0.5 + sign(0.5, x - y)) * tl_x + (0.5 – sign(0.5, x - y)) * tl_y tl_f = (0.5 + sign(0.5, y - x)) * tl_x + (0.5 – sign(0.5, y - x)) * tl_y tl_f = (0.5 + sign(0.5, x - c)) * tl_x tl_f = (0.5 - sign(0.5, c – x)) * tl_x tl_f = (0.5 + sign(0.5, c - x)) * tl_x tl_f = (0.5 - sign(0.5, x – c)) * tl_x tl_f = sign(1.0, x) * tl_x tl_f = 0.5 * tl_x / f tl_f = (x * tl_x + y * tl_y) / f tl_f = tl_x / x tl_f = - f 2 * (tl_x / x) tl_f = exp(x) * tl_x tl_f = cos(x) * tl_x tl_f = - sin(x) * tl_x tl_f = tl_x / (cos(x) * cos(x)) tl_f = cosh(x) * tl_x tl_f = - sinh(x) * tl_x tl_f = tl_x / sqrt(1.0 – x 2 ) tl_f = - tl_x / sqrt(1.0 – x 2 ) tl_f = tl_x / sqrt(1.0 + x 2 ) tl_f = (y * tl_x – x * tl_y) / (x 2 + y 2 ) Tangent Linear Model Recipes Nonlinear Tangent

Consider the product of two time-dependent state variables x and y and let x = x o + x’ and x’ = x - x o (1) y = y o + y’ and y’ = y - y o (2) where x o and y o are the basic state variables and x’ and y’ are their perturbations. Then, x * y = (x o + x’) * (y o + y’) = x o * y o + x’ * y o + x o * y’ + x’ * y’ Eliminating prime terms using (1) and (2) and neglecting high order terms involving prime variables yield x * y = x o * y o + (x - x o ) * y o + x o * (y - y o ) = x o * y o + x * y o - x o * y o + x o * y - x o * y o = x * y o + x o * y - x o * y o using the above previous nomenclature ( tl_x = x, tl_y = y, x = x o, y = y o ) we get f = x * y tl_f = tl_x * y + x * tl_y – x * y = tl_x * y + x * tl_y – f Notice that to obtain the RPM from the TLM for the above expression, we just need to subtract x * y which is the same as f. Representer Model Recipes

f = c f = x f = c * x f = x n f = x * y f = x * y * u f = 1 / x f = 1 / sqrt(x) f = c / x f = x / y f = (x * y) / u f = 1 / (x * y) f = 1 / (x + y) f = 1 / ((x + y) * (u + v)) f = max(c, x) f = sqrt(x) f = sqrt(x 2 + y 2 ) f = exp(x) f = exp(c * x) f = sin(x) tl_f = c tl_f = tl_x SAME! tl_f = c * tl_x SAME! tl_f = n * x n-1 * tl_x – (n – 1) * f tl_f = tl_x * y + x * tl_y – f tl_f = tl_x * y * u + x * (tl_y * u + y * tl_u) – 2 * f tl_f = - f 2 * tl_x + 2 * f tl_f = - f 3 * 0.5 * tl_x * f = f * (1.5 - f 2 * 0.5 * tl_x) tl_f = - f * tl_x / x + 2 * f = f * (2 - tl_x / x) tl_f = (y * tl_x – x * tl_y) / y 2 + f tl_f = (u * (tl_x * y + x * tl_y) – x * y * tl_u) / u 2 SAME! tl_f = - f 2 * (tl_x * y + x * tl_y) + 3 * f tl_f = - f 2 * (tl_x + tl_y) + 2 * f tl_f = - f 2 * (tl_x + tl_y) * (u + v) - f 2 * (x + y) * (tl_u + tl_v) + 2 * f tl_f = (0.5 - sign(0.5, c – x)) * (tl_x – x) + (0.5 + sign(0.5, c - x)) * c tl_f = 0.5 * tl_x / f * f = 0.5 * (f + tl_x / f) tl_f = (x * tl_x + y * tl_y) / f SAME! tl_f = tl_x * f + (1 – x) * f tl_f = c * tl_x * f + (1 – c * x) * f tl_f = tl_x * cos(x) + f – x cos(x) Representer Model Recipes

Beware Recursive expressionsRecursive expressions Vertical integrations (pressure gradient)Vertical integrations (pressure gradient) Tri-diagonal algorithms (implicit vertical mixing, vertical sinking, parabolic spline reconstruction)Tri-diagonal algorithms (implicit vertical mixing, vertical sinking, parabolic spline reconstruction) Rescaling of state variables (T*Hz)Rescaling of state variables (T*Hz) Use of adjoint private arraysUse of adjoint private arrays Zeroing out of global and private adjoint variables after being used (TLM to ADM)Zeroing out of global and private adjoint variables after being used (TLM to ADM) Redundant operations are wrong in adjoint codesRedundant operations are wrong in adjoint codes Model initialization (ini_fields: compute u and v)Model initialization (ini_fields: compute u and v) DO i=IstrU, Iend DC1(i,0) = DC(i,0) ! intermediate DC1(i,0) = DC(i,0) ! intermediate cff1 = 1.0_r8 / ( CF(i,0) * on_u(i,j) ) cff1 = 1.0_r8 / ( CF(i,0) * on_u(i,j) ) DC(i,0) = ( DC(i,0) * on_u(i,j) - DU_avg1(i,j) ) * cff1 ! recursive DC(i,0) = ( DC(i,0) * on_u(i,j) - DU_avg1(i,j) ) * cff1 ! recursive END DO

Parallelization The NLM, TLM, and RPM can be run in either shared-memory (OpenMP) or distributed-memory (MPI) The NLM, TLM, and RPM can be run in either shared-memory (OpenMP) or distributed-memory (MPI) The ADM can only be run in distributed-memory (ADM violates shared-memory collision rules) The ADM can only be run in distributed-memory (ADM violates shared-memory collision rules) Aggregation of variables for MPI communications Aggregation of variables for MPI communications CALL ad_mp_exchange2d (ng, iADM, 3, Istr, Iend, Jstr, Jend, & CALL ad_mp_exchange2d (ng, iADM, 3, Istr, Iend, Jstr, Jend, & & LBi, UBi, LBj, UBj, & & NghostPoints, EWperiodic, NSperiodic, & & ad_Zt_avg1, ad_DU_avg1, ad_DV_avg1)

East-West MPI Communications With Respect To Tile R Nonlinear Adjoint With Respect To Tile R

North-South MPI Communications Nonlinear Adjoint With Respect to Tile B

Profiling Elapsed CPU time (seconds): Resolution: 0256x0128x030, Parallel Nodes: 4, Tiling: 002x002 Elapsed CPU time (seconds): Resolution: 0256x0128x030, Parallel Nodes: 4, Tiling: 002x002 Node 0 Node 1 Node 2 Node 3 Total Node 0 Node 1 Node 2 Node 3 Total CPU: CPU: Model Elapsed Time Profile: Model Elapsed Time Profile: Initialization ( %) ( %) Initialization ( %) ( %) Reading of input data ( %) ( %) Reading of input data ( %) ( %) Processing of input data ( %) ( %) Processing of input data ( %) ( %) Computation of vertical boundary conditions ( %) ( %) Computation of vertical boundary conditions ( %) ( %) Computation of global information integrals ( %) ( %) Computation of global information integrals ( %) ( %) Writing of output data ( %) ( %) Writing of output data ( %) ( %) Model 2D kernel ( %) ( %) Model 2D kernel ( %) ( %) 2D/3D coupling, vertical metrics ( %) ( %) 2D/3D coupling, vertical metrics ( %) ( %) Omega vertical velocity ( %) ( %) Omega vertical velocity ( %) ( %) Equation of state for seawater ( %) ( %) Equation of state for seawater ( %) ( %) 3D equations right-side terms ( %) ( %) 3D equations right-side terms ( %) ( %) 3D equations predictor step ( %) ( %) 3D equations predictor step ( %) ( %) Pressure gradient ( %) ( %) Pressure gradient ( %) ( %) Harmonic stress tensor, S-surfaces ( %) ( %) Harmonic stress tensor, S-surfaces ( %) ( %) Corrector time-step for 3D momentum ( %) ( %) Corrector time-step for 3D momentum ( %) ( %) Corrector time-step for tracers ( %) ( %) Corrector time-step for tracers ( %) ( %) Total: Total: Message Passage profile: Message Passage profile: Message Passage: 2D halo exchanges ( %) ( %) Message Passage: 2D halo exchanges ( %) ( %) Message Passage: 3D halo exchanges ( %) ( %) Message Passage: 3D halo exchanges ( %) ( %) Message Passage: 4D halo exchanges ( %) ( %) Message Passage: 4D halo exchanges ( %) ( %) Message Passage: data broadcast ( %) ( %) Message Passage: data broadcast ( %) ( %) Message Passage: data reduction ( %) ( %) Message Passage: data reduction ( %) ( %) Message Passage: data gathering ( %) ( %) Message Passage: data gathering ( %) ( %) Message Passage: data scattering ( %) ( %) Message Passage: data scattering ( %) ( %) Total: Total: TLMADM

Directories and Files Comments Adjoint Adjoint model (ADM) Bin Executable scripts: cpp_clean, smakedepend Compilers makefile rules and dependency files Drivers Master program and applications drivers External Standard input scripts files and IO variables definitions Include CPP definitions and other configuration include files Lib Needed external libraries: MCT, PARPACK Modules Declaration modules and nested grid pointer structures Nonlinear Nonlinear model (NLM) Obsolete Obsolete files Programs Programs Support programs Representer Representer Tangent linear representer model (RPM) SeaIce SeaIce Sea Ice model Tangent Tangent Tangent linear perturbation model (TLM) Utility Utility Generic support routines Version Version Version information file makefile makefile A single compilation makefile for GNU make Makefile

CPP Options Adjoint it CPP Option TLMRPMADM UV_ADV X X X UV_COR X X X UV_LDRAG X X X UV_QDRAG X X X UV_VIS2 – MID_S_UV X X X UV_VIS2 – MID_GEO_UV X X X UV_VIS4 – MID_S_UV X X X UV_VIS4 – MID_GEO_UV X X X UV_U3ADVECTION X X X UV_C2ADVECTION X X X UV_C4ADVECTION X X X UV_SADVECTION X X X BULK_FLUX X X X NPZD X X X CPP Option TLMRPMADMTS_U3HADVECTION X X X TS_A4HADVECTION X X X TS_C2HADVECTION X X X TS_C4HADVECTION X X X TS_A4VADVECTION X X X TS_C2VADVECTION X X X TS_C4VADVECTION X X X TS_SVADVECTION X X X TS_DIF2 – MID_S_TS X X X TS_DIF2 – MID_GEO_TS X X X TS_DIF2 – MID_ISO_TS X X X TS_DIF4 – MID_S_TS X X X TS_DIF4 – MID_GEO_TS X X X TS_DIF4 – MID_ISO_TS X X X CPP Option TLMRPMADMNONLIN_EOS X X X CURVILINEAR X X X POWER_LAW X X X SALINITY X X X SOLVE3D X X X SPLINES X X X MASKING X X X RHO_SURF X X X VAR_RHO_2D X X X WJ_GRADP X X X DJ_GRADPS X X X TCLM_NUDGING X X X SOLAR_SOURCE X X X TLMRPMADMEASTER_WALL X X X WESTERN_WALL X X X NORTHERN_WALL X X X SOUTHERN_WALL X X X ****_FSCHAPMAN X X X ****_FSGRADIENT X X X ****_FSCLAMPED X X X ****_M2FLATHER X X X ****_M2GRADIENT X X X ****_M3GRADIENT X X X ****_M3CLAMPED X X X ****_TGRADIENT X X X ****_TCLAMPED X X X

Validation Tests ROMS/TOMS is continuously evolving so we need a process to check the validity of all its algorithms ROMS/TOMS is continuously evolving so we need a process to check the validity of all its algorithms Currently, we have four drivers in ocean_control.F to test the correctness of the TLM, RPM, and ADM: Currently, we have four drivers in ocean_control.F to test the correctness of the TLM, RPM, and ADM:  tlcheck_ocean.h TLM_CHECK  picard_ocean.h PICARD_TEST  grad_ocean.h GRADIENT_CHECK  pert_ocean.h INNER_PRODUCT or SANITY_CHECK

Sanity Check This is the most stringent test: it never fails! This is the most stringent test: it never fails! It is highly recommended to run this test on all applications and CPP configurations It is highly recommended to run this test on all applications and CPP configurations It checks the symmetry between TLM and ADM state vectors: It checks the symmetry between TLM and ADM state vectors: If this difference is large, it tell you that either the TLM or ADM is incorrect If this difference is large, it tell you that either the TLM or ADM is incorrect A – (A ) T = 0 within round off

How To Run Sanity Check Simply activate SANITY_CHECK CPP option in your application Simply activate SANITY_CHECK CPP option in your application Initialize from rest and force with desired nonlinear background state Initialize from rest and force with desired nonlinear background state Specify interior point to perturb with a delta function in ocean.in generic user parameters: Specify interior point to perturb with a delta function in ocean.in generic user parameters:  INT(user(1)) TLM state variable to perturb (zeta, ubar, vbar, u, v, t, …)  INT(user(2)) ADM state variable to perturb ( 1, 2, 3, 4, 5, 6, …)  INT(user(3)) I-index of TLM variable to perturb  INT(user(4)) I-index of ADM variable to perturb  INT(user(5)) J-index of TLM variable to perturb  INT(user(6)) J-index of ADM variable to perturb  INT(user(7)) K-index of TLM variable to perturb  INT(user(8)) K-index of ADM variable to perturb

Sanity Check Examples Sanity Check - Tangent: tl_zeta perturbed at (i,j) = Sanity Check - Adjoint: ad_zeta perturbed at (i,j) = Sanity Check - Perturbing variable: zeta Sanity Check - Tangent: E-05 at (i,j) Sanity Check - Adjoint: E-05 at (i,j) Sanity Check - Difference: E-19 at (i,j) Sanity Check - Tangent: tl_u perturbed at (i,j,k) = Sanity Check - Adjoint: ad_u perturbed at (i,j,k) = Sanity Check - Perturbing variable: u Sanity Check - Tangent: E-02 at (i,j,k) Sanity Check - Adjoint: E-02 at (i,j,k) Sanity Check - Difference: E-18 at (i,j,k)

Final Remarks Maintenance of TLM, RPM, and ADM algorithmsMaintenance of TLM, RPM, and ADM algorithms Automatic differentiationAutomatic differentiation Linearization of physicsLinearization of physics Non-differentiable algorithms (vertical mixing parameterizations)Non-differentiable algorithms (vertical mixing parameterizations) Training and documentationTraining and documentation