⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gasbase.h

📁 气体热力性质计算程序
💻 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 + -