= PDAF3_assimilate = This page documents the routine `PDAF3_assimilate`. The routine is part of the advanced [wiki:PDAF3_interface PDAF3 interface] that was introduced with PDAF V3.0. || The routine is universal and used to execute the analysis step of all, local and global, ensemble filters. The routine uses the functionalities provided by PDAF-OMI and PDAFlocal to yield a minimum number of arguments. || The routine is typically called in `assimilate_pdaf` or directly in the model code. The general aspects of the filter specific routines `PDAF3_assimilate_*` are described on the page [ModifyModelforEnsembleIntegration Modification of the model code for the ensemble integration] and its sub-page on [InsertAnalysisStep inserting the analysis step]. The routine is used in both the fully-parallel and the flexible parallelization variant of the data assimilation system. The interface for the routine `PDAF3_assimilate` contains names for routines that operate on the local analysis domains (marked by the suffix `_l`). The interface is: {{{ SUBROUTINE PDAF3_assimilate(U_collect_state, U_distribute_state, & U_init_dim_obs_pdafomi, U_obs_op_pdafomi, & U_init_n_domains, U_init_dim_l, U_init_dim_obs_l_pdafomi, & U_prepoststep, U_next_observation, status) }}} with the following arguments: * `U_collect_state`: [[BR]]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 [ModifyModelforEnsembleIntegration#PDAF_get_state PDAF_get_state] and also here. * `U_distribute_state`: [[BR]]The name of a user supplied routine that initializes the model fields from the array holding the ensemble of model state vectors. * `U_init_dim_obs_pdafomi`: [[BR]]The name of the user-supplied routine that initializes the observation information and provides the size of observation vector. This routine is part of an OMI observation module. * `U_obs_op_pdafomi`: [[BR]]The name of the user-supplied routine that acts as the observation operator on some state vector. This routine is part of an OMI observation module. * `U_init_n_domains`: [[BR]]The name of the routine that provides the number of local analysis domains * `U_init_dim_l`: [[BR]]The name of the user-supplied routine that provides the state dimension for a local analysis domain * `U_init_dim_obs_l_pdafomi`: [[BR]]The name of the user-supplied routine that initializes the size of the observation vector for a local analysis domain. This routine is part of an OMI observation module. * `U_prepoststep`: [[BR]]The name of the user-supplied pre/poststep routine as in `PDAF_get_state` * `U_next_observation`: [[BR]]The name of the user-supplied routine that initializes the variables `nsteps`, `timenow`, and `doexit`. The same routine is also used in `PDAF_get_state`. * `status`: [[BR]]The integer status flag. It is zero, if the routine is exited without errors. **Notes:** * The routine is identical to the routine `PDAFlocalomi_assimilate` of PDAF 2.3, except that the argument `U_prepostep` is at a different place here. * The order of the routine names does not show the order in which these routines are executed. See the [ImplementAnalysisLocal#Executionorderofuser-suppliedroutines section on the order of the execution] on the page on implementing the analysis step of the local filter algorithms. * To use the localization in the LEnKF and ENSRF/EAKF, one needs to call [wiki:PDAFomi_set_localize_covar] in the observation modules to initialize the localization information. * If one only uses the global filters or the LEnKF and ENSRF/EAKF, the routines `U_init_n_domains`, `U_init_dim_l`, `U_init_dim_obs_l_pdafomi` only need to be present. Because they are never called for global filters, they do not need to be completed with functionality. For example, one can just use the template files fo rthese routines. * If one only uses the global filters and the LEnKF one can also use alternative routine [wiki:PDAF3_assimilate_global], in which the routines `U_init_n_domains`, `U_init_dim_l`, `U_init_dim_obs_l_pdafomi` are not in the interface. The user-supplied call-back routines are described on the page on [ImplementAnalysisLocal implementing the analysis step of the local filters]. It is recommended that the value of `status_pdaf` is checked in the program after the routine is executed. Only if its value is 0 the initialization was successful.