From 59f5666c851e3ad32689f8e90d859c00818dcd50 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Thu, 11 Mar 2004 03:02:57 +0000 Subject: [PATCH] *** empty log message *** --- Cantera/python/Cantera/pureFluids.py | 16 ++++ Cantera/python/examples/rankine.py | 37 +++++++++ data/inputs/purefluids.cti | 108 +++++++++++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 Cantera/python/Cantera/pureFluids.py create mode 100644 Cantera/python/examples/rankine.py create mode 100644 data/inputs/purefluids.cti diff --git a/Cantera/python/Cantera/pureFluids.py b/Cantera/python/Cantera/pureFluids.py new file mode 100644 index 000000000..f768ca398 --- /dev/null +++ b/Cantera/python/Cantera/pureFluids.py @@ -0,0 +1,16 @@ +from importFromFile import importPhase + +def Water(): + return importPhase('purefluids.cti','water') + +def Nitrogen(): + return importPhase('purefluids.cti','nitrogen') + +def Methane(): + return importPhase('purefluids.cti','methane') + +def Hydrogen(): + return importPhase('purefluids.cti','hydrogen') + +def Oxygen(): + return importPhase('purefluids.cti','oxygen') diff --git a/Cantera/python/examples/rankine.py b/Cantera/python/examples/rankine.py new file mode 100644 index 000000000..5ff973ce3 --- /dev/null +++ b/Cantera/python/examples/rankine.py @@ -0,0 +1,37 @@ +# +# an ideal Rankine cycle +# +from Cantera import * +from Cantera.pureFluids import Water + +w = Water() + +# start with saturated liquid water at 300 K +w.setTemperature(300.0) +w.setState_satLiquid() +h1 = w.enthalpy_mass() +p1 = w.pressure() + +# pump it isentropically to 10 MPa +w.setState_SP(w.entropy_mass(), 1.0e7) +h2 = w.enthalpy_mass() + +pump_work = h2 - h1 + +# heat at constant pressure to 1500 K +w.setState_TP(1500.0, w.pressure()) +h3 = w.enthalpy_mass() + +heat_in = h3 - h2 + +# expand isentropically back to 300 K +w.setState_SP(w.entropy_mass(), p1) +h4 = w.enthalpy_mass() + +work_out = h3 - h4 +heat_out = h4 - h1 + +efficiency = (work_out - pump_work)/heat_in + +print 'efficiency = ',efficiency + diff --git a/data/inputs/purefluids.cti b/data/inputs/purefluids.cti new file mode 100644 index 000000000..a9f52b31d --- /dev/null +++ b/data/inputs/purefluids.cti @@ -0,0 +1,108 @@ +# These phase definitions actually represent multiphase fluids. They +# use equations of state in the 'TPX' package, which in turn take most +# of the equations of state from the compilation 'Thermodynamic +# Properties in SI', by W. C. Reynolds. + + +pure_fluid(name = "water", + elements = " O H ", + species = "H2O", + substance_flag = 0, + initial_state = state(temperature = 300.0, + pressure = OneAtm) ) + +pure_fluid(name = "nitrogen", + elements = " N ", + species = "N2", + substance_flag = 1, + initial_state = state(temperature = 300.0, + pressure = OneAtm) ) + +pure_fluid(name = "methane", + elements = " C H ", + species = "CH4", + substance_flag = 2, + initial_state = state(temperature = 300.0, + pressure = OneAtm) ) + +pure_fluid(name = "hydrogen", + elements = " H ", + species = "H2", + substance_flag = 3, + initial_state = state(temperature = 300.0, + pressure = OneAtm) ) + +pure_fluid(name = "oxygen", + elements = " O ", + species = "O2", + substance_flag = 4, + initial_state = state(temperature = 300.0, + pressure = OneAtm) ) + + +#------------------------------------------------------------------ +# Note that these species definitions are used ONLY to set the +# reference state values for the entropy and enthalpy, and to define the +# elemental composition. They are not used to compute properties. +#------------------------------------------------------------------ + +species(name = "H2O", + atoms = " H:2 O:1 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 4.198640560E+00, -2.036434100E-03, + 6.520402110E-06, -5.487970620E-09, 1.771978170E-12, + -3.029372670E+04, -8.490322080E-01] ), + NASA( [ 1000.00, 3500.00], [ 3.033992490E+00, 2.176918040E-03, + -1.640725180E-07, -9.704198700E-11, 1.682009920E-14, + -3.000429710E+04, 4.966770100E+00] ) + ) + ) + +species(name = "N2", + atoms = " N:2 ", + thermo = ( + NASA( [ 300.00, 1000.00], [ 3.298677000E+00, 1.408240400E-03, + -3.963222000E-06, 5.641515000E-09, -2.444854000E-12, + -1.020899900E+03, 3.950372000E+00] ), + NASA( [ 1000.00, 5000.00], [ 2.926640000E+00, 1.487976800E-03, + -5.684760000E-07, 1.009703800E-10, -6.753351000E-15, + -9.227977000E+02, 5.980528000E+00] ) + ) + ) + +species(name = "CH4", + atoms = " C:1 H:4 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 5.149876130E+00, -1.367097880E-02, + 4.918005990E-05, -4.847430260E-08, 1.666939560E-11, + -1.024664760E+04, -4.641303760E+00] ), + NASA( [ 1000.00, 3500.00], [ 7.485149500E-02, 1.339094670E-02, + -5.732858090E-06, 1.222925350E-09, -1.018152300E-13, + -9.468344590E+03, 1.843731800E+01] ) + ) + ) + +species(name = "O2", + atoms = " O:2 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 3.782456360E+00, -2.996734160E-03, + 9.847302010E-06, -9.681295090E-09, 3.243728370E-12, + -1.063943560E+03, 3.657675730E+00] ), + NASA( [ 1000.00, 3500.00], [ 3.282537840E+00, 1.483087540E-03, + -7.579666690E-07, 2.094705550E-10, -2.167177940E-14, + -1.088457720E+03, 5.453231290E+00] ) + ) + ) + +species(name = "H2", + atoms = " H:2 ", + thermo = ( + NASA( [ 200.00, 1000.00], [ 2.344331120E+00, 7.980520750E-03, + -1.947815100E-05, 2.015720940E-08, -7.376117610E-12, + -9.179351730E+02, 6.830102380E-01] ), + NASA( [ 1000.00, 3500.00], [ 3.337279200E+00, -4.940247310E-05, + 4.994567780E-07, -1.795663940E-10, 2.002553760E-14, + -9.501589220E+02, -3.205023310E+00] ) + ) + ) +