Beispiel #1
0
import math
import sys
import numpy as np

sys.path.append("/Users/ahagen/code")
from ah_py.plotting import twod as ahp
from ah_py.calc import func as ahm
from ah_py.simulation import fluids as ahf
from matplotlib import pyplot as plt
import matplotlib as mpl

ace = ahf.fluid("acetone")
rho_1 = ace.rho(325.0, 150000.0)
p_1 = ace.p(325.0, rho_1)
print p_1

ace = ahf.fluid("acetone")
rho_1 = ace.rho(300.0, 101325.0)
T = np.linspace(250.0, 350.0, 100)
P = np.linspace(1000.0, 200000.0, 100)

Ta, Pa = np.meshgrid(T, P)
T_rho_a = (Ta[:-1, 1:] - Ta[:-1, :-1]) / 2.0 + Ta[1:, :-1]
P_rho_a = (Pa[1:, :-1] - Pa[:-1, :-1]) / 2.0 + Pa[:-1, 1:]
rho_a = np.zeros_like(T_rho_a)
for i in range(len(P) - 1):
    for j in range(len(T) - 1):
        rho_a[j, i] = ace.rho(T_rho_a[j, i], P_rho_a[j, i])

mask = ace.T_b_curve.at(P_rho_a) <= T_rho_a
rho_a = np.ma.masked_where(mask, rho_a)
Beispiel #2
0
import math
import sys
import numpy as np
sys.path.append("/Users/ahagen/code")
from pym import func as ahm
from pyg import twod as ahp
from ah_py.simulation import fluids as ahf
from matplotlib import pyplot as plt
import matplotlib as mpl
from scipy import interpolate

ace = ahf.fluid('acetone');
T = np.linspace(275.,325.,90);
P = np.linspace(5000.,105000.,100);

T_mid = T[:-1] + (T[1:] - T[:-1])/2.;
P_mid = P[:-1] + (P[1:] - P[:-1])/2.;

Ta,Pa = np.meshgrid(T,P);
T_rho_a = (Ta[:-1,1:] - Ta[:-1,:-1])/2.0 + Ta[1:,:-1];
P_rho_a = (Pa[1:,:-1] - Pa[:-1,:-1])/2.0 + Pa[:-1,1:];
rho_a = np.zeros_like(T_rho_a);
for i in range(len(P)-1):
    for j in range(len(T)-1):
        rho_a[i,j] = ace.rho(T_rho_a[i,j],P_rho_a[i,j]);

mask = ace.T_b_curve.at(P_rho_a) <= T_rho_a;
rho_a = np.ma.masked_where(mask,rho_a);

### find density from NIST
arr = np.loadtxt('acetone_density_nist.csv',delimiter="\t");
Beispiel #3
0
import math
import sys
import numpy as np
sys.path.append("/Users/ahagen/code")
from pym import func as ahm
from pyg import twod as ahp
from ah_py.simulation import fluids as ahf

dfp = ahf.fluid('dfp')
T_b = dfp.T_b
P_b = dfp.P_b
dfp_pos_curve = ahm.curve(P_b, T_b - 273.15, name='dfp')

ace = ahf.fluid('ace')
T_b = ace.T_b
P_b = ace.P_b
ace_pos_curve = ahm.curve(P_b, T_b - 273.15, name='ace')

plot = dfp_pos_curve.plot(linestyle='-', linecolor='#E3AE24')

'''
A = 6.43876
B = 1242.510
C = 46.568
P = np.linspace(1., -700000., 500) / 1.0E3 # in kPa
T_b = - B / (np.log10(P) - A) + C
dfp_neg_curve = ahm.curve(P * 1.0E3, T_b, name='dfp-neg')
plot = dfp_neg_curve.plot(linestyle='--', linecolor='#E3AE24', addto=plot)
'''

dfp_exp_curve = ahm.curve([-3.2 * 1.0E5], [24.], name='dfp expt')