Jump to content
Geochemist's Workbench Support Forum

GWB plugin retrieve results


Recommended Posts


I am having difficulties retrieving results from the GWB plugin in Python. The examples run just fine on my computer.

When I try to get more information from "myGWBrun.results" for the examples provided or my test I seem to get stuck.

I tried to explore this function by doing .tabs and () but I get either:

1) It is empty '[ ]' even when I comment the call to the destroy function, or give the following errors (e.g. "myGWBrun.results.im_func.func_dict.items()");

2) "the results take two arguments" (e.g. "myGWBrun.results.im_self.results()"), and

3) "object is not callable" (e.g. "myGWBrun.results.im_func.func_dict()").

At this stage I would like to retrieve time steps results for example using the react module. How could I retrieve results to plot pH versus a mass reacted for example?

Would it please be possible to get more information? like a map of what is stored under the results function and under what name. The command guide and the guides are not really helping me with this.

I also wonder what is the difference between Chemplugin and GWB plugin.

Any help would be much appreciated.



Link to comment
Share on other sites

Dear Coralie,
I'm not exactly sure what you're trying to do, but "im_func" and "im_self" won't be helpful to find out what details you can get from the report command. For a complete description of the report command, including the arguments accepted in each GWB app, please see the Report Command chapter in the GWB Reference Manual.
Regarding the GWB's Plug-in Feature and ChemPlugin, they are somewhat similar, but have some important differences. In each, you can write your own program or script (the client or “master program”) that uses the GWB in some form (Rxn, SpecE8, React, X1t, or X2t in the Plug-in Features, or ChemPlugin) to perform calculations for you and pass along the results. For example, a program you write might use SpecE8 to figure the saturation state of Calcite in a fluid, or use ChemPlugin to do the same, then feed the result back to the client.
A client could similarly use the Plug-in Feature to have X1t trace a 1D reactive transport model and retrieve certain results from any nodal block of interest. The transport calculation in this case is limited to the flow model implemented in X1t. With ChemPlugin, however, you’re not limited to any conceptual model of flow. You create ChemPlugin instances which self-link into a network of any geometry. The client specifies the rate at which fluid flows across each link (thus controlling advective solute transport and convective heat transport) and can also set at each link transmissivities representing diffusion, physical mixing, and heat conduction. The client then marches forward in time and triggers the instances to perform various steps, such as reporting optimum time step size, transporting mass, transferring heat, and solving the chemical reaction equations.
There are a few other key differences between ChemPlugin and the GWB’s Plug-in Feature. With ChemPlugin you can launch any number of instances that will self-link, but you only have 1 instance of the GWB’s Plug-in. Finally, the ChemPlugin API is much easier to use than that for the GWB’s Plug-in Feature. A straightforward API composed of a few member functions makes linking ChemPlugin with your client a simple matter.
If you'd like us to try to help further, please provide your Python script.
Hope this helps,
Brian Farrell
Aqueous Solutions LLC
Link to comment
Share on other sites

Hi Brian,

Thank you for your reply. What I was after really is to retrieve time steps results from python rather than just reading the output txt file. At this stage I have started to write a script that reads the output txt file and gets the information I need into a csv, which in a way is a bit time-consuming. I was hoping I could retrieve these data with some sorts of commands. The command guide you refer to is helpful for the initial commands but not for retrieving time-steps results.

For example, if I use the React module and do a graph pH vs Mass reacted or minerals vs mass reacted, I can plot all steps. However, The GWB plugin only gives me the pH and number of minerals at the last time step. How do I retrieve the previous steps within Python so that I can do the plot directly with python rather than opening the output in GWB?  See script attached.

Also, I am not sure what you mean by the number of instances that self-link (your last paragraph) ? 


Kind regards



Link to comment
Share on other sites

Hi Coralie,

Thanks for your clarification. The GWB plugin wasn’t intended to let a client control time stepping and retrieve calculation results from any stage of a calculation. Rather, it was designed to prompt a client to run a geochemical model (e.g. an equilibrium model with the SpecE8 plugin) and retrieve the end results (e.g. mineral saturation indices) without any need to develop an in-house chemical modeling simulator. With the React plugin, similarly, you can simulate any reaction path model (e.g. precipitating minerals from a supersaturated fluid or acidifying a sample) but the plugin was designed only to retrieve the end results.

The GWB plugin is now a legacy feature. ChemPlugin was created to supersede and drastically improve those plugin capabilities. One important capability was the ability to control certain operations, such as figuring the maximum allowable time step, advancing the time level, and solving the chemical reaction equations at a given step, then retrieving results from that step. The application programmer interface (API) is composed of a small number of member functions that enable this fine-tuned control.

The ChemPlugin User’s Guide describes how the software works. The Titration Simulator chapter specifically describes how you can set up a time marching loop to control your ChemPlugin instance. It walks you through a client written in C++ to report the concentration of various species at different stages of a pH titration. In the ChemPlugin Modeling with Python Academy, we have an example even closer to what you want. In the Time Marching lesson, a client written in Python is set up to report to the console the pH after various amounts of NaOH have been added to a fluid. The Diffusion and Dispersion lesson similarly walks you through writing results to a text file.

An instance is an individual copy of ChemPlugin. A single ChemPlugin instance would suffice for your purpose, since it’s a single batch reactor. However, in tracing a reactive transport model (i.e. in a spatially discretized domain), separate ChemPlugin instances could be very useful. They would operate in different nodes in parallel to share the work, rather than executing the chemistry calculations serially. This can speed up your calculations significantly.

Please let me know if you’d be interested in trying out a demo of ChemPlugin.



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