Saras
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 https://github.com/roshansamuel/saras.git

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

bash compileSaras.sh

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

Before compilation, a few dependencies have to installed first.

Blitz++

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

CMake

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

MPICH

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

YAML

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.

HDF5

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 testSaras.sh, 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.

bash testSaras.sh

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 validate_ldc.py, 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.

License

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

References

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

General articles

  1. https://stackoverflow.com/questions/4816698/avoiding-circular-dependencies-of-header-files
  2. https://stackoverflow.com/questions/8111677/what-is-argument-dependent-lookup-aka-adl-or-koenig-lookup
  3. https://www.codesynthesis.com/~boris/blog/2012/04/04/when-provide-empty-destructor/

Articles on multi-grid methods

  1. http://math.mit.edu/classes/18.086/2006/am63.pdf
  2. http://www.mgnet.org/mgnet-tuts.html

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.