Cantera  3.1.0
Loading...
Searching...
No Matches
WaterTransport.cpp
Go to the documentation of this file.
1//! @file WaterTransport.cpp
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at https://cantera.org/license.txt for license and copyright information.
5
10#include "cantera/base/global.h"
11
12namespace {
13
14const double Tstar = 647.27;
15const double rhoStar = 317.763; // kg / m3
16const double presStar = 22.115E6; // Pa
17const double muStar = 55.071E-6; //Pa s
18
19const double H[4] = {1., 0.978197, 0.579829, -0.202354};
20const double Hij[6][7] = {
21 { 0.5132047, 0.2151778, -0.2818107, 0.1778064, -0.04176610, 0., 0.},
22 { 0.3205656, 0.7317883, -1.070786 , 0.4605040, 0., -0.01578386, 0.},
23 { 0., 1.241044 , -1.263184 , 0.2340379, 0., 0., 0.},
24 { 0., 1.476783 , 0., -0.4924179, 0.1600435, 0., -0.003629481},
25 {-0.7782567, 0.0 , 0., 0. , 0., 0., 0.},
26 { 0.1885447, 0.0 , 0., 0. , 0., 0., 0.},
27};
28
29}
30
31namespace Cantera
32{
33
34void WaterTransport::init(ThermoPhase* thermo, int mode, int log_level)
35{
36 if (log_level != -7) {
37 warn_deprecated("Transport::init", "The log_level parameter "
38 "is deprecated and will be removed after Cantera 3.1.");
39 }
41}
42
44{
45 static const double TStar = 647.27; // Kelvin
46 double temp = m_thermo->temperature();
47 double dens = m_thermo->density();
48
49 double rhobar = dens/rhoStar;
50 double tbar = temp / TStar;
51 double tbar2 = tbar * tbar;
52 double tbar3 = tbar2 * tbar;
53 double mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3);
54
55 double tfac1 = 1.0 / tbar - 1.0;
56 double tfac2 = tfac1 * tfac1;
57 double tfac3 = tfac2 * tfac1;
58 double tfac4 = tfac3 * tfac1;
59 double tfac5 = tfac4 * tfac1;
60
61 double rfac1 = rhobar - 1.0;
62 double rfac2 = rfac1 * rfac1;
63 double rfac3 = rfac2 * rfac1;
64 double rfac4 = rfac3 * rfac1;
65 double rfac5 = rfac4 * rfac1;
66 double rfac6 = rfac5 * rfac1;
67
68 double sum = Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 +
69 Hij[0][1]*rfac1 + Hij[1][1]*tfac1*rfac1 + Hij[2][1]*tfac2*rfac1 + Hij[3][1]*tfac3*rfac1 +
70 Hij[0][2]*rfac2 + Hij[1][2]*tfac1*rfac2 + Hij[2][2]*tfac2*rfac2 +
71 Hij[0][3]*rfac3 + Hij[1][3]*tfac1*rfac3 + Hij[2][3]*tfac2*rfac3 + Hij[3][3]*tfac3*rfac3 +
72 Hij[0][4]*rfac4 + Hij[3][4]*tfac3*rfac4 +
73 Hij[1][5]*tfac1*rfac5 + Hij[3][6]*tfac3*rfac6;
74 double mu1bar = std::exp(rhobar * sum);
75
76 // Apply the near-critical point corrections if necessary
77 double mu2bar = 1.0;
78 if (tbar >= 0.9970 && tbar <= 1.0082 && rhobar >= 0.755 && rhobar <= 1.290) {
79 double drhodp = m_thermo->isothermalCompressibility() * dens;
80 drhodp *= presStar / rhoStar;
81 double xsi = rhobar * drhodp;
82 if (xsi >= 21.93) {
83 mu2bar = 0.922 * std::pow(xsi, 0.0263);
84 }
85 }
86
87 double mubar = mu0bar * mu1bar * mu2bar;
88 return mubar * muStar;
89}
90
92{
93 static const double lambdastar = 0.4945;
94 static const double L[4] = {
95 1.0000,
96 6.978267,
97 2.599096,
98 -0.998254
99 };
100 static const double Lji[6][5] = {
101 { 1.3293046, 1.7018363, 5.2246158, 8.7127675, -1.8525999},
102 {-0.40452437, -2.2156845, -10.124111, -9.5000611, 0.93404690},
103 { 0.24409490, 1.6511057, 4.9874687, 4.3786606, 0.0},
104 { 0.018660751, -0.76736002, -0.27297694, -0.91783782, 0.0},
105 {-0.12961068, 0.37283344, -0.43083393, 0.0, 0.0},
106 { 0.044809953, -0.11203160, 0.13333849, 0.0, 0.0},
107 };
108
109 double temp = m_thermo->temperature();
110 double dens = m_thermo->density();
111
112 double rhobar = dens / rhoStar;
113 double tbar = temp / Tstar;
114 double tbar2 = tbar * tbar;
115 double tbar3 = tbar2 * tbar;
116 double lambda0bar = sqrt(tbar) / (L[0] + L[1]/tbar + L[2]/tbar2 + L[3]/tbar3);
117
118 double tfac1 = 1.0 / tbar - 1.0;
119 double tfac2 = tfac1 * tfac1;
120 double tfac3 = tfac2 * tfac1;
121 double tfac4 = tfac3 * tfac1;
122 double tfac5 = tfac4 * tfac1;
123
124 double rfac1 = rhobar - 1.0;
125 double rfac2 = rfac1 * rfac1;
126 double rfac3 = rfac2 * rfac1;
127 double rfac4 = rfac3 * rfac1;
128 double rfac5 = rfac4 * rfac1;
129 double rfac6 = rfac5 * rfac1;
130
131 double sum = (Lji[0][0] + Lji[0][1]*tfac1 + Lji[0][2]*tfac2 + Lji[0][3]*tfac3 + Lji[0][4]*tfac4 +
132 Lji[1][0]*rfac1 + Lji[1][1]*tfac1*rfac1 + Lji[1][2]*tfac2*rfac1 + Lji[1][3]*tfac3*rfac1 + Lji[1][4]*tfac4*rfac1 +
133 Lji[2][0]*rfac2 + Lji[2][1]*tfac1*rfac2 + Lji[2][2]*tfac2*rfac2 + Lji[2][3]*tfac3*rfac2 +
134 Lji[3][0]*rfac3 + Lji[3][1]*tfac1*rfac3 + Lji[3][2]*tfac2*rfac3 + Lji[3][3]*tfac3*rfac3 +
135 Lji[4][0]*rfac4 + Lji[4][1]*tfac1*rfac4 + Lji[4][2]*tfac2*rfac4 +
136 Lji[5][0]*rfac5 + Lji[5][1]*tfac1*rfac5 + Lji[5][2]*tfac2*rfac5
137 );
138 double lambda1bar = exp(rhobar * sum);
139 double mu0bar = std::sqrt(tbar) / (H[0] + H[1]/tbar + H[2]/tbar2 + H[3]/tbar3);
140
141 sum = (Hij[0][0] + Hij[1][0]*tfac1 + Hij[4][0]*tfac4 + Hij[5][0]*tfac5 +
142 Hij[0][1]*rfac1 + Hij[1][1]*tfac1*rfac1 + Hij[2][1]*tfac2*rfac1 + Hij[3][1]*tfac3*rfac1 +
143 Hij[0][2]*rfac2 + Hij[1][2]*tfac1*rfac2 + Hij[2][2]*tfac2*rfac2 +
144 Hij[0][3]*rfac3 + Hij[1][3]*tfac1*rfac3 + Hij[2][3]*tfac2*rfac3 + Hij[3][3]*tfac3*rfac3 +
145 Hij[0][4]*rfac4 + Hij[3][4]*tfac3*rfac4 +
146 Hij[1][5]*tfac1*rfac5 + Hij[3][6]*tfac3*rfac6
147 );
148 double mu1bar = std::exp(rhobar * sum);
149 double t2r2 = tbar2 / (rhobar * rhobar);
150 double kappa = m_thermo->isothermalCompressibility();
151 double xsi = rhobar * rhobar * kappa * presStar;
152 double xsipow = std::pow(xsi, 0.4678);
153 double temp2 = (tbar - 1.0) * (tbar - 1.0);
154 double dpdT_const_rho = m_thermo->thermalExpansionCoeff() / kappa;
155 dpdT_const_rho *= Tstar / presStar;
156 double lambda2bar = 0.0013848 / (mu0bar * mu1bar) * t2r2 * dpdT_const_rho * dpdT_const_rho *
157 xsipow * sqrt(rhobar) * exp(-18.66*temp2 - rfac4);
158 return (lambda0bar * lambda1bar + lambda2bar) * lambdastar;
159}
160
161}
Implementation of a pressure dependent standard state virtual function for a Pure Water Phase (see Sp...
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
Declares a ThermoPhase class consisting of pure water (see Thermodynamic Properties and class WaterSS...
Header file defining class WaterTransport.
double temperature() const
Temperature (K).
Definition Phase.h:562
virtual double density() const
Density (kg/m^3).
Definition Phase.h:587
Base class for a phase with thermodynamic properties.
virtual double thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
virtual double isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
ThermoPhase * m_thermo
pointer to the object representing the phase
Definition Transport.h:437
ThermoPhase & thermo()
Phase object.
Definition Transport.h:103
double thermalConductivity() override
Returns the thermal conductivity of water at the current conditions (W/m/K)
void init(ThermoPhase *thermo, int mode=0, int log_level=-7) override
Initialize a transport manager.
double viscosity() override
Returns the viscosity of water at the current conditions (kg/m/s)
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
Definition AnyMap.cpp:1997