Vitens / phreeqpython

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

Obtain amount of precipitated salt from evaporation #31

Open Pichatdev opened 1 year ago

Pichatdev commented 1 year ago

Hi,

I am simulating the evaporation of a lake (by removing moles of H20) in order to follow the evolution of brine element concentrations and the type of salt precipitated.

lake.desaturate enable me to allow the precipitation of salts under over-saturation sate.

I am however struggling to know how much salt has precipitated after each desaturation state.

As several minerals sharing similar elements can be simultaneously precipitating (e.g. CaSO₄ ; K₂MgCa₂(SO₄)₄•2H₂O and MgSO₄•7 H₂O ), it is very challenging to calculate the amount of precipitated salts from the evolution of the elements content in the brine, (by comparing element contents before and after the desaturation stages).

Is there a way to obtain the output of the moles of precipitated salt after each desaturation stage ?

Pichatdev commented 1 year ago

Ok, I have just seen this former issue https://github.com/Vitens/phreeqpython/issues/4 (2019) which is similar to mine. I guess the individual phase management it is still not solved ? If so, I will desaturate one by one the salts at SI >0 and calculate the number of precipitated moles from the evolution of the concentrations in the brine before and after each precipitation phase.

AbelHeinsbroek commented 1 year ago

Hi,

Hmm, to be able to do what you want I'll need to make some changes to the VIPHREEQC package to persist EQUILIBRIUM_PHASES and get their relevant attributes. In pseudocode you'll get something like this:

salt = pp.add_equlibrium_phase(phases=['Calcite', 'Vivianite'], saturation_index=[0,0], amount=[1,1])
solution.interact(salt)
print(salt.amount)
salt.forget() # cleanup

Will that work for you?

AbelHeinsbroek commented 1 year ago

Also, please note that the method you're currently using (desaturate one by one) may not give the same results as simultaneous precipitation.

Pichatdev commented 1 year ago

Many thanks Abel for your answer. I am sorry, I am not sure I understand the solution you propose. How could I anticipate the amount and type of salts to mix in a solution under an evaporating process ? Could you develop what you propose ?

Regarding your second remark, I add the same thought. I have however simulated the evaporation of one liter of seawater with my method, and benchmarked it with experimental data (Shalev et al., 2018). Turns out that the results are very similar. I guess its because salt minerals tend to form in successive saturation steps....

AbelHeinsbroek commented 1 year ago

Sorry, the amount parameter is a bit confusing, and allows for specifying the amount of a phase already available, useful for when you're modelling dissolution instead of precipitation.