nx_soda_carbonation.nx
buildroot/runtime/nx_soda_carbonation.nx
about
nx_soda_carbonation.nx -- CRAFT-SODA rung C0: the CARBONATION physics model.
The operator's curiosity point (1): "generate carbonation WITHOUT heavy
equipment (research as of 2025/26)." The answer is NANOBUBBLE CO2 -- a
compact venturi hydrodynamic-cavitation loop dissolves CO2 at LOW pressure
(2-5 bar) ~5x faster than a sparger, no industrial saturator/chiller.
This organ is the quantitative substrate under that claim. It is Henry's
law done integer-exact (no float): dissolved CO2 is proportional to the
CO2 partial pressure over the liquid, with a solubility coefficient k_H
that RISES as the water gets colder (why soda is carbonated cold). From
dissolved CO2 it derives the beverage "volumes" unit, the carbonic-acid
acidity ([H+], pH) that makes soda taste tart, and the nanobubble KINETIC
advantage (time-to-target).
MEASURED EXCEEDS (gate-checked, see nx_soda_carbonation_test):
- COLD HOLDS MORE FIZZ: at one pressure, 4C water dissolves strictly
more CO2 than 25C water -- the grounded fact a fixed table misses.
- NO HEAVY EQUIPMENT: soda-strength 4 volumes at 4C needs only ~2.7 bar,
inside the 2-5 bar nanobubble envelope (not an industrial saturator).
- NANOBUBBLE 5x FASTER: time-to-target is 5x shorter than sparging.
- CARBONATION IS ACID: more dissolved CO2 -> more [H+] -> lower pH, into
the measured 3.5-4.0 soda range (carbonation is itself a sour lever).
Grounding (knowledge/fetched + WebSearch 2026-07-10): CO2 solubility in
water vs temperature (~3.35 g/L/atm at 0C down to ~1.26 at 30C); the
beverage volume unit (1 vol = 1.96 g/L); carbonic acid Ka1_eff ~4.45e-7;
nanobubble reviews (100-210 nm, pH 4.5 in ~5 min vs ~25 min sparge).
genealogy_id: henry_1803_solubility + carbonic_acid_equilibrium
+ nanobubble_cavitation_2024_2025 + nishi_food_science_2026
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_soda_carbonation_test.nxnx_soda_design.nxnx_soda_flavor.nx
structs
| none |
consts
| 34 | const SODA_MAGIC_3350: i64 = 3350 |
| 35 | const SODA_MAGIC_2770: i64 = 2770 |
| 36 | const SODA_MAGIC_2320: i64 = 2320 |
| 37 | const SODA_MAGIC_1970: i64 = 1970 |
| 38 | const SODA_MAGIC_1690: i64 = 1690 |
| 39 | const SODA_MAGIC_1450: i64 = 1450 |
| 40 | const SODA_MAGIC_1260: i64 = 1260 |
| 41 | const SODA_MAGIC_10000: i64 = 10000 |
| 42 | const SODA_MAGIC_7000: i64 = 7000 |
| 43 | const SODA_MAGIC_6000: i64 = 6000 |
| 44 | const SODA_MAGIC_2000: i64 = 2000 |
| 45 | const SODA_MAGIC_5000: i64 = 5000 |
| 51 | const SODA_MG_PER_VOLUME: i64 = 1960 // 1 carbonation "volume" = 1.96 g/L CO2 |
| 52 | const SODA_CO2_MOLAR_MASS: i64 = 44 // g/mol |
| 53 | const SODA_KA1_SCALED: i64 = 445 // carbonic acid: [H+]uM = isqrt(445 * C_uM / 1000) |
| 54 | const SODA_METHOD_SPARGE: i64 = 0 |
| 55 | const SODA_METHOD_NANOBUBBLE: i64 = 1 |
functions
| 60 | func soda_kh_anchor(bucket: i64) -> i64 called by 1: soda_kh |
| 72 | func soda_kh(temp_c: i64) -> i64 |
| 87 | func soda_co2_mg_per_l(temp_c: i64, pressure_mbar: i64) -> i64 |
| 93 | func soda_volumes_milli(co2_mg_per_l: i64) -> i64 called by 1: main |
| 101 | func soda_required_pressure_mbar(target_volumes_milli: i64, temp_c: i64) -> i64 |
| 110 | func soda_isqrt(n: i64) -> i64 |
| 124 | func soda_hplus_um(co2_mg_per_l: i64) -> i64 |
| 131 | func soda_log10_anchor(k: i64) -> i64 called by 1: soda_log10_milli |
| 146 | func soda_log10_milli(x: i64) -> i64 |
| 166 | func soda_ph_milli(co2_mg_per_l: i64) -> i64 |
| 175 | func soda_carbonation_time_s(method: i64, target_volumes_milli: i64) -> i64 called by 1: main |
| 183 | func soda_nanobubble_feasible(pressure_mbar: i64) -> i64 |