Changes between Version 45 and Version 46 of Lorenz_96_model
- Timestamp:
- Jun 1, 2025, 3:43:32 PM (3 days ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Lorenz_96_model
v45 v46 3 3 [[PageOutline(2-3,Contents of this page)]] 4 4 5 The implementation of the Lorenz-96 model coupled to PDAF is in the directory `models/lorenz96/` of the PDAF package (from PDAF 1.15, before it was located in `estsuite/src/lorenz96`).5 The implementation of the Lorenz-96 model coupled to PDAF is in the directory `models/lorenz96/` of the PDAF package. 6 6 Provided is a full implementation of PDAF with the nonlinear Lorenz96 model (E. N. Lorenz (1996) Predictability - a problem partly 7 solved. Proceedings Seminar on Predictability, ECMWF, READING, UK) providing various filter and smoother methods. We used this implementation for different publications in which we studied the behavior of different data assimilation methods.7 solved. Proceedings Seminar on Predictability, ECMWF, READING, UK) providing the possibility to assess various filter and smoother methods. We used this implementation for different publications in which we studied the behavior of different data assimilation methods. 8 8 9 Next to the implementation of the Lorenz-96 model with PDAF, the test case provides tool programs and scripts that9 Next to the implementation of the Lorenz-96 model with PDAF, the test case provides tool programs and scripts (in the subdirectory `tools/`) that 10 10 allow to run a test case and to display the outputs. Note, that this implementation runs without parallelization. 11 12 This description focuses on PDAF version 1.15 and later as we have moved the Lorenz-96 model case in version 1.15 to the directory `models`.13 11 14 12 15 13 == Running the test case == 16 14 17 Runnning a data assimilation experiment with the Lorenz-96 model is a two step process: First one runs the model without PDAF to generate a file holding the trajectory of a forward run. Then one generates files with observations and a covariance matrix for the initialization of the initial ensemble. In the second step, one compiles the Lorenz-96 model with activated coupling to PDAF and runs the data assimilation experiments.15 Runnning a data assimilation experiment with the Lorenz-96 model is a two step process: First one runs the model without PDAF to generate a file holding the trajectory of a forward run. Then, one generates a file with observations and a file holding information on the covariance matrix (EOFs and singular values, see the [wiki:EnsembleGeneration page on ensemble generation]). The second file will be used to generate the initial ensemble with second-order exact sampling. Afterwards, one compiles the Lorenz-96 model with activated coupling to PDAF and runs the data assimilation experiments. 18 16 19 17 === 1. Compile and run the forward model without assimilation === 20 18 21 First change in the file `make.arch/linux_gfortran_openmpi.h` the line19 First, we compile the Lorenz-96 model without assimilation. For this we need to deactivate the code parts that couple to PDAF. For this, change in the file `make.arch/linux_gfortran.h` the line 22 20 {{{ 23 21 CPP_DEFS = -DUSE_PDAF … … 27 25 CPP_DEFS = #-DUSE_PDAF 28 26 }}} 29 to deactivate the coupling to PDAF in the model code.Now build the forward model program with27 Now build the forward model program with 30 28 {{{ 31 29 cd models/lorenz96 32 make lorenz_96 PDAF_ARCH=linux_gfortran _openmpi30 make lorenz_96 PDAF_ARCH=linux_gfortran 33 31 }}} 34 You have to ensure 35 that in the machine-specific make include file `linux_gfortran_openmpi.h` `-DUSE_PDAF` is not defined 36 for CPP_DEFS (such that calls to PDAF are not active). You can replace `linux_gfortran_openmpi` by any other make include file from `make.arch/`, e.g. specify `macos_gfortran` for compiling on MacOS. The executable 37 is generated in this directory. 32 You can replace `linux_gfortran` by any other make include file from `make.arch/`, e.g. specify `macos_gfortran_openmpi` for compiling on MacOS. The executable 33 is generated in the directory `models/lorenz96`. 38 34 39 '''Note''': The implementation uses the NetCDF library for file outputs. If the compilation above fails, please ensure the net cdf-library ist installed. On computers running Linux, it is usually available as a package of the operating system. On MacOS one can install the netcdf library e.g. using Finkor !MacPorts. NetCDF is a self-describing binary output format, but here it is not required that you know details about it. Anyway, if you like to look 'into' a NetCDF file, please try to use `ncdump FILENAME | less`.35 '''Note''': The implementation uses the NetCDF library for file outputs. If the compilation above fails, please ensure the netCDF-library is installed. On computers running Linux, netCDF is usually available as a package of the operating system. On MacOS one can install the netcdf library e.g. using Homebrew or !MacPorts. NetCDF is a self-describing binary output format, but here it is not required that you know details about it. Anyway, if you like to look 'into' a NetCDF file, please try to use `ncdump FILENAME | less`. 40 36 41 37 To run the forward model use … … 47 43 === 2. Generate observations and a covariance matrix === 48 44 49 To build the executables forthe tool programs use45 To compile the tool programs use 50 46 {{{ 51 47 cd tools 52 make all PDAF_ARCH=linux_gfortran _openmpi48 make all PDAF_ARCH=linux_gfortran 53 49 }}} 54 50 … … 57 53 ./generate_obs 58 54 }}} 59 and55 to generate a file holding observations (`obs.nc` in models/lorenz96/) and 60 56 {{{ 61 57 ./generate_covar 62 58 }}} 63 to generate a file holding observations (`obs.nc` in models/lorenz96/) and 64 a file holding the covariance matrix information (`covar.nc` in 59 to generate a file holding the covariance matrix information (`covar.nc` in 65 60 models/lorenz96/), which is used to generate an initial ensemble for 66 the data assimilation experiments. 61 the data assimilation experiments. The covariance information consists of singular vectors (EOFs), corresponding singular values and the mean state over the 10000 time steps. 67 62 68 63 69 64 === 3. Build and run the assimilation program === 70 65 71 Now do 72 {{{ 73 cd ../../../make.arch 74 }}} 75 and change in the file `linux_gfortran_openmpi.h` the line 66 Now edit the file `make.arch/linux_gfortran.h` again and change the line 76 67 {{{ 77 68 CPP_DEFS = #-DUSE_PDAF … … 84 75 85 76 Now compile the Lorenz-96 model with activated 86 coupling to PDAF. First clean the directories for the main driver and the Lorenz-96 modelusing77 coupling to PDAF. First remove the binary files from the previous compilation using 87 78 {{{ 88 cd ../models/lorenz96 89 make clean PDAF_ARCH=linux_gfortran_openmpi 79 make clean PDAF_ARCH=linux_gfortran 90 80 }}} 91 (This removes object files that were compiled without support for PDAF) 92 Then build the executable using 81 Then build the assimilative model using 93 82 {{{ 94 make pdaf_lorenz_96 PDAF_ARCH=linux_gfortran _openmpi83 make pdaf_lorenz_96 PDAF_ARCH=linux_gfortran 95 84 }}} 96 85 The program `pdaf_lorenz_96` is generated. … … 107 96 === 4. Plot output from the assimilation experiments === 108 97 109 To display the output of the assimilation experiments we provide plotting scripts for Matlab, Octave and (from PDAF 1.13.2) Python. To use them do 98 To display the output of the assimilation experiments we provide plotting scripts for Python or 99 Matlab, Octave. To use them do 110 100 {{{ 111 101 cd plotting … … 124 114 there are additional arguments like the time step index. The syntax of the functions is identical for Matlab and Python (except for `plot_rms`): 125 115 126 ||= Matlab =||= Python=||= Comment =||116 ||= Python =||= !Matlab/Octave =||= Comment =|| 127 117 || plot_example() || plot_example() || || 128 118 || plot_eofs(filename, index) || plot_eofs(filename, index) || index=0 for mean state, index>1 for EOFs || 129 119 || plot_obs(filename, timestep) || plot_obs(filename, timestep) || || 130 || plot_rms(filename [, plot_forecast= 1, plot_analysis=1]) || plot_rms(filename [, plot_forecast=True, plot_analysis=True]) ||plot_forecast/plot_analysis are optional and switch on/off a plot ||120 || plot_rms(filename [, plot_forecast=True, plot_analysis=True]) ||plot_rms(filename [, plot_forecast=1, plot_analysis=1]) || plot_forecast/plot_analysis are optional and switch on/off a plot || 131 121 || plot_sigma(filename) || plot_sigma(filename) || || 132 122 || plot_state(filename, timestep [, choice='t']) || plot_state(filename, timestep [, choice='t']) || `choice` is optional; options for `choice`: 't' true (use with truth file `state.nc`); for use with assimilation experiment output files: 'f' forecast, 'a' analysis, 'i' initial || … … 134 124 Here `filename` is the name of the file including its path. 135 125 In Matlab use 'help' to display the information about required input. 136 137 '''!Matlab/Octave plotting examples:'''[[BR]]138 `plot_obs('../obs.nc',100)` plots the observation at time step 100[[BR]]139 `plot_state('../t1_N30_f0.97.nc',100,'f')` plots the forecast state estimate at the 100th analysis step[[BR]]140 `plot_rms('../t1_N30_f0.97.nc')` plots the true and estimated RMS errors over time for the chosen experiment[[BR]]141 `plot_state('../state.nc',1101)` plots the true state at model time step 1101 (= analysis step 100)[[BR]]142 126 143 127 '''Python plotting'''[[BR]] … … 152 136 `./plot_l96.py plot_obs ../obs.nc 4`[[BR]] 153 137 (If this fails you can also try to run the script as 154 `python plot_l96.py plot_obs ../obs.nc 4`). To plot only the Analysis RMS error one can use[[BR]] 155 `plot_rms ../t1_N30_f0.95.nc False True` 138 `python plot_l96.py plot_obs ../obs.nc 4`). [[BR]] 139 To plot only the analysis RMS error one can use[[BR]] 140 `./plot_l96.py plot_rms ../t1_N30_f0.95.nc False True` 141 142 143 '''!Matlab/Octave plotting examples:'''[[BR]] 144 `plot_obs('../obs.nc',100)` plots the observation at time step 100[[BR]] 145 `plot_state('../t1_N30_f0.97.nc',100,'f')` plots the forecast state estimate at the 100th analysis step[[BR]] 146 `plot_rms('../t1_N30_f0.97.nc')` plots the true and estimated RMS errors over time for the chosen experiment[[BR]] 147 `plot_state('../state.nc',1101)` plots the true state at model time step 1101 (= analysis step 100)[[BR]] 156 148 157 149 … … 199 191 Here, 'regulation' refers to the regulated localization introduced in Nerger, L., Janjić, T., Schröter, J., Hiller, W. (2012). A regulated localization scheme for ensemble-based Kalman filters. Quarterly Journal of the Royal Meteorological Society, 138, 802-812. [https://doi.org/10.1002/qj.945 doi:10.1002/qj.945]. 200 192 201 For the full set of options, please see init_pdaf.F90 in the lorenz96 directory. There, also the possible settings e.g. for `filtertype` are described.193 For the full set of options, please see init_pdaf.F90 and mod_assimilation.F90 in the lorenz96 directory. There, also the possible settings e.g. for `filtertype` are described. 202 194 203 195