FUEL_AIR_SPEC
This function solves a complete-combustion mixing problem for an air stream and a fuel stream, returning the solved inlet and outlet flow quantities together with air-fuel ratios and product compositions. It can solve from any two extensive variables, or from one extensive variable and one intensive specification such as excess oxygen or outlet oxygen fraction.
A central intensive relation used by the solver is the excess-oxygen definition:
O_{2,excess} = \frac{n_{O_2,in}}{n_{O_2,required}} - 1
The output dictionary includes total outlet flow, wet and dry oxygen fractions, all three air-fuel ratio bases, and the component-wise outlet mole flows and mole fractions. This makes the wrapper suitable for burner sizing, flue-gas analysis, and fuel-comparison workflows.
Excel Usage
=FUEL_AIR_SPEC(zs_air, zs_fuel, CASs, atomss, n_fuel, n_air, n_out, Oxy_excess, frac_out_Oxy, frac_out_Oxy_dry, ratio, Vm_air, Vm_fuel, MW_air, MW_fuel, ratio_basis, reactivities, combustion_stoichiometries)
zs_air(str, required): Mole fractions of the air in JSON array format.zs_fuel(str, required): Mole fractions of the fuel in JSON array format.CASs(str, required): CAS numbers of all compounds in JSON array format.atomss(str, required): List of dictionaries of elements and their counts for all molecules in JSON array format.n_fuel(float, optional, default: null): Flow rate of fuel [mol/s].n_air(float, optional, default: null): Flow rate of air [mol/s].n_out(float, optional, default: null): Flow rate of combustion products, remaining oxygen, and inerts [mol/s].Oxy_excess(float, optional, default: null): The excess oxygen coming out.frac_out_Oxy(float, optional, default: null): The mole fraction of oxygen out.frac_out_Oxy_dry(float, optional, default: null): The mole fraction of oxygen out on a dry basis.ratio(float, optional, default: null): Air-fuel ratio, in the specified basis.Vm_air(float, optional, default: null): Molar volume of air [m^3/mol].Vm_fuel(float, optional, default: null): Molar volume of fuel [m^3/mol].MW_air(float, optional, default: null): Molecular weight of air [g/mol].MW_fuel(float, optional, default: null): Molecular weight of fuel [g/mol].ratio_basis(str, optional, default: “mass”): One of ‘mass’, ‘mole’, or ‘volume’.reactivities(str, optional, default: null): Optional JSON array of booleans marking combustible species to leave unreacted.combustion_stoichiometries(str, optional, default: null): Optional JSON array of precomputed combustion stoichiometry dictionaries.
Returns (str): JSON Dictionary of all calculated variables.
Example 1: Fuel air mixture specs with excess O2
Inputs:
| zs_air | zs_fuel | CASs | atomss | n_fuel | Oxy_excess | Vm_air | Vm_fuel | MW_air | MW_fuel | ratio_basis |
|---|---|---|---|---|---|---|---|---|---|---|
| [0.79, 0.205, 0, 0, 0, 0.0045, 0.0005] | [0.025, 0.025, 0.85, 0.07, 0.029, 0.0005, 0.0005] | [“7727-37-9”, “7782-44-7”, “74-82-8”, “74-84-0”, “74-98-6”, “7732-18-5”, “124-38-9”] | [{“N”: 2}, {“O”: 2}, {“H”: 4, “C”: 1}, {“H”: 6, “C”: 2}, {“H”: 8, “C”: 3}, {“H”: 2, “O”: 1}, {“C”: 1, “O”: 2}] | 5 | 0.3 | 0.02493 | 0.02488 | 28.793 | 18.551 | mass |
Excel formula:
=FUEL_AIR_SPEC("[0.79, 0.205, 0, 0, 0, 0.0045, 0.0005]", "[0.025, 0.025, 0.85, 0.07, 0.029, 0.0005, 0.0005]", "["7727-37-9", "7782-44-7", "74-82-8", "74-84-0", "74-98-6", "7732-18-5", "124-38-9"]", "[{"N": 2}, {"O": 2}, {"H": 4, "C": 1}, {"H": 6, "C": 2}, {"H": 8, "C": 3}, {"H": 2, "O": 1}, {"C": 1, "O": 2}]", 5, 0.3, 0.02493, 0.02488, 28.793, 18.551, "mass")
Expected output:
"{\"O2_excess\": 0.3000000000000005, \"frac_out_O2\": 0.04416828172034147, \"frac_out_O2_dry\": 0.051774902132806985, \"mass_ratio\": 20.381717900948086, \"mole_ratio\": 13.131707317073175, \"n_air\": 65.65853658536588, \"n_fuel\": 5, \"n_out\": 70.97853658536589, \"ns_out\": [51.99524390243905, 3.1350000000000042, 0.0, 0.0, 0.0, 10.427963414634148, 5.420329268292683], \"volume_ratio\": 13.15809740412517, \"zs_out\": [0.7325488296015285, 0.04416828172034147, 0.0, 0.0, 0.0, 0.14691713743763138, 0.07636575124049863]}"
Example 2: Fuel air specification from ratio on a mass basis
Inputs:
| zs_air | zs_fuel | CASs | atomss | n_fuel | ratio | Vm_air | Vm_fuel | MW_air | MW_fuel | ratio_basis |
|---|---|---|---|---|---|---|---|---|---|---|
| [0.79, 0.205, 0, 0, 0, 0.0045, 0.0005] | [0.025, 0.025, 0.85, 0.07, 0.029, 0.0005, 0.0005] | [“7727-37-9”, “7782-44-7”, “74-82-8”, “74-84-0”, “74-98-6”, “7732-18-5”, “124-38-9”] | [{“N”: 2}, {“O”: 2}, {“H”: 4, “C”: 1}, {“H”: 6, “C”: 2}, {“H”: 8, “C”: 3}, {“H”: 2, “O”: 1}, {“C”: 1, “O”: 2}] | 5 | 20.381717900948086 | 0.02493 | 0.02488 | 28.793 | 18.551 | mass |
Excel formula:
=FUEL_AIR_SPEC("[0.79, 0.205, 0, 0, 0, 0.0045, 0.0005]", "[0.025, 0.025, 0.85, 0.07, 0.029, 0.0005, 0.0005]", "["7727-37-9", "7782-44-7", "74-82-8", "74-84-0", "74-98-6", "7732-18-5", "124-38-9"]", "[{"N": 2}, {"O": 2}, {"H": 4, "C": 1}, {"H": 6, "C": 2}, {"H": 8, "C": 3}, {"H": 2, "O": 1}, {"C": 1, "O": 2}]", 5, 20.381717900948086, 0.02493, 0.02488, 28.793, 18.551, "mass")
Expected output:
"{\"O2_excess\": 0.3000000000000005, \"frac_out_O2\": 0.04416828172034147, \"frac_out_O2_dry\": 0.051774902132806985, \"mass_ratio\": 20.381717900948086, \"mole_ratio\": 13.131707317073175, \"n_air\": 65.65853658536588, \"n_fuel\": 5, \"n_out\": 70.97853658536589, \"ns_out\": [51.99524390243905, 3.1350000000000042, 0.0, 0.0, 0.0, 10.427963414634148, 5.420329268292683], \"volume_ratio\": 13.15809740412517, \"zs_out\": [0.7325488296015285, 0.04416828172034147, 0.0, 0.0, 0.0, 0.14691713743763138, 0.07636575124049863]}"
Example 3: Leave methane unreacted with reactivities override
Inputs:
| zs_air | zs_fuel | CASs | atomss | n_fuel | Oxy_excess | Vm_air | Vm_fuel | MW_air | MW_fuel | ratio_basis | reactivities |
|---|---|---|---|---|---|---|---|---|---|---|---|
| [0.79, 0.205, 0, 0, 0, 0.0045, 0.0005] | [0.025, 0.025, 0.85, 0.07, 0.029, 0.0005, 0.0005] | [“7727-37-9”, “7782-44-7”, “74-82-8”, “74-84-0”, “74-98-6”, “7732-18-5”, “124-38-9”] | [{“N”: 2}, {“O”: 2}, {“H”: 4, “C”: 1}, {“H”: 6, “C”: 2}, {“H”: 8, “C”: 3}, {“H”: 2, “O”: 1}, {“C”: 1, “O”: 2}] | 5 | 0.3 | 0.02493 | 0.02488 | 28.793 | 18.551 | mass | [true, true, false, true, true, true, true] |
Excel formula:
=FUEL_AIR_SPEC("[0.79, 0.205, 0, 0, 0, 0.0045, 0.0005]", "[0.025, 0.025, 0.85, 0.07, 0.029, 0.0005, 0.0005]", "["7727-37-9", "7782-44-7", "74-82-8", "74-84-0", "74-98-6", "7732-18-5", "124-38-9"]", "[{"N": 2}, {"O": 2}, {"H": 4, "C": 1}, {"H": 6, "C": 2}, {"H": 8, "C": 3}, {"H": 2, "O": 1}, {"C": 1, "O": 2}]", 5, 0.3, 0.02493, 0.02488, 28.793, 18.551, "mass", "[true, true, false, true, true, true, true]")
Expected output:
"{\"O2_excess\": 0.30000000000000004, \"frac_out_O2\": 0.03425841284351253, \"frac_out_O2_dry\": 0.03800997910520847, \"mass_ratio\": 3.6493269049988766, \"mole_ratio\": 2.3512195121951223, \"n_air\": 11.756097560975611, \"n_fuel\": 5, \"n_out\": 17.07609756097561, \"ns_out\": [9.412317073170733, 0.585, 4.25, 0.0, 0.0, 1.6854024390243905, 1.143378048780488], \"volume_ratio\": 2.355944631793585, \"zs_out\": [0.551198365994401, 0.03425841284351253, 0.24888590527338167, 0.0, 0.0, 0.09869950865565903, 0.06695780723304577]}"
Python Code
Show Code
import json
from chemicals.combustion import fuel_air_spec_solver
def fuel_air_spec(zs_air, zs_fuel, CASs, atomss, n_fuel=None, n_air=None, n_out=None, Oxy_excess=None, frac_out_Oxy=None, frac_out_Oxy_dry=None, ratio=None, Vm_air=None, Vm_fuel=None, MW_air=None, MW_fuel=None, ratio_basis='mass', reactivities=None, combustion_stoichiometries=None):
"""
Solves the system of equations describing a flow of air mixing with a flow of combustibles and burning completely.
See: https://chemicals.readthedocs.io/chemicals.combustion.html
This example function is provided as-is without any representation of accuracy.
Args:
zs_air (str): Mole fractions of the air in JSON array format.
zs_fuel (str): Mole fractions of the fuel in JSON array format.
CASs (str): CAS numbers of all compounds in JSON array format.
atomss (str): List of dictionaries of elements and their counts for all molecules in JSON array format.
n_fuel (float, optional): Flow rate of fuel [mol/s]. Default is None.
n_air (float, optional): Flow rate of air [mol/s]. Default is None.
n_out (float, optional): Flow rate of combustion products, remaining oxygen, and inerts [mol/s]. Default is None.
Oxy_excess (float, optional): The excess oxygen coming out. Default is None.
frac_out_Oxy (float, optional): The mole fraction of oxygen out. Default is None.
frac_out_Oxy_dry (float, optional): The mole fraction of oxygen out on a dry basis. Default is None.
ratio (float, optional): Air-fuel ratio, in the specified basis. Default is None.
Vm_air (float, optional): Molar volume of air [m^3/mol]. Default is None.
Vm_fuel (float, optional): Molar volume of fuel [m^3/mol]. Default is None.
MW_air (float, optional): Molecular weight of air [g/mol]. Default is None.
MW_fuel (float, optional): Molecular weight of fuel [g/mol]. Default is None.
ratio_basis (str, optional): One of 'mass', 'mole', or 'volume'. Valid options: Mass, Mole, Volume. Default is 'mass'.
reactivities (str, optional): Optional JSON array of booleans marking combustible species to leave unreacted. Default is None.
combustion_stoichiometries (str, optional): Optional JSON array of precomputed combustion stoichiometry dictionaries. Default is None.
Returns:
str: JSON Dictionary of all calculated variables.
"""
try:
_za = json.loads(zs_air) if isinstance(zs_air, str) else zs_air
_zf = json.loads(zs_fuel) if isinstance(zs_fuel, str) else zs_fuel
_c = json.loads(CASs) if isinstance(CASs, str) else CASs
_a = json.loads(atomss) if isinstance(atomss, str) else atomss
_r = json.loads(reactivities) if reactivities and isinstance(reactivities, str) else reactivities
_s = json.loads(combustion_stoichiometries) if combustion_stoichiometries and isinstance(combustion_stoichiometries, str) else combustion_stoichiometries
rb = ratio_basis if ratio_basis else "mass"
res = fuel_air_spec_solver(_za, _zf, _c, _a, n_fuel=n_fuel, n_air=n_air, n_out=n_out, O2_excess=Oxy_excess, frac_out_O2=frac_out_Oxy, frac_out_O2_dry=frac_out_Oxy_dry, ratio=ratio, Vm_air=Vm_air, Vm_fuel=Vm_fuel, MW_air=MW_air, MW_fuel=MW_fuel, ratio_basis=rb, reactivities=_r, combustion_stoichiometries=_s)
return json.dumps(res, sort_keys=True)
except Exception as e:
return f"Error: {str(e)}"