Jump to content
Geochemist's Workbench Support Forum

Using different rate constants for different nodes

Tom Meuzelaar

Recommended Posts

[admin notice: the below is from the former GWB users group email distribution list. This message was originally posted 10/18/2005]


Posted by: Megan Knight


I'm currently using X1t version 6.0. My system is a column reactor in

which As(III) is oxidized to As(V), but due to intermediate reactions, the

effective rate constant changes in different zones (nodes) of the column.

I've modeled the system using excess O2 as the reactant, so the model uses

a second-order rate law which is pseudo-first order in practice. Is there a

way to assign different rate constants to different nodes while keeping

the same rate law?


Posted by: Craig Bethke


Hi Megan,


You do this by setting your own rate law, as described in the "Custom Rate Laws" chapter of the GWB Reaction Modeling Guide. In this way, you will not only be able to define rate constants that vary from node to node, but set a second order rate law, or any rate law you want.


Go to the Reactants pane, click on the (+) next to the entry for the kinetic redox reaction, then on the (+) next to "Rate law". There are two options of interest.


Under "script file" you point to a script that you have prepared in a simplified Basic language. The script returns the reaction rate, and X1t uses this rate in its calculations. These scripts are pretty easy to write, and there are a number of examples in the documentation.


A more powerful option is pointed to by the "function/in library" entries. In this case, you code a rate law in C/C++, and compile it and link it into a library. When X1t runs, it links with the library and executes the function whenever it needs to know the reaction rate.


This option requires a little more programming knowledge, but there are examples in the documentation and once you get going I think you'll appreciate the flexibility it gives you. If you (or a friend) are comfortable with C programming, this is what I'd recommend.


Custom rate laws are an advanced feature of the software and you should keep in mind that you are replacing the GWB's coding with your own. It's possible to do some wild and crazy things, not all of which are necessarily desirable.


A good way to start is to take a working problem, replace the built-in rate law with your own (following the examples in the documentation), and make sure you get the same answer. Then, you can gradually add the features you want to your coding, checking as you go to make sure things are working the way you expect.


Hope this helps,


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.

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.

  • Create New...