PhreeqcUsers Discussion Forum
Click here to donate to keep PhreeqcUsers open

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Conceptual Models »
  • Database selection and modification »
  • Defining log_K values
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Defining log_K values  (Read 135 times)

Sol-Chan Han

  • Top Contributor
  • Posts: 25
Defining log_K values
« on: June 14, 2022, 04:09:05 AM »
Hi Phreeqc users!

I would like to modify the phreeqc database.
I am currently working on using Phreeqc with external code.
For my purpose, I would like to use an equation for defining log_K value of SURFACE_SPECIES, as follows.

   Hfo_sOH   + H+ = Hfo_sOH2+
   -log_k   8.29 - 1

However, it seems like Phreeqc cannot understand 8.29 -1 = 7.29.
And Phreeqc just use 8.29 instead of 7.29.
Is there any way to use equation for defining log_K value?

Thank you in advance for your help.
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2554
Re: Defining log_K values
« Reply #1 on: June 14, 2022, 05:59:39 AM »
Assuming you don't want to just set the log_K to 7.29, there are a couple of options.

(1) There is an undocumented option -add_constant. A constant is added to the log K, which is either the log K as defined with -log_k or -analytical_expression. An analytical expression defines log K as a function of temperature. The analytical expression is used in preference to -log_k if both -log_k and -analytical_expression are defined. Here is an example:

Code: [Select]
SOLUTION_SPECIES
   Hfo_sOH   + H+ = Hfo_sOH2+
   -log_k   8.29
   -add_constant -1
END
SOLUTION 1
Na 1
Cl  1 charge
SURFACE 1
    Hfo_sOH    1         600       1
USER_PRINT
10 PRINT "Log10K(Hfo_sOH2+): ", LK_SPECIES("Hfo_sOH2+")
END

(2) There is another more complicated, but more flexible option to add a "named expression", -add_logk, in SURFACE_SPECIES. This option is documented in the manual. You can define a NAMED_EXPRESSION that is a function of temperature, and then add it (multiplied by a coefficient) to the log K that is defined by -log_k or -analytical_expression in SURFACE_SPECIES.
Logged

Sol-Chan Han

  • Top Contributor
  • Posts: 25
Re: Defining log_K values
« Reply #2 on: June 14, 2022, 08:09:59 PM »
Hi sir Parkhurst

Thank you for the reply.
I have tried option (1).
It seems that the option (1) works for solution_species but does not work for surface_species.
Am I correct?

Unfortunately, the option (2) might not be fit for my purpose becasue I would not use analytical expression.
But thank you for your comment.
« Last Edit: June 14, 2022, 08:26:09 PM by Sol-Chan Han »
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2554
Re: Defining log_K values
« Reply #3 on: June 14, 2022, 10:14:27 PM »
Sorry, my mistake. I should have had SURFACE_SPECIES, rather than SOLUTION_SPECIES, but add_constant is available for both types of input. Here is the corrected script with log K for Hfo_sOH2+ calculated in a couple different ways:

Code: [Select]
SURFACE_SPECIES
   Hfo_sOH   + H+ = Hfo_sOH2+
   -log_k   8.29
   -add_constant -1
END
SOLUTION 1
Na 1
Cl  1 charge
END
USE solution 1
SURFACE 1
    Hfo_sOH    1         600       1
USER_PRINT
100 PRINT "Log10K(Hfo_sOH2+): ", LK_SPECIES("Hfo_sOH2+")
110 F_KJ_V_EQ = 96.4935
120 R_KJ_DEG_MOL = 0.00831470
130 REM equation 15 of PHREEQC version 2, 1999 manual
140 lk = LA("Hfo_sOH2+") - LA("H+") - LA("Hfo_sOH") \
         + LOG10(EXP[1*F_KJ_V_EQ*EDL("psi","Hfo")/(R_KJ_DEG_MOL*TK)]) 
150 PRINT "Alternatively:     ", lk
END

Note that the equation for NAMED_EXPRESSION includes a constant, so -add_logk would work as an alternative to -add_constant.
Logged

Sol-Chan Han

  • Top Contributor
  • Posts: 25
Re: Defining log_K values
« Reply #4 on: July 15, 2022, 06:19:00 PM »
Thank you, parkhurst!
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Conceptual Models »
  • Database selection and modification »
  • Defining log_K values
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2