Jump to content
Geochemist's Workbench Support Forum

Custom rate law - script


forrie

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

Link to comment
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

Link to comment
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

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...