mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Modified to tidy exchange, gas_phase, ppassemblage, solution, ssassemblage, and surface when _raw or _modify are read. Set new_def for each. Had problem with equilibrium_phases as shown in eq_phase_mod test case. Probably will add amdtreat test case from which it was derived.
Tony revised density calculation. Toyed with the following when testing for amdtreat in Copy equations to optimize into ineq_array //if (x[i]->f > 1e-14/*0e-8*/ && x[i]->moles <= 0 checked for a null pointer in prep (could happen when _modify used). git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@6967 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
d0d48fca3a
commit
4c2e8c33c0
@ -205,7 +205,7 @@ cxxExchange::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read exchange number and description
|
||||
this->read_number_description(parser);
|
||||
|
||||
this->Set_new_def(true);
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
bool pitzer_exchange_gammas_defined(false);
|
||||
|
||||
|
||||
@ -282,6 +282,7 @@ cxxGasPhase::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read gas_phase number and description
|
||||
this->read_number_description(parser);
|
||||
this->Set_new_def(true);
|
||||
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
bool type_defined(false);
|
||||
|
||||
@ -134,6 +134,7 @@ cxxPPassemblage::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read PPassemblage number and description
|
||||
this->read_number_description(parser);
|
||||
this->Set_new_def(true);
|
||||
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
|
||||
|
||||
@ -136,6 +136,7 @@ cxxSSassemblage::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read SSassemblage number and description
|
||||
this->read_number_description(parser);
|
||||
this->Set_new_def(true);
|
||||
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
|
||||
|
||||
@ -307,6 +307,7 @@ cxxSolution::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read solution number and description
|
||||
this->read_number_description(parser.line());
|
||||
this->Set_new_def(true);
|
||||
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
bool tc_defined(false);
|
||||
|
||||
@ -243,6 +243,7 @@ cxxSurface::read_raw(CParser & parser, bool check)
|
||||
|
||||
// Read surface number and description
|
||||
this->read_number_description(parser);
|
||||
this->Set_new_def(true);
|
||||
|
||||
opt_save = CParser::OPT_ERROR;
|
||||
bool only_counter_ions_defined(false);
|
||||
|
||||
@ -298,7 +298,7 @@ calc_dens(void)
|
||||
* volume 6, pages 1-17
|
||||
*/
|
||||
int i;
|
||||
LDBLE M_T, rho_new, gfw;
|
||||
LDBLE M_T, /*rho_new,*/ gfw;
|
||||
/* 2 options: original VP, assign the volumes of species with zero molar volume to their master species,
|
||||
but this doubles counts of complexes with -Vm defined. And, cation-OH and H-anion
|
||||
complexes are counted once. Also, must add H+ and OH-... */
|
||||
@ -364,15 +364,17 @@ calc_dens(void)
|
||||
/* If pure water then return rho_0 */
|
||||
if (M_T == 0)
|
||||
return rho_0;
|
||||
else
|
||||
return rho_0 * (1e3 + M_T / mass_water_aq_x) / (rho_0 * V_solutes / mass_water_aq_x + 1e3);
|
||||
|
||||
M_T /= 1e3;
|
||||
solution_mass = mass_water_aq_x + M_T;
|
||||
V_solutes = M_T - rho_0 * V_solutes / 1e3;
|
||||
//M_T /= 1e3;
|
||||
//solution_mass = mass_water_aq_x + M_T;
|
||||
//V_solutes = M_T - rho_0 * V_solutes / 1e3;
|
||||
|
||||
rho_new = halve(f_rho, 0.5, 2.0, 1e-7);
|
||||
if (!PHR_ISFINITE(rho_new) || rho_new > 1.99999) rho_new = 1.99999;
|
||||
//rho_new = halve(f_rho, 0.5, 2.0, 1e-7);
|
||||
//if (!PHR_ISFINITE(rho_new) || rho_new > 1.99999) rho_new = 1.99999;
|
||||
|
||||
return rho_new;
|
||||
//return rho_new;
|
||||
}
|
||||
/* VP: Density End */
|
||||
/* DP: Function for interval halving */
|
||||
|
||||
@ -1193,6 +1193,7 @@ ineq(int in_kode)
|
||||
if (it->second.Get_force_equality())
|
||||
continue;
|
||||
/* Undersaturated and no mass, ignore */
|
||||
//if (x[i]->f > 1e-14/*0e-8*/ && x[i]->moles <= 0
|
||||
if (x[i]->f > 0e-8 && x[i]->moles <= 0
|
||||
&& it->second.Get_add_formula().size() == 0)
|
||||
{
|
||||
|
||||
@ -1518,6 +1518,13 @@ build_pure_phases(void)
|
||||
else
|
||||
{
|
||||
master_ptr = elt_list[j].elt->primary;
|
||||
if (master_ptr == NULL)
|
||||
{
|
||||
error_string = sformatf(
|
||||
"Element undefined, %s.",
|
||||
elt_list[j].elt->name);
|
||||
error_msg(error_string, STOP);
|
||||
}
|
||||
if (master_ptr->in == FALSE)
|
||||
{
|
||||
master_ptr = master_ptr->s->secondary;
|
||||
|
||||
@ -60,21 +60,21 @@ tidy_model(void)
|
||||
{
|
||||
new_model = TRUE;
|
||||
}
|
||||
if (keycount[Keywords::KEY_EQUILIBRIUM_PHASES] > 0 /*||
|
||||
if (keycount[Keywords::KEY_EQUILIBRIUM_PHASES] > 0 ||
|
||||
keycount[Keywords::KEY_EQUILIBRIUM_PHASES_RAW] > 0 ||
|
||||
keycount[Keywords::KEY_EQUILIBRIUM_PHASES_MODIFY]*/)
|
||||
keycount[Keywords::KEY_EQUILIBRIUM_PHASES_MODIFY])
|
||||
{
|
||||
new_pp_assemblage = TRUE; /*"pure_phases" */
|
||||
}
|
||||
if (keycount[Keywords::KEY_SURFACE] > 0 /*||
|
||||
if (keycount[Keywords::KEY_SURFACE] > 0 ||
|
||||
keycount[Keywords::KEY_SURFACE_RAW] > 0 ||
|
||||
keycount[Keywords::KEY_SURFACE_MODIFY]*/)
|
||||
keycount[Keywords::KEY_SURFACE_MODIFY])
|
||||
{
|
||||
new_surface = TRUE; /*"surface" */
|
||||
}
|
||||
if (keycount[Keywords::KEY_EXCHANGE] > 0 /*||
|
||||
if (keycount[Keywords::KEY_EXCHANGE] > 0 ||
|
||||
keycount[Keywords::KEY_EXCHANGE_RAW] > 0 ||
|
||||
keycount[Keywords::KEY_EXCHANGE_MODIFY]*/)
|
||||
keycount[Keywords::KEY_EXCHANGE_MODIFY])
|
||||
{
|
||||
new_exchange = TRUE; /*"exchange" */
|
||||
}
|
||||
@ -96,21 +96,21 @@ tidy_model(void)
|
||||
new_mix = TRUE; /*"mix" */
|
||||
}
|
||||
if (keycount[Keywords::KEY_SOLUTION] > 0 ||
|
||||
keycount[Keywords::KEY_SOLUTION_SPREAD] > 0 /*||
|
||||
keycount[Keywords::KEY_SOLUTION_SPREAD] > 0 ||
|
||||
keycount[Keywords::KEY_SOLUTION_RAW] > 0 ||
|
||||
keycount[Keywords::KEY_SOLUTION_MODIFY]*/)
|
||||
keycount[Keywords::KEY_SOLUTION_MODIFY])
|
||||
{ /*"solution" */
|
||||
new_solution = TRUE;
|
||||
}
|
||||
if (keycount[Keywords::KEY_GAS_PHASE] > 0 /*||
|
||||
if (keycount[Keywords::KEY_GAS_PHASE] > 0 ||
|
||||
keycount[Keywords::KEY_GAS_PHASE_RAW] > 0 ||
|
||||
keycount[Keywords::KEY_GAS_PHASE_MODIFY]*/)
|
||||
keycount[Keywords::KEY_GAS_PHASE_MODIFY])
|
||||
{
|
||||
new_gas_phase = TRUE; /*"gas_phase" */
|
||||
}
|
||||
if (keycount[Keywords::KEY_SOLID_SOLUTIONS] > 0 /*||
|
||||
if (keycount[Keywords::KEY_SOLID_SOLUTIONS] > 0 ||
|
||||
keycount[Keywords::KEY_SOLID_SOLUTIONS_RAW] > 0 ||
|
||||
keycount[Keywords::KEY_SOLID_SOLUTIONS_MODIFY]*/)
|
||||
keycount[Keywords::KEY_SOLID_SOLUTIONS_MODIFY])
|
||||
{
|
||||
new_ss_assemblage = TRUE; /*"solid_solutions" */
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user