Skip to content
arintanenPublic
forked from kahilah/ct2foam

About

This repository includes all necessary scripts and compilation instructions required to run user-given chemical mechanisms with DLBFoam.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

ct2foam

License: GPL v3

Convert Cantera based thermophysical data to OpenFoam format

ct2foam enables user to generate OpenFOAM dictionary entries for NASA-polynomials, Sutherland and other transport models required by compressible multi-species solvers. Conversion and re-fitting procedures ensure NASA-polynomials will share the same common temperature between low and high temperature range coefficients, which is required in OpenFOAM.

This python package utilises Cantera to generate such entries for all species in a given chemical mechanism or for a gaseous mixture defined by the user. With the general functions provided in this package, it is also possible to create fits for thermophysical data based on experiments.

Installation

See up-to-date Cantera installation documentation.

Install ct2foam with uv:

git clone git@github.com:kahilah/ct2foam.git
cd ct2foam
uv sync

Activate the uv-managed virtual environment:

source .venv/bin/activate
ct2foam --help

Install ct2foam with pip:

cd ct2foam
pip install .

Run tests:

python -m unittest discover

Note that openfoam_reference/Test-thermoMixture.C can be used for advanced testing and debugging how data, units and fit evaluations are handled on OpenFOAM side.

Running ct2foam:

Convert all species in chemical mechanism

ct2foam --input h2o2.yaml --output test_output --Tmid 1000.0 --plot

outputs OpenFoam compatible thermodynamical and transport dictionary entries under output directory such that NASA-polynomials have a middle temperature of 1000 K. Thermodynamical fits are plotted under test_output/Figures directory.

Convert a mixture

ct2foam --input h2o2.yaml --mixture "O2:1, N2:3.67" --mixture-name test_output --output test

See ct2foam -h for help.

Acknowledgements

About

This repository includes all necessary scripts and compilation instructions required to run user-given chemical mechanisms with DLBFoam.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages