valib
Vortex Analysis LIBrary
valib Documentation

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. Functions 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 a 3x3 matrix, 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 be then used for postprocessing, e.g. by plotting isosurfaces of the scalar quantities.

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 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/va.c which just includes all the headeres and can be compiled to a library, libva.a.

The testing program test/test_libva 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 OpenCL kernels.

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 library libvalib.a, i.e.

    -LPATH_TO_VALIB/lib -lvalib
    

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

Fortran

VALIB comes with a simple 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, i.e.

    -LPATH_TO_VALIB/lib -lvalib

CUDA

You may want to use these functions from CUDA kernels. This can be important for accelerating evaluation of the more time consuming methods, such as the triple decomposition method with a high resolution.

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
    

OpenCL

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 "OPENCL" in your code

    #define OPENCL
    

    or on the command line by adding on the compile line

    -DOPENCL
    

Building the library

This is really needed only for Fortran users. For C/C++/CUDA/OpenCL users, it is simpler to use just the header files, i.e. the 1st way of use described at C/C++ section.

  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. Open the include/common_defs.h file and check if you need to change some settings here. In particular, the type of real numbers can be changed from "double" to "float" on the line by un/commenting the correct line.

    #define VA_REAL double
    

    or

    #define VA_REAL float
    

    The double precision version is the default.

  3. Build the library by typing
    make
    
  4. Optional. Test the library by executing the tester executable
    test/test_valib
    
  5. Optional. Create the Doxygen documentation by

    make doxy
    

    You will need the Doxygen and BibTeX tools for this.

  6. Optional. Browse the documentation by opening the file

    doc/doxy/valib/html/index.html
    

    in your favourite browser.

  7. Optional. If you want to use VALIB from Fortran, precompile the module file with the interface. Open file include/valib_mod.F90 and check if you need to change the type of real numbers from "c_double" to "c_float" on the line by un/commenting the line

    #define VA_REAL_F c_double
    

    or

    #define VA_REAL_F c_float
    

    The double precision version is the default. Make sure your type here matches the type used for VALIB (see step 2). Use c_double for double, and c_float for float.

    Then run

    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 (Institute of Mathematics of the Czech Academy of Sciences, Prague), with a lot of help, consulting, and support provided by Václav Kolář (Institute of Hydrodynamics of the Czech Academy of Sciences, Prague).

Funding

Development of VALIB was supported by the following projects:

  • Czech Science Foundation project GACR 14-02067S
  • Grant Agency of the Academy of Sciences of the Czech Republic project GA AV IAA200600801

This support is greatly appreciated.

License

Copyright (c) 2010-2020, 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. 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