Hi! I am very new to GWB, so forgive me if any of this seems rather simplistic.
I created a rate law script to try to fix a problem where certain parts of a chemical reaction are going to zero within a few years of a ten-year simulation, causing GWB to crash.
Reaction:
Methane(aq) + 8*Fe(OH)3 + 15*H+ -> 8*Fe++ +HCO3- + 21*H2O
To fix this, I think I want to set the rate equal to zero every time certain elements in a node dip below a threshold value, but running the simulation with my current script gives the following error message "Could not evaluate rate law script at line 2". I'm guessing I have not set up the indexing of my nodes or time step correctly, but am unsure how to proceed.
Here is the code as it stands now:
i = 1
begin_loop1: If (molality(Methane(aq)(i)) < 1e-20 or mass(Fe(OH)3(i)) < 100)
rate = 0;
return rate;
i = i+1
end_loop1
else
cat = 1.0
i = 1
begin_loop: If i > ncatal THEN GOTO end_loop
cat = cat* acatal(i)^pcatal(i)
i = i+1
GOTO begin_loop
end_loop: rate = Wmass*cat*rate_con*(1.0 - QoverK)
RETURN rate
I would appreciate any advice on how to adapt my script so that I am correctly indexing nodes at each time step.
Thanks!
Lauren