valib
Vortex Analysis LIBrary
Loading...
Searching...
No Matches
valib

Vortex Analysis LIBrary (VALIB)

About

VALIB is a collection of functions intended for computing local vortex identification criteria out of the velocity gradient at a point in 3D. The project contains some established methods as well as some recently developed methods. Subroutines have a common interface based on the velocity gradient at a point in 3D, which is a 3x3 matrix stored in a column-major format. The 3x3 matrix of derivatives of the velocity components u, v, w by x, y, z,

[ du/dx du/dy du/dz ]
[ dv/dx dv/dy dv/dz ]
[ dw/dx dw/dy dw/dz ]

is stored as an array of length 9 as

[ du/dx dv/dx dw/dx du/dy dv/dy dw/dy du/dz dv/dz dw/dz ]

On the output from each function, there is the demanded quantity - one or more scalars, a vector of length 3, or one or more 3x3 matrices, depending on the nature of the quantity.

The intended use of the library is to evaluate a vortex identification quantity for each point in a 3-D flow field by calling a VALIB function at each of these points and storing the result. These values can then be used for postprocessing, e.g. by plotting isosurfaces of the scalar quantities. The functions can be called from ParaView through a plug-in, details of using this functionality are described below.

Some widely used methods in the collection include

  • lambda_2
  • Q-criterion
  • Delta-criterion
  • swirling strength criterion

Some recent methods include

  • residual vorticity, residual strain-rate and shear based on the Triple Decomposition Method (TDM)
  • average corotation and contrarotation of line segments
  • Q_D-criterion
  • Q_M-criterion
  • Q_W-criterion
  • Rortex/Liutex vector

The functions are implemented as C-header files and can be used as such from C/C++ codes. There is an auxiliary file src/valib.c which just includes all the headers and can be compiled into a library, libvalib.a or libvalib.so.

The testing program test/test_valib is written in C and shows basic usage of the library at a local point.

This design gives the flexibility of usage in a variety of languages, including seamless use by CUDA and HIP kernels. Fortran and Python interfaces are also provided.

Some computationally intensive functions (triple decomposition method and average corotation) exploit acceleration by GPUs. These functions have a batch interface.

Documentation

VALIB documentation generated by Doxygen is available at http://users.math.cas.cz/~sistek/software/valib/

Download

You can download a particular released version of VALIB from the list below

The latest version under development can be downloaded from the git repository of VALIB at https://bitbucket.org/jakub_sistek/valib

For example, you can simply clone the repository by

  git clone https://bitbucket.org/jakub_sistek/valib

Usage

