57 | | The general aspects of the filter specific routines `PDAF_assimilate_*` have been described on the page [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 Modification of the model code for the ensemble integration]. The routine is used in the fully-parallel implementation variant of the data assimilation system. When the 'flexible' implementation variant is used, the routines `PDAF_put_state_*' is used as described further below. Here, we list once more the full interface of the routine. Subsequently, the full set of user-supplied routines specified in the call to `PDAF_assimilate_lenkf` is explained. |
58 | | |
59 | | The interface when using the LEnKF is the following: |
60 | | {{{ |
61 | | SUBROUTINE PDAF_assimilate_lenkf(U_collect_state, U_distribute_state, U_init_dim_obs, & |
62 | | U_obs_op, U_init_obs, U_prepoststep, U_localize, & |
| 57 | This routine is used both in the ''fully-parallel'' and the ''flexible'' implementation variants of the data assimilation system. (See the page [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 Modification of the model code for the ensemble integration] for these variants) |
| 58 | |
| 59 | Here, we list the full interface of the routine. Subsequently, the user-supplied routines specified in the call are explained. |
| 60 | |
| 61 | The interface is: |
| 62 | {{{ |
| 63 | SUBROUTINE PDAF_assimilate_lenkf(U_collect_state, U_distribute_state, & |
| 64 | U_init_dim_obs, U_obs_op, U_init_obs, U_prepoststep, U_localize, & |
| 80 | |
| 81 | |
| 82 | == `PDAF_assim_offline_enkf ` == |
| 83 | |
| 84 | This routine is used to perform the analysis step for the offline mode of PDAF. |
| 85 | The interface of the routine is identical with that of the 'assimilate'-routine, except that the user-supplied routines `U_distribute_state`, `U_collect_state` and `U_next_observation` are missing. |
| 86 | |
| 87 | The 'assim_offline' routines were introduced with PDAF V3.0 to simplify the [wiki:OfflineImplementationGuide_PDAF3 implementation of the offline mode]. |
| 88 | |
| 89 | The interface is: |
| 90 | {{{ |
| 91 | SUBROUTINE PDAF_assim_offline_lenkf( & |
| 92 | U_init_dim_obs, U_obs_op, U_init_obs, U_prepoststep, U_localize, & |
| 93 | U_add_obs_err, U_init_obscovar, status) |
| 94 | }}} |
| 95 | |
80 | | When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAF_put_state_lenkf` has to be used instead of `PDAF_assimilate_lenkf`. The general aspects of the filter specific routines `PDAF_put_state_*` have been described on the page [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 Modification of the model code for the ensemble integration]. The interface of the routine is identical with that of `PDAF_assimilate_lenkf` with the exception the specification of the user-supplied routines `U_distribute_state` and `U_next_observation` are missing. |
81 | | |
82 | | The interface when using the LEnKF is the following: |
83 | | {{{ |
84 | | SUBROUTINE PDAF_put_state_lenkf(U_collect_state, U_init_dim_obs, U_obs_op, & |
85 | | U_init_obs, U_prepoststep, U_localize, & |
| 98 | This routine exists for backward-compatibility. In implementations that were done for PDAF V2.3.1 and before, a 'put_state' routine was used for the [wiki:OnlineFlexible_PDAF3 'flexible' parallelization variant] and for the [wiki:OfflineImplementationGuide_PDAF3 offline mode]. This routine allows to continue using the previous implementation structure. |
| 99 | The interface of the routine is identical with that of the 'assimilate'-routine, except that the user-supplied routines `U_distribute_state` and `U_next_observation` are missing. |
| 100 | |
| 101 | The interface is: |
| 102 | {{{ |
| 103 | SUBROUTINE PDAF_assimilate_lenkf(U_collect_state, & |
| 104 | U_init_dim_obs, U_obs_op, U_init_obs, U_prepoststep, U_localize, & |
173 | | The general aspects of this routines have already been described on the [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#U_prepoststepprepoststep_ens_pdaf.F90 page on modifying the model code for the ensemble integration] for the SEIK filter. For completeness, the description is repeated specifically for the EnKF: |
174 | | |
175 | | The interface of the routine is identical for all filters, but sizes can vary. Also, the particular operations that are performed in the routine can be specific for each filter algorithm. |
176 | | |
177 | | The interface for this routine is for the LEnKF |
178 | | {{{ |
179 | | SUBROUTINE prepoststep(step, dim_p, dim_ens, dim_ens_p, dim_obs_p, & |
180 | | state_p, Uinv, ens_p, flag) |
181 | | |
182 | | INTEGER, INTENT(in) :: step ! Current time step |
183 | | ! (When the routine is called before the analysis -step is provided.) |
184 | | INTEGER, INTENT(in) :: dim_p ! PE-local state dimension |
185 | | INTEGER, INTENT(in) :: dim_ens ! Size of state ensemble |
186 | | INTEGER, INTENT(in) :: dim_ens_p ! PE-local size of ensemble |
187 | | INTEGER, INTENT(in) :: dim_obs_p ! PE-local dimension of observation vector |
188 | | REAL, INTENT(inout) :: state_p(dim_p) ! PE-local forecast/analysis state |
189 | | ! The array 'state_p' is not generally not initialized in the case of SEIK/EnKF/ETKF. |
190 | | ! It can be used freely in this routine. |
191 | | REAL, INTENT(inout) :: Uinv(1, 1) ! Not used not LEnKF |
192 | | REAL, INTENT(inout) :: ens_p(dim_p, dim_ens) ! PE-local state ensemble |
193 | | INTEGER, INTENT(in) :: flag ! PDAF status flag |
194 | | }}} |
195 | | |
196 | | The routine `U_prepoststep` is called once at the beginning of the assimilation process. In addition, it is called during the assimilation cycles before the analysis step and after the ensemble transformation. The routine is called by all filter processes (that is `filterpe=1`). |
197 | | |
198 | | The routine provides for the user the full access to the ensemble of model states. Thus, user-controlled pre- and post-step operations can be performed. For example the forecast and the analysis states and ensemble covariance matrix can be analyzed, e.g. by computing the estimated variances. In addition, the estimates can be written to disk. |
199 | | |
200 | | Hint: |
201 | | * If a user considers to perform adjustments to the estimates (e.g. for balances), this routine is the right place for it. |
202 | | * Only for the SEEK filter the state vector (`state_p`) is initialized. For all other filters, the array is allocated, but it can be used freely during the execution of `U_prepoststep`. |
203 | | * The array `Uinv` is not used in the EnKF. Internally to PDAF, it is allocated to be of size (1,1). |
204 | | * Apart from the size of the array `Uinv`, the interface is identical for all ensemble filters (SEIK/ETKF/EnKF/LSEIK/LETKF/LEnKF). In general it should be possible to use an identical pre/poststep routine for all these filters. |
205 | | * The interface through which `U_prepoststep` is called does not include the array of smoothed ensembles. In order to access the smoother ensemble array one has to set a pointer to it using a call to the routine `PDAF_get_smootherens` (see page on [AuxiliaryRoutines auxiliary routines]) |
206 | | |
| 190 | The routine has already been described for modifying the model for the ensemble integration and for inserting the analysis step. |
| 191 | |
| 192 | See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#distribute_state_pdafdistribute_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine. |