Finite Difference Solver for Fluid Dynamics Simulations
 All Classes Files Functions Variables Pages
Saras Documentation

Saras is an OpenMP-MPI hybrid parallelized Navier-Stokes equation solver written in C++. It uses the finite-difference method for calculating spatial derivatives and parallelized geometric multigrid method for solving the pressure Poisson equation.

All the source and library files for the Saras solver are contained in the following directories:

Installing SARAS

To install SARAS, you need to first clone the git repository into your local machine

git clone

On LINUX systems which use the Bash shell, SARAS can be compiled by simply running the shell script in the compile/ folder, as below


The first few lines of the script can be used to set certain compilation parameters and flags:

Before compilation, a few dependencies have to installed first.


To install the Blitz++ library, please download the library from here, and extract the archive. Follow the installation instructions in the archive.


On LINUX systems which use Debian package manager, please use the package manager itself to install CMake. For example, on Ubuntu systems, CMake can be installed by running

sudo apt-get install cmake


Similar to CMake installation above, it is best to install MPICH using the native package manager.


On Debian based systems, the YAML library can be installed by running

sudo apt-get install libyaml-cpp-dev

Otherwise, the yaml-cpp library can be downloaded from here. Please extract the archive and follow the installation instructions.


The HDF5 library has to be installed with parallel writing enabled for the file writing functions of SARAS to work. The library can either be downloaded and manually installed from here, or the native package manager of the OS can be used to locate and install the library.

More instructions on installing the libraries listed above can be found here. If any of the above libraries is being installed to the home directory, please make sure to update the relevant paths in the shell configuration file (~/.bashrc)

Running SARAS

SARAS can be executed by issuing the mpirun command at the root folder of the solver (assuming that MPICH is installed as mentioned above).

mpirun -np <number_of_processors> ./saras

It is essential to set the parameters appropriately with the parameters.yaml file in the input/ folder of the solver. The number of processors specified to the mpirun command should be equal to the product of X Number of Procs and Y Number of Procs options within the Parallel sub-section of parameters.yaml. Please check the parameters.yaml file for the full list of options specifiable to the solver, and their explanations (in comments).

For more information please refer to the SARAS documentation.

Testing SARAS

SARAS offers an automated testing process to validate the solver after installation. The relevant test scripts can be found in the tests/ folder of the solver. Executing the Bash shell script, will compile SARAS, and run it with a pre-defined set of parameters. We use the benchmark results on 2D lid-driven cavity (LDC) performed by Ghia et al (1982) to validate SARAS. The test can be executed by running the following command within the tests/ folder.


The test uses 4 cores and takes about 12 minutes to complete on an Intel workstation. At the end of the test, the Python script, found in tests/ldcTest/ reads the output from SARAS, and plots the velocity profiles along with the data from Ghia et al's result.

The following Python modules are necessary for the Python test script to execute successfully

At the end of the test, a plot of the x and y velocity profiles is shown to the user and drawn into a ldc_validation.png file.


SARAS is an open-source package made available under the New BSD License.


Various articles and pages used to make programming decisions during development of the solver are listed here:

General articles


Articles on multi-grid methods


Journal references

  1. Ghia, U., Ghia, K. N., & Shin, C. T. (1982). High-Re solutions for incompressible flow using the Navier-Stokes equations and a multigrid method. J. Comput. Phys., 48(3), 387-411.