";
return;
}// Constants
const R = 8314; // J/kmol·K
const T = tempC + 273.15; // Kelvin
const massFlow_s = massFlow / 3600; // kg/s// Volumetric flow rate: Q = (mass × R × T) / (MW × P)
// Assume atmospheric pressure = 101325 Pa
const Q = (massFlow_s * R * T) / (molWeight * 101325); // m³/s// Stack diameter from Q = A × V → A = Q / V
const A = Q / exitVelocity; // m²
const diameter = 2 * Math.sqrt(A / Math.PI); // m// Simple empirical height estimate (based on API 521 or dispersion needs)
const stackHeight = 5 * Math.cbrt(massFlow_s); // mresultDiv.innerHTML = `
Estimated Flare Stack Diameter:
${diameter.toFixed(2)} m
Recommended Stack Height:
${stackHeight.toFixed(1)} m
(based on preliminary safety estimation)
`;
}