| 59 | == User-supplied routines == |
| 60 | |
| 61 | Here, all user-supplied routines are described that are required in the call to `PDAF_generate_obs`. For some of the generic routines, we link to the page on [ModifyModelforEnsembleIntegration modifying the model code for the ensemble integration]. |
| 62 | |
| 63 | To indicate user-supplied routines we use the prefix `U_`. In the template directory `templates/` as well as in the example implementation in `testsuite/src/dummymodel_1D` these routines exist without the prefix, but with the extension `_pdaf.F90`. In the section titles below we provide the name of the template file in parentheses. |
| 64 | |
| 65 | In the subroutine interfaces some variables appear with the suffix `_p` (short for 'process'). This suffix indicates that the variable is particular to a model sub-domain, if a domain decomposed model is used. Thus, the value(s) in the variable will be different for different model sub-domains. In addition, there will be variables with the suffix `_f` (for 'full'). |
| 66 | |
| 67 | === `U_collect_state` (collect_state_pdaf.F90) === |
| 68 | |
| 69 | This routine is independent from the filter algorithm used. |
| 70 | See the page on [InsertAnalysisStep#U_collect_statecollect_state_pdaf.F90 inserting the analysis step] for the description of this routine. |
| 71 | |
| 72 | === `U_distribute_state` (distribute_state_pdaf.F90) === |
| 73 | |
| 74 | This routine is independent of the filter algorithm used. |
| 75 | See the page on [InsertAnalysisStep#U_distribute_statedistribute_state_pdaf.F90 inserting the analysis step] for the description of this routine. |
| 76 | |
| 77 | |
| 78 | === `U_init_dim_obs_f` (init_dim_obs_f_pdaf.F90) === |
| 79 | |
| 80 | This routine has to initialize the size `dim_obs_f` of the full observation vector according to the current time step. For simplicity, `dim_obs_f` can be the size for the global model domain. The routine is described in detail on the [wiki:ImplementAnalysislestkf page on implementing the analysis step for LESKTF]. |
| 81 | |
| 82 | === `U_obs_op_f` (obs_obs_f_pdaf.F90) === |
| 83 | |
| 84 | This routine has to perform the operation of the observation operator acting on a state vector, which is provided as `state_p`. The observed state has to be returned in `m_state_f`. It is the observed state corresponding to the 'full' observation vector. The routine is described in detail on the [wiki:ImplementAnalysislestkf page on implementing the analysis step for LESKTF]. |
| 85 | |
| 86 | === `U_get_obs_f` (get_obs_f_pdaf.F90) === |
| 87 | |
| 88 | This routine is specific for the observation generation. In this routine PDAF provides the user with the vector of synthetic observations generated by PDAF. One can then e.g. write the observation vector into a file so that one can use it later in a twin experiment (The template file `readwrite_obs.F90` provides functionality for reading and writing as described on the [wiki:readwrite_obs page on readwrite_obs]. |
| 89 | |
| 90 | The interface is the following: |
| 91 | {{{ |
| 92 | SUBROUTINE get_obs_f_pdaf(step, dim_obs_f, observation_f) |
| 93 | }}} |
| 94 | with |
| 95 | * `step` : `integer, intent(in)`[[BR]] Current time step |
| 96 | * `dim_obs_f` : `integer, intent(in)`[[BR]] Size of the full observation vector |
| 97 | * `observation_f` : `real, intent(out), dimension(dim_obs_f)`[[BR]] Full vector of synthetic observations (process-local) |
| 98 | |
| 99 | Hints: |
| 100 | * For the generation of synthetic observations, PDAF does not distinguish between local and global filters. Without parallelization, the full observation vector would be the same for both types of filters. With parallelization the implementation of the observation operator used for generating the observations will define whether different process-domain have the same or distinct observation vectors (i.e. covering the global domain or different process-specific domains). |
| 101 | * In case of the global filters, one uses the functionality of the observation operator for this filter type. With parallelization, the observation operator will initialize an observation vector specifically for each process-domain. |
| 102 | * The usual operation performed in this routine is to write the generated synthetic observation into a file. The PDAF package provides the template routine [wiki:readwrite_obs readwrite_obs] for this. Depending on the parallelization, discussed above, one either writes a single file (of the full observation vector is the same for all processes. In this case one a single process calls the writing routine) or a different file for each process (in this case, each process call the routine with a different file name; usually indicating the process-rank number). |
| 103 | |
| 104 | |
| 105 | === `U_init_obserr_f` (init_obserr_f_pdaf.F90) === |
| 106 | |
| 107 | This routine is specific for the observation generation. The routine is called by PDAF during the observation generation. Its purpose is to fill the provided vector of observation error standard deviations. |
| 108 | |
| 109 | The interface is the following: |
| 110 | {{{ |
| 111 | SUBROUTINE init_obserr_f_pdaf(step, dim_obs_f, obs_f, rms_obs) |
| 112 | }}} |
| 113 | with |
| 114 | * `step` : `integer, intent(in)`[[BR]] Current time step |
| 115 | * `dim_obs_f` : `integer, intent(in)`[[BR]] Size of full observation vector |
| 116 | * `obs_f` : `real, intent(in), dimension(dim_obs_f)`[[BR]] Full vector of observations |
| 117 | * `rms_obs` : `real, intent(out), dimension(dim_obs_f)`[[BR]] Full vector of observation error standard deviations |
| 118 | |
| 119 | Notes: |
| 120 | * The routines handles the 'full' observation vector as in localizated filters. As described for the observation generation functionality one can also use it for global filters. In this case the 'full' vector would just contain the observations local to a process sub-domain. |
| 121 | * The observation vector `obs_f` is provided to the routine for the case that the observation error is relative to the value of the observations. |
| 122 | |
| 123 | |
| 124 | === `U_prepoststep` (prepoststep_ens_pdaf.F90) === |
| 125 | |
| 126 | This routine can be identical to that used for the global ESTKF algorithm, which has already been described on the [ModifyModelforEnsembleIntegration#U_prepoststepprepoststep_ens.F90 page on modifying the model code for the ensemble integration]. |
| 127 | |
| 128 | === `U_next_observation` (next_observation_pdaf.F90) === |
| 129 | |
| 130 | This routine is independent of the filter algorithm used. |
| 131 | See the page on [InsertAnalysisStep#U_next_observationnext_observation_pdaf.F90 inserting the analysis step] for the description of this routine. |
| 132 | |