Replay the measured sulfur response in a cooling flue gas
View code · Download Python script · Download complete ZIP
Replay the fitted reactor at Zeuthen’s six feed compositions
Section titled “Replay the fitted reactor at Zeuthen’s six feed compositions”The study asks how particle counts respond when SO₂, oxygen or potassium chloride changes in a cooling synthetic flue gas. Use the example ZIP for the study-specific reactor equations, observed outlet values, reconstructed temperatures, and fitted parameters. The original calibration used CUDA. This CPU replay fixes the coefficients and integrates the same forward model on two radial paths for each feed.
Compare two fits of the model with all cluster pathways available. One fit used all 85 measurements. The other used 56, reserving the high-oxygen and high-KCl aerosol feeds among its 29 withheld readings. Each fit used one parameter set across all reactor conditions.
Python · section 1
import matplotlib.pyplot as pltfrom scripts.straw_combustion.replay import run_replay
if "saved_data" in globals(): report = globals()["saved_data"]else: rows, _ = run_replay(device="cpu", fits=("all_combined", "split_combined")) report = {} for fit in ("all_combined", "split_combined"): fitted = [row for row in rows if row["fit"] == fit] withheld = [r for r in fitted if not r["in_original_train"]] report[fit] = { "all_in_band": sum(abs(r["residual_bands"]) <= 1 for r in fitted), "reserved_in_band": sum( abs(r["residual_bands"]) <= 1 for r in withheld ), "counts": { r["case"]: [r["measured"], r["tolerance"], r["predicted"]] for r in fitted if r["dataset"] == "aerosol" and r["target"] == "count" }, }Warp 1.11.1 initialized:
CUDA Toolkit 12.9, Driver 13.4
Devices:
"cpu" : "CPU"
"cuda:0" : "NVIDIA GeForce RTX 5060" (8 GiB, sm_120, mempool enabled)
Kernel cache:
~/.cache/warp/1.11.1
Module scripts.straw_combustion.forward.ladders d310fa3 load on device 'cpu' took 1.15 ms (cached)
Module scripts.straw_combustion.forward.dry a0c9356 load on device 'cpu' took 0.27 ms (cached)
Compare outlet particle counts on a common scale
Section titled “Compare outlet particle counts on a common scale”Each marker is one reactor outlet measurement or calculation. The vertical whiskers show the reported experimental scatter. The first three feeds form the sulfur series. Comparing the two fitted markers for the high-oxygen and high-KCl feeds shows what changed when those measurements were included in calibration.
Python · section 2
conditions = ( "No SO2", "Reference", "High SO2", "Low O2", "High O2", "High KCl",)labels = ("No SO₂", "Reference", "High SO₂", "Low O₂", "High O₂", "High KCl")all_counts = report["all_combined"]["counts"]split_counts = report["split_combined"]["counts"]fig, ax = plt.subplots(figsize=(7.6, 3.5), layout="constrained")ax.errorbar( [i - 0.16 for i in range(len(conditions))], [all_counts[c][0] for c in conditions], yerr=[all_counts[c][1] for c in conditions], fmt="o", color="#243E43", capsize=3, label="Zeuthen ± scatter",)ax.scatter( range(len(conditions)), [all_counts[c][2] for c in conditions], marker="s", color="#135963", label="85-reading fit",)ax.scatter( [i + 0.16 for i in range(len(conditions))], [split_counts[c][2] for c in conditions], marker="x", color="#A44D21", label="56-reading fit",)ax.set_xticks(range(len(conditions)), labels)ax.set(ylabel="Outlet count (million particles per cm³)", ylim=(0, None))ax.legend(frameon=False)ax.spines[["right", "top"]].set_visible(False)plt.show()
Check agreement beyond the six counts
Section titled “Check agreement beyond the six counts”Count a reading inside its study working band when the absolute residual divided by its assigned tolerance is at most one. The full calibration matches both high-feed counts. The held-out comparison also tests dry-gas concentrations, particle sizes and masses across different conditions.
Python · section 3
print( f"All-data calibration: {report['all_combined']['all_in_band']}/85 in band")print( f"56-reading calibration: {report['split_combined']['reserved_in_band']}/29 withheld in band")All-data calibration: 49/85 in band
56-reading calibration: 13/29 withheld in band
Related studies
Section titled “Related studies”Explore this topic: Emissions and exposure · Nucleation and particle sources · Gas and environment