Comments (2)
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)
from pycycle.
The computations above have two problems:
- they assume a HOF for the fuel to compute LHV ... when we normally want to go the other way
- 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)
from pycycle.
Related Issues (20)
- MFTF example throws error with OpenMDAO 3.1 HOT 1
- Dodecane in janaf.py file
- Unit confusion in species_data.py
- Composition array shape error when using wet air thermo and bleeds
- Problem loading 4.0.0 HOT 1
- Problem checking out version 4.0.0 HOT 3
- Change breaks existing code HOT 1
- Adapting pyCycle to extra-terrestrial atmosphere HOT 1
- Variable Aliasing in Helper functions
- PSFC units in performance.py
- How to add Combustion efficiency HOT 2
- Issues related to MAP correction of off-design points HOT 3
- N3ref mudule
- How to visualize a map HOT 4
- 0
- caculation of off-design points for mixed-turbofan
- Issue about whether MAP is automatically scaled
- How do I convert input and output variables
- Repoducing baseline design examples HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycycle.