﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
854	VERY IMPORTANT: 4D-Var Revisited	arango		"It is a significant update to ROMS 4D-Var data assimilation drivers and its associated algorithms.

* Several CPP options are renamed for clarity and consistency of how these algorithms are described in the ROMS literature available in journals and books:[[br]] [[br]]
  1. '''IS4DVAR''' is renamed to [[span(style=color: red, '''I4DVAR''')]] (Incremental 4D-Var; strong constraint, primal formulation).
  2. '''IS4DVAR_SENSITIVITY''' is renamed to [[span(style=color: red, '''I4DVAR_ANA_SENSITIVITY''')]] (I4D-Var Analysis Observation Impact and Observations Sensitivity).
  3. '''W4DPSAS''' is renamed to [[span(style=color: red, '''RBL4DVAR''')]] (Restricted B-preconditioned Lanczos 4D-Var; strong/weak constraint, dual formulation). This driver have evolved throught the years and it is no longer a '''PSAS''''''' algorithm.  See Gürol ''et al''. (2014) for full description of the '''RBLanczos''' methodology.
  4. '''TL_W4DPSAS''' is renamed to [[span(style=color: red, '''TL_RBL4DVAR''')]] (Tangent linearization of the RBL4D-Var data assimilation system)
  5. '''W4DPSAS_SENSITIVITY''' is renamed to [[span(style=color: red, '''RBL4DVAR_ANA_SENSITIVITY''')]] (RBL4D-Var Analysis Observation Impact and Observations Sensitivity).
  6. '''W4DPSAS_FCT_SENSITIVITY''' is renamed to [[span(style=color: red, '''RBL4DVAR_FCT_SENSITIVITY''')]] (RBL4D-Var Forecast Observation Impact and Observations Sensitivity).
  7. '''W4DVAR''' is renamed to [[span(style=color: red, '''R4DVAR''')]] (indirect Representers 4D-Var; strong/weak constraint, dual formulation).  This algorithm is no longer developed due to its instability in multiple outer loops in applications with high Rossby number. It is keep for instructional usage. We do not recommend to be used in realistic applications. Use instead the RBL4D-Var algorithm, which has a more efficient minimization '''RBLanczos''' solver.
  7. '''TL_W4DVAR''' is renamed to [[span(style=color: red, '''TL_R4DVAR''')]] (tangent linearization of the R4D-Var data assimilation system). 
  8. '''W4DVAR_SENSITIVITY''' is renamed to [[span(style=color: red, '''R4DVAR_ANA_SENSITIVITY''')]] (R4D-Var Analysis Observation Impact and Observations Sensitivity).

  You can still use the old CPP options.  ROMS will issue a warning, but it runs to completion. For example, for '''W4DPSAS''' you will get:
 {{{
CHECKADJ - use caution when activating: W4DPSAS
            REASON: deprecated option, use instead RBL4DVAR.
}}}

* Similarly, several of the include drivers to '''Master/ocean_control.F''' have been renamed for consistency with the new CPP options: [[br]] [[br]]
  1. '''is4dvar_ocean.h''' is renamed to [[span(style=color: red, '''i4dvar_ocean.h''')]].
  2. '''obs_sen_is4dvar.h''' is renamed to [[span(style=color: red, '''obs_sen_i4dvar_analysis.h''')]].
  3. '''w4dpsas_ocean.h''' is renamed to [[span(style=color: red, '''rbl4dvar_ocean.h''')]].
  4. '''tl_w4dpsas_ocean.h''' is renamed to [[span(style=color: red, '''tl_rbl4dvar_ocean.h''')]].
  5. '''obs_sen_w4dpsas.h''' is renamed to [[span(style=color: red, '''obs_sen_rbl4dvar_analysis.h''')]].
  6. '''obs_sen_w4dpsas_forecast.h''' is renamed to [[span(style=color: red, '''obs_sen_rbl4dvar_forecast.h''')]].
  7. '''w4dvar_ocean.h''' is renamed to [[span(style=color: red, '''r4dvar_ocean.h''')]].
  8. '''tl_w4dvar_ocean.h''' is renamed to [[span(style=color: red, '''tl_r4dvar_ocean.h''')]].
  9. '''obs_sen_w4dvar.h''' is renamed to [[span(style=color: red, '''obs_sen_r4dvar_analysis.h''')]].
  10. '''array_modes_w4dvar.h''' is renamed to [[span(style=color: red, '''array_modes.h''')]].

≈

* The main 4D-Var drivers have been split into several Fortran subroutines inside of new modules: [[span(style=color: red, '''i4dvar.F''')]], [[span(style=color: red, '''rbl4dvar.F''')]], and [[span(style=color: red, '''r4dvar.F''')]]. Each module has generic routine names for each phase of the 4D-Var data assimilation algorithm: [[br]] [[br]]
  * [[span(style=color: red, '''prior_error''')]]: processes background and model prior error covariance (standard deviations) and its normalization coefficients.
  * [[span(style=color: red, '''background''')]]: nonlinear model trajectory vector ('''Xb''') used to linearize the tangent linear and adjoint models.
  * [[span(style=color: red, '''increment''')]]: 4D-Var data assimilation increment ('''δXa'''). It iterates over all inner loops and minimizes the cost function.
  * [[span(style=color: red, '''analysis''')]]: computes analized state ('''Xa = Xb + δXa''').
  * [[span(style=color: red, '''posterior_error''')]]: computes 4D-Var posterior error covariance.

* The new 4D-Var data assimilation Fortran modules facilitate splitting the algorithm for various usage: [[br]] [[br]]
 1. Running 4D-Var with multiple executables. For example, the [[span(style=color: red, '''background''')]] phase can be computed in an atmospheric-ROMS coupled system using the '''ESMF/NUOPC''' or '''MCT''' libraries. Such a system may have a nested grid or not. Another executable with different CPP options run the [[span(style=color: red, '''increment''')]] phase. The 4D-Var system is scripted like the ECMWF IFS.
 2. Use a coarser-resolution grid in the [[span(style=color: red, '''increment''')]] phase and finer resolution in the [[span(style=color: red, '''background''')]] and [[span(style=color: red, '''analysis''')]] phases. The finer backgrond trajectory is interpolated to the coarser grid, and the coarser 4D-Var increment is interpolated to the finer grid.  Such interpolation can be done insie or outside of ROMS susing other software like Matlab or Python.
 3. Development of a hybrid 4D-Var system.
 4. Development of complex algebraic equations of other 4D-Var algorithms.
 5. Comfortable interfacing with third-party data assimilation systems like Object-Oriented Prediction System ('''OOPS)''' and Joint Effort for Data Assimilation Integration ('''JEDI''').

* The 4D-Var algorithm becomes much simpler. For example, in [[span(style=color: red, '''rbl4dvar_ocean.h''')]], we have
 {{{
!
!  Compute nonlinear background state trajectory, Xb(t)|n-1. Interpolate
!  the background at the observation locations, and compute the quality
!  control accept/reject flag, ObsScale. The background state is used
!  to linearize the tangent linear and adjoint models during the
!  minimization.
!
      CALL background (outer, RunInterval)
      IF (FoundError(exit_flag, NoError, __LINE__,                      &
     &               __FILE__)) RETURN
!
!  Start outer loop iterations.
!
      OUTER_LOOP : DO my_outer=1,Nouter

        outer=my_outer
        inner=0
!
!  Compute 4D-Var data assimilation increment, dXa, by iterating over
!  the inner loops, and minimizing the cost function.
!
        CALL increment (my_outer, RunInterval)
        IF (FoundError(exit_flag, NoError, __LINE__,                    &
     &                 __FILE__)) RETURN
!
!  Compute 4D-Var data assimilation analysis, Xa = Xb + dXa.  Set
!  nonlinear model initial conditions for next outer loop.
!
        CALL analysis (my_outer, RunInterval)
        IF (FoundError(exit_flag, NoError, __LINE__,                    &
     &                 __FILE__)) RETURN

      END DO OUTER_LOOP

#if defined POSTERIOR_ERROR_I || defined POSTERIOR_ERROR_F || \
    defined POSTERIOR_EOFS
!
!  Compute full (diagonal) posterior analysis error covariance matrix.
!  (NOTE: Currently, this code only works for a single outer-loop).
!
      CALL posterior_error (RunInterval)
      IF (FoundError(exit_flag, NoError, __LINE__,                      &
     &               __FILE__)) RETURN
#endif
}}}

----

== WARNING ==

* The '''makefile''' was changed to add a new library ('''libDRIVER.a''') to the '''ROMS/Drivers''' subdirectory.
* There are small changes to lots of files.  Good luck!"	upgrade	closed	major	Release ROMS/TOMS 3.9	Adjoint	3.9	Done		
