time_list=[] temp_list=[] time_list2=[] temp_list2=[] time_list3=[] temp_list3=[] NotOpenVent = False for n in range(166000): time = (n+1)*0.00002 area_valve = 5.E-5 roh = r1.density() kappa = gas.cp_mole()/gas.cv_mole() nym_real = min(gas_sink.pressure()/r1.pressure(),((2./(kappa+1.))**(kappa/(kappa-1.)))) #print nym_real,gas_sink.pressure()/r1.pressure(),((2./(kappa+1.))**(kappa/(kappa-1.))) Ausfluss = ( (kappa/(kappa-1.)) * (nym_real**(2./kappa))* (1.-(nym_real**((kappa-1.)/kappa)))**(1./2.)) Kv = area_valve * 1. * Ausfluss * (2*gas_sink.pressure()*roh)**(1./2.) / roh print r1.density(),r1.temperature(),r1.pressure() if (r1.pressure()/1E5)>1.5 or NotOpenVent: v1.setValveCoeff(Kv) NotOpenVent = True sim.advance(time)
# steady state. A few residence times should be enough. t = 0.0 time_list=[] CO_list=[] Quell_list=[] for n in range(19000): tres = mixer.mass()/(mfc1.massFlowRate() + mfc2.massFlowRate()) t += 2*tres sim.advance(t) time_list.append(t) #reflow = mixer.massFraction('CO') * outlet.massFlowRate()/5 #mfc3.set(mdot = reflow) Quell_list.append(mfc2.massFlowRate()) CO_list.append(mixer.density()*mixer.massFraction('CO')*1000*1000) if t>1.: mfc2.set(mdot=0.1) if t>5.: mfc2.set(mdot=0.0) print '%14.5g %14.5g %14.5g ppm CO %14.5g kg/s'% (t, mixer.massFraction('CO'),mixer.density()*mixer.massFraction('CO')*1000*1000,mfc2.massFlowRate()) p.plot(list_to_array(time_list),list_to_array(CO_list)) p.plot(list_to_array(time_list),list_to_array(Quell_list),'+') p.show() # view the state of the gas in the mixer #print mixer.contents()