Open JustinSGray opened 2 years ago
Pythonized version of the above code
# CONSTANTS ===============================================================
C_calToJoule = 4.184 # J/cal, conversion constant
C_lbmToGram = 453.59 # g/lbm, conversion constant
C_BTUtoCal = 252.16 # cal/BTU, conversion constant
C_BTUtoJoule = 1055.056 # J/BTU, conversion constant
hof_CO2 = -393510. # heat of formation of CO2, J/mol
hof_H2O = -241826. # heat of formation of water, J/mol
MW_C = 12.0107 # molar weight of Carbon, g/mol
MW_H = 2.01588/2. # molar weight of Hydrogen, g/mol
MW_O2 = 31.9988 # molar weight of DIatomic Oxygen, g/mol
MW_N = 28.0134/2. # molar weight of Nitrogen, g/mol
MW_air = 28.965116 # molar weight of air
fAir_O2 = 0.23141563 # fraction of air that is O2 by mass
# air is defined by CEA on a molar basis as:
# 78.0840 mol N2 20.9476 mol O2 0.9365 mol Ar 0.0319 mol CO2
# uncomment the following lines if a different air composition is desired
# MW_air = (78.084*(MW_N*2.) + 20.9476*MW_O2 + 0.9365*39.948 + 0.0319*44.0095 )/100.;
# fAir_O2 = (20.9476*MW_O2/100. ) / MW_air;
# INPUTS ==================================================================
Carbon = 0. # number of Carbon atoms in the fuel
Hydrogen = 2 # number of Hydrogen atoms in the fuel
Oxygen = 0. # number of Oxygen atoms in the fuel
Nitrogen = 0. # number of Nitrogen atoms in the fuel
fuelHOF = -218000 # heat of formation of the fuel, J/mol e.g. -45940 J/mol for NH3
# hydrogen: 218,000 J/mol
effComb = 1. # combustion efficiency
# molar weight of fuel from input definition
MW_fuel = Carbon*MW_C + Hydrogen*MW_H + Nitrogen*MW_N + Oxygen*MW_O2/2.;
# OUTPUTS =================================================================
# MW_fuel # molar weight of the fuel, g/mol
# mFuel # mass of fuel from stoichiometric reaction
# mO2 # mass of Oxygen from stoichiometric reaction
# OFratio # Oxygen-to-fuel mass ratio
# LHV # fuel lower heating value, BTU/lbm
# FARstoich # stoichiometric fuel-to-air mass ratio
# J/mol cal/J g/lbm BTU/cal mol/g = BTU/lbm
LHV = (( fuelHOF - Carbon*(hof_CO2) - Hydrogen*(hof_H2O)/2. )
/C_calToJoule * C_lbmToGram / C_BTUtoCal / MW_fuel / effComb)
# assumed stoichiometric reaction, fuel is defined as CxHyNwOz
# xC yH wN zO + qO2 --> xCO2 + (y/2)H2O + (w/2)N2 where q = x + y/4 - z/2
mFuel = Carbon*MW_C + Hydrogen*MW_H + Nitrogen*MW_N + Oxygen*MW_O2/2.;
mO2 = ( Carbon + Hydrogen/4. - Oxygen/2. )*MW_O2;
OFratio = mO2 / mFuel;
FARstoich = fAir_O2 / OFratio;
print("LHV =", LHV, " BTU/lbm ")
print("FAR stoich = " ,FARstoich)
The computations above have two problems: 1) they assume a HOF for the fuel to compute LHV ... when we normally want to go the other way 2) they didn't actually compute the specific enthalpy of the fuel we need, which is based on the HOF for fuel
Here are better ones. the fuel_h
value is the one you actually need to set in a pyCycle model. You would do this by setting the mix_fuel.mix:h
variable in the burner. Note that you need to make sure to set this in ALL points. If you are using the MPCycle
group, you can promote it as a cycle parameter.
This would look something like:
prob.set_val('DESIGN.burner.mix_fuel.mix:h', -750.239580565205, units='Btu/lbm')
# CONSTANTS ===============================================================
C_calToJoule = 4.184 # cal/J, conversion constant
C_lbmToGram = 453.59 # g/lbm, conversion constant
C_BTUtoCal = 252.16 # cal/BTU, conversion constant
C_BTUtoJoule = 1055.056 # BTU/J, conversion constant
hof_CO2 = -393510. # heat of formation of CO2, J/mol
hof_H2O = -241826. # heat of formation of water, J/mol
MW_C = 12.0107 # molar weight of Carbon, g/mol
MW_H = 2.01588/2. # molar weight of Hydrogen, g/mol
MW_O2 = 31.9988 # molar weight of Diatomic Oxygen, g/mol
MW_N = 28.0134/2. # molar weight of Nitrogen, g/mol
MW_air = 28.965116 # molar weight of air
fAir_O2 = 0.23141563 # fraction of air that is O2 by mass
# air is defined by CEA on a molar basis as:
# 78.0840 mol N2 20.9476 mol O2 0.9365 mol Ar 0.0319 mol CO2
# uncomment the following lines if a different air composition is desired
# MW_air = (78.084*(MW_N*2.) + 20.9476*MW_O2 + 0.9365*39.948 + 0.0319*44.0095 )/100.;
# fAir_O2 = (20.9476*MW_O2/100. ) / MW_air;
# INPUTS ==================================================================
Carbon = 12 # number of Carbon atoms in the fuel
Hydrogen = 23 # number of Hydrogen atoms in the fuel
Oxygen = 0 # number of Oxygen atoms in the fuel
Nitrogen = 0 # number of Nitrogen atoms in the fuel
effComb = 1. # combustion efficiency
# molar weight of fuel g/mol
fuelMW = Carbon*MW_C + Hydrogen*MW_H + Nitrogen*MW_N + Oxygen*MW_O2/2.;
print("fuel molar weight (g/mol): ",fuelMW)
# OUTPUTS =================================================================
# mFuel # mass of fuel from stoichiometric reaction
# mO2 # mass of Oxygen from stoichiometric reaction
# OFratio # Oxygen-to-fuel mass ratio
# LHV # fuel lower heating value, BTU/lbm
# FARstoich # stoichiometric fuel-to-air mass ratio
fuelLHV = 18529.6813 # BTU/lbm
fuelHOF = fuelLHV*fuelMW*effComb/C_lbmToGram*C_BTUtoJoule + Carbon*(hof_CO2) + Hydrogen*(hof_H2O)/2.
# fuelHOF = fuelLHV*fuelMW*effComb/C_lbmToGram*C_BTUtoCal + Carbon*(-94051.15) + Hydrogen*(-57797.8)/2.
print("fuelHOF (J/mol): ", fuelHOF)
print("fuelHOF (cal/mol): ", fuelHOF/C_calToJoule)
fuel_h = fuelHOF/fuelMW # J/g
print('fuel_h (J/g): ', fuel_h)
print('fuel_h (BTU/lbm): ', fuel_h/C_BTUtoJoule*C_lbmToGram)
The current combustor code has an input for fuel specific enthalpy. The default value is 0, which is what has been used in just about everything.
This is not correct. There is a non-zero (usually negative) fuel enthalpy that needs to be computed relative the LHV of the fuel you are using. This can be computed...
Without breaking ALL of the existing regression test that rely on 0 fuel enthalpy ... we need to account for this.
Probably just add a helper function and some fuel-data somewhere, and add an option to use it or not. Then we can set all the reg tests to not use it ... default should probably be to have it turned on though.
Some NPSS calculations: