Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions docs/pygeos_tools_docs/Example/reservoir.rst
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the doc for pygeos-examples is generic and is not related to a specific python file, I am not sure having pygeos_tools_docs /Example/reservoir.rst is necessary. Maybe a example.rst file in pygeos_tools_docs is ok.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The example python script for this documentation is the following:

.. code-block:: console

pygeos-tools/src/solvers_examples/reservoir_modeling.py
pygeos-tools/examples/solvers/reservoir_modeling.py


------------------------------------------------------------------
Expand Down Expand Up @@ -152,7 +152,7 @@ Using the same python used to build your GEOS installation with, run this comman

.. code-block:: console

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


Expand Down
213 changes: 213 additions & 0 deletions pygeos-tools/examples/obl/2ph_comp/input_file_adaptative.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
<?xml version="1.0"?>
<Problem>
<Solvers>
<ReactiveCompositionalMultiphaseOBL
name="compflow"
logLevel="1"
discretization="fluidTPFA"
targetRegions="{Region1}"
enableEnergyBalance="0"
maxCompFractionChange="1"
numComponents="3"
numPhases="2"
transMultExp="1">
<NonlinearSolverParameters
timeStepDecreaseFactor="0.5"
newtonTol="0.0001"
newtonMaxIter="25"/>
<LinearSolverParameters
directParallel="0"/>
</ReactiveCompositionalMultiphaseOBL>
</Solvers>

<Mesh>
<InternalMesh
name="mesh1"
elementTypes="{C3D8}"
xCoords="{0.0, 500.0}"
yCoords="{0.0, 500.0}"
zCoords="{0.0, 20.0}"
nx="{25}"
ny="{25}"
nz="{1}"
cellBlockNames="{block1}"/>
</Mesh>

<Geometry>
<Box
name="inj1"
xMin="{-0.2, -0.2, -0.2}"
xMax="{20.2, 20.2, 20.2}"/>
<Box
name="prd1"
xMin="{479.8, 479.8, -0.1999999999999993}"
xMax="{500.2, 500.2, 20.2}"/>
</Geometry>

<Constitutive>
<CompressibleSolidConstantPermeability
name="rock"
solidModelName="nullSolid"
porosityModelName="rockPorosity"
permeabilityModelName="rockPerm"/>
<NullModel
name="nullSolid"/>
<PressurePorosity
name="rockPorosity"
defaultReferencePorosity="0.3"
referencePressure="5000000.0"
compressibility="1e-09"/>
<ConstantPermeability
name="rockPerm"
permeabilityComponents="{9.869e-14, 9.869e-14, 9.869e-14}"/>
<OBLFluid
name="fluid"
interpolatorMode="adaptive"
interpolatorType="multilinear"/>
</Constitutive>

<Events
maxTime="31536000.0">
<!--PeriodicEvent
name="outputs"
timeFrequency="2592000.0"
target="/Outputs/vtkOutput"/-->
<PeriodicEvent
name="solver_1"
forceDt="86400.0"
endTime="604800.0"
target="/Solvers/compflow"/>
<PeriodicEvent
name="solver_2"
forceDt="1209600.0"
beginTime="604800.0"
target="/Solvers/compflow"/>
</Events>

<Outputs>
<VTK name="vtkOutput"/>
</Outputs>

<NumericalMethods>
<FiniteVolume>
<TwoPointFluxApproximation name="fluidTPFA"/>
</FiniteVolume>
</NumericalMethods>

<ElementRegions>
<CellElementRegion
name="Region1"
cellBlocks="{block1}"
materialList="{rock, fluid}"/>
</ElementRegions>

<FieldSpecifications>
<FieldSpecification
name="Region1InitialPressure"
initialCondition="1"
setNames="{ all }"
objectPath="ElementRegions/Region1"
fieldName="pressure"
scale="5000000.0"/>
<FieldSpecification
name="Region1InitialTemp"
initialCondition="1"
setNames="{ all }"
objectPath="ElementRegions/Region1"
fieldName="temperature"
scale="348.15"/>
<FieldSpecification
name="Region1InitCO2"
initialCondition="1"
setNames="{ all }"
objectPath="ElementRegions/Region1"
fieldName="globalCompFraction"
component="0"
scale="0.1"/>
<FieldSpecification
name="Region1InitC1"
initialCondition="1"
setNames="{ all }"
objectPath="ElementRegions/Region1"
fieldName="globalCompFraction"
component="1"
scale="0.2"/>
<FieldSpecification
name="Region1InitH2O"
initialCondition="1"
setNames="{ all }"
objectPath="ElementRegions/Region1"
fieldName="globalCompFraction"
component="2"
scale="0.7"/>

<FieldSpecification
name="inj1Pressure"
objectPath="ElementRegions/Region1"
fieldName="pressure"
scale="14000000.0"
setNames="{ inj1 }"/>
<FieldSpecification
name="inj1TermTemp"
setNames="{ inj1 }"
objectPath="ElementRegions/Region1"
fieldName="temperature"
scale="348.15"/>
<FieldSpecification
name="inj1CO2"
setNames="{ inj1 }"
objectPath="ElementRegions/Region1"
fieldName="globalCompFraction"
component="0"
scale="0.99999998"/>
<FieldSpecification
name="inj1C1"
setNames="{ inj1 }"
objectPath="ElementRegions/Region1"
fieldName="globalCompFraction"
component="1"
scale="1e-08"/>
<FieldSpecification
name="inj1H2O"
setNames="{ inj1 }"
objectPath="ElementRegions/Region1"
fieldName="globalCompFraction"
component="2"
scale="1e-08"/>

