Skip to content

Commit 108fdd3

Browse files
Merge commit '27025d1ccd77fdf67a75e7dc1e49394daa4d6a0d'
2 parents 3233a9d + 27025d1 commit 108fdd3

File tree

2 files changed

+18
-27
lines changed

2 files changed

+18
-27
lines changed

IPhreeqcMMS/IPhreeqc/src/phreeqcpp/transport.cpp

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6070,21 +6070,22 @@ viscosity(cxxSurface *surf_ptr)
60706070
Jones_Dole[6] contains the anion factor, 1 for Cl-, variable for other anions
60716071
f_z = (z * z + |z|) / 2, the contribution of the ion to mu_x, if z = 0: f_z = mu_x / m_i
60726072
f_I = variable, depends on d3_i > 1, or d3_i < 1.
6073+
tc is limited to 200 C.
6074+
60736075
60746076
A from Falkenhagen-Dole for a salt:
60756077
A = 4.3787e-14 * TK**1.5 / (eps_r**0.5)* (z1 + z2)**-0.5 / (D1 * D2) * psi
60766078
psi = (D1*z2 + D2*z1)/4 - z1*z2 * (D1-D2)**2 / ((D1*z1 + D2*z2)**0.5 + ((D1 + D2) * (z1 + z2))**0.5)**2
60776079
D1, z1 for the cation, D2, |z2| for the anion of the salt.
60786080
We use the harmonic mean of the Dw's, and the arithmetic mean of the z's,
60796081
both weighted by the equivalent concentration.
6080-
6081-
tc is limited to 200 C.
60826082
*/
60836083
LDBLE D1, D2, z1, z2, m_plus, m_min, eq_plus, eq_min, eq_dw_plus, eq_dw_min, t1, t2, t3, fan = 1;
6084-
LDBLE A, psi, Bc = 0, Dc = 0, Dw = 0.0, l_z, f_z, lm, V_an, m_an, V_Cl, l_moles, l_water, l_mu_x, dw_t_visc;
6084+
LDBLE A, psi, Bc = 0, Dc = 0, Dw = 0.0, l_z, f_z, lm, V_an, m_an, V_Cl, tc, l_moles, l_water, l_mu_x, dw_t_visc;
60856085

60866086
m_plus = m_min = eq_plus = eq_min = eq_dw_plus = eq_dw_min = V_an = m_an = V_Cl = 0;
60876087

6088+
tc = (tc_x > 200) ? 200 : tc_x;
60886089
l_water = mass_water_aq_x;
60896090
l_mu_x = mu_x;
60906091

