Changes between Version 11 and Version 12 of OfflineInitPdaf
- Timestamp:
- May 19, 2025, 9:57:00 AM (13 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
OfflineInitPdaf
v11 v12 20 20 The PDAF release provides example code for the offline mode in `tutorial/offline_2D_parallel`. We refer to this code to use it as a basis. 21 21 22 The routine `PDAF_init` is called to initialize PDAF. This call sets parameters for the data assimilation, chooses the data assimilation method and initializes the ensemble. In the tutorial code in `tutorial/offline_2D_parallel`, we collect the initialization of all variables required for the call to `PDAF_init` into the single subroutine `init_pdaf_offline`, which yields a clean code. The file `init_pdaf_offline.F90` in `templates/offline` provides a commented template for this routine, which can be used as the basis of the implementation.22 The routine `PDAF_init` is called to initialize PDAF. This call sets parameters for the data assimilation, chooses the data assimilation method and initializes the ensemble. In the tutorial and template codes we collect the initialization of all variables required for the call to `PDAF_init` into the single subroutine `init_pdaf_offline`, which yields a clean code. The file `templates/offline/init_pdaf_offline.F90` provides a commented template for this routine, which can be used as the basis of the implementation. 23 23 24 24 `PDAF_init` itself calls a user-supplied call-back routine to initialize the ensemble of model states. In the example, this is the routine in the file `init_ens_offline.F90`. 25 25 26 == Using `init_pdaf ` ==26 == Using `init_pdaf_offline` == 27 27 28 In the offline mode, the routine `init_pdaf_offline` is executed after the initialization of the parallelization. (Note: In the main program of the example implementation (`main_offine.F90`) we added a call to a routine `initialize` in between for clarity of the implementation. This routine simply initializes the size of the 2-dimensional model grid and then the size of the model state.)28 In the offline mode, the routine `init_pdaf_offline` is executed after the initialization of the parallelization. 29 29 30 In the routine`init_pdaf_offline` 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_offline` but not used in the call to `PDAF_init`. These are variables that are specific for the data assimilation system, but only shared in between the user-supplied routines. For the tutorial example, these variables are described below in the section '[#Othervariablesfortheassimilation Other variables for the assimilation]'.30 In `init_pdaf_offline` 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_offline` but not used in the call to `PDAF_init`. These are variables that are specific for the data assimilation system, but only shared in between the user-supplied routines. For the tutorial example, these variables are described below in the section '[#Othervariablesfortheassimilation Other variables for the assimilation]'. 31 31 32 The example implementation and the template version allow to parse all variables through a command line parser. 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_serial/parser_mpi.F90`32 The 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_serial/parser_mpi.F90` 33 33 34 == Required arguments for`PDAF_init` ==34 == Arguments of `PDAF_init` == 35 35 36 36 The call to `PDAF_init` has the following structure: … … 41 41 COMM_model, COMM_filter, COMM_couple, & 42 42 task_id, n_modeltasks, filterpe, & 43 init_ens_ pdaf, screen, status_pdaf)43 init_ens_offline, screen, status_pdaf) 44 44 }}} 45 45 46 46 The required variables are the following: 47 47 48 * `filtertype`: An integer defining the type of filter algorithm. Available are 49 * 1: SEIK 50 * 2: EnKF 51 * 3: LSEIK 52 * 4: ETKF 53 * 5: LETKF 54 * 6: ESTKF 55 * 7: LESTKF 56 * 8: LEnKF 57 * 9: NETF 58 * 10: LNETF 59 * 11: LKNETF 60 * 12: PF 61 * 13: ENSRF/EAKF 62 * 100: GENOBS 63 * 200: 3DVAR 64 * `subtype`:[[BR]] An integer defining the sub-type of the filter algorithm 48 * `filtertype`: An integer defining the type of the DA method. Available values are listed on the[wiki:AvailableOptionsforInitPDAF Page on available options] and can also be displayed runnign the assimialtion program with the option `-subtype -1`. 49 * `subtype`:[[BR]] An integer defining the sub-type of the filter algorithm. Available values are listed on the[wiki:AvailableOptionsforInitPDAF Page on available options] and can also be displayed runnign the assimialtion program with the option `-subtype -1`. 65 50 * `step_null`:[[BR]] Always 0 for the offline mode. 66 51 * `filter_param_i`:[[BR]] Integer array collecting options for PDAF. The first two variables are mandatory and equal for all filters. Further variables are optional (see example code). The mandatory variables are in the following order: … … 77 62 * `n_modeltasks`:[[BR]] The number of model tasks as defined before the call to `init_parallel_pdaf`. 78 63 * `filterpe`:[[BR]] The flag showing if a process belongs to `COMM_filter` as initialized by `init_parallel_pdaf`. 79 * `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-suppliedroutineU_init_ens User-supplied routine U_init_ens]'64 * `init_ens_offline`:[[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_offline User-supplied routine init_ens_offline]' 80 65 * `screen`:[[BR]] An integer defining whether information output is written to the screen (i.e. standard output). The following choices are available: 81 66 * 0: quite mode - no information is displayed. … … 86 71 PDAF 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 option (forgetting factor for inflation) 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. 87 72 88 An overview of available integer and real-valued options for each DA method can be found on the page [wiki:AvailableOptionsforInitPDAF Available options for the different DA methods]. The available options for a specific DA method can also be displayed by running the assimilation program for the selected DA method setting `subtype = -1`. (In the tutorial and template codes one can set `-subtype -1` on the command line).73 An overview of available integer and real-valued options for each DA method can be found on the page [wiki:AvailableOptionsforInitPDAF Available options for the different DA methods]. The available options for a specific DA method can also be displayed by running the assimilation program for the selected DA method setting `subtype = -1`. (In the tutorial and template codes one can set `-subtype -1` on the command line). Generally, available options and valid settings are also listed in `mod_assimilation.F90` of the tutorials and template codes. 89 74 90 It is recommended to check the value of `status_pdaf` in the program after PDAF_init (and potentially `PDAF_set_iparam and `PDAF_set_rparam`) are executed. Only if its value is 0the initialization was successful.75 We recommended to check the value of `status_pdaf` in the program after PDAF_init (and potentially `PDAF_set_iparam and `PDAF_set_rparam`) are executed. Only if its value is 0, the initialization was successful. 91 76 92 77 93 78 == Other variables for the assimilation == 94 79 95 The routine `init_pdaf ` 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:80 The 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: 96 81 * `cradius`: Localization cut-off radius (here in grid points) for the local observation domain 97 82 * `sradius`: support radius, if the observation errors are weighted with distance (for `locweight>0`) … … 99 84 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. 100 85 101 Apart from the generic variables for loc laization, we also specify variables that are specific for each obseration type, for example86 Apart from the generic variables for localization, we also specify variables that are specific for each obseration type, for example 102 87 * `assim_A`: Flag whether to assimialtion observations of type A 103 88 * `rms_obs_A`: Assumed observation error standard deviation of observation type A 104 89 105 == User-supplied routine `init_ens_ pdaf` ==90 == User-supplied routine `init_ens_offline` == 106 91 107 The user-supplied routine th e we named `init_ens_pdaf` here, is the call-back routine that called by PDAF through the defined interface described below. The routine is called by all MPI processes that compute the filter analysis step (i.e. those for which 'filterpe' is set to true. In the standard configuration of `init_parallel_pdaf` these are all processes of the first model task, i.e. task_id=1.) `init_ens_pdaf` is only called by `PDAF_init` if no error occurred before; thus the status flag is zero.92 The user-supplied routine that we named `init_ens_ofline` here, is the call-back routine that called by PDAF through the defined interface described below. The routine is called by all MPI processes that compute the filter analysis step (i.e. those for which 'filterpe' is set to true. In the standard configuration of `init_parallel_pdaf` these are all processes of the first model task, i.e. task_id=1.) `init_ens_pdaf` is only called by `PDAF_init` if no error occurred before; thus the status flag is zero. 108 93 109 94 The interface can be looked up in the template and tutorial codes. It is the following: 110 95 {{{ 111 SUBROUTINE init_ens_ pdaf(filtertype, dim_p, dim_ens, &96 SUBROUTINE init_ens_offline(filtertype, dim_p, dim_ens, & 112 97 state_p, Uinv, ens_p, flag) 113 98 }}} … … 199 184 }}} 200 185 201 The correctness of the ensemble initialization in ` U_init_ens` should be checked by the user.186 The correctness of the ensemble initialization in `init_ens_offline` should be checked by the user.