Version 1 (modified by lnerger, 10 years ago) (diff)


Initialization of PDAF and the ensemble by PDAF_init

After the adaption of the parallelization, the initialization of PDAF has to be implemented. Typically, all initializations of variables required before the call to the initialization routine PDAF_init can be colledted into a single subroutine. The example implementation uses the routine init_pdaf. The right place to insert this routine to the model code is in between the initialization part of the model and its time stepping loop. In the routine a number of variables have to be defined. The are, for example the size of the ensemble and the type of filter algorithm. The example implementation explains the full set of variables. The example also initializes a few variables that are not handed over to PDAF_init, like delt_obs. This variable is the number of time steps between sucessive analysis steps. It is meaningful to define it at this central position. Of course, this definition has to be adapted to the particluar model used. The example implementation allows 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.

In the call to PDAF_init several variables have to be provided. These are the type index of the filter algorithm, its subtype, and the initial time step. Then follows an integer array and an integer defining the size of the array. This integer array holds parameters that define filter-specific quantities, but also the ensemble size and the size of the state vector (for the current MPI process in case of parallelization with domain decomposition). The next argument is an array of reals followed by its size. This array contains floating point variables for the filter algorithm, like the forgetting factor. Apart from the first two variable of the integer array (state dimension and ensemble size) and the first variable of the real array (forgetting factor) all further variables are optional. For example, if the size parameter for the integer array is set to 2, only the first two variables are parsed by PDAF_init. This also allows to define both arrays to be of minimum size in combination with defining the size accordingly in the call to PDAF_init. In this case the default values of the optional parameters are used. After the arrays and their sizes, the communicator variables COMM_model, COMM_filter, and COMM_couple have to be provided by PDAF_init. This is followed by task_id, n_modeltasks, and the flag filterpe, all of which are initialized by init_parallel_pdaf. The following argument is the name of the user-provided routine for the initialization of the ensemble states. Defining the name of this routine in the call to PDAF_init allows to use different ensemble initialization routines in a single compiled executable. Internally to PDAF_init the routine is called generically U_ens_init. Finally, the integer variables 'screen' and 'status_pdaf' have to be provided. The former variable defines how much output is written to 'standard out' by PDAF. The latter variable is the error flag of PDAF. The initialization was successful if 'status_pdaf' is zero, otherwise a problem occured. For error codes are described in the routine PDAF_init.

The user-supplied routine for the ensemble initialization is called through a defined interface as is visible in the ensemble implementation. 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). For the ensemble based filter (that is, not for the SEEK filter), the routine has to initialize the ensemble of model states. If domain decomposition is used, the full ensemble for the local sub-domain of the MPI process has to be initialized. (In case of the SEEK filter, the initial state estimate as well as decomposed covariance matrix in form of the the array of EOF modes and the inverse of matrix U have to be initialized.) The ensemble initialization routine is only called if the internal error flag of PDAF_init is zero. The flag is provided to the ensemble initialization routine. The user can set its value depending on the success of the ensemble initialization. Preferably, values above 102 should be used for failures to avoid conflict with the error codes defined within PDAF_init.