-
Posts
43 -
Joined
-
Last visited
-
Days Won
1
Posts posted by Helge
-
-
I am having trouble retrieving the fugacity for CO2(g) with python. I provided the scripts. For this calcuation I used thermo.tdat
In the resultsfile 0400.out you readÂ
fugacity(CO2(g))Â Â Â <GWBplugin.c_double_Array_1 object at 0x0000020F80CCAD40>
Any hint is appreciated.Â
Best regards,
Helge
Â
-
I manually changed env variables (c:\program\user\gwb and c:\program\users\scr) and it works. I am quite sure I didn't deactivate this option upon installation, though!Â
Thanks for response 🙂
Helge
-
Sorry for opening this thread again, but I am again having trouble using the python plugin.Â
I call the python script from cmd-line usingÂ
python 0293.py
Error message is that it can't find the given module (?)
I enclose the database, the script, and the env-variables. Python version is 3.10.5
I use GWB Professional, version 17.? (can't figure out where to retrieve the version number)
I know for certain that the enclosed script worked February last year. Every help appreciated.Â
Best regards,
Helge
Â
-
Hello Jia,
this is number 81 in a series of calculations, run in a normal windows command prompt. At number 81 the output in the prompt stopped. But indeed, if I wait long enough, the calculation converges.Â
Please excuse my impatience. 🙂
In fact, we encounter numerical problems every once in a while, but usually epsilon, delxi, or pickup entire are our friends.Â
Best regards,
Helge
-
This is an interesting case. Using GWB and the attached rea-script the equilibrium is found. Translating to python and running again the equilibrium is found, too. But the calculation has to be killed manually, the attached log-file has 44 MB. Addmittedly, it is a tricky calculation because SI of Na2CO3:7H2O(s) is -0.0065 at this point, also pretty much close to saturation.Â
I wonder whether the command epsilon = 5e-6 is correctly transferred using python.
Best regards,
Helge
-
Dear Jia,
thanks for the advice, it works. The beginning of the script now readsÂ
#!/usr/bin/env python import os, glob, sys, string, math # To find the plugin sys.path.append('c:/program files/gwb/src') os.add_dll_directory('c:/program files/gwb') # import GWBplugin class from GWBplugin import *
Indeed the problem didn't arise with a colleague who uses python 3.8 (I am using 3.10).Â
Best regards,
Helge
-
Hello,
I fail to run a python script which worked on a different computer and I simply cannot figure out where is the problem. Enclosed you find
- python script
- databaseÂ
- settings for path variables
- output on the command line
In case it is important: I am working from remote ("Home Office") on the computer where the executables are located.Â
Many thanks,
Helge
-
As to my knowledge there are experimental data at higher temperature which could allow for the determination of Pitzer coefficients for Si- and Al-Species. But this work (compiling suitable experimental data, critical assessment, fitting procedure) simply has not been done yet. A project to pursue this goal has been outlined and we are waiting for funding. 🙂
Best regards,
Helge
Â
-
Hello Yumeng,
please look here:Â https://www.thereda.de/en/datenabfrage/download
Please note that depending on the particular system the valid temperature range for Pitzer coefficients is different. This is marked in the (quite bulky) parameterfile.Â
Note 2: Pitzer coefficients for Si- and Al-Species are only estimates and valid for 25°C only. However, if the solubility of the solid phase in question is very low, then the database might give a good estimate. Whether the assumption of thermodynamic equilibrium between a silicate mineral and an aqueous solution is valid needs to be ascertained in any particular case.
If you apply THEREDA to real systems for which experimental data are available, we are always very interested in your results!
Best regards,
HelgeÂ
- 1
-
It isn't aphi. I checked and the function is smooth around 239K. It begins to drop steeply at ~ -63C and below -83C it doesn't work anymore.
Density function for water looks "normal" at 239K, no rapid changes.
May I have look at the database? At the moment I have no idea 😞
Helge
-
Hello Vincent,
I am not aware of any thermodynamic database which is able to calculate equilibria down to -80°C. Perhaps it helps to consult
https://apps.dtic.mil/dtic/tr/fulltext/u2/a288456.pdf
In the context of martian geochemistry some publications are available, e. g. https://www.sciencedirect.com/science/article/abs/pii/S0016703707005844
Another hint: look into Craig Bethkes book about geochemical modeling, chapter on activity coefficients. Water activity is calculated from osmotic coefficient, which in turn is subject of Pitzer coefficients for dissolved salts and of Aphi. In pure water the calculation of water activity boils down to the Debye-Hückel equation where the impact of Aphi prevails. I think GWB calculates Aphi temperature dependent (Debye-Hückel coefficients), but I am sure the underlying temperature function has never been tested down to such a low temperature.
In salt solutions situation is even worse. I encountered a similar situation, though for elevated temperatures, where a temperature function for a single Pitzer coefficient beyond 170°C went mad all of a sudden. In your specific situation you had to inspect the temperature function for every single Pitzer coefficient in your database - a formidable task!
Best regards,
Helge -
Hello Jia,
I cannot believe that there is no way to retrieve the total concentration of all species being formed from a single redox species. But I cannot see any way to get this result in gtplot either. Also in Tedit I don't see product species grouped into their respective oxidation state. In the present (very special) case the total element concentration gives indeed the correct answer. But this doesn't offer a general solution to the problem, e. g. for those cases, where you have two oxidation states of one basis species in comparable concentration.
Thank you for the replay anyway.
Helge
-
I am trying to write the log10 total molality of Np(V) to file using python. The present line looks like this:
fobj_ResultFile.write(Testcase + '\t' + '1180' + '\t' + 'log10(conc_oxidationstate(NpO2<+>))' + '\t'+ str(math.log10(myGWB.results('concentration "NpO2+"', 'molal')[0])) + '\n')
A normal export for a single species looks like this
fobj_ResultFile.write(Testcase + '\t' + '1181' + '\t' + 'log10(conc_solute(Ca[NpO2(OH)2]<+>))' + '\t'+ str(math.log10(myGWB.results('concentration aqueous "Ca[NpO2(OH)2]+"', 'molal')[0])) + '\n')
My opinion was that by omitting the "aqueous" behind "concentration" would cause GWB to export the total molality of the given oxidationstate, as defined by the redox species (NpO2+ in this case). Instead, what I observe, is that the concentration of the species NpO2+ is exported. What I would like to have is the total sum of all Np(V)-species in solution.
Any ideas appreciated.
Helge
-
This works:
myGWB.exec_cmd('print react_output.txt')
os.rename(r'react_output.txt',r'<whatever name>')
Thanks,
Helge -
Does anybody know...? ?
-
Hello everybody,
is it possible to pipe what is usually shown as react_output.txt (when you push the button "view results") from a python script into a user defined text file?
Cheers,
Helge
-
Hello everybody,
is it possible to place comment lines in *.rea files, which are not processed by GWB?
Best regards,
Helge
-
Works perfectly, thank you very much ?
Helge
-
Hello everybody,
in the attached test case I can retrieve all concentrations withÂ
species = myGWB.results("species") conc = myGWB.results("concentration aqueous", "mol/kg") print "\nThere are" , len(species) , "aqueous species.\n" for i in range(len(species)): print "%-4s = %10.4g mol/kg" % (species[i], conc[i])
However, if I export the results to file with  Â
ResultFile = Testcase + '_mod.out' fobj_ResultFile = open(ResultFile,'w') fobj_ResultFile.write(Testcase + '\t' + 'pcH' + '\t' + str(-(math.log10(myGWB.results('concentration aqueous H+', 'molal')[0]))) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_element(Nd)' + '\t' + str(myGWB.results('concentration Neodymium', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(Nd(OH)2<+>)' + '\t' + str(myGWB.results('concentration aqueous Nd(OH)2+', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(Nd(OH)<2+>)' + '\t' + str(myGWB.results('concentration aqueous Nd(OH)++', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(Nd<3+>)' + '\t' + str(myGWB.results('concentration aqueous Nd+++', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(Nd(OH)3<0>)' + '\t' + str(myGWB.results('concentration aqueous Nd(OH)3', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(Nd(OH)4<->)' + '\t' + str(myGWB.results('concentration aqueous Nd(OH)4-', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(NdCl<2+>)' + '\t' + str(myGWB.results('concentration aqueous NdCl++', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(NdCl2<+>)' + '\t' + str(myGWB.results('concentration aqueous NdCl2+', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(Ca[Nd(OH)3]<2+>)' + '\t' + str(myGWB.results('concentration aqueous Ca[Nd(OH)3]++', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(Ca2[Nd(OH)4]<3+>)' + '\t' + str(myGWB.results('concentration aqueous Ca2[Nd(OH)4]+++', 'molal')[0]) + '\n') fobj_ResultFile.write(Testcase + '\t' + 'conc_solute(Ca3[Nd(OH)6]<3+>)' + '\t' + str(myGWB.results('concentration aqueous Ca3[Nd(OH)6]+++', 'molal')[0]) + '\n') fobj_ResultFile.close()
concentrations for species whose name contains [ and ] are exported as -999999.0. I fail to locate my mistake.
Best regards,
Helge
Â
Â
Helge
Â
Â
-
Taken the case I look at the transition of Tc(+VII) to Tc(+IV) by inreasing pH: is there any means to retrieve the proportion of the two different oxidation states of Tc in solution?
Helge
-
Means: if I want to retrieve the total molality of Tc(+IV) in solution, and TcO(OH)2 is the secondary master for the formation of all Tc(+IV)-species, I use
myGWB.results('concentration TcO(OH)2', 'molal')[0]
?
Â
Helge
-
Hello everybody,
I can't retrieve the molal H+ concentration. With
#######
   species = myGWB.results("species")
   conc = myGWB.results("concentration aqueous", "molal")
   print "\nThere are" , len(species) , "aqueous species.\n"
   for i in range(len(species)):
      print "%-4s = %10.4g mol/kg" % (species, conc)
   print "concentration H+ = ", myGWB.results('concentration H+', 'molal')[0]#######
I get
Y:\Rechnungen\gwb>0001_test.py
There are 9 aqueous species.
H+Â Â =Â 3.027e-07 mol/kg
HSO4- =Â 3.231e-06 mol/kg
K+Â Â =Â Â Â Â 0.7233 mol/kg
KMg(SO4)+ =Â 6.463e-05 mol/kg
Mg(OH)+ =Â 3.447e-06 mol/kg
Mg++ =Â Â Â Â Â 3.114 mol/kg
Mg3(OH)4++ =Â 8.826e-15 mol/kg
OH-Â =Â 8.746e-08 mol/kg
SO4-- =Â Â Â Â Â 3.475 mol/kg
concentration H+ = -3.47366172108e-10It seems that with myGWB.results('concentration H+', 'molal')[0] I retrieve something else (charge balance?) but not the H+ molality. Of course I could work around the problem and get the H+ molality from the aqueous species list, but this wouldn't be elegant.
Helge
Â
Â
-
Perfect! Thank you very much ?
Helge
-
Hello everybody,
I have a problem getting started with the GWB Python plugin. On running the example script I get:
###############################
Y:\THEREDA\Arbeitsergebnisse\Testrechnungen\meinGWB>GWBplugin_Python_example2.py
Starting program SpecE8
Traceback (most recent call last):
 File "Y:\THEREDA\Arbeitsergebnisse\Testrechnungen\meinGWB\GWBplugin_Python_example2.py", line 20, in <module>
   -s \"c:/program files/gwb/gtdata/feoh.dat\""):
 File "Y:\THEREDA\Arbeitsergebnisse\Testrechnungen\meinGWB\GWBplugin.py", line 11, in initialize
   return cdll.gwbplugin.c_initialize(byref(self.plugin), c_char_p(app_name), c_char_p(file_name), c_char_p(cmds))
 File "C:\Python27-x64\lib\ctypes\__init__.py", line 436, in __getattr__
   dll = self._dlltype(name)
 File "C:\Python27-x64\lib\ctypes\__init__.py", line 366, in __init__
   self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] Das angegebene Modul wurde nicht gefunden
###############################I get the same result with Python 3.7.x and also when calling module react (in a different script). To me it appears that GWB is having trouble with my Python installation. The requested file C:\Python27-x64\lib\ctypes\__init__.py exists. I use GWB 12 Professional.
Thanks for help.
Helge
Â
Â
retrieval of fugacity using python
in The Geochemist's Workbench
Posted
It works. Thank you very much 🙂
Helge