Changes between Version 14 and Version 15 of OfflineInitPdaf


Ignore:
Timestamp:
May 21, 2025, 10:01:59 PM (11 days ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OfflineInitPdaf

    v14 v15  
    8181
    8282The routine `init_pdaf_offline` in the example also initializes several variables that are not used to call `PDAF_init`. These variables control some functionality of the user-supplied routines for the data assimilation system and are shared with these routines through `mod_assimilation`. These variables are for example:
    83  * `cradius`: Localization cut-off radius (here in grid points) for the local observation domain
    84  * `sradius`: support radius, if the observation errors are weighted with distance (for `locweight>0`)
    85  * `locweight`: Type of localizing weight
    86 It is useful to define variables like these at this central position. Of course, this definition has to be adapted to the particular model used.
    87 
    88 Apart from the generic variables for localization, we also specify variables that are specific for each obseration type, for example
     83 * `cradius`: Localization cut-off radius in grid points for the observation domain
     84 * `sradius`: support radius, if observation errors are weighted (i.e. `locweight>0`)
     85 * `locweight`: Type of localizing weight (see further below)
     86These localization parameters are used later in the subroutines called by `init_dim_obs_l_pdafomi`.
     87
     88We recommend to define such configuration variables at this central position, so that all configuration is done at one place. Of course, their definition should be adapted to the particular model used.
     89
     90The setting of `locweight` influences the weight function for the localization. With the PDAF3 interface (and generally with PDAF-OMI), the choices are standardized as follows
     91
     92||= '''locweight''' =||= '''0''' =||= '''1''' =||= '''2''' =||= '''3''' =||= '''4''' =||
     93||= function =|| unit weight ||  exponential  ||  5-th order[[BR]]polynomial  ||  5-th order[[BR]]polynomial  ||  5-th order[[BR]]polynomial  ||
     94||= regulation =||  -  ||  -  ||  -  ||  regulation using[[BR]]mean variance  ||  regulation using variance[[BR]]of single observation point  ||
     95||= '''cradius''' =||||||||||||  weight=0 if distance > cradius  ||
     96||= '''sradius''' =||  no impact  ||  weight = exp(-d / sradius)  ||||||||  weight = 0 if d >= sradius[[BR]] else[[BR]] weight = f(sradius, distance)  ||
     97
     98Here, 'regulation' refers to the regulated localization introduced in Nerger, L., Janjić, T., Schröter, J., Hiller, W. (2012). A regulated localization scheme for ensemble-based Kalman filters. Quarterly Journal of the Royal Meteorological Society, 138, 802-812. ​[https://doi.org/10.1002/qj.945 doi:10.1002/qj.945].
     99
     100
     101Apart from the generic variables for localization, we also specify variables that are specific for each observation type, for example in the tutorial code, we specify
    89102 * `assim_A`: Flag whether to assimialtion observations of type A
    90103 * `rms_obs_A`: Assumed observation error standard deviation of observation type A
     
    92105== User-supplied routine `init_ens_offline` ==
    93106
    94 The user-supplied routine that we named `init_ens_offline` here, is the call-back routine that called by PDAF through the defined interface described below. For the offline mode the routine is called by all processes. `init_ens_pdaf` is only called by `PDAF_init` if no error occurred before; thus the status flag is zero.
     107The user-supplied routine that we named `init_ens_offline` here, is the call-back routine that is called by PDAF through the defined interface described below. For the offline mode the routine is called by all processes. `init_ens_pdaf` is only called by `PDAF_init` if no error occurred before; thus the status flag is zero.
    95108
    96109The interface details can be looked up in the template and tutorial codes. It is the following:
     
    100113}}}
    101114with
    102  * `filtertype`:[[BR]] The integer defining the type of filter algorithm as given in the call to `PDAF_init`
    103  * `dim_p`:[[BR]] An integer holding the size of the state dimension for the calling process as specified in the call to `PDAF_init`
    104  * `dim_ens`:[[BR]] An integer holding the size of the ensemble
    105  * `state_p`:[[BR]] A real array of size (`dim_p`) for the local model state of the calling process (can be used freely for ensemble-based methods)
    106  * `Uinv`:[[BR]] A real array of size (`dim_ens-1`, `dim_ens-1`) for the inverse of matrix '''U''' from the decomposition of the state error covariance matrix '''P''' = '''VUV^T^''' (Not relevant for ensemble-based methods)
    107  * `ens_p`:[[BR]] A real array of size (`dim_p`, `dim_ens`), which has to be filled with the ensemble of model states.
    108  * `flag`:[[BR]] Status flag for PDAF. It is 0 upon entry and can be set by in the user-supplied routine, depending on the success of the ensemble initialization.  Preferably, values above 102 should be used for failures to avoid conflicts with the error codes defined within PDAF_init.
     115 * `filtertype`, `integer, intent(in)`:[[BR]]The type of filter algorithm as given in the call to `PDAF_init`
     116 * `dim_p`, `integer, intent(in)`:[[BR]] The size of the state dimension for the calling process as specified in the call to `PDAF_init`
     117 * `dim_ens`, `integer, intent(in)`:[[BR]]The size of the ensemble
     118 * `state_p`, `real, dimension(dim_p), intent(inout)`:[[BR]]Array for the local model state of the calling process (can be used freely for ensemble-based methods)
     119 * `Uinv`, `real, dimension(dim_ens-1, dim_ens-1), intent(inout)`:[[BR]]A possible weight matrix (Not relevant for ensemble-based methods)
     120 * `ens_p`, `real, dimension(dim_p, dim_ens), intent(inout)`:[[BR]] The ensemble array, which has to be filled with the ensemble of model states.
     121 * `flag`, `integer, intent(inout)`:[[BR]]Status flag for PDAF. It is 0 upon entry and can be set by in the user-supplied routine, depending on the success of the ensemble initialization.  Preferably, values above 102 should be used for failures to avoid conflicts with the error codes defined within PDAF_init.
     122
     123=== Defining the state vector ===
     124
     125The ensemble initialization routine `init_ens_pdaf` is the first location at which the user has to fill a state vector (or array of state vectors). A state vector is the collection of all model fields that are handled in the analysis step of the assimilation procedure into a single vector. Usually one concatenates the different model fields as complete fields. Thus, the vector could contain a full 3-dimensional temperature field, followed by the salinity field (in case of an ocean model), and then followed by the 3 fields of the velocity components.
     126
     127The logical definition of the state vector will also be utilized in several other user-supplied routines. E.g. in routines that fill model fields from a state vector or in the routine providing the observation operator.
     128
     129The actual setup of the state vector should be done in `init_pdaf`.  The tutorial example `tutorial/online_2D_serialmodel_2fields` demonstrates a possible setup of the state vector for 2 fields. Here, one defines the number of fields, the dimension of each included field as well as the offset of each field in the state vector.
    109130
    110131
    111132=== Initialization for ensemble-based filters ===
    112133
    113 Most data assimilation methods are based on ensembles (an exception is only the parameterized 3D-Var). For the ensemble-based methods only the array `ens_p` needs to be initialized by the ensemble of model states. If a model with domain decomposition is used, the full ensemble for the local sub-domain of the MPI process has to be initialized.
     134For the ensemble-based filters and the ensemble/hybrid 3D-Var methods, only the array `ens_p` needs to be initialized by the ensemble of model states. If a parallel model with domain decomposition is used, the full ensemble for the local sub-domain has to be initialized.
    114135
    115136The arrays `state_p` and `Uinv` are allocated to their correct sizes because they are used during the assimilation cycles. They are not yet initialized and it is allowed to use these arrays in the initialization. An exception from this is the EnKF for which `Uinv` is allocated only with size (`1`,`1`), because `Uinv` is not using for EnKF.