> |
restart:#"m09_nomen".23-06-2005. |
Elementary procedures available for chemical reactions and combustion computation.
NOTE: To be able to name substances by an index and make automatic computations, only compounds formed with the atom set {C,H,O,N,S} are considered, and only a given list of them (might be appended with new compounds).
List of funcions and procedures available with `../therm_chem.m`:
> |
read`../therm_chem.m`:with(therm_chem); |
NOMENCLATURE
Global constants from `../therm_const`: T25=298 K, p0= 100 kPa, c21=0.21, c79=0.79.
Global constants from `../therm_chem`: Elem,Comp,CompElem,state,cps,cpComp,C_,h1_,g1_,s1_,h2_,g2_,s2_..
Elements (atoms):
Compounds (keep a numbered list to refer to each one). C_ gives the total number listed.
WARNING: several compounds are twice: first as a liquid and after as a gas (H2O(l) is the 5th)
CompElem holds the matrix of atomic composition of the compounds.
'state' is the list of phisical states at standard conditions (T25=25 ÂșC, p0=100 kPa)
'cps' is the list of mean c[p]-values appropriate for computations (34 J/(mol*K) for diatomic molecules, 47 for water-vapour, 54 for CO2, 99 for unknown, etc. cpComp is the full assignment list:
MfComp is the list of molar masses.
Thermochemical data.
If only one or two values were needed, one may do:
> |
su:="H2O(l)":hgsdat:=therm_chem[get_hgs_data](convert(su,string)); |
but, as it is always the case that several compounds intervene in a reaction, 'therm_chem.m' provides the whole set of values as h1_,g1_,s1_,h2_,g2_,s2_...
> |
member(H2O,Comp,i);i,h||i||_,g||i||_,s||i||_; |
To fetch the list of stoichiometric coefficients from a given chemical equation.
WARNING: H2O and the other liquids are assumed at the standard liquid state.
> |
eq:=CO+a*H2=b*H2+0*CO+c*CH4O;nulist(eq); |
To fit the stoichiometric coefficients from a given chemical equation.
An auxiliar procedure constructs the 5-Element Balance Equations.
> |
seqEBE(eq);'eqBC'=eqBC;'eqBH'=eqBH;'eqBO'=eqBO;'eqBN'=eqBN;'eqBS'=eqBS;eq_fit(eq); |
To compute the enthalpy of reaction and the like.
WARNING: H2O and the other liquids are assumed at the standard liquid state.
> |
i:='i':h[r]:=Sum(nu[i]*h[i],i=1..C);eq:=CH4+2*O2=CO2+2*H2O;hgs_r25(eq); |
Calorific values of a fuel (really of a combustion reaction) are related to the reaction enthalpy.
The combustion reaction must be given for 1 mol of fuel.
> |
PCS:='-h[r]';eq:=CH4+2*O2=CO2+2*H2O;PCS_:=-hgs_r25(eq)[1]:'PCS'=evalf(%,3);PCI_:=PCI(eq):'PCI'=evalf(%,3); |
Equilibrium composition.
CAREFUL that now H2O and the other liquids are assumed at the standard virtual gas state.
Finally, to pass from a sketch of the mixture eqation (e.g. eqmix:=a*C+b*O2=[2,4,7] to the mixture eqation (substituting indices by compounds).
Additionally, the delta list of exhaust-compounds and the extended balance equations eqNX,eqBC,eqBH,eqBO,eqBN,eqBS and are globally created.
> |
eq:=therm_chem[eqMIX](a*CH4+b*(c21*O2+c79*N2)=[3,4,5]);i:='i':'delta'=[seq(delta[i],i=1..nops(Comp))];eqNX;eqBC;eqBH;eqBO;eqBN;eqBS;sol1_:=subs(Const,solve({eqNX,eqBC,eqBH,eqBO,eqBN,eqBS},{a,b,x[N2],x[CO2],x[H2O]})):'sol1'=evalf(%,3);A[0]:=b/a;subs(sol1_,b/a):'A[0,CH4]'=evalf(%,2); |
and the theoretical air to fuel ratio:
> |
Ateo(CuHvOwNxSy);A[0,CH4]:=rhs(Ateo(CH4)); |