Version 2 (modified by lnerger, 3 years ago) (diff)

--

# U_likelihood

The page document the user-supplied call-back routine `U_likelihood`.

The routine `U_likelihood` is a call-back routine that has to be provided by the user. In the simplified interface the predefined name of the routine is `likelihood_pdaf`, but in the full interface, the user can choose the name of the routine. The routine is used with the nonlinear filter NETF and called during the analysis step. The purpose of the routine is to compute the likelihood of the observation for a given ensemble member. The likelihood depends on the assumed observation error distribution. For a Gaussian observation error, the likelihood is exp(-0.5*(y-Hx)T*R-1*(y-Hx)). The vector y-HX = `resid` is provided as an input argument. The likelihood has to be returned in the variable `likely`.

The interface is the following:

```SUBROUTINE U_likelihood(step, dim_obs_p, observation_p, resid, likely)
```

with

• `step` : `integer, intent(in)`
Current time step
• `dim_obs_p` : `integer, intent(in)`
Number of observations at current time step (i.e. the size of the observation vector)
• `obs_p` : `real, intent(in), dimension(dim_obs_p)`
Vector of observations
• `resid` : `real, intent(in), dimension(dim_obs_p)`
Input vector holding the residual
• `likely` : `real, intent(out)`
Output value of the likelihood

Notes:

• In case of a parallelization 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 vector.

Hints:

• The routine is very similar to the routine 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 U_prodRinvA.
• 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.
• 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.
• 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.