?? gasbase.h
字號:
/*====================================================================
INSTRUCTION
Units of results:
p: Pa (Pascal)
T: K (Kelvin)
v: m3/kg (Cubic meter per kilogram)
h: J/kg (Joule per kilogram)
u: J/kg (Joule per kilogram)
s: J/kg·K (Joule per kilogram and kelvin)
--------------------------------------------------------------------*/
/*====================================================================
聲明
本程序用于計算氣體熱力性質,它包括了基于幾個氣體模型的計算。本程序
由華中科技大學能源與動力工程學院0110班 肖震 編制 。版權的不要,如本人
的程序能對您的學習和研究有所幫助,敬請拷貝引用。
——作者
Announcement
This suit of programs is used for the calculation of properties of
gases based upon several different models. The author is Jim Shaw,
who is a junior student in the Energy and Power Engineering Department
of Huazhong Univerity of Science and Technology when programming this.
I do not require the copyright of this program suit. If it proves
helpful for your rearch and study, please do not hestate to copy it.
-- the Author
--------------------------------------------------------------------*/
#pragma once
#ifndef x_GASBASE
#define x_GASBASE
#endif
#include<cmath>
#include<cstring>
#include "coeArray\\coeArray.h"
namespace XZGas
{
//the universal gas constant
const double R=8.31451;
struct BBData
{
double B0;
double A0;
double a;
double b;
double c;
};
struct MHData
{
double b;
double A2;
double B2;
double C2;
double A3;
double B3;
double C3;
double A4;
double B5;
};
//the struct used to decribe properties of a gas
class GasData
{
public:
//constructors, the parameter of which deals with the name
GasData(char n[]="NoNameGas",unsigned int l=0);
//copy constructor
GasData(const GasData &scrGas);
//destructor free the space employed by the struct
~GasData();
virtual inline GasData &operator=(const GasData &scrGas);
public:
char *Name; //name of the gas
//critical information of the gas
double pc; //critical pressure Unit: Pa
double Tc; //critical temperature Unit: K
double vc; //critical special volume Unit: m3/kg
double M; //mass per mole Unit: kg/mol
//data used to precise Cp under 1 atm
coeArray A;
//the point on which h,u,s are zero
double p0;
double T0;
//the value on zero point
double h0;
double u0;
double s0;
//data used in certain equations
BBData BBEquData; //for Beatie-Bridgeman equation
MHData MHEquData; //for Matin-Hou equation
};
//the base of all gasmodels which provides a template for all
class GasModel
{
public:
GasModel(const GasData &gas);
virtual ~GasModel();
//the interface for specific heat capacities with both constant pressure and volume
virtual inline double Cp(double TT,double pp) =0;
virtual inline double Cv(double TT,double vv) =0;
//the adiabatic Coefficient
virtual inline double Gama(double TT,double pp) =0;
//interfaces for specific enthelpy, inner energy and entropy
virtual inline double h(double TT,double pp) =0;
virtual inline double u(double TT,double vv) =0;
virtual inline double s(double TT,double pp) =0;
//interfaces for state parameters under certain gas models
virtual inline double p(double TT,double vv) =0;
virtual inline double v(double TT,double pp) =0;
virtual inline double T(double pp,double vv) =0;
//interfaces for heat coeffients under certain gas models
virtual inline double Alphav(double pp,double vv) =0;
virtual inline double KT(double TT,double vv) =0;
virtual inline double Beta(double pp,double vv) =0;
//the compressive factor
virtual inline double Z(double TT,double pp);
const char* Name()const;
virtual inline void ChangeGas(const GasData &newgas);
protected:
//the name of the gas
char *GasName;
//the constant of idealgas
double Rg;
//the mass of one mole of gas
double M;
//data used to precise Cp under 1 atm
coeArray A;
//the point on which h,u,s are zero
double p0;
double T0;
//the value on zero point of h,u and s
double h0;
double u0;
double s0;
//heat capacity of constant pressure
virtual inline double _Cp(double TT);
//the integration of the above heat capacity function only on temperature
virtual inline double _ICp(double TT);
//the integration of Cp/T with temperature T only
virtual inline double _ICpT(double TT);
private:
//locate the coefficients used to precise Cp in the 2-dimensional array
inline virtual unsigned int FindA(double TT);
};
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -