Changes between Version 45 and Version 46 of Lorenz_96_model


Ignore:
Timestamp:
Jun 1, 2025, 3:43:32 PM (3 days ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Lorenz_96_model

    v45 v46  
    33[[PageOutline(2-3,Contents of this page)]]
    44
    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`).
     5The implementation of the Lorenz-96 model coupled to PDAF is in the directory `models/lorenz96/` of the PDAF package.
    66Provided 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.
     7solved. 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.
    88
    9 Next to the implementation of the Lorenz-96 model with PDAF, the test case provides tool programs and scripts that
     9Next to the implementation of the Lorenz-96 model with PDAF, the test case provides tool programs and scripts  (in the subdirectory `tools/`) that
    1010allow 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`.
    1311
    1412
    1513== Running the test case  ==
    1614
    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.
     15Runnning 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.
    1816
    1917=== 1. Compile and run the forward model without assimilation ===
    2018
    21 First change in the file `make.arch/linux_gfortran_openmpi.h` the line
     19First, 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
    2220{{{
    2321CPP_DEFS = -DUSE_PDAF
     
    2725CPP_DEFS = #-DUSE_PDAF
    2826}}}
    29 to deactivate the coupling to PDAF in the model code. Now build the forward model program with
     27Now build the forward model program with
    3028{{{
    3129  cd models/lorenz96
    32   make lorenz_96 PDAF_ARCH=linux_gfortran_openmpi
     30  make lorenz_96 PDAF_ARCH=linux_gfortran
    3331}}}
    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.
     32You 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
     33is generated in the directory `models/lorenz96`.
    3834
    39 '''Note''': The implementation uses the NetCDF library for file outputs. If the compilation above fails, please ensure the netcdf-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 Fink 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`. 
     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`. 
    4036
    4137To run the forward model use
     
    4743=== 2. Generate observations and a covariance matrix ===
    4844
    49 To build the executables for the tool programs use
     45To compile the tool programs use
    5046{{{
    5147  cd tools
    52   make all PDAF_ARCH=linux_gfortran_openmpi
     48  make all PDAF_ARCH=linux_gfortran
    5349}}}
    5450
     
    5753  ./generate_obs
    5854}}}
    59 and
     55to generate a file holding observations (`obs.nc` in models/lorenz96/) and
    6056{{{
    6157  ./generate_covar
    6258}}}
    63 to generate a file holding observations (`obs.nc` in models/lorenz96/) and
    64 a file holding the covariance matrix information (`covar.nc` in
     59to generate a file holding the covariance matrix information (`covar.nc` in
    6560models/lorenz96/), which is used to generate an initial ensemble for
    66 the data assimilation experiments.
     61the data assimilation experiments. The covariance information consists of singular vectors (EOFs), corresponding singular values and the mean state over the 10000 time steps.
    6762
    6863
    6964=== 3. Build and run the assimilation program ===
    7065
    71 Now do
    72 {{{
    73   cd ../../../make.arch
    74 }}}
    75 and change in the file `linux_gfortran_openmpi.h` the line
     66Now edit the file `make.arch/linux_gfortran.h` again and change the line
    7667{{{
    7768CPP_DEFS = #-DUSE_PDAF
     
    8475
    8576Now compile the Lorenz-96 model with activated
    86 coupling to PDAF. First clean the directories for the main driver and the Lorenz-96 model using
     77coupling to PDAF. First remove the binary files from the previous compilation using
    8778{{{
    88   cd ../models/lorenz96
    89   make clean PDAF_ARCH=linux_gfortran_openmpi
     79  make clean PDAF_ARCH=linux_gfortran
    9080}}}
    91 (This removes object files that were compiled without support for PDAF)
    92 Then build the executable using
     81Then build the assimilative model using
    9382{{{
    94   make pdaf_lorenz_96 PDAF_ARCH=linux_gfortran_openmpi
     83  make pdaf_lorenz_96 PDAF_ARCH=linux_gfortran
    9584}}}
    9685The program `pdaf_lorenz_96` is generated.
     
    10796=== 4. Plot output from the assimilation experiments ===
    10897
    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
     98To display the output of the assimilation experiments we provide plotting scripts for Python or
     99Matlab, Octave. To use them do
    110100{{{
    111101cd plotting
     
    124114there are additional arguments like the time step index. The syntax of the functions is identical for Matlab and Python (except for `plot_rms`):
    125115
    126 ||= Matlab =||= Python =||= Comment =||
     116||= Python =||= !Matlab/Octave =||= Comment =||
    127117|| plot_example() || plot_example() || ||
    128118|| plot_eofs(filename, index) || plot_eofs(filename, index) || index=0 for mean state, index>1 for EOFs ||
    129119|| 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 ||
    131121|| plot_sigma(filename) || plot_sigma(filename) || ||
    132122|| 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 ||
     
    134124Here `filename` is the name of the file including its path.
    135125In 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]]
    142126
    143127'''Python plotting'''[[BR]]
     
    152136`./plot_l96.py plot_obs ../obs.nc 4`[[BR]]
    153137(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]]
     139To 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]]
    156148
    157149
     
    199191Here, '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].
    200192
    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.
     193For 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.
    202194
    203195