Vitens / phreeqpython

Object-oriented python wrapper for the VIPhreeqc module
Apache License 2.0
62 stars 19 forks source link

How to retreive species diffusion coefficients? #18

Open rkingsbury opened 2 years ago

rkingsbury commented 2 years ago

Hello, is it possible to use the phreeqpython interface to retrieve the species diffusion coefficients (or mobilities) used in the specific conductance calculation? I have tried a bit with, e.g., solution.pp.ip.get_selected_output_XXX() methods but have not been able to understand their call signatures. Thank you.

AbelHeinsbroek commented 2 years ago

Hi Ryan,

PhreeqPython works by adding new api hooks into the IPHREEQC module (VIPhreeqc). I'll see if I can update VIPhreeqc to support retrieving the species diffusion coefficients.

rkingsbury commented 2 years ago

Thank you so much! I'd be happy to take a stab at it myself, but I will need some guidance as I'm not very familiar with the IPHREEQC source code (or C in general).

On Fri, May 27, 2022 at 1:40 AM Abel Heinsbroek @.***> wrote:

Hi Ryan,

PhreeqPython works by adding new api hooks into the IPHREEQC module (VIPhreeqc). I'll see if I can update VIPhreeqc to support retrieving the species diffusion coefficients.

— Reply to this email directly, view it on GitHub https://github.com/Vitens/phreeqpython/issues/18#issuecomment-1139407163, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOR7V5C3WSWU74PZDLUBVLVMCC6TANCNFSM5WSTNRIA . You are receiving this because you authored the thread.Message ID: @.***>

AbelHeinsbroek commented 2 years ago

Hi Ryan,

I've added the functionality to VIPHREEQC, but am having some issues interpreting whether the program returns the correct values. Could you provide me with a test solution and expected results?

Thanks!

rkingsbury commented 2 years ago

@AbelHeinsbroek thank you very much for your attention this; I'm sorry for my slow reply.

The following PHREEQC input defines a 0.1m NaCl solution and prints the diffusion coefficients of Na+ and Cl-. The values I obtain are 1.33e-9 for Na+ and 2.03 e-9 for Cl-.

SOLUTION 1
    temp      25
    pH        7
    pe        4
    redox     pe
    units     mol/kgw
    density   1
    Na        0.1
    Cl        0.1
    -water    1 # kg

USER_PRINT
-start
10 PRINT "D_Cl:     ", DIFF_C("Cl-")
20 PRINT "D_Na:     ", DIFF_C("Na+")
-end
AbelHeinsbroek commented 2 years ago

My test branch seems to work ok then, thanks for the example! I'll need some time to compile new binaries of VIPhreeqc for linux and windows, before I can push a new version of PhreeqC.

If you by any chance use MacOS you can already try the diffusion branch of PhreeqPython.

image
rkingsbury commented 2 years ago

Outstanding, thank you! I do in fact use MacOS (for one of my systems anyway), so I'll give it a try.