7 | | Numerical models are typically implemented for normal integration of some initial state. For the data assimilation with filter algorithm, an ensemble of model states has to be integrated for limited time until observations are available and an analysis step of the filter is computed. Subsequently, the updated ensemble has to be integrated again. To allow for these alternating ensemble integrations and analysis steps the model code has to be extended. The recommended implementation strategy for PDAF is to add an additional loop outside of the regular time-stepping loop of the model. This strategy has the potential to reduce the required chances in the model code to the minimum. The required extensions are described below. |
| 7 | Numerical models are typically implemented for normal integration of some initial state. For the data assimilation with filter algorithm, an ensemble of model states has to be integrated for limited time until observations are available and an analysis step of the filter is computed. Subsequently, the updated ensemble has to be integrated again. To allow for these alternating ensemble integrations and analysis steps the model code has to be extended. The recommended implementation strategy for PDAF is to add an additional loop outside of the regular time-stepping loop of the model. This strategy has the potential to reduce the required chances in the model code to the minimum. In addition, a routine that simulates model errors might be required to be inserted into the time stepping loop of the model. The required extensions are described below. |
| 8 | |
| 9 | Some operations that are specific to the model and the observations that are assimilated are performed by routines that are supplied by the user and that are called through the defined interface of PDAF. Generally, these user-supplied routines have to provide quite elementary operations, like initializing a model state vector for PDAF from model fields or providing the vector of observations. PDAF provides examples for these routines and templates that can be used as the basis for the implementation. As only the interface of these routines is specified, the user can implement the routines like a routine of the model. Thus, the implementation of these routines should not be difficult. |
54 | | * `U_next_obs`: A user supplied routine that initializes the variables `nsteps`, `timenow`, and `doexit` |
55 | | * `U_distributed_state`: A user supplied routine that initializes the model fields from the array holding the ensemble of moel state vectors |
56 | | * `U_prepoststep`: A user supplied routine that is called before and after the analysis step. Here the user has the possibility to access the state ensemble and can e.g. compute estimated variances or can write the ensemble states the state estimate into files. |
57 | | * `status`: An integer status flag |
| 56 | * `U_next_obs`: The name of a user supplied routine that initializes the variables `nsteps`, `timenow`, and `doexit` |
| 57 | * `U_distributed_state`: The name of a user supplied routine that initializes the model fields from the array holding the ensemble of model state vectors |
| 58 | * `U_prepoststep`: The name of a user supplied routine that is called before and after the analysis step. Here the user has the possibility to access the state ensemble and can e.g. compute estimated variances or can write the ensemble states the state estimate into files. |
| 59 | * `status`: The integer status flag. It is zero, if PDAF_get_state is existed without errors. |
| 60 | |
| 61 | == PDAF_put_state_* == |
| 62 | |
| 63 | There is a separate routine `PDAF_put_state_*` for each of the filter algorithms. The name of the routine includes the name of the filter at its end. The purpose of the `PDAF_put_state_*` routines is to write back the forecast model fields into the array holding the ensemble of model state vectors. In addition, the routine checks if the current forecast phase is completed. If not, the routine is exited and the next cycle of the ensemble loop is performed. If the current forecast phase is completed, the routine executes the analysis step of the chosen filter algorithm. The interface to each put-state routine is specific for each filter algorithm, because the names of several user-supplied routines have to be specified, which are specific for each filter algorithm. For example, the interface when using the SEIK filter is the following: |
| 64 | {{{ |
| 65 | SUBROUTINE PDAF_put_state_seik(U_collect_state, U_init_dim_obs, U_obs_op, & |
| 66 | U_init_obs, U_prepoststep, U_prodRinvA, U_init_obsvar, status) |
| 67 | }}} |
| 68 | with the following arguments: |
| 69 | * `U_collect_state`: The name of the user-supplied routine that initializes a state vector from the array holding the ensembel of model states from the model fields. This is basically the inverse operation to `U_distribute_state` used in `PDAF_get_state` |
| 70 | * `U_init_dim_obs`: The name of the user-supplied routine that provides the size of observation vector |
| 71 | * `U_obs_op`: The name of the user-supplied routine that acts as the observation operator on some state vector |
| 72 | * `U_init_obs`: The name of the user-supplied routine that initializes the vector of observations |
| 73 | * `U_prepoststep`: The name of the pre/poststep routine as in `PDAF_get_state` |
| 74 | * `U_prodRinvA`: The name of the user-supplied routine that computes the product of the inverse of the observation error covariance matrix with some matrix provided to the routine by PDAF. This operation occurs during the analysis step of the SEIK filter. |
| 75 | * `U_init_obsvar`: The name of the user-supplied routine that provides a mean observation error variance to PDAF (This routine will only be executed, if an adaptive forgetting factor is used) |
| 76 | * `status`: The integer status flag. It is zero, if PDAF_get_state is existed without errors. |
| 77 | |
| 78 | == Simulating model errors == |
| 79 | |
| 80 | The implementation of the filter algorithms does not support the specification of a model error covariance matrix. This was left out, because in the SEEK and SEIK filter, the handling can be extremely costly, as the model error covariance matrix has to be projected onto the ensemble space. Instead PDAF support the simulation of model errors by disturbing fields during the model integration. For this, some routine will be required that is inserted into the time stepping loop of the model. As this procedure is specific to each model, the is no routine provided by PDAF for this. |
| 81 | |
| 82 | == Compilation and testing == |
| 83 | |
| 84 | To compile the extended model code with PDAF, one has to extend the Makefile for the model. The core part of PDAF can be compiled separately as a library. It can then simply be linked to the model code. This is the strategy followed in the PDAF-package. The user-supplied routines also need to exist and need to be compiled and linked. However, for testing at this stage, only the user-supplied routines used in `PDAF_get_state` as well as the routine `U_collect_state` need to be implemented with functionality. The other routine will only be executed, when an actual analysis is performed. |
| 85 | |
| 86 | |
| 87 | If one out-comments the analysis routines in the `PDAF_*_update` routine (e.g. `PDAF_seik_update`), the analysis is not performed. |