Merge commit '9ba726de0f8b36a9143922bf148f6a259982756a'

This commit is contained in:
Darth Vader 2024-05-29 19:06:22 +00:00
commit 051687d391
5 changed files with 31 additions and 4 deletions

View File

@ -1722,7 +1722,10 @@ Phreeqc::InternalCopy(const Phreeqc* pSrc)
viscos_0 = pSrc->viscos_0;
viscos_0_25 = pSrc->viscos_0_25; // viscosity of the solution, of pure water, of pure water at 25 C
density_x = pSrc->density_x;
cell_pore_volume = pSrc->cell_pore_volume;;
solution_volume_x = pSrc->solution_volume_x;
solution_mass_x = pSrc->solution_mass_x;
kgw_kgs = pSrc->kgw_kgs;
cell_pore_volume = pSrc->cell_pore_volume;
cell_porosity = pSrc->cell_porosity;
cell_volume = pSrc->cell_volume;
cell_saturation = pSrc->cell_saturation;

View File

@ -1523,6 +1523,7 @@ protected:
int iterations;
int gamma_iterations;
size_t density_iterations;
LDBLE kgw_kgs;
int run_reactions_iterations;
int overall_iterations;
@ -1629,6 +1630,8 @@ protected:
int print_viscosity;
LDBLE viscos, viscos_0, viscos_0_25; // viscosity of the solution, of pure water, of pure water at 25 C
LDBLE density_x;
LDBLE solution_volume_x;
LDBLE solution_mass_x;
LDBLE cell_pore_volume;
LDBLE cell_porosity;
LDBLE cell_volume;

View File

@ -592,6 +592,8 @@ calc_dens(void)
{
density_x = rho_0 * (1e3 + M_T / mass_water_aq_x) / (rho_0 * V_solutes / mass_water_aq_x + 1e3);
}
solution_mass_x = 1e-3*(M_T + s_h2o->moles * s_h2o->gfw);
solution_volume_x = solution_mass_x / density_x;
return density_x;
//M_T /= 1e3;
//solution_mass = mass_water_aq_x + M_T;
@ -604,7 +606,7 @@ calc_dens(void)
}
/* VP: Density End */
/* DP: Function for interval halving */
#ifdef NOT_USED
LDBLE Phreeqc::
f_rho(LDBLE rho_old, void* cookie)
/* ---------------------------------------------------------------------- */
@ -622,7 +624,8 @@ f_rho(LDBLE rho_old, void* cookie)
rho = rho + pThis->rho_0;
return (rho - rho_old);
}
#endif
#ifdef original
/* ---------------------------------------------------------------------- */
LDBLE Phreeqc::
calc_solution_volume(void)
@ -653,7 +656,19 @@ calc_solution_volume(void)
LDBLE vol = 1e-3 * total_mass / rho;
return (vol);
}
#endif
/* ---------------------------------------------------------------------- */
LDBLE Phreeqc::
calc_solution_volume(void)
/* ---------------------------------------------------------------------- */
{
/*
* Calculates solution volume based on sum of mass of element plus density
*/
LDBLE rho = calc_dens();
LDBLE vol = solution_volume_x;
return (vol);
}
/* ---------------------------------------------------------------------- */
LDBLE Phreeqc::
calc_logk_n(const char* name)

View File

@ -409,6 +409,8 @@ initial_solutions(int print)
set(TRUE);
converge = model();
}
calc_dens();
kgw_kgs = mass_water_aq_x / solution_mass_x;
density_iterations++;
if (solution_ref.Get_initial_data()->Get_calc_density())
{

View File

@ -1942,6 +1942,10 @@ convert_units(cxxSolution *solution_ptr)
strstr(initial_data_ptr->Get_units().c_str(), "/l") != NULL)
{
mass_water_aq_x = 1.0 - 1e-3 * sum_solutes;
if (density_iterations > 0)
{
mass_water_aq_x = kgw_kgs;
}
if (mass_water_aq_x <= 0)
{
error_string = sformatf( "Solute mass exceeds solution mass in conversion from /kgs to /kgw.\n"