Added new keywords to mix SOLUTION, EXCHANGE, GAS_PHASE, KINETICS, EQUILIBRIUM_PHASES, SOLID_SOLUTIONS, SURFACE

Replaced can not with cannot.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@6811 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2012-07-24 16:51:26 +00:00
parent e20fd6af4d
commit 06cc39e84d
15 changed files with 183 additions and 32 deletions

View File

@ -363,7 +363,7 @@ cxxExchComp::add(const cxxExchComp & addee, LDBLE extensive)
{
std::ostringstream oss;
oss <<
"Can not mix two exchange components with same formula and different related phases, "
"Cannot mix two exchange components with same formula and different related phases, "
<< this->formula;
error_msg(oss.str().c_str(), CONTINUE);
return;
@ -377,7 +377,7 @@ cxxExchComp::add(const cxxExchComp & addee, LDBLE extensive)
{
std::ostringstream oss;
oss <<
"Can not mix two exchange components with same formula and different related kinetics, "
"Cannot mix two exchange components with same formula and different related kinetics, "
<< this->formula;
error_msg(oss.str().c_str(), CONTINUE);
return;
@ -392,7 +392,7 @@ cxxExchComp::add(const cxxExchComp & addee, LDBLE extensive)
{
std::ostringstream oss;
oss <<
"Can not mix exchange components related to phase with exchange components related to kinetics, "
"Cannot mix exchange components related to phase with exchange components related to kinetics, "
<< this->formula;
error_msg(oss.str().c_str(), CONTINUE);
return;

View File

@ -78,7 +78,7 @@ cxxGasPhase::cxxGasPhase(std::map < int, cxxGasPhase > &entity_map,
if (this->type != entity_ptr->type)
{
std::ostringstream oss;
oss << "Can not mix two gas_phases with differing types.";
oss << "Cannot mix two gas_phases with differing types.";
error_msg(oss.str().c_str(), CONTINUE);
return;
}
@ -160,7 +160,7 @@ cxxNumKeyword(io)
if (this->type != entity_ptr->type)
{
std::ostringstream oss;
oss << "Can not mix two gas_phases with differing types.";
oss << "Cannot mix two gas_phases with differing types.";
error_msg(oss.str().c_str(), CONTINUE);
//input_error++;
return;

View File

@ -198,6 +198,23 @@ std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_REACTI
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_REACTION_PRESSURE, "REACTION_PRESSURE"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_REACTION_PRESSURE_RAW, "REACTION_PRESSURE_RAW"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_REACTION_PRESSURE_MODIFY, "REACTION_PRESSURE_MODIFY"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_SOLUTION_MIX, "SOLUTION_MIX")
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_SOLUTION_MIX, "SOLUTION_MIX"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_SOLUTION_MIX, "MIX_SOLUTION"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_EXCHANGE_MIX, "EXCHANGE_MIX"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_EXCHANGE_MIX, "MIX_EXCHANGE"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_GAS_PHASE_MIX, "GAS_PHASE_MIX"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_GAS_PHASE_MIX, "MIX_GAS_PHASE"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_KINETICS_MIX, "KINETICS_MIX"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_KINETICS_MIX, "MIX_KINETICS"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_PPASSEMBLAGE_MIX, "EQUILIBRIUM_PHASES_MIX"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_PPASSEMBLAGE_MIX, "MIX_EQUILIBRIUM_PHASES"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_PPASSEMBLAGE_MIX, "EQUILIBRIUM_PHASE_MIX"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_PPASSEMBLAGE_MIX, "MIX_EQUILIBRIUM_PHASE"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_SSASSEMBLAGE_MIX, "SOLID_SOLUTION_MIX"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_SSASSEMBLAGE_MIX, "MIX_SOLID_SOLUTION"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_SSASSEMBLAGE_MIX, "SOLID_SOLUTIONS_MIX"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_SSASSEMBLAGE_MIX, "MIX_SOLID_SOLUTIONS"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_SURFACE_MIX, "SURFACE_MIX"),
std::map<Keywords::KEYWORDS, const std::string>::value_type(Keywords::KEY_SURFACE_MIX, "MIX_SURFACE")
};
const std::map<Keywords::KEYWORDS, const std::string> Keywords::phreeqc_keyword_names(temp_keyword_names, temp_keyword_names + sizeof temp_keyword_names / sizeof temp_keyword_names[0]);

View File

@ -77,6 +77,12 @@ public:
KEY_REACTION_PRESSURE_RAW,
KEY_REACTION_PRESSURE_MODIFY,
KEY_SOLUTION_MIX,
KEY_EXCHANGE_MIX,
KEY_GAS_PHASE_MIX,
KEY_KINETICS_MIX,
KEY_PPASSEMBLAGE_MIX,
KEY_SSASSEMBLAGE_MIX,
KEY_SURFACE_MIX,
KEY_COUNT_KEYWORDS // must be last in list
};

View File

@ -408,7 +408,7 @@ cxxPPassemblageComp::add(const cxxPPassemblageComp & addee, LDBLE extensive)
{
std::ostringstream oss;
oss <<
"Can not mix two Equilibrium_phases with differing add_formulae., "
"Cannot mix two Equilibrium_phases with differing add_formulae., "
<< this->name;
error_msg(oss.str().c_str(), CONTINUE);
return;

View File

@ -690,7 +690,8 @@ public:
int *read_list_t_f(char **ptr, int *count_ints);
int read_master_species(void);
int read_mix(void);
int read_solution_mix(void);
int read_entity_mix(std::map<int, cxxMix> &mix_map);
//int read_solution_mix(void);
int read_named_logk(void);
int read_phases(void);
int read_print(void);
@ -1197,7 +1198,12 @@ protected:
std::map<int, cxxMix> Rxn_mix_map;
std::map<int, cxxMix> Dispersion_mix_map;
std::map<int, cxxMix> Rxn_solution_mix_map;
std::map<int, cxxMix> Rxn_exchange_mix_map;
std::map<int, cxxMix> Rxn_gas_phase_mix_map;
std::map<int, cxxMix> Rxn_kinetics_mix_map;
std::map<int, cxxMix> Rxn_pp_assemblage_mix_map;
std::map<int, cxxMix> Rxn_ss_assemblage_mix_map;
std::map<int, cxxMix> Rxn_surface_mix_map;
/*----------------------------------------------------------------------
* Irreversible reaction
*---------------------------------------------------------------------- */
@ -2018,6 +2024,19 @@ namespace Utilities
return phreeqc_cookie->cleanup_after_parser(parser);
}
template < typename T >
void Rxn_mix(std::map <int, cxxMix> &mix_map, std::map < int, T > &entity_map, Phreeqc * phreeqc_cookie)
{
std::map<int, cxxMix>::iterator mix_it;
for (mix_it = mix_map.begin(); mix_it != mix_map.end(); mix_it++)
{
T entity(entity_map, mix_it->second, mix_it->second.Get_n_user(), phreeqc_cookie->Get_phrq_io());
entity_map[mix_it->second.Get_n_user()] = entity;
Utilities::Rxn_copies(entity_map, mix_it->second.Get_n_user(), mix_it->second.Get_n_user_end());
}
mix_map.clear();
}
} // namespace Utilities

