Changes between Version 2 and Version 3 of ImplementGenerateObs_PDAF3


Ignore:
Timestamp:
Jun 2, 2025, 7:45:20 PM (2 days ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ImplementGenerateObs_PDAF3

    v2 v3  
    1111PDAF provides functionality to generate synthetic observations. The functionality bases on the usual implementation of the assimilation used with PDAF's oneline coupled mode. However, one can run the observation generation with an ensemble of just one member, which should be initialized with the initial true state. PDAF provides the routines `PDAF3_generate_obs` and `PDAF3_put_state_generate_obs` to generate the observations. These routines use the observation operator routines which the user also implements for assimilating real observations. Thus, one can use characterstics of real observations to generate the synthetic observations.
    1212
    13 Here we describes the steps needed to generate synthetic obsrvations.
     13An example implementation can be found in `models/loenz96/` where synthetic observation can be generated for the Lorenz-96 model. In addition, the implemenation is show in the templates in `templates/online/`.
     14
     15Here we describes the steps needed to generate synthetic observations.
    1416
    1517== Initialization ==
    1618
    17 The implementation of the initialization of PDAF is explained on the [wiki:OnlineInitPdaf_PDAF3 page on `init_pdaf` and `PDAF_init`].
     19The implementation of the initialization of PDAF is explained on the [wiki:OnlineInitPdaf_PDAF3 page on 'init_pdaf' and 'PDAF_init'].
    1820
    1921For the observation generation one just has to set `filtertype = PDAF_DA_GENOBS` or `filtertype = 100`.
    2022
    21 There are no particular options for the observation generation functionality. So, using the common names in the tutorial and template codes, for `filter_param_i` one just has to specify the mandatory values of the state dimension and the ensemble size. For `filter_param_r` one has to specify the mandatory values of the forgetting factor (even though, this value is ignored for the observation generation). An overview of the options can be optained by runnign the program with `subtype=-1`. The options are also listed on the [wiki:AvailableOptionsforInitPDAF#ObservationGeneration page on available options].
     23To set options, using the common names in the tutorial and template codes, for `filter_param_i` one just has to specify the mandatory values of the state dimension and the ensemble size. For `filter_param_r` one has to specify the mandatory values of the forgetting factor (even though, this value is ignored for the observation generation).
     24
     25There is one additional integer option: `seedset` (`iparam(3)`). This allows to select a seed set for the random number generation, see the options listed on the [wiki:AvailableOptionsforInitPDAF#ObservationGeneration page on available options]. An overview of the options can also be optained by runnign the program with `subtype=-1`.
     26
    2227
    2328== Observation Generation Step ==
    2429
    25 This step replaces the analysis step. The implementation is analogous to implementing the analysis step as described on the [wiki:ImplementationofAnalysisStep page on implementing the analysis step].
     30This step replaces the analysis step. The implementation is analogous to implementing the analysis step as described on the [wiki:ImplementationofAnalysisStep_PDAF3 page on implementing the analysis step].
     31
     32The observation generation is always run with ensemble size 1.
    2633
    2734== `PDAFomi_generate_obs` ==
    2835
    29 This routine is used in the same way as the filter specific routines `PDAFomi_assimilate_*`. Thus the general aspect 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 `PDAFomi_generate_obs` is used in the fully-parallel implementation variant of the data assimilation system. When the 'flexible' implementation variant is used, the routines `PDAFomi_put_state_generate_obs' is used as described further below. Here, we list once more the full interface. Subsequently, the full set of user-supplied routines specified in the call to `PDAFomi_generate_obs` is described. Apart from two call-back routines, the routines are identical to e.g. those used for the local filters.
     36This routine is used in the same way as the analysis routine `PDAF3_assimilate`. This routine can be used in both 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).
    3037
     38Here, we list the full interface of the routine. Subsequently, the user-supplied routines specified in the call are explained.
     39
     40The interface is
    3141{{{
    32   SUBROUTINE PDAFomi_generate_obs(U_collect_state, U_distribute_state, &
    33                                   U_init_dim_obs, U_obs_op, U_get_obs_f, &
    34                                   U_prepoststep, U_next_observation, status_pdaf)
     42  SUBROUTINE PDAF3_generate_obs(collect_state_pdaf, distribute_state_pdaf, &
     43                                  init_dim_obs_pdafomi, obs_op_pdafomi, get_obs_f_pdaf, &
     44                                  prepoststep_pdaf, next_observation_pdaf, status_pdaf)
    3545}}}
    3646with the following arguments:
    37  * `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 [ModifyModelforEnsembleIntegration#PDAF_get_state PDAF_get_state]
    38  * `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.
    39  * `U_init_dim_obs`: The name of the user-supplied routine that provides the size of the full observation vector
    40  * `U_obs_op`: The name of the user-supplied routine that acts as the full observation operator on some state vector
    41  * `U_get_obs_f`: The name of the user-supplied routine that receives the full vector of generated synthetic observations from PDAF
    42  * `U_prepoststep`: The name of the pre/poststep routine as in `PDAF_get_state`
    43  * `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`.
    44  * `status_pdaf`: The integer status flag. It is zero, if `PDAF_assimilate_lestkf` is exited without errors.
     47* Routines to transfer between model fields and state vector:
     48 * [#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.
     49 * [#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`.)
     50* Observation routines using PDAF-OMI:
     51 * [#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
     52 * [#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
     53* Partifular routine to access generated observations
     54 * [#get_obs_f_pdafget_obs_f_pdaf.F90 get_obs_f_pdaf]: The name of the user-supplied routine that receives the full vector of generated synthetic observations from PDAF
     55* Prepoststep and initialization for next forecast phase
     56 * [#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`.)
     57 * [#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`.)
     58* Status flag
     59 * `status`:[[BR]] The integer status flag. It is zero, if the routine is exited without errors.
    4560
    4661
    47 == `PDAFomi_put_state_generate_obs` ==
     62== `PDAF3_put_state_generate_obs` ==
    4863
    49 When the 'flexible' implementation variant is chosen for the assimilation system, the routine `PDAFomi_put_state_generate_obs` has to be used instead of `PDAFomi_generate_obs`. The general aspects of the filter specific routines `PDAFomi_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 `PDAFomi_generate_obs` with the exception the specification of the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
     64This 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.
     65When the 'flexible' implementation variant is chosen for the assimilation system, the routine. The routine `PDAF3_put_state_generate_obs` allows to port such implementations to the PDAF3 interface with minimal changes.
     66The interface of the routine is identical with that of `PDAF3_generate_obs`, except that the user-supplied routines `U_distribute_state` and `U_next_observation` are missing.
     67
    5068
    5169The interface is the following:
    5270{{{
    53   SUBROUTINE PDAFomi_put_state_generate_obs(U_collect_state, U_init_dim_obs, U_obs_op, &
    54                                   U_get_obs_f, U_prepoststep, status_pdaf)
     71  SUBROUTINE PDAF3_put_state_generate_obs(collect_state_pdaf, &
     72                                  init_dim_obs_pdafomi, obs_op_pdafomi, get_obs_f_pdaf, &
     73                                  prepoststep_pdaf, status_pdaf)
    5574}}}
    5675
     
    5978== User-supplied routines ==
    6079
    61 Here, all user-supplied routines are described that are required in the call to `PDAF_generate_obs`. For some of the generic routines, we link to the page on [ModifyModelforEnsembleIntegration modifying the model code for the ensemble integration].
     80Here, all user-supplied routines are described that are required in the call to `PDAF3_generate_obs` or `PDAF3_put_state_generate_obs`. For some of the generic routines, we link to the page on [ModifyModelforEnsembleIntegration modifying the model code for the ensemble integration].
    6281
    63 To indicate user-supplied routines we use the prefix `U_`. In the template directory `templates/` as well as in the example implementation in `models/lorenz_96/` these routines exist without the prefix, but with the extension `_pdaf.F90`. The two routines `init_dim_obs_pdafomi` and `obs_op_pdafomi` are part of PDAF-OMI and are contained in the file `callback_obs_pdafomi.F90`. In the section titles below we provide the name of the template file in parentheses.
     82In 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.
     83 In addition, there will be variables with the suffix `_f` (for 'full').
    6484
    65 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. Thus, the value(s) in the variable will be different for different model sub-domains. In addition, there will be variables with the suffix `_f` (for 'full').
     85Call-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.
    6686
    67 === `U_collect_state` (collect_state_pdaf.F90) ===
    6887
    69 This routine is independent from the filter algorithm used.
    70 See the page on [InsertAnalysisStep#U_collect_statecollect_state_pdaf.F90 inserting the analysis step] for the description of this routine.
    71 
    72 === `U_distribute_state` (distribute_state_pdaf.F90) ===
     88=== `collect_state_pdaf` (collect_state_pdaf.F90) ===
    7389
    7490This routine is independent of the filter algorithm used.
    75 See the page on [InsertAnalysisStep#U_distribute_statedistribute_state_pdaf.F90 inserting the analysis step] for the description of this routine.
     91
     92See the page on [ModifyModelforEnsembleIntegration#collect_state_pdafcollect_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
     93
     94=== `distribute_state_pdaf` (distribute_state_pdaf.F90) ===
     95
     96This routine is independent of the filter algorithm used.
     97
     98See the page on [ModifyModelforEnsembleIntegration#distribute_state_pdafdistribute_state_pdaf.F90 modifying the model code for the ensemble integration] for the description of this routine.
     99
     100=== `init_dim_obs_pdafomi` (callback_obs_pdafomi.F90) ===
     101
     102This is a call-back routine initializing the observation information. The routine just calls a routine from the observation module for each observation type.
     103
     104See the [wiki:OMI_Callback_obs_pdafomi_PDAF3 documentation on callback_obs_pdafomi.F90] for more information.
     105
     106=== `obs_op_pdafomi` (callback_obs_pdafomi.F90) ===
     107
     108This 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.
     109
     110See the [wiki:OMI_Callback_obs_pdafomi_PDAF3 documentation on callback_obs_pdafomi.F90] for more information.
    76111
    77112
    78 === `U_init_dim_obs` (callback_obs_pdafomi.F90) ===
     113=== `get_obs_f_pdaf` (get_obs_f_pdaf.F90) ===
    79114
    80 The routine is called at the beginning of each analysis step.  For PDAF, it has to initialize the size `dim_obs_p` of the observation vector according to the current time step. Apart from this routine will initialize overall observation information.  In this routine one just calls `init_dim_obs_TYPE` for each observation type. The routine is described in detail on [wiki:OMI_Callback_obs_pdafomi callback_obs_pdafomi.F90].
    81 
    82 
    83 === `U_obs_op` (callback_obs_pdafomi.F90) ===
    84 
    85 The routine is called during the analysis step. It has to perform the operation of the observation operator acting on a state vector that is provided as `state_p`. The observed state has to be returned in `m_state_p`. In this routine one just calls `obs_op_TYPE` for each observation type. The routine is described in detail on [wiki:OMI_Callback_obs_pdafomi callback_obs_pdafomi.F90].
    86 
    87 
    88 === `U_get_obs_f` (get_obs_f_pdaf.F90) ===
    89 
    90 This routine is specific for the observation generation. In this routine PDAF provides the user with the vector of synthetic observations generated by PDAF. One can then e.g. write the observation vector into a file so that one can use it later in a twin experiment (The template file `readwrite_obs.F90` provides functionality for reading and writing as described on the [wiki:readwrite_obs page on readwrite_obs].
     115This routine is specific for the observation generation. PDAF provides to this routine the vector of synthetic observations generated by PDAF. One can then, e.g., write the observation vector into a file so that one can use it later in a twin experiment (The template file `readwrite_obs.F90` provides functionality for reading and writing as described on the [wiki:readwrite_obs page on readwrite_obs].
    91116
    92117The interface is the following: