Vitens / phreeqpython

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

Passing solution numbers #7

Closed ahockin closed 4 years ago

ahockin commented 4 years ago

Hi, I'm having issues passing the correct solution numbers from PhreeqPython to Phreeq for the bits from Phreeq where I don't think there is built in functions in PhreeqPython e.g. EXCHANGE, TRANSPORTS etc.

For example, using EXCHANGE I can fix the problem by changing the solution number from 0 to 1, because in EXCHANGE I can specify what SOLUTION I want to use.

But for TRANSPORT, it requires a SOLUTION 0 as the influent and you cannot change the solution number that it takes as the influent.

Is there a way to fix this and make PhreeqPython pass a SOLUTIONS 0 to Phreeq when using the pp.ip.run_string(...) code?

Thanks you!

Code for EXCHANGE changing from SOLUTION 0 to SOLUTION 1; from phreeqpython import PhreeqPython

pp = PhreeqPython()

pp.add_master_species( element = 'Doc', master_species = 'Doc', alkalinity = 0,

gfw= 12,

                   egfw = 12)

pp.add_species(reaction = 'Doc = Doc', log_k= 0)

Add Jurbanite to the database

str_to_run = """ PHASES # Taken from WATEQ4f database as not present in phreeqc.dat Jurbanite AlOHSO4 + H+ = Al+3 + SO4-2 + H2O log_k -3.230 """

pp.ip.run_string(str_to_run)

Create solution

solution = pp.add_solution({'temp' : 8.9, 'pH': 4.18, 'Ca': 0.3, 'Mg': 0.16, 'Na':0.65, 'K':0.05, 'Al':0.2, 'Fe(+2)': 0.11, 'Cl':0.76, 'C(4)':3.5, #TIC 'S(6)':1.03, 'Si':0.07, 'Doc':1.3, })

CATION EXCHANGE

Will not work if specify EXCHANGE 0 and -equilibrate 0 ?

str_to_run ="""

EXCHANGE 1 X 0.031 # See exercise manual. CEC must be in eq/L. -equilibrate 1 # bring in equilibrium with solution 0 END

""" pp.ip.run_string(str_to_run)

AbelHeinsbroek commented 4 years ago

Hi Ahockin,

I've modified phreeqpython to start at solution 0 instead of 1, does that fix your problem?

ahockin commented 4 years ago

Hi AbelHeinsbroek,

Yes! Thank you!!