Best workflow to convert H2(g) partial pressure / mole fraction into absolute moles
Hi everyone,
I am currently post-processing results from a reactive transport simulation and need to convert
π―π
(
π
)
from its reported mole fraction or partial pressure into absolute moles for specific grid blocks over time.
Looking at my visualization files (gas.tec and time.out), I see the individual gas partial pressures (e.g., P_H2(g)). To get the true number of moles, my current planned approach is to calculate total gas moles (
ntotal
πtotal) per grid block using the Ideal Gas Law:
- Calculate total gas phase pressure (
Ptotal
π·ππ¨πππ₯) by summing all gas partial pressure columns or pulling total pressure fromflow.out(where gas saturationππ
>0
). - Calculate gas volume (
Vgas
π½π ππ¬) using:πblock
Γporosity
Γππ
. - Solve for total moles (
πtotal
=πtotalβ πgasπ β π
) and multiply by theH2
π»2 mole fraction (ππ»2
=ππ»2πtotal
).
Before I build a Python/Pandas parser to automate this over my output datasets, I wanted to check with the community:
- Is this the correct physical workflow for extracting molar quantities from TOUGHREACT outputs, or is there an edge case regarding phase volumes or compressibility factors I am overlooking?
- Is there an alternative output flag or pre-existing post-processing tool/script (like
toughio) that can output mass or moles of a gaseous species directly?
Any advice, formulas, or example script snippets would be greatly appreciated!
Thanks in advance,
