|
| 1 | +# PVTsimulation (PVT experiments, characterization, tuning) |
| 2 | + |
| 3 | +NeqSim’s `pvtsimulation` package contains common PVT laboratory experiments (CCE/CME, CVD, DL, separator tests, swelling, viscosity, etc.) and utilities for tuning fluid characterization to match measured data. |
| 4 | + |
| 5 | +This repository supports two ways of running these experiments from Python: |
| 6 | + |
| 7 | +1. **Python wrappers** in `neqsim.thermo` / `neqsim.thermo.thermoTools` (quickest) |
| 8 | +2. **Direct Java access** via `from neqsim import jneqsim` (full control, more outputs, tuning) |
| 9 | + |
| 10 | +## Experiment coverage |
| 11 | + |
| 12 | +| Experiment | Java class | Python wrapper | Example | |
| 13 | +| --- | --- | --- | --- | |
| 14 | +| Saturation pressure (bubble/dew point) | `jneqsim.pvtsimulation.simulation.SaturationPressure` | `neqsim.thermo.saturationpressure()` | `examples/pvtsimulation/pvt_experiments_java_access.py`, `examples/pvtsimulation/pvt_tuning_to_saturation.py` | |
| 15 | +| Constant mass expansion (CCE/CME) | `...ConstantMassExpansion` | `neqsim.thermo.CME()` | `examples/pvtsimulation/pvt_experiments_java_access.py`, `examples/pvtsimulation/pvt_tuning_cme.py` | |
| 16 | +| Constant volume depletion (CVD) | `...ConstantVolumeDepletion` | `neqsim.thermo.CVD()` | `examples/pvtsimulation/pvt_experiments_java_access.py`, `examples/pvtsimulation/pvt_tuning_cvd.py` | |
| 17 | +| Differential liberation (DL) | `...DifferentialLiberation` | `neqsim.thermo.difflib()` | `examples/pvtsimulation/pvt_experiments_java_access.py` | |
| 18 | +| Separator test | `...SeparatorTest` | `neqsim.thermo.separatortest()` | `examples/pvtsimulation/pvt_experiments_java_access.py` | |
| 19 | +| Swelling test | `...SwellingTest` | `neqsim.thermo.swellingtest()` | `examples/pvtsimulation/pvt_experiments_java_access.py` | |
| 20 | +| Viscosity | `...ViscositySim` | `neqsim.thermo.viscositysim()` | `examples/pvtsimulation/pvt_experiments_java_access.py`, `examples/pvtsimulation/pvt_tuning_viscosity.py` | |
| 21 | +| GOR / Bo | `...GOR` | `neqsim.thermo.GOR()` | `examples/pvtsimulation/pvt_experiments_java_access.py` | |
| 22 | + |
| 23 | +Other available simulations (direct Java access): |
| 24 | + |
| 25 | +- `jneqsim.pvtsimulation.simulation.WaxFractionSim` (wax appearance / wax fraction vs T,P; requires wax model setup) |
| 26 | +- `jneqsim.pvtsimulation.simulation.ViscosityWaxOilSim` (wax + viscosity) |
| 27 | +- `jneqsim.pvtsimulation.simulation.DensitySim` |
| 28 | +- `jneqsim.pvtsimulation.simulation.SlimTubeSim` (slim-tube style displacement simulation) |
| 29 | + |
| 30 | +## Direct Java access: key patterns |
| 31 | + |
| 32 | +### Passing arrays |
| 33 | + |
| 34 | +Many PVTsimulation methods expect Java `double[]`. With JPype you can pass: |
| 35 | + |
| 36 | +- A Python list (auto-converted to `double[]` by JPype) |
| 37 | + |
| 38 | +Example: |
| 39 | + |
| 40 | +```python |
| 41 | +from neqsim import jneqsim |
| 42 | + |
| 43 | +pressures = [400.0, 300.0, 200.0] |
| 44 | +temperatures = [373.15, 373.15, 373.15] |
| 45 | + |
| 46 | +cme = jneqsim.pvtsimulation.simulation.ConstantMassExpansion(oil) |
| 47 | +cme.setTemperaturesAndPressures(temperatures, pressures) |
| 48 | +cme.runCalc() |
| 49 | +``` |
| 50 | + |
| 51 | +### Experimental data for tuning |
| 52 | + |
| 53 | +For several experiments, NeqSim expects `double[1][n]` experimental data, i.e. a single row with `n` values aligned with your pressure/temperature points: |
| 54 | + |
| 55 | +```python |
| 56 | +cme.setExperimentalData([[0.98, 1.02, 1.10]]) # relative volume values |
| 57 | +cme.runTuning() |
| 58 | +``` |
| 59 | + |
| 60 | +## Fluid characterization + PVT lumping |
| 61 | + |
| 62 | +See `examples/pvtsimulation/fluid_characterization_and_lumping.py` for a typical black-oil characterization workflow using: |
| 63 | + |
| 64 | +- `addTBPfraction(...)` and `addPlusFraction(...)` |
| 65 | +- `getCharacterization().setLumpingModel("PVTlumpingModel")` |
| 66 | +- `getCharacterization().characterisePlusFraction()` |
| 67 | + |
| 68 | +## Run the examples |
| 69 | + |
| 70 | +```bash |
| 71 | +python examples/pvtsimulation/pvt_experiments_java_access.py |
| 72 | +python examples/pvtsimulation/pvt_tuning_to_saturation.py |
| 73 | +python examples/pvtsimulation/pvt_tuning_cme.py |
| 74 | +python examples/pvtsimulation/pvt_tuning_cvd.py |
| 75 | +python examples/pvtsimulation/pvt_tuning_viscosity.py |
| 76 | +``` |
| 77 | + |
| 78 | +Tuning scripts default to skipping the actual tuning step; set `run_tuning = True` inside the script when you are ready to tune against measured data. |
0 commit comments