mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Fixing Linux compiler warnings, checking in new regression test files.
This commit is contained in:
parent
77e36a2394
commit
fbde6338ec
@ -3590,7 +3590,8 @@ CVsldet(CVodeMem cv_mem)
|
|||||||
realtype smink, smaxk, sumrat, sumrsq, vmin, vmax, drrmax, adrr;
|
realtype smink, smaxk, sumrat, sumrsq, vmin, vmax, drrmax, adrr;
|
||||||
realtype /*small_cvode,*/ tem, sqmax, saqk, qp, s, sqmaxk, saqj, sqmin;
|
realtype /*small_cvode,*/ tem, sqmax, saqk, qp, s, sqmaxk, saqj, sqmin;
|
||||||
realtype rsa, rsb, rsc, rsd, rse, rd1a, rd1b, rd1c, rd1d;
|
realtype rsa, rsb, rsc, rsd, rse, rd1a, rd1b, rd1c, rd1d;
|
||||||
realtype rd2a, rd2b, rd2c, rd3a, rd3b, cest1, corr1;
|
//realtype rd2a, rd2b, rd2c, rd3a, rd3b, cest1, corr1;
|
||||||
|
realtype rd2a, rd2b, rd2c, rd3a, cest1, corr1;
|
||||||
realtype ratp, ratm, qfac1, qfac2, bb, rrb;
|
realtype ratp, ratm, qfac1, qfac2, bb, rrb;
|
||||||
|
|
||||||
/* The following are cutoffs and tolerances used by this routine */
|
/* The following are cutoffs and tolerances used by this routine */
|
||||||
@ -3854,7 +3855,7 @@ CVsldet(CVodeMem cv_mem)
|
|||||||
rd2b = rd1b - rd1c;
|
rd2b = rd1b - rd1c;
|
||||||
rd2c = rd1c - rd1d;
|
rd2c = rd1c - rd1d;
|
||||||
rd3a = rd2a - rd2b;
|
rd3a = rd2a - rd2b;
|
||||||
rd3b = rd2b - rd2c;
|
//rd3b = rd2b - rd2c;
|
||||||
/* rd3b = rd3b; */
|
/* rd3b = rd3b; */
|
||||||
|
|
||||||
if (ABS(rd1b) < TINY * smax[k])
|
if (ABS(rd1b) < TINY * smax[k])
|
||||||
|
|||||||
163
model.cpp
163
model.cpp
@ -687,98 +687,99 @@ gammas(LDBLE mu)
|
|||||||
*/
|
*/
|
||||||
if (calculating_deriv)
|
if (calculating_deriv)
|
||||||
continue;
|
continue;
|
||||||
LDBLE coef, z;
|
|
||||||
for (j = 1; s_x[i]->rxn_x->token[j].s != NULL; j++)
|
|
||||||
{
|
{
|
||||||
if (s_x[i]->rxn_x->token[j].s->type == EX)
|
LDBLE coef = 0, z = 0;
|
||||||
|
for (j = 1; s_x[i]->rxn_x->token[j].s != NULL; j++)
|
||||||
{
|
{
|
||||||
s_x[i]->alk =
|
if (s_x[i]->rxn_x->token[j].s->type == EX)
|
||||||
s_x[i]->rxn_x->token[j].s->primary->unknown->moles;
|
{
|
||||||
//break;
|
s_x[i]->alk =
|
||||||
|
s_x[i]->rxn_x->token[j].s->primary->unknown->moles;
|
||||||
|
//break;
|
||||||
|
}
|
||||||
|
else if (s_x[i]->rxn_x->token[j].s->type <= HPLUS)
|
||||||
|
{
|
||||||
|
coef = s_x[i]->rxn_x->token[j].coef;
|
||||||
|
z = s_x[i]->rxn_x->token[j].s->z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (s_x[i]->rxn_x->token[j].s->type <= HPLUS)
|
if (!use.Get_exchange_ptr()->Get_pitzer_exchange_gammas())
|
||||||
{
|
{
|
||||||
coef = s_x[i]->rxn_x->token[j].coef;
|
if (s_x[i]->primary != NULL)
|
||||||
z = s_x[i]->rxn_x->token[j].s->z;
|
{
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!use.Get_exchange_ptr()->Get_pitzer_exchange_gammas())
|
|
||||||
{
|
|
||||||
if (s_x[i]->primary != NULL)
|
|
||||||
{
|
|
||||||
s_x[i]->lg = 0.0;
|
|
||||||
s_x[i]->dg = 0.0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (s_x[i]->alk <= 0)
|
|
||||||
s_x[i]->lg = 0.0;
|
s_x[i]->lg = 0.0;
|
||||||
|
s_x[i]->dg = 0.0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
s_x[i]->lg = log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
{
|
||||||
s_x[i]->dg = 0.0;
|
if (s_x[i]->alk <= 0)
|
||||||
|
s_x[i]->lg = 0.0;
|
||||||
|
else
|
||||||
|
s_x[i]->lg = log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
||||||
|
s_x[i]->dg = 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (s_x[i]->exch_gflag == 1 && s_x[i]->alk > 0)
|
||||||
else if (s_x[i]->exch_gflag == 1 && s_x[i]->alk > 0)
|
|
||||||
{
|
|
||||||
/* Davies */
|
|
||||||
s_x[i]->lg = -coef * z * z * a *
|
|
||||||
(muhalf / (1.0 + muhalf) - 0.3 * mu) +
|
|
||||||
log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
|
||||||
s_x[i]->dg =
|
|
||||||
c1 * coef * z * z * s_x[i]->moles;
|
|
||||||
}
|
|
||||||
else if (s_x[i]->exch_gflag == 2 && s_x[i]->alk > 0)
|
|
||||||
{
|
|
||||||
/* Extended D-H, WATEQ D-H */
|
|
||||||
s_x[i]->lg = coef * (-a * muhalf * z * z /
|
|
||||||
(1.0 + s_x[i]->dha * b * muhalf) + s_x[i]->dhb * mu) +
|
|
||||||
log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
|
||||||
s_x[i]->dg = coef * (c2 * z * z /
|
|
||||||
((1.0 + s_x[i]->dha * b * muhalf) * (1.0 + s_x[i]->dha * b * muhalf)) +
|
|
||||||
s_x[i]->dhb) * LOG_10 * s_x[i]->moles;
|
|
||||||
}
|
|
||||||
else if (s_x[i]->exch_gflag == 7 && s_x[i]->alk > 0)
|
|
||||||
{
|
|
||||||
if (llnl_count_temp > 0)
|
|
||||||
{
|
{
|
||||||
s_x[i]->lg =
|
/* Davies */
|
||||||
coef * (-a_llnl * muhalf * z * z /
|
s_x[i]->lg = -coef * z * z * a *
|
||||||
(1.0 + s_x[i]->dha * b_llnl * muhalf) +
|
(muhalf / (1.0 + muhalf) - 0.3 * mu) +
|
||||||
bdot_llnl * mu) +
|
|
||||||
log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
||||||
s_x[i]->dg =
|
s_x[i]->dg =
|
||||||
coef * (c2_llnl * z * z /
|
c1 * coef * z * z * s_x[i]->moles;
|
||||||
((1.0 + s_x[i]->dha * b_llnl * muhalf) * (1.0 + s_x[i]->dha * b_llnl * muhalf)) +
|
|
||||||
bdot_llnl) * LOG_10 * s_x[i]->moles;
|
|
||||||
}
|
}
|
||||||
else
|
else if (s_x[i]->exch_gflag == 2 && s_x[i]->alk > 0)
|
||||||
{
|
{
|
||||||
error_msg("LLNL_AQUEOUS_MODEL_PARAMETERS not defined.",
|
/* Extended D-H, WATEQ D-H */
|
||||||
STOP);
|
s_x[i]->lg = coef * (-a * muhalf * z * z /
|
||||||
|
(1.0 + s_x[i]->dha * b * muhalf) + s_x[i]->dhb * mu) +
|
||||||
|
log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
||||||
|
s_x[i]->dg = coef * (c2 * z * z /
|
||||||
|
((1.0 + s_x[i]->dha * b * muhalf) * (1.0 + s_x[i]->dha * b * muhalf)) +
|
||||||
|
s_x[i]->dhb) * LOG_10 * s_x[i]->moles;
|
||||||
}
|
}
|
||||||
}
|
else if (s_x[i]->exch_gflag == 7 && s_x[i]->alk > 0)
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Master species is a dummy variable with meaningless activity and mass
|
|
||||||
*/
|
|
||||||
if (s_x[i]->primary != NULL)
|
|
||||||
{
|
{
|
||||||
s_x[i]->lg = 0.0;
|
if (llnl_count_temp > 0)
|
||||||
s_x[i]->dg = 0.0;
|
{
|
||||||
}
|
s_x[i]->lg =
|
||||||
else
|
coef * (-a_llnl * muhalf * z * z /
|
||||||
{
|
(1.0 + s_x[i]->dha * b_llnl * muhalf) +
|
||||||
if (s_x[i]->alk <= 0)
|
bdot_llnl * mu) +
|
||||||
s_x[i]->lg = 0.0;
|
log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
||||||
|
s_x[i]->dg =
|
||||||
|
coef * (c2_llnl * z * z /
|
||||||
|
((1.0 + s_x[i]->dha * b_llnl * muhalf) * (1.0 + s_x[i]->dha * b_llnl * muhalf)) +
|
||||||
|
bdot_llnl) * LOG_10 * s_x[i]->moles;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
s_x[i]->lg = log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
{
|
||||||
s_x[i]->dg = 0.0;
|
error_msg("LLNL_AQUEOUS_MODEL_PARAMETERS not defined.",
|
||||||
|
STOP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Master species is a dummy variable with meaningless activity and mass
|
||||||
|
*/
|
||||||
|
if (s_x[i]->primary != NULL)
|
||||||
|
{
|
||||||
|
s_x[i]->lg = 0.0;
|
||||||
|
s_x[i]->dg = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (s_x[i]->alk <= 0)
|
||||||
|
s_x[i]->lg = 0.0;
|
||||||
|
else
|
||||||
|
s_x[i]->lg = log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
|
||||||
|
s_x[i]->dg = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (s_x[i]->a_f && s_x[i]->primary == NULL && s_x[i]->moles)
|
||||||
|
gammas_a_f(i); // appt
|
||||||
}
|
}
|
||||||
if (s_x[i]->a_f && s_x[i]->primary == NULL && s_x[i]->moles)
|
|
||||||
gammas_a_f(i); // appt
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 5: /* Always 1.0 */
|
case 5: /* Always 1.0 */
|
||||||
s_x[i]->lg = 0.0;
|
s_x[i]->lg = 0.0;
|
||||||
@ -879,7 +880,8 @@ int Phreeqc::gammas_a_f(int i1)
|
|||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
LDBLE d2, d3, coef = 0, sum = 0;
|
//LDBLE d2, d3, coef = 0, sum = 0;
|
||||||
|
LDBLE d2, d3, sum = 0;
|
||||||
char name[MAX_LENGTH];
|
char name[MAX_LENGTH];
|
||||||
//struct master *m_ptr;
|
//struct master *m_ptr;
|
||||||
|
|
||||||
@ -2219,7 +2221,7 @@ mb_ss(void)
|
|||||||
{
|
{
|
||||||
cxxSS *ss_ptr = ss_ptrs[i];
|
cxxSS *ss_ptr = ss_ptrs[i];
|
||||||
total_moles = 0;
|
total_moles = 0;
|
||||||
bool ss_in = true;
|
//bool ss_in = true;
|
||||||
for (size_t j = 0; j < ss_ptr->Get_ss_comps().size(); j++)
|
for (size_t j = 0; j < ss_ptr->Get_ss_comps().size(); j++)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
@ -3020,7 +3022,8 @@ ss_binary(cxxSS *ss_ptr)
|
|||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
LDBLE nb, nc, n_tot, xb, xc, dnb, dnc, l_a0, l_a1;
|
LDBLE nb, nc, n_tot, xb, xc, dnb, dnc, l_a0, l_a1;
|
||||||
LDBLE xb2, xb3, xb4, xc2, xc3;
|
//LDBLE xb2, xb3, xb4, xc2, xc3;
|
||||||
|
LDBLE xb2, xb3, xc2;
|
||||||
LDBLE xb1, xc1;
|
LDBLE xb1, xc1;
|
||||||
/*
|
/*
|
||||||
* component 0 is major component
|
* component 0 is major component
|
||||||
@ -3107,10 +3110,10 @@ ss_binary(cxxSS *ss_ptr)
|
|||||||
comp1_ptr->Get_log10_lambda();
|
comp1_ptr->Get_log10_lambda();
|
||||||
|
|
||||||
xc2 = xc * xc;
|
xc2 = xc * xc;
|
||||||
xc3 = xc2 * xc;
|
//xc3 = xc2 * xc;
|
||||||
xb2 = xb * xb;
|
xb2 = xb * xb;
|
||||||
xb3 = xb2 * xb;
|
xb3 = xb2 * xb;
|
||||||
xb4 = xb3 * xb;
|
//xb4 = xb3 * xb;
|
||||||
/* xb4 = xb4; */
|
/* xb4 = xb4; */
|
||||||
/* xc3 = xc3; */
|
/* xc3 = xc3; */
|
||||||
|
|
||||||
|
|||||||
@ -2025,7 +2025,7 @@ fill_spec(int l_cell_no, int ref_cell)
|
|||||||
malloc_error();
|
malloc_error();
|
||||||
sol_D[l_cell_no].spec_size = i3 + count_spec + 1 + size_xt;
|
sol_D[l_cell_no].spec_size = i3 + count_spec + 1 + size_xt;
|
||||||
}
|
}
|
||||||
for (i1; i1 < i2; i1++)
|
for (; i1 < i2; i1++) // i1 is loop variable
|
||||||
{
|
{
|
||||||
memmove(&sol_D[l_cell_no].spec[i1], &sol_D[ref_cell].spec[i1], sizeof(struct spec));
|
memmove(&sol_D[l_cell_no].spec[i1], &sol_D[ref_cell].spec[i1], sizeof(struct spec));
|
||||||
sol_D[l_cell_no].spec[i1].c = 0.0;
|
sol_D[l_cell_no].spec[i1].c = 0.0;
|
||||||
@ -2098,7 +2098,7 @@ fill_spec(int l_cell_no, int ref_cell)
|
|||||||
sol_D[i1].spec_size = i2 + size_xt;
|
sol_D[i1].spec_size = i2 + size_xt;
|
||||||
}
|
}
|
||||||
i2--;
|
i2--;
|
||||||
for (i2; i2 > i3; i2--)
|
for (; i2 > i3; i2--) // i2 is loop variable
|
||||||
sol_D[i1].spec[i2] = sol_D[i1].spec[i2 - 1];
|
sol_D[i1].spec[i2] = sol_D[i1].spec[i2 - 1];
|
||||||
|
|
||||||
memmove(&sol_D[i1].spec[i2], &sol_D[l_cell_no].spec[i2], sizeof(struct spec));
|
memmove(&sol_D[i1].spec[i2], &sol_D[l_cell_no].spec[i2], sizeof(struct spec));
|
||||||
@ -2189,9 +2189,9 @@ diffuse_implicit(LDBLE DDt, int stagnant)
|
|||||||
int i, icell, cp, comp;
|
int i, icell, cp, comp;
|
||||||
// ifirst = (bcon_first == 2 ? 1 : 0); ilast = (bcon_last == 2 ? count_cells - 1 : count_cells);
|
// ifirst = (bcon_first == 2 ? 1 : 0); ilast = (bcon_last == 2 ? count_cells - 1 : count_cells);
|
||||||
int ifirst, ilast;
|
int ifirst, ilast;
|
||||||
int i_1, i0, i1, i2;
|
int i_1, i0, i1, i2 = 0;
|
||||||
double mfr, mfr1, max_b = 0, b, grad, dVc, j_0e, min_dif_M = pow(10, min_dif_LM);
|
double mfr, mfr1, max_b = 0, b, grad, dVc, j_0e, min_dif_M = pow(10, min_dif_LM);
|
||||||
LDBLE dum1, dum2, dum_stag, min_mol;
|
LDBLE dum1, dum2, dum_stag = 0.0, min_mol;
|
||||||
|
|
||||||
LDBLE dum = 0;
|
LDBLE dum = 0;
|
||||||
cxxSurfaceCharge * charge_ptr = NULL;
|
cxxSurfaceCharge * charge_ptr = NULL;
|
||||||
@ -2789,10 +2789,15 @@ diffuse_implicit(LDBLE DDt, int stagnant)
|
|||||||
for (i = ifirst + 1; i < ilast; i++)
|
for (i = ifirst + 1; i < ilast; i++)
|
||||||
{
|
{
|
||||||
dVc = current_cells[i].R * (current_x - current_cells[i].dif);
|
dVc = current_cells[i].R * (current_x - current_cells[i].dif);
|
||||||
if ((dV_dcell && dVc * j_0e > 0 ||
|
//if (((dV_dcell && (dVc * j_0e > 0)) ||
|
||||||
(dV_dcell > 0 && (cell_data[i].potV + dVc) > (cell_data[count_cells + 1].potV)) ||
|
// (dV_dcell > 0 && (cell_data[i].potV + dVc) > (cell_data[count_cells + 1].potV)) ||
|
||||||
(dV_dcell < 0 && (cell_data[i].potV + dVc) < (cell_data[count_cells + 1].potV))))
|
// (dV_dcell < 0 && (cell_data[i].potV + dVc) < (cell_data[count_cells + 1].potV))))
|
||||||
|
if ((dV_dcell && (dVc * j_0e > 0)) ||
|
||||||
|
((dV_dcell > 0) && ((cell_data[i].potV + dVc) > cell_data[count_cells + 1].potV)) ||
|
||||||
|
((dV_dcell < 0) && ((cell_data[i].potV + dVc) < cell_data[count_cells + 1].potV)))
|
||||||
|
{
|
||||||
dVc = (cell_data[count_cells + 1].potV - cell_data[i].potV) / (count_cells + 1 - i);
|
dVc = (cell_data[count_cells + 1].potV - cell_data[i].potV) / (count_cells + 1 - i);
|
||||||
|
}
|
||||||
cell_data[i + 1].potV = cell_data[i].potV + dVc;
|
cell_data[i + 1].potV = cell_data[i].potV + dVc;
|
||||||
}
|
}
|
||||||
if (!dV_dcell || fix_current)
|
if (!dV_dcell || fix_current)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user