[Go to previous section: 3.2| Go to next section: 3.4]
[ Go to CENG301 Homepage | CENG301 Notes Table of Contents]

3.3: Energy Flow Sheet Functions - Page 1

On this page:

On page 2:

3.3.0 Intro

We will consider fluids that are ideal in the sense that the energy associated with a fluid mixture is identical to the energy of the same compounds flowing in separate streams. In essence we will neglect any energy effects associated with mixing of compounds. The molar flow rate of a fluid mixture made up of C compounds is:

where Nk is the molar flow rate of compound k.

We will assume that the total enthalpy content of the mixture is simply:

where is the molar specific enthalpy of the mixture
and k is the molar specific enthalpy of compound k at the conditions in the stream.

Changes in enthalpy of a pure compound are due to:

a) changes in temperature
b) changes in state
c) changes in pressure.

We will consider only the first two of these changes in enthalpy.

The following functions in ~ceng301/matlab/mods will be discussed in this chapter:

3.3.1 Table of the Main Energy Balance Functions


Used for



Determine the enthalpy change for a compound for given temperature change. This only accounts for sensible heat effects!



Determine the enthalpy change for a compound for given temperature change. Gives the same result as enth1, but uses the MATLAB function polyval to do most of the work.



Determine the enthalpy change for multiple compounds for given temperature change.



Determine the enthalpy of one or more compounds relative to the elements at 25°C. All of the compounds must be in the same state.



Extension of HinkJ to allow more than one temperature to be given.



Set the flow and energy conditions in a stream.



The mixer mass and energy balance module.



The separator mass and energy module.



The splitter mass and energy balance module.



The reactor mass and energy balance module: only one exit stream.



Extension of reacte to allow multiple exit streams.



Display the flow rates and energy content of each stream in or out of a module.

Prior to use of most of these modules, you must use start301 to specify compounds and retrieve property data for them. The functions enth1, enth2 and enth3 all determine the enthalpy change associated with temperature changes in pure compounds.

The functions enth1 and enth2

The functions enth1 and enth2 calculate the change in enthalpy for a substance undergoing a temperature change at constant pressure. Each uses a polynomial approximation for the heat capacity:

cp = a + (b * T) + (c * T2) + ...

to determine the enthalpy change associated with a change in temperature from Ti to Tf. Integration of this polynomial gives the enthalpy change at constant state and pressure:

Note that many different kinds of polynomial approximations can be found for different compounds. These may include:

  1. use of the temperature in different units: K, °C, °F, or R,
  2. giving results in different units such as J, kJ, cal or BTU,
  3. different ranges for the polynomial powers.

All of the polynomials in the Appendices and our MATLAB Data Bank require the temperature to be in K and give the enthalpy change in Joules. All are polynomials with up to fourth powers of the temperature. You may find many other kinds of polynomial approximations including ones with negative powers of the temperature. The two functions: enth1 and enth2 have the same effect but use different methods for achieving their results. Enth1 lists as:



Note the "for" loop used to evaluate the polynomial. Our enth2 uses the MATLAB polyval function with the specific heat coefficients for the integral of cp to do the same thing. It avoids obvious looping and serves as a check on enth1.


Both enth1 and enth2 must be given three arguments. The comments in the functions define each argument. We will follow the suggestions in the comment about both functions to set properties for benzene. Here is the session using the FORTRAN program start301 to set up the test file with benzene data in it, beginning by selecting (1) New Session, Energy & Mass Balances, using CENG 301's database, and Kelvin as the temperature unit:

Input the name of your new file: test
The output file name is: test

Input the number of compounds: 1
The number of compounds is: 1

Enter the name of compound # 1: benzene
Enter the number of reactions: 0

Here are your compounds' formulae and names:
No. Formula  Name
  1 C6H6     benzene 

Here are your reactions:
No reactions given

Enter the number of streams: 0

The variables for your compounds have now been created,
you may continue, or come back later and reload the same data.

The variable cpv has the specific heat coefficients for vapor benzene:

>> cpv
cpv =
   18.5800   -0.0117    0.0013   -0.0000    0.0000

The last two coefficients appear to be zeros, but we can see that they are not by:

>> format long
>> cpv
cpv =
  Columns 1 through 4 
  18.58000000000000  -0.01174000000000   0.00127500000000  
  Column 5 
