I'm looking for a general formula that...
given a sealed container with a specified volume of beer, and a specified volume of headspace
... gives the % of the total CO2 (by weight) that is in the beer and (thus) the % of the total CO2 (by weight) that is in the headspace, assuming equilibrium has been reached.
Anyone? TIA!
Turns out this problem is not as difficult as I originally thought, and does not require an iterative (goal seek) solution. So, let's derive the formula here.
A J deLange gives the volumes of carbonation as a function of CO2 partial pressure and temperature as (see attached PDF, no longer available on-line):
Volumes of carbonation = P [psia] * (0.01821 + 0.090115 * exp(-(T - 32) / 43.11)) - 0.003342
where:
P is CO2 partial pressure which equals gauge pressure in psi + atmospheric pressure (14.695 psi at sea level,) if the headspace is 100% CO2
The parenthetical formula is the temp dependent Henry coefficient
T is the beer temp in °F
and 0.003342 is a fudge factor to make the average error vs. the ASBC tables zero
Converting to °C and dropping the fudge factor (since it is insignificant for our purposes here) leads to this equation:
Volumes of carb = P [psia] * (0.01821 + 0.090115 * exp(- (T / 23.95))
1 volume of carbonation is equal to 1.977 g/L of CO2, so the mass of CO2 in solution is:
Mass of CO2 in beer = Beer volume [in Liters] * 1.977 [g/L] * P [psia] * (0.01821 + 0.090115 * exp(- (T [°C] / 23.95)))
Now we turn to the mass of CO2 in the headspace.
At 0°C and 1 atmosphere pressure (14.695 psia) CO2 gas has a density of 1.977 g/L (that number should look familiar.) Thus the mass of CO2 in the headspace as a function of temperature and pressure is:
Mass of CO2 in headspace = Headspace volume [in Liters] * 1.977 [g/L] * (P [psia] / 14.965 [psia]) * (273.15° / (T [°C] + 273.15°))
The ratio of CO2 mass in the beer to CO2 mass in the headspace then becomes:
CO2 Beer / CO2 HS = (Vol Beer/ Vol HS) * 14.965 * (0.01821 + 0.090115 * exp(- (T [°C] / 23.95)) *(T[°C] + 273.15°) / 273.15°
(hope I didn't make any algebra errors above.)
Edit: No algebra errors, but a couple of typos, which have been corrected in red above.
Brew on