View File

@ -439,7 +439,7 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, LDBLE extensive)
{
std::ostringstream oss;
oss <<
"Can not mix two Surface components with same formula and different related phases, "
"Cannot mix two Surface components with same formula and different related phases, "
<< this->formula;
error_msg(oss.str().c_str(), CONTINUE);
return;
@ -454,7 +454,7 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, LDBLE extensive)
{
std::ostringstream oss;
oss <<
"Can not mix two exchange components with same formula and different related kinetics, "
"Cannot mix two exchange components with same formula and different related kinetics, "
<< this->formula;
error_msg(oss.str().c_str(), CONTINUE);
return;
@ -470,7 +470,7 @@ cxxSurfaceComp::add(const cxxSurfaceComp & addee, LDBLE extensive)
{
std::ostringstream oss;
oss <<
"Can not mix exchange components related to phase with exchange components related to kinetics, "
"Cannot mix exchange components related to phase with exchange components related to kinetics, "
<< this->formula;
error_msg(oss.str().c_str(), CONTINUE);
return;

View File

@ -2178,7 +2178,7 @@ total(const char *total_name)
return (cb_x / mass_water_aq_x);
}
/*
sprintf (error_string, "Can not find definition for master species, %s.",
sprintf (error_string, "Cannot find definition for master species, %s.",
total_name);
warning_msg (error_string);
*/
@ -2248,7 +2248,7 @@ total_mole(const char *total_name)
return (cb_x);
}
/*
sprintf (error_string, "Can not find definition for master species, %s.",
sprintf (error_string, "Cannot find definition for master species, %s.",
total_name);
warning_msg (error_string);
*/

