Changes between Initial Version and Version 1 of FirstSteps


Ignore:
Timestamp:
Jun 17, 2018, 2:17:29 PM (6 years ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FirstSteps

    v1 v1  
     1= First Steps with PDAF =
     2
     3[[PageOutline(2-3,Contents of this page)]]
     4
     5When you have downloaded PDAF, a good starting point is to run a
     6tutorial example. The directory tutorial/ contains files for tutorials
     7demonstrating the implementation and application of PDAF with a simple 2-dimensional example.
     8
     9== First Test Case - A Single Analysis Step ==
     10
     11In 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 mode of PDAF.
     12
     13=== Compiling ===
     14
     15We recommend to first look at the tutorial offline_2D_serial, which is a
     16single analysis step acting on an ensemble of 2D model fields without any
     17parallelization.
     18
     19Change to the tutorial directory with
     20{{{
     21cd tutorial/offline_2D_serial
     22}}}
     23and run
     24{{{
     25make PDAF_ARCH=linux_gfortran
     26}}}
     27This compiles the assimilation program including PDAF. The compilation
     28should work for computers running Linux. If the compilation fails, please
     29see below the section [#CompilationProblems Compilation Problems].
     30
     31=== Running ===
     32
     33Having compiled the program, you can just run it by executing
     34{{{
     35./PDAF_offline
     36}}}
     37The program computes a single analysis step of the ensemble Kalman filter ESTKF. It should not take more than a second. The program generates the
     38output files
     39`state_ana.txt` (The analysis state)
     40and
     41`ens_01_ana.txt` to `ens_09_ana.txt` (the analysis ensemble).
     42
     43The 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.
     44
     45=== Plotting ===
     46
     47To plot, e.g. the analysis field you can use Matlab or Octave and do
     48{{{
     49load state_ana.txt
     50pcolor(state_ana)
     51}}}
     52You can also plot the initial ensemble mean field by
     53{{{
     54cd ../inputs_offline
     55load state_ini.txt
     56pcolor(state_ini)
     57}}}
     58Analogously you can plot the observations (`obs.txt`) and the true state (`true.txt`) from which the observations have been generated. In the
     59observation 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{{{
     61set(gca,'clim',[-2 2])
     62}}}
     63
     64=== Assimilation Options ===
     65
     66There are various options you can set to modify the assimilation,
     67For example you can run
     68{{{
     69./PDAF_offline -filtertype 7
     70}}}
     71With this setting, the localized filter LESTKF instead of the global ESTKF.
     72Without further settings, the localization radius is set to 0 so that only
     73the observed grid points are changed by the assimilation.
     74You can further set the localization radius with
     75{{{
     76./PDAF_offline -filtertype 7 -local_range 5
     77}}}
     78Now the LESTKF is used with a localization radius of 5 grid points. This
     79localization still uses a constant weight of the observation. So you will
     80see steps in the analysis fields around each observation. To add a
     81tapering so that observations get less influence for increasing distance,
     82use
     83{{{
     84./PDAF_offline -filtertype 7 -local_range 5 -locweight 2
     85}}}
     86Now, the filter is applied with the 5th-order polynomial function by
     87Gaspari and Cohn. As a result you get a smoothly changing analysis field.
     88You can also change the ensemble size, e.g. running
     89{{{
     90./PDAF_offline -dim_ens 5
     91}}}
     92to run with an ensemble of 5 model states. (For this test case we only
     93prepared 9, so only dim_obs<=9 is possible to run here.)
     94The standard deviation (RMS error) of the observation is set to 0.5 in the program. To change it to, e.g. 2.0, would would run
     95{{{
     96./PDAF_offline -rms_obs 2.0
     97}}}
     98All 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.
     99
     100
     101
     102== Second Test Case - A Sequence of Analysis Steps ==
     103
     104As a second test case, we recommend to look at the tutorial online_2D_serialmodel.
     105This case is again a simple 2D model field, but now coupled to PDAF with
     106time stepping. This is the so-called online-coupling of PDAF, in which the model code is augmented with data assimilation functionality provided by PDAF.
     107
     108=== Compiling ===
     109
     110Change to the tutorial directory with
     111{{{
     112cd ../online_2D_serialmodel
     113}}}
     114and run
     115{{{
     116make cleanall
     117}}}
     118and then
     119{{{
     120make model_pdaf PDAF_ARCH=linux_gfortran_openmpi
     121}}}
     122This compiles the assimilation program including PDAF. The compilation
     123should work for computers running Linux, but it requires that OpenMPI
     124is installed on the computer. If it's not installed, please install it
     125using the Linux package providing it. If the compilation still fails,
     126please see below the section [#CompilationProblems Compilation Problems].
     127
     128=== Running ===
     129
     130Having compiled the program, you can just run it by executing
     131{{{
     132mpirun -np 9 ./model_pdaf -dim_ens 9
     133}}}
     134The program computes a sequence of 9 analysis steps with two model time
     135steps in between subsequent analysis steps. The assimilation uses of the
     136ensemble Kalman filter ESTKF. It should not take more than a few seconds.
     137The program generates the
     138output files
     139`state_stepX_ana.txt` (The analysis state at time step X)
     140and
     141`ens_01_stepX_ana.txt` to `ens_09_stepX_ana.txt` (the analysis ensemble at time step X)
     142`ens_01_stepX_for.txt to `ens_09_stepX_for.txt` (the forecast ensemble at time step X)
     143
     144=== Plotting ===
     145
     146You can plot the analysis fields, but also the observations, true fields
     147and the initial state estimate as described in the first test case. However,
     148the files for the observations and true fields are stored in the directory
     149inputs_online/
     150
     151To plot the analysis field at time step 10, you can do
     152{{{
     153load state_step10_ana.txt
     154pcolor(state_step10_ana)
     155}}}
     156You can also plot the initial model field by
     157{{{
     158cd ../inputs_online
     159load state_ini.txt
     160pcolor(state_ini)
     161}}}
     162The directory `inputs_online/` also contains files for the true state at time steps 1 to 18.
     163For example, you can plot the true state at time step 15, with
     164{{{
     165load true_step15.txt
     166pcolor(true_step15)
     167}}}
     168Analogously you can plot the observations (`obs_stepX.txt`) with time step X. In the
     169observation file, observation gaps are indiced by the value -999.0. So
     170to get a meaningful plot, you can specify the limits for the color map by
     171{{{
     172set(gca,'clim',[-2 2])
     173}}}
     174
     175
     176=== Assimilation Options ===
     177
     178The same options as for the first test case can be used here, too. In addition, one can specify the
     179forecast length (number of time steps between two analysis steps by
     180{{{
     181mpirun -np 9 ./model_pdaf -dim_ens 9 -delt_obs 6
     182}}}
     183To change the ensemble size to 6 states, you can use for example
     184{{{
     185mpirun -np 6 ./model_pdaf -dim_ens 6 -filtertype 5 -local_range 3
     186}}}
     187which chooses to run the LETKF with a localization radius of 3 grid points.
     188(Please note: The value behind `-np` must always set to be equal to the value given for `-dim_ens`.
     189For this test case we only
     190prepared 9 initial ensemble files, so only dim_obs<=9 is possible to run here.)
     191
     192
     193
     194
     195
     196== Compilation Problems ==
     197
     198For the compilation, you need `make`. This should be installed on any computer running Linux, Unix or OSX.
     199If it is missing, you cannot compile and should install `make`.
     200
     201The compilation might fail with an error mentioning `blas` or `lapack`.
     202These are libraries for matrix computations, which are used by PDAF for
     203performance reasons. Both libraries are usually installed on Linux
     204computers. If these libraries are missing, please install them from the
     205Linux packages of your Linux distribution. Then compile the tutorial
     206example again.
     207
     208For compilation on computers different from standard Linux or with a
     209different compiler than gfortran, the directory `make.arch/` provides
     210include files for the compilation. To check for a suitable include file
     211koos into the directory `make.arch/`. There are files for
     212compilation on different computers both with and without parallelization
     213(MPI). If you don't find a suitable include file, you might also copy
     214an existing one and edit it for your needs. To specify the include file
     215for the compilation, you just need to set it when running make as
     216{{{
     217make PDAF_ARCH=FILENAME_WITHOUT_.h
     218}}}
     219
     220
     221== Next steps ==
     222
     223Possible next steps from here can be the following:
     224
     225
     226=== Implementing PDAF with your model ===
     227
     228If you plan to couple PDAF with your model, we recommend to study the [wiki:PdafTutorial PDAF implementation tutorials]. The tutorial provides a step-by-step explanation of the implementation steps. Further, please see the description of the [wiki:GeneralImplementationConcept Implementation Concept of PDAF].
     229
     230=== Model Bindings ===
     231
     232With PDAF 1.13, the PDAF package provides a model binding for the MITgcm general circulation model. This code provides an implementation of PDAF with the MITgcm model for a simple test case. Please look into the directory `modelbindings/MITgcm/` of the PDAF package, where a README-file describes the use of the model binding code.