Reverting from Tony's fix to my fix for saturation index of pure phases with pressure.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@7553 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2013-03-14 17:00:53 +00:00
parent acd7d32d59
commit 82fc3b7ef5
2 changed files with 42 additions and 32 deletions

View File

@ -5520,7 +5520,7 @@ calc_delta_v(reaction *r_ptr, bool phase)
/* ---------------------------------------------------------------------- */
{
/* calculate delta_v from molar volumes */
#ifdef TONY
int p = -1;
LDBLE d_v = 0.0;
@ -5539,39 +5539,41 @@ calc_delta_v(reaction *r_ptr, bool phase)
d_v += p * r_ptr->token[i].coef * r_ptr->token[i].s->logk[vm_tc];
}
return d_v;
#else
//dlp
//LDBLE d_v = 0.0;
LDBLE d_v = 0.0;
//if (phase)
//{
// /* for phases: reactants have coef's < 0, products have coef's > 0, v.v. for species */
// for (size_t i = 1; r_ptr->token[i].s /*|| r_ptr->token[i].s*/ ; i++)
// {
// //if (!r_ptr->token[i].s)
// // continue;
// if (!strcmp(r_ptr->token[i].s->name, "H+"))
// continue;
// if (!strcmp(r_ptr->token[i].s->name, "e-"))
// continue;
// else if (r_ptr->token[i].s->logk[vm_tc])
// d_v += r_ptr->token[i].coef * r_ptr->token[i].s->logk[vm_tc];
// }
//}
//else
//{
// for (size_t i = 0; r_ptr->token[i].name /*|| r_ptr->token[i].s*/ ; i++)
// {
// if (!r_ptr->token[i].s)
// continue;
// if (!strcmp(r_ptr->token[i].s->name, "H+"))
// continue;
// if (!strcmp(r_ptr->token[i].s->name, "e-"))
// continue;
// else if (r_ptr->token[i].s->logk[vm_tc])
// d_v += - r_ptr->token[i].coef * r_ptr->token[i].s->logk[vm_tc];
// }
//}
//return d_v;
if (phase)
{
/* for phases: reactants have coef's < 0, products have coef's > 0, v.v. for species */
for (size_t i = 1; r_ptr->token[i].s /*|| r_ptr->token[i].s*/ ; i++)
{
//if (!r_ptr->token[i].s)
// continue;
if (!strcmp(r_ptr->token[i].s->name, "H+"))
continue;
if (!strcmp(r_ptr->token[i].s->name, "e-"))
continue;
else if (r_ptr->token[i].s->logk[vm_tc])
d_v += r_ptr->token[i].coef * r_ptr->token[i].s->logk[vm_tc];
}
}
else
{
for (size_t i = 0; r_ptr->token[i].name /*|| r_ptr->token[i].s*/ ; i++)
{
if (!r_ptr->token[i].s)
continue;
if (!strcmp(r_ptr->token[i].s->name, "H+"))
continue;
if (!strcmp(r_ptr->token[i].s->name, "e-"))
continue;
else if (r_ptr->token[i].s->logk[vm_tc])
d_v += - r_ptr->token[i].coef * r_ptr->token[i].s->logk[vm_tc];
}
}
return d_v;
#endif
}
#ifdef PHREEQC2
/* ---------------------------------------------------------------------- */

View File

@ -1278,6 +1278,7 @@ print_pp_assemblage(void)
{
phase_ptr = x[j]->phase;
PR_inprint = false;
#ifdef TONY
if (phase_ptr->pr_in)
{
PR_inprint = true;
@ -1288,6 +1289,13 @@ print_pp_assemblage(void)
}
else
lk = phase_ptr->lk;
#else
phase_ptr->rxn->logk[delta_v] = calc_delta_v(phase_ptr->rxn, true) -
phase_ptr->logk[vm0];
if (phase_ptr->rxn->logk[delta_v])
mu_terms_in_logk = true;
lk = k_calc(phase_ptr->rxn->logk, tk_x, patm_x * PASCAL_PER_ATM);
#endif
// dlp
//phase_ptr->rxn->logk[delta_v] = calc_delta_v(phase_ptr->rxn, true) -
// phase_ptr->logk[vm0];