Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
7f9fa60
Created utils repository and updated every import for mesh_doctor
alexbenedicto Dec 24, 2024
c7bc10a
Messages correction in io
alexbenedicto Jan 22, 2025
1948f60
All the initial files from the Makutu PR are added for future refacto…
alexbenedicto Jan 22, 2025
50c6f02
Refactoring mesh files
alexbenedicto Jan 25, 2025
7fa1d04
Moved solverutils to utils
alexbenedicto Jan 25, 2025
7cae0cd
Modified model directory structure + renamed vtkUtils into pyevtk_tools
alexbenedicto Jan 27, 2025
b3a8637
Adding acoustic / elastic modeling tools
alexbenedicto Feb 12, 2025
6735025
Merge branch 'main' of https://github.com/GEOS-DEV/geosPythonPackages…
alexbenedicto Feb 12, 2025
9bd7c4d
Correction exports and module names for pygeos-tools
alexbenedicto Feb 13, 2025
3bbfbd7
Change imports for geos-mesh
alexbenedicto Feb 13, 2025
5972c30
Support processing of included XML files
av-novikov Feb 25, 2025
cb666e4
Fix to wave prop modeling in p4 and p3. Also fix to allow use of pyth…
Victor-M-Gomes Mar 6, 2025
6ab34ef
Bug fix for io with VtkOutput
alexbenedicto Mar 8, 2025
d4a08bb
Format update io and GeosxArgs
alexbenedicto Mar 25, 2025
5990979
Error handling for class methods
alexbenedicto Mar 25, 2025
e1110db
Update XML class
alexbenedicto Mar 25, 2025
0166a7f
Update Solver base class with also the use of wrapper file
alexbenedicto Mar 25, 2025
9530ffc
Update WaveSolver
alexbenedicto Mar 25, 2025
7ea90d2
Update AcousticSolver
alexbenedicto Mar 26, 2025
bba1762
bug fix
alexbenedicto Mar 26, 2025
14ae4cb
Add minTime and maxTime handling
alexbenedicto Mar 26, 2025
55f6804
Update ElasticSolver
alexbenedicto Mar 26, 2025
bf3a827
Update ReservoirSolver
alexbenedicto Mar 29, 2025
512156e
Update GeomechanicsSolver
alexbenedicto Mar 31, 2025
bf3be8e
Update hinting of variables and methods
alexbenedicto Apr 1, 2025
ccb6b57
Add examples of scripts to pilot a GEOS simulation through pygeos usi…
alexbenedicto Apr 1, 2025
c8fa6dc
Add __doc__ at the beginning of scritps
alexbenedicto Apr 1, 2025
0112ad4
Moved examples inside utilities
alexbenedicto Apr 1, 2025
2ec5997
Change examples folder to solvers-examples
alexbenedicto Apr 1, 2025
176b03f
Moved all files outside of "utilities" folder and remove utilities fo…
alexbenedicto Apr 2, 2025
e124dbf
Update format of acquisition_library files
alexbenedicto Apr 2, 2025
f3ab221
Update format of Trace outputs
alexbenedicto Apr 2, 2025
f0f4e04
Update pyproject.toml
alexbenedicto Apr 3, 2025
762d100
Added .rst documentation
alexbenedicto Apr 3, 2025
6924879
Merge remote-tracking branch 'refs/remotes/origin/origin/feature/bene…
alexbenedicto Apr 3, 2025
2a3b83d
yapf formatting
alexbenedicto Apr 3, 2025
b0af0d6
Merge remote-tracking branch 'origin/main' into origin/feature/benedi…
alexbenedicto Apr 3, 2025
1d83a2d
yapf formatting + change minimum python version to 3.8
alexbenedicto Apr 3, 2025
b91259e
For pygeos-tools: update documentation, removed geos-utils/pygeos-too…
alexbenedicto Apr 4, 2025
85fc721
Move geos.utils.vtk to geos.mesh.vtk
alexbenedicto Apr 4, 2025
2adecdd
Update geos-mesh tests
alexbenedicto Apr 4, 2025
4c7e8bc
Update docs for pygeos-tools to remove warnings
alexbenedicto Apr 4, 2025
4ef5c35
Merge remote-tracking branch 'origin/main' into origin/feature/benedi…
alexbenedicto Apr 5, 2025
9555339
Exclude build directory when processing mypy checks + removed ruff ch…
alexbenedicto Apr 7, 2025
8b4aa25
Bugfix for tests + yapf formatting
alexbenedicto Apr 7, 2025
2d2bcb0
Merge remote-tracking branch 'origin/main' into origin/feature/benedi…
alexbenedicto Apr 7, 2025
a48b6cb
Remove conflict between ruff and mypy checking in classes.py
alexbenedicto Apr 7, 2025
fdce1fa
Fix build projects with invalid path
alexbenedicto Apr 10, 2025
5d9faef
Update documentation
alexbenedicto Apr 10, 2025
8ea6146
Merge remote-tracking branch 'origin/main' into origin/feature/benedi…
alexbenedicto Apr 10, 2025
0c5959b
Move checking of xml file from __init__ to initialize method
alexbenedicto Apr 11, 2025
95a4dff
Add examples for ReactiveCompositionalMultiphaseOBL solver
av-novikov Apr 14, 2025
c3edf00
Merge remote-tracking branch 'origin/main' into origin/feature/benedi…
alexbenedicto Apr 15, 2025
940e27e
Upgrade python version to 3.10
alexbenedicto Apr 15, 2025
3c26d90
Remove examples to check if CI cache build error still occurs
alexbenedicto Apr 15, 2025
a79a9b8
Merge remote-tracking branch 'origin/main' into origin/feature/benedi…
alexbenedicto Apr 16, 2025
4306dce
Readded the examples for obl provided by Aleks Novikov + moved all ex…
alexbenedicto Apr 16, 2025
d05f90b
Fix name of the *.xml in 2ph_comp example
av-novikov Apr 17, 2025
7950e43
Fix timestepping in OBL solver examples
av-novikov Apr 17, 2025
a62cf92
Rename folder with OBL examples
av-novikov Apr 17, 2025
d4db9e6
Updated example.rst and yapf formatting
alexbenedicto Apr 17, 2025
5d5ce74
Fix write_mesh
alexbenedicto Apr 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

