Jump to content
Geochemist's Workbench Support Forum
forrie

Custom rate law - script

Recommended Posts

Hi

 

I am trying to model calcite dissolution under both neutral and acid conditions as the model start with the former and end with the latter.

 

However, GWB totally ignores dissolution when I assign a script to the model (calcite reacted = 0).

 

The script is given below. Is my script wrong that GWB ignores it?

 

I also assigned a rate const and a surface area in the interface for the neutral conditions. I assumed that neutral/acid conditions change at 6.3.

 

Thanks in advance.

Regards

Johan

 

 

IF pH > 6.3 THEN 20 ELSE 40

20: rate = rate_const * surface * (1 - Q/K)

GOTO 60

40: rate = 3.235936569E+05 * rate_const * surface * (1 - Q/K) * activity("H+")^powerD(1)

60: RETURN rate

Share this post


Link to post
Share on other sites

Hi,

 

Could you post your entire React script (the .rea file), and a BASIC file (.bas) if you're using one, so that I can take a look?

 

Thanks,

 

Brian Farrell

Aqueous Solutions LLC

 

P.S. I moved your post from the archive of old posts to the main GWB forum page.

Share this post


Link to post
Share on other sites

Hi Brian

 

I have attached the .rea and the .bas files. I just changed the .bas extention to .txt as it seems that one cannot upload a .bas file.

 

The .rea script is just an example of what I am trying to do. Actually my model is in Xt1, however I have deleted all the clutter and just put it into React. However, there is the same problem in React.

 

When I change the "custom rate law" to "built in rate law" then there is no problem and the calcite reacts - but when I add the script file then nothing happens and the model totally ignores the calcite as if it is not there.

 

(It may not be neccesary to assign such a complex rate law to calcite but I would like to sort out the principle - how to let a mineral dissolve with different rate laws under different pH conditions).

 

I use GWB 8.012.

 

Thanks so much for your help.

Regards

Johan

Example of calcite dissolution.rea

ratelaw_calcite.txt

Share this post


Link to post
Share on other sites

Hi Johan,

 

It looks like there were a few keywords that weren't recognized or that were used incorrectly. First, you should use rate_con instead of rate_const.

 

The other issues is that you used the "powerD() parameter. This is for use with the half saturation term of the electron donating reaction in the microbial rate law. If you want the activity of the H+ ion raised to a certain exponent, you can just use the "^" symbol.

 

If you save the block of text into a .bas file your script will run. You should ensure that it is doing what you want it to, however.

 

IF pH > 6.3 THEN 20 ELSE 40

rate = rate_con * surface * (1 - Q/K)

GOTO 60

40: rate = 3.235936569E+05 * rate_con * surface * (1 - Q/K) * (activity("H+")^1)

60: RETURN rate

 

Regards,

Brian

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×