Karen Posted September 22, 2015 Share Posted September 22, 2015 Brian, I am interested in writing some custom rate laws into a script for dissolution of some minerals. I have an idea as to how to do this but I think I am possibly missing something critical. Below is a rate law for anorthite dissolution that is one of the simpler expressions I am interested in incorporating into a React model. It has the form: Rate = k+[((aH+3n/aAl3+n)Keq)/(1+Keq(aH+3n/aAl3+n))] where n = 1/3, Keq is a known constant, and k+ is the forward rate constant. "a" represents activities and the parameters with n in them are exponents on the various hydrogen ion and aluminum ion activities. I have attached a file with a better representation of the expression. Also, I have not included the surface area of the (1-Q/K) terms because those are obvious to me as to their implementation. Any suggestions you have would be greatly appreciated. Best wishes, Karen J. Anorthite Rate Law.pdf Quote Link to comment Share on other sites More sharing options...
Brian Farrell Posted September 25, 2015 Share Posted September 25, 2015 Hi Karen, I moved your post to the front page of the forum. It was posted in the archive of old posts. The Custom Rate Laws chapter (section 5 in the GWB Reaction Modeling Guide) should be helpful. I think you probably want to use a rate law script, which you'll write in a simplified form of the BASIC language. You can find a description of the syntax in Table 5.3. In your scripts, you can access certain parameters (pH, temperature, rate_con) and helper functions (activity(), fugacity(), etc.) that are listed in Tables 5.1 and 5.2 in the guide, respectively. You can also define new variables within your script (n, for example). Assuming you define the rate constant using the GUI, your .bas script file might look something like this: n = 1/3 Keq = ... top = ((activity("H+")^(3*n))/(activity("Al+++")^n))*Keq bottom = ... rate = rate_con * top / bottom RETURN rate In this case, n and Keq are variables that you define, activity() is a helper function from 5.2, and rate_con is a parameter, listed in 5.1, that accesses what you entered in the rate constant field of the GUI. Please keep in mind the GWB's convention of writing reactions as destruction reactions (i.e., a mineral dissolves or a complex breaks down). A positive rate indicates dissolution, while a negative rate indicates precipitation. I hope this helps. Best, Brian Farrell Aqueous Solutions Quote Link to comment Share on other sites More sharing options...
Karen Posted September 25, 2015 Author Share Posted September 25, 2015 Thanks Brian! This helps a lot. Quote Link to comment Share on other sites More sharing options...
Brian Farrell Posted September 25, 2015 Share Posted September 25, 2015 You can write out the entire basic rate law script in parentheses within your React script or you can save them as separate script files (.bas) that you refer to in your React script. In my opinion, the latter method is easier, especially if you have rate laws for several different kinetic minerals. You would write a rate law script, like the one above, in a text editor like Notepad. Instead of saving as a txt file, though, just change the extension to .bas (AlbiteRate.bas, for example). I mentioned using the GUI to define certain parameters, like the rate constant, for use by your rate law. You can alternatively use a simple keyword to define those parameters in your React script (.rea) at the same time that you set up your rate law. For example, kinetic Quartz rate_law = QuartzRate.bas rate_constant = 10^-16 kinetic Albite rate_law = AlbiteRate.bas rate_constant = 10^-15 If you had instead included your own variable "MyRateConstant" in your rate law script, then you wouldn't need to specify the rate constant within your React script: kinetic Quartz rate_law = QuartzRate.bas Hope this helps, Brian Quote Link to comment Share on other sites More sharing options...
Karen Posted October 12, 2015 Author Share Posted October 12, 2015 Thanks Brian, This is very, very helpful! Are you planning to attend GSA in Baltimore in a few weeks? If so, hope to see you there. Best wishes, Karen Quote Link to comment Share on other sites More sharing options...
Brian Farrell Posted October 13, 2015 Share Posted October 13, 2015 Hi Karen, Glad it helped. Yes, we'll be teaching a half-day short course on October 31st and then we'll have a booth in the exhibit hall. See you there! Cheers, Brian Quote Link to comment Share on other sites More sharing options...
Karen Posted October 26, 2015 Author Share Posted October 26, 2015 Hi Brian, Great! I will pop by the GWB booth and say hi. Quick question, does the BASIC language that GWB employs for such custom rate laws use log for log base 10? When I used to use BASIC decades ago, LOG was for the natural log. I have rate law expression that is given as: log Rate = 0.03*pH2 - 0.073*pH - 10 that I need to "code" for one of the minerals in my hypothetical basalt. Based on what you wrote above, I will need to convert "log R = ..." to "R = ..." using activity("H+") for the pH terms. In my olden days of BASIC programming to code for log base 10, I would have to use "2.303*LOG(argument). Karen Quote Link to comment Share on other sites More sharing options...
Brian Farrell Posted October 28, 2015 Share Posted October 28, 2015 Hi Karen, When writing a script in the BASIC language (to define a custom rate law or to specify medium heterogeneity, for example) LOG refers to the natural logarithm, whereas LOG10 refers to the common (base 10) logarithm. See Table 5.3 in the GWB Reaction Modeling Guide. If you've ever used the calculator built into the Command pane of any GWB app, though, you would use ln (or LN) for the natural log and log (or LOG) for the common log. See section B.4, Calculator, in the GWB Reference Manual for more info. See you next week, Brian Quote Link to comment Share on other sites More sharing options...
Karen Posted October 29, 2015 Author Share Posted October 29, 2015 Thanks again Brian! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.