NeqSim is a tool for thermodynamic and process calculations
Project description
NeqSim Python
Python interface to the NeqSim engine — fluid properties, process simulation, and PVT analysis from Python and Jupyter notebooks.
Quick Start · Process Simulation · PVT Simulation · Examples · Docs · Community
What is NeqSim Python?
NeqSim Python is part of the NeqSim project — a Python interface to the NeqSim Java library for estimation of fluid behavior and process design for oil and gas production.
It provides Python toolboxes such as thermoTools and processTools that streamline the use of NeqSim, plus direct access to the full Java API via the jneqsim gateway.
| Capability | What you get |
|---|---|
| Thermodynamics | 60+ EOS models (SRK, PR, CPA, GERG-2008, …), flash calculations, phase envelopes |
| Physical properties | Density, viscosity, thermal conductivity, surface tension |
| Process simulation | 33+ equipment types — separators, compressors, heat exchangers, valves, pumps, reactors |
| PVT simulation | CME, CVD, differential liberation, separator tests, swelling, viscosity |
| Pipeline & flow | Steady-state multiphase pipe flow (Beggs & Brill), pipe networks |
🚀 Quick Start
Install
| pip (requires Java 11+) | conda (Java included) |
pip install neqsim
|
conda install -c conda-forge neqsim
|
Prerequisites: Python 3.9+ and Java 11+. The conda package automatically installs OpenJDK — no separate Java setup needed. For pip, install Java from Adoptium.
Try it now
from neqsim.thermo import fluid
# Create a natural gas fluid
fl = fluid('srk')
fl.addComponent('methane', 0.85)
fl.addComponent('ethane', 0.10)
fl.addComponent('propane', 0.05)
fl.setTemperature(25.0, 'C')
fl.setPressure(60.0, 'bara')
fl.setMixingRule('classic')
from neqsim.thermo import TPflash, printFrame
TPflash(fl)
printFrame(fl)
🔧 Process Simulation
NeqSim Python provides multiple ways to build process simulations:
1. Python Wrappers — recommended for beginners & notebooks
Simple functions with a global process — great for 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 code
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 for configuration-driven design
Chainable builder pattern:
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 via jneqsim
Explicit process management using the Java API — for advanced features see the NeqSim Java repo:
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 |
🧪 PVT Simulation
NeqSim includes a pvtsimulation package for common PVT experiments (CCE/CME, CVD, differential liberation, separator tests, swelling, viscosity, etc.) and tuning workflows.
📂 Examples
Explore ready-to-run examples in the examples folder:
- Process simulation — processApproaches.py (all four approaches)
- Flash calculations, phase envelopes, hydrate prediction
- Compressor trains, heat exchangers, separation processes
- Jupyter notebooks in examples/jupyter/
- Google Colab examples
⚙️ Technical Notes
JPype bridges Python and Java. See the JPype installation guide for platform-specific details. Ensure Python and Java are both 64-bit (or both 32-bit) — mixing architectures will crash on import.
The full list of Python dependencies is on the dependencies page.
🏗️ Contributing
We welcome contributions — bug fixes, new examples, documentation improvements, and more.
- CONTRIBUTING.md — Code of conduct and PR process
- NeqSim Python Wiki — Guides and usage patterns
📚 Documentation & Resources
| Resource | Link |
|---|---|
| NeqSim homepage | equinor.github.io/neqsimhome |
| Python wiki | neqsim-python/wiki |
| JavaDoc API | JavaDoc |
| Discussion forum | GitHub Discussions |
| NeqSim Java | equinor/neqsim |
| MATLAB binding | equinor/neqsimmatlab |
| Releases | GitHub Releases |
Versioning
NeqSim uses SemVer for versioning.
Authors
Even Solbraa ([email protected]), Marlene Louise Lund
NeqSim development was initiated at NTNU. A number of master and PhD students have contributed — we greatly acknowledge their contributions.
License
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.8.0.tar.gz.
File metadata
- Download URL: neqsim-3.8.0.tar.gz
- Upload date:
- Size: 99.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4cae4f248ddd27c9e165d4bddaf352f9fff35810d3c2eb18569ae75c978299a
|
|
| MD5 |
49dd01b4ac993cf3c45f39e0cb16e00f
|
|
| BLAKE2b-256 |
b48c553c6f2ddc47a2a9ff2e5ef3b37f8c4901450f738db30c7054c8b8b4db15
|
Provenance
The following attestation bundles were made for neqsim-3.8.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.8.0.tar.gz -
Subject digest:
a4cae4f248ddd27c9e165d4bddaf352f9fff35810d3c2eb18569ae75c978299a - Sigstore transparency entry: 1357253130
- Sigstore integration time:
-
Permalink:
equinor/neqsim-python@be0a50a9af698037fcee925257e1fa1448ea5098 -
Branch / Tag:
refs/tags/v3.8.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@be0a50a9af698037fcee925257e1fa1448ea5098 -
Trigger Event:
release
-
Statement type:
File details
Details for the file neqsim-3.8.0-py3-none-any.whl.
File metadata
- Download URL: neqsim-3.8.0-py3-none-any.whl
- Upload date:
- Size: 99.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
455eff6f9e298c062a1bd5fbd675250a7eb7c150cd72419b2c0bdc3b06ac7f64
|
|
| MD5 |
ea45762d6bfd0d578f4063d86066ed70
|
|
| BLAKE2b-256 |
243236f55009c2875fc18c0e95a1402ca0b1551950e296bb37ad27d0fdcf34ad
|
Provenance
The following attestation bundles were made for neqsim-3.8.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.8.0-py3-none-any.whl -
Subject digest:
455eff6f9e298c062a1bd5fbd675250a7eb7c150cd72419b2c0bdc3b06ac7f64 - Sigstore transparency entry: 1357253135
- Sigstore integration time:
-
Permalink:
equinor/neqsim-python@be0a50a9af698037fcee925257e1fa1448ea5098 -
Branch / Tag:
refs/tags/v3.8.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@be0a50a9af698037fcee925257e1fa1448ea5098 -
Trigger Event:
release
-
Statement type: