mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Fixed error for malloc introduced in recent Basic function.
Fixed error with Pitzer paramenters that were not recalculated with a change in pressure. Parameters depend on density of water I think. Also changed SIT, although I am not sure the parameters have a pressure dependence. git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@7837 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
a03d2ae87e
commit
7848242e28
@ -3440,15 +3440,15 @@ factor(struct LOC_exec * LINK)
|
||||
std::string elt_name;
|
||||
|
||||
// return equivalent fraction
|
||||
n.UU.val = PhreeqcPtr->equivalent_fraction(species_name.c_str(), &eq, elt_name);
|
||||
n.UU.val = (parse_all) ? 1 : PhreeqcPtr->equivalent_fraction(species_name.c_str(), &eq, elt_name);
|
||||
|
||||
// set equivalents
|
||||
*count_varrec->UU.U0.val = eq;
|
||||
*count_varrec->UU.U0.val = (parse_all) ? 1 : eq;
|
||||
|
||||
// set element name
|
||||
size_t l = elt_name.size();
|
||||
l = l < 256 ? 256 : l + 1;
|
||||
char * token = (char *) PhreeqcPtr->PHRQ_malloc( l, sizeof(char));
|
||||
char * token = (char *) PhreeqcPtr->PHRQ_malloc( l * sizeof(char));
|
||||
strcpy(token, elt_name.c_str());
|
||||
*elt_varrec->UU.U1.sval = token;
|
||||
}
|
||||
|
||||
@ -986,7 +986,8 @@ void Phreeqc::init(void)
|
||||
count_theta_param = 0;
|
||||
max_theta_param = 100;
|
||||
use_etheta = TRUE;
|
||||
OTEMP = 0.0;
|
||||
OTEMP = -100.;
|
||||
OPRESS = -100.;
|
||||
A0 = 0;
|
||||
spec = NULL;
|
||||
cations = NULL;
|
||||
|
||||
@ -1799,7 +1799,7 @@ protected:
|
||||
struct theta_param **theta_params;
|
||||
int count_theta_param, max_theta_param;
|
||||
int use_etheta;
|
||||
LDBLE OTEMP;
|
||||
LDBLE OTEMP, OPRESS;
|
||||
LDBLE A0;
|
||||
struct species **spec, **cations, **anions, **neutrals;
|
||||
int count_cations, count_anions, count_neutrals;
|
||||
|
||||
@ -28,6 +28,7 @@ pitzer_init(void)
|
||||
|
||||
ICON = TRUE;
|
||||
OTEMP = -100.;
|
||||
OPRESS = -100.;
|
||||
for (i = 0; i < 23; i++)
|
||||
{
|
||||
BK[i] = 0.0;
|
||||
@ -58,6 +59,7 @@ pitzer_tidy(void)
|
||||
* Ensure new parameters are calculated
|
||||
*/
|
||||
OTEMP = -100.;
|
||||
OPRESS = -100.;
|
||||
/*
|
||||
* allocate pointers to species structures
|
||||
*/
|
||||
@ -740,9 +742,10 @@ C
|
||||
int i;
|
||||
LDBLE TR = 298.15;
|
||||
|
||||
if (fabs(TK - OTEMP) < 0.001e0)
|
||||
if (fabs(TK - OTEMP) < 0.001e0 && fabs(patm_x - OPRESS) < 0.001)
|
||||
return OK;
|
||||
OTEMP = TK;
|
||||
OPRESS = patm_x;
|
||||
/*
|
||||
C Set DW0
|
||||
*/
|
||||
|
||||
6
sit.cpp
6
sit.cpp
@ -17,6 +17,7 @@ sit_init(void)
|
||||
space((void **) ((void *) &sit_params), INIT, &max_sit_param,
|
||||
sizeof(struct pitz_param *));
|
||||
OTEMP = -100.;
|
||||
OPRESS = -100.;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -33,6 +34,7 @@ sit_tidy(void)
|
||||
* Ensure new parameters are calculated
|
||||
*/
|
||||
OTEMP = -100.;
|
||||
OPRESS = -100.;
|
||||
/*
|
||||
* allocate pointers to species structures
|
||||
*/
|
||||
@ -1333,8 +1335,10 @@ C
|
||||
int i;
|
||||
LDBLE TR = 298.15;
|
||||
|
||||
if (fabs(TK - OTEMP) < 0.001e0) return OK;
|
||||
if (fabs(TK - OTEMP) < 0.001e0 && fabs(patm_x - OPRESS) < 0.001)
|
||||
return OK;
|
||||
OTEMP = TK;
|
||||
OPRESS = patm_x;
|
||||
/*
|
||||
C Set DW0
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user