Jump to content
RockWare Support Forum

GWBplugin and Matlab


Nick_T

Recommended Posts

Hi there,

 

I wondered if anyone might be able to help - I am working on some scripts in Matlab that make use of the GWBplugin. I am calling React to run a reaction path calculation (in this case evaporation) and want to retrieve the results to do some subsequent calculations within Matlab. The React calculation executes properly from within Matlab (I can see this from the React_output.txt file it generates) but when I use the "results" function within Matlab (i.e., Calcium = results(myGWBrun, 'concentration aqueous Ca++', 'mol/kg'), the array is only composed of one value, which corresponds to the very last step in reaction progress (i.e., Xi = 1.0000). I cant seem to find a straight-forward way to retrieve results as an array of values parsed as a function of reaction progress. Any thoughts or ideas would be very much appreciated.

 

An example of some of the commands I've been using:

 

clear all
setenv('PATH',[getenv('PATH'),';C:\Program Files\Gwb']);
myGWBrun = GWBplugin('react',[],'-nocd -d "C:/Program Files/Gwb/Gtdata/thermo.tdat"');

exec_cmd(myGWBrun,'468 mmol/kg Na+','10.25 mmol/kg Ca++','53.1 mmol/kg Mg++','10.2 mmol/kg K+','balance on Cl-','pH = 8.5','swap CO2(g) for HCO3-','log fugacity CO2(g) = -2.5','fix f CO2(g)','react -100 g/kg H2O','precip off','delxi = 0.01','go');
if results(myGWBrun,'Success')
    H2O_remaining = results(myGWBrun,'concentration H2O','g/kg');
    Ca = results(myGWBrun,'concentration aqueous Ca++','mol/kg');
end

 

All the best,

Nick

Link to comment
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
×
×
  • Create New...