@@ -6103,8 +6104,6 @@ viscosity(cxxSurface *surf_ptr)
61036104
LDBLE ratio_surf_aq = mass_water_surfaces_x / mass_water_aq_x;
61046105
for (i1 = 0; i1 < i1_last; i1++)
61056106
{
6106-
if (tc_x > 200)
6107-
goto highT;
61086107
Bc = Dc = Dw = m_plus = m_min = eq_plus = eq_min = eq_dw_plus = eq_dw_min = V_an = m_an = 0;
61096108
if (surf_ptr)
61106109
{
@@ -6182,7 +6181,7 @@ viscosity(cxxSurface *surf_ptr)
61826181
}
61836182
// find B * m and D * m * mu^d3
61846183
dw_t_visc = (s_x[i]->Jones_Dole[0] +
6185-
s_x[i]->Jones_Dole[1] * exp(-s_x[i]->Jones_Dole[2] * tc_x)) * t1;
6184+
s_x[i]->Jones_Dole[1] * exp(-s_x[i]->Jones_Dole[2] * tc)) * t1;
61866185
Bc += dw_t_visc;
61876186
// define f_I from the exponent of the D * m^d3 term...
61886187
if (s_x[i]->Jones_Dole[5] >= 1)
@@ -6191,7 +6190,7 @@ viscosity(cxxSurface *surf_ptr)
61916190
t2 = -0.8 / s_x[i]->Jones_Dole[5];
61926191
else
61936192
t2 = -1;
6194-
t3 = (s_x[i]->Jones_Dole[3] * exp(-s_x[i]->Jones_Dole[4] * tc_x)) *
6193+
t3 = (s_x[i]->Jones_Dole[3] * exp(-s_x[i]->Jones_Dole[4] * tc)) *
61956194
t1 * (pow(l_mu_x, s_x[i]->Jones_Dole[5])*(1 + t2) + pow(t1 * f_z, s_x[i]->Jones_Dole[5])) / (2 + t2);
61966195
if (t3 < -1e-5)
61976196
t3 = 0;
@@ -6260,35 +6259,28 @@ viscosity(cxxSurface *surf_ptr)
62606259
V_an /= m_an;
62616260
if (!V_Cl)
62626261
V_Cl = calc_vm_Cl();
6263-
if (V_an == V_Cl)
6264-
fan = 1;
6265-
else if (V_Cl >= 1)
6262+
if (V_an && V_Cl)
62666263
fan = 2 - V_an / V_Cl;
62676264
else
6268-
fan = 2 - V_an * mu_x;
6269-
//if (Dc < 0)
6270-
// Dc = 0; // provisional...
6265+
fan = 1;
6266+
if (Dc < 0)
6267+
Dc = 0; // provisional...
62716268
viscos += viscos_0 * fan * (Bc + Dc);
62726269
if (viscos < 0)
62736270
{
62746271
viscos = viscos_0;
62756272
warning_msg("viscosity < 0, reset to viscosity of pure water");
62766273
}
6277-
6278-
highT:
62796274
if (!surf_ptr)
62806275
{
6281-
t1 = fabs(Bc + Dc);
62826276
for (i = 0; i < (int)this->s_x.size(); i++)
62836277
{
62846278
if (s_x[i]->type != AQ && s_x[i]->type > HPLUS)
62856279
continue;
6286-
if (s_x[i]->lm < -9)
6280+
if ((lm = s_x[i]->lm) < -9)
62876281
continue;
6288-
if (tc_x > 200)
6289-
s_x[i]->dw_t_visc = 0;
6290-
else if (s_x[i]->Jones_Dole[0] || s_x[i]->Jones_Dole[1] || s_x[i]->Jones_Dole[3])
6291-
s_x[i]->dw_t_visc /= t1;
6282+
if (s_x[i]->Jones_Dole[0] || s_x[i]->Jones_Dole[1] || s_x[i]->Jones_Dole[3])
6283+
s_x[i]->dw_t_visc /= (Bc + Dc);
62926284
}
62936285
}
62946286
else //if (surf_ptr->Get_calc_viscosity())

IPhreeqcMMS/IPhreeqc/src/phreeqcpp/utilities.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,11 @@ calc_rho_0(LDBLE tc, LDBLE pa)
192192
LDBLE p1 = -6.0251348E-06 + tc * ( 3.6696407E-07 + tc * (-9.2056269E-09 + tc * ( 6.7024182E-11 + tc * -1.5947241E-13)));
193193
LDBLE p2 = -2.2983596E-09 + tc * (-4.0133819E-10 + tc * ( 1.2619821E-11 + tc * (-9.8952363E-14 + tc * 2.3363281E-16)));
194194
LDBLE p3 = 7.0517647E-11 + tc * ( 6.8566831E-12 + tc * (-2.2829750E-13 + tc * ( 1.8113313E-15 + tc * -4.2475324E-18)));
195-
// /* The minimal pressure equals the saturation pressure... */
196-
/* 5/12/2025: remove ah2o_x, rho_0 is independent of concentrations*/
197-
//if (ah2o_x <= 1.0)
198-
// p_sat = exp(11.6702 - 3816.44 / (T - 46.13)) * ah2o_x;
199-
//else
200-
p_sat = exp(11.6702 - 3816.44 / (T - 46.13));
195+
/* The minimal pressure equals the saturation pressure... */
196+
if (ah2o_x <= 1.0)
197+
p_sat = exp(11.6702 - 3816.44 / (T - 46.13)) * ah2o_x;
198+
else
199+
p_sat = exp(11.6702 - 3816.44 / (T - 46.13));
201200
//ah2o_x0 = ah2o_x; // for updating rho in model(): compare with new ah2o_x
202201
if (pa < p_sat || (use.Get_solution_ptr() && use.Get_solution_ptr()->Get_patm() < p_sat))
203202
{

0 commit comments

Comments
 (0)