mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Working with gas phase.
Bug in calculation of total pressure of mix. Other issues when element of a gas component was not present in the system. git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@8879 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
1c3b396536
commit
87ad76934b
@ -137,6 +137,12 @@ cxxGasPhase::cxxGasPhase(std::map < int, cxxGasPhase > &entity_map,
|
||||
|
||||
const std::map < int, LDBLE > & mixcomps = mx.Get_mixComps();
|
||||
std::map < int, LDBLE >::const_iterator it;
|
||||
this->total_p = 0;
|
||||
double sum_fractions = 0.0;
|
||||
for (it = mixcomps.begin(); it != mixcomps.end(); it++)
|
||||
{
|
||||
sum_fractions += it->second;
|
||||
}
|
||||
for (it = mixcomps.begin(); it != mixcomps.end(); it++)
|
||||
{
|
||||
if (entity_map.find(it->first) != entity_map.end())
|
||||
@ -148,7 +154,7 @@ cxxGasPhase::cxxGasPhase(std::map < int, cxxGasPhase > &entity_map,
|
||||
this->solution_equilibria = entity_ptr->solution_equilibria;
|
||||
this->n_solution = entity_ptr->n_solution;
|
||||
this->type = entity_ptr->type;
|
||||
this->total_p = entity_ptr->total_p * it->second;
|
||||
this->total_p += entity_ptr->total_p * it->second / sum_fractions;
|
||||
this->total_moles = entity_ptr->total_moles * it->second;
|
||||
this->volume = entity_ptr->volume * it->second;
|
||||
this->v_m = entity_ptr->v_m * it->second;
|
||||
|
||||
@ -1067,6 +1067,14 @@ cxxSolution::Update(LDBLE h_tot, LDBLE o_tot, LDBLE charge, const cxxNameDouble
|
||||
// Don`t bother to update activities?
|
||||
//this->Update(const_nd);
|
||||
this->totals = const_nd;
|
||||
cxxNameDouble::iterator it;
|
||||
for (it = this->totals.begin(); it != this->totals.end(); it++)
|
||||
{
|
||||
if (it->second < 1e-14)
|
||||
{
|
||||
it->second = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
void
|
||||
cxxSolution::Update_activities(const cxxNameDouble &original_tot)
|
||||
|
||||
18
gases.cpp
18
gases.cpp
@ -183,17 +183,14 @@ build_fixed_volume_gas(void)
|
||||
{
|
||||
master_ptr = rxn_ptr->s->secondary;
|
||||
}
|
||||
else
|
||||
else if (rxn_ptr->s->primary != NULL && rxn_ptr->s->primary->in == TRUE)
|
||||
{
|
||||
master_ptr = rxn_ptr->s->primary;
|
||||
}
|
||||
if (master_ptr == NULL)
|
||||
else
|
||||
{
|
||||
error_string = sformatf(
|
||||
"Element needed for gas component, %s, is not in model.",
|
||||
phase_ptr->name);
|
||||
warning_msg(error_string);
|
||||
continue;
|
||||
master_ptr = master_bsearch_primary(rxn_ptr->s->name);
|
||||
master_ptr->s->la = -999.0;
|
||||
}
|
||||
if (debug_prep == TRUE)
|
||||
{
|
||||
@ -265,10 +262,15 @@ build_fixed_volume_gas(void)
|
||||
{
|
||||
master_ptr = rxn_ptr->s->secondary;
|
||||
}
|
||||
else
|
||||
else if (rxn_ptr->s->primary != NULL && rxn_ptr->s->primary->in == TRUE)
|
||||
{
|
||||
master_ptr = rxn_ptr->s->primary;
|
||||
}
|
||||
else
|
||||
{
|
||||
master_ptr = master_bsearch_primary(rxn_ptr->s->name);
|
||||
master_ptr->s->la = -999.0;
|
||||
}
|
||||
|
||||
if (master_ptr == NULL)
|
||||
{
|
||||
|
||||
19
prep.cpp
19
prep.cpp
@ -509,17 +509,14 @@ build_gas_phase(void)
|
||||
{
|
||||
master_ptr = rxn_ptr->s->secondary;
|
||||
}
|
||||
else
|
||||
else if (rxn_ptr->s->primary != NULL && rxn_ptr->s->primary->in == TRUE)
|
||||
{
|
||||
master_ptr = rxn_ptr->s->primary;
|
||||
}
|
||||
if (master_ptr == NULL)
|
||||
else
|
||||
{
|
||||
error_string = sformatf(
|
||||
"Element needed for gas component, %s, is not in model.",
|
||||
phase_ptr->name);
|
||||
warning_msg(error_string);
|
||||
continue;
|
||||
master_ptr = master_bsearch_primary(rxn_ptr->s->name);
|
||||
master_ptr->s->la = -999.0;
|
||||
}
|
||||
if (debug_prep == TRUE)
|
||||
{
|
||||
@ -591,11 +588,15 @@ build_gas_phase(void)
|
||||
{
|
||||
master_ptr = rxn_ptr->s->secondary;
|
||||
}
|
||||
else
|
||||
else if (rxn_ptr->s->primary != NULL && rxn_ptr->s->primary->in == TRUE)
|
||||
{
|
||||
master_ptr = rxn_ptr->s->primary;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
master_ptr = master_bsearch_primary(rxn_ptr->s->name);
|
||||
master_ptr->s->la = -999.0;
|
||||
}
|
||||
if (master_ptr == NULL)
|
||||
{
|
||||
error_string = sformatf(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user