Jump to content
Geochemist's Workbench Support Forum

custom rate laws


Recommended Posts

Not an extensive user of GWB and first attempt at a simple custom rate law. Have a quick question about syntax for using an affinity term. Test case is a simple dissolution of albite into a pH ~4 HCl solution.

 

The react input attached called "2-mech.rea" uses the expression (1-Q/K) for this "affinity" term. Seems to run OK.

 

The second input called "2-mech-affinity.rea" tries to use the helper function "logQoverK", which is defined as being "affinity" in the modeling guide. In this case I want to use the Aagaard & Helgeson form for the affinity term: (1-e^(-A/RT)), where A is the affinity. My syntax for this is clearly wrong, because the output shows the albite reaction rate for step #0 as being "-1.#IO". It appears to be running, but is just stuck at the first step.

 

What would be the correct form for this? I'm guessing it's something quite simple that I've missed, being a newbie using custom rate laws in GWB. Thanks.

2-mech.rea

2-mech-affinity.rea

Link to comment
Share on other sites

Never mind. OK, I see my problem. I was being literal. The table in the manual defined the variable logQoverK as "affinity", but it really is log(Q/K). If I use the expression (1-exp(2.303*logQoverK)), you get the same result as using (1-Q/K) for this thermo-driver term in the rate law. Cheers.

Link to comment
Share on other sites

Hi,

 

I was just starting to take a look at this when you wrote again. As you say, I think the logQoverK is not exactly the same as the affinity in the reference you mentioned. What you have now looks reasonable if you plug in values for a fluid in equilibrium with and undersaturated with respect to the mineral.

 

One point about your earlier script. You should be careful about the order of operations and using parentheses where they're needed. I think you want to use something like exp(-logQoverK/(R*TK)) instead of exp(-logQoverK/R*TK).

 

Regards,

 

Brian Farrell

Aqueous Solutions LLC

Link to comment
Share on other sites

Thanks for jumping in, Brian. As you note, "affinity" is defined as -2.303RTlogQ/K. When the reaction modeling guide called the variable "logQoverK" affinity, I wrote that first rate expression assuming that it was literally affinity. I was being incredibly literal! When it occurred to me that the variable was just what it says, logQ/K, putting that in the A&H form for the rate law gets you effectively exp(lnx) = x, ie, it gives the thermo term as (1-Q/K), just like the first form of the rate law that I used. Duh!

 

As for the extra parens, I tested that to be sure it wasn't an issue. It is, however, a very good point that you raise. Cheers.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...