25 | | == External ensemble loop == |
26 | | |
27 | | The external loop for the ensemble integration has to enclose the time stepping loop of the model. Next to the external loop, a control structure for exiting the external loop as well as two calls to subroutines of PDAF have to be added. These are the calls to `PDAF_get_state` and a filter-specific routine like `PDAF_put_state_seik` for the SEIK filter. Both routines are described in sections below. |
28 | | |
29 | | The extended model code can look like this for the SEIK filter: |
30 | | {{{ |
31 | | pdaf_modelloop: DO |
32 | | |
33 | | CALL PDAF_get_state(nsteps, ..., doexit, ...) |
34 | | |
35 | | ! Check whether forecast has to be performed |
36 | | ifcontrol: IF (doexit /= 1) THEN |
37 | | |
38 | | IF (nsteps > 0) THEN |
39 | | |
40 | | ... Time stepping code of the model ... |
41 | | |
42 | | END IF |
43 | | |
44 | | CALL PDAF_put_state_seik(...) |
45 | | |
46 | | ELSE ifcontrol |
47 | | |
48 | | ! No more assimilation work; exit loop |
49 | | EXIT pdaf_modelloop |
50 | | |
51 | | END IF ifcontrol |
52 | | |
53 | | END DO pdaf_modelloop |
54 | | }}} |
55 | | 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). |