Mixing of Air and H2 streams by Cantera MATLAB interface

136 views
Skip to first unread message

Fabrizio Borgna

unread,
Nov 10, 2023, 1:22:20 PM11/10/23
to Cantera Users' Group
Hello everyone,

I've just started using Cantera Matlab Interface and I was hoping that someone could help me with that. I have to write a Matlab script that evaluate the thermodynamic characteristics of an Air-H2 mixture. In particular, the two streams of Air and H2 have different initial temperature, pressure and molar flow rate.

I've already write a Pyton version of this script, that i reported below

% In this example, air and H2 are mixed in stoichiometric proportions. This
% is a simpler, steady-state version of the example ``reactors/mix1.py``.

% Since the goal is to simulate a continuous flow system, the mixing takes place
% at constant enthalpy and pressure.

import cantera as ct

gas = ct.Solution('z24_nox.yaml')

# Stream A (air)
A = ct.Quantity(gas, constant='HP')
A.TPY = 440.3, 13375000, 'O2:0.2329 N2:0.7671'

# Stream B (perburner exhaust gas)
F = ct.Quantity(gas, constant='HP')
F.TPY = 891.2, 13375000, 'H2:1.00'

# Set the molar flow rates corresponding to stoichiometric reaction,
F.moles = 3566.8
A.moles = 1663.7

# Compute the mixed state
M = A + F
print(M.report())


In MATLAB I'm able to address some characteristics to the two streams as below:

% STREAM A (AIR)
air=Solution('z24_nox.yaml');
disp('fixed H and P:');
set(air,'T',440.3,'P',13375000,'Y','O2:0.2329 N2:0.7671');
% STREAM F (FUEL)
fuel=Solution('z24_nox.yaml');
disp('fixed H and P:');
set(fuel,'T',891.2,'P',13375000,'Y','H2:1.00');

However, I was wondering How could I assign the molar flow rate values to the two stream and how could I compute the mixed state in Matlab

thank you all,
best regards

Ray Speth

unread,
Nov 12, 2023, 11:30:19 AM11/12/23
to Cantera Users' Group

Hi,

There is no equivalent of the Python Quantity class in the Cantera Matlab interface. I would strongly suggest sticking to the Python interface, as it provides a much more complete and well-tested interface. There is some work on an updated Matlab toolbox, but it’s not ready yet.

Regards,
Ray

Reply all
Reply to author
Forward
0 new messages