pyrestoolbox 3.1.1__tar.gz → 3.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/PKG-INFO +7 -7
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/README.rst +6 -6
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/benchmark_rust_vs_python.py +6 -6
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyproject.toml +1 -1
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/gas/gas.py +50 -22
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/setup.cfg +1 -1
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/setup.py +1 -1
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/zfactor/mod.rs +42 -32
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/.github/workflows/build-wheels.yml +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/.gitignore +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/Cargo.lock +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/Cargo.toml +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/LICENSE +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/MANIFEST.in +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/ResToolbox/privacy_policy.md +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/build_pure_python.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/_accelerator.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/brine/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/brine/_lib_salting_library.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/brine/_lib_vle_engine.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/brine/brine.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/classes/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/classes/classes.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/constants/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/constants/constants.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/dca/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/dca/dca.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/brine.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/changelist.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/dca.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/examples.ipynb +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/gas.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/img/bot.png +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/img/bot_PVTO.png +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/img/bot_img.png +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/img/dry_gas.png +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/img/grid_sat_df.png +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/img/influence.png +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/img/properties_df.png +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/img/sgof.png +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/img/swof.png +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/layer.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/library.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/matbal.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/nodal.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/nodal_examples.ipynb +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/nodal_hydrate_demo.ipynb +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/oil.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/recommend.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/sensitivity.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/docs/simtools.rst +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/gas/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/layer/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/layer/layer.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/library/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/library/component_library.xlsx +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/library/library.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/matbal/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/matbal/matbal.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/nodal/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/nodal/nodal.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/oil/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/oil/oil.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/plyasunov/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/plyasunov/iapws_if97.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/plyasunov/plyasunov_model.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/plyasunov/water_properties.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/recommend/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/recommend/recommend.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/sensitivity/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/sensitivity/sensitivity.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/shared_fns/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/shared_fns/shared_fns.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/simtools/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/simtools/simtools.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/validate/__init__.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/pyrestoolbox/validate/validate.py +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/bessel.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/critical_properties/mod.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/dca/hyperbolic.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/dca/mod.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/dca/ransac.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/gas_viscosity/mod.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/gwr.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/lib.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/matbal/mod.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/matbal/objective.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/oil/density.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/oil/mod.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/pseudopressure.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/spycher_pruess/mod.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/spycher_pruess/solubility.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vle/alpha.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vle/bip.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vle/components.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vle/eos.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vle/flash.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vle/fugacity.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vle/k_init.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vle/mod.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vle/rachford_rice.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/friction.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/holdup_bb.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/holdup_gray.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/holdup_hb.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/holdup_wg.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/ift.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/mod.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/pvt_helpers.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/segment_gas.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/segment_oil.rs +0 -0
- {pyrestoolbox-3.1.1 → pyrestoolbox-3.1.2}/src/vlp/static_column.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyrestoolbox
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.2
|
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
|
5
5
|
Classifier: Programming Language :: Rust
|
|
6
6
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
@@ -203,7 +203,7 @@ A set of Gas-Oil relative permeability curves with the LET method
|
|
|
203
203
|
>>> plt.grid('both')
|
|
204
204
|
>>> plt.plot()
|
|
205
205
|
|
|
206
|
-
.. image:: https://
|
|
206
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/sgof.png
|
|
207
207
|
:alt: SGOF Relative Permeability Curves
|
|
208
208
|
|
|
209
209
|
Or a set of Water-Oil relative permeability curves with the Corey method
|
|
@@ -220,7 +220,7 @@ Or a set of Water-Oil relative permeability curves with the Corey method
|
|
|
220
220
|
>>> plt.grid('both')
|
|
221
221
|
>>> plt.plot()
|
|
222
222
|
|
|
223
|
-
.. image:: https://
|
|
223
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/swof.png
|
|
224
224
|
:alt: SWOF Relative Permeability Curves
|
|
225
225
|
|
|
226
226
|
A set of dimensionless pressures for the constant terminal rate Van Everdingin & Hurst aquifer, along with an AQUTAB.INC export for use in ECLIPSE.
|
|
@@ -242,7 +242,7 @@ A set of dimensionless pressures for the constant terminal rate Van Everdingin &
|
|
|
242
242
|
>>> plt.title('Constant Terminal Rate Solution')
|
|
243
243
|
>>> plt.show()
|
|
244
244
|
|
|
245
|
-
.. image:: https://
|
|
245
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/influence.png
|
|
246
246
|
:alt: Constant Terminal Rate influence tables
|
|
247
247
|
|
|
248
248
|
Or creating black oil table information for oil
|
|
@@ -295,7 +295,7 @@ Or creating black oil table information for oil
|
|
|
295
295
|
Reservoir Water Compressibility: 2.930237693350768e-06 1/psi
|
|
296
296
|
Reservoir Water Viscosity: 0.3640686136171888 cP
|
|
297
297
|
|
|
298
|
-
.. image:: https://
|
|
298
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/bot.png
|
|
299
299
|
:alt: Black Oil Properties
|
|
300
300
|
|
|
301
301
|
And gas
|
|
@@ -310,7 +310,7 @@ And gas
|
|
|
310
310
|
>>> ...
|
|
311
311
|
>>> plt.show()
|
|
312
312
|
|
|
313
|
-
.. image:: https://
|
|
313
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/dry_gas.png
|
|
314
314
|
:alt: Dry Gas Properties
|
|
315
315
|
|
|
316
316
|
With ability to generate Live Oil PVTO style table data as well
|
|
@@ -384,7 +384,7 @@ With ability to generate Live Oil PVTO style table data as well
|
|
|
384
384
|
Reservoir Water Compressibility: 2.930237693350768e-06 1/psi
|
|
385
385
|
Reservoir Water Viscosity: 0.3640686136171888 cP
|
|
386
386
|
|
|
387
|
-
.. image:: https://
|
|
387
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/bot_PVTO.png
|
|
388
388
|
:alt: Live Oil Properties
|
|
389
389
|
|
|
390
390
|
|
|
@@ -177,7 +177,7 @@ A set of Gas-Oil relative permeability curves with the LET method
|
|
|
177
177
|
>>> plt.grid('both')
|
|
178
178
|
>>> plt.plot()
|
|
179
179
|
|
|
180
|
-
.. image:: https://
|
|
180
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/sgof.png
|
|
181
181
|
:alt: SGOF Relative Permeability Curves
|
|
182
182
|
|
|
183
183
|
Or a set of Water-Oil relative permeability curves with the Corey method
|
|
@@ -194,7 +194,7 @@ Or a set of Water-Oil relative permeability curves with the Corey method
|
|
|
194
194
|
>>> plt.grid('both')
|
|
195
195
|
>>> plt.plot()
|
|
196
196
|
|
|
197
|
-
.. image:: https://
|
|
197
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/swof.png
|
|
198
198
|
:alt: SWOF Relative Permeability Curves
|
|
199
199
|
|
|
200
200
|
A set of dimensionless pressures for the constant terminal rate Van Everdingin & Hurst aquifer, along with an AQUTAB.INC export for use in ECLIPSE.
|
|
@@ -216,7 +216,7 @@ A set of dimensionless pressures for the constant terminal rate Van Everdingin &
|
|
|
216
216
|
>>> plt.title('Constant Terminal Rate Solution')
|
|
217
217
|
>>> plt.show()
|
|
218
218
|
|
|
219
|
-
.. image:: https://
|
|
219
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/influence.png
|
|
220
220
|
:alt: Constant Terminal Rate influence tables
|
|
221
221
|
|
|
222
222
|
Or creating black oil table information for oil
|
|
@@ -269,7 +269,7 @@ Or creating black oil table information for oil
|
|
|
269
269
|
Reservoir Water Compressibility: 2.930237693350768e-06 1/psi
|
|
270
270
|
Reservoir Water Viscosity: 0.3640686136171888 cP
|
|
271
271
|
|
|
272
|
-
.. image:: https://
|
|
272
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/bot.png
|
|
273
273
|
:alt: Black Oil Properties
|
|
274
274
|
|
|
275
275
|
And gas
|
|
@@ -284,7 +284,7 @@ And gas
|
|
|
284
284
|
>>> ...
|
|
285
285
|
>>> plt.show()
|
|
286
286
|
|
|
287
|
-
.. image:: https://
|
|
287
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/dry_gas.png
|
|
288
288
|
:alt: Dry Gas Properties
|
|
289
289
|
|
|
290
290
|
With ability to generate Live Oil PVTO style table data as well
|
|
@@ -358,7 +358,7 @@ With ability to generate Live Oil PVTO style table data as well
|
|
|
358
358
|
Reservoir Water Compressibility: 2.930237693350768e-06 1/psi
|
|
359
359
|
Reservoir Water Viscosity: 0.3640686136171888 cP
|
|
360
360
|
|
|
361
|
-
.. image:: https://
|
|
361
|
+
.. image:: https://raw.githubusercontent.com/mwburgoyne/pyResToolbox/main/pyrestoolbox/docs/img/bot_PVTO.png
|
|
362
362
|
:alt: Live Oil Properties
|
|
363
363
|
|
|
364
364
|
|
|
@@ -64,10 +64,10 @@ print(json.dumps({"elapsed": _elapsed, "value": float(z)}))
|
|
|
64
64
|
""",
|
|
65
65
|
),
|
|
66
66
|
(
|
|
67
|
-
"(b)
|
|
68
|
-
"[gas.gas_z(p=p, sg=0.7, degf=200, zmethod=z_method.BNS, cmethod=c_method.BNS)\n for p in np.linspace(500, 5000,
|
|
67
|
+
"(b) 1000x Z-factors",
|
|
68
|
+
"[gas.gas_z(p=p, sg=0.7, degf=200, zmethod=z_method.BNS, cmethod=c_method.BNS)\n for p in np.linspace(500, 5000, 1000)]",
|
|
69
69
|
"""
|
|
70
|
-
pressures = np.linspace(500, 5000,
|
|
70
|
+
pressures = np.linspace(500, 5000, 1000).tolist()
|
|
71
71
|
results = [gas.gas_z(p=p, sg=0.7, degf=200, zmethod=z_method.BNS, cmethod=c_method.BNS) for p in pressures]
|
|
72
72
|
print(json.dumps({"elapsed": _elapsed, "value": float(np.mean(results))}))
|
|
73
73
|
""",
|
|
@@ -81,10 +81,10 @@ print(json.dumps({"elapsed": _elapsed, "value": float(ug)}))
|
|
|
81
81
|
""",
|
|
82
82
|
),
|
|
83
83
|
(
|
|
84
|
-
"(d)
|
|
85
|
-
"[gas.gas_ug(p=p, sg=0.7, degf=200, zmethod=z_method.BNS, cmethod=c_method.BNS)\n for p in np.linspace(500, 5000,
|
|
84
|
+
"(d) 1000x viscosities",
|
|
85
|
+
"[gas.gas_ug(p=p, sg=0.7, degf=200, zmethod=z_method.BNS, cmethod=c_method.BNS)\n for p in np.linspace(500, 5000, 1000)]",
|
|
86
86
|
"""
|
|
87
|
-
pressures = np.linspace(500, 5000,
|
|
87
|
+
pressures = np.linspace(500, 5000, 1000).tolist()
|
|
88
88
|
results = [gas.gas_ug(p=p, sg=0.7, degf=200, zmethod=z_method.BNS, cmethod=c_method.BNS) for p in pressures]
|
|
89
89
|
print(json.dumps({"elapsed": _elapsed, "value": float(np.mean(results))}))
|
|
90
90
|
""",
|
|
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pyrestoolbox"
|
|
7
|
-
version = "3.1.
|
|
7
|
+
version = "3.1.2"
|
|
8
8
|
description = "pyResToolbox - A collection of Reservoir Engineering Utilities"
|
|
9
9
|
license = {text = "GPL-3.0-or-later"}
|
|
10
10
|
authors = [{name = "Mark W. Burgoyne", email = "mark.w.burgoyne@gmail.com"}]
|
|
@@ -536,32 +536,60 @@ def _cardano_cubic(c2, c1, c0, flag=0):
|
|
|
536
536
|
return max(Zs)
|
|
537
537
|
return Zs
|
|
538
538
|
|
|
539
|
-
def _halley_cubic_vec(c2, c1, c0, max_iter=50, tol=1e-12):
|
|
539
|
+
def _halley_cubic_vec(c2, c1, c0, A=None, B=None, max_iter=50, tol=1e-12):
|
|
540
540
|
"""Vectorized Halley solver: solve Z^3+c2*Z^2+c1*Z+c0=0 for max root (vapor Z).
|
|
541
541
|
c2, c1, c0 are 1D arrays of length N. Returns 1D array of Z values.
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
542
|
+
When A and B are provided, solves in Z* = Z - B space (per Aaron Zick's
|
|
543
|
+
reformulation) where all physical roots lie in (0, 1], giving more
|
|
544
|
+
robust convergence. Falls back to _cardano_cubic for any bad elements."""
|
|
545
|
+
|
|
546
|
+
if A is not None and B is not None:
|
|
547
|
+
# Z* = Z - B reformulation: Z*³ + d2·Z*² + d1·Z* + d0 = 0
|
|
548
|
+
# f*(0) = -2B² < 0, f*(1) = A >= 0, so largest root in (0, 1]
|
|
549
|
+
d2 = 4.0 * B - 1.0
|
|
550
|
+
d1 = A + 2.0 * B * (B - 2.0)
|
|
551
|
+
d0 = -2.0 * B * B
|
|
552
|
+
|
|
553
|
+
# Start at Z* = 1 (above largest root since f*(1) = A >= 0)
|
|
554
|
+
Zs = np.ones_like(c2)
|
|
555
|
+
|
|
556
|
+
for _ in range(max_iter):
|
|
557
|
+
f = Zs**3 + d2 * Zs**2 + d1 * Zs + d0
|
|
558
|
+
fp = 3.0 * Zs**2 + 2.0 * d2 * Zs + d1
|
|
559
|
+
fpp = 6.0 * Zs + 2.0 * d2
|
|
560
|
+
safe_fp = np.where(np.abs(fp) < 1e-30, 1e-30, fp)
|
|
561
|
+
dZ = f / safe_fp
|
|
562
|
+
denom = safe_fp - 0.5 * dZ * fpp
|
|
563
|
+
denom = np.where(np.abs(denom) < 1e-30, 1e-30, denom)
|
|
564
|
+
dZ = f / denom
|
|
565
|
+
Zs -= dZ
|
|
566
|
+
if np.max(np.abs(dZ)) < tol:
|
|
567
|
+
break
|
|
568
|
+
|
|
569
|
+
# Convert Z* -> Z; fallback to Cardano in Z space for bad elements
|
|
570
|
+
Z = Zs + B
|
|
571
|
+
f = Zs**3 + d2 * Zs**2 + d1 * Zs + d0
|
|
572
|
+
bad = (np.abs(f) > 1e-6) | (Zs <= 0.0)
|
|
573
|
+
else:
|
|
574
|
+
# Legacy path: solve directly in Z space with Cauchy upper bound
|
|
575
|
+
Z = 1.0 + np.maximum(np.abs(c2), np.maximum(np.abs(c1), np.abs(c0)))
|
|
576
|
+
|
|
577
|
+
for _ in range(max_iter):
|
|
578
|
+
f = Z**3 + c2 * Z**2 + c1 * Z + c0
|
|
579
|
+
fp = 3.0 * Z**2 + 2.0 * c2 * Z + c1
|
|
580
|
+
fpp = 6.0 * Z + 2.0 * c2
|
|
581
|
+
safe_fp = np.where(np.abs(fp) < 1e-30, 1e-30, fp)
|
|
582
|
+
dZ = f / safe_fp
|
|
583
|
+
denom = safe_fp - 0.5 * dZ * fpp
|
|
584
|
+
denom = np.where(np.abs(denom) < 1e-30, 1e-30, denom)
|
|
585
|
+
dZ = f / denom
|
|
586
|
+
Z -= dZ
|
|
587
|
+
if np.max(np.abs(dZ)) < tol:
|
|
588
|
+
break
|
|
547
589
|
|
|
548
|
-
for _ in range(max_iter):
|
|
549
590
|
f = Z**3 + c2 * Z**2 + c1 * Z + c0
|
|
550
|
-
|
|
551
|
-
fpp = 6.0 * Z + 2.0 * c2
|
|
552
|
-
# Protect against zero derivatives
|
|
553
|
-
safe_fp = np.where(np.abs(fp) < 1e-30, 1e-30, fp)
|
|
554
|
-
dZ = f / safe_fp
|
|
555
|
-
denom = safe_fp - 0.5 * dZ * fpp
|
|
556
|
-
denom = np.where(np.abs(denom) < 1e-30, 1e-30, denom)
|
|
557
|
-
dZ = f / denom
|
|
558
|
-
Z -= dZ
|
|
559
|
-
if np.max(np.abs(dZ)) < tol:
|
|
560
|
-
break
|
|
591
|
+
bad = (np.abs(f) > 1e-6) | (Z < 0.0)
|
|
561
592
|
|
|
562
|
-
# Check residuals and fall back to Cardano for any bad elements
|
|
563
|
-
f = Z**3 + c2 * Z**2 + c1 * Z + c0
|
|
564
|
-
bad = np.abs(f) > 1e-6
|
|
565
593
|
if np.any(bad):
|
|
566
594
|
bad_idx = np.where(bad)[0]
|
|
567
595
|
for idx in bad_idx:
|
|
@@ -766,7 +794,7 @@ def gas_z(
|
|
|
766
794
|
c0 = -(A * B - B**2 - B**3)
|
|
767
795
|
|
|
768
796
|
# Solve all cubics at once - get max (vapor) root
|
|
769
|
-
Z_raw = _halley_cubic_vec(c2, c1_coeff, c0) # (N,)
|
|
797
|
+
Z_raw = _halley_cubic_vec(c2, c1_coeff, c0, A=A, B=B) # (N,)
|
|
770
798
|
|
|
771
799
|
# Fugacity-based root selection for sub-critical conditions
|
|
772
800
|
# When 3 real roots exist, the thermodynamically stable phase
|
|
@@ -12,7 +12,7 @@ with open(os.path.join(ROOT, 'README.rst'), 'r', encoding='utf-8') as f:
|
|
|
12
12
|
setup(
|
|
13
13
|
name='pyrestoolbox',
|
|
14
14
|
include_package_data=True,
|
|
15
|
-
version='3.1.
|
|
15
|
+
version='3.1.2', # Ideally should be same as your GitHub release tag version
|
|
16
16
|
packages=find_packages(exclude=['pyrestoolbox.tests', 'pyrestoolbox.tests.*']),
|
|
17
17
|
description='pyResToolbox - A collection of Reservoir Engineering Utilities',
|
|
18
18
|
license="GNU General Public License v3 or later (GPLv3+)",
|
|
@@ -288,37 +288,46 @@ fn cardano_cubic(c2: f64, c1: f64, c0: f64, flag: i32) -> f64 {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
/// Halley's method for finding max root of cubic z^3 + c2*z^2 + c1*z + c0 = 0
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
291
|
+
/// Halley's method for finding max root of cubic z^3 + c2*z^2 + c1*z + c0 = 0,
|
|
292
|
+
/// using Z* = Z - B transformation (per Aaron Zick's reformulation).
|
|
293
|
+
/// For any standard cubic EOS with non-negative A, all physical Z* roots
|
|
294
|
+
/// lie in (0, 1], eliminating negative/huge roots and guaranteeing convergence.
|
|
295
|
+
/// Returns Z (not Z*), i.e. the B offset is added back before returning.
|
|
296
|
+
fn halley_cubic_zstar(a_mix: f64, b_mix: f64) -> f64 {
|
|
297
|
+
// Z* cubic: Z*³ + d2·Z*² + d1·Z* + d0 = 0
|
|
298
|
+
// where f*(0) = d0 = -2B² < 0 and f*(1) = A >= 0
|
|
299
|
+
let d2 = 4.0 * b_mix - 1.0;
|
|
300
|
+
let d1 = a_mix + 2.0 * b_mix * (b_mix - 2.0);
|
|
301
|
+
let d0 = -2.0 * b_mix * b_mix;
|
|
302
|
+
|
|
303
|
+
// Start at Z* = 1 where f* = A >= 0 (above largest root).
|
|
304
|
+
let mut zs = 1.0_f64;
|
|
298
305
|
|
|
299
306
|
for _ in 0..50 {
|
|
300
|
-
let f =
|
|
301
|
-
let fp = 3.0 *
|
|
302
|
-
let fpp = 6.0 *
|
|
307
|
+
let f = zs * zs * zs + d2 * zs * zs + d1 * zs + d0;
|
|
308
|
+
let fp = 3.0 * zs * zs + 2.0 * d2 * zs + d1;
|
|
309
|
+
let fpp = 6.0 * zs + 2.0 * d2;
|
|
303
310
|
|
|
304
311
|
let fp_safe = if fp.abs() < 1e-30 { 1e-30 } else { fp };
|
|
305
312
|
let dz = f / fp_safe;
|
|
306
313
|
let denom = fp_safe - 0.5 * dz * fpp;
|
|
307
314
|
let denom_safe = if denom.abs() < 1e-30 { 1e-30 } else { denom };
|
|
308
315
|
let dz_final = f / denom_safe;
|
|
309
|
-
|
|
316
|
+
zs -= dz_final;
|
|
310
317
|
if dz_final.abs() < 1e-12 {
|
|
311
318
|
break;
|
|
312
319
|
}
|
|
313
320
|
}
|
|
314
321
|
|
|
315
|
-
// Verify convergence
|
|
316
|
-
let f =
|
|
317
|
-
if f.abs() > 1e-6 {
|
|
318
|
-
|
|
322
|
+
// Verify convergence; fallback to Cardano in Z space if needed
|
|
323
|
+
let f = zs * zs * zs + d2 * zs * zs + d1 * zs + d0;
|
|
324
|
+
if f.abs() > 1e-6 || zs <= 0.0 {
|
|
325
|
+
let c2 = -(1.0 - b_mix);
|
|
326
|
+
let c1 = a_mix - 3.0 * b_mix * b_mix - 2.0 * b_mix;
|
|
327
|
+
let c0 = -(a_mix * b_mix - b_mix * b_mix - b_mix * b_mix * b_mix);
|
|
319
328
|
return cardano_cubic(c2, c1, c0, 1);
|
|
320
329
|
}
|
|
321
|
-
|
|
330
|
+
zs + b_mix
|
|
322
331
|
}
|
|
323
332
|
|
|
324
333
|
fn bns_zfactor_core(
|
|
@@ -381,28 +390,29 @@ fn bns_zfactor_core(
|
|
|
381
390
|
b_mix += zi[i] * bi[i];
|
|
382
391
|
}
|
|
383
392
|
|
|
384
|
-
//
|
|
385
|
-
let
|
|
386
|
-
let c1 = a_mix - 3.0 * b_mix * b_mix - 2.0 * b_mix;
|
|
387
|
-
let c0 = -(a_mix * b_mix - b_mix * b_mix - b_mix * b_mix * b_mix);
|
|
388
|
-
|
|
389
|
-
// Solve cubic - get max (vapor) root
|
|
390
|
-
let z_max = halley_cubic(c2, c1, c0);
|
|
393
|
+
// Solve cubic in Z* = Z - B space (Aaron Zick reformulation)
|
|
394
|
+
let z_max = halley_cubic_zstar(a_mix, b_mix);
|
|
391
395
|
|
|
392
|
-
//
|
|
393
|
-
|
|
394
|
-
let
|
|
396
|
+
// Fugacity-based root selection for sub-critical conditions.
|
|
397
|
+
// Use Z* cubic discriminant to check for 3-root case.
|
|
398
|
+
let d2 = 4.0 * b_mix - 1.0;
|
|
399
|
+
let d1 = a_mix + 2.0 * b_mix * (b_mix - 2.0);
|
|
400
|
+
let d0 = -2.0 * b_mix * b_mix;
|
|
401
|
+
let p_d = (3.0 * d1 - d2 * d2) / 3.0;
|
|
402
|
+
let q_d = (2.0 * d2 * d2 * d2 - 9.0 * d2 * d1 + 27.0 * d0) / 27.0;
|
|
395
403
|
let disc = q_d * q_d / 4.0 + p_d * p_d * p_d / 27.0;
|
|
396
404
|
|
|
397
405
|
let z_selected = if disc < -1e-15 {
|
|
398
|
-
// 3 real roots
|
|
399
|
-
let
|
|
400
|
-
let
|
|
406
|
+
// 3 real roots — find min root via deflation in Z* space
|
|
407
|
+
let zs_max = z_max - b_mix; // convert back to Z*
|
|
408
|
+
let b_q = d2 + zs_max;
|
|
409
|
+
let c_q = d1 + zs_max * b_q;
|
|
401
410
|
let det = (b_q * b_q - 4.0 * c_q).max(0.0);
|
|
402
|
-
let
|
|
411
|
+
let zs_min = (-b_q - det.sqrt()) / 2.0;
|
|
412
|
+
let z_min = zs_min + b_mix; // convert to Z
|
|
403
413
|
|
|
404
|
-
// Fugacity comparison (Gibbs criterion)
|
|
405
|
-
if
|
|
414
|
+
// Fugacity comparison (Gibbs criterion); Z > B ↔ Z* > 0
|
|
415
|
+
if zs_min > 0.0 {
|
|
406
416
|
let sqrt2: f64 = std::f64::consts::SQRT_2;
|
|
407
417
|
let s2p1 = 1.0 + sqrt2;
|
|
408
418
|
let s2m1 = sqrt2 - 1.0;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|