Changes between Version 3 and Version 4 of ImplementAnalysisPDAF3Universal


Ignore:
Timestamp:
May 24, 2025, 6:18:53 PM (8 days ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ImplementAnalysisPDAF3Universal

    v3 v4  
    4444=== `PDAF3_assimilate` ===
    4545
    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)
     46This 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)
    4747
    4848The interface for the routine `PDAF3_assimilate` contains names for routines that operate on the local analysis domains (marked by the suffix `_l`).
    4949Here, we list the full interface of the routine. Subsequently, the user-supplied routines specified in the call are explained.
    5050
    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)
     51The 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)
    5758}}}
    5859with the following arguments:
    5960* 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`.)
    6263* 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 vector
    64  * [#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 vector
     64 * [#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
    6566* 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 domains
    67  * [#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
    68  * [#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.
    6970* 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`.)
    7273* Status flag
    7374 * `status`:[[BR]] The integer status flag. It is zero, if the routine is exited without errors.
     
    7980=== `PDAF3_assim_offline` ===
    8081
    81 For the offline mode of PDAF, the routine `PDAF3_assim_offline` is used to perform the analysis step.
     82For the offline mode of PDAF, the routine `PDAF3_assim_offline_local` is used to perform the analysis step.
    8283The 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.
    8384
     
    8586{{{
    8687  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)
    9091}}}
    9192
     
    9798This 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.
    9899When 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.
     100The 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.
    100101
    101102The interface when using one of the local filters is the following:
    102103{{{
    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
    110110
    111111== User-supplied routines ==
     
    113113Here, 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].
    114114
    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 
    117115In 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').
    118116
    119 
    120 === `U_collect_state` (collect_state_pdaf.F90) ===
     117Call-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) ===
    121121
    122122This routine is independent of the filter algorithm used.
     
    124124See the page on [ModifyModelforEnsembleIntegration#collect_state_pdafcollect_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
    125125
    126 === `U_distribute_state` (distribute_state_pdaf.F90) ===
     126=== `distribute_state_pdaf` (distribute_state_pdaf.F90) ===
    127127
    128128This routine is independent of the filter algorithm used.
     
    131131
    132132
    133 === `U_init_dim_obs_pdafomi` (callback_obs_pdafomi.F90) ===
     133=== `init_dim_obs_pdafomi` (callback_obs_pdafomi.F90) ===
    134134
    135135This is a call-back routine initializing the observation information. The routine just calls a routine from the observation module for each observation type.
     
    139139
    140140
    141 === `U_obs_op_pdafomi` (callback_obs_pdafomi.F90) ===
     141=== `obs_op_pdafomi` (callback_obs_pdafomi.F90) ===
    142142
    143143This 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.
     
    146146
    147147
    148 === `U_init_n_domains` (init_n_domains_pdaf.F90) ===
     148=== `init_n_domains_pdaf` (init_n_domains_pdaf.F90) ===
    149149
    150150This 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.
     
    152152The interface for this routine is:
    153153{{{
    154 SUBROUTINE init_n_domains(step, n_domains_p)
     154SUBROUTINE init_n_domains_pdaf(step, n_domains_p)
    155155
    156156  INTEGER, INTENT(in)  :: step        ! Current time step
     
    162162
    163163
    164 === `U_init_dim_l` (init_dim_l_pdaf.F90) ===
     164=== `init_dim_l_pdaf` (init_dim_l_pdaf.F90) ===
    165165
    166166This routine is only used for localization.
     
    168168The interface for this routine is:
    169169{{{
    170 SUBROUTINE init_dim_l(step, domain_p, dim_l)
     170SUBROUTINE init_dim_l_pdaf(step, domain_p, dim_l)
    171171
    172172  INTEGER, INTENT(in)  :: step        ! Current time step
     
    207207
    208208
    209 === `U_init_dim_obs_l_pdafomi` (callback_obs_pdafomi.F90) ===
     209=== `init_dim_obs_l_pdafomi` (callback_obs_pdafomi.F90) ===
    210210
    211211This 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.
     
    214214
    215215
    216 === `U_prepoststep` (prepoststep_ens_pdaf.F90) ===
     216=== `prepoststep_pdaf` (prepoststep_ens_pdaf.F90) ===
    217217
    218218The routine has already been described for modifying the model for the ensemble integration and for inserting the analysis step.
     
    221221
    222222
    223 === `U_next_observation` (next_observation_pdaf.F90) ===
     223=== `next_observation_pdaf` (next_observation_pdaf.F90) ===
    224224
    225225This routine is independent of the filter algorithm used.
     
    231231== Execution order of user-supplied routines ==
    232232
    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)
     233The 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
     235Before 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)
    238238
    239239At 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)
    242242
    243243Now 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]
    245245
    246246In 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]
    249249
    250250After 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)
    252252
    253253In 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]