Jump to content
Geochemist's Workbench Support Forum

Configuring mineral dissolution in python


Recommended Posts

Hello,

 

I’m trying to model mineral dissolution/precipitation in a natural setting for a long time (e.g., 10 years) using react module of GWB. Since the temperature and rainfall fluctuate significantly in the environment, it doesn’t make sense to assume constant temperature and water content in the system for the period of simulation. So, I came with the idea of dividing the model to small steps (e.g., 1 day), pickup the result from the previous step, and define the new temperature and water content for the system. (See the attached file, it’s an example form of inputs for ten days of simulation). As it will be almost impossible to extend such command lines for ten years, I am thinking of running the model using the GWB plugin in python (defining new temperature and water content for each step from an excel file). I execute the script examples successfully on python. However, I have some difficulties writing the script for my simulation in python. Below are some challenges I’m facing now:

1)using pickup command in python script. As I checked the manual reference of GWB, there was no discussion on using pickup the system and using it as the input for the next step of modeling in coding environments.

2)(which is also related to No.1) I wonder if I can retrieve the results from each step and save them (or part of them) in a text or excel file.

3) I noticed when I run a model using a costume rate law (defined in script) like the one specified in the attached file, the python plugin cannot read it and return an error.

 

I would appreciate it if you could help me with solving these problems.

 

Regards,

Rezatest.rea

 

Link to post
Share on other sites

Hello Reza,

I would suggest you start by looking at the GWB Command guide for more information how the pickup command is defined. The plugin python scripts provide an example for setting up an input file. GWB_plugin_python_example2 shows an example for writing out results using GWB plugin. With regards to retrieving results in general, you will want to familiarize yourself with the Report command in the GWB Command reference guide. 

With regards to adding the pick up command, you have a couple of options. In GWBplugin_Python_example1, the program sets up the fluid composition within the python script itself. In the second python example, the program calls in an input file, freshwater.sp8, and execute commands drawn from the input file. You can also amend or change the commands drawn from the input file within your python script (e.g. with the line 'cmds = ["pH = 8","molality Cl- = .05","go"]' in example 2). If you want to pickup the results after a run, then you would need to add the pickup command after 'go'. I would recommend simplifying and start with just an initial fluid composition, run the reaction and see if you are writing out results as you expect. I would recommend doing this and comparing the results from running GWBPlugin with running a React simulation. Then add the pickup command. If that's all successful, write in loops to iterate the process for many days. 

If you are entering your custom rate law directly in your python script, I would suggest double checking if you have entered all the variable names correctly. The easiest way to check this is to open your test.rea file in a text editor and compare the rate law to your python script. If you would like more help with troubleshooting, you can attach your python input file so we can take a closer look. 

Hope this helps,
Jia Wang

Link to post
Share on other sites
On 3/23/2021 at 3:20 PM, Jia Wang said:

Hi Jia

Thank you so much for your explanation. It was really helpful and I was able to run my test simulation in plugin python.

Regards,
Reza

 

Link to post
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...