Jump to content
Geochemist's Workbench Support Forum

JohanFourie

Members
  • Posts

    27
  • Joined

  • Last visited

Posts posted by JohanFourie

  1. Good day,

    I have switched to a new computer and now I cant get chemplugin to run on it

     

    This is the error message in python (spyder):

    FileNotFoundError: Could not find module 'chemplugin' (or one of its dependencies). Try using the full path with constructor syntax.

     

    The paths look ok (the same as on old computer)

     image.png.51b7a9bbfb665575dc838acb126de587.png

    The license is OK (as CP is now also part of GWB Pro?)

    image.png.139e3a70bc2f191fbb32597c136cb569.png

     

    Thanks for your help.

    Johan

     

     

  2. Hi Jia

    I am playing around with redox couples in chemplugin.

    See the attached dummy code.

     

    The Fe+++ is decoupled but 

    1) does the model read the specified kinetic rate? Did I wrote it correctly? Looks like there are 2 escape characters........

    cp.Config("kinetic redox-1 rxn = \" Fe++ + H+ + .25 O2(aq) -> Fe+++ + .5 H2O \" rate_con = 1e-12 mpower(Fe++) = 1 mpower(O2(aq)) = 1 apower(OH-) = 2  ") 
     

    2) It does not want to report Eh(Fe+++/Fe++). Probably because it didnt read the kinetic rate? Do I call it correctly below?

    cpReport1('Eh(Fe+++/Fe++)')

     

    I run it in Ipython in Spyder. I use thermo.com.v8.r6

    image.png.20fbbb118fc9307595ac5695823408f8.png

     

    Thanks!

    Johan

     

     

    JF_model_redox_to_GWB.py

  3. Hi Jia

    I haven't come right with "pickup". The model just does not want to converge after "pickup". Or maybe I don't apply it correctly - but I have tried several variations and could not get it running. I can send you a small dummy code if you want to see what I did wrong with pickup.

    As an alternative what I did, is to run the model initially by removing the O2 buffer altogether, adding "react O2" until I get the oxic conditions  - therefore creating a pseudo-O2buffer. My solution is not ideal as I add O2 constantly but it is not exactly constantly consumed over time. Then for the second run I "extend" the model (after "adjust" the kinetic mineral mass to the last remaining mass as "extend" keep equilibrium minerals but reset the kinetic mineral mass for some reason) and also "adjust_rate O2(aq) 0 mg/hour". 

    It is working and I get the oxic/anoxic transition, however it is quite cumbersome and I would be very glad if there was an eazy option to just "unfix" the O2 buffer. Do you think this will be something you guys might implement in future? 

    Regards

    Johan

    Edit: Using the cp.Report1("mass_reacted O2(aq)"," mg") function it was possible to adjust the amount of O2 put back to what was consumed in the previous time-step, creating a more realistic O2 buffer in Model 1 than the constant one. Still, it would be great if you guys could look into the "unfix" option.......

     

  4. Hi Brian

    I have not come right with this yet and would appreciate if you can help.

    To make the problem more tangible I have edited the chemplugin example: Flowthrough1.py and attached it here.

     

    1) The thermo database does not seem to need the escape character. In the attached python script I can run the 'surface data' without any escape character:

          'surface_data = "C:\Program Files\ChemPlugin\Gtdata\FeOH.sdat"',

    However, if you deactivate it with # and activate the wateqdatabase (for instance), with or without the escape character it does not work:

    'data = "C:\Program Files\Gwb\Gtdata\thermo_wateq4f.tdat" verify', 

     or

     'data = "C:\\Program Files\\Gwb\\Gtdata\\thermo_wateq4f.tdat" verify',

    I have tested it by changing a mineral name in the database i.e. calcite --> calcite2, however chemplugin couldn't read the database.

     

    2) Then I also cant get the script to run. I have tried different ways but cant get it to run.

    I dont know where is the problem. It is not maybe at the "….RETURN rate" part?

       #     "kinetic Calcite .1 volume% rate_law = script 'rate = (1.49e-02*EXP(-29000/(8.3144598*TK))*activity(\'H+\')^0.75 + 1.00e-02*EXP(-34800/(8.3144598*TK))*activity(\'H2CO3\')^0.75 + 2.20e-07*EXP(-52200/(8.3144598*TK))*activity(\'H2O\')^0.75) * surface * (1 - QoverK) RETURN rate' pre-exp = ??? act_eng = ??? surface = 200",
         

    My problem is that my real model have temperatures up to 220 C and I need to include to higher kinetic rate in some way or other. I have come right with the sliding temperature question I had in the other post and now my model can run at different temperature scenarios. I think chemplugin works great as it surely gives you a lot of flexibility to work with.

    Regards

    Johan

     

    FlowThrough_JF2.py

  5. "Hi Brian

    On 2/22/2019 at 10:03 AM, Brian Farrell said:

    By the way, it sounds like you're using ExtendRun() to daisy-chain a series of steady runs (each with a different flow rate) to simulate transient flow. You can, however, set up transient flow without the ExtendRun() function. For steady flow, call the “FlowRate()” member function once, before entering the time marching loop. For transient flow, alternatively, call “FlowRate()” at the head of each pass through the loop. 

     

    This works well for my model when changing the flowrate.

    But now I want to change a configuration of one of the instances also at a certain timestep.

    1) Can I still do it before the time marching loop (this doesn't seem to work) or should I use extend run if I want to change the configuration

    2) Have I done it correctly below or should I use the "remove" and "add" functions? Both temp and Br are already in the configuration - I just want to change their values.....

    3) Can one also use the "slide" function in chemplugin? I also tried it but chemplugin ignored it.

            

     for n in range(0, var_ScenFlow):                                                                                                   ………………………..for each flow scenario:

            if n == 1:                                                                                                                                          ……………………….not at the 0 flow scenario but for the 1 one
                var_Temp2 = var_Temp1                                                                                                      
                cp_reactor[2].Config("Temperature = " + str(var_Temp2) + " C")                                     ……………………...change the temperature in the configuration
                cp_reactor[2].Config("Br- = 1 mg/l")                                                                           ……………………….change the tracer concentration
           

           # Time marching loop.
            while True:
               for c in cp_reactor:
                    deltat = c.ReportTimeStep()

    …………….etc
                

  6. Hi Brian

    I tried different ways with the quotation marks. If I use single quotes, then there is no error, however chemplugin just ignores the line.

    I may have a similar problem when I want to assign a different database when using python. There is no error but chemplugin just ignores this and use the default database anyway, e.g.

    cmds = ('data = "C:\Program Files\ChemPlugin\Gtdata\thermo.com.V8.R6+_MRM_JF.tdat" ',          …...etc

    I have tried to use all different ways with the quotation marks but it doesn't help.

    Regards

    Johan

  7. Hi Brian

    We struggle to write a script in Chemplugin for the reaction rate of kinetic minerals. The script for dolomite is given below.

    Python also don't like the double notation: "H+" for the parameters.

     "kinetic Dolomite-Mn 12.1 volume% rate_law = script 'rate = (1.49e-02*EXP(-29000/(8.3144598*TK))*activity("H+")^0.75 + 1.00e-02*EXP(-34800/(8.3144598*TK))*activity("H2CO3")^0.75 + 2.20e-7*EXP(-52200/(8.3144598*TK))*activity("H2O")^0.75) * surface * (1 - QoverK) RETURN rate' pre-exp = ??? act_eng = ??? surface = .65"

    We would appreciate your help.

    Regards Johan

  8. Hi Brian

    We struggle to write a script in Chemplugin for the reaction rate of kinetic minerals. The script for dolomite is given below.

    Python also don't like the double notation: "H+" for the parameters.

     "kinetic Dolomite-Mn 12.1 volume% rate_law = script 'rate = (1.49e-02*EXP(-29000/(8.3144598*TK))*activity("H+")^0.75 + 1.00e-02*EXP(-34800/(8.3144598*TK))*activity("H2CO3")^0.75 + 2.20e-7*EXP(-52200/(8.3144598*TK))*activity("H2O")^0.75) * surface * (1 - QoverK) RETURN rate' pre-exp = ??? act_eng = ??? surface = .65"

    We would appreciate your help.

    Regards Johan

  9. From 1 user to another:

    GWB does not have the facility to include statistical distribution of parameters. 

    Option 1: Manually run various scenarios with consideration of the statistical distribution of the most sensitive parameters. Let say the 50, 66 and 95 percentile of a parameter. 

    Option 2: Write a code in Chemplugin that run several models for you with consideration of the statistical distribution of your parameter (which might even be a water balance component). I have not done it myself but think it is a great idea - but one would probably need a lot of time for the development of the code.

    If you have several parameters with several different distribution functions, I would say first try to simplify your conceptual model as much as possible...….

  10. Hi Vivek

    We also fit experimental data with GWB but the only way to do that is through manual calibration. We start with literature values for the rate constants and then use the surface area for calibration. You should also play around with the CO2 buffer as there might be some buildup of CO2 in the experiment I assume.

    Regards

    Johan

  11. Thank you Brian. After every run I update the flowrates between the instances and use Extendrun to start the new run. This is the only way I could see one can update the flowrates? I would like the new run to continue the model and not to change the composition of the previous run at endpoint. However, each run automatically starts with the original kinetic mineral content. As you can see in the figure above there is every 20 years an Extendrun() and with each run the calcite is at its original concentration.

    I suspect the pickup function works similiar to the other react functions in that it is not applicable to the chemplugin reactive transport model? I have tried to use all versions of pickpup (incl pickup system = entire) is it has no effect on the chemplugin transport model. I also see that commands like "add" and "remove" works for a mineral but not for kinetic minerals with ExtendRun().

    In X1t the kinetic minerals at the endpoint of the previous run is retained when the run is extended but I couldnt see that it is the case in Chemplugin?

    Regards

    Johan

×
×
  • Create New...