mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Fixed bug in SI of pure phase assemblage that did not account for pressure (Tony's version).
git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@7550 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
6899bc4ba7
commit
acd7d32d59
71
prep.cpp
71
prep.cpp
@ -5521,38 +5521,57 @@ calc_delta_v(reaction *r_ptr, bool phase)
|
||||
{
|
||||
/* calculate delta_v from molar volumes */
|
||||
|
||||
int p = -1;
|
||||
LDBLE d_v = 0.0;
|
||||
|
||||
if (phase)
|
||||
p = 1; /* for phases: reactants have coef's < 0, products have coef's > 0, v.v. for species */
|
||||
|
||||
for (size_t i = 0; r_ptr->token[i].name; i++)
|
||||
{
|
||||
/* 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];
|
||||
}
|
||||
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 += p * r_ptr->token[i].coef * r_ptr->token[i].s->logk[vm_tc];
|
||||
}
|
||||
return d_v;
|
||||
//dlp
|
||||
//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;
|
||||
}
|
||||
#ifdef PHREEQC2
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
17
print.cpp
17
print.cpp
@ -1282,12 +1282,19 @@ print_pp_assemblage(void)
|
||||
{
|
||||
PR_inprint = true;
|
||||
phase_ptr->pr_in = false;
|
||||
}
|
||||
phase_ptr->rxn->logk[delta_v] = calc_delta_v(phase_ptr->rxn, true) -
|
||||
phase_ptr->rxn->logk[delta_v] = calc_delta_v(phase_ptr->rxn_x, 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);
|
||||
lk = k_calc(phase_ptr->rxn->logk, tk_x, patm_x * PASCAL_PER_ATM);
|
||||
}
|
||||
else
|
||||
lk = phase_ptr->lk;
|
||||
// dlp
|
||||
//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;
|
||||
// end
|
||||
// lk = k_calc(phase_ptr->rxn->logk, tk_x, patm_x * PASCAL_PER_ATM);
|
||||
if (PR_inprint)
|
||||
phase_ptr->pr_in = true;
|
||||
for (rxn_ptr = phase_ptr->rxn->token + 1; rxn_ptr->s != NULL;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user