# Add python modules to be documented
python_root = '..'
python_modules = ( 'geos-ats', 'geos-geomechanics', 'geos-mesh', 'geos-posp', 'geos-pv', 'geos-timehistory', 'geos-utils', 'geos-xml-tools', 'geos-xml-viewer', 'hdf5-wrapper', 'pygeos-tools' )
python_modules = ( 'geos-ats', 'geos-geomechanics', 'geos-mesh', 'geos-posp', 'geos-pv', 'geos-timehistory',
'geos-utils', 'geos-xml-tools', 'geos-xml-viewer', 'hdf5-wrapper', 'pygeos-tools' )


for m in python_modules:
Expand Down Expand Up @@ -49,7 +50,9 @@
]

autoclass_content = 'both'
autodoc_mock_imports = [ "ats", "colorcet", "h5py", "lxml", "matplotlib", "meshio", "mpi4py", "scipy", "pandas", "paraview", "pygeosx", "pylvarray", "vtk", "xmlschema", "xsdata", ]
autodoc_mock_imports = [ "ats", "colorcet", "h5py", "lxml", "matplotlib", "meshio", "mpi4py", "numba", "pandas",
"paraview", "pygeosx", "pyevtk", "pylvarray", "scipy", "segyio", "vtk", "xmlschema",
"xmltodict", "xsdata" ]
autodoc_typehints = 'none'
autodoc_typehints_format = 'short'
suppress_warnings = [ "autodoc.mocked_object" ]
Expand Down
45 changes: 34 additions & 11 deletions docs/pygeos-tools.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@

PyGEOS Tools
--------------------------
=============

The `pygeos-tools` python package adds a variety of tools for working with pygeosx objects.
These include common operations such as setting the value of geosx wrappers with python functions, parallel communication, and file IO.
Examples using these tools can be found here: `PYGEOSX Examples <https://geosx-geosx.readthedocs-hosted.com/en/latest/docs/sphinx/advancedExamples/pygeosxExamples/Index.html>`_ .

To get the pygeosx objects, you need to build your GEOS with pygeosx, using this command in your cmake file.

API
^^^^^
.. code-block:: cmake

.. automodule:: geos.pygeos_tools.wrapper
:members:
set(ENABLE_PYGEOSX ON CACHE BOOL "")

