Fluid Dynamics Building Blocks
|
FDBB (Fluid Dynamics Building Blocks) is a C++ expression template library for fluid dynamics.
FDBB is a fluid dynamics expression template library written in C++14 (C++11 by compiler flag) that provides the algorithmic building blocks for developing computational fluid dynamics (CFD) tools. It is designed as a header-only C++ library that can be easily integrated into existing CFD codes by including the main header file fdbb.h
.
FDBB is implemented as expression template library that builds on existing vector expression template libraries (ETL). The main features of the FDBB library are:
FDBB currently supports the following ETLs and compilers (tested under Linux/macOS)
ETL | Remark | Clang | GCC 4.9 | GCC 5.x | GCC 6.x | PGI 16.10 | OracleStudio 12.5 |
---|---|---|---|---|---|---|---|
Armadillo | not fully supported yet | ||||||
Arrayfire | version 3.3.x and better | yes | yes | yes | yes | ||
Blaze | version 3.3 and better | yes | yes | yes | yes | ||
CMTL4 | not fully supported yet | ||||||
Eigen | version 3.2.x and better with patching | yes | yes | yes | yes | ||
IT++ | version 4.3.1 with patching | yes | yes | yes | yes | ||
MTL4 | not fully supported yet | ||||||
uBLAS | not fully supported yet | ||||||
VexCL | developer version | yes | yes | yes | yes | ||
ViennaCL | developer version (1.8.x) | yes | yes | yes | yes |
The FDBB library makes extensively use of C++11 features (auto
keyword, variadic templates, etc.) so that a C++ compiler with full C++11 support is a prerequisite. Some ETLs, like Blaze, even require C++14 support. Beside that, additional prerequisites depend on the specific ETL used.
The coding style of the FDBB library is based on Google's C++ style guide. The ClangFormat tool is used regularly to ensure a consistent code format.
The library is licensed under the Mozilla Public License Version 2.0.
The MPL is a simple copyleft license. The MPL's "file-level" copyleft is designed to encourage contributors to share their modifications with the library, while still allowing them to combine the library with code under other licenses (open or proprietary) with minimal restrictions.
The FDBB library comes with unit tests for all supported ETLs. The compilation requires configuration using CMake at a new, empty folder (in-source builds are disabled).
build
folder, execute CMake and start the compilation process inside that folder. If your source folder is FDBB
then the sequence of commandscompiles the unit tests for the enabled ETLs and features. To see a complete list of supported ETLs and features run
and set/unset the configuration in the CMake GUI.
After successful compilation executable unit tests are created at the ./unittests/<ETL>/
subdirectory of the build folder.
All compiled unit tests can be run by executing
If Doxygen is available on your system, you can compile and open the Doxygen HTML pages by executing
To compile the unit tests for the VexCL library under Linux/MacOSX you need to call CMake as follows:
It is also possible to specify a selection of unit tests that should be run by specifying a list/file patterns of tests to be included and a list/file pattern of tests to be excluded.
To perform all unit tests for element-wise operations except for the power function you need to call CMake as follows:
The FDBB library is included in your program by including the header file
By default, FDBB assumes C++14 support enabled and all accelerators and parallelization techniques disabled. This behavior can be changed by enabled one or more of the following flags when compiling your program:
-DFDBB_WITH_CXX11
-DFDBB_WITH_CUDA
-DFDBB_WITH_MIC
-DFDBB_WITH_OCL
-DFDBB_WITH_OMP
The FDBB library provides the following core components:
Core components are realized as struct
's with static
member functions that realize the evaluation of variables, fluxes, and flux-Jacobians.
The FDBB library support the following equations of state (EOS) implemented in the file fdbbEOS.hpp
:
Further EOS are planned in an upcoming release making use of the CoolProp project.
The strucutre fdbb::EOSidealGas
implements the EOS for an ideal gas with specific heat at constant volume \(c_v=\frac{7}{2}R\) and specific heat at constant pressure \(c_p=\frac{5}{2}R\) with \(R=8.3144598(48)\, \frac{J}{mol\cdot K}\) being the ideal gas constant. The absolute pressure can then be computed by passing density \(\rho\) and internal energy per unit mass \(e\)
To create a user-defined EOS, you have to implement a new struct
derived from the base class fdbb::EOS_pVT
, which represents an EOS of the form \(f(p,V,T)=0\) with absolute pressure \(p\), volume \(V\), and absolute temperature \(T\)
The base class is used internally to detect the interface of the eos::p
function that is used during the computation of fluxes and flux-Jacobians.
The FDBB library supports the following variables in one, two and three spatial dimensions:
The struct
fdbb::Variables
provides static
member functions to evaluate both primary and secondary variables. The table below gives an overview of available member functions
Variable name | Symbol | Function name | SI base unit | SI derived units |
---|---|---|---|---|
(volumetric mass) density | \(\rho\) | rho | \(\rm kg \cdot m^{-3}\) | |
velocity | \(\mathbf{v}\) | v<idim> | \(\rm m \cdot s^{-1}\) | |
velocity magnitude | \(\|\mathbf{v}\|\) | v_mag | \(\rm m \cdot s^{-1}\) | |
velocity magnitude squared | \(\|\mathbf{v}\|^2\) | v_mag2 | \(\rm m \cdot s^{-1}\) | |
momentum | \(\rho \mathbf{v}\) | rhov<idim> | \(\rm kg \cdot m \cdot s^{-1}\) | |
momentum magnitude | \(\|\rho \mathbf{v}\|\) | rhov_mag | \(\rm kg \cdot m \cdot s^{-1}\) | |
momentum magnitude squared | \(\|\rho \mathbf{v}\|^2\) | rhov_mag2 | \(\rm kg \cdot m \cdot s^{-1}\) | |
total energy per unit volume | \(\rho E\) | rhoE | \(\rm m^{2} \cdot kg \cdot s^{-2}\) | \(\rm J\) |
total energy per unit mass | \(E\) | E | \(\rm m^{2} \cdot s^{-2}\) | \(\rm J \cdot kg^{-1}\) |
internal energy per unit volume | \(\rho e\) | rhoe | \(\rm m^{2} \cdot kg \cdot s^{-2}\) | \(\rm J\) |
internal energy per unit mass | \(e\) | e | \(\rm m^{2} \cdot s^{-2}\) | \(\rm J \cdot kg^{-1}\) |
kinetic energy per unit volume | \(\rho E_{\rm kin}\) | rhoE_kin | \(\rm m^{2} \cdot kg \cdot s^{-2}\) | \(\rm J\) |
kinetic energy per unit mass | \(E_{\rm kin}\) | E_kin | \(\rm m^{2} \cdot s^{-2}\) | \(\rm J \cdot kg^{-1}\) |
total enthalpy per unit volume | \(\rho H\) | rhoH | \(\rm m^{2} \cdot kg \cdot s^{-2}\) | \(\rm J\) |
total enthalpy per unit mass | \(H\) | H | \(\rm m^{2} \cdot s^{-2}\) | \(\rm J \cdot kg^{-1}\) |
internal enthalpy per unit volume | \(\rho h\) | rhoh | \(\rm m^{2} \cdot kg \cdot s^{-2}\) | \(\rm J\) |
internal enthalpy per unit mass | \(h\) | h | \(\rm m^{2} \cdot s^{-2}\) | \(\rm J \cdot kg^{-1}\) |
tba
tba
This project has received funding from the European's Horizon 2020 research and innovation programme under grant agreement No 678727, project MOTOR (Multi-ObjecTive design Optimization of fluid eneRgy machines).
Author: Matthias Möller