-
Notifications
You must be signed in to change notification settings - Fork 485
A new X-MeshGraphNet example for reservoir simulation. #1186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tonishi-nv
wants to merge
75
commits into
NVIDIA:main
Choose a base branch
from
tonishi-nv:tonishi/xmgn_ressim
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
cd58455
X-MGN for reservoir simulation
tonishi-nv 784342c
installation bug fix
tonishi-nv b6c172f
well object docstring fix
tonishi-nv 388ce1c
more well object docstring fix
tonishi-nv bbe573e
improve path_utils
tonishi-nv 65d335a
fix while space in config
tonishi-nv e4cf2ce
fix version inconsistency in requirement.txt
tonishi-nv 95b1aac
add versions for some libs in requirement.txt
tonishi-nv 91b56f4
improve exception handling in mldlow_utils
tonishi-nv 7508549
improve mldlow_utils
tonishi-nv a2cdfaf
improve datetiem in mlflow_utils
tonishi-nv be88a7d
improve exception handling in inference
tonishi-nv 97613c2
improve inference
tonishi-nv bb0bd8a
improve ecl_reader
tonishi-nv 69d82dd
formatting
tonishi-nv f635750
improve preprocessor
tonishi-nv b8b6003
improve preprocessor loop
tonishi-nv 8ce3778
fmt
tonishi-nv d705514
fmt
tonishi-nv 803c377
fmt
tonishi-nv 0c910f9
fmt
tonishi-nv 0635fd1
grad accum bug fix
tonishi-nv 8a73d0b
total loss bug fix
tonishi-nv db2e534
added some safe guard for connection indexing
tonishi-nv 37aa62e
fmt
tonishi-nv 616c78d
bug fix
tonishi-nv 8c5a8dc
bug fix
tonishi-nv 048d693
cleanup
tonishi-nv bb2fc5d
fmt
tonishi-nv 444d92f
update ecl_reader
tonishi-nv 6c524e1
cleanup utils
tonishi-nv 295cf6b
cleanup
tonishi-nv 76cf0a0
cleanup
tonishi-nv 17e44e8
update configs
tonishi-nv d81302c
Update README.md
megnvidia f2c87d3
Update README.md
megnvidia 0656882
Merge branch 'main' into tonishi/xmgn_ressim
tonishi-nv a3109b4
fmt
tonishi-nv ba5e928
improve docstring fmt
tonishi-nv 2a0e61b
update license yr
tonishi-nv 1d8cf62
cleanup well
tonishi-nv c1c9edf
cleanup preproc fmt
tonishi-nv c95f833
cleanup preproc fmt
tonishi-nv cec0923
cimprove infrence fmt
tonishi-nv 859a651
improve datetime
tonishi-nv fcc5420
improve readme fmt
tonishi-nv d492de4
improve readme
tonishi-nv 84b3e6f
improve train.py fmt
tonishi-nv 744cabd
improve readme fmt
tonishi-nv 271fabb
improve requirement
tonishi-nv b29cf29
ilcense header
tonishi-nv 7279bd0
improve ecl reader logging
tonishi-nv 5bdeac1
cleanup
tonishi-nv 149c6c0
license header
tonishi-nv 965f0ca
improve graph builder (parallel) + added results to readme
tonishi-nv 3978c9f
delete some unsed files
tonishi-nv bdfc71c
address PR comments
tonishi-nv 21bcf76
improve inference grdecl header
tonishi-nv a69ed40
improve readme
tonishi-nv 4e00639
improve readme
tonishi-nv d15ccab
support time series
tonishi-nv c000f8d
update config
tonishi-nv ba4d4e2
minor update
tonishi-nv f95a29e
improve graph builder
tonishi-nv 3757239
update ecl_reader logging
tonishi-nv 37f9e51
replace pickle with json
tonishi-nv c0fda34
add license headers
tonishi-nv 4bb9df4
remove unused png files
tonishi-nv e612159
remove unsed import
tonishi-nv f1e73b5
remove emojis
tonishi-nv 9eed676
replace print with logger
tonishi-nv b73a2d4
update docstring
tonishi-nv 8415fbe
update readme
tonishi-nv 0914876
minor updates
tonishi-nv 04e7706
update readme
tonishi-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| # Simulation Utilities | ||
|
|
||
| ## Overview | ||
|
|
||
| The `sim_utils` package provides utilities for processing ECL/IX style binary | ||
| output files to prepare datasets for training. These scripts can read industry | ||
| standard simulator output formats (ECLIPSE, IX, OPM) and convert them into | ||
| various data structures suitable for different ML architectures. | ||
|
|
||
| ## Supported Formats | ||
|
|
||
| - `.INIT` | ||
| - `.EGRID` | ||
| - `.UNRST` or `.X00xx` | ||
| - `.UNSMRY` or `.S00xx` | ||
|
|
||
| ## Modules | ||
|
|
||
| ### `ecl_reader.py` | ||
|
|
||
| Main class for reading ECLIPSE-style binary output files. | ||
|
|
||
| **Usage**: | ||
|
|
||
| ```python | ||
| from sim_utils import EclReader | ||
tonishi-nv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Initialize reader with case name | ||
| reader = EclReader("path/to/CASE.DATA") | ||
|
|
||
| # Read static properties | ||
| init_data = reader.read_init(["PORV", "PERMX", "PERMY", "PERMZ"]) | ||
|
|
||
| # Read grid geometry | ||
| egrid_data = reader.read_egrid(["COORD", "ZCORN", "FILEHEAD", "NNC1", "NNC2"]) | ||
|
|
||
| # Read dynamic properties (all timesteps) | ||
| restart_data = reader.read_restart(["PRESSURE", "SWAT", "SGAS"]) | ||
| ``` | ||
|
|
||
| **Common Keywords**: | ||
|
|
||
| Static properties (INIT): | ||
|
|
||
| - `PORV`: Pore volume | ||
| - `PERMX`, `PERMY`, `PERMZ`: Permeability in X, Y, Z directions | ||
| - `PORO`: Porosity | ||
| - `TRANX`, `TRANY`, `TRANZ`: Transmissibility in X, Y, Z directions | ||
|
|
||
| Dynamic properties (UNRST): | ||
|
|
||
| - `PRESSURE`: Cell pressure | ||
| - `SWAT`: Water saturation | ||
| - `SGAS`: Gas saturation | ||
| - `SOIL`: Oil saturation | ||
|
|
||
| Grid geometry (EGRID): | ||
|
|
||
| - `COORD`: Grid pillar coordinates | ||
| - `ZCORN`: Grid corner depths | ||
| - `FILEHEAD`: File header information | ||
| - `NNC1`, `NNC2`: Non-neighboring connections | ||
|
|
||
| ### `grid.py` | ||
|
|
||
| **Grid** - Handles reservoir grid structure and operations. | ||
|
|
||
| **Features**: | ||
|
|
||
| - Grid dimensions and active cells | ||
| - Cell center coordinates computation | ||
| - Connection/edge computation for graph construction | ||
| - Aggregating directional transmissibilities for edge features | ||
| - Non-Neighboring Connections (NNC) | ||
| - Well completion arrays | ||
|
|
||
| **Usage**: | ||
|
|
||
| ```python | ||
| from sim_utils import Grid | ||
tonishi-nv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Initialize grid from simulation data | ||
| grid = Grid(init_data, egrid_data) | ||
|
|
||
| # Get connections and transmissibilities for graph construction | ||
| connections, transmissibilities = grid.get_conx_tran() | ||
|
|
||
| # Create completion arrays for wells | ||
| completion_inj, completion_prd = grid.create_completion_array(wells) | ||
|
|
||
| # Access grid properties | ||
| print(f"Grid dimensions: {grid.nx} x {grid.ny} x {grid.nz}") | ||
| print(f"Active cells: {grid.nact}") | ||
| print(f"Cell coordinates: X={grid.X}, Y={grid.Y}, Z={grid.Z}") | ||
| ``` | ||
|
|
||
| ### `well.py` | ||
|
|
||
| **Well** and **Completion** - Well and completion data structures. Typically, | ||
| use results from `UNRST` (well name, type, status, I, J, K, etc.) to | ||
| instantiate the object. | ||
|
|
||
| **Usage**: | ||
|
|
||
| ```python | ||
| from sim_utils import Well, Completion | ||
tonishi-nv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Create a well | ||
| well = Well(name="INJ1", type_id=3, stat=1) # Water injector | ||
|
|
||
| # Add completions | ||
| well.add_completion( | ||
| I=10, # Grid I-index | ||
| J=10, # Grid J-index | ||
| K=5, # Grid K-index | ||
| dir=3, # Direction (1=X, 2=Y, 3=Z) | ||
| stat=1, # Status (1=OPEN) | ||
| conx_factor=1.0 # Connection factor | ||
| ) | ||
|
|
||
| # Check well properties | ||
| print(f"Well type: {well.type}") # 'INJ' or 'PRD' | ||
| print(f"Well status: {well.status}") # 'OPEN' or 'SHUT' | ||
| print(f"Number of completions: {len(well.completions)}") | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2023 - 2024 NVIDIA CORPORATION & AFFILIATES. | ||
| # SPDX-FileCopyrightText: All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """ | ||
| Reservoir Utilities | ||
|
|
||
| Shared utilities for processing reservoir simulation data across different | ||
| machine learning architectures (XMeshGraphNet, FNO, DeepONet, etc.). | ||
|
|
||
| This package contains: | ||
| - ecl_reader: Read ECLIPSE-style simulation output files (.INIT, .EGRID, .UNRST, etc.) | ||
| - grid: Grid data structures and operations for reservoir simulations | ||
| - well: Well and completion data structures | ||
| """ | ||
|
|
||
| from .ecl_reader import EclReader | ||
| from .grid import Grid | ||
| from .well import Well, Completion | ||
|
|
||
| __all__ = ["EclReader", "Grid", "Well", "Completion"] | ||
tonishi-nv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| __version__ = "1.0.0" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.