wiki:SoftwarePackage

Version 30 (modified by lnerger, 5 years ago) (diff)

--

The Software package

Getting the code package

A package archive with the source code of PDAF and its test suite can be downloaded after registration from the download page.

Structure of the package

The software package contains the following directories:

  • lib/
    • This is the directory in which the library object file of PDAF is created upon compilation.
  • make.arch/
    • This directory contains machine-specific include files for the Makefile.
  • modelbindings/
    • This directory contains the PDAF bindings for real simulation models (starting with PDAF 1.13 for MITgcm)
  • models/
    • This directory contains fully implemented toy models for assimilation experiments with PDAF (added in PDAF 1.15)
  • nullmpi/
    • This directory contains the file nullmpi.F90. The file provides MPI functions for the single-process case. It replaces a real MPI library, if users want to compile PDAF without parallelization support.
  • src/
    • This directory contains the source code of the core routines of PDAF. In addition, a Makefile is included to compile the PDAF library file.
  • templates/
    • This directory contains stubs for all user-supplied routines required by the different filters. These files can be used for the own implementation (alternatively one can base on the routines of the example implementations in testsuite/.)
  • testsuite/
    • This directory contains the test suite of PDAF including example implementations. For more details see the section on the test suite
  • tutorial/
    • From version 1.9 of PDAF, this directory contains an example implementation of the analysis step in the offline mode of PDAF (i.e. an analysis step in a program separate from the forcasting model)

Compiling the PDAF library

The library file of PDAF can be compiled on its own or in connection with an example implementation from tutorial/, models/, or testsuite/. Here, we describe the stand-alone compilation. In order to build the library file, you need a Fortran-2003 compatible compiler and 'make'. In addition, the libraries 'BLAS' and 'LAPACK' are required.

Compiling the PDAF library is conduction in the following steps:

  1. Choose a suitable include file for the make process and/or edit one. In the directory make.arch/ several include files are provided. There are include files for compilation with and without MPI. The name of the include files as well as the header comment in the file described the intended architecture. The choices linux_gfortran.h and linux_gfortran_openmpi.h are quite generic choices that should work on a wide range of computers.
  1. The environment variable PDAF_ARCH specifies for which architecture you compile PDAF according to your choice in step 1. You need to specify the file name without '.h'. You can specify PDAF_ARCH in the make command line like make PDAF_ARCH=NAME. Alternatively, you can set the environment variable $PDAF_ARCH in the shell to the name of the include file (without ending .h), e.g. by setenv PDAF_ARCH NAME in case of a (t)csh or export PDAF_ARCH=NAME in case of bash.
  1. Execute cd src and type 'make' at the prompt. This will compile the sources. The library file is generated in the directory lib/.
  • Note on parallelization: PDAF is generally intended for parallel computing using MPI. However, it can be compiled for serial computing. To compile PDAF for this case a simplified MPI header file is included in src/dummympi and should be in the include path. In addition, a dummy implementation of MPI, which behaves like MPI in the single-process case, is provided in the directory nullmpi/. For the serial case, this file should also be compiled and linked when PDAF is linked to a program. The include files in make.arch without MPI-parallelization include the required settings.
  • Note on precision of floating point variables: PDAF is designed to use floating point variables of double precision. However, for flexibility the variables are decared in the source code without a 'KIND' specification. Thus, for the compilation one has to specify that the compiler treats all 'real' variables with double precision accuracy. This is done, e.g. for gfortran by setting -fdefault-real-8 or for ifort by setting -r8. In the provided include files in make.arch/ these specifications are included. (Starting from version 1.8 of PDAF also single precision is supported. To enable it in PDAF, one has to use the preprocessor definition -DSNGLPREC.)

Tutorial Implementations

The directory tutorial/ contains four example implementations as well as inputs file used to run the examples (from Version 1.9 of PDAF):

  • offline_2D_serial
    • This directory contains the example implementation of the offline mode without parallelization
  • offline_2D_parallel
    • This directory contains a parallel example implementation of the offline mode
  • online_2D_serialmodel
    • This directory contains an example implementation of the online mode with a serial model
  • online_2D_parallelmodel
    • This directory contains an example implementation of the online model with a parallelized model
  • inputs
    • This directory contains inputs files used to run the examples

