/deepflame-dev

Primary LanguageCGNU General Public License v3.0GPL-3.0

DeepFlame v0.1.0

DeepFlame is a computational fluid dynamics suite for single or multiphase, laminar or turbulent reacting flows at all speeds with machine learning capabilities. It aims to provide an open-source platform bringing together the individual strengths of OpenFOAM, Cantera and pyTorch libraries for machine learning assisted reacting flow simulations. It is also has the scope to incorporate next-generation heterogenous supercomputing and AI acceleration infrustructures such as GPU and FPGAs.

Dependencies

OpenFOAM-7, Cantera C++ lib 2.6.0, Torch C++ lib 1.11.0

Features

  • Native Cantera reader for chemical mechanisms in .cti, .xml or .ymal formats
  • Full compatiblity with Cantera's UnityLewis, Mix and Multi transport models
  • Zero-dimensional constant pressure or constant volume reactor solver df0DFoam
  • Pressued-based low-Mach number reacting flow solver dfLowMachFoam
  • Density-based high-speed reacting flow solver dfHighSpeedFoam
  • Two-phase Lagrangian/Euler spray reacting flow solver dfSprayFoam
  • Cantera's native SUNDIALS CVODE solver for chemical reaction rate evaluation
  • Torch's tensor operation functionality for neutral network I/O and calculation
  • Interface for DNN model to obtain chemical reaction rates
  • Multiple example and tutorial cases with Allrun and Allclean scripts
    • 0D Perfectly Stirred Reactor
    • 1D Freely Propagating Premixed Flame
    • 2D Lifted Partially Premixed Triple Flame
    • 3D Taylor-Green Vortex with Flame
    • 1D Detotation Wave in Homogeneous Premixed Mixture
    • 3D Aachen Bomb Spray Flame

How to install

The installation of DeepFlame is simple and requires OpenFOAM-7, LibCantera and LibTorch .

  1. Install OpenFOAM-7 (if not already installed)
  2. Source your OpenFOAM via the default path below (or your own path for OpenFOAM bashrc)
source $HOME/OpenFOAM/OpenFOAM-7/etc/bashrc 
  1. Install LibCantera via conda
conda create -n libcantera

conda activate libcantera

conda install -c conda-forge boost fmt libcantera-devel

Note: Check your Miniconda3/envs/libcantera directory and make sure the install was successful (lib/ include/ etc. exist).

  1. Clone the DeepFlame repository
git clone https://github.com/deepmodeling/deepflame-dev.git

cd deepflame-dev
  1. Install precompiled LibTorch
wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.11.0%2Bcpu.zip

unzip libtorch-cxx11-abi-shared-with-deps-1.11.0+cpu.zip -d thirdParty
  1. Install DeepFlame
. install.sh

Note: Some compiling issues may happen due to system compatability. Instead of using conda installed Cantera C++ lib and the downloaded Torch C++ lib, try to compile your own Cantera and Torch C++ libraries.

Running DeepFlame examples

  1. Source your OpenFOAM, for example (depends on your OpenFOAM path):
source $HOME/OpenFOAM/OpenFOAM-7/etc/bashrc 
  1. Source deepflame-dev/bashrc, for example (depends on your DeepFlame path):
source $HOME/deepflame-dev/bashrc
  1. Go to an example case directory, for example:
cd $HOME/deepflame-dev/examples/zeroD_cubicReactor/H2/cvodeSolver

./Allrun

Note: For the example cases with torchSolver, an additional DNN model file in the .pt format is required. Please contact the developers if you would like a test run.

Citing DeepFlame

If you use DeepFlame for a publication, please use the citation:

DeepFlame: A computational fluid dynamics suite for multiphase turbulent reacting flows at all speeds with machine learning. URL:https://github.com/deepmodeling/deepflame-dev, 2022.