<FieldSpecification
name="prd1Pressure"
objectPath="ElementRegions/Region1"
fieldName="pressure"
scale="5000000.0"
setNames="{ prd1 }"/>
<FieldSpecification
name="prd1TermTemp"
setNames="{ prd1 }"
objectPath="ElementRegions/Region1"
fieldName="temperature"
scale="348.15"/>
<FieldSpecification
name="prd1CO2"
setNames="{ prd1 }"
objectPath="ElementRegions/Region1"
fieldName="globalCompFraction"
component="0"
scale="0.99999998"/>
<FieldSpecification
name="prd1C1"
setNames="{ prd1 }"
objectPath="ElementRegions/Region1"
fieldName="globalCompFraction"
component="1"
scale="1e-08"/>
<FieldSpecification
name="prd1H2O"
setNames="{ prd1 }"
objectPath="ElementRegions/Region1"
fieldName="globalCompFraction"
component="2"
scale="1e-08"/>
</FieldSpecifications>

</Problem>
117 changes: 117 additions & 0 deletions pygeos-tools/examples/obl/2ph_comp/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# ------------------------------------------------------------------------------------------------------------
# SPDX-License-Identifier: LGPL-2.1-only
#
# Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
# Copyright (c) 2018-2024 TotalEnergies
# Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
# Copyright (c) 2023-2024 Chevron
# Copyright (c) 2019- GEOS/GEOSX Contributors
# Copyright (c) 2019- INRIA project-team Makutu
# All rights reserved
#
# See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
# ------------------------------------------------------------------------------------------------------------

# ---------------------------------------- README ----------------------------------------
# Requires 'python -m pip install open-darts' and GEOS branch feature/anovikov/adaptive_obl
# to run this example.
# This is two-phase three-component model with fluid defined by constant K values.

import numpy as np
from mpi4py import MPI

from geos.pygeos_tools.input import XML
from geos.pygeos_tools.solvers import ReservoirSolver

from darts.models.darts_model import DartsModel
from darts.physics.super.physics import Compositional
from darts.physics.super.property_container import PropertyContainer
from darts.physics.properties.flash import ConstantK
from darts.physics.properties.basic import ConstFunc, PhaseRelPerm
from darts.physics.properties.density import DensityBasic


class Model( DartsModel ):

def __init__( self, n_points=50 ):
# Call base class constructor
super().__init__()
self.n_obl_points = n_points
self.set_physics()

def set_physics( self ):
"""Physical properties"""
self.zero = 1e-8
# Create property containers:
components = [ 'CO2', 'C1', 'H2O' ]
phases = [ 'gas', 'oil' ]
thermal = 0
Mw = [ 44.01, 16.04, 18.015 ]

property_container = PropertyContainer( phases_name=phases,
components_name=components,
Mw=Mw,
min_z=self.zero / 10,
temperature=1. )
""" properties correlations """
property_container.flash_ev = ConstantK( len( components ), [ 4, 2, 1e-1 ], self.zero )
property_container.density_ev = dict( [ ( 'gas', DensityBasic( compr=1e-3, dens0=200 ) ),
( 'oil', DensityBasic( compr=1e-5, dens0=600 ) ) ] )
property_container.viscosity_ev = dict( [ ( 'gas', ConstFunc( 0.05 ) ), ( 'oil', ConstFunc( 0.5 ) ) ] )
property_container.rel_perm_ev = dict( [ ( 'gas', PhaseRelPerm( "gas" ) ), ( 'oil', PhaseRelPerm( "oil" ) ) ] )
""" Activate physics """
self.physics = Compositional( components,
phases,
self.timer,
n_points=self.n_obl_points,
min_p=1,
max_p=300,
min_z=self.zero / 10,
max_z=1 - self.zero / 10 )
self.physics.add_property_region( property_container )
self.engine = self.physics.init_physics( platform='cpu' )
return


def run_darts_model( xml_name: str, darts_model=None ):
comm = MPI.COMM_WORLD
rank = comm.Get_rank()

xml = XML( xml_name )

solver = ReservoirSolver( solverType="ReactiveCompositionalMultiphaseOBL" )
solver.initialize( rank=rank, xml=xml )

# connect solver to Python-based operators
functions = solver.geosx.get_group( "/Functions" ).groups()
for func in functions:
if hasattr( func, 'setAxes' ) and darts_model is not None:
func.setAxes( darts_model.physics.n_vars, darts_model.physics.n_ops, list( darts_model.physics.axes_min ),
list( darts_model.physics.axes_max ), list( darts_model.physics.n_axes_points ) )
func.setEvaluateFunction( darts_model.physics.reservoir_operators[ 0 ].evaluate )
print( "Adaptive OBL interpolator is configured." )

solver.applyInitialConditions()
solver.setDtFromTimeVariable( "forceDt" )
solver.setMaxTime( solver.getTimeVariables()[ "maxTime" ] )

time: float = 0
cycle: int = 0

solver.outputVtk( time )
while time < solver.maxTime:
if rank == 0:
if solver.dt is not None:
print( f"time = {time:.3f}s, dt = {solver.getDt():.4f}, iter = {cycle + 1}" )
solver.execute( time )
solver.outputVtk( time )
time += solver.dt
cycle += 1
solver.cleanup( time )


if __name__ == "__main__":
# run adaptive OBL
print( "\n" + "=" * 30 + " RUNNING ADAPTIVE OBL " + "=" * 30 + "\n" )
darts_model = Model()
run_darts_model( xml_name="input_file_adaptive.xml", darts_model=darts_model )
Loading
Loading