-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from thermotools/hydrate
Initial hydrate support
- Loading branch information
Showing
38 changed files
with
10,969 additions
and
410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
; File generated by thermopack/addon/pyUtils/exports/export_list.py | ||
; Time stamp: 2024-10-04T15:56:57.529901 | ||
; Time stamp: 2024-12-09T14:49:32.643496 | ||
; @[email protected] : Declares the module parameters. | ||
|
||
LIBRARY | ||
|
@@ -98,6 +98,10 @@ EXPORTS | |
eostv_mp_enthalpy_tvp_ | ||
fundamental_measure_theory_mp_fmt_energy_density_ | ||
hardsphere_bmcsl_mp_calc_bmcsl_gij_fmt_ | ||
hydrate_mp_init_hydrate_model_ | ||
hydrate_mp_fugacity_water_in_hydrate_tpx_ | ||
hydrate_mp_fugacity_water_in_hydrate_tvn_ | ||
hydrate_curves_mp_map_hydrate_appearance_curve_ | ||
ideal_mp_set_standard_entropy_ | ||
ideal_mp_get_standard_entropy_ | ||
ideal_mp_set_enthalpy_of_formation_ | ||
|
@@ -117,6 +121,7 @@ EXPORTS | |
lj_splined_mp_ljs_wca_model_control_ | ||
lj_splined_mp_ljs_wca_set_pure_params_ | ||
lj_splined_mp_ljs_wca_get_pure_params_ | ||
multi_phase_envelope_tv_mp_multi_phase_envelope_plot_tv_ | ||
mut_solver_mp_solve_mu_t_ | ||
mut_solver_mp_solve_lnf_t_ | ||
mut_solver_mp_map_meta_isotherm_ | ||
|
@@ -196,6 +201,7 @@ EXPORTS | |
saturation_curve_mp_envelopeplot_ | ||
saturation_curve_mp_envelope_isentrope_cross_ | ||
saturation_curve_mp_pure_fluid_saturation_wrapper_ | ||
saturation_tv_mp_envelope_plot_tv_ | ||
saturation_point_locators_mp_locate_saturation_property_ | ||
saturation_point_locators_mp_property_index_from_string_ | ||
saturation_point_locators_mp_sat_points_based_on_prop_ | ||
|
@@ -229,4 +235,4 @@ EXPORTS | |
thermopack_var_mp_get_eos_identification_ | ||
tp_solver_mp_twophasetpflash_ | ||
sv_solver_mp_twophasesvflash_ | ||
uv_solver_mp_twophaseuvflash_ | ||
uv_solver_mp_twophaseuvflash_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/usr/bin/python | ||
#Modify system path | ||
import sys | ||
sys.path.insert(0,'../pycThermopack/') | ||
from thermopack.cubic import cubic | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import itertools as it | ||
import csv | ||
|
||
cb = cubic("CO2,H2O","SRK") | ||
cb.init_hydrate() | ||
|
||
Z_H2O = np.array([30.0, 100.0, 250.0])*1e-6 | ||
initial_pressure = 1.0e3 | ||
minimum_temperature = 100.0 | ||
maximum_pressure = 150.0e5 | ||
p_scaling = 1.0e-6 | ||
colors = [ "black", "blue", "red", "green", "m"] | ||
linestyles = [ "-", "--", ":", "-.", "."] | ||
|
||
z = np.zeros((2)) | ||
for i in range(len(Z_H2O)): | ||
z[0] = (1-Z_H2O[i]) | ||
z[1] = Z_H2O[i] | ||
fluid, water = cb.get_multi_phase_envelope_tv(initial_pressure, z, | ||
minimum_temperature, | ||
maximum_pressure) | ||
t_vals, p_vals = (fluid.t, fluid.p) | ||
tw_vals, pw_vals = (water.t, water.p) | ||
t_hyd_vals, p_hyd_vals = cb.get_hydrate_apperance_curve(initial_pressure, z, | ||
minimum_temperature, | ||
maximum_pressure) | ||
plt.plot(t_vals, p_vals*p_scaling, linestyle="-", color=colors[i]) | ||
#plt.plot(tw_vals, pw_vals*p_scaling, linestyle=":", color=colors[i], | ||
# label="H2O: {} ppm".format(round(z[-1]*1e6))) | ||
plt.plot(t_hyd_vals, p_hyd_vals*p_scaling, linestyle="--", color=colors[i], | ||
label="Hyd. H2O: {} ppm".format(round(z[-1]*1e6))) | ||
|
||
# z = np.ones((2))*0.5 | ||
# t_hyd_vals, p_hyd_vals = cb.get_hydrate_apperance_curve(initial_pressure, z, | ||
# minimum_temperature, | ||
# maximum_pressure) | ||
# plt.plot(t_hyd_vals, p_hyd_vals*p_scaling, linestyle="--", color="orange", | ||
# label="Hyd. excess H2O") | ||
|
||
plt.title("SRK: CO2 and variable H2O") | ||
leg = plt.legend(loc="best", numpoints=1) | ||
leg.get_frame().set_linewidth(0.0) | ||
plt.ylabel(r"$P$ (MPa)") | ||
plt.xlabel(r"$T$ (K)") | ||
plt.tight_layout() | ||
plt.savefig("hydrate_co2.pdf") | ||
|
||
plt.figure() | ||
cb.init("CO2,N2,H2O","SRK","Classic","Classic") | ||
cb.init_hydrate() | ||
Z_CO2 = np.array([0.85,0.15]) | ||
Z_H2O = np.array([30.0, 100.0, 250.0])*1e-6 | ||
initial_pressure = 5.0e3 | ||
|
||
z = np.zeros((3)) | ||
for i in range(len(Z_H2O)): | ||
z[0:2] = (1-Z_H2O[i])*Z_CO2 | ||
z[2] = Z_H2O[i] | ||
fluid, water = cb.get_multi_phase_envelope_tv(initial_pressure, z, | ||
minimum_temperature, | ||
maximum_pressure) | ||
t_vals, p_vals = (fluid.t, fluid.p) | ||
tw_vals, pw_vals = (water.t, water.p) | ||
t_hyd_vals, p_hyd_vals = cb.get_hydrate_apperance_curve(initial_pressure, z, | ||
minimum_temperature, | ||
maximum_pressure) | ||
|
||
plt.plot(t_vals, p_vals*p_scaling, linestyle="-", color=colors[i]) | ||
# plt.plot(tw_vals, pw_vals*p_scaling, linestyle=":", color=colors[i], | ||
# label="H2O: {} ppm".format(round(z[-1]*1e6))) | ||
plt.plot(t_hyd_vals, p_hyd_vals*p_scaling, linestyle="--", color=colors[i], | ||
label="Hyd. H2O: {} ppm".format(round(z[-1]*1e6))) | ||
|
||
|
||
plt.title("SRK: CO2 (0.85), N2 (0.15) and variable H2O") | ||
leg = plt.legend(loc="best", numpoints=1) | ||
leg.get_frame().set_linewidth(0.0) | ||
plt.ylabel(r"$P$ (MPa)") | ||
plt.xlabel(r"$T$ (K)") | ||
plt.tight_layout() | ||
plt.savefig("hydrate_co2_n2.pdf") | ||
plt.show() | ||
plt.clf() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/usr/bin/python | ||
#Modify system path | ||
import sys | ||
sys.path.insert(0,'../pycThermopack/') | ||
from thermopack.cubic import cubic | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import itertools as it | ||
import csv | ||
|
||
cb = cubic("CO2,N2,H2O","SRK") | ||
Z_CO2 = np.array([0.85,0.15]) | ||
Z_H2O = np.array([0.05,1e-2,1e-3,1e-4]) | ||
Z_H2O = np.array([5.0, 30.0, 100.0, 1000.0])*1e-6 | ||
initial_pressure = 5.0e3 | ||
minimum_temperature = 140.0 | ||
maximum_pressure = 150.0e5 | ||
p_scaling = 1.0e-6 | ||
colors = [ "black", "blue", "red", "green"] | ||
linestyles = [ "-", "--", ":", "-."] | ||
|
||
z = np.zeros((3)) | ||
for i in range(len(Z_H2O)): | ||
z[0:2] = (1-Z_H2O[i])*Z_CO2 | ||
z[2] = Z_H2O[i] | ||
fluid, water = cb.get_multi_phase_envelope_tv(initial_pressure, z, | ||
minimum_temperature, | ||
maximum_pressure) | ||
t_vals, p_vals = (fluid.t, fluid.p) | ||
tw_vals, pw_vals = (water.t, water.p) | ||
plt.plot(t_vals, p_vals*p_scaling, linestyle="-", color=colors[i]) | ||
plt.plot(tw_vals, pw_vals*p_scaling, linestyle="--", color=colors[i], | ||
label="H2O: {} ppm".format(round(z[-1]*1e6))) | ||
|
||
cb.init("CO2,N2","SRK","Classic","Classic") | ||
Z_CO2 = np.array([0.85,0.15]) | ||
T, P, v = cb.get_envelope_twophase_tv(initial_pressure, Z_CO2, | ||
maximum_pressure=maximum_pressure, | ||
minimum_temperature=minimum_temperature) | ||
plt.plot(T, P*p_scaling, linestyle="-", color="cyan", label="No water") | ||
|
||
plt.title("SRK: CO2 (0.85), N2 (0.15) and variable H2O") | ||
leg = plt.legend(loc="best", numpoints=1) | ||
leg.get_frame().set_linewidth(0.0) | ||
plt.ylabel(r"$P$ (MPa)") | ||
plt.xlabel(r"$T$ (K)") | ||
|
||
plt.figure() | ||
cb.init("CO2,H2O","SRK","Classic","Classic") | ||
initial_pressure = 1.0e3 | ||
minimum_temperature = 100.0 | ||
maximum_pressure = 150.0e5 | ||
p_scaling = 1.0e-6 | ||
colors = [ "black", "blue", "red", "green"] | ||
linestyles = [ "-", "--", ":", "-."] | ||
|
||
arrays = [] | ||
z = np.zeros((2)) | ||
for i in range(len(Z_H2O)): | ||
z[0] = (1-Z_H2O[i]) | ||
z[1] = Z_H2O[i] | ||
fluid, water = cb.get_multi_phase_envelope_tv(initial_pressure, z, | ||
minimum_temperature, | ||
maximum_pressure) | ||
t_vals, p_vals = (fluid.t, fluid.p) | ||
tw_vals, pw_vals = (water.t, water.p) | ||
arrays += [t_vals, p_vals, tw_vals, pw_vals] | ||
plt.plot(t_vals, p_vals*p_scaling, linestyle="-", color=colors[i]) | ||
plt.plot(tw_vals, pw_vals*p_scaling, linestyle="--", color=colors[i], | ||
label="H2O: {} ppm".format(round(z[-1]*1e6))) | ||
|
||
# with open('co2_h2o.csv', 'w') as f: | ||
# csv.writer(f, delimiter='\t').writerows(it.zip_longest(*arrays, fillvalue =np.NaN)) | ||
|
||
cb.init("CO2","SRK","Classic","Classic") | ||
Z_CO2 = np.array([1.0]) | ||
T, P, v = cb.get_envelope_twophase_tv(initial_pressure, Z_CO2, | ||
maximum_pressure=maximum_pressure, | ||
minimum_temperature=minimum_temperature) | ||
plt.plot(T, P*p_scaling, linestyle="-", color="cyan", label="No water") | ||
|
||
plt.title("SRK: CO2 and variable H2O") | ||
leg = plt.legend(loc="best", numpoints=1) | ||
leg.get_frame().set_linewidth(0.0) | ||
plt.ylabel(r"$P$ (MPa)") | ||
plt.xlabel(r"$T$ (K)") | ||
|
||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.