WaterPropsIAPWSphi.h

Go to the documentation of this file.
00001 /**
00002  * @file WaterPropsIAPWSphi.h
00003  *  Header for Lowest level of the classes which support a real water model
00004  *  (see class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink and  class \link WaterPropsIAPWSphi WaterPropsIAPWSphi\endlink).
00005  *
00006  *   This class calculates dimensionless quantitites.
00007  */
00008 /*
00009  * Copywrite (2006) Sandia Corporation. Under the terms of
00010  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
00011  * U.S. Government retains certain rights in this software.
00012  */
00013 /*
00014  * $Id: WaterPropsIAPWSphi.h 387 2010-01-17 18:17:55Z hkmoffa $
00015  */
00016 
00017 #ifndef WATERPROPSIAPWSPHI_H
00018 #define WATERPROPSIAPWSPHI_H
00019 
00020 #include "config.h"
00021 
00022 /*!
00023  * the WaterPropsIAPSWSphi class support low level calls for
00024  * the real description of water.
00025  *
00026  *  The reference is W. Wagner, A. Prub, "The IAPWS Formulation 1995 for the Themodynamic
00027  *  Properties of Ordinary Water Substance for General and Scientific Use,"
00028  *  J. Phys. Chem. Ref. Dat, 31, 387, 2002.
00029  * 
00030  * Units Note: This class works with reduced units exclusively.
00031  */
00032 class WaterPropsIAPWSphi {
00033 
00034 public:
00035 
00036   //! Base constructor
00037   WaterPropsIAPWSphi();
00038 
00039   //! Calculate the Phi function, which is the base function
00040   /*!
00041    * The phi functino  is basically the helmholtz free energy
00042    * Eqn. (6.4)
00043    * All internal polynomials are recalculated.
00044    *
00045    * @param tau     Dimensionless temperature = T_c/T
00046    * @param delta   Dimensionless density =  delta = rho / Rho_c
00047    */
00048   doublereal phi(doublereal tau, doublereal delta);
00049 
00050   //! Delta derivative of phi
00051   /*!
00052    * @param tau     Dimensionless temperature = T_c/T
00053    * @param delta   Dimensionless density =  delta = rho / Rho_c
00054    */
00055   doublereal phi_d(doublereal tau, doublereal delta);
00056 
00057   //! 2nd derivative of phi wrt delta
00058   /*!
00059    * @param tau     Dimensionless temperature = T_c/T
00060    * @param delta   Dimensionless density =  delta = rho / Rho_c
00061    */
00062   doublereal phi_dd(doublereal tau, doublereal delta);
00063 
00064   //! First derivative of phi wrt tau
00065   /*!
00066    * @param tau     Dimensionless temperature = T_c/T
00067    * @param delta   Dimensionless density =  delta = rho / Rho_c
00068    */
00069   doublereal phi_t(doublereal tau, doublereal delta);
00070 
00071   //! Second derivative of phi wrt tau
00072   /*!
00073    * @param tau     Dimensionless temperature = T_c/T
00074    * @param delta   Dimensionless density =  delta = rho / Rho_c
00075    */
00076   doublereal phi_tt(doublereal tau, doublereal delta);
00077 
00078   //! Internal check # 1
00079   void   check1();
00080 
00081   //! Internal check # 2
00082   void   check2();
00083 
00084   //! Calculate the dimensionless pressure at tau and delta;
00085   /*!
00086    *
00087    *       pM/(rhoRT) = delta * phi_d() = 1.0 + delta phiR_d()
00088    *
00089    * @param tau     Dimensionless temperature = T_c/T
00090    * @param delta   Dimensionless density =  delta = rho / Rho_c
00091    *
00092    * note: this is done so much, we have a seperate routine.
00093    */
00094   doublereal pressureM_rhoRT(doublereal tau, doublereal delta);
00095 
00096   //! Dimensionless derivative of p wrt rho at constant T
00097   /*!
00098    *  dp/drho * 1/RT = (2. delta phi_d() + delta**2 phi_dd())
00099    *                   (1.0 + 2. delta phiR_d() + delta**2 phiR_dd())
00100    *
00101    * @param tau     Dimensionless temperature = T_c/T
00102    * @param delta   Dimensionless density =  delta = rho / Rho_c
00103    */
00104   doublereal dimdpdrho(doublereal tau, doublereal delta);
00105 
00106   //! Dimensionless derivative of p wrt T at constant rho
00107   /*!
00108    *  dp/dT * M/(Rho R) = (1.0 + delta phiR_d() 
00109    *                   -  tau delta (phiR_dt())
00110    *
00111    * @param tau     Dimensionless temperature = T_c/T
00112    * @param delta   Dimensionless density =  delta = rho / Rho_c
00113    */
00114   doublereal dimdpdT(doublereal tau, doublereal delta);
00115 
00116   /**
00117    * This program computes the reduced density, given the reduced pressure
00118    * and the reduced temperature, tau. It takes an initial guess, deltaGuess.
00119    * DeltaGuess is important as this is a multivalued function below the
00120    * critical point.
00121    *
00122    * @param p_red       Value of the dimensionless pressure
00123    * @param tau         Dimensionless temperature = T_c/T
00124    * @param deltaGuess Initial guess for the dimensionless density
00125    *
00126    * @return 
00127    *   Returns the dimensionless density.
00128    */
00129   doublereal dfind(doublereal p_red, doublereal tau, doublereal deltaGuess);
00130 
00131   /**
00132    * Calculate the dimensionless gibbs free energy
00133    */
00134   doublereal gibbs_RT() const;
00135 
00136   /**
00137    * Calculate the dimensionless enthalpy, h/RT
00138    */
00139   doublereal enthalpy_RT() const;
00140     
00141   /**
00142    * Calculate the dimensionless entropy, s/R
00143    */
00144   doublereal entropy_R() const;
00145 
00146   /**
00147    * Calculate the dimensionless internal energy, u/RT
00148    */
00149   doublereal intEnergy_RT() const;
00150 
00151   /**
00152    * Calculate the dimensionless constant volume heat capacity, Cv/R
00153    */
00154   doublereal cv_R() const;
00155 
00156   /**
00157    * Calculate the dimensionless constant pressure heat capacity, Cv/R
00158    */
00159   doublereal cp_R() const;
00160 
00161   
00162   //! Calculates internal polynomials in tau and delta.
00163   /*!
00164    * This routine is used to store the internal state of tau and delta
00165    * for later use by the other routines in the class.
00166    *
00167    * @param tau     Dimensionless temperature = T_c/T
00168    * @param delta   Dimensionless density =  delta = rho / Rho_c
00169    */
00170   void tdpolycalc(doublereal tau, doublereal delta);
00171 
00172   //! Return the value of phiR(), res
00173   doublereal phiR() const;
00174 
00175 private:
00176 
00177   //! nau calculation
00178   doublereal phi0() const;
00179   //! calculation of d_phiR/d_d
00180   doublereal phiR_d() const;
00181   //! calculation of d_nau/d_d
00182   doublereal phi0_d() const;
00183   //! calculation of d2_res/d_dd
00184   doublereal phiR_dd() const;
00185   //! calculation of d2_nau/d_dd
00186   doublereal phi0_dd() const;
00187   //! calculation of d_nau/d_t
00188   doublereal phi0_t() const;
00189   //! calculation of d_res/d_t
00190   doublereal phiR_t() const;
00191   //! calculation of d2_res/d_tt
00192   doublereal phiR_tt() const;
00193   //! calculation of d2_nau/d_tt
00194   doublereal phi0_tt() const;
00195   //! calculation of d2_res/d_dt
00196   doublereal phiR_dt() const;
00197   //! calculation of d2_nau/d_dt
00198   doublereal phi0_dt() const;
00199 
00200   /**
00201    * intCheck() calculates all of the functions at a one point and
00202    * prints out the result. It's used for conducting the internal
00203    * check.
00204    *
00205    * @param tau     Dimensionless temperature = T_c/T
00206    * @param delta   Dimensionless density =  delta = rho / Rho_c
00207    */
00208   void intCheck(doublereal tau, doublereal delta);
00209 
00210 private:
00211 
00212   //! Value of internally calculated polynomials of powers of TAU
00213   doublereal TAUp[52];
00214 
00215  //! Value of internally calculated polynomials of powers of delta
00216   doublereal DELTAp[16];
00217 
00218   //! Last tau that was used to calculate polynomials
00219   doublereal TAUsave;
00220 
00221   //! sqrt of TAU
00222   doublereal TAUsqrt;
00223 
00224   //! Last delta that was used to calculate polynomials
00225   doublereal DELTAsave;
00226 };
00227 #endif
Generated by  doxygen 1.6.3