Skip to content

Getting bulk/species properties from Phreeqc #310

@vineetbansal

Description

@vineetbansal

In our wrappers, to get all bulk/species properties, we're formulating a phreeqc string like below (without the -file so.out which is included here to test against phreeqc UI). This is the main mechanism we use to interact with phreeqc:

SELECTED_OUTPUT
    -file so.out
    -reset false

USER_PUNCH
5 PUNCH CELL_NO, TOT['water'], OSMOTIC, EOL_NOTAB$
10 t = SYS("aq", count, name$, type$, moles)
20 FOR i = 1 to count
30 PUNCH name$(i), MOL(name$(i)), ACT(name$(i))
40 NEXT i
50 PUNCH EOL$
60 p = SYS("phases", count, name$, type$, moles)
70 FOR j = 1 TO count
80 PUNCH name$(j), SI(name$(j))
90 NEXT j

SOLUTION 0
  pH 7.0
  pe 8.5
  redox pe
  temp 25.0
  units mol/kgw
  water 0.9970480319717386
SAVE SOLUTION 0
END

The part between SOLUTION 0 and SAVE SOLUTION 0 is dynamic and generated using the Solution class. For example, the above solution would correspond to the call:

Solution({"pH": 7.0, "pe": 8.5, "redox": "pe", "temp": 25.0, "units": "mol/kgw", "water": 0.9970480319717386})

The output we get in so.out is:

0.0000e+00	  9.9705e-01	  0.0000e+00	           
OH-	  1.0127e-07	  1.0123e-07	          H+	  1.0005e-07	  1.0002e-07	          O2	  8.3176e-25	  8.3176e-25	          H2	  7.0795e-35	  7.0795e-35	           
H2O(g)	 -1.5028e+00	       O2(g)	 -2.1188e+01	       H2(g)	 -3.1049e+01	

interpretable as:

<solution_num>, <kg_water>, <osmotic_coeff>
<species1_name>, <species1_amt_moles>, <species1_activity>, <species2_name>, ...
<phase1_name>, <phase1_si>, <phase2_name>, ...

This issue is created to ensure that this indeed gives us the correct values (unit testing seems to indicate that it does), and to discuss how to add add more bulk/species properties to be reported in so.out.

@rkingsbury mentioned that we may want:

- Bulk properties
  - conductivity
  - density
  - mass
  - volume
  - pH
  - pE
  - total dissolved solids (if available)

- Individual species properties
  - molalities
  - activities
  - activity coefficients  <-- currently calculated in pyEQL using activity+molality
  - diffusion coefficients
  - mobility (if available in PHREEQC)

- Equilibrium-related
  - Saturation indices for any minerals present

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions