Tony's fix for erm (enrichment factors).

New test case erm.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@10013 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2015-07-21 20:37:03 +00:00
parent 72352f536a
commit 2dd34675ab
3 changed files with 25 additions and 7 deletions

View File

@ -702,7 +702,14 @@ sum_diffuse_layer(cxxSurfaceCharge *charge_ptr)
if (s_x[j]->type > HPLUS)
continue;
molality = under(s_x[j]->lm);
moles_excess = mass_water_aq_x * molality * charge_ptr->Get_g_map()[s_x[j]->z].Get_g();
LDBLE g = charge_ptr->Get_g_map()[s_x[j]->z].Get_g();
if (s_x[j]->erm_ddl != 1)
{
LDBLE ratio_aq = mass_water_surface / mass_water_aq_x;
LDBLE g2 = g / ratio_aq + 1;
g = ratio_aq * (g2 * s_x[j]->erm_ddl - 1);
}
moles_excess = mass_water_aq_x * molality * g;
moles_surface = mass_water_surface * molality + moles_excess;
/*
* Accumulate elements in diffuse layer

View File

@ -1755,14 +1755,25 @@ xsurface_save(int n_user)
double moles_excess = mass_water_aq_x * molality * charge_ref.Get_g_map()[s_x[j]->z].Get_g();
double moles_surface = mass_water_surface * molality + moles_excess;
charge_ref.Get_dl_species_map()[s_x[j]->number] = moles_surface/mass_water_surface;
#ifdef SKIP
//#ifdef SKIP
double g = charge_ref.Get_g_map()[s_x[j]->z].Get_g();
double moles_excess = mass_water_aq_x * molality * (g * s_x[j]->erm_ddl +
mass_water_surface /
mass_water_aq_x * (s_x[j]->erm_ddl - 1));
//double moles_excess = mass_water_aq_x * molality * (g * s_x[j]->erm_ddl +
// mass_water_surface /
// mass_water_aq_x * (s_x[j]->erm_ddl - 1));
//LDBLE g = charge_ptr->Get_g_map()[s_x[j]->z].Get_g();
if (s_x[j]->erm_ddl != 1)
{
LDBLE ratio_aq = mass_water_surface / mass_water_aq_x;
LDBLE g2 = g / ratio_aq + 1;
g = ratio_aq * (g2 * s_x[j]->erm_ddl - 1);
}
moles_excess = mass_water_aq_x * molality * g;
double c = (mass_water_surface * molality + moles_excess) / mass_water_surface;
charge_ref.Get_dl_species_map()[s_x[j]->number] = c;
#endif
//#endif
}
//charge_ref.Get_dl_species_map()[s_h2o->number] = 0.0;
charge_ref.Get_dl_species_map()[s_h2o->number] = 1.0/gfw_water;

View File

@ -2428,7 +2428,7 @@ molalities(int allow_overflow)
dl_ref.Set_drelated_moles(s_ptr->moles * s_ptr->erm_ddl * charge_ref.Get_specific_area() *
use.Get_surface_ptr()->Get_thickness() / mass_water_aq_x);
}
s_ptr->tot_g_moles = s_ptr->moles * (1 + total_g /* s_ptr->erm_ddl */ );
s_ptr->tot_g_moles = s_ptr->moles * (1 + total_g * s_ptr->erm_ddl);
/* note that dg is for cb, act water, mu eqns */
/* dg_total_g for mole balance eqns */