Implements Weighted Sum of Gray Gases (WSGG) radiation properties model into a standalone, pure C89 compliant module with zero dependencies outside the standard math library.
Implementation is validated against Fig. 2 of Bordbar (2014). Please check validate/validate.py for more information.
Building this project for evaluation of radiative properties of gases can be done locally under the hypothesis that you have installed:
- Python >=3.12
- uv (for managing the environment)
- gcc (on Windows, use MinGW64)
Build the project by performing the following steps:
# Create virtual environment
uv venv --python 3.12 .venv
# Activate in Windows
. .venv/Scripts/activate
# Activate in Linux
source .venv/bin/activate
# Install the project
uv pip install .For running the samples and validation scripts you need the optional dependencies. Install everything with:
uv pip install .[full]A sample C program is provided for illustration purposes under sample/wsggapp.c. The C89 code compiles cleanly and warning-free with strict standard-conforming flags -Wall -Wextra -ansi -pedantic -O2 -fPIC. The following instructions are to be run under sample/ directory:
-
💻 Windows (PowerShell) compilation: run
.\makefile.ps1for compiling with the Mingw64 GCC compilergcc.exe. -
🐧 Linux compilation: run
makeand everything should work with a C89 compliant compiler.
This builds:
-
wsgglib.dllorlibwsgglib.so— Standalone shared library. -
wsggapp.exeorwsggapp— Direct C illustration program.
Running wsggapp.exe or wsggapp gives the following output:
========================================================
WSGGRadlibBordbar2020 C89 Model Call Illustration
========================================================
Inputs:
Optical Path length (L): 1.00 m
Gas Temperature (T): 1000.00 K
Total Pressure (P): 101325.0 Pa (1.000 atm)
H2O Mole Fraction (x_h2o): 0.180
CO2 Mole Fraction (x_co2): 0.080
Soot Vol Fraction (fv): 0.00e+00
Output Emissivity: 0.183685774525871
Intermediate Band-by-Band Coefficients:
Band | Absorption Coefficient [1/m] | Fractional Weight [-]
-----|----------------------------------|-----------------------
0 | 0.000000000000000e+00 | 2.700875528124971
1 | 1.742166701236471e-02 | 0.274939183163228
2 | 1.926201637035025e-01 | 0.288178187122667
3 | 1.578204068390441e+00 | 0.234163841751569
4 | 1.723962360219242e+01 | 0.090577827738800
========================================================
Before proceeeding, you might consider checking the following:
A minimal working example is provided under sample/ directory and can be test following the steps:
-
Generate the mesh by running
python geometry.pyfrom within the environment and move the generated CGNS file to this directory. -
Start Fluent in your favorite way and load the
fluent-setup.scmjournal file as running from this directory. This will setup a simple simulation and run until convergence. -
Check the
fluent-upgrade.scmfile for the steps to hook the UDF to Fluent. The main steps include (1) creating UDM before, (2) compiling and loading the UDF, and (3) hooking the UDF to Fluent by setting the hooks of model update and weighting factor functions, and editing the material to use the UDF for absorption coefficients instead of the built-in model.
All the source files are located in the src/ directory.