>> format short

The function enth1 finds the enthalpy change associated with any temperature change over which the specific heat approximation is valid. For example the change associated with heating one mol of benzene vapor from 300K to 400K could be found by:

>> enth1(300,400,cpv) 
ans =

The change associated with heating one mole of liquid from 300 to 400 K could be found by using the data stored in cpl:

>> cpl
cpl =
   -7.2732    0.7705   -0.0016    0.0000
>> enth1(300,400,cpl)
ans =

If we look for the specific heat of solid benzene:

>> cps
??? Undefined function or variable cps.

There was no data for solid benzene in the data file.

To use the second enthalpy change function, we need to have our coefficients ordered in descending powers of temperature and to be divided by the power. This is the way data is stored in the variables that start with "icp". In a previous version of start301, the variables starting with "icp" were created and saved. However, since they are created from other variables and not needed for energy balances themselves, they were not created in the current version of start301. To demonstrate the use of the enthalpy functions, the intcp and intcp2 functions were created to give us the "icp" variables after running start301. If we set benzene and water as our compounds we will find after executing start301:

Here are your compounds' formulae and names:
No. Formula  Name
  1 C6H6     benzene 
  2 H2O      water
>> intcp
>> icpv
icpv =
    0.0000   -0.0000    0.0004   -0.0059   18.5800
    0.0000   -0.0000    0.0000   -0.0048   34.0400
>> icpl
icpl =
    0.0000   -0.0005    0.3853   -7.2732
    0.0000   -0.0004    0.2361   18.2960
>> icps
icps =
       NaN       NaN       NaN       NaN
    0.0000   -0.0003    0.1220   -2.4167

The function intcp2 may also be used as shown in the help for enth2 to make the "icp" arrays without storing them. In the previous session with benzene as the only compound, cps was not defined. This time there is data for solid water (ice), but the missing data for the specific heat of solid benzene produces a string of NaN's. The function enth2 works only for a single compound, so we use it for benzene vapor as:

>> enth2(300,400,icpv(1,:)) 
ans =

The answer is always in J/mol for the data stored in the compound files. Note the difference between liquid and vapor enthalpy differences. If you use cp data in other units (such as AE units in some of the Tables in the Appendix of Reklaitis) the answer would be in other units (such as Btu/lb mol.)

The Function: enth3

The main problem with the functions enth1 and enth2 is that the enthalpy change for only a single compound can be found. Frequently we will want the enthalpy change for all the compounds in a flowing mixture. That is the purpose of enth3. It is assumed in enth3 that the compounds have been identified by execution of the start301 program. Furthermore, all of the compounds must be in the same state. The three arguments required by enth3 give the initial and final temperatures and the state of the compounds. Here is what help shows:

>> help enth3

  enth3 finds the sensible enthalpy change (J/mol)for compounds
       designated in the vector j or all of them if 4th argument
       is omitted.
  All the designated cmpds MUST be in the same state and
       must be set with start301 before execution of enth3 
  function ents=enth3(ti,tf,s,j)
       ti    the initial temperature in K.
       tf    the final temperature in K.
       s     the state of the compounds: 
               'v'    for vapor or 
                       'l'    for liquid or 
             's'    for solid.
       j     compounds designated in cnms
  See also ENTH1 and ENTH2
  Example:  After executing start301. 
    with the compounds: benzene(1), water(2) carbon(3)
  OKB, revised help by TYLC, SHD & MAH

We can see how to use enth3 by the following session following execution of start301 to specify benzene and water as the compounds:

>> enth3(300,400,'v')
ans =
   1.0e+03 *
    9.7166    3.3904
>> enth3(300,400,'l')
ans =
   1.0e+04 *
    1.4218    0.7592
>> enth3(300,400,'s')
ans =
   1.0e+03 *
       NaN    5.6130

Note that the absence of data for solid benzene this time is indicated by the value of NaN found the for the enthalpy change.

The Functions: HinkJ and mHinkJ

The function HinkJ uses data extracted by the start301 program to calculate the enthalpy of compounds with given names or formula stored in cnms at one specific temperature relative to the elements in their normal states at 25°C. In contrast to the enth functions, the enthalpies calculated by HinkJ are given in kJ/mol. The arguments of the function are:

  1. the temperature in Tdeg,
  2. the state of the compounds: v, l, or s,
  3. the indices of the compounds in cnms that will be found.

