Skip to main content

ogs5py: a python API for OpenGeoSys5

Project description

Welcome to ogs5py

DOI PyPI version Build Status Coverage Status Documentation Status Code style: black

ogs5py-LOGO

Purpose

ogs5py is A python-API for the OpenGeoSys 5 scientific modeling package.

Installation

You can install the latest version with the following command:

pip install ogs5py

Documentation for ogs5py

You can find the documentation under geostat-framework.readthedocs.io.

Further Information

Tutorials and Examples

In the following a simple transient pumping test is simulated on a radial symmetric mesh. The point output at the observation well is plotted afterwards.

from ogs5py import OGS
from matplotlib import pyplot as plt

model = OGS(task_root="pump_test", task_id="model")

# generate a radial mesh
model.msh.generate("radial", dim=2, rad=range(51))
# generate a radial outer boundary
model.gli.generate("radial", dim=2, rad_out=50.)
model.gli.add_points([0., 0., 0.], "pwell")
model.gli.add_points([1., 0., 0.], "owell")
model.bc.add_block(  # boundary condition
    PCS_TYPE='GROUNDWATER_FLOW',
    PRIMARY_VARIABLE='HEAD',
    GEO_TYPE=['POLYLINE', "boundary"],
    DIS_TYPE=['CONSTANT', 0.0],
)
model.st.add_block(  # source term
    PCS_TYPE='GROUNDWATER_FLOW',
    PRIMARY_VARIABLE='HEAD',
    GEO_TYPE=['POINT', "pwell"],
    DIS_TYPE=['CONSTANT_NEUMANN', -1.0e-04],
)
model.ic.add_block(  # initial condition
    PCS_TYPE='GROUNDWATER_FLOW',
    PRIMARY_VARIABLE='HEAD',
    GEO_TYPE='DOMAIN',
    DIS_TYPE=['CONSTANT', 0.0],
)
model.mmp.add_block(  # medium properties
    GEOMETRY_DIMENSION=2,
    STORAGE=[1, 1.0e-04],
    PERMEABILITY_TENSOR=['ISOTROPIC', 1.0e-4],
)
model.num.add_block(  # numerical solver
    PCS_TYPE='GROUNDWATER_FLOW',
    LINEAR_SOLVER=[2, 5, 1.0e-14, 1000, 1.0, 100, 4],
)
model.out.add_block(  # point observation
    PCS_TYPE='GROUNDWATER_FLOW',
    NOD_VALUES='HEAD',
    GEO_TYPE=['POINT', "owell"],
    DAT_TYPE='TECPLOT',
    TIM_TYPE=['STEPS', 1],
)
model.pcs.add_block(  # set the process type
    PCS_TYPE='GROUNDWATER_FLOW', NUM_TYPE='NEW'
)
model.tim.add_block(  # set the timesteps
    PCS_TYPE='GROUNDWATER_FLOW',
    TIME_START=0,
    TIME_END=600,
    TIME_STEPS=[[10, 30], [5, 60]],
)
model.write_input()
success = model.run_model()

point = model.readtec_point(pcs='GROUNDWATER_FLOW')
time = point['owell']["TIME"]
head = point['owell']["HEAD"]

plt.plot(time, head)
plt.show()

Drawdown

OGS5 executable

To obtain an OGS5 executable, ogs5py brings a download routine:

from ogs5py import download_ogs
download_ogs()

Then a executable is stored in the ogs5py config path and will be called when a model is run.

You can pass a version statement to the download_ogs routine, to obtain a specific version (5.7, 5.7.1 (win only) and 5.8). Also "latest" and "stable" are possible. For OGS 5.7 there are executables for Windows/Linux and MacOS. For "5.8", "latest" and "stable" there are no MacOS pre-builds. Have a look at the documentation for all options.

If you have compiled your own OGS5 version, you can add your executable to the ogs5py config path with:

from ogs5py import add_exe
add_exe("path/to/your/ogs/exe")

Otherwise you need to specify the path to the executable within the run command:

model.run_model(ogs_exe="path/to/ogs")

Requirements:

Contact

You can contact us via info@geostat-framework.org.

License

MIT © 2018-2019 (inspired by Falk Hesse and Miao Jing)

This project is based on OGSPY.

Project details


Download files

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

Source Distribution

ogs5py-1.0.3.tar.gz (240.0 kB view details)

Uploaded Source

Built Distribution

ogs5py-1.0.3-py2.py3-none-any.whl (130.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ogs5py-1.0.3.tar.gz.

File metadata

  • Download URL: ogs5py-1.0.3.tar.gz
  • Upload date:
  • Size: 240.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/2.7.15

File hashes

Hashes for ogs5py-1.0.3.tar.gz
Algorithm Hash digest
SHA256 17f8176649bb2c811dc9cf3bf75fe038c24edb4f64d7c72d50cd1a596d02c848
MD5 8e1a902696bf7dbd14b953976fecda0f
BLAKE2b-256 3d78d98d648fdf50d3cd796b5998f0a14a36fbe1dd72a57c9eadae0f2b920597

See more details on using hashes here.

Provenance

File details

Details for the file ogs5py-1.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: ogs5py-1.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 130.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/2.7.15

File hashes

Hashes for ogs5py-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e64ac2278b6e49a5b6f8b8ef607c41b9429a18bfd447f2665ec7697f842b7840
MD5 23ffc6dab8f7f0e61890ab40729db75b
BLAKE2b-256 7c7669253e89e6ccc94d5251b909b82b0552d0142b2b66cd529cdefb73314277

See more details on using hashes here.

Provenance

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