Changes between Version 3 and Version 4 of ImplementAnalysisPDAF3Universal
- Timestamp:
- May 24, 2025, 6:18:53 PM (8 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ImplementAnalysisPDAF3Universal
v3 v4 44 44 === `PDAF3_assimilate` === 45 45 46 This routine is used both in the ''fully-parallel'' and the ''flexible'' implementation variant of the data assimilation system. (See the page [ModifyModelforEnsembleIntegration Modification of the model code for the ensemble integration] for these variants)46 This routine is used both in the ''fully-parallel'' and the ''flexible'' implementation variants of the data assimilation system. (See the page [ModifyModelforEnsembleIntegration Modification of the model code for the ensemble integration] for these variants) 47 47 48 48 The interface for the routine `PDAF3_assimilate` contains names for routines that operate on the local analysis domains (marked by the suffix `_l`). 49 49 Here, we list the full interface of the routine. Subsequently, the user-supplied routines specified in the call are explained. 50 50 51 The interface when using one of the local filters is the following: 52 {{{ 53 SUBROUTINE PDAF3_assimilate(U_collect_state, U_distribute_state, & 54 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, & 55 U_init_n_domains, U_init_dim_l, U_init_dim_obs_l_pdafomi, & 56 U_prepoststep, U_next_observation, status) 51 The unversal interface is the following: 52 {{{ 53 SUBROUTINE PDAF3_assimilate(collect_state_pdaf, distribute_state_pdaf, & 54 init_dim_obs_pdafomi, obs_op_pdafomi, & 55 init_n_domains_pdaf, init_dim_l_pdaf, init_dim_obs_l_pdafomi, & 56 g2l_state_pdaf, l2g_state_pdaf, & 57 prepoststep_pdaf, next_observation_pdaf, status) 57 58 }}} 58 59 with the following arguments: 59 60 * Routines to transfer between model fields and state vector: 60 * [# U_collect_statecollect_state_pdaf.F90 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_init_forecast PDAF_init_forecast] and also here.61 * [# U_distribute_statedistribute_state_pdaf.F90 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.61 * [#collect_state_pdafcollect_state_pdaf.F90 collect_state_pdaf]:[[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. 62 * [#distribute_state_pdafdistribute_state_pdaf.F90 distribute_state_pdaf]:[[BR]] The name of a user supplied routine that initializes the model fields from the array holding the ensemble of model state vectors. (The same routine is also used in `PDAF_init_forecast`.) 62 63 * Observation routines using PDAF-OMI: 63 * [# U_init_dim_obs_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_pdafomi]:[[BR]] The name of the user-supplied routine that initializes the observation information and provides the size of observation vector64 * [# U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_pdafomi]:[[BR]] The name of the user-supplied routine that acts as the observation operator on some state vector64 * [#init_dim_obs_pdafomicallback_obs_pdafomi.F90 init_dim_obs_pdafomi]:[[BR]] The name of the user-supplied routine that initializes the observation information and provides the size of observation vector 65 * [#obs_op_pdafomicallback_obs_pdafomi.F90 obs_op_pdafomi]:[[BR]] The name of the user-supplied routine that acts as the observation operator on some state vector 65 66 * Routines only used for localization: 66 * [# U_init_n_domainsinit_n_domains_pdaf.F90 U_init_n_domains]:[[BR]] The name of the routine that provides the number of local analysis domains67 * [# U_init_dim_linit_dim_l_pdaf.F90 U_init_dim_l]:[[BR]] The name of the routine that provides the state dimension for a local analysis domain68 * [# U_init_dim_obs_l_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_l_pdafomi]:[[BR]] The name of the routine that initializes the size of the observation vector for a local analysis domain and the index arrays used to map between the global state vector and the local state vector.67 * [#init_n_domains_pdafinit_n_domains_pdaf.F90 init_n_domains_pdaf]:[[BR]] The name of the routine that provides the number of local analysis domains 68 * [#init_dim_l_pdafinit_dim_l_pdaf.F90 init_dim_l_pdaf]:[[BR]] The name of the routine that provides the state dimension for a local analysis domain 69 * [#init_dim_obs_l_pdafomicallback_obs_pdafomi.F90 init_dim_obs_l_pdafomi]:[[BR]] The name of the routine that initializes the size of the observation vector for a local analysis domain and the index arrays used to map between the global state vector and the local state vector. 69 70 * Prepoststep and initialization for next forecast phase 70 * [# U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep]:[[BR]] The name of the pre/poststep routine as in `PDAF_init_forecast`71 * [# U_next_observationnext_observation.F90 U_next_observation]:[[BR]] The name of a user supplied routine that initializes the variables `nsteps`, `timenow`, and `doexit`. The same routine is also used in `PDAF_init_forecast`.71 * [#prepoststep_pdafprepoststep_ens_pdaf.F90 prepoststep_pdaf]:[[BR]] The name of the pre/poststep routine as in `PDAF_init_forecast`. (The same routine is also used in `PDAF_init_forecast`.) 72 * [#next_observation_pdafnext_observation.F90 next_observation_pdaf]:[[BR]] The name of a user supplied routine that initializes the variables `nsteps`, `timenow`, and `doexit`. (The same routine is also used in `PDAF_init_forecast`.) 72 73 * Status flag 73 74 * `status`:[[BR]] The integer status flag. It is zero, if the routine is exited without errors. … … 79 80 === `PDAF3_assim_offline` === 80 81 81 For the offline mode of PDAF, the routine `PDAF3_assim_offline ` is used to perform the analysis step.82 For the offline mode of PDAF, the routine `PDAF3_assim_offline_local` is used to perform the analysis step. 82 83 The interface of the routine is identical with that of `PDAF3_assimilate`, except that the user-supplied routines `U_distribute_state`, `U_collect_state` and `U_next_observation` are missing. 83 84 … … 85 86 {{{ 86 87 SUBROUTINE PDAF3_assim_offline( & 87 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, &88 U_init_n_domains, U_init_dim_l, U_init_dim_obs_l_pdafomi, &89 U_prepoststep, status)88 init_dim_obs_pdafomi, obs_op_pdafomi, & 89 init_n_domains_pdaf, init_dim_l_pdaf, init_dim_obs_l_pdafomi, & 90 prepoststep_pdaf, status) 90 91 }}} 91 92 … … 97 98 This routine exists for backward-compatibility. In implementations that were done before the release of PDAF V3.0, a 'put_state' routine was used for the `flexible` parallelization variant and for the offline mode. 98 99 When the 'flexible' implementation variant is chosen for the assimilation system, the routine. The routine `PDAF3_put_state` allows to port such implemnetations to the PDAF3 interface with minimal changes. 99 The interface of the routine is identical with that of `PDAF3_assimilate `, except that the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.100 The interface of the routine is identical with that of `PDAF3_assimilate_local`, except that the user-supplied routines `U_distribute_state` and `U_next_observation` are missing. 100 101 101 102 The interface when using one of the local filters is the following: 102 103 {{{ 103 SUBROUTINE PDAF3_put_state(U_collect_state, & 104 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, & 105 U_init_n_domains, U_init_dim_l, U_init_dim_obs_l_pdafomi, & 106 U_prepoststep, status) 107 }}} 108 109 * If your code shows a call to `PDAFomi_put_state_local`, it uses the implementation variant without PDAFlocal. This is documented on the page on [wiki:ImplementAnalysisLocal Implementing the Analysis Step for the Local Filters with OMI without PDAFlocal (until V2.2.1 of PDAF)]. 104 SUBROUTINE PDAF3_put_state(collect_state_pdaf, & 105 init_dim_obs_pdafomi, obs_op_pdafomi, & 106 init_n_domains_pdaf, init_dim_l_pdaf, init_dim_obs_l_pdafomi, & 107 prepoststep_pdaf, status) 108 }}} 109 110 110 111 111 == User-supplied routines == … … 113 113 Here, all user-supplied routines are described that are required in the call to `PDAF3_assimilate`, `PDAF3_assim_offline` or `PDAF3_put_state`. For some of the generic routines, we link to the page on [ModifyModelforEnsembleIntegration modifying the model code for the ensemble integration]. 114 114 115 To indicate user-supplied routines we use the prefix `U_`. In the tutorials in `tutorial/` and in the template directory `templates/` these routines exist without the prefix, but with the extension `_pdaf`. The files are named correspondingly. The user-routines relating to OMI are collected in the file callback_obs_pdafomi.F90. In the section titles below we provide the name of the template file in parentheses.116 117 115 In the subroutine interfaces some variables appear with the suffix `_p` (short for 'process'). This suffix indicates that the variable is particular to a model sub-domain, if a domain decomposed model is used. In addition, there will be variables with suffix `_l` (indicating 'local'). 118 116 119 120 === `U_collect_state` (collect_state_pdaf.F90) === 117 Call-back routines that end on `_pdaf` are regular call-back routines from the core part of PDAF, while call-back routines that end on `_pdafomi` handle observations within PDAF-OMI. 118 119 120 === `collect_state_pdaf` (collect_state_pdaf.F90) === 121 121 122 122 This routine is independent of the filter algorithm used. … … 124 124 See the page on [ModifyModelforEnsembleIntegration#collect_state_pdafcollect_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine. 125 125 126 === ` U_distribute_state` (distribute_state_pdaf.F90) ===126 === `distribute_state_pdaf` (distribute_state_pdaf.F90) === 127 127 128 128 This routine is independent of the filter algorithm used. … … 131 131 132 132 133 === ` U_init_dim_obs_pdafomi` (callback_obs_pdafomi.F90) ===133 === `init_dim_obs_pdafomi` (callback_obs_pdafomi.F90) === 134 134 135 135 This is a call-back routine initializing the observation information. The routine just calls a routine from the observation module for each observation type. … … 139 139 140 140 141 === ` U_obs_op_pdafomi` (callback_obs_pdafomi.F90) ===141 === `obs_op_pdafomi` (callback_obs_pdafomi.F90) === 142 142 143 143 This is a call-back routine applying the observation operator to the state vector. The routine calls a routine from the observation module for each observation type. … … 146 146 147 147 148 === ` U_init_n_domains` (init_n_domains_pdaf.F90) ===148 === `init_n_domains_pdaf` (init_n_domains_pdaf.F90) === 149 149 150 150 This routine is only used for localization. It is called during the analysis step before the loop over the local analysis domains is entered. 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. … … 152 152 The interface for this routine is: 153 153 {{{ 154 SUBROUTINE init_n_domains (step, n_domains_p)154 SUBROUTINE init_n_domains_pdaf(step, n_domains_p) 155 155 156 156 INTEGER, INTENT(in) :: step ! Current time step … … 162 162 163 163 164 === ` U_init_dim_l` (init_dim_l_pdaf.F90) ===164 === `init_dim_l_pdaf` (init_dim_l_pdaf.F90) === 165 165 166 166 This routine is only used for localization. … … 168 168 The interface for this routine is: 169 169 {{{ 170 SUBROUTINE init_dim_l (step, domain_p, dim_l)170 SUBROUTINE init_dim_l_pdaf(step, domain_p, dim_l) 171 171 172 172 INTEGER, INTENT(in) :: step ! Current time step … … 207 207 208 208 209 === ` U_init_dim_obs_l_pdafomi` (callback_obs_pdafomi.F90) ===209 === `init_dim_obs_l_pdafomi` (callback_obs_pdafomi.F90) === 210 210 211 211 This routine is only used for localization. It 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. … … 214 214 215 215 216 === ` U_prepoststep` (prepoststep_ens_pdaf.F90) ===216 === `prepoststep_pdaf` (prepoststep_ens_pdaf.F90) === 217 217 218 218 The routine has already been described for modifying the model for the ensemble integration and for inserting the analysis step. … … 221 221 222 222 223 === ` U_next_observation` (next_observation_pdaf.F90) ===223 === `next_observation_pdaf` (next_observation_pdaf.F90) === 224 224 225 225 This routine is independent of the filter algorithm used. … … 231 231 == Execution order of user-supplied routines == 232 232 233 The user-supplied routines are executed in the order listed below. The order can be important as some routines can perform preparatory work for routines executed later on during the analysis. For example, in ` U_init_dim_l` we can prepare the index array that provides the information how to localize a global state vector.234 235 Before the analysis step is called the following is executed :236 1. [# U_collect_statecollect_state_pdaf.F90 U_collect_state] (called once for each ensemble member)237 1. [# U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep] (Call to act on the forecast ensemble, called with negative value of the time step)233 The user-supplied routines are executed in the order listed below. The order can be important as some routines can perform preparatory work for routines executed later on during the analysis. For example, in `init_dim_l_pdaf` we can prepare the index array that provides the information how to localize a global state vector. 234 235 Before the analysis step is called the following is executed by `PDAF3_assimilate` and `PDAF3_put_state`: 236 1. [#collect_state_pdafcollect_state_pdaf.F90 collect_state_pdaf] (called once for each ensemble member) 237 1. [#prepoststep_pdafprepoststep_ens_pdaf.F90 prepoststep_pdaf] (Call to act on the forecast ensemble, called with negative value of the time step) 238 238 239 239 At the analysis time, the observations are initialized by the routines: 240 1. [# U_init_dim_obs_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_pdafomi]241 1. [# U_obs_op_pdadfomicallback_obs_pdafomi.F90 U_obs_op_pdafomi] (Called `dim_ens` times; once for each ensemble member)240 1. [#init_dim_obs_pdafomicallback_obs_pdafomi.F90 init_dim_obs_pdafomi] 241 1. [#obs_op_pdadfomicallback_obs_pdafomi.F90 obs_op_pdafomi] (Called `dim_ens` times; once for each ensemble member) 242 242 243 243 Now the analysis step is entered and the number of local analysis domain is initialized by calling: 244 1. [# U_init_n_domainsinit_n_domains_pdaf.F90 U_init_n_domains]244 1. [#init_n_domains_pdafinit_n_domains_pdaf.F90 init_n_domains_pdaf] 245 245 246 246 In the loop over all local analysis domains, it is executed for each local analysis domain: 247 1. [# U_init_dim_linit_dim_l_pdaf.F90 U_init_dim_l]248 1. [# U_init_dim_obs_l_pdafomiinit_dim_obs_l_pdaf.F90 U_init_dim_obs_l_pdafomi]247 1. [#init_dim_l_pdafinit_dim_l_pdaf.F90 init_dim_l_pdaf] 248 1. [#init_dim_obs_l_pdafomiinit_dim_obs_l_pdaf.F90 U_init_dim_obs_l_pdafomi] 249 249 250 250 After the loop over all local analysis domains, it is executed: 251 1. [# U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep] (Call to act on the analysis ensemble, called with (positive) value of the time step)251 1. [#prepoststep_pdafprepoststep_ens_pdaf.F90 prepoststep_pdaf] (Call to act on the analysis ensemble, called with (positive) value of the time step) 252 252 253 253 In case of the routine `PDAF3_assimilate`, the following routines are executed after the analysis step: 254 1. [# U_distribute_statedistribute_state_pdaf.F90 U_distribute_state]255 1. [# U_next_observationnext_observation_pdaf.F90 U_next_observation]254 1. [#distribute_state_pdafdistribute_state_pdaf.F90 distribute_state_pdaf] 255 1. [#next_observation_pdafnext_observation_pdaf.F90 next_observation_pdaf]