Skip to main content

OPM-Simulators Python bindings

Project description

Python bindings for the OPM-common module of the Open Porous Media project.

To compile with python support:

  • Add the cmake flags -DOPM_ENABLE_PYTHON=ON and -DOPM_INSTALL_PYTHON=ON
  • Optionally add prefix -DCMAKE_INSTALL_PREFIX=/opt/opm to install outside the standard distro directories
  • Optionally specify python binary -DPython3_EXECUTABLE=/home/user/miniconda3/envs/rkt/bin/python3 if you don't want to use the system python, e.g. use a python from pyenv or from a conda environment

Sample compilation on linux:

#! /bin/bash

flags="-DPython3_EXECUTABLE=/home/hakon/miniconda3/envs/rkt/bin/python3 -DOPM_ENABLE_PYTHON=ON -DOPM_INSTALL_PYTHON=ON -DCMAKE_INSTALL_PREFIX=/opt/opm"
for repo in opm-common opm-grid opm-models opm-simulators
do
    cd "$repo"
    mkdir -p build
    cd build
    cmake  $flags ..
    make -j8
    sudo make install
    cd ..
    cd ..
done

Then you should be able to use the module from a Python script. If you installed in a non-standard directory by specifying -DCMAKE_INSTALL_PREFIX you may need to set the PYTHONPATH environment variable before running your Python script, for example:

$ PYTHONPATH=/opt/opm/lib/python3.11/site-packages python3 spe1case1.py

and spe1case1.py could be:

import os
from opm.simulators import BlackOilSimulator
from opm.io.parser import Parser
from opm.io.ecl_state import EclipseState
from opm.io.schedule import Schedule
from opm.io.summary import SummaryConfig

os.chdir("SPE1CASE1")
deck  = Parser().parse('SPE1CASE1.DATA')
state = EclipseState(deck)
schedule = Schedule( deck, state )
summary_config = SummaryConfig(deck, state, schedule)

sim = BlackOilSimulator(deck, state, schedule, summary_config)
sim.step_init()
sim.step()
poro = sim.get_porosity()
poro = poro *.95
sim.set_porosity(poro)
sim.step()
sim.step_cleanup()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

opm_simulators-2024.10-cp312-cp312-manylinux_2_28_x86_64.whl (16.2 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

opm_simulators-2024.10-cp311-cp311-manylinux_2_28_x86_64.whl (16.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

opm_simulators-2024.10-cp310-cp310-manylinux_2_28_x86_64.whl (16.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

opm_simulators-2024.10-cp39-cp39-manylinux_2_28_x86_64.whl (16.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

opm_simulators-2024.10-cp38-cp38-manylinux_2_28_x86_64.whl (16.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

opm_simulators-2024.10-cp37-cp37m-manylinux_2_28_x86_64.whl (16.2 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.28+ x86-64

opm_simulators-2024.10-cp36-cp36m-manylinux_2_28_x86_64.whl (16.2 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.28+ x86-64

File details

Details for the file opm_simulators-2024.10-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for opm_simulators-2024.10-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 773dadb35314ba1d5f49f831f2e932b09126b971a74293c34acd4721ff8f3736
MD5 41fd1913dfab2a3d0d1673f3bf8b4473
BLAKE2b-256 7590ef35c2593b7596c34d99ad1dbc8e3e188a0275dc43db0225c9b1b2d4bee7

See more details on using hashes here.

File details

Details for the file opm_simulators-2024.10-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for opm_simulators-2024.10-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 84f3fb61225cc8fc204c64966fb80e5c999795ba1edeb055d0cb0c793f3f7dea
MD5 6137066a21cec5852c645d298239f609
BLAKE2b-256 7fc72c11b7b8da8147ad90e94d50306a99c2a72400f9794bf378bb7d7b0f1531

See more details on using hashes here.

File details

Details for the file opm_simulators-2024.10-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for opm_simulators-2024.10-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a85eb2d9a7fccbf1f4c8baba20b60873746886d1e30c094792b488727153ca19
MD5 33c7727e24f1af4e71b602908df8cf6b
BLAKE2b-256 f103051646dcac5eda720b55f7721f715bb417357ef45326bb423ed629dfcfe1

See more details on using hashes here.

File details

Details for the file opm_simulators-2024.10-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for opm_simulators-2024.10-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6b4f5945e8e1be9c36149d2c8ad38856d428516685ac4a70969ccc5224f2c8c6
MD5 9bfbfc7b4d6ff80a21843798ee7a0133
BLAKE2b-256 b381b0850a39b2a22cbe78dd08c08255a28168cd84c7548244f895beb63a9d6c

See more details on using hashes here.

File details

Details for the file opm_simulators-2024.10-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for opm_simulators-2024.10-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 39617eac37b5319c0e15bf73d7675a14b3500de354cd927d50fd6e9921bac898
MD5 b9c498bc89c9c36144381f6389b11506
BLAKE2b-256 740946dd7eb4fcc6c57ec4ba622189e46af174e6334dc31d5bf01916749ad732

See more details on using hashes here.

File details

Details for the file opm_simulators-2024.10-cp37-cp37m-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for opm_simulators-2024.10-cp37-cp37m-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5633f2399cd8a669e6b14af53ca136f591afc1b42c2ee1a4c1521f08c702a60b
MD5 fa4239d18f245baea5923b7737e0fa16
BLAKE2b-256 0a73e9a766948e675e2049786942d5caebc23703460774b6e54b6dbd50555c7a

See more details on using hashes here.

File details

Details for the file opm_simulators-2024.10-cp36-cp36m-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for opm_simulators-2024.10-cp36-cp36m-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d379bee024383840e4e2d10d3b78108f01d330a2798b0508b04c12916bef892b
MD5 6a248fb70036942280c7fbbeac815bba
BLAKE2b-256 7f6fa26ed19c6b59e529d76b1cab9b4540dd9b8871571ce6b168e3b27a4d93de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page