If the third argument is omitted, the enthalpies of all the compounds will be found. The data used by the function are polynomial coefficients stored in the arrays: hcpv, hcpl and hcps when setname is executed. Here are the comments from HinkJ:

>> help HinkJ
  HinkJ		- Finds enthalpies for compounds relative to elements
  function h=HinkJ(t,s,j)
  HinkJ calculates the enthalpy of cmpds (all in the same state) 
   relative to their elements in their normal states at 25 degrees C
  Returns the enthalpy in KJ/mol
  Must execute the start301 programs first
  See also mHinkJ
  Argument   Gives
     t      temperature in units of Tdeg.
     s      State: 'v', 'l' or 's'.
     j      Indices of compounds in cnms
            that are to be found.  If the
            3rd argument is omitted, all are found.
  Example: After executing start301 with the cmpds in this order:
 	benzene, water, carbon, bromine and no streams
 	>>HinkJ(300,'v');   this will find enthalpy for all cmpds
 	>>HinkJ(300,'l',[1 2 4]);  this will find enthalpy for cmpds 1,2,4
  OKB, revised help by TYLC

An auxiliary function: at allows the user to specify temperatures in any of the common units: Celsius, Fahrenheit, or Rankine in addition to Kelvin. The global variable Tdeg must be set as 'C', 'F', 'R' or 'K'. Then any temperature given in one of those 4 units will be converted to Kelvin as required in the argument right of the two enthalpy functions. It lists as:


Its use is shown by:

>> Tdeg='K';   <--- Working in Kelvin,
>> at(300)     <--- at gives back its argument
ans =
>> Tdeg='C';   <--- Working in Celsius,
>> at(25)      <--- at adds 273.15 to its argument
ans =

The at function is used in HinkJ and many of the vapor-liquid equilibrium functions. When you have Tdeg = 'C', any temperature inputs in the argument of the (module) programs will be interpreted as being in °C and will then be converted automatically to Kelvin.
>> Tdeg='F'; <--- Working in Fahrenheit, >> at(212) <--- at adds 459.67 and divides the result by 1.8 ans = 373.1500 <--- The boiling point of water is 212°F or 373.15K >> Tdeg='K'; <--- Let's go back to using K.

Now let's see how to find the enthalpy of various compounds with temperature in K. Using start301:

Here are your compounds' formulae and names:
No. Formula  Name
  1 C6H6     benzene 
  2 H2O      water   
  3 C        carbon  
  4 Br2      bromine 
>> HinkJ(300,'v')
ans =
   83.0815 -241.7679       NaN   30.6494

Obviously, there is no data for carbon as a gas. If we want only those compounds that we have data for, then we must specify the ones that we want in the third argument:

>> HinkJ(300,'v',[1 2 4]) 
ans =
   83.0815 -241.7679   30.6494

Here is what we find for a liquid stream:

>> HinkJ(300,'l') 
ans =
   49.9513 -285.4883       NaN    0.1313

Finally, here is what we get for the solids:

>> HinkJ(300,'s') 
ans =
       NaN -292.4029    0.0172       NaN

This time, we only have data for water and carbon. An extension that allows the user to give multiple temperatures and get a matrix of enthalpies for each temperature as well as each compound is called: mHinkJ. The help on mHinkJ explains how to use it.

>> help mHinkJ
mHinkJ - Finds enthalpies for compounds, allows multiple temperatures
  function hs=mHinkJ(ts,s,j)
  Matrix version of HinkJ.  The temperatures may be a vector.
  Other arguments are the same as in HinkJ and all cmpds must be in same
        state with temperature designated by Tdeg
  Argument   Gives
     s     the physical state: 'v' for vapor, 'l' for liquid
               or 's' for solid.
     j     the indices of the compounds in cnms that are
           to be included.  If the third argument is omitted,
           all compounds are included.
  hs returns the enthalpies for each temperature in a row and
    each compound in a column.
  Example: For cnms set with the start301 programs and only water in it:
      mHinkJ([200 300],'v')
      will give the enthalpy of vapor water at 200K and 300K
      as a column vector.