View File

@ -1381,7 +1381,7 @@ minimal_solve(struct inverse *inv_ptr, unsigned long minimal_bits)
}
/*
* minimal_bits can not be superset of a minimal model, but
* minimal_bits cannot be superset of a minimal model, but
* could be subset of one of the sets of minerals with no feasible solution
* If it is a subset, then replace mineral and go on to next
*/

View File

@ -529,7 +529,7 @@ calculate_isotope_moles(struct element *elt_ptr,
if (total_moles <= 0)
{
error_string = sformatf(
"Can not calculate molality of isotopes, molality of element is zero, %s",
"Cannot calculate molality of isotopes, molality of element is zero, %s",
elt_ptr->name);
warning_msg(error_string);
return (ERROR);

View File

@ -2647,8 +2647,15 @@ run_simulations(void)
/*
* Calculate mixed solutions
*/
if (Rxn_solution_mix_map.size() > 0)
solution_mix();
//if (Rxn_solution_mix_map.size() > 0)
// solution_mix();
Utilities::Rxn_mix(Rxn_solution_mix_map, Rxn_solution_map, this);
Utilities::Rxn_mix(Rxn_exchange_mix_map, Rxn_exchange_map, this);
Utilities::Rxn_mix(Rxn_gas_phase_mix_map, Rxn_gas_phase_map, this);
Utilities::Rxn_mix(Rxn_kinetics_mix_map, Rxn_kinetics_map, this);
Utilities::Rxn_mix(Rxn_pp_assemblage_mix_map, Rxn_pp_assemblage_map, this);
Utilities::Rxn_mix(Rxn_ss_assemblage_mix_map, Rxn_ss_assemblage_map, this);
Utilities::Rxn_mix(Rxn_surface_mix_map, Rxn_surface_map, this);
/*
* Calculate distribution for exchangers
*/

View File

@ -3869,7 +3869,7 @@ setup_master_rxn(struct master **master_ptr_list, const std::string &pe_rxn)
if (master_ptr->s == s_h2o)
{
error_string = sformatf(
"Can not enter concentration data for O(-2),\n\tdissolved oxygen is O(0),\n\tfor mass of water, use -water identifier.");
"Cannot enter concentration data for O(-2),\n\tdissolved oxygen is O(0),\n\tfor mass of water, use -water identifier.");
error_msg(error_string, CONTINUE);
input_error++;
continue;
@ -4649,7 +4649,7 @@ setup_solution(void)
(ph_unknown == charge_balance_unknown)
&& (alkalinity_unknown != NULL))
{
error_msg("pH adustment can not attain charge balance"
error_msg("pH adustment cannot attain charge balance"
" when alkalinity is fixed.", CONTINUE);
input_error++;
}
@ -4657,7 +4657,7 @@ setup_solution(void)
(alkalinity_unknown->type == CB ||
alkalinity_unknown->type == SOLUTION_PHASE_BOUNDARY))
{
error_msg("Alkalinity can not be used with charge balance"
error_msg("Alkalinity cannot be used with charge balance"
" or solution phase boundary constraints.", CONTINUE);
input_error++;
}

View File

@ -113,7 +113,26 @@ read_input(void)
read_mix();
break;
case Keywords::KEY_SOLUTION_MIX:
read_solution_mix();
//read_solution_mix();
read_entity_mix(Rxn_solution_mix_map);
break;
case Keywords::KEY_EXCHANGE_MIX:
read_entity_mix(Rxn_exchange_mix_map);
break;
case Keywords::KEY_GAS_PHASE_MIX:
read_entity_mix(Rxn_gas_phase_mix_map);
break;
case Keywords::KEY_KINETICS_MIX:
read_entity_mix(Rxn_kinetics_mix_map);
break;
case Keywords::KEY_PPASSEMBLAGE_MIX:
read_entity_mix(Rxn_pp_assemblage_mix_map);
break;
case Keywords::KEY_SSASSEMBLAGE_MIX:
read_entity_mix(Rxn_ss_assemblage_mix_map);
break;
case Keywords::KEY_SURFACE_MIX:
read_entity_mix(Rxn_surface_mix_map);
break;
case Keywords::KEY_USE:
read_use();
@ -2455,7 +2474,7 @@ read_list_doubles(char **ptr, int *count_doubles)
{
/*
* Reads a list of LDBLE numbers until end of line is reached or
* a LDBLE can not be read from a token.
* a LDBLE cannot be read from a token.
*
* Arguments:
* ptr entry: points to line to read from
@ -2509,7 +2528,7 @@ read_list_ints(char **ptr, int *count_ints, int positive)
{
/*
* Reads a list of int numbers until end of line is reached or
* an int can not be read from a token.
* an int cannot be read from a token.
*
* Arguments:
* ptr entry: points to line to read from
@ -2569,7 +2588,7 @@ read_list_ints_range(char **ptr, int *count_ints, int positive, int *int_list)
{
/*
* Reads a list of int numbers until end of line is reached or
* an int can not be read from a token.
* an int cannot be read from a token.
*
* Arguments:
* ptr entry: points to line to read from
@ -3421,6 +3440,89 @@ read_mix(void)
}
/* ---------------------------------------------------------------------- */
int Phreeqc::
read_entity_mix(std::map<int, cxxMix> &mix_map)
/* ---------------------------------------------------------------------- */
{
/*
* Reads mixing fractions
*/
int n_user, n_user_end;
int return_value;
int n_solution;
LDBLE fraction;
int j, i, l;
char *ptr;
char token[MAX_LENGTH];
char *description;
cxxMix temp_mix;
/*
* Read mix number
*/
ptr = line;
read_number_description(ptr, &n_user, &n_user_end, &description);
temp_mix.Set_n_user(n_user);
temp_mix.Set_n_user_end(n_user_end);
temp_mix.Set_description(description);
free_check_null(description);
/*
* Read mixture data
*/
for (;;)
{
return_value = check_line("Mix raw data", FALSE, TRUE, TRUE, TRUE);
/* empty, eof, keyword, print */
if (return_value == EOF || return_value == KEYWORD)
{
break;
}
ptr = line;
/*
* Read n_user
*/
i = copy_token(token, &ptr, &l);
if (i == DIGIT)
{
sscanf(token, "%d ", &n_solution);
}
else
{
input_error++;
error_msg("Expected a number in mix input.", CONTINUE);
error_msg(line_save, CONTINUE);
continue;
}
/*
* Read fraction for entity
*/
copy_token(token, &ptr, &l);
j = sscanf(token, SCANFORMAT, &fraction);
if (j != 1)
{
input_error++;
error_msg("Expected a mixing fraction.", CONTINUE);
error_msg(line_save, CONTINUE);
continue;
}
/*
* Save data
*/
temp_mix.Add(n_solution ,fraction);
}
if (temp_mix.Get_mixComps().size() == 0)
{
input_error++;
error_msg
("Must define at least one number and mixing fraction for mix input.",
CONTINUE);
}
mix_map[n_user] = temp_mix;
return (return_value);
}
#ifdef SKIP
/* ---------------------------------------------------------------------- */
int Phreeqc::
read_solution_mix(void)
/* ---------------------------------------------------------------------- */
{
@ -3523,7 +3625,7 @@ read_solution_mix(void)
#endif
return (return_value);
}
#endif
/* ---------------------------------------------------------------------- */
int Phreeqc::
read_number_description(char *ptr, int *n_user,

View File

@ -360,7 +360,7 @@ tidy_model(void)
else if (s_hplus != NULL && s_h3oplus != NULL)
{
input_error++;
error_msg("Can not define both H+ and H3O+ in solution_species.",
error_msg("Cannot define both H+ and H3O+ in solution_species.",
STOP);
}
if (s_hplus->primary == NULL)
@ -925,7 +925,7 @@ tidy_gas_phase(void)
{
input_error++;
error_string = sformatf(
"Gas phase %d: can not use '-equilibrium' option with fixed pressure gas phase.",
"Gas phase %d: cannot use '-equilibrium' option with fixed pressure gas phase.",
gas_phase_ptr->Get_n_user());
error_msg(error_string, CONTINUE);
}

View File

@ -3391,7 +3391,7 @@ check_surfaces(cxxSurface *surface_ptr1, cxxSurface *surface_ptr2)
if (surface_ptr1->Get_type() != surface_ptr2->Get_type())
{
error_string = sformatf(
"Surfaces %d and %d differ in use of electrical double layer. Can not mix.",
"Surfaces %d and %d differ in use of electrical double layer. Cannot mix.",
n_user1, n_user2);
error_msg(error_string, STOP);
return_code = ERROR;
@ -3400,7 +3400,7 @@ check_surfaces(cxxSurface *surface_ptr1, cxxSurface *surface_ptr2)
if (surface_ptr1->Get_only_counter_ions() != surface_ptr2->Get_only_counter_ions())
{
error_string = sformatf(
"Surfaces %d and %d differ in use of only counter ions in the diffuse layer. Can not mix.",
"Surfaces %d and %d differ in use of only counter ions in the diffuse layer. Cannot mix.",
n_user1, n_user2);
error_msg(error_string, STOP);
return_code = ERROR;
@ -3409,7 +3409,7 @@ check_surfaces(cxxSurface *surface_ptr1, cxxSurface *surface_ptr2)
if (surface_ptr1->Get_related_phases() != surface_ptr2->Get_related_phases())
{
error_string = sformatf(
"Surfaces %d and %d differ in use of related phases (sites proportional to moles of an equilibrium phase). Can not mix.",
"Surfaces %d and %d differ in use of related phases (sites proportional to moles of an equilibrium phase). Cannot mix.",
n_user1, n_user2);
error_msg(error_string, STOP);
return_code = ERROR;
@ -3418,7 +3418,7 @@ check_surfaces(cxxSurface *surface_ptr1, cxxSurface *surface_ptr2)
if (surface_ptr1->Get_related_rate() != surface_ptr2->Get_related_rate())
{
error_string = sformatf(
"Surfaces %d and %d differ in use of related rate (sites proportional to moles of a kinetic reactant). Can not mix.",
"Surfaces %d and %d differ in use of related rate (sites proportional to moles of a kinetic reactant). Cannot mix.",
n_user1, n_user2);
error_msg(error_string, STOP);
return_code = ERROR;