Venue: 14th Conference on Numerical Weather Prediction
T. Nehrkorn, G. Modica, M. Cerniglia, F. Ruggiero, J. Michalakes, and X. Zou, 2001: MM5 adjoint development using TAMC: experiences with an automatic code generator. In 14th Conference on Numerical Weather Prediction, pages 481-484, Ft. Lauderdale, FL, 30 July - 2 August. American Meteorological Society, Boston, MA.
The MM5 adjoint modeling system (Zou et al. 1998) is being updated to allow its efficient execution on parallel distributed memory machines (see presentation by Ruggiero et al. in this conference). To take advantage of the existing parallelization mechanisms (Michalakes, 2000) already in place for the latest release (Version 3.4) of the MM5 nonlinear model (NLM), the existing (Version 1) tangent linear (TLM) and adjoint model codes are also being updated to Version 3.4. We describe our experiences using the Tangent Linear and Adjoint Model Compiler (TAMC) automatic adjoint code generator in this process. TAMC is a source-to-source translator that generates Fortran code for the tangent linear (TLM) or adjoint from the Fortran code of the nonlinear model. The NLM source code must conform to the Fortran-77 standard, with some additional restrictions (some features of the Fortran-90 standard are also supported). TAMC was developed and tested by Giering and Kaminski (1998), and it has been used in oceanographic and other modeling applications (e.g., Kaminski et al. 1996). As part of the TLM and adjoint model development, the MM5 NLM code is temporarily modified to remove some nonstandard features (primarily, the use of Fortran-77 pointer variables) before being passed to TAMC. The output generated by TAMC is then hand-checked by comparison against the existing, hand-coded TLM and adjoint Version 1 codes, taking into account differences between the Version 1 and 3.4 NLM codes. Finally, both the TLM and adjoint are tested for correctness, using the standard comparison of the TLM and finite difference NLM gradients to check for correctness of the TLM, and the definition of the adjoint to check for consistency of the TLM and adjoint. This testing is performed for individual subroutines as well as the complete model integration. Different model variables are tested separately, and testing can be done for the entire model domain, or for selected model grid points. We will present details of our code development methodology, and the results of TAMC. In particular, we will quantify the amount of manual code changes required for the MM5 adjoint, illustrate examples of code constructs that caused difficulties, and show solutions to problems encountered in the use of TAMC. Based on our experiences, we will assess the potential role of TAMC as a code maintenance tool, to allow future NLM model code upgrades to be propagated quickly into the TLM and adjoint counterparts.