Changes between Version 1 and Version 2 of OnlineInitPdaf_PDAF3


Ignore:
Timestamp:
Sep 1, 2025, 10:22:00 AM (22 hours ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OnlineInitPdaf_PDAF3

    v1 v2  
    2121The PDAF release provides example code for the online mode in `tutorial/online_2D_parallelmodel` and `tutorial/online_2D_serialmodel`. We refer to these codes to use it as a basis.
    2222
    23 The initialization of PDAF is done in the subroutine `init_pdaf`. This routine is called from the model code and sets all variables required for the initialization. Then the subroutine `PDAF_init` is called, which performs the actual internal initialization of PDAF. Thus, it sets the internal parameters for the data assimilation, chooses the data assimilation method, allocates the internal ensemble array, and initializes the ensemble. By using `init_pdaf`, only a single additional subroutine call has to be inserted to the model source code for the initialization. The file `templates/online/init_pdaf.F90` provides a commented template for this routine, which can be used as the basis of the implementation.
    24 
    25 `PDAF_init` itself calls a user-supplied call-back routine to initialize the ensemble of model states. In the example and templates, this routine can be found in `init_ens_pdaf.F90`.
     23The initialization of PDAF is done in the subroutine `init_pdaf`. This routine is called from the model code and sets all variables required for the initialization. Then the subroutine `PDAF3_init` is called, which performs the actual internal initialization of PDAF. Thus, it sets the internal parameters for the data assimilation, chooses the data assimilation method, allocates the internal ensemble array, and initializes the ensemble. By using `init_pdaf`, only a single additional subroutine call has to be inserted to the model source code for the initialization. The file `templates/online/init_pdaf.F90` provides a commented template for this routine, which can be used as the basis of the implementation.
     24
     25`PDAF3_init` itself calls a user-supplied call-back routine to initialize the ensemble of model states. In the example and templates, this routine can be found in `init_ens_pdaf.F90`.
    2626
    2727To initialize the ensemble forecasting, also the subroutine `PDAF_init_forecast` is called in `init_pdaf`.
     
    3333== Using `init_pdaf` ==
    3434
    35 In `init_pdaf` a number of variables are defined that are used in the call to `PDAF_init` as described below.  There are also a few variables that are initialized in `init_pdaf` for later use in user-supplied call-back routies. For the tutorial example, these variables are described below in the section '[#Othervariablesfortheassimilation Other variables for the assimilation]'. The template file  `templates/online/init_pdaf.F90` provide some more functionality which can be adapted.
     35In `init_pdaf` a number of variables are defined that are used in the call to `PDAF3_init` as described below.  There are also a few variables that are initialized in `init_pdaf` for later use in user-supplied call-back routies. For the tutorial example, these variables are described below in the section '[#Othervariablesfortheassimilation Other variables for the assimilation]'. The template file  `templates/online/init_pdaf.F90` provide some more functionality which can be adapted.
    3636
    3737The example implementation and the template code allow to specify all options at run time using a command line parser. These options are specified as the combination `-VARIABLE VALUE`. This method provides a convenient way to define an experiment and could also be used for other models. The parser module is provided by the file `tutorial/offline_2D_parallel/parser_mpi.F90`. An alterantive could be to use a configuration file.
    3838
    39 == Calling `PDAF_init` ==
    40 
    41 In the tutorial codes and the template, the call to `PDAF_init` is fully implemented. Here, we provide an overview of the arguments that are set in the call to `PDAF_init`.
    42 
    43 The call to `PDAF_init` has the following structure:
    44 {{{
    45 CALL PDAF_init(filtertype, subtype, step_null, &
     39== Calling `PDAF3_init` ==
     40
     41In the tutorial codes and the template, the call to `PDAF3_init` is fully implemented. Here, we provide an overview of the arguments that are set in the call.
     42
     43The call to `PDAF3_init` has the following structure:
     44{{{
     45CALL PDAF3_init(filtertype, subtype, step_null, &
    4646               filter_param_i, length_filter_param_i, &
    4747               filter_param_r, length_filter_param_r, &
    48                COMM_model, COMM_filter, COMM_couple, &
    49                task_id, n_modeltasks, filterpe, &
    5048               init_ens_offline, screen, status_pdaf)
    5149}}}
     50
     51**Note:** Implementations before PDAF V3.0, used the routine `PDAF_init` which is described on the [wiki:InitPdaf_PDAF23 Page on initialized PDAF without the PDAF3 interface].
    5252
    5353The required arguments are described below. In the list, we mark those variables bold, which one might like to change, like the type of the DA method. The other variables are required, but usually not changed by the user.
     
    6363  1. The value of the forgetting factor controlling inflation (required to be larger than zero)
    6464 * **length_filter_param_r**:[[BR]] An integer defining the length of the array `filter_param_r`. The entries in the array are parsed up to this index.
    65  * `COMM_model`:[[BR]] The communicator variable `COMM_model` as initialized by `init_parallel_pdaf`. If the model-communicator is named differently in the actual program, the name has to be adapted
    66  * `COMM_filter`:[[BR]] The communicator variable `COMM_filter` as initialized by `init_parallel_pdaf`.
    67  * `COMM_couple`:[[BR]] The communicator variable `COMM_couple` as initialized by `init_parallel_pdaf`.
    68  * `task_id`:[[BR]] The index of the model tasks  as initialized by `init_parallel_pdaf`. Always 1 for the offline mode
    69  * `n_modeltasks`:[[BR]] The number of model tasks as defined before the call to `init_parallel_pdaf`.
    70  * `filterpe`:[[BR]] The flag showing if a process belongs to `COMM_filter` as initialized by `init_parallel_pdaf`.
    71  * **init_ens_pdaf**:[[BR]] The name of the user-supplied routine that is called by `PDAF_init` to initialize the ensemble of model states. (See below: '[#User-suppliedroutineinit_ens_pdaf User-supplied routine init_ens_pdaf]'
     65 * **init_ens_pdaf**:[[BR]] The name of the user-supplied routine that is called by `PDAF3_init` to initialize the ensemble of model states. (See below: '[#User-suppliedroutineinit_ens_pdaf User-supplied routine init_ens_pdaf]'
    7266 * `screen`:[[BR]] An integer defining whether information output is written to the screen (i.e. standard output). The following choices are available:
    7367  * 0: quite mode - no information is displayed.
    7468  * 1: Display standard information (recommended)
    7569  * 2: as 1 plus display of timing information during the assimilation process
    76  * `status_pdaf`:[[BR]] An integer used as status flag of PDAF. If `status_pdaf` is zero upon exit from `PDAF_init`, the initialization was successful. An error occurred for non-zero values. (The error codes are documented in the routine PDAF_init.)
     70 * `status_pdaf`:[[BR]] An integer used as status flag of PDAF. If `status_pdaf` is zero upon exit from `PDAF3_init`, the initialization was successful. An error occurred for non-zero values. (The error codes are documented in the routine PDAF3_init.)
    7771
    7872PDAF uses two arrays **filter_param_i** and **filter_param_r** to respectively specify integer and real-valued options for PDAF. As described above, 2 integer values (state vector size, ensemble size) and 1 real value (forgetting factor) are mandatory. Additional options can be set by specifying a larger array and setting the corresponding size value (`length_filter_param_i`, `length_filter_param_r`). However, with PDAF V3.0 it can be more convenient to use the subroutines `PDAF_set_iparam` and `PDAF_set_rparam`, which are explained further below.