ThermoFluid Class

It is used for computing thermodynamic properties of fluids. The available fluids are:

ASHRAE IUPAC TYPE Nsaturation Nsuperheated
R12 Dichlorodifluoromethane CFC 42 271
R22 Chlorodifluoromethane HCFC 35 155
R23 Trifluoromethane HFC 176 1333
R32 Difluoromethane HFC 68 53
R125 Pentafluoroethane HFC 69 64
R134A 1,1,1,2-Tetrafluoroethane HFC 69 334
R143A 1,1,1-Trifluoroethane HFC 66 63
R717 Ammonia N/A 67 371
R718 Water N/A 71 569


Note: Although the number of data entries for each saturated and superheated states is well satisfactory, it should be noted that the more the experimental points the more accurate the results will be. For example, for saturated state if the properties at T=85°C is requested, the properties, say at 80° and 90°C will be found from the database and then linear interpolation will be performed to compute the properties at 85°C.


For the compressed state, it is assumed that the properties are equal to saturated liquid's properties. For more on this assumption please see Cengel & Boles, Thermodynamics: An Engineering Approach


In order to create a fluid class, run the following command:

>>"water")  -- Either ASHRAE or IUPAC name is accepted as argument



Member functions

get(tbl): Accepts one argument as Lua table, tbl, and returns the computed thermodynamic properties as a Lua table. The accepted keys for the tbl argument are:

Lua Table Key Meaning Units
P Pressure kPa
T Temperature C
s Entropy kJ/kgK
h Enthalpy kJ/kg
v Specific Volume m3/kg

Possible combinations for the argument tbl are:

  1. P (only saturated properties are searched)
  2. T (only saturated properties are searched)
  3. P,T (compressed, saturated and superheated properties are searched)
  4. P,s (saturated and superheated properties are searched) and T,s (only saturated properties are searched)
  5. P,v and T,v (only saturated properties are searched)
  6. P,h and T,h (only saturated properties are searched)



Example #1:

P=10    T=45.7384    vg=14.783    vf=0.0010103    uf=191.523    ug=2436.68    hf=191.534    hg=2584.51  sf=0.648314 sg=8.15173   


Example #2:

P=9.593    T=45    vf=0.00101    vg=15.26    uf=188.44    ug=2436.81    hf=188.45    hg=2583.2  sf=0.6387    sg=8.1648    


Example #3:

>>props=fluid:get{P=10, T=100}
v=17.196    h=2687.5    s=8.4479