# these are the pressures we're interested in here pp = [freesteam.psat_T(50 + 273.15), 3e6, 12e6, 165e5, 300e5] print("low p =", pp[0]) hh = arange(50., 4500., 100) * 1e3 hh1 = arange(50., 4500., 20) * 1e3 x = [] y = [] u = [] v = [] for p in pp: plot(hh1 / 1e3, [freesteam.steam_ph(p, h).T for h in hh1], alpha=0.8) if 0: for h in hh: try: S = freesteam.steam_ph(p, h) x += [S.h / 1.e3] y += [S.T] dy = freesteam.freesteam_deriv(S, 'T', 'h', 'p') dx = 0.0005 m = math.sqrt(dx**2 + dy**2) u += [dx / m] v += [dy / m] except: pass plot([0, 4500], [550 + 273.15, 550 + 273.15], 'b--')
# these are the pressures we're interested in here pp = [freesteam.psat_T(50+273.15), 3e6, 12e6, 165e5, 300e5] print "low p =",pp[0] hh = arange(50.,4500.,100)*1e3 hh1 = arange(50.,4500.,20)*1e3 x = [] y = [] u = [] v = [] for p in pp: plot(hh1/1e3,[freesteam.steam_ph(p,h).T for h in hh1],alpha=0.8) if 0: for h in hh: try: S = freesteam.steam_ph(p,h) x += [S.h/1.e3] y += [S.T] dy = freesteam.freesteam_deriv(S,'T','h','p') dx = 0.0005 m = math.sqrt(dx**2 + dy**2) u += [dx/m] v += [dy/m] except: pass plot([0,4500],[550+273.15,550+273.15],'b--')
for T in TT: S = freesteam.steam_pT(p,T) #print "p = %f, T = %f" % (p,T) r = S.region #print "p = %f MPa, T = %f K, region[%d,%d] = %d" % (p/1e6,T,x,y,r) im[x,y] = float(r) / 4. y += 1 x += 1 imshow(im,extent=[Tmin,Tmax,pmin/1e6,pmax/1e6],origin='lower',aspect='auto',interpolation='nearest',alpha=0.6) # LINES OF CONSTANT ENTHALPY hh = arange(100,4500,200)*1e3 for h in hh: TT2 = [freesteam.steam_ph(p,h).T for p in pp] plot(TT2,pp/1e6,'g-') plot(TT0,psat,'b-') axis([Tmin,Tmax,pmin/1e6,pmax/1e6]) #quiver(x,y,u,v,alpha=0.6) # LINES OF CONSTANT ENTROPY ss = arange(0,12,1./3)*1e3 for s in ss: TT2 = [freesteam.steam_ps(p,s).T for p in pp] plot(TT2,pp/1e6,'r:') plot(TT0,psat,'b-') axis([Tmin,Tmax,pmin/1e6,pmax/1e6])
#!/usr/bin/env python import freesteam S = freesteam.steam_ph(100e5, 300) print("TESTING RESULTS") print("region =", S.region) print("h =", S.h) print("v =", S.v) print("p =", S.p) print("s =", S.s) print("mu=", S.mu) print("TESTING PV") p = 500e5 v = 1. / 401. print("(p,v) = (%f, %f)" % (p, v)) print("bounds errors?", freesteam.bounds_pv(p, v, 1)) print("region?", freesteam.region_pv(p, v)) S = freesteam.steam_pv(p, v) print("region =", S.region) print("h =", S.h) print("v =", S.v) print("p =", S.p) print("s =", S.s) print("mu=", S.mu)
sys.stderr.write("can do this with 'export PATH=..:$PATH', assuming.\n") sys.stderr.write("you are in the directory containing test.py.\n") sys.exit(1) else: if not os.environ.get(LDVAR) or up not in os.environ[LDVAR]: os.environ[LDVAR] = up script = os.path.join(sys.path[0],"test.py") os.execvp("python",[script] + sys.argv) #------------------------------------------------------------------------------- # now for the tests... import freesteam S = freesteam.steam_ph(100e5,300) print "TESTING RESULTS" print "region =",S.region print "h =",S.h print "v =",S.v print "p =",S.p print "s =",S.s print "mu=",S.mu print "TESTING PV" p = 500e5 v = 1./401. print "(p,v) = (%f, %f)" % (p, v)