A 2D computational fluid dynamics (CFD) solver for simulating reactive flows with coupled fluid dynamics and chemical kinetics.
This project implements a numerical simulation of a counterflow premixed flame using:
- Incompressible Navier-Stokes solver with fractional step method
- Multi-species reactive chemistry with Arrhenius kinetics
- Operator splitting for advection-diffusion-reaction equations
- Runge-Kutta 4th order (RK4) time integration for species and temperature
- Successive Over-Relaxation (SOR) for pressure correction and enforcing incompressibility with Chorin projection method
- 2D incompressible flow solver with upwind advection / Lax-Wendroff scheme
- Multi-species chemistry manager (CH₄, O₂, CO₂, H₂O, N₂)
- Temperature-dependent reaction rates (Arrhenius law)
- Pressure correction using Successive Over-Relaxation (SOR)
- Automatic time step selection based on CFL and Fourier criteria
- Data export and visualization tools
- Animation generation for temporal evolution
- Use of Numba for performance optimization
nm_method/
├── main.py # Entry point and simulation setup
├── system.py # Main system controller
├── fluid.py # Fluid dynamics solver
├── chemistry.py # Chemistry manager and species handling
├── constant.py # Physical constants and parameters
├── plotting.py # Visualization functions
├── data/ # Simulation output data (*.npy files)
├── .gitignore # Git ignore rules
└── README.md # This file
└── LICENSE # License information
- Python 3.8+
- NumPy
- Matplotlib
- SciPy (optional, for advanced features)
- Numba (for performance optimization)
- Clone the repository:
git clone https://github.com/EwanBat/combustion_flow.git
cd combustion_flow- Install dependencies:
pip install numpy matplotlibRun the simulation:
python main.pyThe simulation will:
- Initialize the computational domain and fields
- Run the time-stepping loop with automatic progress display
- Save data snapshots at specified intervals to
data/folder - Generate visualization plots and animations
Edit parameters in constant.py to modify:
- Physical properties (density, viscosity, specific heat)
- Reaction kinetics parameters (activation energy, pre-exponential factor)
- Species properties (molecular mass, diffusivity)
Edit main.py to adjust:
- Domain size and grid resolution
- Inlet velocities and boundary conditions
- Total simulation time and data save frequency
Momentum (Navier-Stokes):
Species transport:
Energy (temperature):
Simple one-step methane combustion:
With Arrhenius rate:
The code generates:
- Velocity magnitude plots showing flow patterns
- Temperature fields with heated regions
- Species concentration plots for each chemical species
- Animations showing temporal evolution
Species concentration profiles showing the distribution of reactants and products in the computational domain.
Simulation data is saved as NumPy arrays (.npy) in the data/ folder:
simulation_data_t0000_u.npy- x-velocity at timestep 0simulation_data_t0000_v.npy- y-velocity at timestep 0simulation_data_t0000_T.npy- temperature at timestep 0simulation_data_t0000_Y_CH4.npy- CH₄ mass fraction at timestep 0- ... (and so on for each timestep and species)
This project is licensed under the MIT License - see the [LICENSE] file for details.
- Ewan Bataille
Developed as part of a numerical methods course project.