Changes between Version 16 and Version 17 of FirstSteps
- Timestamp:
- May 31, 2025, 7:02:03 PM (2 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FirstSteps
v16 v17 7 7 demonstrating the implementation and application of PDAF with a simple 2-dimensional example. 8 8 9 Here we describe the steps for a Linux-based computer. 10 9 11 == First Test Case - A Single Analysis Step == 10 12 11 In this test case, a data assimilation program is used to read an ensemble of model fields from files and compute an analysis step. This is the so-called offline coupling modeof PDAF. A full description of this test case is provided in the [wiki:PdafTutorial implementation tutorial for the offline mode of PDAF].13 In this test case, a data assimilation program is used to read an ensemble of model fields from files and compute an analysis step. This is the so-called ''offline coupled mode'' of PDAF. A full description of this test case is provided in the [wiki:PdafTutorial implementation tutorial for the offline mode of PDAF]. 12 14 13 15 === Compiling === 14 16 15 We recommend to first look at the tutorial offline_2D_serial, which is a17 We recommend to first look at the tutorial `offline_2D_serial`, which is a 16 18 single analysis step acting on an ensemble of 2D model fields without any 17 19 parallelization. … … 23 25 and run 24 26 {{{ 25 make PDAF_ARCH=linux_gfortran _openmpi27 make PDAF_ARCH=linux_gfortran 26 28 }}} 27 29 This compiles the assimilation program including PDAF. The compilation … … 35 37 ./PDAF_offline 36 38 }}} 37 The program reads ensemble files and a file holding the observations from the directory `tutorial/inputs_offline/`. Then it computes a single analysis step of the ensemble Kalman filter ESTKF. Running the program should not take more than a second. The program generates the 38 output files 39 `state_ana.txt` (The analysis state) 40 and 41 `ens_01_ana.txt` to `ens_09_ana.txt` (the analysis ensemble). 42 43 The screen output shows the progress of the program. For example the ensemble standard deviation before and after the analysis step and final timing and memory information are shown. Lines starting with 'PDAF' are outputs from the code part of PDAF other lines are from the user routines. 39 The program reads ensemble files and a file holding the observations from the directory `tutorial/inputs_offline/`. Then, it computes a single analysis step of the ensemble Kalman filter ESTKF. Running the program should only take seconds. The program generates the output files 40 * `state_ana.txt` (the analysis state) 41 * `ens_01_ana.txt` to `ens_09_ana.txt` (the analysis ensemble). 42 43 The screen output shows the progress of the program. For example, the ensemble standard deviation before and after the analysis step and final timing and memory information are shown. Lines starting with 'PDAF' are outputs from the core part of PDAF; other lines are from the user routines. 44 44 45 45 === Plotting === 46 46 47 To plot, e.g. the analysis field you can use Matlab or Octave and do 48 {{{ 49 load state_ana.txt 50 pcolor(state_ana) 51 }}} 52 You can also plot the initial ensemble mean field by 53 {{{ 54 cd ../inputs_offline 55 load state_ini.txt 56 pcolor(state_ini) 57 }}} 58 Analogously you can plot the observations (`obs.txt`) and the true state (`true.txt`) from which the observations have been generated. In the 59 observation file, only 28 grid points are observed, while non-observed grid points have the value -999.0. To get a meaningful plot, you can specify the limits for the color map by 60 {{{ 61 set(gca,'clim',[-2 2]) 62 }}} 63 64 Alternatively, you can plot using Python with e.g. 47 You can plot using Python with, for example 65 48 {{{ 66 49 import numpy as np … … 75 58 }}} 76 59 60 Analogously you can plot the observations (`obs.txt`) and the true state (`true.txt`) from which the observations have been generated. These files are in the input directory. In the observation file, only 28 grid points are observed, while non-observed grid points have the value -999.0. To get a meaningful plot, you can specify the color limits by 61 {{{ 62 plt.clim([-1.5, 1.5]) 63 }}} 64 before showing the plot. 65 66 77 67 === Assimilation Options === 78 68 79 There are various options you can set to modify the assimilation, 69 There are various options you can set on the command line to modify the assimilation. 70 80 71 For example you can run 81 72 {{{ 82 73 ./PDAF_offline -filtertype 7 83 74 }}} 84 With this setting,the localized filter LESTKF instead of the global ESTKF.85 Without further settings, the localization radius is set to 0 so that only75 to apply the localized filter LESTKF instead of the global ESTKF. 76 Without further settings, the localization radius is set to 0.0 so that only 86 77 the observed grid points are changed by the assimilation. 87 You can further set the localization cut-off gradius with78 You can further set the localization cut-off radius with 88 79 {{{ 89 80 ./PDAF_offline -filtertype 7 -cradius 5.0 90 81 }}} 91 Now the LESTKF is used with a localization radius of 5 grid points. This92 localization stilluses a constant weight of the observation. So you will82 Now, the LESTKF is used with a localization radius of 5 grid points. This 83 localization uses a constant weight of the observation. So you will 93 84 see steps in the analysis fields around each observation. To add a 94 85 tapering so that observations get less influence for increasing distance, … … 98 89 }}} 99 90 Now, the filter is applied with the 5th-order polynomial function by 100 Gaspari and Cohn . As a result you get a smoothly changing analysis field.91 Gaspari and Cohn (1999). As a result you get a smoothly varying analysis field. 101 92 You can also change the ensemble size, e.g. running 102 93 {{{ … … 104 95 }}} 105 96 to run with an ensemble of 5 model states. (For this test case we only 106 prepared 9 , so only dim_obs<=9 is possible to run here.)107 The standard deviation (RMS error) of the observation is set to 0.5 in the program. To change it to, e.g. 2.0, would wouldrun97 prepared 9 ensemble files, so only dim_ens<=9 is possible to run here. Please note that such ensemble size is usually too low for real cases) 98 The standard deviation (RMS error) of the observation is set to 0.5 in the program. To change it to, e.g. 2.0, you can run 108 99 {{{ 109 100 ./PDAF_offline -rms_obs 2.0 110 101 }}} 111 Also the inflation can be specified on the command line. PDAF uses the so-called forgetting factor, which is a positive value <=1 (the ensemble variance is influted by the inverse of the forgetting factor). One can specify the forgetting factor as102 Also the inflation can be specified on the command line. PDAF uses the so-called forgetting factor, which is a positive value <=1.0 (the ensemble variance is inflated by the inverse of the forgetting factor). One can specify the forgetting factor as 112 103 {{{ 113 104 ./PDAF_offline -forget 0.9 114 105 }}} 115 All the different options can be combined. For a complete list of possible options, see the file ` init_pdaf_offline.F90`, which is the source code file in which the default values of options are specified.106 All the different options can be combined. For a complete list of possible options, see the file `mod_assimilate.F90`, which is the source code file in which the default values of options are declared and explained. 116 107 117 108 … … 120 111 == Second Test Case - A Sequence of Analysis Steps == 121 112 122 As a second test case, we recommend to look at the tutorial online_2D_serialmodel.113 As a second test case, we recommend to look at the tutorial `online_2D_serialmodel`. 123 114 This case is again a simple 2D model field, but now coupled to PDAF with 124 time stepping. This is the so-called online-couplingof PDAF, in which the model code is augmented with data assimilation functionality provided by PDAF. A full description of this test case is provided in the [wiki:PdafTutorial implementation tutorial for the online mode of PDAF].115 time stepping. This is the so-called ''online coupling'' of PDAF, in which the model code is augmented with data assimilation functionality provided by PDAF. A full description of this test case is provided in the [wiki:PdafTutorial implementation tutorial for the online mode of PDAF]. 125 116 126 117 === Compiling === … … 131 122 }}} 132 123 and run 133 {{{134 make cleanall PDAF_ARCH=linux_gfortran_openmpi135 }}}136 and then137 124 {{{ 138 125 make model_pdaf PDAF_ARCH=linux_gfortran_openmpi … … 140 127 This compiles the assimilation program including PDAF. The compilation 141 128 should work for computers running Linux, but it requires that OpenMPI 142 is installed on the computer. If it's not installed, please install it 143 using the Linux package providing it. If the compilation still fails, 129 is installed on the computer. If it is not installed, please install the Linux package providing it. If the compilation still fails, 144 130 please see below the section [#CompilationProblems Compilation Problems]. 145 131 … … 148 134 Having compiled the program, you can just run it by executing 149 135 {{{ 150 mpirun -np 9 ./model_pdaf -dim_ens 9 151 }}} 152 The program computes a sequence of 9 analysis steps with two model time 153 steps in between subsequent analysis steps. The initial ensemble are read from the directory `tutorial/inputs_online/`, where also the observation files are stored. The assimilation uses of the 136 mpirun -np 5 ./model_pdaf -dim_ens 5 137 }}} 138 The program computes a sequence of 9 analysis steps with of forecase phase of 2 time steps (thus two model time steps are computed in between subsequent analysis steps). The initial ensemble files are read from the directory `tutorial/inputs_online/`, where also the observation files are stored. The assimilation uses of the 154 139 ensemble Kalman filter ESTKF. It should not take more than a few seconds. 155 The program generates the 156 output files 157 `state_stepX_ana.txt` (The analysis state at time step X) 158 and 159 `ens_01_stepX_ana.txt` to `ens_09_stepX_ana.txt` (the analysis ensemble at time step X) 160 `ens_01_stepX_for.txt to `ens_09_stepX_for.txt` (the forecast ensemble at time step X) 140 The program generates the output files 141 * `state_stepX_ana.txt` (the analysis state at time step X) 142 * `ens_01_stepX_ana.txt` to `ens_09_stepX_ana.txt` (the analysis ensemble at time step X) 143 * `ens_01_stepX_for.txt` to `ens_09_stepX_for.txt` (the forecast ensemble at time step X) 161 144 162 145 === Plotting === … … 167 150 inputs_online/ 168 151 169 To plot the analysis field at time step 10, you can do 170 {{{ 171 load state_step10_ana.txt 172 pcolor(state_step10_ana) 173 }}} 174 You can also plot the initial model field by 175 {{{ 176 cd ../inputs_online 177 load state_ini.txt 178 pcolor(state_ini) 179 }}} 180 The directory `inputs_online/` also contains files for the true state at time steps 1 to 18. 181 For example, you can plot the true state at time step 15, with 182 {{{ 183 load true_step15.txt 184 pcolor(true_step15) 185 }}} 186 Analogously you can plot the observations (`obs_stepX.txt`) with time step X. In the 187 observation file, observation gaps are indiced by the value -999.0. So 188 to get a meaningful plot, you can specify the limits for the color map by 189 {{{ 190 set(gca,'clim',[-2 2]) 191 }}} 152 You can plot using Python with, for example 153 {{{ 154 import numpy as np 155 import matplotlib.pyplot as plt 156 157 file = 'state_step10_ana.txt' 158 159 field = np.loadtxt(file) 160 161 plt.pcolor(field) 162 plt.show() 163 }}} 164 165 Analogously, you can also plot the initial model field `state_ini.txt`, the true state (`true_stepX.txt`), or observations (`obs_stepX.txt`) with X the time step. 192 166 193 167 194 168 === Assimilation Options === 195 169 196 The same options as for the first test case can be used here, too. In addition, one can specify the 197 forecast length (number of time steps between two analysis steps by 170 The same options as for the first test case can be used here, too. 171 172 In addition, one can specify the 173 forecast length (number of time steps between two analysis steps) by 198 174 {{{ 199 175 mpirun -np 9 ./model_pdaf -dim_ens 9 -delt_obs 6