Snoopy Version 6.0 (Albert)
Using the code

Configuring the code

As any open source software, Snoopy comes with automatic configuration tools. The script ./configure allows one to configure the main options of snoopy, creating a customized Makefile and producing a default src/gvars.h and snoopy.cfg to setup the physics. The following options may be used with the configure script:

  • --with-problem=PROB: Initialize the code with problem PROB. This initializes snoopy.cfg and src/gvars.h according to PROB. See the section Problem setup for a standard list of problems.
  • --enable-mpi: Enable MPI parallelization
  • --enable-fftw-mpi: Enable *experimental* support of MPI found in fftw3.3alpha. These routines replace the custom transpose routines found in Snoopy and are generally more efficient. NB: MPI support in fftw3 is still under developpement and untested.
  • --enable-openmp: Enable OpenMP support. Useful on Intel Core** processors. This option requires OpenMP support in FFTW3 (see fftw3 doc).
  • --enable-debug: Enable debug outputs. This option will override the optimisation flags and create LOTS of outputs when the code is run.
  • CC=xxx: force the compiler to be xxx.
  • CFLAGS=xxx: force the compilation flags to be xxx.
  • LDFLAGS=xxx: force the link flags to be xxx.
  • FFTPATH=xxx: specify where the FFTW 3 libraries are located (if not found in the default path). This option assumes the libraries files (libfftw3.a...) are in xxx/lib and the include files (fftw3.h...) are in xxx/include.

Example: One wants to configure Snoopy with openMP using the Intel compiler "icc". The fftw library is located in /opt (/opt/lib and /opt/include) and one wants to initialize an MRI problem. One has to configure Snoopy with:

./configure CC=icc FFTPATH=/opt --enable-openmp --with-problem=mri

Once the configure script has finished, you normally don't need to run it again, except if you want to change one of these options.

Testing the code

A standard test can be run typing "make check". This test, although not physically meaningful (magnetized 2D vortex with unstable boussinesq stratification), switches on almost all the routines of the code and therefore checks if everything is running as it should. Make check compiles the code with a benchmark configuration (saving your gvars.h if you have already made modifications), runs it and compares the outputs to a standard output. If the code behaves normally, "make check" should exit without any error.

Problem setup

A problem correponds to a header file src/gvars.h and a config file snoopy.cfg. Templates of these files for several problems are located in src/problem. Each problem (corresponding to a subdirectory in src/problem) can be initialized using --with-problem=PROB of the configure script or alternatively moving by hand gvars.h in ROOT/src and snoopy.cfg in ROOT/. The file gvars.h contains major options requiring a recompilation of the code (make). The file snoopy.cfg is read at runtime and should be accessible by at least process of rank 0 (for MPI runs). The available options in gvars.h and snoopy.cfg are described in the Code configuration documentation. The following problems are available by default (the user can create new problems with new directories in src/problem).

  • default
  • bench
  • mri
  • convection
  • couette
  • sbi (Subcritical baroclinic instability)

Code interface

While the code is running, it's possible to know what's happening in real time using the so-called interface (located in interface.c). Typically, one creates a file with a filename corresponding to one of the possible commands (e.g using the command "touch" on UNIX, as "touch status"). Once the command has been executed, the code deletes the file. The available commands are as follow:

  • status: show the status of the code, including current time, current time step and code speed.
  • output: Immediatly write the statistical informations in timevar, output one snapshot and a dump file.
  • dump: Immediatly output a dump file.
  • stop: Immediatly output a dump file and exit the code.

It is possible to redirect the display outputs of the interface to a file using the interface_output_file option in snoopy.cfg. This is useful when one wants to run in batch mode on a cluster. For performances reasons, the code doesn't check at each loop if the user has created a command file. Instead, it checks every INTERFACE_CHECK loops. A larger INTERFACE_CHECK results in a smaller overhead but a longer delay between the command file creation and the actual output.