mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
LDBLEs
git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@7588 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
7bb4d37189
commit
c42bd89280
@ -233,7 +233,7 @@ cxxKineticsComp::read_raw(CParser & parser, bool check)
|
||||
case 6: // d_params
|
||||
while (parser.copy_token(token, next_char) == CParser::TT_DIGIT)
|
||||
{
|
||||
double dd;
|
||||
LDBLE dd;
|
||||
sscanf(token.c_str(), "%lf", &dd);
|
||||
temp_d_params.push_back((LDBLE) dd);
|
||||
d_params_defined = true;
|
||||
|
||||
@ -3144,7 +3144,7 @@ factor(struct LOC_exec * LINK)
|
||||
break;
|
||||
case toklog10:
|
||||
{
|
||||
double t = realfactor(LINK);
|
||||
LDBLE t = realfactor(LINK);
|
||||
if (t > 0.0)
|
||||
{
|
||||
n.UU.val = log10(t);
|
||||
|
||||
4
SS.cxx
4
SS.cxx
@ -482,7 +482,7 @@ cxxSS::add(const cxxSS & addee_in, LDBLE extensive)
|
||||
if (Utilities::strcmp_nocase(this->ss_comps[i].Get_name().c_str(),
|
||||
addee.Get_ss_comps()[j].Get_name().c_str()) == 0)
|
||||
{
|
||||
double d = this->ss_comps[i].Get_initial_moles() +
|
||||
LDBLE d = this->ss_comps[i].Get_initial_moles() +
|
||||
addee.Get_ss_comps()[j].Get_initial_moles() * extensive;
|
||||
this->ss_comps[i].Set_initial_moles(d);
|
||||
d = this->ss_comps[i].Get_moles() +
|
||||
@ -511,7 +511,7 @@ cxxSS::multiply(LDBLE extensive)
|
||||
size_t i;
|
||||
for (i = 0; i < this->ss_comps.size(); i++)
|
||||
{
|
||||
double d = this->ss_comps[i].Get_initial_moles() * extensive;
|
||||
LDBLE d = this->ss_comps[i].Get_initial_moles() * extensive;
|
||||
this->ss_comps[i].Set_initial_moles(d);
|
||||
d = this->ss_comps[i].Get_moles() * extensive;
|
||||
this->ss_comps[i].Set_moles(d);
|
||||
|
||||
@ -157,11 +157,11 @@ Utilities::convert_time(double t, std::string in, std::string out)
|
||||
return t;
|
||||
|
||||
}
|
||||
double
|
||||
Utilities::safe_exp(double t)
|
||||
LDBLE
|
||||
Utilities::safe_exp(LDBLE t)
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
double f = 1.442695*t; // convert to exp for 2.0
|
||||
LDBLE f = 1.442695*t; // convert to exp for 2.0
|
||||
|
||||
if (f > DBL_MAX_EXP - 50.0)
|
||||
{
|
||||
|
||||
4
Utils.h
4
Utils.h
@ -6,7 +6,7 @@
|
||||
#include <ostream> // std::ostream
|
||||
#include <istream> // std::istream
|
||||
#include <map> // std::map
|
||||
|
||||
#include "phrqtype.h"
|
||||
namespace Utilities
|
||||
{
|
||||
|
||||
@ -23,6 +23,6 @@ namespace Utilities
|
||||
|
||||
void squeeze_white(std::string & s_l);
|
||||
double convert_time(double t, std::string in, std::string out);
|
||||
double safe_exp(double t);
|
||||
LDBLE safe_exp(LDBLE t);
|
||||
}
|
||||
#endif // UTILITIES_H_INCLUDED
|
||||
|
||||
12
model.cpp
12
model.cpp
@ -4668,9 +4668,9 @@ revise_guesses(void)
|
||||
if (x[i]->moles > 1e101 || x[i]->moles < 1e-101 ||
|
||||
x[i]->sum > 1e101 || x[i]->sum < 1e-101)
|
||||
{
|
||||
double d1 = log10(x[i]->moles);
|
||||
double d2 = log10(x[i]->sum);
|
||||
double d3 = d1 - d2;
|
||||
LDBLE d1 = log10(x[i]->moles);
|
||||
LDBLE d2 = log10(x[i]->sum);
|
||||
LDBLE d3 = d1 - d2;
|
||||
if (d3 > DBL_MAX_10_EXP/2)
|
||||
{
|
||||
d = pow(10.0, DBL_MAX_10_EXP/2.);
|
||||
@ -4684,7 +4684,7 @@ revise_guesses(void)
|
||||
{
|
||||
d = fabs(x[i]->moles / x[i]->sum);
|
||||
}
|
||||
double d1;
|
||||
LDBLE d1;
|
||||
if (d > 0)
|
||||
{
|
||||
d1 = weight * log10(d);
|
||||
@ -5329,7 +5329,7 @@ numerical_jacobian(void)
|
||||
// avoid overflow
|
||||
if (residual[j] > 1.0e101)
|
||||
{
|
||||
double t = pow(10.0, DBL_MAX_10_EXP - 50.0);
|
||||
LDBLE t = pow((LDBLE) 10.0, LDBLE(DBL_MAX_10_EXP - 50.0));
|
||||
if (residual[j] > t)
|
||||
{
|
||||
array[j * (count_unknowns + 1) + i] = -pow(10.0, DBL_MAX_10_EXP - 50.0);
|
||||
@ -5341,7 +5341,7 @@ numerical_jacobian(void)
|
||||
}
|
||||
else if (residual[j] < -1.0e101)
|
||||
{
|
||||
double t = pow(10.0, DBL_MIN_10_EXP + 50.0);
|
||||
LDBLE t = pow((LDBLE) 10.0, (LDBLE) (DBL_MIN_10_EXP + 50.0));
|
||||
if (residual[j] < -t)
|
||||
{
|
||||
array[j * (count_unknowns + 1) + i] = pow(10.0, DBL_MIN_10_EXP + 50.0);
|
||||
|
||||
2
read.cpp
2
read.cpp
@ -2449,7 +2449,7 @@ read_kinetics(void)
|
||||
}
|
||||
else if (stdunits.size() > 0)
|
||||
{
|
||||
std::vector<double>::iterator it;
|
||||
std::vector<LDBLE>::iterator it;
|
||||
for (it = temp_kinetics.Get_steps().begin(); it != temp_kinetics.Get_steps().end(); it++)
|
||||
{
|
||||
*it = Utilities::convert_time(*it, stdunits, "s");
|
||||
|
||||
@ -1803,7 +1803,7 @@ cxxChemRxn2rxn(cxxChemRxn &cr)
|
||||
for (int i = 0; rxn_ptr_new->token[i].s != NULL; i++)
|
||||
{
|
||||
rxn_ptr_new->token[i].name = string_hsave(rxn_ptr_new->token[i].name);
|
||||
double z = rxn_ptr_new->token[i].s->z;
|
||||
LDBLE z = rxn_ptr_new->token[i].s->z;
|
||||
rxn_ptr_new->token[i].s = s_store(rxn_ptr_new->token[i].name, z, false);
|
||||
}
|
||||
return (rxn_ptr_new);
|
||||
|
||||
4
tidy.cpp
4
tidy.cpp
@ -2349,7 +2349,7 @@ tidy_species(void)
|
||||
* Find valence of cation from coefficients of reaction components
|
||||
* Changed to be coefficient of exchanger
|
||||
*/
|
||||
double exchange_coef = 0.0;
|
||||
LDBLE exchange_coef = 0.0;
|
||||
for (j = 1; s[i]->rxn_s->token[j].s != NULL; j++)
|
||||
{
|
||||
if (s[i]->rxn_s->token[j].s->type == EX)
|
||||
@ -2370,7 +2370,7 @@ tidy_species(void)
|
||||
}
|
||||
if (s[i]->type == SURF)
|
||||
{
|
||||
double surface_coef = 0.0;
|
||||
LDBLE surface_coef = 0.0;
|
||||
/*
|
||||
* Find coefficient of surface in rxn, store in equiv
|
||||
*/
|
||||
|
||||
@ -169,7 +169,7 @@ calc_rho_0(LDBLE tc, LDBLE pa)
|
||||
but may give densities < 0 outside the limits, e.g. tc = 250, p = 2.5e3... */
|
||||
|
||||
/* The minimal pressure equals the saturation pressure... */
|
||||
double tk = tc + 273.15;
|
||||
LDBLE tk = tc + 273.15;
|
||||
p_sat = exp(11.6702 - 3816.44 / (tk - 46.13));
|
||||
if (ah2o_x <= 1.0)
|
||||
p_sat *= ah2o_x;
|
||||
@ -180,11 +180,11 @@ calc_rho_0(LDBLE tc, LDBLE pa)
|
||||
}
|
||||
if (!use.Get_gas_phase_in())
|
||||
patm_x = pa;
|
||||
double pasc = pa * 1.01325e5;
|
||||
double Rg = 0.461526e3; //J / kg / K
|
||||
double Tref = 1386.0, Pref = 16.53e6; // K, Pa
|
||||
double t_t = Tref / tk, p_p = pasc / Pref;
|
||||
double ni[34] = {0.14632971213167, -0.84548187169114, -0.37563603672040e1, 0.33855169168385e1,
|
||||
LDBLE pasc = pa * 1.01325e5;
|
||||
LDBLE Rg = 0.461526e3; //J / kg / K
|
||||
LDBLE Tref = 1386.0, Pref = 16.53e6; // K, Pa
|
||||
LDBLE t_t = Tref / tk, p_p = pasc / Pref;
|
||||
LDBLE ni[34] = {0.14632971213167, -0.84548187169114, -0.37563603672040e1, 0.33855169168385e1,
|
||||
-0.95791963387872, 0.15772038513228, -0.16616417199501e-1, 0.81214629983568e-3,
|
||||
0.28319080123804e-3, -0.60706301565874e-3, -0.18990068218419e-1, -0.32529748770505e-1,
|
||||
-0.21841717175414e-1, -0.52838357969930e-4, -0.47184321073267e-3, -0.30001780793026e-3,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user