Math & Equations Reference

The exact formulas used by the calculation engine for reactions, H₂ production, and membrane transport. All internal computation is performed in SI units; user-facing inputs are converted before these equations are applied.

Engineering estimates only — not safety certification or code compliance. Results must be independently validated by a qualified engineer.

Formula Parsing & Molecular Weight

Every chemical formula is parsed into an element-count map; molecular weight sums atomic weights.

MW = Σ (n_element × atomic_weight_element)
n_element— count of each element in the formula (handles nested parentheses)
atomic_weight— IUPAC 2021 conventional values (e.g. H = 1.008, O = 15.999)

Equation Parsing

A full equation is split on the arrow into reactants and products, each with a stoichiometric coefficient.

aA + bB → cC + dH₂
a, b, c, d— stoichiometric coefficients parsed from the equation string
H₂ coefficient— coefficient of the H₂ product term (drives yield)

Stoichiometric H₂ Yield (limiting reactant)

For each reactant, compute the H₂ it could produce; the minimum is the limiting-reactant yield.

n_H₂(reactant i) = (n_i / coef_i) × coef_H₂ × η
n_H₂ = min_i [ n_H₂(reactant i) ]
n_i— available moles of reactant i
coef_i— stoichiometric coefficient of reactant i
coef_H₂— stoichiometric coefficient of H₂ in the equation
η— reaction efficiency / yield fraction (0–1, default 1)

Rate-Based & Hybrid Reactions

Rate-based reactions use a measured H₂ rate directly; hybrid reactions cap the stoichiometric total by the measured rate.

rate_based: ṅ_H₂ = ṅ_measured (constant over duration)
hybrid: ṅ_H₂ = min( n_H₂,stoich / t_duration , ṅ_measured )
user_defined: ṅ_H₂ = ṅ_measured (direct H₂ source)
ṅ_measured— user-entered H₂ generation rate, converted to mol/s
t_duration— reaction duration (s)

For stoichiometric reactions the rate is the constant average: ṅ_H₂ = n_H₂,stoich / t_duration, then zero after the duration elapses.

Half-Reaction Balancing (aqueous)

The standard algorithm balances O with H₂O, H with H⁺ (acidic) or OH⁻ (basic), and charge with e⁻.

  1. Balance non-H/O elements (assumed balanced in the entered skeleton).
  2. Balance O by adding H₂O to the deficient side.
  3. Balance H by adding H⁺ to the deficient side (acidic).
  4. Balance charge by adding e⁻ to the more positive side.
  5. For basic medium: add OH⁻ to both sides for each H⁺, then cancel excess H₂O.

Validation checks atom balance, charge balance, and electron balance (electrons cancel in a full equation; appear on one side in a half-reaction).