34 | | This page describes the implementation of the analysis step for the parameterized 3D-Var using PDAF-OMI. |
35 | | |
36 | | For the analysis step of 3D-Var we need different operations related to the observations. These operations are requested by PDAF by call-back routines supplied by the user and provided in the OMI structure. The names of the routines that are provided by the user are specified in the call to the routine `PDAFomi_assimilate_3dvar` in the fully-parallel implementation (or `PDAFomi_put_state_3dvar` for the 'flexible' implementation) that was discussed before. With regard to the parallelization, all these routines (except `U_collect_state`, `U_distribute_state`, and `U_next_observation`) are executed by the filter processes (`filterpe=.true.`) only. |
37 | | |
38 | | For completeness we discuss here all user-supplied routines that are specified in the interface to `PDAFomi_assimilate_3dvar`. Thus, some of the user-supplied routines that are explained on the page describing the modification of the model code for the ensemble integration are repeated here. |
39 | | |
40 | | |
41 | | == `PDAFomi_assimilate_3dvar` == |
| 34 | This page describes the implementation of the analysis step for the 3D Ensemble Var using PDAF-OMI. |
| 35 | |
| 36 | For the analysis step of 3D-Var we need different operations related to the observations. These operations are requested by PDAF by call-back routines supplied by the user and provided in the OMI structure. The names of the routines that are provided by the user are specified in the call to the routine `PDAFomi_assimilate_en3dvar` in the fully-parallel implementation (or `PDAFomi_put_state_en3dvar` for the 'flexible' implementation) that was discussed before. With regard to the parallelization, all these routines (except `U_collect_state`, `U_distribute_state`, and `U_next_observation`) are executed by the filter processes (`filterpe=.true.`) only. |
| 37 | |
| 38 | For 3D Ensemble Var the ensemble is used to represent the background covariance matrix '''B'''. This ensemble perturbations need to be transformed by means of an ensemble Kalman filter. PDAF uses for this the error-subspace transform filter ESTKF. There are two variants: The first uses the localized filter LESTKF, while the second uses the global filter ESTKF. |
| 39 | |
| 40 | For completeness we discuss here all user-supplied routines that are specified in the interface to `PDAFomi_assimilate_en3dvar`. Thus, some of the user-supplied routines that are explained on the page describing the modification of the model code for the ensemble integration are repeated here. |
| 41 | |
| 42 | |
| 43 | == `PDAFomi_assimilate_en3dvar_X`== |
56 | | * [#U_cvtcvt_pdaf.F90 U_cvt]: The name of the user-supplied routine that applies the control-vector transformation (square-root of the B-matrix) on some control vector to obtain a state vector. |
57 | | * [#U_cvt_adjcvt_adj_pdaf.F90 U_cvt_adj]: The name of the user-supplied routine that applies the adjoint control-vector transformation (with square-root of the B-matrix) on some state vector to obtain the control vector. |
| 65 | * [#U_cvt_enscvt_ens_pdaf.F90 U_cvt_ens]: The name of the user-supplied routine that applies the ensemble control-vector transformation (square-root of the B-matrix) on some control vector to obtain a state vector. |
| 66 | * [#U_cvt_adj_enscvt_adj_ens_pdaf.F90 U_cvt_adj_ens]: The name of the user-supplied routine that applies the adjoint ensemble control-vector transformation (with square-root of the B-matrix) on some state vector to obtain the control vector. |
| 67 | * [#U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_pdafomi]: The name of the user-supplied routine that acts as the observation operator on some state vector |
| 68 | * [#U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_lin_pdafomi]: The name of the user-supplied routine that acts as the linearized observation operator on some state vector |
| 69 | * [#U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_lin_pdafomi]: The name of the user-supplied routine that acts as the adjoint observation operator on some state vector |
| 70 | * [#U_init_n_domainsinit_n_domains_pdaf.F90 U_init_n_domains]: The name of the routine that provides the number of local analysis domains |
| 71 | * [#U_init_dim_linit_dim_l_pdaf.F90 U_init_dim_l]: The name of the routine that provides the state dimension for a local analysis domain |
| 72 | * [#U_init_dim_obs_l_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_l_pdafomi]: The name of the routine that initializes the size of the observation vector for a local analysis domain |
| 73 | * [#U_g2l_stateg2l_state_pdaf.F90 U_g2l_state]: The name of the routine that initializes a local state vector from the global state vector |
| 74 | * [#U_l2g_statel2g_state_pdaf.F90 U_l2g_state]: The name of the routine that initializes the corresponding part of the global state vector from the provided local state vector |
| 75 | * [#U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep]: The name of the pre/poststep routine as in `PDAF_get_state` |
| 76 | * [#U_next_observationnext_observation.F90 U_next_observation]: The name of a user supplied routine that initializes the variables `nsteps`, `timenow`, and `doexit`. The same routine is also used in `PDAF_get_state`. |
| 77 | * `status`: The integer status flag. It is zero, if `PDAFomi_assimilate_global` is exited without errors. |
| 78 | |
| 79 | |
| 80 | |
| 81 | === `PDAFomi_assimilate_en3dvar_estkf` === |
| 82 | |
| 83 | This routine is called for the case of transforming the ensemble perturbations using the global ESTKF. |
| 84 | |
| 85 | The interface is: |
| 86 | {{{ |
| 87 | SUBROUTINE PDAFomi_assimilate_en3dvar_lestkf(U_collect_state, U_distribute_state, & |
| 88 | U_init_dim_obs_pdafomi, U_obs_op_pdafomi, & |
| 89 | U_cvt_ens, U_cvt_adj_ens, U_obs_op_lin_pdafomi, U_obs_op_adj_pdafomi, & |
| 90 | U_prepoststep, U_next_observation, outflag) |
| 91 | }}} |
| 92 | with the following arguments: |
| 93 | * [#U_collect_statecollect_state_pdaf.F90 U_collect_state]: The name of the user-supplied routine that initializes a state vector from the array holding the ensemble of model states from the model fields. This is basically the inverse operation to `U_distribute_state` used in `PDAF_get_state` as well as here. |
| 94 | * [#U_distribute_statedistribute_state_pdaf.F90 U_distribute_state]: The name of a user supplied routine that initializes the model fields from the array holding the ensemble of model state vectors. |
| 95 | * [#U_init_dim_obs_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_pdafomi]: The name of the user-supplied routine that initializes the observation information and provides the size of observation vector |
| 96 | * [#U_cvt_enscvt_ens_pdaf.F90 U_cvt_ens]: The name of the user-supplied routine that applies the ensemble control-vector transformation (square-root of the B-matrix) on some control vector to obtain a state vector. |
| 97 | * [#U_cvt_adj_enscvt_adj_ens_pdaf.F90 U_cvt_adj_ens]: The name of the user-supplied routine that applies the adjoint ensemble control-vector transformation (with square-root of the B-matrix) on some state vector to obtain the control vector. |
74 | | U_cvt, U_cvt_adj, U_obs_op_lin_pdafomi, obs_op_adj_pdafomi, & |
75 | | prepoststep_pdaf, outflag) |
| 116 | U_cvt_ens, U_cvt_adj_ens, U_obs_op_lin_pdafomi, U_obs_op_adj_pdafomi, & |
| 117 | U_init_n_domains_p, U_init_dim_l, U_init_dim_obs_l_pdafomi, & |
| 118 | U_g2l_state, U_l2g_state, U_prepoststep, outflag) |
| 119 | }}} |
| 120 | |
| 121 | == `PDAFomi_put_state_en3dvar_estkf` == |
| 122 | |
| 123 | The interface of this routine is analogous to that of `PDAFomi_assimilate_en3dvar_estkf'. Thus it is identical to this routine with the exception the specification of the user-supplied routines `U_distribute_state` and `U_next_observation` are missing. |
| 124 | |
| 125 | The interface when using one of the global filters is the following: |
| 126 | {{{ |
| 127 | SUBROUTINE PDAFomi_put_state_en3dvar_estkf(U_collect_state, & |
| 128 | U_init_dim_obs_pdafomi, U_obs_op_pdafomi, & |
| 129 | U_cvt_ens, U_cvt_adj_ens, U_obs_op_lin_pdafomi, U_obs_op_adj_pdafomi, & |
| 130 | U_prepoststep, outflag) |
| 226 | |
| 227 | === `U_init_n_domains` (init_n_domains_pdaf.F90) === |
| 228 | |
| 229 | The interface for this routine is: |
| 230 | {{{ |
| 231 | SUBROUTINE init_n_domains(step, n_domains_p) |
| 232 | |
| 233 | INTEGER, INTENT(in) :: step ! Current time step |
| 234 | INTEGER, INTENT(out) :: n_domains_p ! Number of analysis domains for local model sub-domain |
| 235 | }}} |
| 236 | |
| 237 | The routine is called during the analysis step before the loop over the local analysis domains is entered. |
| 238 | It has to provide the number of local analysis domains. In case of a domain-decomposed model the number of local analysis domain for the model sub-domain of the calling process has to be initialized. |
| 239 | |
| 240 | Hints: |
| 241 | * As a simple case, if the localization is only performed horizontally, the local analysis domains can be single vertical columns of the model grid. In this case, `n_domains_p` is simply the number of vertical columns in the local model sub-domain. |
| 242 | |
| 243 | |
| 244 | === `U_init_dim_l` (init_dim_l_pdaf.F90) === |
| 245 | |
| 246 | The interface for this routine is: |
| 247 | {{{ |
| 248 | SUBROUTINE init_dim_l(step, domain_p, dim_l) |
| 249 | |
| 250 | INTEGER, INTENT(in) :: step ! Current time step |
| 251 | INTEGER, INTENT(in) :: domain_p ! Current local analysis domain |
| 252 | INTEGER, INTENT(out) :: dim_l ! Local state dimension |
| 253 | }}} |
| 254 | |
| 255 | The routine is called during the loop over the local analysis domains in the analysis step. |
| 256 | It has to provide in `dim_l` the dimension of the state vector for the local analysis domain with index `domain_p`. |
| 257 | |
| 258 | Hints: |
| 259 | * For sharing through the module 'mod_assimilation', we further initialize an array 'coords_l' containing the coordinates that describe the local domain. These coordinates have to describe one location in space that is used in the OMI observation modules to compute the distance from observations. This requires that the coordinates in 'coords_l' have the same units as those used for the observations. |
| 260 | * Any form of local domain is possible as long as it can be describe as a single location. If observations are only horizontally distributed (a common situation with satellite data in the ocean), the local analysis domain can be a single vertical column of the model grid. In this case, the size of the state in the local analysis domain will be just the number of vertical grid points at this location and the horizontal coordinates are used in 'coords_l' |
| 261 | * Further, we recommend to initialize an array containing the indices of the elements of the local state vector in the global (or domain-decomposed) state vector (`id_lstate_in_pstate` in the template files). This array is also shared through 'mod_assimilation'. |
| 262 | |
| 263 | |
| 264 | === `U_init_dim_obs_l_pdafomi` (callback_obs_pdafomi.F90) === |
| 265 | |
| 266 | This is a call-back routine for PDAF-OMI that initializes the local observation vector. The routine calls a routine from the observation module for each observation type. |
| 267 | |
| 268 | See the [wiki:OMI_Callback_obs_pdafomi documentation on callback_obs_pdafomi.F90] for more information. |
| 269 | |
| 270 | |
| 271 | === `U_g2l_state` (g2l_state_pdaf.F90) === |
| 272 | |
| 273 | The interface for this routine is: |
| 274 | {{{ |
| 275 | SUBROUTINE g2l_state(step, domain_p, dim_p, state_p, dim_l, state_l) |
| 276 | |
| 277 | INTEGER, INTENT(in) :: step ! Current time step |
| 278 | INTEGER, INTENT(in) :: domain_p ! Current local analysis domain |
| 279 | INTEGER, INTENT(in) :: dim_p ! State dimension for model sub-domain |
| 280 | INTEGER, INTENT(in) :: dim_l ! Local state dimension |
| 281 | REAL, INTENT(in) :: state_p(dim_p) ! State vector for model sub-domain |
| 282 | REAL, INTENT(out) :: state_l(dim_l) ! State vector on local analysis domain |
| 283 | }}} |
| 284 | |
| 285 | The routine is called during the loop over the local analysis domains in the analysis step. It has to provide the local state vector `state_l` that corresponds to the local analysis domain with index `domain_p`. Provided to the routine is the state vector `state_p`. With a domain decomposed model, this is the state for the local model sub-domain. |
| 286 | |
| 287 | Hints: |
| 288 | * In the simple case that a local analysis domain is a single vertical column of the model grid, the operation in this routine would be to take out of `state_p` the data for the vertical column indexed by `domain_p`. |
| 289 | * Usually, one can initialize the indices of the local state vector elements in the global state vector in `U_init_dim_l` and just use these here. |
| 290 | |
| 291 | |
| 292 | === `U_l2g_state` (l2g_state_pdaf.F90) === |
| 293 | |
| 294 | The interface for this routine is: |
| 295 | {{{ |
| 296 | SUBROUTINE l2g_state(step, domain_p, dim_l, state_l, dim_p, state_p) |
| 297 | |
| 298 | INTEGER, INTENT(in) :: step ! Current time step |
| 299 | INTEGER, INTENT(in) :: domain_p ! Current local analysis domain |
| 300 | INTEGER, INTENT(in) :: dim_p ! State dimension for model sub-domain |
| 301 | INTEGER, INTENT(in) :: dim_l ! Local state dimension |
| 302 | REAL, INTENT(in) :: state_p(dim_p) ! State vector for model sub-domain |
| 303 | REAL, INTENT(out) :: state_l(dim_l) ! State vector on local analysis domain |
| 304 | }}} |
| 305 | |
| 306 | The routine is called during the loop over the local analysis domains in the analysis step. It has to initialize the part of the global state vector `state_p` that corresponds to the local analysis domain with index `domain_p`. Provided to the routine is the state vector `state_l` for the local analysis domain. |
| 307 | |
| 308 | Hints: |
| 309 | * In the simple case that a local analysis domain is a single vertical column of the model grid, the operation in this routine would be to write into `state_p` the data for the vertical column indexed by `domain_p`. |
| 310 | * Usually, one can initialize the indices of the local state vector elements in the global state vector in `U_init_dim_l` and just use these here. |
| 311 | |
| 312 | |
| 313 | |