Changes between Version 4 and Version 5 of OMI_nondiagonal_observation_error_covariance_matrices


Ignore:
Timestamp:
Sep 9, 2024, 11:03:53 AM (2 months ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OMI_nondiagonal_observation_error_covariance_matrices

    v4 v5  
    4242== Call-back routines handling observations ==
    4343
    44 For the different filters and 3D-Var variants,
     44The tables above show the additional routine(s) that need to be implemented the nondiagonal **R** matrix for  the different filters and 3D-Var variants. Here we describe the interface of these routines. Generally the required routine(s) for the chosen DA method should be added to `callback_obs_pdafomi.F90` and to each observation module, where `thisobs` or `thisobs_l` can be included.
     45
     46Note that a mixed implementation is not possible. If one observation type has a non-diagonal **R** matrix, the additional routine(s) have to be implemented for all observations, even if an observation type uses a diagonal **R**. However, for observation wit a diagonal **R**, the corresponding PDAF-OMI routine to be called in the observation module can be called. Below we provide the information where this routine can be found.
     47
     48=== prodRinvA_pdafomi ===
     49
     50The interface for this routine is:
     51{{{
     52SUBROUTINE prodRinvA_pdafomi(step, dim_obs_p, rank, obs_p, A_p, C_p)
     53
     54  INTEGER, INTENT(in) :: step                ! Current time step
     55  INTEGER, INTENT(in) :: dim_obs_p           ! PE-local dimension of obs. vector
     56  INTEGER, INTENT(in) :: rank                ! Rank of initial covariance matrix
     57  REAL, INTENT(in)    :: obs_p(dim_obs_p)    ! PE-local vector of observations
     58  REAL, INTENT(in)    :: A_p(dim_obs_p,rank) ! Input matrix from analysis routine
     59  REAL, INTENT(out)   :: C_p(dim_obs_p,rank) ! Output matrix
     60}}}
     61
     62The routine computes the product of the inverse of the observation error covariance matrix with matrix `A_p`. For the ESTKF this matrix holds the observed part of the ensemble perturbations. The product has to be given as `C_p`.
     63
     64For a model with domain decomposition, `A_p` contains the part of the matrix that resides on the model sub-domain of the calling process. The product has to be computed for this sub-domain, too.
     65
     66Hints:
     67 * The matrix `A_p` relates to the observations of all observation types. Thus, one needs to take the offset of an observation in the observation vector of all observation types into account. This offset is given by `thisobs%off_obs_f`.
     68 * The routine does not require that the product is implemented as a real matrix-matrix product. Rather, the product can be implemented in its most efficient form. For example, if the observation error covariance matrix is diagonal, only the multiplication of the diagonal with matrix `A_p` has to be implemented.
     69 * The observation vector `obs_p` is provided through the interface for cases where the observation error variance is relative to the actual value of the observations.
     70 * The interface has a difference for ESTKF and ETKF: For ETKF the third argument is the ensemble size (`dim_ens`), while for the ESTKF it is the rank (`rank`) of the covariance matrix (usually ensemble size minus one). In addition, the second dimension of `A_p` and `C_p` has size `dim_ens` for ETKF, while it is `rank` for the ESTKF.  (Practically, one can usually ignore this difference as the fourth argument of the interface can be named arbitrarily in the routine.)
     71 * For diagonal **R** PDAF-OMI uses the routine `PDAFomi_prodRinvA` in `/src/PDAFomi_obs_f.F90` as the routine that is called within the observation module. This routine can serve as a template for an implementation by the user.
     72
     73== likelihood_pdafomi ==
     74
     75The interface for this routine is:
     76{{{
     77SUBROUTINE likelihood_pdafomi(step, dim_obs_p, obs_p, residual, likely)
     78
     79  INTEGER, INTENT(in) :: step                ! Current time step
     80  INTEGER, INTENT(in) :: dim_obs_p           ! PE-local dimension of obs. vector
     81  REAL, INTENT(in)    :: obs_p(dim_obs_p)    ! PE-local vector of observations
     82  REAL, INTENT(in)    :: residual(dim_obs_p) ! Input vector holding the residual y-Hx
     83  REAL, INTENT(out)   :: likely              ! Output value of the likelihood
     84}}}
     85
     86The routine computes the likelihood of the observations for each ensemble member. The likelihood is computed from the observation-state residual according to the assumed observation error distribution. Commonly, the observation errors are assumed to be Gaussian distributed. In this case, the likelihood is '''exp(-0.5*(y-Hx)^T^*R^-1^*(y-Hx))'''.
     87
     88For a model with domain decomposition, `resid` contains the part of the matrix that resides on the model sub-domain of the calling process. The likelihood has to be computed for the global state vector. Thus some parallel communication might be required to complete the computation.
     89
     90Hints:
     91 * The matrix `residual` relates to the observations of all observation types. Thus, one needs to take the offset of an observation in the observation vector of all observation types into account. This offset is given by `thisobs%off_obs_f`.
     92 * The routine is very similar to the routine [wiki:U_prodRinvA]. The main addition is the computation of the likelihood after computing '''R^-1^*(y-Hx)''', which corresponds to '''R^-1^*A_p''' in [wiki:U_prodRinvA].
     93 * The information about the inverse observation error covariance matrix has to be provided by the user. Possibilities are to read this information from a file, or to use a Fortran module that holds this information, which one could already prepare in init_pdaf.
     94 * The routine does not require that the product is implemented as a real matrix-vector product. Rather, the product can be implemented in its most efficient form. For example, if the observation error covariance matrix is diagonal, only the multiplication of the inverse diagonal with the vector `resid` has to be implemented.
     95 * The observation vector `obs_p` is provided through the interface for cases where the observation error variance is relative to the actual value of the observations.
     96 * For diagonal **R** PDAF-OMI uses the routine `PDAFomi_likelihood` in `/src/PDAFomi_obs_f.F90` as the routine that is called within the observation module. This routine can serve as a template for an implementation by the user.
     97
     98=== add_obs_err_pdafomi ===
     99
     100The interface for this routine is:
     101{{{
     102SUBROUTINE add_obs_err_pdafomi(step, dim_obs, C)
     103
     104  INTEGER, INTENT(in) :: step                ! Current time step
     105  INTEGER, INTENT(in) :: dim_obs             ! Dimension of obs. vector
     106  REAL, INTENT(inout) :: C(dim_obs, dim_obs) ! Matrix to that the observation
     107                                             !    error covariance matrix is added
     108}}}
     109
     110During the analysis step of the EnKF, the projection of the ensemble covariance onto the observation space is computed. This matrix is provided to the routine as `C_p`. The routine has to add the observation error covariance matrix to `C_p`.
     111
     112The operation is for the global observation space. Thus, it is independent of whether the filter is executed with or without parallelization.
     113
     114Hints:
     115 * Matrix C relates to the observations of all types. Thus, for a single obsevation type one has to take the offset of this observtion type in the observation vector into account. For this, PDAF-OMI initializes an array `obsdims`, which can also be used by a user-implemented routine. See the routine `PDAFomi_add_obs_error` in `/src/PDAFomi_obs_f.F90` for how this can be implemented.
     116 * The routine does not require that the observation error covariance matrix is added as a full matrix. If the matrix is diagonal, only the diagonal elements have to be added.
     117 * For diagonal **R** PDAF-OMI uses the routine `PDAFomi_add_obs_error` in `/src/PDAFomi_obs_f.F90` as the routine that is called within the observation module. This routine can serve as a template for an implementation by the user.