00001 /* 00002 00003 freesteam - IAPWS-IF97 steam tables library 00004 Copyright (C) 2004-2005 John Pye 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License 00008 as published by the Free Software Foundation; either version 2 00009 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 00020 */ 00021 00022 #ifndef COMMON_H 00023 #define COMMON_H 00024 00025 #ifndef FREESTEAM_SWIG 00026 # include "units.h" 00027 #else 00028 # define Pressure Measurement 00029 # define Temperature Measurement 00030 # define SpecificEnergy Measurement 00031 # define SpecificEntropy Measurement 00032 # define Density Measurement 00033 #endif 00034 00035 // this is the precision of all the parameters used in the Steam Calculator: 00036 typedef double Num; 00037 #define NUM_DEFINED 00038 00039 // define a method (for use in header files) 00040 #define METHOD_H_OBJ(funcname) Num funcname(SteamCalculator *c) 00041 00042 const SpecificGasConstant R=0.461526 * kJ_kgK; // Specific gas constant for water from IF97 00043 00044 #define REG4_TOL 0.001 // relative err on pressures considerd to be equal to psat. 00045 00046 const Temperature TB_HIGH = 863.15 * Kelvin; 00047 const Temperature T_MIN = ZeroCelsius; 00048 const Temperature T_MAX = 1073.15 * Kelvin; 00049 const Temperature T_CRIT = 647.096 * Kelvin; // critical-point temperature 00050 const Temperature T_TRIPLE = 273.16 * Kelvin; // triple-point temperature 00051 const Temperature REG2_TEMP_REF = 540.0 * Kelvin; 00052 const Temperature REG1_TEMP_REF = 1386.0 * Kelvin; 00053 const Temperature REG1_T_LOW = ZeroCelsius; 00054 const Temperature REG2_T_LOW = ZeroCelsius; 00055 const Temperature REG2_T_HIGH = T_MAX; 00056 00057 const Temperature T_REG1_REG3 = 623.15 * Kelvin; 00058 const Temperature TB_LOW = T_REG1_REG3; 00059 00060 const Temperature T_MIN_VOL = fromcelsius(3.984); 00061 00062 const Pressure P_MAX = 100.0 * MPa; 00063 const Pressure PB_LOW = 16.5292 * MPa; 00064 const Pressure P_MIN = 0.0 * Pascal; 00065 const Pressure P_CRIT = 22.064 * MPa; // critical-point pressure 00066 const Pressure P_TRIPLE = 611.657 * Pascal; // triple-point pressure 00067 const Pressure REG4_P_MIN = 611.213 * Pascal; // minimum pressure for region 4 (IF-97 eq 31 & p 35) / [MPa] 00068 const Pressure REG2_P_HIGH = P_MAX; 00069 const Pressure REG1_P_HIGH = P_MAX; 00070 const Pressure REG1_PRES_REF = 16.53 * MPa; 00071 const Pressure REG2_PRES_REF = 1.0 * MPa; 00072 00073 const Density RHO_CRIT = 322.0 * kg / metre3; // critical-point density / [kg/m³] 00074 00076 const DynamicViscosity IAPS85_VISC_REF = 55.071 * micro * Pascal * second; 00078 const Density IAPS85_DENS_REF = 317.763 * kg_m3; 00080 const Temperature IAPS85_TEMP_REF = 647.226 * Kelvin; 00082 const Pressure IAPS85_PRES_REF = 22.115 * MPa; // MPa (THIS IS *NOT* EQUAL TO P_CRIT!) 00083 00084 const Temperature IAPS85_TEMP_REG2_REF = 540.0 * Kelvin; 00085 00086 const Pressure STEAM_P_EPS = 1.0e-5 * MPa; 00087 const Temperature STEAM_T_EPS = 5.0e-4 * Kelvin; 00088 00089 const Temperature EPS_T_CRIT=0.00007 * Kelvin; 00090 00091 const Temperature T_CRIT_PLUS=(T_CRIT + STEAM_T_EPS); 00092 00093 const Density REG3_ZEROIN_DENS_MAX = 765.0 * kg_m3; 00094 const Density REG3_ZEROIN_TOL= 1e-18 * kg_m3; 00095 00096 #define MPA_TO_BAR(PRES) (((Num)(PRES)) * 10.0 ) 00097 #define BAR_TO_MPA(PRES) (((Num)(PRES)) * 0.1 ) 00098 #define PA_TO_MPA(PRES) (((Num)(PRES)) * 0.000001 ) 00099 #define MPA_TO_PA(PRES) (((Num)(PRES)) * 1.0E6 ) 00100 #define KJKG_TO_JKG(JKG) (((Num)(KJKG)) * 1000.0 ) 00101 #define BAR_TO_PA(PRES) (((Num)(PRES)) * 100.0E3 ) 00102 #define KPA_TO_MPA(PRES) (((Num)(PRES)) * 0.001 ) 00103 00104 #define W_TO_KW(W) (((Num)(W))*0.001) 00105 #define KJ_TO_J(KJ) (((Num)(KJ))*0.001) 00106 #define J_TO_KJ(J) (((Num)(J))*0.001) 00107 00108 const Acceleration GRAV = 9.81 * Newton / kg; // N/kg, gravitation acceleration 00109 00110 #ifndef PI 00111 # define PI 3.14159265358 00112 #endif 00113 00114 // Property 'Alternative' codes for use with SatCurve and B23Curve and Solver2 00115 00116 const int SOLVE_IENERGY=0; 00117 const int SOLVE_ENTHALPY=1; 00118 00119 const int SOLVE_ENTROPY=0; 00120 const int SOLVE_CV=1; 00121 const int SOLVE_CP=2; 00122 00123 // square a value but only evaluate it once in GNU C's CPP. 00124 00125 template<class T> 00126 T sq(const T& t){ 00127 return t*t; 00128 } 00129 00130 #endif 00131
1.5.6