.. automodule:: geos.pygeos_tools.file_io
:members:

.. automodule:: geos.pygeos_tools.mesh_interpolation
:members:
**The python used to build GEOS with pygeosx will be the python to build the pygeos-tools.**
Once the correct python is selected, you need to run in your virtual environment.

.. automodule:: geos.pygeos_tools.well_log
:members:
.. code-block:: console

python -m pip install ./pygeos-tools/


.. toctree::
:maxdepth: 1
:caption: Contents

./pygeos_tools_docs/api.rst

./pygeos_tools_docs/acquisition_library.rst

./pygeos_tools_docs/input.rst

./pygeos_tools_docs/mesh.rst

./pygeos_tools_docs/model.rst

./pygeos_tools_docs/output.rst

./pygeos_tools_docs/solvers.rst


.. toctree::
:maxdepth: 1
:caption: Example

./pygeos_tools_docs/example.rst
37 changes: 37 additions & 0 deletions docs/pygeos_tools_docs/acquisition_library.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Acquisition library
===================

This package contain utilities for seismic acquisition.


Acquisition
-----------

.. automodule:: geos.pygeos_tools.acquisition_library.Acquisition
:members:
:undoc-members:
:show-inheritance:

EquispacedAcquisition
---------------------

.. automodule:: geos.pygeos_tools.acquisition_library.EquispacedAcquisition
:members:
:undoc-members:
:show-inheritance:

SegyAcquisition
---------------

.. automodule:: geos.pygeos_tools.acquisition_library.SegyAcquisition
:members:
:undoc-members:
:show-inheritance:

Shot
----

.. automodule:: geos.pygeos_tools.acquisition_library.Shot
:members:
:undoc-members:
:show-inheritance:
35 changes: 35 additions & 0 deletions docs/pygeos_tools_docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
API
====


Wrapper
-------

.. automodule:: geos.pygeos_tools.wrapper
:members:
:undoc-members:
:show-inheritance:

File IO
-------

.. automodule:: geos.pygeos_tools.file_io
:members:
:undoc-members:
:show-inheritance:

Mesh Interpolation
------------------

.. automodule:: geos.pygeos_tools.mesh_interpolation
:members:
:undoc-members:
:show-inheritance:

Well Log
--------

.. automodule:: geos.pygeos_tools.well_log
:members:
:undoc-members:
:show-inheritance:
166 changes: 166 additions & 0 deletions docs/pygeos_tools_docs/example.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
#################################################################################
Driving a reservoir simulation with Pygeos
#################################################################################


**Context**

In this example, we will use pygeos to control a CompositionalMultiphaseFVM solver throughout a GEOS simulation.
The goal is to reproduce the same results as if the simulation was launched directly through the XML file.

For the rest of this example, every part highlighting Python snippets will represent what is used to control pygeos and
how it is linked to the XML file.

The example python script for this documentation is the following:

.. code-block:: console

pygeos-tools/examples/solvers/reservoir_modeling.py


------------------------------------------------------------------
XML file and initialization of Solver object
------------------------------------------------------------------


The xml input file for the test case is located at:

.. code-block:: console

/path/to/your/GEOS/src/inputFiles/compositionalMultiphaseFlow/2ph_cap_1d_ihu.xml


After setting up the MPI communication and parsing all the args, we can set the XML object that has parsed our XML file.

.. code-block:: python

xmlfile = args.xml
xml = XML( xmlfile )


**Solver**

The simulation is performed using the GEOS general-purpose multiphase flow solver.
The solver can be found in the ``Solvers`` block.

.. code-block:: xml

<Solvers gravityVector="{0.38268, 0., -0.92388}">

<CompositionalMultiphaseFVM
name="compflow"
logLevel="1"
discretization="fluidTPFA"
targetRegions="{ Region1 }"
temperature="297.15">

<NonlinearSolverParameters
newtonTol="5e-4"
lineSearchAction="None"
newtonMaxIter="15"/>

<LinearSolverParameters
directParallel="0"/>

</CompositionalMultiphaseFVM>

</Solvers>


The important thing to note here is the solver type ``CompositionalMultiphaseFVM``.
Because we are dealing with a flow solver, which is not coupled, we can use the ``ReservoirSolver`` class to pilot the simulation.

