New user seeking guidance of learning OGS 6 for reactive transport (PHREEQC & Porosity/Permeability Updates via Python?)

Hello OGS Community,

I’m a new user trying to learn OpenGeoSys for a specific modeling task, and I’m finding the initial learning curve quite challenging. I’d greatly appreciate some guidance.

My Background

I have some foundational knowledge of Python and have previously used like MODFLOW and PHREEQC.

My current work requires a reactive transport modeling. A key aspect is that the geochemical reactions (which may involve high salinity solutions potentially requiring Pitzer models) significantly alter the porous medium. Therefore, I need a modeling approach, likely using operator splitting, where I can update porosity/permeability based on the reaction results after each reactive step.

I’ve explored other software options but encountered limitations:
TOUGHREACT (Cost prohibitive for me), CrunchFlow (not support the Pitzer activity model), PHT3D (too old and it doesn’t support updating porosity and permeability), Custom Python Coupling COMSOL/MODFLOW and PHREEQC (I’ve attempted this, but it resulted in low computational efficiency and unsatisfactory results).

OpenGeoSys seems very powerful and potentially capable of handling these requirements, which is why I’m keen to learn it. However, after exploring the official website, I’m struggling to understand how to get started effectively.

My Specific Questions

  1. I see OGS offers both binary executables and Python tools (ogstools). Does using ogstools allow for a complete workflow within Python? Meaning, can I define the model setup (geometry, mesh generation/import, boundary conditions, parameters), run the simulation, and perform post-processing entirely using Python scripts, without directly interacting with the binary executable or manually editing input files?

  2. I’ve looked at the official website’s User Guide and Tutorials sections. While helpful, I haven’t found a comprehensive, step-by-step tutorial that guides a beginner through setting up a complete OGS 6 model from scratch, especially one demonstrating a Python-based workflow if that’s feasible. The available books seem to reference older versions or don’t focus on the Python aspect I’m interested in. Are there recommended learning paths or resources (specific tutorials, examples, documentation sections) aimed at beginners wanting to set up and run OGS 6 simulations, ideally showing how Python can be integrated?

  3. Is PHREEQC integration a built-in feature within OGS 6, or do I need to implement the coupling logic myself (calling PHREEQC externally, perhaps managed by a Python script coordinating OGS steps)?

  4. Can this custom updating porosity and permeability be defined and implemented directly using a Python interface/API provided by OGS, or does it fundamentally require modifying the OGS C++ source code and recompiling the software?

I apologize if these questions seem basic. OGS appears much more comprehensive and complex than the previous open-source tools I’ve encountered, and I’m feeling a bit overwhelmed navigating its capabilities.

Any pointers, clarifications, or directions towards relevant examples or documentation sections would be incredibly helpful.

Thank you for your time and assistance!

Hi,

thank you for your interest in OGS. I’ll try to answer your questions:

  1. In principle yes, you can set up and run an OGS model entirely with Python scripts using OGSTools. But I’d recommend first writing/modifying some OGS input files (*.prj) by hand before continuing with OGSTools. In particular the input file modifying features of OGSTools (the ogs6py module) are closely linked to the prj file structure. And many users do not set up OGS models entirely with Python from scratch, but take an existing prj file as a starting point and modify that either by hand or with os6py.
  2. The user guide and tutorials sections are the best starting point that we have. A step-by-step guide starting from zero and ending with a running model is missing, though. I’d recommend taking a simple example from the benchmark gallery as a basis, try to run it, modify it and re-run and cross-check the prj file settings with the user guide (especially the prj file building blocks). We have a comprehensive and more or less accessible documentation of all OGS input file parameters, too, see here.
    For setting up/modifying OGS models with Python, see OGSTools examples or e.g. this mechanics problem.
    Meshes can be created, e.g., with gmsh, and then converted to VTU for use with OGS with msh2vtu from OGSTools. For very simple meshes you could use PyVista for mesh creation and then extract boundaries and subdomains for boundary conditions and source terms (but make sure the required data is included in these extracted parts, see here).4.
  3. It’s built in. It’s used with the <chemical_system chemical_solver="Phreeqc"> setting in the prj file. See here for some examples.
  4. There is the setting <chemically_induced_porosity_change>. So, yes, porosity updates should be possible in principle. See the linked examples on this page.
    And it should be possible to define permeability as a function of porosity (see here for a similar example).
    I’ve never used these features, therefore the "should"s.

I hope that helps a bit.

Best regards,
Christoph

1 Like