Lesson
06: Mastering Environmental Units — Air (ppmv \(\leftrightarrow\) \(\mu\text{g/m}^3\)), Water (pH,
meq/L), Flows & LCA Scaling
The
“Boring Stuff” Problem: \(22.414\text{
L/mol}\) vs. \(24.465\text{
L/mol}\) and Natural Log pH Traps
Unit mismatches sink more environmental permits than bad calculus:
- Using STP molar volume (\(22.414\text{ L/mol}\) at \(0^\circ\text{C}\)) for EPA ambient air (\(25^\circ\text{C}, 1\text{ atm}\), where \(V_m = 24.465\text{ L/mol}\)) injects an immediate 9.1% bias!
- Writing
math.log(1e-7)instead ofmath.log10(1e-7)turns neutral water (\(\text{pH } 7.0\)) into \(\text{pH } 16.12\)! - Using US Million Gallons per Day (
MGD) alongside metric kg/day requires explicit factor1 MGD = 3,785.41 m^3/day.
Let’s unify all four environmental unit families cleanly in Python!
from pathlib import Path
def data_file(name):
"""Locate a dataset file whether running from SRC_DIR, module folder, HOMEWORK, or EXAMS."""
for p in [
Path("datasets") / name,
Path("../datasets") / name,
Path("../../datasets") / name,
]:
if p.exists():
return p
raise FileNotFoundError(f"Missing dataset {name} in datasets/")
import math
# Example 1: Trace Gas ppmv <-> ug/m^3 Across Pressure & Temperature Regimes (ME 200 Ideal Gas)
R_atm = 0.082057 # L * atm / (mol * K)
def gas_vm_L_mol(T_C, P_atm=1.0):
return R_atm * (T_C + 273.15) / P_atm
print(f"Molar Vol @ STP (0 C, 1 atm) : {gas_vm_L_mol(0.0, 1.0):.3f} L/mol")
print(f"Molar Vol @ EPA Ambient (25 C) : {gas_vm_L_mol(25.0, 1.0):.3f} L/mol")
print(f"Molar Vol @ Denver Summer (32C,.83): {gas_vm_L_mol(32.0, 0.83):.3f} L/mol")
# Compare SO2 (MW = 64.06 g/mol) at 0.075 ppmv (75 ppbv EPA 1-hr standard)
so2_ppb = 75.0
mw_so2 = 64.06
for city, tc, patm in [("Sea-Level EPA", 25.0, 1.0), ("Denver Altitude", 32.0, 0.83)]:
c_ug_m3 = so2_ppb * mw_so2 / gas_vm_L_mol(tc, patm)
print(f" 75 ppb SO2 in {city:<16s} -> {c_ug_m3:6.2f} ug/m^3")Molar Vol @ STP (0 C, 1 atm) : 22.414 L/mol
Molar Vol @ EPA Ambient (25 C) : 24.465 L/mol
Molar Vol @ Denver Summer (32C,.83): 30.168 L/mol
75 ppb SO2 in Sea-Level EPA -> 196.38 ug/m^3
75 ppb SO2 in Denver Altitude -> 159.26 ug/m^3
# Example 2: Aqueous pH Log-Trap Check + MGD Flow + LCA Functional Unit Reference Flow
H_mol_L = 1.0e-7
wrong_ph = -math.log(H_mol_L)
right_ph = -math.log10(H_mol_L)
print(f"DEADLY BUG (-math.log(1e-7)) : pH = {wrong_ph:.2f}")
print(f"CORRECT (-math.log10(1e-7)) : pH = {right_ph:.2f}")
# US Water Utility Flow (MGD) -> Metric Loading -> Hardness in CaCO3 equivalents
flow_MGD = 12.5
flow_m3_d = flow_MGD * 3785.411784
ca_mgL = 64.0 # Ca2+ (MW=40.08, z=2 -> EW=20.04)
mg_mgL = 18.0 # Mg2+ (MW=24.31, z=2 -> EW=12.155)
hardness_caco3 = 50.0 * (ca_mgL / 20.04 + mg_mgL / 12.155) # mg/L as CaCO3 (EW_CaCO3=50)
print(f"\nWater Plant Flow : {flow_MGD} MGD = {flow_m3_d:,.0f} m^3/day ({flow_m3_d/86400:.3f} m^3/s)")
print(f"Total Hardness : {hardness_caco3:.1f} mg/L as CaCO3 (Very Hard > 180!)")
# LCA Track 1 Soybean Oil vs Meal Allocation Unit Conversion (from LCA1_Soybean_Coproduction_Allocation.csv)
soy_rows = data_file("LCA1_Soybean_Coproduction_Allocation.csv").read_text(encoding="utf-8").splitlines()[1:]
oil_mass, oil_lhv, oil_price = [float(x) for x in soy_rows[0].split(",")[2:5]]
meal_mass, meal_lhv, meal_price = [float(x) for x in soy_rows[1].split(",")[2:5]]
a_mass = oil_mass / (oil_mass + meal_mass)
a_energy = (oil_mass * oil_lhv) / (oil_mass * oil_lhv + meal_mass * meal_lhv)
a_econ = (oil_mass * oil_price) / (oil_mass * oil_price + meal_mass * meal_price)
print(f"\nLCA Allocation to Soy Oil -> Mass: {a_mass:.1%} | Energy: {a_energy:.1%} | Economic: {a_econ:.1%}")DEADLY BUG (-math.log(1e-7)) : pH = 16.12
CORRECT (-math.log10(1e-7)) : pH = 7.00
Water Plant Flow : 12.5 MGD = 47,318 m^3/day (0.548 m^3/s)
Total Hardness : 233.7 mg/L as CaCO3 (Very Hard > 180!)
LCA Allocation to Soy Oil -> Mass: 19.4% | Energy: 35.0% | Economic: 38.6%
Concept Check Questions
- Why is soybean oil’s economic allocation share much higher than its
mass allocation share (
190 kgoil vs790 kgmeal)? - Why does \(75\text{ ppb}_v\) of \(\text{SO}_2\) weigh fewer \(\mu\text{g/m}^3\) in high-altitude Denver (\(0.83\text{ atm}\)) than at sea level (\(1.0\text{ atm}\))?
- Write the exact conversion from
mg/L\(\text{NO}_3^-\) tomg/Las \(\text{N}\) (\(\text{MW}_{\text{NO}_3} = 62.00\), \(\text{MW}_{\text{N}} = 14.01\)).
Guided
Practice Problem 1: Henry’s Law & Gas-Water Stripping Unit Check
(HMT + Water)
Using
HMT_Diffusivity_Henry_Solubility.csv (from
Heat & Mass Transfer Module 7), read
Species_A, T_ref_K, D_AB_m2_s,
and Molar_Mass_A_kg_kmol cleanly for all gas pairs, and
convert \(\text{CO}_2\) (\(420\text{ ppm}_v\), \(\text{MW} = 44.01\text{ g/mol}\)) at \(20^\circ\text{C}, 1\text{ atm}\) to \(\text{mg/m}^3\).
# Guided Practice 1 Starter
hmt_rows = data_file("HMT_Diffusivity_Henry_Solubility.csv").read_text(encoding="utf-8").splitlines()[1:]
for row in hmt_rows[:4]:
cols = row.split(",")
print(f"{cols[0]} | {cols[1]:<22s} | T={cols[4]} K | D_AB={float(cols[5]):.2e} m^2/s | MW={cols[6]}")GAS_01 | H2O (Water Vapor) | T=298.0 K | D_AB=2.60e-05 m^2/s | MW=18.015
GAS_02 | O2 (Oxygen) | T=298.0 K | D_AB=2.06e-05 m^2/s | MW=32.0
GAS_03 | CO2 (Carbon Dioxide) | T=298.0 K | D_AB=1.60e-05 m^2/s | MW=44.01
GAS_04 | H2 (Hydrogen) | T=298.0 K | D_AB=7.20e-05 m^2/s | MW=2.016