C/C++

  1. Using header files. Include the correct header file into your code and call the corresponding function. The VALIB library need not be even compiled in this mode of use. In C++, the header should be included in the extern "C" { } clause, e.g.

    extern "C" { #include "lambda2.h" }

    This mode is similar to generic programming with templates in C++.

  2. Using a precompiled library. Use just the common header valib.h, i.e.

    #include "valib.h" This file does not contain implementations of the functions, it only provides their signatures. After compiling your code, link to the precompiled (static or shared) library libvalib.a or libvalib.so, i.e.

    -LPATH_TO_VALIB/lib -lvalib

    This mode can be seen as the standard usage of a precompiled library in C.

Python

A Python interface is available for user-level C functions of VALIB. It builds the bindings using Cython, which has to be available. You will first need to build VALIB with

   VA_WITH_PYTHON = 1

set in make.inc. A compiled extension pyvalib.cpython*** will be created in the directory python_module. To use it in your python code, simply import the extension with

   import pyvalib

ParaView

A Python plugin for the open-source postprocessing software ParaView is available in

  python_module/ValibParaviewPlugin.py

The plugin uses the Python interface to call the C functions of VALIB, therefore the Python extension needs to be compiled first. Note that the version of Python used by ParaView must match the version used in the compilation of the Python extension.

Once the plugin is imported to ParaView (for example, using Tools->Manage Plugins->Load New in the GUI), the filter VALIB is exposed. To apply it to your dataset, you will need to precompute the velocity gradient field and select it in the field Velocity Gradient Array as the plugin input. Be aware that in contrast to the C and Python interfaces, here a row-major ordering of the velocity gradient components is considered, in order to be consistent with the output of the Gradient filter in ParaView. Upon applying the VALIB filter, arrays with the results of the selected vortex identification criteria will be added to the dataset.

Fortran

VALIB comes with a simple Fortran interface of the user-level C functions. You will need to build the VALIB library and the Fortran module first (see below). For using it, follow these three steps:

  1. In your application, use this module

    use valib_mod

  2. When compiling your application, add the path

    -IPATH_TO_VALIB/include

    to tell the Fortran compiler where to look for the module.

  3. Link to the precompiled library (libvalib.a or libvalib.so), i.e.

    -LPATH_TO_VALIB/lib -lvalib

CUDA

Since version 2.0, the library comes with batch versions, which significantly accelerates evaluation of the more time consuming methods, such as the triple decomposition method with a high resolution.

Users may want to use also the base-level functions from their own CUDA kernels. This corresponds to the 1st mode of use described for C/C++:

  • include the functions as header files into the code of your kernel
  • define preprocessor variable "CUDA" in your code

    #define CUDA
    

    or on the command line by adding on the compile line

    -DCUDA
    

HIP

HIP functions share the batch interface with CUDA. For using the individual functions from user's own HIP kernels, this also corresponds to the 1st mode of use described for C/C++:

  • include the functions as header files into the code of your kernel
  • define preprocessor variable "HIP" in your code

    #define HIP
    

    or on the command line by adding on the compile line

    -DHIP
    

Building the library

Think twice if this is really needed. For C/C++/CUDA/HIP users, it may be simpler to use just the header files, i.e. the 1st way of use described at C/C++ section.

If you want to benefit from the GPU acceleration and the batch functions, you need to build the library. You will also need to build the library if you want to use it from Fortran, Python, and/or ParaView.

  1. Prepare a make.inc file with your setting of the C compiler and flags in the top section. Use the make.inc.example as the template. This file is automatically included into the Makefile, which should not be edited.
  2. Build the library by typing
    make
    
  1. Optional. Test the library by executing the tester executable
    test/test_valib
    
  1. Optional. Create the Doxygen documentation by

    make doxy
    

    You will need the Doxygen and BibTeX tools for this.

  2. Optional. Browse the documentation by opening the file

    doc/doxy/valib/html/index.html
    

    in your favourite browser.

  3. Optional. If you want to use VALIB from Fortran, precompile the module file with the interface by executing

    make fortran
    

    This generates the module include/valib_mod.mod with the VALIB interface to be used in Fortran applications.

Authors

The VALIB library has been developed by Jakub Šístek. Marek Pátý has developed the Python module and ParaView filter. Václav Kolář provided a lot of help, consulting, and support.

Funding

Development of VALIB was supported by the following projects:

  • Czech Science Foundation projects GACR 14-02067S, 18-09628S, and 23-06159S
  • It has been also supported by the Strategy AV21 Programme of the Czech Academy of Sciences.

The support is greatly acknowledged.

License

Copyright (c) 2010-2026, Jakub Šístek
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of contributors
   may be used to endorse or promote products derived from this software
   without specific prior written permission.

This software is provided by the copyright holders and contributors `as is'
and any express or implied warranties, including, but not limited to, the
implied warranties of merchantability and fitness for a particular purpose
are disclaimed. In no event shall the copyright holder or contributors be
liable for any direct, indirect, incidental, special, exemplary, or
consequential damages (including, but not limited to, procurement of
substitute goods or services; loss of use, data, or profits; or business
interruption) however caused and on any theory of liability, whether in
contract, strict liability, or tort (including negligence or otherwise)
arising in any way out of the use of this software, even if advised of the
possibility of such damage.

Assistance

For assistance, just email the author of VALIB Jakub Šístek at

sistek@math.cas.cz

Citing

  • V. Kolář and J. Šístek. Two complementary eigen-based geometric properties of a vortex. Physics of Fluids, 36(11):111703, 2024. paper
  • V. Kolář and J. Šístek. Orbitally compact and loose vortex regions. Physics of Fluids, 35(12):121708, 2023. paper
  • V. Kolář and J. Šístek. Corotational and compressibility aspects leading to a modification of the vortex-identification Q-criterion. AIAA Journal, 53(8):2406-2410, 2015. paper
  • V. Kolář and J. Šístek. Recent progress in explicit shear-eliminating vortex identification. In H. Chowdhury and F. Alam, editors, Proceedings of 19th Australasian Fluid Mechanics Conference, Melbourne, Australia, December 8-11, 2014. RMIT University, 2014. Article no. 274. paper
  • V. Kolář, J. Šístek, F. Cirak, and P. Moses. Average corotation of line segments near a point and vortex identification. AIAA Journal, 51(11):2678-2694, 2013. paper