Added setdiff_c method.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/branches/concrete@10891 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2016-03-04 16:38:33 +00:00
parent 2a9ab26516
commit 626d678296
4 changed files with 49 additions and 2 deletions

View File

@ -1617,6 +1617,9 @@ listtokens(FILE * f, tokenrec * l_buf)
case tokdiff_c:
output_msg("DIFF_C");
break;
case toksetdiff_c:
output_msg("SETDIFF_C");
break;
case toksa_declercq:
output_msg("SA_DECLERCQ");
break;
@ -3823,7 +3826,25 @@ factor(struct LOC_exec * LINK)
n.UU.val = (parse_all) ? 1 : PhreeqcPtr->diff_c(str);
}
break;
case toksetdiff_c:
{
double d;
require(toklp, LINK);
const char * str = stringfactor(STR1, LINK);
require(tokcomma, LINK);
// double arugument
d = realexpr(LINK);
require(tokrp, LINK);
n.UU.val = (parse_all) ? 1 : PhreeqcPtr->setdiff_c(str, d);
//PhreeqcPtr->PHRQ_free((void *) str);
}
break;
case tokval:
l_s = strfactor(LINK);
tok1 = LINK->t;
@ -7159,7 +7180,8 @@ const std::map<const std::string, PBasic::BASIC_TOKEN>::value_type temp_tokens[]
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("viscos_0", PBasic::tokviscos_0),
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("rho_0", PBasic::tokrho_0),
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("current_a", PBasic::tokcurrent_a),
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("pot_v", PBasic::tokpot_v)
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("pot_v", PBasic::tokpot_v),
std::map<const std::string, PBasic::BASIC_TOKEN>::value_type("setdiff_c", PBasic::toksetdiff_c)
};
std::map<const std::string, PBasic::BASIC_TOKEN> PBasic::command_tokens(temp_tokens, temp_tokens + sizeof temp_tokens / sizeof temp_tokens[0]);

View File

@ -323,6 +323,7 @@ public:
tokequiv_frac,
tokcallback,
tokdiff_c,
toksetdiff_c,
toksa_declercq,
tokedl_species,
tokviscos,

View File

@ -101,6 +101,7 @@ public:
LDBLE log_activity_coefficient(const char *species_name);
LDBLE aqueous_vm(const char *species_name);
LDBLE diff_c(const char *species_name);
LDBLE setdiff_c(const char *species_name, double d);
LDBLE sa_declercq(double type, double sa, double d, double m, double m0, double gfw);
LDBLE calc_SC(void);
/* VP: Density Start */

View File

@ -158,7 +158,7 @@ diff_c(const char *species_name)
LDBLE g;
s_ptr = s_search(species_name);
if (s_ptr != NULL && s_ptr->in != FALSE && s_ptr->type < EMINUS)
if (s_ptr != NULL /*&& s_ptr->in != FALSE && s_ptr->type < EMINUS*/)
{
g = s_ptr->dw;
if (s_ptr->dw_t)
@ -173,6 +173,29 @@ diff_c(const char *species_name)
}
/* ---------------------------------------------------------------------- */
LDBLE Phreeqc::
setdiff_c(const char *species_name, double d)
/* ---------------------------------------------------------------------- */
{
struct species *s_ptr;
LDBLE g;
s_ptr = s_search(species_name);
if (s_ptr != NULL)
{
s_ptr->dw = d;
g = s_ptr->dw;
if (s_ptr->dw_t)
g *= exp(s_ptr->dw_t / tk_x - s_ptr->dw_t / 298.15);
g *= viscos_0_25 / viscos;
}
else
{
g = 0;
}
return (g);
}
/* ---------------------------------------------------------------------- */
LDBLE Phreeqc::
calc_SC(void)
/* ---------------------------------------------------------------------- */
{