Changes between Version 2 and Version 3 of Implement3DVarAnalysisPDAF3_3DVar


Ignore:
Timestamp:
May 27, 2025, 1:50:52 PM (5 days ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Implement3DVarAnalysisPDAF3_3DVar

    v2 v3  
    3333== Overview ==
    3434
    35 This page describes the recommended implementation of the analysis step for the parameterized 3D-Var using the particular interface routines.
    36 
    37 ||
    38 
    39 There are genenerally three different variants of 3D-Var provided by PDAF: parameterized 3D-Var, 3D Ensemble Var, and hybrid (parameterized + ensemble) 3D-Var. All can be called using the universal interface routines described here.
    40 
    41 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 `PDAF3_assimilate_3dvar_all` in the online mode of PDAF or `PDAF3_assim_offline_3dvar_all` for the offline mode. With regard to the parallelization, all these routines (except `collect_state_pdaf`, `distribute_state_pdaf`, and `next_observation_pdaf`) are executed by the filter processes (`filterpe=.true.`) only.
    42 
    43 The universal interface has more arguments than the specific interfaces for the parameterized 3D-Var or the 3D ensemble Var methods. It is useful if one implements both the 3D-Var with parameterized covariances and rhe 3D ensemble Var. The hybrid 3D-Var using the LESTKF is always called using this unversal interface.
    44 
    45 The different 3D-Var methods in PDAF were explained on the [wiki:Implement3DVarAnalysisOverview page providing the verview of the Analysis Step for 3D-Var Methods]. Depending the type of 3D-Var, the background covariance matrix '''B''' is represented either in a parameterized form, by an ensemble, or by a combination of both. The 3D-Var methods that use an ensemble need to transform the ensemble perturbations using 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.
    46 
    47 For completeness we discuss here all user-supplied routines that are specified in the interface to `PDAFomi_assimilate_hyb3dvar_X`. 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.
    48 
    49 == `PDAFomi_assimilate_3dvar` ==
    50 
    51 This routine is used both in the ''fully-parallel'' and the ''flexible'' implementation variants of the data assimilation system. (See the page [OnlineModifyModelforEnsembleIntegration_PDAF3 Modification of the model code for the ensemble integration] for these variants)
    52 
    53 The interface for using the parameterized 3D-Var is:
     35This page describes the implementation of the analysis step for the parameterized 3D-Var using the particular interface routines.
     36
     37|| The interface routines for the parameterized 3D-Var are specialized versions of the universal interface with a reduced number of arguments. If one implements both 3D Ensemble Var and parameterlized 3D-Var we recommend to use the [wiki:Implement3DVarAnalysisPDAF3Universal universal interface routines for 3D-Var]. ||
     38
     39The different 3D-Var methods in PDAF were explained on the [wiki:Implement3DVarAnalysisOverviewPDAF3 page providing the verview of the Analysis Step for 3D-Var Methods]. Depending the type of 3D-Var, the background covariance matrix '''B''' is represented either in a parameterized form, by an ensemble, or by a combination of both. The 3D-Var methods that use an ensemble need to transform the ensemble perturbations using an ensemble Kalman filter.
     40
     41For 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 PDAF-OMI structure.  in the call to the assimilation routines as was examplained on the [wiki:Implement3DVarAnalysisOverviewPDAF3 page providing the verview of the Analysis Step for 3D-Var Methods].
     42
     43For completeness we discuss here all user-supplied routines that are specified as arguments. Thus, some of the user-supplied routines, which were explained on the page describing the modification of the model code for the ensemble integration, are repeated here.
     44
     45
     46== AssimilationRoutines ==
     47
     48The general aspects of the filter (or solver) specific routines for the 3D-Var analysis step have been described on the page [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 Modification of the model code for the ensemble integration]. Here, we list the full interface of the routine. Subsequently, the user-supplied routines specified in the call is explained.
     49
     50=== `PDAF3_assimilate_3dvar` ===
     51
     52This routine is used both in the ''fully-parallel'' and the ''flexible'' implementation variants of the data assimilation system. (See the page [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 Modification of the model code for the ensemble integration] for these variants)
     53
     54The interface is:
    5455{{{
    5556  SUBROUTINE PDAF3_assimilate_3dvar(collect_state_pdaf, distribute_state_pdaf, &
     
    7374
    7475
    75 == `PDAF3_assim_offline_3dvar` ==
    76 
    77 This routine is used to perform the analysi step for the offline mode of PDAF.
    78 The interface of the routine is identical with that of `PDAF3_assimilate_3dvar`, except that the user-supplied routines `U_distribute_state`, `U_collect_state` and `U_next_observation` are missing.
     76=== `PDAF3_assim_offline_3dvar` ===
     77
     78This routine is used to perform the analysis step for the offline mode of PDAF.
     79The interface of the routine is identical with that of `PDAF3_assimilate_3dvar`, except that the user-supplied routines `distribute_state_pdaf`, `collect_state` and `next_observation_pdaf` are missing.
    7980
    8081The interface is:
     
    8889
    8990
    90 == `PDAF3_put_state_3dvar` ==
    91 
    92 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.
    93 When the 'flexible' implementation variant is chosen for the assimilation system, the routine. This routine allows to port such implementations to the PDAF3 interface with minimal changes.
    94 The interface of the routine is identical with that of `PDAF3_assimilate_3dvar`, except that the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
     91=== `PDAF3_put_state_3dvar` ===
     92
     93This 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.
     94When the ''flexible'' implementation variant is chosen for the assimilation system, the routine. This routine allows to port such implementations to the PDAF3 interface with minimal changes.
     95The interface of the routine is identical with that of `PDAF3_assimilate_3dvar`, except that the user-supplied routines `distribute_state_pdaf` and `next_observation_pdaf` are missing.
    9596
    9697The interface is:
     
    106107== User-supplied routines ==
    107108
    108 Here all user-supplied routines are described that are required in the call to `PDAFomi_assimilate_3dvar`. For some of the generic routines, we link to the page on [ModifyModelforEnsembleIntegration modifying the model code for the ensemble integration].
    109 
    110 To indicate user-supplied routines we use the prefix `U_`. In the template directory `templates/` as well as in the tutorial implementations in `tutorial/` these routines exist without the prefix, but with the extension `_pdaf.F90`. 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.
    111 
    112 In the subroutine interfaces some variables appear with the suffix `_p`. This suffix indicates that the variable is particular to a model sub-domain, if a domain decomposed model is used. Thus, the value(s) in the variable will be different for different model sub-domains.
    113 
    114 
    115 === `U_collect_state` (collect_state_pdaf.F90) ===
     109Here, all user-supplied routines are described that are required in the call to the assimilation routines for for parameterized 3D-Var. For some of the generic routines, we link to the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3 modifying the model code for the ensemble integration].
     110
     111The names of the user-suppled routines routines ending on `_pdaf` relate to operations on the model state, while those ensing on `_pdafomi` handle observations using the structured appraoch guided by [wiki:PDAF_OMI_Overview PDAF-OMI]. The user-routines relating to PDAF-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.
     112
     113In the subroutine interfaces some variables appear with the suffix `_p`. This suffix indicates that the variable is particular to a model sub-domain, if a domain decomposed model is used. Thus, the value(s) in the variable will be different for different model sub-domains. 
     114
     115
     116=== `collect_state_pdaf` (collect_state_pdaf.F90) ===
    116117
    117118This routine is independent of the filter algorithm used.
    118119
    119 See the page on [InsertAnalysisStep#U_collect_statecollect_state_pdaf.F90 inserting the analysis step] for the description of this routine.
    120 
    121 
    122 === `U_distribute_state` (distribute_state_pdaf.F90) ===
     120See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#collect_state_pdafcollect_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
     121
     122=== `distribute_state_pdaf` (distribute_state_pdaf.F90) ===
    123123
    124124This routine is independent of the filter algorithm used.
    125125
    126 See the page on [InsertAnalysisStep#U_distribute_statedistribute_state_pdaf.F90 inserting the analysis step] for the description of this routine.
    127 
    128 
    129 === `U_init_dim_obs_pdafomi` (callback_obs_pdafomi.F90) ===
    130 
    131 This is a call-back routine for PDAF-OMI initializing the observation information. The routine just calls a routine from the observation module for each observation type.
    132 
    133 See the [wiki:OMI_Callback_obs_pdafomi documentation on callback_obs_pdafomi.F90] for more information.
    134 
    135 
    136 
    137 === `U_obs_op_pdafomi` (callback_obs_pdafomi.F90) ===
    138 
    139 This is a call-back routine for PDAF-OMI applying the observation operator to the state vector. The routine calls a routine from the observation module for each observation type.
    140 
    141 See the [wiki:OMI_Callback_obs_pdafomi documentation on callback_obs_pdafomi.F90] for more information.
    142 
    143 
    144 
    145 
    146 === `U_cvt` (cvt_pdaf.F90) ===
     126See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#distribute_state_pdafdistribute_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
     127
     128
     129
     130=== `init_dim_obs_pdafomi` (callback_obs_pdafomi.F90) ===
     131
     132This is a call-back routine initializing the observation information. The routine just calls a routine from the observation module for each observation type.
     133
     134See the [wiki:OMI_Callback_obs_pdafomi documentation on callback_obs_pdafomi.F90] for more information.
     135
     136
     137
     138=== `obs_op_pdafomi` (callback_obs_pdafomi.F90) ===
     139
     140This 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.
     141
     142See the [wiki:OMI_Callback_obs_pdafomi documentation on callback_obs_pdafomi.F90] for more information.
     143
     144
     145
     146=
     147=== `cvt_pdaf` (cvt_pdaf.F90) ===
    147148
    148149The interface for this routine is:
     
    158159
    159160The routine is called during the analysis step during the iterative minimization of the cost function.
    160 It has to apply the control vector transformation to the control vector and return the transformed result vector. Usually this transformation is the multiplication with the square-root of the background error covariance matrix '''B'''.
     161It has to apply the control vector transformation to the control vector and return the transformed result state vector. Usually this transformation is the multiplication with the square-root of the background error covariance matrix '''B''' in its parameterized form.
    161162
    162163If the control vector is decomposed in case of parallelization it first needs to the gathered on each processor and afterwards the transformation is computed on the potentially domain-decomposed state vector.
    163164
    164165
    165 === `U_cvt_adj` (cvt_adj_pdaf.F90) ===
     166=== `cvt_adj_pdaf` (cvt_adj_pdaf.F90) ===
    166167
    167168The interface for this routine is:
     
    177178
    178179The routine is called during the analysis step during the iterative minimization of the cost function.
    179 It has to apply the adjoint control vector transformation to a state vector and return the control vector. Usually this transformation is the multiplication with transposed of the square-root of the background error covariance matrix '''B'''.
    180 
    181 If the state vector is decomposed in case of parallelization one needs to take care that the application of the trasformation is complete. This usually requries a comminucation with MPI_Allreduce to obtain a global sun.
    182 
    183 
    184 
    185 === `U_obs_op_lin_pdafomi` (callback_obs_pdafomi.F90) ===
     180It has to apply the adjoint control vector transformation to a state vector and return the control vector. Usually this transformation is the multiplication with transposed of the square-root of the background error covariance matrix '''B''' in its parameterized form.
     181
     182If the state vector is decomposed in case of parallelization one needs to take care that the application of the trasformation is complete. This usually requries a comminucation with MPI_Allreduce to obtain a global sum.
     183
     184
     185
     186=== `obs_op_lin_pdafomi` (callback_obs_pdafomi.F90) ===
    186187
    187188This is a call-back routine for PDAF-OMI applying the linearized observation operator to the state vector. The routine calls a routine from the observation module for each observation type. If the full observation operator is lineaer the same operator can be used here.
     
    190191
    191192
    192 === `U_obs_op_adj_pdafomi` (callback_obs_pdafomi.F90) ===
     193=== `obs_op_adj_pdafomi` (callback_obs_pdafomi.F90) ===
    193194
    194195This is a call-back routine for PDAF-OMI applying the adjoint observation operator to some vector inthe observation space. The routine calls a routine from the observation module for each observation type.
     
    197198
    198199
    199 === `U_prepoststep` (prepoststep_ens_pdaf.F90) ===
     200
     201=== `prepoststep_pdaf` (prepoststep_ens_pdaf.F90) ===
    200202
    201203The routine has already been described for modifying the model for the ensemble integration and for inserting the analysis step.
    202204
    203 See the page on [InsertAnalysisStep#U_prepoststepprepoststep_ens_pdaf.F90 inserting the analysis step] for the description of this routine.
    204 
    205 
    206 === `U_next_observation` (next_observation_pdaf.F90) ===
     205See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#distribute_state_pdafdistribute_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
     206
     207
     208=== `next_observation_pdaf` (next_observation_pdaf.F90) ===
    207209
    208210This routine is independent of the filter algorithm used.
    209211
    210 See the page on [InsertAnalysisStep#U_next_observationnext_observation_pdaf.F90 inserting the analysis step] for the description of this routine.
     212See the page on [wiki:OnlineModifyModelforEnsembleIntegration_PDAF3#distribute_state_pdafdistribute_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
    211213
    212214
    213215== Execution order of user-supplied routines ==
    214216
    215 The user-supplied routines are essentially executed in the order they are listed in the interface to `PDAFomi_assimilate_3dvar`. The order can be important as some routines can perform preparatory work for later routines. For example, `U_init_dim_obs_pdafomi` prepares an index array that provides the information for executing the observation operator in `U_obs_op_pdafomi`. How this information is initialized is described in the documentation of OMI.
     217The user-supplied routines are essentially executed in the order they are listed in the interface to `PDAF3_assimilate_3dvar`. The order can be important as some routines can perform preparatory work for later routines. For example, `U_init_dim_obs_pdafomi` prepares an index array that provides the information for executing the observation operator in `U_obs_op_pdafomi`. How this information is initialized is described in the documentation of OMI.
    216218
    217219Before the analysis step is called the following routine is executed:
    218  1. [#U_collect_statecollect_state_pdaf.F90 U_collect_state]
     220 1. [#collect_state_pdafcollect_state_pdaf.F90 collect_state_pdaf]
    219221
    220222The analysis step is executed when the ensemble integration of the forecast is completed. During the analysis step the following routines are executed in the given order:
    221  1. [#U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep] (Call to act on the forecast ensemble, called with negative value of the time step)
    222  1. [#U_init_dim_obs_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_pdafomi]
    223  1. [#U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_pdafomi] (multiple calls, one for each ensemble member)
     223 1. [#prepoststep_pdafprepoststep_ens_pdaf.F90 prepoststep_pdaf] (Call to act on the forecast ensemble, called with negative value of the time step)
     224 1. [#init_dim_obs_pdafomicallback_obs_pdafomi.F90 init_dim_obs_pdafomi]
     225 1. [#obs_op_pdafomicallback_obs_pdafomi.F90 obs_op_pdafomi] (multiple calls, one for each ensemble member)
    224226
    225227Inside the analysis step the interative optimization is computed. This involves the repeated call of the routines:
    226  1. [#U_cvtcvt_pdaf.F90 U_cvt]
    227  1. [#U_obs_op_linpdafomicallback_obs_pdafomi.F90 U_obs_op_lin_pdafomi]
    228  1. [#U_obs_op_adjpdafomicallback_obs_pdafomi.F90 U_obs_op_adj_pdafomi]
    229  1. [#U_cvt_adjcvt_adj_pdaf.F90 U_cvt_adj]
     228 1. [#cvt_pdafcvt_pdaf.F90 cvt_pdaf]
     229 1. [#obs_op_lin_pdafomicallback_obs_pdafomi.F90 obs_op_lin_pdafomi]
     230 1. [#obs_op_adj_pdafomicallback_obs_pdafomi.F90 obs_op_adj_pdafomi]
     231 1. [#cvt_adj_pdafcvt_adj_pdaf.F90 cvt_adj_pdaf]
     232
    230233
    231234After the iterative optimization the following routines are executes to complte the analysis step:
    232  1. [#U_cvtcvt_pdaf.F90 U_cvt] (Call to the control vector transform to compute the final state vector increment
    233  1. [#U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep] (Call to act on the analysis ensemble, called with (positive) value of the time step)
    234 
    235 In case of the routine `PDAFomi_assimilate_3dvar`, the following routines are executed after the analysis step:
    236  1. [#U_distribute_statedistribute_state_pdaf.F90 U_distribute_state]
    237  1. [#U_next_observationnext_observation_pdaf.F90 U_next_observation]
     235 1. [#cvt_pdafcvt_pdaf.F90 cvt_pdaf] (Call to the control vector transform to compute the final state vector increment
     236 1. [#prepoststep_pdafprepoststep_ens_pdaf.F90 prepoststep_pdaf] (Call to act on the analysis ensemble, called with (positive) value of the time step)
     237
     238In case of the routine `PDAF3_assimilate_3dvar`, the following routines are executed after the analysis step:
     239 1. [#distribute_state_pdafdistribute_state_pdaf.F90 distribute_state_pdaf]
     240 1. [#next_observation_pdafnext_observation_pdaf.F90 next_observation_pdaf]