Please see the tutorial page for the tutorials describing these implementations.

Models

The following example implementations are included in the directories in models/ (from PDAF 1.15; before they were included in testsuite/):

  • lorenz63
    • This directory currently the Lorenz-63 model. In PDAF V1.14 we also added the data assimilation. Because of its small size, this model an be e.g. used with the Particle Filter. Compiling and running this model is described in detail on the page on the [Wiki:Lorenz63_model Lorenz-63 model].
  • lorenz96
    • This directory contains the Lorenz-96 model as well as a full data assimilation implementation of the model with PDAF. This model can be configured to have a sufficiently large state dimension to test low-rank filter algorithms like the SEIK filter. (We have using this model for example in the study: Janjić, T., Nerger, L., Albertella, A., Schröter, J., Skachko S. (2011). On domain localization in ensemble based Kalman filter algorithms. Monthly Weather Review, 139, 2046-2060 ( doi:10.1175/2011MWR3552.1).) Compiling and running this model is described in detail on the page on the [Wiki:Lorenz96_model Lorenz-63 model].

The Test Suite

The test suite of PDAF is included in the directory testsuite/. It contains the following sub-directories:

  • bin/
    • This directory will contain the executable program when an example case is compiled
  • src/
    • This directory contains the example implementations. In addition the Makefile to compile the examples is included.
  • tests_dummy1D/
    • This directory contains scripts to run a series of test runs with the example implementation from testsuite/src/dummymodel_1D. In addition example outputs are included in the sub-directories. These outputs can be used to compare your own test runs with existing outputs. (The example outputs in out.linux_gfortran are from test runs on a Linux PC using the gfortran compilers both with and without parallelization. The example outputs in out.cray_xc_hlrn have been produced using a Cray XC40 Supercomputer with parallelization.)

Example Implementations

The following example implementations are included in the directories in testsuite/src/:

  • dummymodel_1D
    • This is the example implementation in which PDAF is fully connected to a model. The model is trivial: At each time step simply the time step size is added to the state vector. We recommend this example as the starting point to look into the online implementation of PDAF.
  • dummymodel_1D_si
    • This directory contains an analogous example implementation to dummymodel_1D. This variant, however, uses the simplified interface of PDAF. In this case, predefined names of the user-supplied subroutines are used such that there is no need to specify them in the call to the interface of PDAF. (The interface looks simpler in this case, but the subroutine names are fixed)
  • dummymodel_1D_snglprec
    • This directory contains an analogous example implementation to dummymodel_1D. This variant, however, uses single precision (We recommend to use double precision for numerical computation. However, if a model is implemented in single precision PDAF can be used with this model (starting from Version 1.8 of PDAF))
  • offline_1D
    • This example shows the usage of PDAF as an offline tool. In the offline configuration one computes manually the ensemble integrations and supplies this information to PDAF through files. For simplicity, this example does not use files, but generates dummy-information in the code itself. This example is the starting point to look into the offline implementation of PDAF.

Compiling test cases and tutorial implementations

To build an example follow the following steps:

  1. First, follow steps 1 and 2 described in Compiling the PDAF library above.
  2. Change into a directory of a tutorial example, e.g. tutorial/online_2D_serialmodel and execute make. This will show the possible targets than can be compiled. In the tutorial implementation for offline-coupled assimilation, make will directly start the compilation of the example program.
  3. Execute a make operation like make model_pdaf (This will build the tutorial model with assimilation).
  • Note: There are make targets for the compilation of the model itself without data assimilation as well as those for the compilation of the assimilation program. In order to obtain a working assimilation program, one has to define USE_PDAF in the preprocessor definition variable CPP_DEFS has to be set in the include file from make.arch. For example, for most compilers one would use CPP_DEFS = -DUSE_PDAF. When USE_PDAF is not set, the calls to the PDAF routines is not included in the compiled program.

For the tutorial implementations, the compilation procedure is also described in the tutorials.