| 39 | In this example, which is taken from the example implementation in `testsuite/src/dummymodel_1D`, we use an unconditional DO loop (while loop). The exit flag `doexit` for this loop is set within `PDAF_get_state`. In addition, the variable `nsteps` is initialized, which defines the number of time steps to be performed during the current forecast phase. Thus, we only execute the time stepping code if `nsteps>0`. (If this has to be implemented using an IF-clause as in the example should be checked for the particular code). |
| 40 | |
| 41 | == PDAF_get_state == |
| 42 | |
| 43 | The routine `PDAF_get_state` has the purpose to initialize the information, whether further model integrations have to be computed and how many time steps have to be performed. In addition, the model fields to be propagated are initialized from the array holding the ensemble states. |
| 44 | |
| 45 | The interface of `PDAF_get_state` is the following: |
| 46 | {{{ |
| 47 | SUBROUTINE PDAF_get_state(nsteps, timenow, doexit, U_next_obs, U_distribute_state, & |
| 48 | U_prepoststep, status) |
| 49 | }}} |
| 50 | with the following arguments: |
| 51 | * `nsteps`: An integer specifying upon exit the number of time steps to be performed |
| 52 | * `timenow`: A real specifying upon exit the current model time. |
| 53 | * `doexit`: An integer variable defining whether the assimilation process is completed and the program should exit the while loop. For compatibility 1 should be used for exit, 0 for continuing in the loop. |
| 54 | * `U_next_obs`: A user supplied routine that initializes the variables `nsteps`, `timenow`, and `doexit` |
| 55 | * `U_distributed_state`: A user supplied routine that initializes the model fields from the array holding the ensemble of moel state vectors |
| 56 | * `U_prepoststep`: A user supplied routine that is called before and after the analysis step. Here the user has the possibility to access the state ensemble and can e.g. compute estimated variances or can write the ensemble states the state estimate into files. |
| 57 | * `status`: An integer status flag |