NeqSim is a tool for thermodynamic and process calculations
Project description
NeqSim Python
NeqSim Python is part of the NeqSim project. NeqSim Python is a Python interface to the NeqSim Java library for estimation of fluid behavior and process design for oil and gas production. NeqSim Python toolboxes (eg. thermoTools and processTools) are implemented to streamline use of neqsim in Python. Examples of use are given in the examples folder.
Installation
NeqSim Python can be installed via pip or conda.
Using pip
pip install neqsim
Using Conda
NeqSim is available on conda-forge. Install with:
conda install -c conda-forge neqsim
Or add conda-forge to your channels and install:
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install neqsim
Note: The conda package automatically includes Java (OpenJDK) as a dependency, so no separate Java installation is required.
Prerequisites
- Python 3.9 or higher
- Java 11 or higher (automatically installed with conda, or install separately for pip)
Getting Started
See the NeqSim Python Wiki for how to use NeqSim Python via Python or in Jupyter notebooks. Also see examples of use of NeqSim for Gas Processing in Colab. Learn and ask questions in Discussions for use and development of NeqSim.
Process Simulation
NeqSim Python provides multiple ways to build process simulations:
1. Python Wrappers (Recommended for beginners)
Simple functions with a global process - great for notebooks and prototyping:
from neqsim.thermo import fluid
from neqsim.process import stream, compressor, separator, runProcess, clearProcess
clearProcess()
feed = fluid('srk')
feed.addComponent('methane', 0.9)
feed.addComponent('ethane', 0.1)
feed.setTemperature(30.0, 'C')
feed.setPressure(50.0, 'bara')
feed.setTotalFlowRate(10.0, 'MSm3/day')
inlet = stream('inlet', feed)
sep = separator('separator', inlet)
comp = compressor('compressor', sep.getGasOutStream(), pres=100.0)
runProcess()
print(f"Compressor power: {comp.getPower()/1e6:.2f} MW")
2. ProcessContext (Recommended for production)
Context manager with explicit process control - supports multiple independent processes:
from neqsim.thermo import fluid
from neqsim.process import ProcessContext
feed = fluid('srk')
feed.addComponent('methane', 0.9)
feed.addComponent('ethane', 0.1)
feed.setTemperature(30.0, 'C')
feed.setPressure(50.0, 'bara')
with ProcessContext("Compression Train") as ctx:
inlet = ctx.stream('inlet', feed)
sep = ctx.separator('separator', inlet)
comp = ctx.compressor('compressor', sep.getGasOutStream(), pres=100.0)
ctx.run()
print(f"Compressor power: {comp.getPower()/1e6:.2f} MW")
3. ProcessBuilder (Fluent API)
Chainable builder pattern - ideal for configuration-driven design:
from neqsim.thermo import fluid
from neqsim.process import ProcessBuilder
feed = fluid('srk')
feed.addComponent('methane', 0.9)
feed.addComponent('ethane', 0.1)
feed.setTemperature(30.0, 'C')
feed.setPressure(50.0, 'bara')
process = (ProcessBuilder("Compression Train")
.add_stream('inlet', feed)
.add_separator('separator', 'inlet')
.add_compressor('compressor', 'separator', pressure=100.0)
.run())
print(f"Compressor power: {process.get('compressor').getPower()/1e6:.2f} MW")
4. Direct Java Access (Full control)
Explicit process management using jneqsim - for advanced features see neqsim java API:
from neqsim import jneqsim
from neqsim.thermo import fluid
feed = fluid('srk')
feed.addComponent('methane', 0.9)
feed.addComponent('ethane', 0.1)
feed.setTemperature(30.0, 'C')
feed.setPressure(50.0, 'bara')
# Create equipment using Java classes
inlet = jneqsim.process.equipment.stream.Stream('inlet', feed)
sep = jneqsim.process.equipment.separator.Separator('separator', inlet)
comp = jneqsim.process.equipment.compressor.Compressor('compressor', sep.getGasOutStream())
comp.setOutletPressure(100.0)
# Create and run process explicitly
process = jneqsim.process.processmodel.ProcessSystem()
process.add(inlet)
process.add(sep)
process.add(comp)
process.run()
print(f"Compressor power: {comp.getPower()/1e6:.2f} MW")
Choosing an Approach
| Use Case | Recommended Approach |
|---|---|
| Learning & prototyping | Python wrappers |
| Jupyter notebooks | Python wrappers |
| Production applications | ProcessContext |
| Multiple parallel processes | ProcessContext |
| Configuration-driven design | ProcessBuilder |
| Advanced Java features | Direct Java access |
See the examples folder for more process simulation examples, including processApproaches.py which demonstrates all four approaches.
PVT Simulation (PVTsimulation)
NeqSim also includes a pvtsimulation package for common PVT experiments (CCE/CME, CVD, differential liberation, separator tests, swelling, viscosity, etc.) and tuning workflows.
- Documentation:
docs/pvt_simulation.md - Direct Java access examples:
examples/pvtsimulation/README.md
Prerequisites
Java version 8 or higher (Java JDK) needs to be installed. The Python package JPype is used to connect Python and Java. Read the installation requirements for Jpype. Be aware that mixing 64 bit Python with 32 bit Java and vice versa crashes on import of the jpype module. The needed Python packages are listed in the NeqSim Python dependencies page.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
Discussion forum
Questions related to neqsim can be posted in the github discussion pages.
Versioning
NeqSim use SemVer for versioning.
Licence
NeqSim is distributed under the Apache-2.0 licence.
Acknowledgments
A number of master and PhD students at NTNU have contributed to development of NeqSim. We greatly acknowledge their contributions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neqsim-3.4.0.tar.gz.
File metadata
- Download URL: neqsim-3.4.0.tar.gz
- Upload date:
- Size: 83.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
540b78dda4b1b3005c2866b9ca6540f6cf22d6b0feceae348566773b923fd7fa
|
|
| MD5 |
9844ceb60f196d2e71a2219d1ba84a87
|
|
| BLAKE2b-256 |
8586130be299aa036307318896babbaf00a06cd088bb1b329f15a5cb4b2ce17a
|
Provenance
The following attestation bundles were made for neqsim-3.4.0.tar.gz:
Publisher:
publish-to-test-pypi.yml on equinor/neqsim-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
neqsim-3.4.0.tar.gz -
Subject digest:
540b78dda4b1b3005c2866b9ca6540f6cf22d6b0feceae348566773b923fd7fa - Sigstore transparency entry: 900105431
- Sigstore integration time:
-
Permalink:
equinor/neqsim-python@2a31a85b5caab67f92312a7b8073b2856cd49f19 -
Branch / Tag:
refs/tags/v3.4.0 - Owner: https://github.com/equinor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@2a31a85b5caab67f92312a7b8073b2856cd49f19 -
Trigger Event:
release
-
Statement type:
File details
Details for the file neqsim-3.4.0-py3-none-any.whl.
File metadata
- Download URL: neqsim-3.4.0-py3-none-any.whl
- Upload date:
- Size: 83.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d96ade5e47f98366bae2bfe0d971c1573ae538e8658ba57f42f74c1480d4992d
|
|
| MD5 |
89164267bae05227712819221c482e7c
|
|
| BLAKE2b-256 |
dbb37a6e8fa223de148460a58c59c0499b5c9928f299efac50ec0311b1f90557
|
Provenance
The following attestation bundles were made for neqsim-3.4.0-py3-none-any.whl:
Publisher:
publish-to-test-pypi.yml on equinor/neqsim-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
neqsim-3.4.0-py3-none-any.whl -
Subject digest:
d96ade5e47f98366bae2bfe0d971c1573ae538e8658ba57f42f74c1480d4992d - Sigstore transparency entry: 900105473
- Sigstore integration time:
-
Permalink:
equinor/neqsim-python@2a31a85b5caab67f92312a7b8073b2856cd49f19 -
Branch / Tag:
refs/tags/v3.4.0 - Owner: https://github.com/equinor
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@2a31a85b5caab67f92312a7b8073b2856cd49f19 -
Trigger Event:
release
-
Statement type: