Changes between Version 1 and Version 2 of ImplementAnalysis_3DEnVar


Ignore:
Timestamp:
Dec 9, 2021, 8:35:44 AM (3 years ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ImplementAnalysis_3DEnVar

    v1 v2  
    1 = Implementation of the Analysis Step for 3D-Var with OMI =
     1= Implementation of the Analysis Step for 3D Ensemble Var with OMI =
    22
    33{{{
     
    1414<li><a href="ImplementAnalysisLocal">Implementation for Local Filters</a></li>
    1515<li><a href="ImplementAnalysislenkfOmi">Implementation for LEnKF</a></li>
     16<li><a href="ImplementAnalysis_3DEnVar">Implementation for 3D-Var</li>
    1617<li>Implementation for 3D-Var</li>
    17 <li><a href="ImplementAnalysis_3DEnVar">Implementation for 3D-EnVar</a></li>
    1818<li><a href="ImplementAnalysis_Hyb3DVar">Implementation for hybrid 3D-Var</a></li>
    1919<li><a href="PDAF_OMI_Overview">PDAF-OMI Overview</a></li>
     
    3232With Version 2.0 with introduced 3D variational assimilation methods to PDAF. There are genenerally three different variants: parameterized 3D-Var, 3D Ensemble Var, and hybrid (parameterized + ensemble) 3D-Var.
    3333
    34 This page describes the implementation of the analysis step for the parameterized 3D-Var using PDAF-OMI.
    35 
    36 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 `PDAFomi_assimilate_3dvar` in the fully-parallel implementation (or `PDAFomi_put_state_3dvar` for the 'flexible' implementation) that was discussed before. With regard to the parallelization, all these routines (except `U_collect_state`, `U_distribute_state`, and `U_next_observation`) are executed by the filter processes (`filterpe=.true.`) only.
    37 
    38 For completeness we discuss here all user-supplied routines that are specified in the interface to `PDAFomi_assimilate_3dvar`. 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.
    39 
    40 
    41 == `PDAFomi_assimilate_3dvar` ==
     34This page describes the implementation of the analysis step for the 3D Ensemble Var using PDAF-OMI.
     35
     36For 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 `PDAFomi_assimilate_en3dvar` in the fully-parallel implementation (or `PDAFomi_put_state_en3dvar` for the 'flexible' implementation) that was discussed before. With regard to the parallelization, all these routines (except `U_collect_state`, `U_distribute_state`, and `U_next_observation`) are executed by the filter processes (`filterpe=.true.`) only.
     37
     38For 3D Ensemble Var the ensemble is used to represent the background covariance matrix '''B'''. This ensemble perturbations need to be transformed by means of 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.
     39
     40For completeness we discuss here all user-supplied routines that are specified in the interface to `PDAFomi_assimilate_en3dvar`. 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.
     41
     42
     43== `PDAFomi_assimilate_en3dvar_X`==
    4244
    4345The general aspects of the filter (or solver) specific routines `PDAF_assimilate_*` have been 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 the fully-parallel implementation variant of the data assimilation system. When the 'flexible' implementation variant is used, the routines `PDAF_put_state_*` is used as described further below. Here, we list the full interface of the routine. Subsequently, the user-supplied routines specified in the call is explained.
    4446
    45 The interface for using the parameterized 3D-Var is:
    46 {{{
    47   SUBROUTINE PDAFomi_assimilate_3dvar(collect_state_pdaf, distribute_state_pdaf, &
     47There are two variants that either compute the transformataion of the ensemble transformation using the local LESTKF method, or the global ESTKF.
     48
     49=== Analysis routines ===
     50
     51This routine is called for the case of transforming the ensemble perturbations using the local LESTKF.
     52
     53The interface is:
     54{{{
     55SUBROUTINE PDAFomi_assimilate_en3dvar_lestkf(U_collect_state, U_distribute_state, &
    4856                                 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, &
    49                                  U_cvt, U_cvt_adj, U_obs_op_lin_pdafomi, obs_op_adj_pdafomi, &
    50                                  prepoststep_pdaf, next_observation_pdaf, outflag)
     57                                 U_cvt_ens, U_cvt_adj_ens, U_obs_op_lin_pdafomi, U_obs_op_adj_pdafomi, &
     58                                 U_init_n_domains_p, U_init_dim_l, U_init_dim_obs_l_pdafomi, &
     59                                 U_g2l_state, U_l2g_state, U_prepoststep, U_next_observation, outflag)
    5160}}}
    5261with the following arguments:
     
    5463 * [#U_distribute_statedistribute_state_pdaf.F90 U_distribute_state]:  The name of a user supplied routine that initializes the model fields from the array holding the ensemble of model state vectors.
    5564 * [#U_init_dim_obs_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_pdafomi]: The name of the user-supplied routine that initializes the observation information and provides the size of observation vector
    56  * [#U_cvtcvt_pdaf.F90 U_cvt]: The name of the user-supplied routine that applies the control-vector transformation (square-root of the B-matrix) on some control vector to obtain a state vector.
    57  * [#U_cvt_adjcvt_adj_pdaf.F90 U_cvt_adj]: The name of the user-supplied routine that applies the adjoint control-vector transformation (with square-root of the B-matrix) on some state vector to obtain the control vector.
     65 * [#U_cvt_enscvt_ens_pdaf.F90 U_cvt_ens]: The name of the user-supplied routine that applies the ensemble control-vector transformation (square-root of the B-matrix) on some control vector to obtain a state vector.
     66 * [#U_cvt_adj_enscvt_adj_ens_pdaf.F90 U_cvt_adj_ens]: The name of the user-supplied routine that applies the adjoint ensemble control-vector transformation (with square-root of the B-matrix) on some state vector to obtain the control vector.
     67 * [#U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_pdafomi]: The name of the user-supplied routine that acts as the observation operator on some state vector
     68 * [#U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_lin_pdafomi]: The name of the user-supplied routine that acts as the linearized observation operator on some state vector
     69 * [#U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_lin_pdafomi]: The name of the user-supplied routine that acts as the adjoint observation operator on some state vector
     70 * [#U_init_n_domainsinit_n_domains_pdaf.F90 U_init_n_domains]: 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]: 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]: The name of the routine that initializes the size of the observation vector for a local analysis domain
     73 * [#U_g2l_stateg2l_state_pdaf.F90 U_g2l_state]: The name of the routine that initializes a local state vector from the global state vector
     74 * [#U_l2g_statel2g_state_pdaf.F90 U_l2g_state]: The name of the routine that initializes the corresponding part of the global state vector from the provided local state vector
     75 * [#U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep]: The name of the pre/poststep routine as in `PDAF_get_state`
     76 * [#U_next_observationnext_observation.F90 U_next_observation]: The name of a user supplied routine that initializes the variables `nsteps`, `timenow`, and `doexit`. The same routine is also used in `PDAF_get_state`.
     77 * `status`: The integer status flag. It is zero, if `PDAFomi_assimilate_global` is exited without errors.
     78
     79
     80
     81=== `PDAFomi_assimilate_en3dvar_estkf` ===
     82
     83This routine is called for the case of transforming the ensemble perturbations using the global ESTKF. 
     84
     85The interface is:
     86{{{
     87SUBROUTINE PDAFomi_assimilate_en3dvar_lestkf(U_collect_state, U_distribute_state, &
     88                                 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, &
     89                                 U_cvt_ens, U_cvt_adj_ens, U_obs_op_lin_pdafomi, U_obs_op_adj_pdafomi, &
     90                                 U_prepoststep, U_next_observation, outflag)
     91}}}
     92with the following arguments:
     93 * [#U_collect_statecollect_state_pdaf.F90 U_collect_state]: 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 `PDAF_get_state` as well as here.
     94 * [#U_distribute_statedistribute_state_pdaf.F90 U_distribute_state]:  The name of a user supplied routine that initializes the model fields from the array holding the ensemble of model state vectors.
     95 * [#U_init_dim_obs_pdafomicallback_obs_pdafomi.F90 U_init_dim_obs_pdafomi]: The name of the user-supplied routine that initializes the observation information and provides the size of observation vector
     96 * [#U_cvt_enscvt_ens_pdaf.F90 U_cvt_ens]: The name of the user-supplied routine that applies the ensemble control-vector transformation (square-root of the B-matrix) on some control vector to obtain a state vector.
     97 * [#U_cvt_adj_enscvt_adj_ens_pdaf.F90 U_cvt_adj_ens]: The name of the user-supplied routine that applies the adjoint ensemble control-vector transformation (with square-root of the B-matrix) on some state vector to obtain the control vector.
    5898 * [#U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_pdafomi]: The name of the user-supplied routine that acts as the observation operator on some state vector
    5999 * [#U_obs_op_pdafomicallback_obs_pdafomi.F90 U_obs_op_lin_pdafomi]: The name of the user-supplied routine that acts as the linearized observation operator on some state vector
     
    63103 * `status`: The integer status flag. It is zero, if `PDAFomi_assimilate_global` is exited without errors.
    64104
    65 
    66 == `PDAFomi_put_state_global` ==
    67 
    68 When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAFomi_put_state_global` has to be used instead of `PDAFomi_assimilate_global`. The general aspects of the filter specific routines `PDAF_put_state_*` have been described on the page [ModifyModelforEnsembleIntegration Modification of the model code for the ensemble integration]. The interface of the routine is identical with that of `PDAF_assimilate_global` with the exception the specification of the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
     105Note that the interface of `PDAFomi_assimilate_en3dvar_estkf` is identical to that of `PDAFomi_assimilate_3dvar` apart from using the routines `U_cvt_ens` and `U_cvt_adj_ens` in case of the ensemble variational method.
     106
     107
     108== `PDAFomi_put_state_en3dvar_lestkf` ==
     109
     110When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAFomi_put_state_*` has to be used instead of `PDAFomi_assimilate_*`. The general aspects of the filter specific routines `PDAF_put_state_*` have been described on the page [ModifyModelforEnsembleIntegration Modification of the model code for the ensemble integration]. The interface of the routine is identical with that of `PDAF_assimilate_*` with the exception the specification of the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
    69111
    70112The interface when using one of the global filters is the following:
    71113{{{
    72   SUBROUTINE PDAFomi_assimilate_3dvar(collect_state_pdaf, &
     114  SUBROUTINE PDAFomi_put_state_en3dvar_lestkf(U_collect_state, &
    73115                                 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, &
    74                                  U_cvt, U_cvt_adj, U_obs_op_lin_pdafomi, obs_op_adj_pdafomi, &
    75                                  prepoststep_pdaf, outflag)
     116                                 U_cvt_ens, U_cvt_adj_ens, U_obs_op_lin_pdafomi, U_obs_op_adj_pdafomi, &
     117                                 U_init_n_domains_p, U_init_dim_l, U_init_dim_obs_l_pdafomi, &
     118                                 U_g2l_state, U_l2g_state, U_prepoststep, outflag)
     119}}}
     120
     121== `PDAFomi_put_state_en3dvar_estkf` ==
     122
     123The interface of this routine is analogous to that of `PDAFomi_assimilate_en3dvar_estkf'. Thus it is identical to this routine with the exception the specification of the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
     124
     125The interface when using one of the global filters is the following:
     126{{{
     127  SUBROUTINE PDAFomi_put_state_en3dvar_estkf(U_collect_state, &
     128                                 U_init_dim_obs_pdafomi, U_obs_op_pdafomi, &
     129                                 U_cvt_ens, U_cvt_adj_ens, U_obs_op_lin_pdafomi, U_obs_op_adj_pdafomi, &
     130                                 U_prepoststep, outflag)
    76131}}}
    77132
     
    169224
    170225
     226
     227=== `U_init_n_domains` (init_n_domains_pdaf.F90) ===
     228
     229The interface for this routine is:
     230{{{
     231SUBROUTINE init_n_domains(step, n_domains_p)
     232
     233  INTEGER, INTENT(in)  :: step        ! Current time step
     234  INTEGER, INTENT(out) :: n_domains_p ! Number of analysis domains for local model sub-domain
     235}}}
     236
     237The routine is called during the analysis step before the loop over the local analysis domains is entered.
     238It 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.
     239
     240Hints:
     241 * As a simple case, if the localization is only performed horizontally, the local analysis domains can be single vertical columns of the model grid. In this case, `n_domains_p` is simply the number of vertical columns in the local model sub-domain.
     242
     243
     244=== `U_init_dim_l` (init_dim_l_pdaf.F90) ===
     245
     246The interface for this routine is:
     247{{{
     248SUBROUTINE init_dim_l(step, domain_p, dim_l)
     249
     250  INTEGER, INTENT(in)  :: step        ! Current time step
     251  INTEGER, INTENT(in)  :: domain_p    ! Current local analysis domain
     252  INTEGER, INTENT(out) :: dim_l       ! Local state dimension
     253}}}
     254
     255The routine is called during the loop over the local analysis domains in the analysis step.
     256It has to provide in `dim_l` the dimension of the state vector for the local analysis domain with index `domain_p`.
     257
     258Hints:
     259 * For sharing through the module 'mod_assimilation', we further initialize an array 'coords_l' containing the coordinates that describe the local domain. These coordinates have to describe one location in space that is used in the OMI observation modules to compute the distance from observations. This requires that the coordinates in 'coords_l' have the same units as those used for the observations.
     260 * Any form of local domain is possible as long as it can be describe as a single location. If observations are only horizontally distributed (a common situation with satellite data in the ocean), the local analysis domain can be a single vertical column of the model grid. In this case, the size of the state in the local analysis domain will be just the number of vertical grid points at this location and the horizontal coordinates are used in 'coords_l'
     261 * Further, we recommend to initialize an array containing the indices of the elements of the local state vector in the global (or domain-decomposed) state vector (`id_lstate_in_pstate` in the template files). This array is also shared through 'mod_assimilation'.
     262
     263
     264=== `U_init_dim_obs_l_pdafomi` (callback_obs_pdafomi.F90) ===
     265
     266This 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.
     267
     268See the [wiki:OMI_Callback_obs_pdafomi documentation on callback_obs_pdafomi.F90] for more information.
     269
     270
     271=== `U_g2l_state` (g2l_state_pdaf.F90) ===
     272
     273The interface for this routine is:
     274{{{
     275SUBROUTINE g2l_state(step, domain_p, dim_p, state_p, dim_l, state_l)
     276
     277  INTEGER, INTENT(in) :: step           ! Current time step
     278  INTEGER, INTENT(in) :: domain_p       ! Current local analysis domain
     279  INTEGER, INTENT(in) :: dim_p          ! State dimension for model sub-domain
     280  INTEGER, INTENT(in) :: dim_l          ! Local state dimension
     281  REAL, INTENT(in)    :: state_p(dim_p) ! State vector for model sub-domain
     282  REAL, INTENT(out)   :: state_l(dim_l) ! State vector on local analysis domain
     283}}}
     284
     285The routine is called during the loop over the local analysis domains in the analysis step. It has to provide the local state vector `state_l` that corresponds to the local analysis domain with index `domain_p`. Provided to the routine is the state vector `state_p`. With a domain decomposed model, this is the state for the local model sub-domain.
     286
     287Hints:
     288 * 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`.
     289 * Usually, one can initialize the indices of the local state vector elements in the global state vector in `U_init_dim_l` and just use these here.
     290
     291
     292=== `U_l2g_state` (l2g_state_pdaf.F90) ===
     293
     294The interface for this routine is:
     295{{{
     296SUBROUTINE l2g_state(step, domain_p, dim_l, state_l, dim_p, state_p)
     297
     298  INTEGER, INTENT(in) :: step           ! Current time step
     299  INTEGER, INTENT(in) :: domain_p       ! Current local analysis domain
     300  INTEGER, INTENT(in) :: dim_p          ! State dimension for model sub-domain
     301  INTEGER, INTENT(in) :: dim_l          ! Local state dimension
     302  REAL, INTENT(in)    :: state_p(dim_p) ! State vector for model sub-domain
     303  REAL, INTENT(out)   :: state_l(dim_l) ! State vector on local analysis domain
     304}}}
     305
     306The routine is called during the loop over the local analysis domains in the analysis step. It has to initialize the part of the global state vector `state_p` that corresponds to the local analysis domain with index `domain_p`. Provided to the routine is the state vector `state_l` for the local analysis domain.
     307
     308Hints:
     309 * 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`.
     310 * Usually, one can initialize the indices of the local state vector elements in the global state vector in `U_init_dim_l` and just use these here.
     311
     312
     313
    171314=== `U_prepoststep` (prepoststep_ens_pdaf.F90) ===
    172315
     
    196339
    197340Inside the analysis step the interative optimization is computed. This involves the repeated call of the routines:
    198  1. [#U_cvtcvt_pdaf.F90 U_cvt]
     341 1. [#U_cvt_enscvt_ens_pdaf.F90 U_cvt_ens]
    199342 1. [#U_obs_op_linpdafomicallback_obs_pdafomi.F90 U_obs_op_lin_pdafomi]
    200343 1. [#U_obs_op_adjpdafomicallback_obs_pdafomi.F90 U_obs_op_adj_pdafomi]
    201  1. [#U_cvt_adjcvt_adj_pdaf.F90 U_cvt_adj]
     344 1. [#U_cvt_adj_enscvt_adj_ens_pdaf.F90 U_cvt_adj_ens]
    202345
    203346After the iterative optimization the following routines are executes to complte the analysis step:
    204  1. [#U_cvtcvt_pdaf.F90 U_cvt] (Call to the control vector transform to compute the final state vector increment
     347 1. [#U_cvt_enscvt_ens_pdaf.F90 U_cvt] (Call to the control vector transform to compute the final state vector increment
    205348 1. [#U_prepoststepprepoststep_ens_pdaf.F90 U_prepoststep] (Call to act on the analysis ensemble, called with (positive) value of the time step)
    206349
    207 In case of the routine `PDAFomi_assimilate_global`, the following routines are executed after the analysis step:
     350The iterative optimization abovve computes an updated ensemble mean state. Subsequently, the ensemble perturbations are updated using the LESTKF or ESTKF. The execution of the routines for these filters is described for the LESTKF on the [wiki:ImplementAnalysisLocal page on implementing the local filter analysis step] and for the ESTKF on the [wiki:ImplementAnalysisGlobal page on implementing the global filter analysis step].
     351
     352In case of the routine `PDAFomi_assimilate_*`, the following routines are executed after the analysis step:
    208353 1. [#U_distribute_statedistribute_state_pdaf.F90 U_distribute_state]
    209354 1. [#U_next_observationnext_observation_pdaf.F90 U_next_observation]