def ts_phase_envelope(substance, fill=None, Tf=None): Tc = pr('Tcrit', substance) if Tf == None: Tf = pr('Tmin', substance) Tsweep = linspace(Tf, Tc, 100) Tsweep[-1] = Tc - .1 s_sl = pr('S', 'Q', 0, 'T', Tsweep, substance) s_sv = pr('S', 'Q', 1, 'T', Tsweep, substance) ss = array(list(s_sl) + list(s_sv)[::-1]) Ts = array(list(Tsweep) + list(Tsweep)[::-1]) plot(ss, Ts, '.2') if fill != None: if fill == True: fill = 'silver' fill_between(ss, Ts, Tf, color=fill, alpha=.5) return ss, Ts
def tv_phase_envelope(substance, fill=None): Tc = pr('Tcrit', substance) Tf = pr('Tmin', substance) Tsweep = linspace(Tf, Tc, 100) Tsweep[-1] = Tc - .1 v_sl = 1 / pr('D', 'Q', 0, 'T', Tsweep, substance) v_sv = 1 / pr('D', 'Q', 1, 'T', Tsweep, substance) vs = array(list(v_sl) + list(v_sv)[::-1]) Ts = array(list(Tsweep) + list(Tsweep)[::-1]) plot(vs, Ts, '.2') if fill != None: if fill == True: fill = 'silver' fill_between(vs, Ts, 0, color=fill, alpha=.5) return vs, Ts
def ph_phase_envelope(substance, fill=False): Pc = pr('Pcrit', substance) Psweep = linspace(1e4, Pc, 100) Psweep[-1] = Pc - .01 h_sl = pr('H', 'Q', 0, 'P', Psweep, substance) h_sv = pr('H', 'Q', 1, 'P', Psweep, substance) hs = array(list(h_sl) + list(h_sv)[::-1]) Ps = array(list(Psweep) + list(Psweep)[::-1]) plot(hs, Ps, '.2') if fill != None: if fill == True: fill = 'silver' fill_between(hs, Ps, 0, color=fill, alpha=.5) return hs, Ps
def pv_phase_envelope(substance, fill=None): Pc = pr('Pcrit', substance) Pm = pr('P_min', substance) Psweep = linspace(Pm, Pc, 100) Psweep[-1] = Pc - .01 v_sl = 1 / pr('D', 'Q', 0, 'P', Psweep, substance) v_sv = 1 / pr('D', 'Q', 1, 'P', Psweep, substance) vs = array(list(v_sl) + list(v_sv)[::-1]) Ps = array(list(Psweep) + list(Psweep)[::-1]) plot(vs, Ps, '.2') if fill != None: if fill == True: fill = 'silver' fill_between(vs, Ps, 0, color=fill, alpha=.5) return vs, Ps
def stater(arg1, arg2, arg3, arg4, arg5): out = {} arg1 = arg1.upper() arg3 = arg3.upper() terms = ['T', 'H', 'U', 'S', 'Q', 'P', 'D'] #allow volume calcs if arg1 == 'V': arg1 = 'D' arg2 = 1 / arg2 if arg3 == 'V': arg3 = 'D' arg4 = 1 / arg4 for t in terms: out[t] = pr(t, arg1, arg2, arg3, arg4, arg5) ##weird bug that cody and nikita caught bad = "V,D,Q".split(",") if (arg1 in bad) and (arg3 in bad): #"this might be borked" arg1 = 'D' arg2 = out['D'] arg3 = 'T' arg4 = out['T'] for t in terms: out[t] = pr(t, arg1, arg2, arg3, arg4, arg5) out['V'] = 1 / out['D'] try: out['phase'] = ph(arg1, arg2, arg3, arg4, arg5) except: out['phase'] = "NA" out['substance'] = arg5 return out