.. code-block:: python

solver = ReservoirSolver( "CompositionalMultiphaseFVM" )
solver.initialize( rank=rank, xml=xml )
solver.applyInitialConditions()


**Events**

To trigger the timestepping of the solver and the different outputs to perform, the "Events" block is the following:

.. code-block:: xml

<Events
maxTime="1.0368e8">

<PeriodicEvent
name="outputs"
timeFrequency="1.728e6"
target="/Outputs/vtkOutput"/>

<PeriodicEvent
name="solverApplications1"
forceDt="1.728e6"
target="/Solvers/compflow"/>

<PeriodicEvent
name="restarts"
timeFrequency="3e7"
targetExactTimestep="0"
target="/Outputs/restartOutput"/>

</Events>


The first attribute to use is ``maxTime`` which will be the limit for the simulation.
The ``solverApplications1`` event targets the ``CompositionalMultiphaseFVM`` solver that we are using.
This block contains a ``forceDt`` attribute that will be used later to choose as the timestep of the simulation.

.. code-block:: python

solver.setDtFromTimeVariable( "forceDt" ) # solver.dt = 1.728e6
solver.setMaxTime( solver.getTimeVariables()[ "maxTime" ] ) # solver.maxTime = 1.0368e8


The "outputs" event triggers the output of the vtk files. The attribute "timeFrequency" has the same value as "forceDt"
so we can use the same timestep for the solver and the outputs.
To start, we will set the time to 0.0 and trigger one output of the vtk files.

.. code-block:: python

time = 0.0
solver.outputVtk( time )


------------------------------------------------------------------
Iterations process and simulation end
------------------------------------------------------------------

The iterative process organizes the execution of the solver at each timestep while not exceeding the maxTime of the simulation.
Once done, the simulation is ended by calling the ``cleanup`` method.

.. code-block:: python

while time < solver.maxTime:
solver.execute( time )
solver.outputVtk( time )
time += solver.dt
solver.cleanup( time )


More complex timestepping strategies can be implemented by modifying the timestep duration and the outputs.


------------------------------------------------------------------
How to run that script
------------------------------------------------------------------

Using the same python used to build your GEOS installation with, run this command:

.. code-block:: console

python pygeos-tools/examples/solvers/reservoir_modeling.py
--xml /path/to/your/GEOS/src/inputFiles/compositionalMultiphaseFlow/2ph_cap_1d_ihu.xml


------------------------------------------------------------------
To go further
------------------------------------------------------------------


**Feedback on this example**

For any feedback on this example, please submit a `GitHub issue on the project's GitHub page <https://github.com/GEOS-DEV/geosPythonPackages/issues>`_.
23 changes: 23 additions & 0 deletions docs/pygeos_tools_docs/input.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Input
=====

This packages has utilities for handling the two principal arguments of GEOS:
- the XML file that will be used to setup GEOS simulation
- the Geos args which are -i input, partitions ...


GeosxArgs
---------

.. automodule:: geos.pygeos_tools.input.GeosxArgs
:members:
:undoc-members:
:show-inheritance:

Xml
---

.. automodule:: geos.pygeos_tools.input.Xml
:members:
:undoc-members:
:show-inheritance:
23 changes: 23 additions & 0 deletions docs/pygeos_tools_docs/mesh.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Mesh
====

This packages has utilities to handle the two different mesh formats to use in GEOS:
- InternalMesh that is provided by GEOS
- VtkMesh that is imported by GEOS


InternalMesh
------------

.. automodule:: geos.pygeos_tools.mesh.InternalMesh
:members:
:undoc-members:
:show-inheritance:

VtkMesh
-------

.. automodule:: geos.pygeos_tools.mesh.VtkMesh
:members:
:undoc-members:
:show-inheritance:
27 changes: 27 additions & 0 deletions docs/pygeos_tools_docs/model.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Model
=====


pyevtk_tools
------------

.. automodule:: geos.pygeos_tools.model.pyevtk_tools
:members:
:undoc-members:
:show-inheritance:

SepModel
--------

.. automodule:: geos.pygeos_tools.model.SepModel
:members:
:undoc-members:
:show-inheritance:

VtkModel
--------

.. automodule:: geos.pygeos_tools.model.VtkModel
:members:
:undoc-members:
:show-inheritance:
Loading