GasFlowMeter/User/AGA10/therm.h

150 lines
4.8 KiB
C
Raw Normal View History

/*************************************************************************
* File : therm.h
* Description : Header file for class 'Therm'
* See therm.cpp for implementation of this class
* Version : ver 1.7 2002.11.17
* Author : W.B. Peterson
*Revisions:
*Copyright (c) 2002 American Gas Association
**************************************************************************/
#ifndef _THERM_H
#define _THERM_H
#include "aga10.h"
#include "detail.h"
class Therm
{
private:
// member data
double dT ; // current temperature, in Kelvins
double dP ; // current pressure, in Pascals
double dD ; // molar density, in moles/dm3
double dRho ; // mass density, in kg/m3
double dPdD ; // partial deriv of P wrt D
double dPdT ; // partial deriv of P wrt T
double dSi ; // ideal gas specific entropy, kJ/kg.K
double dTold ; // temperature previously used
double dMrxold ; // mixture molar mass previously used
// private methods
double CpiMolar(AGA10STRUCT *) ;
protected:
public:
Therm(void) ; // default constructor ~Therm() ; // default destructor
void Run(AGA10STRUCT *, Detail *) ; // runs an object based on this class
double Ho(AGA10STRUCT *) ; // ideal gas enthalpy
double So(AGA10STRUCT *) ; // ideal gas entropy
void CprCvrHS(AGA10STRUCT *, Detail *) ; // specific heat capacities + k_ideal + H + S
double H(AGA10STRUCT *, Detail *) ; // real gas specific enthalpy
double S(AGA10STRUCT *, Detail *) ; // real gas specific entropy
void HS_Mode(AGA10STRUCT *, Detail *, double, double, bool) ; // estimates P & T, given H & S
} ;
//Other data used by Therm class
//Roots and Weights for gaussian quadrature
const long double GK_root[5] =
{0.14887433898163121088,
0.43339539412924719080,
0.67940956829902440263,
0.86506336668898451073, 0.97390652851717172008 };
const long double GK_weight[5] =
{ 0.29552422471475286217, 0.26926671930999634918, 0.21908636251598204295, 0.14945134915058059038, 0.066671344308688137179 };
//set the number of points for quadrature const int GK_points = 5 ;
//equation constants for ideal gas heat capacity, enthalpy and entropy
const double ThermConstants[NUMBEROFCOMPONENTS[11] =
{{-29776.4, 7.95454, 43.9417, 1037.09, 1.56373, 813.205, -24.9027, 1019.98,-10.1601, 1070.14,-20.0615}, {-3495.34, 6.95587, 0.272892, 662.738,-0.291318,-680.562, 1.78980, 1740.06, 0.0, 100.0, 4.49823}, { 20.7307, 6.96237, 2.68645, 500.371,-2.56429,-530.443, 3.91921, 500.198, 2.13290, 2197.22, 5.81381}, {-37524.4, 7.98139, 24.3668, 752.320, 3.53990, 272.846, 8.44724, 1020.13,-13.2732, 869.510,-22.4010},
{-56072.1, 8.14319, 37.0629, 735.402, 9.38159, 247.190, 13.4556, 1454.78,-11.7342, 984.518,-24.0426},
{-13773.1, 7.97183, 6.27078, 2572.63, 2.05010, 1156.72, 0.0, 100.0, 0.0, 100.0, -3.24989},
{-10085.4, 7.94680,-0.08380, 433.801, 2.85539, 843.792, 6.31595, 1481.43,-2.88457, 1102.23,-0.51551},
{-5565.60, 6.66789, 2.33458, 2584.98, .749019, 559.656, 0.0, 100.0, 0.0, 100.0, -7.94821},
{-2753.49, 6.95854, 2.02441, 1541.22, .096774, 3674.81, 0.0, 100.0, 0.0, 100.0, 6.23387},
{-3497.45, 6.96302, 2.40013, 2522.05, 2.21752, 1154.15, 0.0, 100.0, 0.0, 100.0, 9.19749},
{-72387.0, 17.8143, 58.2062, 1787.39, 40.7621, 808.645, 0.0, 100.0, 0.0, 100.0, -44.1341},
{-72674.8, 18.6383, 57.4178, 1792.73, 38.6599, 814.151, 0.0, 100.0, 0.0, 100.0, -46.1938},
{-91505.5, 21.3861, 74.3410, 1701.58, 47.0587, 775.899, 0.0, 100.0, 0.0, 100.0, -60.2474},
{-83845.2, 22.5012, 69.5789, 1719.58, 46.2164, 802.174, 0.0, 100.0, 0.0, 100.0, -62.2197},
{-94982.5, 26.6225, 80.3819, 1718.49, 55.6598, 802.069, 0.0, 100.0, 0.0, 100.0, -77.5366},
{-103353., 30.4029, 90.6941, 1669.32, 63.2028, 786.001, 0.0, 100.0, 0.0, 100.0, -92.0164},
{-109674., 34.0847, 100.253, 1611.55, 69.7675, 768.847, 0.0, 100.0, 0.0, 100.0, -106.149},
{-122599., 38.5014, 111.446, 1646.48, 80.5015, 781.588, 0.0, 100.0, 0.0, 100.0, -122.444},
{-133564., 42.7143, 122.173, 1654.85, 90.2255, 785.564, 0.0, 100.0, 0.0, 100.0, -138.006},
{ 0.0, 4.9680, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0 },
{ 0.0, 4.9680, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0, 100.0, 0.0 }};
// enumerations for indexing of coefficients
enum CoefficientList{ coefA = 0, coefB, coefC, coefD, coefE, coefF, coefG, coefH, coefI, coefJ, coefK } ;
// conversion constant for thermochemical calories to Joules: 1 cal(IT) = 4.1840 J const double CalTH = 4.1840 ;
#endif
/*************************************************************************
*
* File : entry.cpp
* Purpose : This file contains the startup code for aga10.dll
* and is only required for Windows DLL creation.
* Project : AGA10 DLL
* Version : ver 1.7 2002.11.17
* Author : W.B. Peterson
*Revisions:
*Copyright (c) 2002 American Gas Association
*
**************************************************************************/
#include <windows.h>
/* win32 DLL startup code */
int WINAPI DLLMain(HINSTANCE hInst, DWORD fdwReason, PVOID pvReserved)
{
return TRUE ;
}