Jump to content
Geochemist's Workbench Support Forum

Brian Farrell

Admin
  • Posts

    1,056
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Brian Farrell

  1. Hi Zsófia,

    Thermo_ymp.R2.tdat uses the hmw formalism of the Pitzer equations, just like thermo_hmw.tdat and thermo_phrqpitz.tdat. Thermo_ymp.R2.tdat has some provision for working at elevated temperatures, and is designed to work at high ionic strength, so it could potentially work well for your application. Before using it, though, I recommend that you study the documentation to ensure you're working within the valid range of temperature and ionic strength. Please see 2.3 Thermodynamic datasets in the GWB Essentials Guide, as well as references cited in the dataset, for more information.

    For future reference, please post new topics to the front page of the forum. The archive is for older posts. It's easy to miss new questions that are added there.

    Hope this helps, 

    Brian Farrell
    Aqueous Solutions LLC

  2. Hi, 

    The Kd model implemented in most geochemical modeling software, including the GWB, is what is called the “reaction Kd model” or “activity Kd model”. The Kd approach as strictly defined (as you’d find in a purely hydrologic model) implies, but does not specify, a chemical reaction. In reaction modeling, we write a specific chemical reaction (such as >UO2++ = UO2++) and define Kd’, the apparent distribution coefficient, as the ratio of sorbed mass to the activity of the free ion, rather than the concentration of the entire component.

    For use in geochemical models, traditional Kd values need to be corrected by the value of the free ion’s activity coefficient, as well as the fraction of the component present as the free species. For more information, please see 9.1, Distribution coefficient (Kd) approach, in the Geochemical and Biogeochemical Reaction Modeling text. The Kd.sdat template, installed with the software in the Gtdata folder, provides a similar explanation in the notes. If you’re referring to the Pb-Kd.sdat file used in our RTM workshop and the GWB Online Academy, the workbook exercise description provides a true Kd value (units of cm3/g) and includes the information needed to convert that to the Kd’ (units of mol/g) specified in the surface dataset.

    The GWB does not account for changing Kd values with pH. A more robust approach would be to use a surface complexation model, which the GWB does indeed include. You can account not only for pH effects, but mass balance on the sorbing sites, competition of different ions for those sorbing sites, and electrostatic effects. A simple generalized composite approach to surface complexation modeling, if you can parameterize it, would likely be much better than any Kd model.

    Hope this helps,

    Brian Farrell
    Aqueous Solutions LLC
     

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

    Regards,

    Brian

  4. Hi Bob,

    There are a couple methods you  might try. One idea is to add the urea and molasses as simple reactants. Simple reactants are field variables, meaning the mass reacted can vary spatially. You might use the node-by-node editor to set the reactant mass everywhere in the domain to 0 except for the node containing the injection well. Keep in mind that simple reactants are added continuously throughout the simulation, though, unless you specify a cutoff value. I think you’d need a cutoff to ensure the urea and molasses are added only during the first 12 days. For more information, please see 3.1 “Titration paths” in the GWB Reaction Modeling Guide, the Heterogeneity Appendix in the GWB Reactive Transport Modeling Guide, and 9.89 “react” in the GWB Command Reference.

    Alternatively, you could define a new fluid for the urea and molasses solution (with negligibly small amounts of the rest of your basis entries) and add a new injection well. Beginning with GWB11, you can specify any number of wells within a single nodal block. X2t determines from the position you specify the nodal block a well would fall within, then uses the corresponding nodal point as the actual position. You could define two sources of fluid (the direct injection well and the recirculation well) where the mixed fluid is being injected. With wells, of course, you turn pumping on and off whenever you like, so the 12 day injection interval is no problem.

    I’m glad to hear you enjoyed the workshop at the Goldschmidt Conference. It was nice to meet you in person.

    Hope this helps,

    Brian Farrell
    Aqueous Solutions LLC
     

  5. 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
  6. Hi Oleh, 

    One strategy would be to set a simple kinetic rate law for the redox reaction between H2S and sulfite. If kinetic parameters are unknown, or time isn't particularly important, you could just use arbitrary values and ignore the time.

    If you want to use an equilibrium model, though, you'll probably have to rebalance the coupling reactions in your thermo dataset. Instead of coupling redox species H2S and sulfite to the basis species sulfate, you could set up a dataset with H2S or sulfite as a basis species, and the other two coupled to it. The TEdit app provides a convenient way to do this. It will rebalance any reactions that would be affected. For details, please see section 9.2.8, Exchanging species, in the GWB Essentials Guide.

    I'd have to see your script and thermo dataset to see why the other species aren't being loaded in your simulation.

    Finally, it's easy to miss posts in the archive. In the future, please add new topics to the main section of the GWB forum.

    Hope this helps,

    Brian Farrell
    Aqueous Solutions LLC

  7. Hi John, 

    I don’t quite understand. It sounded like a single React input file was producing different results in GWB8 vs. GWB11. But now you’re saying you’ve changed the Na+ and NO3- concentrations in the input as well? If you want me to see whether the software is behaving differently from one release to the next, I’ll need a consistent input file (.rea) that I can run myself. I need to see what database (and activity model) is used, how the model is set up, the units that are used, the species that are loaded, etc.

    Thanks,
    Brian
     

  8. Hi Fang,

    You’ll want to disable the redox coupling reaction between acetic acid and HCO3-. When you decouple acetic acid, it acts just like a basis species, so you can add it to SpecE8’s basis directly. You won’t be required to add O2(aq) to your basis, but if you do, the acetic acid won’t break down to other types of carbon species. If you need both O2(aq) and HCO3- in your basis (perhaps O2(g) and CO2(g) are in contact with your solution), you’ll probably want to disable all redox coupling reactions involving carbon. For more information, please see 2.4 Redox couples and 7.3 Redox disequilibrium in the GWB Essentials Guide.

    By the way, a dissolved oxygen measurement is almost always set as a “free constraint” (8 free mg/kg, referring to the O2(aq) species only, rather than 8 mg/kg, which would constrain the entire O2(aq) component). For more information, please see 7.1 Example calculation in the GWB Essentials Guide and 5.1 <unit> in the GWB Command Reference (or look for the same SpecE8 command in the GWB Reference Manual for older releases of the software).

    Regarding the charge imbalance, I think you’ll find the value is pretty miniscule. 

    Sometimes it’s possible to calculate the equilibrium pH of a fluid at a specified temperature using SpecE8. Other times you might know the pH at room temperature, so you can use it to constrain the initial condition of a sliding temperature path in React. It’s a really convenient option. For more information, please see section 3.4 Polythermal reaction paths in the GWB Reaction Modeling Guide.

    Hope this helps,

    Brian Farrell
    Aqueous Solutions LLC
     

  9. Hi Amanda,

    I took a look at your GSS file and your React script and noticed a few things. The React script was using the default thermo.tdat dataset, not the Phrqpitz dataset. You can check the dataset loaded in any app by going to File -> File Properties -> Thermo Data. It's possible you changed the thermo dataset in the Preferences dialog, but this only applies a preferred setting for every subsequent time you open a blank instance of an app. You need to use File -> Open to actually load a different dataset in an already open app.

    GSS does not allow supersaturated minerals to precipitate, so you should set up React to be consistent by disabling precipitation. You should similarly disable charge balancing in React to be consistent with GSS (or set GSS to balance on Cl-, to be consistent with React). For more information, please see 2.3 Initial system in the GWB Reaction Modeling Guide.

    The "flash" configuration is not enabled by default, so you need to turn that on from the Config -> Stepping dialog. Please see 3.7 "Flash diagrams" in the GWB Reaction Modeling Guide.

    I think the unit for Na+ in GSS is supposed to be mol/kg, not mmol/kg. You also have F- and B(OH)3 components in React, but not in your GSS spreadsheet. Just a tip, you can drag and drop a sample from GSS into React's Basis pane, or from React's basis pane into GSS. That makes it easy to quickly copy chemical data from one app to another.

    By the way, you can implement polythermal mixing in React by clicking the pulldown next to the temperature unit and changing it to "reactant mixing". Then, set the reactant temperature to the temperature of your reactant fluid. For more information, please see 3.4 Polythermal reaction paths in the GWB Reaction Modeling Guide.

    Hope this helps,

    Brian Farrell
    Aqueous Solutions
     

  10. Hi, 

    You can't add a reactant to a system unless that system already includes the components that make up the reactant. The components need to exist in the initial definition of the thermodynamic model, even if in a negligibly small concentration. All you have to do is set very small amounts of B(OH)3(aq), Li+, Mg++, etc. in the Basis. 

    Hope this helps,

    Brian Farrell
    Aqueous Solutions LLC

    • Upvote 1
  11. You're welcome. I'm glad to hear that you were able to use TEdit to make your dataset.

    Unfortunately, there is no ultimate dataset that is appropriate for everyone. There will always be tradeoffs between completeness and accuracy. Every user needs to be a judge of what data is appropriate for their specific applications.

    Cheers,
    Brian

  12. Hello,

    Thanks for providing your .dis and .bud files. X2t currently expects CONSTANT DELR, DELC, TOP, and BOTM. Your script has varying values for TOP, which is giving it trouble. It looks like the Reactive Transport Modeling Guide specifies that delta x and delta y in X2t need to be constant (taken from your DELC and DELR), but not the TOP and BOTM. We'll get the appendix updated.

    By the way, I also noticed your .dis file has multiple layers. X2t can only use a single layer, but as mentioned in the appendix, it will pick the uppermost layer.

    Hope this helps,

    Brian Farrell
    Aqueous Solutions LLC

     

  13. We are pleased to announce our latest maintenance release, GWB 12.0.3.
     
    The 12.0.3 update features support for Windows 10 2018 Creators Update; smaller installer size; better font and symbol support for east Asian locales; various improvements to plotting apps; correction of a glitch affecting some influx/efflux calculations in X1t and X2t; correction to an auditing issue when modeling retardation within stagnant zones; and fixes to a few issues in GSS in which copy/paste operations involve an “as” unit conversion.
     
    Update from 12.0.0 - 12.0.2 at no charge to ensure you have all the newest features and bug fixes. Existing installations should automatically update to this release, unless auto-update is disabled. In that case, users should update their installations from the Help menu of any GWB app.
     
    Regards,
     
    Brian Farrell
    Aqueous Solutions
  14. Hi Ellie, 

    There are two aspects to this question. First, in any run in which you have supersaturated minerals, React will report calculations for the metastable fluid (the first Xi = 0) block, as well as the "true" equilibrium state, in which supersaturated minerals have been allowed to precipitate (the second Xi = 0 block). Section 2.3 Initial system in the GWB Reaction Modeling Guide describes the differences between these two blocks of output, and suggests using input from a SpecE8 example (seawater.sp8) in React to compare the differences. In that example, the precipitation of dolomite and quartz from seawater alters the pH from its initial value. The scope of your modeling work will dictate which block of results is more appropriate.

    Second, if you trace an actual reaction path of some sort, for example, by titrating mass as a simple reactants, sliding the temperature, or sliding gas fugacity, React will report in its text output file results from various steps in the calculation (Xi = .1, Xi = .2, ..., Xi = 1). If you slide temperature from 0 to 100 C, for example, Xi = 0 corresponds to the initial system, Xi = .1 corresponds to the system heated to 10 C, and Xi = 1 corresponds to the end of the simulation, the system at 100 C. Understanding the entire reaction path is of course important, but often people care only about the results at the end of the calculation. Averaging values from different steps would not be useful.

    I assume these steps are what you're referring to, not the actual iterations within any single reaction step. Please let me know if you have any more questions.

    Regards,

    Brian

×
×
  • Create New...