Here is the result returned by mHinkJ for the same session shown before with the four compounds benzene, water, carbon and bromine. We can find the enthalpies of all the compounds at various states at the temperatures 25°C and 100°C by:

>> Tdeg='C';
>> mHinkJ([25 100],'v')
ans =
   82.9300 -241.8300       NaN   30.5827
   89.9007 -239.2945       NaN   33.2999
>> mHinkJ([25 100],'l')
ans =
   49.7168 -285.6272       NaN         0
   60.0348 -279.9550       NaN    5.3102
>> mHinkJ([25 100],'s')
ans =
       NaN -292.4834         0       NaN
       NaN -288.5873    0.7777       NaN

The enthalpy function HinkJ is used with the functions mixe, sepe, and reacte to accomplish energy balances for a mixer, separator, and reactor, respectively.

Comparison of Enthalpies from HinkJ with those from the Fortran Programs

Example 7.18 in the Text

The steam and thermprop programs were used to find the enthalpies of water and carbon dioxide at a variety of pressures and temperatures. These values are compared to those given by HinkJ in the next session to show how this requires a conversion of units and adjustment for different reference states. The values from both sources were then used to work example The next table shows the enthalpies found with the FORTRAN programs.

Temperature C
Pressure kPa
Enthalpy kJ/kg

Here are your compounds' formulae and names:
No. Formula Name
 1 H2O water 
 2 CO2 carbon dioxide 
 3 O2 oxygen 
Here are your reactions:
No reactions given
Enter the number of streams: 3
Sensible heat in Liquid Water
>> Hsliq=[209.33 640.12];  <-- Liquid water from steam
>> TsHliq=[50 151.844];
>> dHliq=diff(Hsliq)*mw(1,1)/1000  <-- differences converted to kJ/mol
dHliq =
 7.7607     <-- from steam program in kJ/mol
>> enth1(at(TsHliq(1)),at(TsHliq(2)),cpl(1,:)) <-- J/mol note at converts
ans =                                                    C to K
>> HinkJ(TsHliq(2),'l',1)- HinkJ(TsHliq(1),'l',1) <-- kJ/mol
ans =
Sensible heat in Vapor Water
>> Hsvap=[2675.43 2855.13 2943.04]; <- P was 1, 5 and 10 bar
>> TsHvap=[99.632 200 250];
>> dHvap=diff(Hsvap)*mw(1,1)/1000
dHvap =
 3.2373 1.5837
>> MatHvs=mHinkJ(TsHvap,'v',1)'
MatHvs =
 -239.3070 -235.8482 -234.0903
>> diff(MatHvs)
ans =
 3.4588 1.7580 <-- Neglecting P effect overestimates dHs.
Sensible and Latent heat in Water
>> dHlv5=(Hsvap(2)-Hsliq(2))*mw(1,1)/1000   <-- at 5 bar
dHlv5 =
>> HinkJ(TsHvap(2),'v',1)-HinkJ(TsHliq(2),'l',1)
ans =
Sensible and Latent Heat in Carbon Dioxide
>> HsCO2=[-19.92 406.6 458.66]; <-- These are at 20, 10 and 1 bar
>> TsCO2=[-50 50 100];
>> dHsCO2=diff(HsCO2)*mw(2,1)/1000
dHsCO2 =
 18.7711 2.2912
>> matHsCO2= [HinkJ(TsCO2(1),'l',2),mHinkJ(TsCO2(2:3),'v',2)']
matHsCO2 =
 -411.3913 -392.5578 -390.5949
>> diff(matHsCO2)
ans =
 18.8334 1.9630

>> dHtext=2693.36-467.13  <-- from steam at 1.5 bar
dHtext =
>> dHst=2796.2-897.73    <-- from steam at 210C
dHst =
>> dHO2=(HinkJ(200,'v',3)-HinkJ(25,'v',3))*100000
dHO2 =
>> Ftext=dHO2/dHtext    <-- agrees with the text
Ftext =
>> Fst=dHO2/dHst        <-- more reasonable
Fst =

Go to Page 2

[Go to previous section: 3.2| Go to next section: 3.4]
[ Go to CENG301 Homepage | CENG301 Notes Table of Contents]

Last modified August 5, 1998.