Moved WaterPropsIAPWS inside the Cantera namespace. I can't remember why it wasn't in the first place.
Added a WaterProps object to PDSS_Water. This object will be worked into all of the other objects , and also used within the transport directory.
This commit is contained in:
parent
276602af3a
commit
53d21aaf7e
7 changed files with 99 additions and 33 deletions
|
|
@ -11,17 +11,18 @@
|
|||
* $Id: PDSS_Water.cpp,v 1.15 2008/12/22 22:40:44 hkmoffa Exp $
|
||||
*/
|
||||
#include "ct_defs.h"
|
||||
|
||||
#include "xml.h"
|
||||
#include "ctml.h"
|
||||
#include "PDSS_Water.h"
|
||||
|
||||
#include "WaterPropsIAPWS.h"
|
||||
#include "ThermoFactory.h"
|
||||
#include "WaterProps.h"
|
||||
#include "VPStandardStateTP.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
#include "VPStandardStateTP.h"
|
||||
|
||||
namespace Cantera {
|
||||
/**
|
||||
* Basic list of constructors and duplicators
|
||||
|
|
@ -29,24 +30,7 @@ namespace Cantera {
|
|||
PDSS_Water::PDSS_Water() :
|
||||
PDSS(),
|
||||
m_sub(0),
|
||||
m_dens(1000.0),
|
||||
m_iState(WATER_LIQUID),
|
||||
EW_Offset(0.0),
|
||||
SW_Offset(0.0),
|
||||
m_verbose(0),
|
||||
m_allowGasPhase(false)
|
||||
{
|
||||
m_pdssType = cPDSS_WATER;
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
m_spthermo = 0;
|
||||
constructSet();
|
||||
m_minTemp = 200.;
|
||||
m_maxTemp = 10000.;
|
||||
}
|
||||
|
||||
PDSS_Water::PDSS_Water(VPStandardStateTP *tp, int spindex) :
|
||||
PDSS(tp, spindex),
|
||||
m_sub(0),
|
||||
m_waterProps(0),
|
||||
m_dens(1000.0),
|
||||
m_iState(WATER_LIQUID),
|
||||
EW_Offset(0.0),
|
||||
|
|
@ -56,6 +40,27 @@ namespace Cantera {
|
|||
{
|
||||
m_pdssType = cPDSS_WATER;
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
m_waterProps = new WaterProps(m_sub);
|
||||
m_spthermo = 0;
|
||||
constructSet();
|
||||
m_minTemp = 200.;
|
||||
m_maxTemp = 10000.;
|
||||
}
|
||||
|
||||
PDSS_Water::PDSS_Water(VPStandardStateTP *tp, int spindex) :
|
||||
PDSS(tp, spindex),
|
||||
m_sub(0),
|
||||
m_waterProps(0),
|
||||
m_dens(1000.0),
|
||||
m_iState(WATER_LIQUID),
|
||||
EW_Offset(0.0),
|
||||
SW_Offset(0.0),
|
||||
m_verbose(0),
|
||||
m_allowGasPhase(false)
|
||||
{
|
||||
m_pdssType = cPDSS_WATER;
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
m_waterProps = new WaterProps(m_sub);
|
||||
m_spthermo = 0;
|
||||
constructSet();
|
||||
m_minTemp = 200.;
|
||||
|
|
@ -67,6 +72,7 @@ namespace Cantera {
|
|||
std::string inputFile, std::string id) :
|
||||
PDSS(tp, spindex),
|
||||
m_sub(0),
|
||||
m_waterProps(0),
|
||||
m_dens(1000.0),
|
||||
m_iState(WATER_LIQUID),
|
||||
EW_Offset(0.0),
|
||||
|
|
@ -75,7 +81,8 @@ namespace Cantera {
|
|||
m_allowGasPhase(false)
|
||||
{
|
||||
m_pdssType = cPDSS_WATER;
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
m_waterProps = new WaterProps(m_sub);
|
||||
constructPDSSFile(tp, spindex, inputFile, id);
|
||||
m_spthermo = 0;
|
||||
m_minTemp = 200.;
|
||||
|
|
@ -87,6 +94,7 @@ namespace Cantera {
|
|||
const XML_Node& phaseRoot, bool spInstalled) :
|
||||
PDSS(tp, spindex),
|
||||
m_sub(0),
|
||||
m_waterProps(0),
|
||||
m_dens(1000.0),
|
||||
m_iState(WATER_LIQUID),
|
||||
EW_Offset(0.0),
|
||||
|
|
@ -96,6 +104,7 @@ namespace Cantera {
|
|||
{
|
||||
m_pdssType = cPDSS_WATER;
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
m_waterProps = new WaterProps(m_sub);
|
||||
std::string id= "";
|
||||
constructPDSSXML(tp, spindex, phaseRoot, id) ;
|
||||
initThermo();
|
||||
|
|
@ -109,6 +118,7 @@ namespace Cantera {
|
|||
PDSS_Water::PDSS_Water(const PDSS_Water &b) :
|
||||
PDSS(),
|
||||
m_sub(0),
|
||||
m_waterProps(0),
|
||||
m_dens(1000.0),
|
||||
m_iState(WATER_LIQUID),
|
||||
EW_Offset(b.EW_Offset),
|
||||
|
|
@ -116,7 +126,7 @@ namespace Cantera {
|
|||
m_verbose(b.m_verbose),
|
||||
m_allowGasPhase(b.m_allowGasPhase)
|
||||
{
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
/*
|
||||
* Use the assignment operator to do the brunt
|
||||
* of the work for the copy construtor.
|
||||
|
|
@ -134,7 +144,16 @@ namespace Cantera {
|
|||
*/
|
||||
PDSS::operator=(b);
|
||||
|
||||
if (!m_sub) {
|
||||
m_sub = new WaterPropsIAPWS();
|
||||
}
|
||||
m_sub->operator=(*(b.m_sub));
|
||||
|
||||
if (!m_waterProps) {
|
||||
m_waterProps = new WaterProps(m_sub);
|
||||
}
|
||||
m_waterProps->operator=(*(b.m_waterProps));
|
||||
|
||||
m_dens = b.m_dens;
|
||||
m_iState = b.m_iState;
|
||||
EW_Offset = b.EW_Offset;
|
||||
|
|
@ -145,8 +164,9 @@ namespace Cantera {
|
|||
return *this;
|
||||
}
|
||||
|
||||
PDSS_Water::~PDSS_Water() {
|
||||
delete m_sub;
|
||||
PDSS_Water::~PDSS_Water() {
|
||||
delete m_waterProps;
|
||||
delete m_sub;
|
||||
}
|
||||
|
||||
PDSS *PDSS_Water::duplMyselfAsPDSS() const {
|
||||
|
|
|
|||
|
|
@ -14,15 +14,19 @@
|
|||
* $Revision: 1.11 $
|
||||
*/
|
||||
|
||||
#ifndef CT_WATERPDSS_H
|
||||
#define CT_WATERPDSS_H
|
||||
#ifndef CT_PDSS_WATER_H
|
||||
#define CT_PDSS_WATER_H
|
||||
|
||||
#include "ct_defs.h"
|
||||
#include "PDSS.h"
|
||||
#include "VPStandardStateTP.h"
|
||||
|
||||
class WaterPropsIAPWS;
|
||||
|
||||
|
||||
|
||||
namespace Cantera {
|
||||
class WaterPropsIAPWS;
|
||||
class WaterProps;
|
||||
|
||||
//! Class for the liquid water pressure dependent
|
||||
//! standard state
|
||||
|
|
@ -387,11 +391,16 @@ namespace Cantera {
|
|||
*/
|
||||
virtual doublereal satPressure(doublereal t);
|
||||
|
||||
//! Get a pointer to the WaterPropsIAPWS object
|
||||
WaterPropsIAPWS *getWater() const {
|
||||
//! Get a pointer to a changeable WaterPropsIAPWS object
|
||||
WaterPropsIAPWS *getWater() {
|
||||
return m_sub;
|
||||
}
|
||||
|
||||
//! Get a pointer to a changeable WaterPropsIAPWS object
|
||||
WaterProps *getWaterProps() {
|
||||
return m_waterProps;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @name Initialization of the Object
|
||||
|
|
@ -485,13 +494,23 @@ namespace Cantera {
|
|||
|
||||
private:
|
||||
|
||||
//! Pointer to the WaterProps object, which does the actual calculations
|
||||
//! Pointer to the WaterPropsIAPWS object, which does the actual calculations
|
||||
//! for the real equation of state
|
||||
/*!
|
||||
* This object owns m_sub
|
||||
*/
|
||||
mutable WaterPropsIAPWS *m_sub;
|
||||
|
||||
//! Pointer to the WaterProps object
|
||||
/*!
|
||||
* This class is used to house several approximation
|
||||
* routines for properties of water.
|
||||
*
|
||||
* This object owns m_waterProps, and the WaterPropsIAPWS object used by
|
||||
* WaterProps is m_sub, which is defined above.
|
||||
*/
|
||||
WaterProps *m_waterProps;
|
||||
|
||||
//! State of the system - density
|
||||
/*!
|
||||
* Density is the independent variable here, but it's hidden behind the
|
||||
|
|
|
|||
|
|
@ -54,6 +54,19 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
WaterProps::WaterProps(WaterPropsIAPWS *waterIAPWS) :
|
||||
m_waterIAPWS(0),
|
||||
m_own_sub(false)
|
||||
{
|
||||
if (waterIAPWS) {
|
||||
m_waterIAPWS = waterIAPWS;
|
||||
m_own_sub = false;
|
||||
} else {
|
||||
m_waterIAPWS = new WaterPropsIAPWS();
|
||||
m_own_sub = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
|
||||
#include "ct_defs.h"
|
||||
class WaterPropsIAPWS;
|
||||
namespace Cantera {
|
||||
class WaterPropsIAPWS;
|
||||
class PDSS_Water;
|
||||
|
||||
/**
|
||||
|
|
@ -115,6 +115,12 @@ namespace Cantera {
|
|||
//! Default constructor
|
||||
WaterProps();
|
||||
|
||||
//! Constructor with pointer to Water PDSS object
|
||||
/*!
|
||||
* @param wptr Pointer to WaterPropsIAPWS object
|
||||
*/
|
||||
WaterProps(WaterPropsIAPWS *wptr);
|
||||
|
||||
//! Constructor with pointer to Water PDSS object
|
||||
/*!
|
||||
* @param wptr Pointer to water standard state object
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace Cantera {
|
||||
/*
|
||||
* Critical Point values of water in mks units
|
||||
*/
|
||||
|
|
@ -872,3 +874,5 @@ doublereal WaterPropsIAPWS::molarVolume() const {
|
|||
doublereal rho = delta * Rho_c;
|
||||
return (M_water / rho);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "WaterPropsIAPWSphi.h"
|
||||
#include "config.h"
|
||||
|
||||
namespace Cantera {
|
||||
/**
|
||||
* @name Names for the phase regions
|
||||
*
|
||||
|
|
@ -470,4 +472,6 @@ private:
|
|||
//! Current state of the system
|
||||
mutable int iState;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
#include "SingleSpeciesTP.h"
|
||||
|
||||
class WaterPropsIAPWS;
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
class WaterPropsIAPWS;
|
||||
//! Class for single-component water. This is designed to cover just the
|
||||
//! liquid part of water.
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue