Changes between Version 1 and Version 2 of ImplementAnalysisPDAF3UniversalLocal
- Timestamp:
- May 24, 2025, 6:09:26 PM (8 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ImplementAnalysisPDAF3UniversalLocal
v1 v2 12 12 <li><a href="ImplementAnalysisPDAF3Universal">Universal interface</a></li> 13 13 <li>Universal interface using g2l/l2g_state</li> 14 <li><a href="ImplementAnalysisPDAF3UniversalGlobal"> Interface for allglobal filters</a></li>14 <li><a href="ImplementAnalysisPDAF3UniversalGlobal">Specific Interface for global filters</a></li> 15 15 </ol> 16 16 <li> <a href="Implement3DVarAnalysisOverview"> General overview for 3D-Var methods</a></li> … … 49 49 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) 50 50 51 The interface for the routine `PDAF3_assimilate ` contains names for routines that operate on the local analysis domains (marked by the suffix `_l`).51 The interface for the routine `PDAF3_assimilate_local` contains names for routines that operate on the local analysis domains (marked by the suffix `_l`). 52 52 Here, we list the full interface of the routine. Subsequently, the user-supplied routines specified in the call are explained. 53 53 54 54 The interface when using one of the local filters is the following: 55 55 {{{ 56 SUBROUTINE PDAF3_assimilate( U_collect_state, U_distribute_state, &57 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, &58 U_init_n_domains, U_init_dim_l, U_init_dim_obs_l_pdafomi, &59 U_gel_state, U_l2g_state, &60 U_prepoststep, U_next_observation, status)56 SUBROUTINE PDAF3_assimilate(collect_state_pdaf, distribute_state_pdaf, & 57 init_dim_obs_pdafomi, obs_op_pdafomi, & 58 init_n_domains_pdaf, init_dim_l_pdaf, init_dim_obs_l_pdafomi, & 59 g2l_state_pdaf, l2g_state_pdaf, & 60 prepoststep_pdaf, next_observation_pdaf, status) 61 61 }}} 62 62 with the following arguments: 63 63 * Routines to transfer between model fields and state vector: 64 * [# 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.65 * [# 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.64 * [#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. 65 * [#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`.) 66 66 * Observation routines using PDAF-OMI: 67 * [# 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 vector68 * [# 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 vector67 * [#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 68 * [#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 69 69 * Routines only used for localization: 70 * [#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 domains 71 * [#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 domain 72 * [#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. 70 * [#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 71 * [#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 72 * [#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. 73 * [#g2l_state_pdafg2l_state_pdaf.F90 g2l_state_pdaf]: The name of the routine that initializes a local state vector from the global state vector 74 * [#l2g_state_pdafl2g_state_pdaf.F90 l2g_state_pdaf]: The name of the routine that initializes the corresponding part of the global state vector from the provided local state vector 73 75 * Prepoststep and initialization for next forecast phase 74 * [# U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep]:[[BR]] The name of the pre/poststep routine as in `PDAF_init_forecast`75 * [# 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`.76 * [#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`.) 77 * [#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`.) 76 78 * Status flag 77 79 * `status`:[[BR]] The integer status flag. It is zero, if the routine is exited without errors. … … 81 83 82 84 83 === `PDAF3_assim_offline ` ===84 85 For the offline mode of PDAF, the routine `PDAF3_assim_offline ` is used to perform the analysis step.86 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.85 === `PDAF3_assim_offline_local` === 86 87 For the offline mode of PDAF, the routine `PDAF3_assim_offline_local` is used to perform the analysis step. 88 The interface of the routine is identical with that of `PDAF3_assimilate_local`, except that the user-supplied routines `U_distribute_state`, `U_collect_state` and `U_next_observation` are missing. 87 89 88 90 The interface is: 89 91 {{{ 90 SUBROUTINE PDAF3_assim_offline( & 91 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, & 92 U_init_n_domains, U_init_dim_l, U_init_dim_obs_l_pdafomi, & 93 U_prepoststep, status) 94 }}} 95 96 97 98 99 === `PDAF3_put_state` === 92 SUBROUTINE PDAF3_assim_offline_local( & 93 init_dim_obs_pdafomi, obs_op_pdafomi, & 94 init_n_domains_pdaf, init_dim_l_pdaf, init_dim_obs_l_pdafomi, & 95 g2l_state_pdaf, l2g_state_pdaf, & 96 prepoststep_pdaf, status) 97 }}} 98 99 100 101 102 === `PDAF3_put_state_local` === 100 103 101 104 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. 102 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.103 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.105 When the 'flexible' implementation variant is chosen for the assimilation system, the routine. The routine `PDAF3_put_state_local` allows to port such implemnetations to the PDAF3 interface with minimal changes. 106 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. 104 107 105 108 The interface when using one of the local filters is the following: 106 109 {{{ 107 SUBROUTINE PDAF3_put_state (U_collect_state, &108 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, &109 U_init_n_domains, U_init_dim_l, U_init_dim_obs_l_pdafomi, &110 U_prepoststep, status)111 }}} 112 113 * 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)]. 110 SUBROUTINE PDAF3_put_state_local(collect_state_pdaf, & 111 init_dim_obs_pdafomi, obs_op_pdafomi, & 112 init_n_domains_pdaf, init_dim_l_pdaf, init_dim_obs_l_pdafomi, & 113 g2l_state_pdaf, l2g_state_pdaf, & 114 prepoststep_pdaf, status) 115 }}} 116 114 117 115 118 == User-supplied routines == 116 119 117 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]. 118 119 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. 120 Here, all user-supplied routines are described that are required in the call to `PDAF3_assimilate_local`, `PDAF3_assim_offline_local` or `PDAF3_put_state_local`. For some of the generic routines, we link to the page on [ModifyModelforEnsembleIntegration modifying the model code for the ensemble integration]. 120 121 121 122 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'). 122 123 123 124 124 === ` U_collect_state` (collect_state_pdaf.F90) ===125 === `collect_state_pdaf` (collect_state_pdaf.F90) === 125 126 126 127 This routine is independent of the filter algorithm used. … … 128 129 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. 129 130 130 === ` U_distribute_state` (distribute_state_pdaf.F90) ===131 === `distribute_state_pdaf` (distribute_state_pdaf.F90) === 131 132 132 133 This routine is independent of the filter algorithm used. … … 135 136 136 137 137 === ` U_init_dim_obs_pdafomi` (callback_obs_pdafomi.F90) ===138 === `init_dim_obs_pdafomi` (callback_obs_pdafomi.F90) === 138 139 139 140 This is a call-back routine initializing the observation information. The routine just calls a routine from the observation module for each observation type. … … 143 144 144 145 145 === ` U_obs_op_pdafomi` (callback_obs_pdafomi.F90) ===146 === `obs_op_pdafomi` (callback_obs_pdafomi.F90) === 146 147 147 148 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. … … 150 151 151 152 152 === ` U_init_n_domains` (init_n_domains_pdaf.F90) ===153 === `init_n_domains_pdaf` (init_n_domains_pdaf.F90) === 153 154 154 155 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. … … 156 157 The interface for this routine is: 157 158 {{{ 158 SUBROUTINE init_n_domains (step, n_domains_p)159 SUBROUTINE init_n_domains_pdaf(step, n_domains_p) 159 160 160 161 INTEGER, INTENT(in) :: step ! Current time step … … 166 167 167 168 168 === ` U_init_dim_l` (init_dim_l_pdaf.F90) ===169 === `init_dim_l_pdaf` (init_dim_l_pdaf.F90) === 169 170 170 171 This routine is only used for localization. … … 172 173 The interface for this routine is: 173 174 {{{ 174 SUBROUTINE init_dim_l (step, domain_p, dim_l)175 SUBROUTINE init_dim_l_pdaf(step, domain_p, dim_l) 175 176 176 177 INTEGER, INTENT(in) :: step ! Current time step … … 211 212 212 213 213 === ` U_init_dim_obs_l_pdafomi` (callback_obs_pdafomi.F90) ===214 === `init_dim_obs_l_pdafomi` (callback_obs_pdafomi.F90) === 214 215 215 216 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. … … 217 218 See the [wiki:OMI_Callback_obs_pdafomi documentation on callback_obs_pdafomi.F90] for more information. 218 219 219 === ` U_g2l_state` (g2l_state_pdaf.F90) ===220 === `g2l_state_pdaf` (g2l_state_pdaf.F90) === 220 221 221 222 The interface for this routine is: 222 223 {{{ 223 SUBROUTINE g2l_state (step, domain_p, dim_p, state_p, dim_l, state_l)224 SUBROUTINE g2l_state_pdaf(step, domain_p, dim_p, state_p, dim_l, state_l) 224 225 225 226 INTEGER, INTENT(in) :: step ! Current time step … … 235 236 Hints: 236 237 * 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`. 237 * Usually, one can use the index array `id_lstate_in_pstate`, which is initialized in ` U_init_dim_l`. The array holds the indices of the local state vector elements in the global state vector.238 239 240 === ` U_l2g_state` (l2g_state_pdaf.F90) ===238 * Usually, one can use the index array `id_lstate_in_pstate`, which is initialized in `init_dim_l_pdaf`. The array holds the indices of the local state vector elements in the global state vector. 239 240 241 === `l2g_state_pdaf` (l2g_state_pdaf.F90) === 241 242 242 243 The interface for this routine is: 243 244 {{{ 244 SUBROUTINE l2g_state (step, domain_p, dim_l, state_l, dim_p, state_p)245 SUBROUTINE l2g_state_pdaf(step, domain_p, dim_l, state_l, dim_p, state_p) 245 246 246 247 INTEGER, INTENT(in) :: step ! Current time step … … 256 257 Hints: 257 258 * 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`. 258 * Usually, one can use the index array `id_lstate_in_pstate`, which is initialized in ` U_init_dim_l`. The array holds the indices of the local state vector elements in the global state vector.259 260 261 === ` U_prepoststep` (prepoststep_ens_pdaf.F90) ===259 * Usually, one can use the index array `id_lstate_in_pstate`, which is initialized in `init_dim_l_pdaf`. The array holds the indices of the local state vector elements in the global state vector. 260 261 262 === `prepoststep_pdaf` (prepoststep_ens_pdaf.F90) === 262 263 263 264 The routine has already been described for modifying the model for the ensemble integration and for inserting the analysis step. … … 266 267 267 268 268 === ` U_next_observation` (next_observation_pdaf.F90) ===269 === `next_observation_pdaf` (next_observation_pdaf.F90) === 269 270 270 271 This routine is independent of the filter algorithm used.