Cantera  2.0
WaterTransport.cpp
1 #include "cantera/base/ct_defs.h"
7 
12 
13 #include <iostream>
14 using namespace std;
15 
16 
17 namespace Cantera
18 {
19 
20 //! default constructor
21 WaterTransport::WaterTransport(thermo_t* thermo, int ndim) :
22  Transport(thermo, ndim)
23 {
24  initTP();
25 }
26 
27 // Copy Constructor for the %WaterThermo object.
28 /*
29  * @param right ThermoPhase to be copied
30  */
32  Transport(right.m_thermo, right.m_nDim)
33 {
34  *this = right;
35 }
36 
37 // Assignment operator
38 /*
39  *
40  * @param right Reference to %WaterTransport object to be copied into the
41  * current one.
42  */
44 {
45  if (&right != this) {
46  return *this;
47  }
48  Transport::operator=(right);
49 
50  // All pointers in this routine are shallow pointers. Therefore, it's
51  // ok just to reinitialize them
52  initTP();
53 
54  return *this;
55 }
56 
57 // Duplication routine for objects which inherit from %Transport
58 /*
59  * This virtual routine can be used to duplicate %Transport objects
60  * inherited from %Transport even if the application only has
61  * a pointer to %Transport to work with.
62  *
63  * These routines are basically wrappers around the derived copy
64  * constructor.
65  */
67 {
68  WaterTransport* tr = new WaterTransport(*this);
69  return dynamic_cast<Transport*>(tr);
70 }
71 
72 
73 // virtual destructor
75 {
76 }
77 
78 // Routine to do some common initializations at the start of using
79 // this routine.
81 {
82  // The expectation is that we have a VPStandardStateTP derived object
83  VPStandardStateTP* vpthermo = dynamic_cast<VPStandardStateTP*>(m_thermo);
84  if (!vpthermo) {
85 
86  WaterSSTP* wsstp = dynamic_cast<WaterSSTP*>(m_thermo);
87  if (!wsstp) {
88  throw CanteraError("WaterTransport::initTP()",
89  "Expectation is that ThermoPhase be a VPStandardStateTP");
90  } else {
91 
92  m_sub = wsstp->getWater();
93  AssertTrace(m_sub != 0);
94  // Get a pointer to a changeable WaterProps object
95  m_waterProps = wsstp->getWaterProps();
97  }
98  } else {
99  m_waterPDSS = dynamic_cast<PDSS_Water*>(vpthermo->providePDSS(0));
100  if (!m_waterPDSS) {
101  throw CanteraError("WaterTransport::initTP()",
102  "Expectation is that first species be water with a PDSS_Water object");
103  }
104  // Get a pointer to a changeable WaterPropsIAPWS object
106  AssertTrace(m_sub != 0);
107  // Get a pointer to a changeable WaterProps object
110  }
111 }
112 
113 // Returns the viscosity of water at the current conditions
114 // (kg/m/s)
115 /*
116  * This function calculates the value of the viscosity of pure
117  * water at the current T and P.
118  *
119  * The formulas used are from the paper
120  * J. V. Sengers, J. T. R. Watson, "Improved International
121  * Formulations for the Viscosity and Thermal Conductivity of
122  * Water Substance", J. Phys. Chem. Ref. Data, 15, 1291 (1986).
123  *
124  * The formulation is accurate for all temperatures and pressures,
125  * for steam and for water, even near the critical point.
126  * Pressures above 500 MPa and temperature above 900 C are suspect.
127  */
129 {
130  doublereal visc = m_waterProps->viscosityWater();
131  return visc;
132 }
133 
134 // Returns the thermal conductivity of water at the current conditions
135 // (W/m/K)
136 /*
137  * This function calculates the value of the thermal conductivity of
138  * water at the current T and P.
139  *
140  * The formulas used are from the paper
141  * J. V. Sengers, J. T. R. Watson, "Improved International
142  * Formulations for the Viscosity and Thermal Conductivity of
143  * Water Substance", J. Phys. Chem. Ref. Data, 15, 1291 (1986).
144  *
145  * The formulation is accurate for all temperatures and pressures,
146  * for steam and for water, even near the critical point.
147  * Pressures above 500 MPa and temperature above 900 C are suspect.
148  */
150 {
151  doublereal lambda = m_waterProps->thermalConductivityWater();
152  return lambda;
153 }
154 
155 }