COMBUSTION_STOICH

This function constructs the ideal complete-combustion stoichiometry for a compound from its elemental composition. The returned dictionary contains product coefficients together with a negative oxygen coefficient, where a negative value indicates the amount of oxygen required per mole of fuel.

For a compound with elemental counts C_cH_hO_oN_nS_sBr_bI_iCl_xF_fP_p, the oxygen requirement is computed from:

k = c + s + \frac{h}{4} + \frac{5p}{4} - \frac{x + f}{4} - \frac{o}{2}

The result is intended for complete combustion calculations of typical fuels. Elements outside the standard combustion products can be returned in elemental form or lumped into ash, depending on the selected missing-atom handling rule.

Excel Usage

=COMBUSTION_STOICH(atoms, MW, missing_handling)
  • atoms (str, required): Dictionary of atoms and their counts.
  • MW (float, optional, default: null): Molecular weight of chemical, used only if missing_handling is ‘ash’ [g/mol].
  • missing_handling (str, optional, default: “elemental”): How to handle compounds which do not appear in the stoichiometric reaction.

Returns (str): Stoichiometric coefficients of combustion representation.

Example 1: Methane combustion

Inputs:

atoms
{“C”: 1, “H”: 4}

Excel formula:

=COMBUSTION_STOICH("{"C": 1, "H": 4}")

Expected output:

"{\"CO2\": 1, \"H2O\": 2.0, \"O2\": -2.0}"

Example 2: Ethanol combustion with oxygen in the fuel

Inputs:

atoms
{“C”: 2, “H”: 6, “O”: 1}

Excel formula:

=COMBUSTION_STOICH("{"C": 2, "H": 6, "O": 1}")

Expected output:

"{\"CO2\": 2, \"H2O\": 3.0, \"O2\": -3.0}"

Example 3: Sulfur-containing fuel stoichiometry

Inputs:

atoms
{“C”: 1, “H”: 4, “S”: 1}

Excel formula:

=COMBUSTION_STOICH("{"C": 1, "H": 4, "S": 1}")

Expected output:

"{\"CO2\": 1, \"H2O\": 2.0, \"O2\": -3.0, \"SO2\": 1}"

Example 4: Unknown atoms can be lumped into ash

Inputs:

atoms MW missing_handling
{“C”: 1, “H”: 4, “Na”: 1} 39 ash

Excel formula:

=COMBUSTION_STOICH("{"C": 1, "H": 4, "Na": 1}", 39, "ash")

Expected output:

"{\"Ash\": 22.95754, \"CO2\": 1, \"H2O\": 2.0, \"O2\": -2.0}"

Python Code

Show Code
import json
from chemicals.combustion import combustion_stoichiometry

def combustion_stoich(atoms, MW=None, missing_handling='elemental'):
    """
    Returns a dictionary of stoichiometric coefficients of chemical combustion from an atoms dictionary.

    See: https://chemicals.readthedocs.io/chemicals.combustion.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        atoms (str): Dictionary of atoms and their counts.
        MW (float, optional): Molecular weight of chemical, used only if missing_handling is 'ash' [g/mol]. Default is None.
        missing_handling (str, optional): How to handle compounds which do not appear in the stoichiometric reaction. Valid options: Elemental, Ash. Default is 'elemental'.

    Returns:
        str: Stoichiometric coefficients of combustion representation.
    """
    try:
        if isinstance(atoms, str):
            atoms = json.loads(atoms)
        res = combustion_stoichiometry(atoms, MW, missing_handling)
        return json.dumps(res, sort_keys=True)
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Dictionary of atoms and their counts.
Molecular weight of chemical, used only if missing_handling is 'ash' [g/mol].
How to handle compounds which do not appear in the stoichiometric reaction.