From 4463d417038c03276637ed63c3b604ad4a5de485 Mon Sep 17 00:00:00 2001 From: Scott R Charlton Date: Fri, 2 Apr 2010 00:14:16 +0000 Subject: [PATCH] passes all tests on win32; before changing to multiple instances git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/branches/class@4201 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- IPhreeqc.sln | 11 + IPhreeqc.vcproj | 30 +- {src => include}/IPhreeqc.hpp | 3 - include/IPhreeqc2.h | 134 ++ include/IPhreeqcLib.h | 96 ++ src/IPhreeqc.cpp | 1131 ++++++++-------- src/IPhreeqc2.cpp | 1257 ++++++++++++++++++ src/IPhreeqcLib.cpp | 468 +++++++ src/module_files.cpp | 5 +- src/module_output.cpp | 2 +- testcpp/ex1 | 71 ++ testcpp/phreeqc.dat | 1556 +++++++++++++++++++++++ testcpp/testcpp.cpp | 24 + testcpp/testcpp.vcproj | 204 +++ testcpp/testcpp.vcproj.GS.charlton.user | 65 + 15 files changed, 4504 insertions(+), 553 deletions(-) rename {src => include}/IPhreeqc.hpp (94%) create mode 100644 include/IPhreeqc2.h create mode 100644 include/IPhreeqcLib.h create mode 100644 src/IPhreeqc2.cpp create mode 100644 src/IPhreeqcLib.cpp create mode 100644 testcpp/ex1 create mode 100644 testcpp/phreeqc.dat create mode 100644 testcpp/testcpp.cpp create mode 100644 testcpp/testcpp.vcproj create mode 100644 testcpp/testcpp.vcproj.GS.charlton.user diff --git a/IPhreeqc.sln b/IPhreeqc.sln index 9a25c337..41bd2df5 100644 --- a/IPhreeqc.sln +++ b/IPhreeqc.sln @@ -25,6 +25,11 @@ Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "test_getline", "test_getlin {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7} = {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testcpp", "testcpp\testcpp.vcproj", "{046110C9-CD5B-404D-B197-E295656CBF7F}" + ProjectSection(ProjectDependencies) = postProject + {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7} = {F9C18E06-F73A-4EB0-92E0-AE1713EA7FD7} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -68,6 +73,12 @@ Global {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.MemDebug|Win32.Build.0 = Debug|Win32 {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.Release|Win32.ActiveCfg = Release|Win32 {D95AB257-163E-4ABD-8577-94FB8D1EF62C}.Release|Win32.Build.0 = Release|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.Debug|Win32.ActiveCfg = Debug|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.Debug|Win32.Build.0 = Debug|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.MemDebug|Win32.ActiveCfg = Debug|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.MemDebug|Win32.Build.0 = Debug|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.Release|Win32.ActiveCfg = Release|Win32 + {046110C9-CD5B-404D-B197-E295656CBF7F}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/IPhreeqc.vcproj b/IPhreeqc.vcproj index 7a756284..3933bebe 100644 --- a/IPhreeqc.vcproj +++ b/IPhreeqc.vcproj @@ -117,7 +117,7 @@ + + + + @@ -800,6 +808,7 @@ > @@ -1443,7 +1454,6 @@ > + + + + diff --git a/src/IPhreeqc.hpp b/include/IPhreeqc.hpp similarity index 94% rename from src/IPhreeqc.hpp rename to include/IPhreeqc.hpp index e202550a..482cd550 100644 --- a/src/IPhreeqc.hpp +++ b/include/IPhreeqc.hpp @@ -75,8 +75,6 @@ public: // Singleton for library static IPhreeqc* LibraryInstance(void); - static int Create(void); - static void Destroy(int n); // Callbacks // @@ -101,7 +99,6 @@ public: void do_run(const char* sz_routine, std::istream* pis, FILE* fp, PFN_PRERUN_CALLBACK pfn_pre, PFN_POSTRUN_CALLBACK pfn_post, void *cookie); protected: - void init(void); void update_errors(void); protected: diff --git a/include/IPhreeqc2.h b/include/IPhreeqc2.h new file mode 100644 index 00000000..e8cc6862 --- /dev/null +++ b/include/IPhreeqc2.h @@ -0,0 +1,134 @@ +#ifndef _INC_IPHREEQC2_HPP +#define _INC_IPHREEQC2_HPP + +#include +#include +#include +#include "IPhreeqcCallbacks.h" /* PFN_PRERUN_CALLBACK, PFN_POSTRUN_CALLBACK, PFN_CATCH_CALLBACK */ +#include "Var.h" /* VRESULT */ +// COMMENT: {3/31/2010 4:21:28 PM}#include "SelectedOutput.hxx" + +class Phreeqc; +class IErrorReporter; +class CSelectedOutput; + +class IPhreeqcStop : std::exception +{ +}; + +class IPhreeqc2 +{ +public: + IPhreeqc2(void); + ~IPhreeqc2(void); + +public: + + const char* GetLastErrorString(void); + const char* GetLastWarningString(void); + const char* GetDumpString(void); + + int LoadDatabase(const char* filename); + int LoadDatabaseString(const char* input); + + void UnLoadDatabase(void); + + size_t AddError(const char* error_msg); + size_t AddWarning(const char* warning_msg); + + int RunAccumulated(void); + int RunFile(const char* filename); + int RunString(const char* input); + + int GetSelectedOutputRowCount(void)const; + int GetSelectedOutputColumnCount(void)const; + VRESULT GetSelectedOutputValue(int row, int col, VAR* pVAR); + + void OutputLines(void); + const std::string& GetAccumulatedLines(void); + void ClearAccumulatedLines(void); + VRESULT AccumulateLine(const char *line); + + int GetDumpLineCount(void)const; + const char* GetDumpLine(int n); + + int GetErrorLineCount(void)const; + const char* GetErrorLine(int n); + + std::list< std::string > ListComponents(void); + size_t GetComponentCount(void); + const char* GetComponent(int n); + + bool GetDumpOn(void)const; + void SetDumpOn(bool bValue); + + bool GetDumpStringOn(void)const; + void SetDumpStringOn(bool bValue); + + bool GetErrorOn(void)const; + void SetErrorOn(bool bValue); + + bool GetLogOn(void)const; + void SetLogOn(bool bValue); + + bool GetOutputOn(void)const; + void SetOutputOn(bool bValue); + + bool GetSelectedOutputOn(void)const; + void SetSelectedOutputOn(bool bValue); + + // IPhreeqc.cpp + static int handler2(const int action, const int type, const char *err_str, const int stop, void *cookie, const char *format, va_list args); + int output_handler2(const int type, const char *err_str, const int stop, void *cookie, const char *format, va_list args); + int open_handler2(const int type, const char *file_name); + + // module_files.c + static int module_handler2(const int action, const int type, const char *err_str, const int stop, void *cookie, const char *format, va_list args); + int module_isopen_handler2(const int type); + int module_open_handler2(const int type, const char *file_name); + + // module_output.c + int output_isopen2(const int type); + + virtual int EndRow(void); + void AddSelectedOutput(const char* name, const char* format, va_list argptr); + + void check_database(const char* sz_routine); + void do_run(const char* sz_routine, std::istream* pis, FILE* fp, PFN_PRERUN_CALLBACK pfn_pre, PFN_POSTRUN_CALLBACK pfn_post, void *cookie); + +protected: + void update_errors(void); + + +protected: + bool DatabaseLoaded; + bool SelectedOutputOn; + bool OutputOn; + bool LogOn; + bool ErrorOn; + bool DumpOn; + bool DumpStringOn; + + IErrorReporter *ErrorReporter; + std::string LastErrorString; + std::vector< std::string > ErrorLines; + + IErrorReporter *WarningReporter; + std::string LastWarningString; + std::vector< std::string > WarningLines; + + CSelectedOutput *SelectedOutput; + std::string PunchFileName; + std::string StringInput; + + std::string DumpString; + std::vector< std::string > DumpLines; + + std::list < std::string > Components; + +private: + friend class TestIPhreeqc; + Phreeqc* PhreeqcPtr; +}; + +#endif // _INC_IPHREEQC2_HPP \ No newline at end of file diff --git a/include/IPhreeqcLib.h b/include/IPhreeqcLib.h new file mode 100644 index 00000000..4524b41d --- /dev/null +++ b/include/IPhreeqcLib.h @@ -0,0 +1,96 @@ +#ifndef __IPHREEQC_LIB_H +#define __IPHREEQC_LIB_H + +#include + +#include "Var.h" + +/*! \brief Enumeration used to return error codes. +*/ +typedef enum { + IPL_OK = 0, + IPL_OUTOFMEMORY = -1, + IPL_BADINSTANCE = -2, + IPL_BADVARTYPE = -3, + IPL_INVALIDARG = -4, + IPL_INVALIDROW = -5, + IPL_INVALIDCOL = -6, +} IPL_RESULT; + + +class IPhreeqc2; + +#if defined(__cplusplus) +extern "C" { +#endif + + int AddErrorM(int id, const char* error_msg); + + int CreateIPhreeqc(void); + + IPL_RESULT DestroyIPhreeqc(int id); + + int LoadDatabaseM(int id, const char* filename); + + int LoadDatabaseStringM(int id, const char* input); + + int UnLoadDatabaseM(int id); + + const char* GetLastErrorStringM(int id); + + const char* GetDumpStringM(int id); + + int GetDumpLineCountM(int id); + + const char* GetDumpLineM(int id, int n); + + IPL_RESULT AccumulateLineM(int id, const char *line); + + int GetSelectedOutputOnM(int id); + IPL_RESULT SetSelectedOutputOnM(int id, int value); + + int GetOutputOnM(int id); + IPL_RESULT SetOutputOnM(int id, int value); + + int GetErrorOnM(int id); + IPL_RESULT SetErrorOnM(int id, int value); + + int GetLogOnM(int id); + IPL_RESULT SetLogOnM(int id, int value); + + int GetDumpOnM(int id); + IPL_RESULT SetDumpOnM(int id, int value); + + int GetDumpStringOnM(int id); + IPL_RESULT SetDumpStringOnM(int id, int value); + + int RunAccumulatedM(int id); + + int RunFileM(int id, const char* filename); + + int GetSelectedOutputRowCountM(int id); + int GetSelectedOutputColumnCountM(int id); + + IPL_RESULT GetSelectedOutputValueM(int id, int row, int col, VAR* pVAR); + + int GetComponentCountM(int id); + const char* GetComponentM(int id, int n); + + +#if defined(__cplusplus) +} +#endif + +class IPhreeqcLib +{ +public: + static int CreateIPhreeqc(void); + static IPL_RESULT DestroyIPhreeqc(int n); + static IPhreeqc2* GetInstance(int n); + +private: + static std::map Instances; + static size_t InstancesIndex; +}; + +#endif // __IPHREEQC_LIB_H \ No newline at end of file diff --git a/src/IPhreeqc.cpp b/src/IPhreeqc.cpp index 3c8fbc92..ca33ba43 100644 --- a/src/IPhreeqc.cpp +++ b/src/IPhreeqc.cpp @@ -17,6 +17,17 @@ LoadDatabase(const char* filename) return IPhreeqc::LibraryInstance()->LoadDatabase(filename); } +// COMMENT: {3/29/2010 10:18:52 PM}int +// COMMENT: {3/29/2010 10:18:52 PM}LoadDatabaseM(int n, const char* filename) +// COMMENT: {3/29/2010 10:18:52 PM}{ +// COMMENT: {3/29/2010 10:18:52 PM} IPhreeqc* IPhreeqcPtr = IPhreeqc::GetInstance(n); +// COMMENT: {3/29/2010 10:18:52 PM} if (IPhreeqcPtr) +// COMMENT: {3/29/2010 10:18:52 PM} { +// COMMENT: {3/29/2010 10:18:52 PM} return IPhreeqcPtr->LoadDatabase(filename); +// COMMENT: {3/29/2010 10:18:52 PM} } +// COMMENT: {3/29/2010 10:18:52 PM} return PHR_BADINSTANCE; +// COMMENT: {3/29/2010 10:18:52 PM}} + int LoadDatabaseString(const char* input) { @@ -224,7 +235,7 @@ IPhreeqc::IPhreeqc(void) this->ErrorReporter = new CErrorReporter; this->WarningReporter = new CErrorReporter; this->SelectedOutput = new CSelectedOutput(); - this->init(); +// COMMENT: {3/25/2010 2:37:54 PM} this->init(); this->UnLoadDatabase(); } @@ -235,35 +246,61 @@ IPhreeqc::~IPhreeqc(void) delete this->SelectedOutput; } -std::map IPhreeqc::Instances; -size_t IPhreeqc::InstancesIndex = 0; - -int -IPhreeqc::Create(void) -{ - int n = (int)IPhreeqc::InstancesIndex; - try - { - IPhreeqc* instance = new IPhreeqc; - if (instance) - { - IPhreeqc::Instances[IPhreeqc::InstancesIndex] = instance; - ++IPhreeqc::InstancesIndex; - } - } - catch(...) - { - return -1; - } - return n; -} - -void -Destroy(int n) -{ - -} - +// COMMENT: {4/1/2010 5:52:55 PM}std::map IPhreeqc::Instances; +// COMMENT: {4/1/2010 5:52:55 PM}size_t IPhreeqc::InstancesIndex = 0; +// COMMENT: {4/1/2010 5:52:55 PM} +// COMMENT: {4/1/2010 5:52:55 PM}int +// COMMENT: {4/1/2010 5:52:55 PM}IPhreeqc::CreateIPhreeqc(void) +// COMMENT: {4/1/2010 5:52:55 PM}{ +// COMMENT: {4/1/2010 5:52:55 PM} int n = -1; +// COMMENT: {4/1/2010 5:52:55 PM} try +// COMMENT: {4/1/2010 5:52:55 PM} { +// COMMENT: {4/1/2010 5:52:55 PM} IPhreeqc* IPhreeqcPtr = new IPhreeqc; +// COMMENT: {4/1/2010 5:52:55 PM} if (IPhreeqcPtr) +// COMMENT: {4/1/2010 5:52:55 PM} { +// COMMENT: {4/1/2010 5:52:55 PM} std::map::value_type instance(IPhreeqc::InstancesIndex, IPhreeqcPtr); +// COMMENT: {4/1/2010 5:52:55 PM} std::pair::iterator, bool> pr = IPhreeqc::Instances.insert(instance); +// COMMENT: {4/1/2010 5:52:55 PM} if (pr.second) +// COMMENT: {4/1/2010 5:52:55 PM} { +// COMMENT: {4/1/2010 5:52:55 PM} n = (int) (*pr.first).first; +// COMMENT: {4/1/2010 5:52:55 PM} ++IPhreeqc::InstancesIndex; +// COMMENT: {4/1/2010 5:52:55 PM} } +// COMMENT: {4/1/2010 5:52:55 PM} } +// COMMENT: {4/1/2010 5:52:55 PM} } +// COMMENT: {4/1/2010 5:52:55 PM} catch(...) +// COMMENT: {4/1/2010 5:52:55 PM} { +// COMMENT: {4/1/2010 5:52:55 PM} return -1; +// COMMENT: {4/1/2010 5:52:55 PM} } +// COMMENT: {4/1/2010 5:52:55 PM} return n; +// COMMENT: {4/1/2010 5:52:55 PM}} +// COMMENT: {4/1/2010 5:52:55 PM} +// COMMENT: {4/1/2010 5:52:55 PM}int +// COMMENT: {4/1/2010 5:52:55 PM}IPhreeqc::DestroyIPhreeqc(int n) +// COMMENT: {4/1/2010 5:52:55 PM}{ +// COMMENT: {4/1/2010 5:52:55 PM} int retval = PHR_BADINSTANCE; +// COMMENT: {4/1/2010 5:52:55 PM} if (n >= 0) +// COMMENT: {4/1/2010 5:52:55 PM} { +// COMMENT: {4/1/2010 5:52:55 PM} std::map::iterator it = IPhreeqc::Instances.find(size_t(n)); +// COMMENT: {4/1/2010 5:52:55 PM} if (it != IPhreeqc::Instances.end()) +// COMMENT: {4/1/2010 5:52:55 PM} { +// COMMENT: {4/1/2010 5:52:55 PM} delete (*it).second; +// COMMENT: {4/1/2010 5:52:55 PM} IPhreeqc::Instances.erase(it); +// COMMENT: {4/1/2010 5:52:55 PM} retval = 0; +// COMMENT: {4/1/2010 5:52:55 PM} } +// COMMENT: {4/1/2010 5:52:55 PM} } +// COMMENT: {4/1/2010 5:52:55 PM} return retval; +// COMMENT: {4/1/2010 5:52:55 PM}} +// COMMENT: {4/1/2010 5:52:55 PM} +// COMMENT: {4/1/2010 5:52:55 PM}IPhreeqc* +// COMMENT: {4/1/2010 5:52:55 PM}IPhreeqc::GetInstance(int n) +// COMMENT: {4/1/2010 5:52:55 PM}{ +// COMMENT: {4/1/2010 5:52:55 PM} std::map::iterator it = IPhreeqc::Instances.find(size_t(n)); +// COMMENT: {4/1/2010 5:52:55 PM} if (it != IPhreeqc::Instances.end()) +// COMMENT: {4/1/2010 5:52:55 PM} { +// COMMENT: {4/1/2010 5:52:55 PM} return (*it).second; +// COMMENT: {4/1/2010 5:52:55 PM} } +// COMMENT: {4/1/2010 5:52:55 PM} return 0; +// COMMENT: {4/1/2010 5:52:55 PM}} // the library singleton IPhreeqc* IPhreeqc::Instance = 0; @@ -367,22 +404,25 @@ int IPhreeqc::LoadDatabase(const char* filename) // open file // - FILE* f = fopen(filename, "r"); - if (!f) + std::ifstream ifs; + ifs.open(filename); + + if (!ifs.is_open()) { std::ostringstream oss; oss << "LoadDatabase: Unable to open:" << "\"" << filename << "\"."; - this->error_msg(oss.str().c_str(), STOP); // throws PhreeqcStop + this->error_msg(oss.str().c_str(), STOP); // throws } // read input // - this->read_database(getc_callback, f); - + this->read_database(istream_getc, &ifs); } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } catch (...) { @@ -393,10 +433,17 @@ int IPhreeqc::LoadDatabase(const char* filename) } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } } +#if defined(_WIN32) + int n = ::_fcloseall(); + assert(n == 0); +#endif + this->DatabaseLoaded = (this->input_error == 0); return this->input_error; } @@ -420,7 +467,9 @@ int IPhreeqc::LoadDatabaseString(const char* input) } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } catch(...) { @@ -431,7 +480,9 @@ int IPhreeqc::LoadDatabaseString(const char* input) } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } } @@ -914,486 +965,486 @@ int IPhreeqc::open_handler(const int type, const char *file_name) return n; } -void IPhreeqc::init(void) -{ - int i; - - moles_per_kilogram_string = 0; - pe_string = 0; - - debug_model = FALSE; - debug_prep = FALSE; - debug_set = FALSE; - debug_diffuse_layer = FALSE; - debug_inverse = FALSE; - itmax = 100; -#ifdef USE_LONG_DOUBLE - /* from float.h, sets tolerance for cl1 routine */ - ineq_tol = pow((long double) 10, (long double) -LDBL_DIG); -#else - ineq_tol = pow((double) 10, (double) -DBL_DIG); -#endif - convergence_tolerance = 1e-8; -#ifdef USE_LONG_DOUBLE - /* from float.h, sets tolerance for cl1 routine */ - inv_tol_default = pow((long double) 10, (long double) -LDBL_DIG + 5); -#else - inv_tol_default = pow((double) 10, (double) -DBL_DIG + 5); -#endif - step_size = 100.; - pe_step_size = 10.; - pp_scale = 1.0; - pp_column_scale = 1.0; - diagonal_scale = FALSE; - censor = 0.0; - mass_water_switch = FALSE; - delay_mass_water = FALSE; - incremental_reactions = FALSE; - aqueous_only = 0; - negative_concentrations = FALSE; - - LOG_10 = log(10.0); - - max_solution = MAX_SOLUTION; - max_pp_assemblage = MAX_PP_ASSEMBLAGE; - max_exchange = MAX_PP_ASSEMBLAGE; - max_surface = MAX_PP_ASSEMBLAGE; - max_gas_phase = MAX_PP_ASSEMBLAGE; - max_kinetics = MAX_PP_ASSEMBLAGE; - max_s_s_assemblage = MAX_PP_ASSEMBLAGE; - - max_elements = MAX_ELEMENTS; - max_elts = MAX_ELTS; - max_line = MAX_LINE; - max_master = MAX_MASTER; - max_mb_unknowns = MAX_TRXN; - max_phases = MAX_PHASES; - max_s = MAX_S; - max_strings = MAX_STRINGS; - max_trxn = MAX_TRXN; - max_logk = MAX_S; - max_master_isotope = MAX_ELTS; - - count_solution = 0; - count_pp_assemblage = 0; - count_exchange = 0; - count_surface = 0; - count_gas_phase = 0; - count_kinetics = 0; - count_s_s_assemblage = 0; - - count_elements = 0; - count_irrev = 0; - count_master = 0; - count_mix = 0; - count_phases = 0; - count_s = 0; - count_temperature = 0; - count_logk = 0; - count_master_isotope = 0; -/* - * Initialize advection - */ - count_ad_cells = 1; - count_ad_shifts = 1; - print_ad_modulus = 1; - punch_ad_modulus = 1; - - advection_punch = 0; - advection_kin_time = 0.0; - advection_kin_time_defined = FALSE; - advection_print = 0; - advection_warnings = TRUE; -/* - * Initialize transport - */ - count_cells = 1; - count_shifts = 1; - ishift = 1; - bcon_first = bcon_last = 3; - diffc = 0.3e-9; - simul_tr = 0; - tempr = 2.0; - heat_diffc = -0.1; - timest = 0.0; - multi_Dflag = FALSE; - interlayer_Dflag = FALSE; - interlayer_tortf = 100.0; - interlayer_Dpor = 0.1; -/* !!!! count_stag = 0; */ - mcd_substeps = 1.0; - print_modulus = 1; - punch_modulus = 1; - dump_modulus = 0; - dump_in = FALSE; - transport_warnings = TRUE; - - pp_assemblage = 0; - exchange = 0; - surface = 0; - gas_phase = 0; - kinetics = 0; - s_s_assemblage = 0; - cell_data = 0; - elements = 0; - elt_list = 0; - - - inverse = 0; - count_inverse = 0; - - irrev = 0; - - line = 0; - line_save = 0; - - master = 0; - - mb_unknowns = 0; - - mix = 0; - count_mix = 0; -/* !!!! */ - stag_data = 0; - - phases = 0; - - trxn.token = 0; - - s = 0; - - logk = 0; - - master_isotope = 0; - - solution = 0; - - temperature = 0; - - title_x = NULL; - pe_x = NULL; - description_x = NULL; - units_x = NULL; - s_x = NULL; - - sum_mb1 = NULL; - sum_mb2 = NULL; - sum_jacob0 = NULL; - sum_jacob1 = NULL; - sum_jacob2 = NULL; - sum_delta = NULL; - - isotopes_x = 0; - - x = NULL; - max_unknowns = 0; - - array = NULL; - delta = NULL; - residual = NULL; - s_h2o = NULL; - s_hplus = NULL; - s_h3oplus = NULL; - s_eminus = NULL; - s_co3 = NULL; - s_h2 = NULL; - s_o2 = NULL; - - logk_hash_table = 0; - master_isotope_hash_table = 0; - strings_hash_table = 0; - elements_hash_table = 0; - species_hash_table = 0; - phases_hash_table = 0; - keyword_hash_table = 0; -/* - * Initialize use pointers - */ - use.solution_in = FALSE; - use.pp_assemblage_in = FALSE; - use.mix_in = FALSE; - use.irrev_in = FALSE; -/* - * Initialize punch - */ - punch.in = FALSE; - punch.count_totals = 0; - punch.totals = 0; - punch.count_molalities = 0; - - punch.molalities = 0; - punch.count_activities = 0; - - punch.activities = 0; - punch.count_pure_phases = 0; - - punch.pure_phases = 0; - punch.count_si = 0; - - punch.si = 0; - punch.count_gases = 0; - - punch.gases = 0; - punch.count_s_s = 0; - punch.s_s = 0; - - punch.count_kinetics = 0; - punch.kinetics = 0; - - punch.count_isotopes = 0; - punch.isotopes = 0; - - punch.count_calculate_values = 0; - punch.calculate_values = 0; - - count_save_values = 0; - save_values = 0; - - - punch.inverse = TRUE; - - punch.sim = TRUE; - punch.state = TRUE; - punch.soln = TRUE; - punch.dist = TRUE; - punch.time = TRUE; - punch.step = TRUE; - punch.rxn = FALSE; - punch.temp = FALSE; - punch.ph = TRUE; - punch.pe = TRUE; - punch.alk = FALSE; - punch.mu = FALSE; - punch.water = FALSE; - punch.high_precision = FALSE; - punch.user_punch = TRUE; - punch.charge_balance = FALSE; - punch.percent_error = FALSE; -/* - * last model - */ - last_model.exchange = NULL; - last_model.gas_phase = NULL; - last_model.s_s_assemblage = NULL; - last_model.kinetics = NULL; - last_model.pp_assemblage = NULL; - last_model.add_formula = NULL; - last_model.si = NULL; - last_model.surface_comp = NULL; - last_model.surface_charge = NULL; -/* - * Update hash table - */ - keyword_hash = 0; -/* - * rates - */ - rates = 0; - count_rates = 0; - initial_total_time = 0; - rate_m = 0; - rate_m0 = 0; - rate_p = NULL; - rate_time = 0; - rate_sim_time_start = 0; - rate_sim_time_end = 0; - rate_sim_time = 0; - rate_moles = 0; - initial_total_time = 0; - -/* - * user_print, user_punch - */ - user_print = 0; - user_punch = 0; - user_punch_headings = 0; - user_punch_count_headings = 0; -#ifdef PHREEQ98 -/* - * user_graph - */ - user_graph = 0; - user_graph_headings = 0 - user_graph_count_headings = 0; -#endif - /* - Initialize llnl aqueous model parameters - */ - llnl_temp = 0; - llnl_count_temp = 0; - - llnl_adh = 0; - llnl_count_adh = 0; - - llnl_bdh = 0; - llnl_count_bdh = 0; - - llnl_bdot = 0; - llnl_count_bdot = 0; - - llnl_co2_coefs = 0; - llnl_count_co2_coefs = 0; -/* - * - */ - command_hash_table = 0; - - change_surf = 0; - change_surf_count = 0; - - -#if defined(WINDOWS) || defined(_WINDOWS) - /* SRC pr.status = FALSE; */ -#endif - /* Initialize print here, not in global.h */ - pr.all = TRUE; - pr.initial_solutions = TRUE; - pr.initial_exchangers = TRUE; - pr.reactions = TRUE; - pr.gas_phase = TRUE; - pr.s_s_assemblage = TRUE; - pr.pp_assemblage = TRUE; - pr.surface = TRUE; - pr.exchange = TRUE; - pr.kinetics = TRUE; - pr.totals = TRUE; - pr.eh = TRUE; - pr.species = TRUE; - pr.saturation_indices = TRUE; - pr.irrev = TRUE; - pr.mix = TRUE; - pr.reaction = TRUE; - pr.use = TRUE; - pr.logfile = FALSE; - pr.punch = TRUE; - if (phast == TRUE) - { - pr.status = FALSE; - } - else - { - pr.status = TRUE; - } - pr.inverse = TRUE; - pr.dump = TRUE; - pr.user_print = TRUE; - pr.headings = TRUE; - pr.user_graph = TRUE; - pr.echo_input = TRUE; - count_warnings = 0; - pr.warnings = 100; - pr.initial_isotopes = TRUE; - pr.isotope_ratios = TRUE; - pr.isotope_alphas = TRUE; - pr.hdf = FALSE; - pr.alkalinity = FALSE; - - species_list = NULL; - - user_database = NULL; - first_read_input = TRUE; - have_punch_name = FALSE; - selected_output_file_name = NULL; - dump_file_name = NULL; - - /* calculate_value */ - max_calculate_value = MAX_ELTS; - count_calculate_value = 0; - - calculate_value = 0; - calculate_value_hash_table = 0; - - /* isotope_ratio */ - max_isotope_ratio = MAX_ELTS; - count_isotope_ratio = 0; - isotope_ratio = 0; - isotope_ratio_hash_table = 0; - - /* isotope_value */ - max_isotope_alpha = MAX_ELTS; - count_isotope_alpha = 0; - isotope_alpha = 0; - isotope_alpha_hash_table = 0; - - phreeqc_mpi_myself = 0; - - copy_solution.n_user = copy_solution.start = copy_solution.end = 0; - copy_pp_assemblage.n_user = copy_pp_assemblage.start = copy_pp_assemblage.end = 0; - copy_exchange.n_user = copy_exchange.start = copy_exchange.end = 0; - copy_surface.n_user = copy_surface.start = copy_surface.end = 0; - copy_s_s_assemblage.n_user = copy_s_s_assemblage.start = copy_s_s_assemblage.end = 0; - copy_gas_phase.n_user = copy_gas_phase.start = copy_gas_phase.end = 0; - copy_kinetics.n_user = copy_kinetics.start = copy_kinetics.end = 0; - copy_mix.n_user = copy_mix.start = copy_mix.end = 0; - copy_irrev.n_user = copy_irrev.start = copy_irrev.end = 0; - copy_temperature.n_user = copy_temperature.start = copy_temperature.end = 0; - - set_forward_output_to_log(FALSE); - simulation = 0; - /* - * cvode - */ - - cvode_init(); - /* - * Pitzer - */ - pitzer_model = FALSE; - max_pitz_param = 100; - count_pitz_param = 0; - use_etheta = TRUE; - pitz_params = 0; - - max_theta_param = 100; - count_theta_param = 0; - theta_params = 0; - - ICON = TRUE; - OTEMP = 0.0; - for (i = 0; i < 23; i++) - { - BK[i] = 0.0; - DK[i] = 0.0; - } - pitzer_pe = FALSE; - - - /* - * SIT - */ - sit_model = FALSE; - max_sit_param = 100; - count_sit_param = 0; - sit_params = 0; - - /* - * to facilitate debuging - */ - dbg_use = &use; - dbg_solution = solution; - dbg_exchange = exchange; - dbg_surface = surface; - dbg_pp_assemblage = pp_assemblage; - dbg_kinetics = kinetics; - dbg_irrev = irrev; - dbg_mix = mix; - dbg_master = master; - calculating_deriv = FALSE; - numerical_deriv = FALSE; - - zeros = 0; - zeros_max = 1; - - cell_pore_volume = 0; - cell_volume = 0; - cell_porosity = 0; - cell_saturation = 0; - - charge_group = NULL; - print_density = 0; - - return; -} +// COMMENT: {3/25/2010 2:37:25 PM}void IPhreeqc::init(void) +// COMMENT: {3/25/2010 2:37:25 PM}{ +// COMMENT: {3/25/2010 2:37:25 PM} int i; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} moles_per_kilogram_string = 0; +// COMMENT: {3/25/2010 2:37:25 PM} pe_string = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} debug_model = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} debug_prep = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} debug_set = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} debug_diffuse_layer = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} debug_inverse = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} itmax = 100; +// COMMENT: {3/25/2010 2:37:25 PM}#ifdef USE_LONG_DOUBLE +// COMMENT: {3/25/2010 2:37:25 PM} /* from float.h, sets tolerance for cl1 routine */ +// COMMENT: {3/25/2010 2:37:25 PM} ineq_tol = pow((long double) 10, (long double) -LDBL_DIG); +// COMMENT: {3/25/2010 2:37:25 PM}#else +// COMMENT: {3/25/2010 2:37:25 PM} ineq_tol = pow((double) 10, (double) -DBL_DIG); +// COMMENT: {3/25/2010 2:37:25 PM}#endif +// COMMENT: {3/25/2010 2:37:25 PM} convergence_tolerance = 1e-8; +// COMMENT: {3/25/2010 2:37:25 PM}#ifdef USE_LONG_DOUBLE +// COMMENT: {3/25/2010 2:37:25 PM} /* from float.h, sets tolerance for cl1 routine */ +// COMMENT: {3/25/2010 2:37:25 PM} inv_tol_default = pow((long double) 10, (long double) -LDBL_DIG + 5); +// COMMENT: {3/25/2010 2:37:25 PM}#else +// COMMENT: {3/25/2010 2:37:25 PM} inv_tol_default = pow((double) 10, (double) -DBL_DIG + 5); +// COMMENT: {3/25/2010 2:37:25 PM}#endif +// COMMENT: {3/25/2010 2:37:25 PM} step_size = 100.; +// COMMENT: {3/25/2010 2:37:25 PM} pe_step_size = 10.; +// COMMENT: {3/25/2010 2:37:25 PM} pp_scale = 1.0; +// COMMENT: {3/25/2010 2:37:25 PM} pp_column_scale = 1.0; +// COMMENT: {3/25/2010 2:37:25 PM} diagonal_scale = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} censor = 0.0; +// COMMENT: {3/25/2010 2:37:25 PM} mass_water_switch = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} delay_mass_water = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} incremental_reactions = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} aqueous_only = 0; +// COMMENT: {3/25/2010 2:37:25 PM} negative_concentrations = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} LOG_10 = log(10.0); +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} max_solution = MAX_SOLUTION; +// COMMENT: {3/25/2010 2:37:25 PM} max_pp_assemblage = MAX_PP_ASSEMBLAGE; +// COMMENT: {3/25/2010 2:37:25 PM} max_exchange = MAX_PP_ASSEMBLAGE; +// COMMENT: {3/25/2010 2:37:25 PM} max_surface = MAX_PP_ASSEMBLAGE; +// COMMENT: {3/25/2010 2:37:25 PM} max_gas_phase = MAX_PP_ASSEMBLAGE; +// COMMENT: {3/25/2010 2:37:25 PM} max_kinetics = MAX_PP_ASSEMBLAGE; +// COMMENT: {3/25/2010 2:37:25 PM} max_s_s_assemblage = MAX_PP_ASSEMBLAGE; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} max_elements = MAX_ELEMENTS; +// COMMENT: {3/25/2010 2:37:25 PM} max_elts = MAX_ELTS; +// COMMENT: {3/25/2010 2:37:25 PM} max_line = MAX_LINE; +// COMMENT: {3/25/2010 2:37:25 PM} max_master = MAX_MASTER; +// COMMENT: {3/25/2010 2:37:25 PM} max_mb_unknowns = MAX_TRXN; +// COMMENT: {3/25/2010 2:37:25 PM} max_phases = MAX_PHASES; +// COMMENT: {3/25/2010 2:37:25 PM} max_s = MAX_S; +// COMMENT: {3/25/2010 2:37:25 PM} max_strings = MAX_STRINGS; +// COMMENT: {3/25/2010 2:37:25 PM} max_trxn = MAX_TRXN; +// COMMENT: {3/25/2010 2:37:25 PM} max_logk = MAX_S; +// COMMENT: {3/25/2010 2:37:25 PM} max_master_isotope = MAX_ELTS; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} count_solution = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_pp_assemblage = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_exchange = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_surface = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_gas_phase = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_kinetics = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_s_s_assemblage = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} count_elements = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_irrev = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_master = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_mix = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_phases = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_s = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_temperature = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_logk = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_master_isotope = 0; +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * Initialize advection +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} count_ad_cells = 1; +// COMMENT: {3/25/2010 2:37:25 PM} count_ad_shifts = 1; +// COMMENT: {3/25/2010 2:37:25 PM} print_ad_modulus = 1; +// COMMENT: {3/25/2010 2:37:25 PM} punch_ad_modulus = 1; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} advection_punch = 0; +// COMMENT: {3/25/2010 2:37:25 PM} advection_kin_time = 0.0; +// COMMENT: {3/25/2010 2:37:25 PM} advection_kin_time_defined = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} advection_print = 0; +// COMMENT: {3/25/2010 2:37:25 PM} advection_warnings = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * Initialize transport +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} count_cells = 1; +// COMMENT: {3/25/2010 2:37:25 PM} count_shifts = 1; +// COMMENT: {3/25/2010 2:37:25 PM} ishift = 1; +// COMMENT: {3/25/2010 2:37:25 PM} bcon_first = bcon_last = 3; +// COMMENT: {3/25/2010 2:37:25 PM} diffc = 0.3e-9; +// COMMENT: {3/25/2010 2:37:25 PM} simul_tr = 0; +// COMMENT: {3/25/2010 2:37:25 PM} tempr = 2.0; +// COMMENT: {3/25/2010 2:37:25 PM} heat_diffc = -0.1; +// COMMENT: {3/25/2010 2:37:25 PM} timest = 0.0; +// COMMENT: {3/25/2010 2:37:25 PM} multi_Dflag = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} interlayer_Dflag = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} interlayer_tortf = 100.0; +// COMMENT: {3/25/2010 2:37:25 PM} interlayer_Dpor = 0.1; +// COMMENT: {3/25/2010 2:37:25 PM}/* !!!! count_stag = 0; */ +// COMMENT: {3/25/2010 2:37:25 PM} mcd_substeps = 1.0; +// COMMENT: {3/25/2010 2:37:25 PM} print_modulus = 1; +// COMMENT: {3/25/2010 2:37:25 PM} punch_modulus = 1; +// COMMENT: {3/25/2010 2:37:25 PM} dump_modulus = 0; +// COMMENT: {3/25/2010 2:37:25 PM} dump_in = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} transport_warnings = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} pp_assemblage = 0; +// COMMENT: {3/25/2010 2:37:25 PM} exchange = 0; +// COMMENT: {3/25/2010 2:37:25 PM} surface = 0; +// COMMENT: {3/25/2010 2:37:25 PM} gas_phase = 0; +// COMMENT: {3/25/2010 2:37:25 PM} kinetics = 0; +// COMMENT: {3/25/2010 2:37:25 PM} s_s_assemblage = 0; +// COMMENT: {3/25/2010 2:37:25 PM} cell_data = 0; +// COMMENT: {3/25/2010 2:37:25 PM} elements = 0; +// COMMENT: {3/25/2010 2:37:25 PM} elt_list = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} inverse = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_inverse = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} irrev = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} line = 0; +// COMMENT: {3/25/2010 2:37:25 PM} line_save = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} master = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} mb_unknowns = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} mix = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_mix = 0; +// COMMENT: {3/25/2010 2:37:25 PM}/* !!!! */ +// COMMENT: {3/25/2010 2:37:25 PM} stag_data = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} phases = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} trxn.token = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} s = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} logk = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} master_isotope = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} solution = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} temperature = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} title_x = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} pe_x = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} description_x = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} units_x = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} s_x = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} sum_mb1 = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} sum_mb2 = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} sum_jacob0 = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} sum_jacob1 = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} sum_jacob2 = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} sum_delta = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} isotopes_x = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} x = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} max_unknowns = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} array = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} delta = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} residual = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} s_h2o = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} s_hplus = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} s_h3oplus = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} s_eminus = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} s_co3 = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} s_h2 = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} s_o2 = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} logk_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} master_isotope_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} strings_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} elements_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} species_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} phases_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} keyword_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * Initialize use pointers +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} use.solution_in = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} use.pp_assemblage_in = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} use.mix_in = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} use.irrev_in = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * Initialize punch +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} punch.in = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_totals = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.totals = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_molalities = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.molalities = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_activities = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.activities = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_pure_phases = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.pure_phases = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_si = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.si = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_gases = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.gases = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_s_s = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.s_s = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_kinetics = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.kinetics = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_isotopes = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.isotopes = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.count_calculate_values = 0; +// COMMENT: {3/25/2010 2:37:25 PM} punch.calculate_values = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} count_save_values = 0; +// COMMENT: {3/25/2010 2:37:25 PM} save_values = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.inverse = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} punch.sim = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.state = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.soln = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.dist = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.time = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.step = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.rxn = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.temp = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.ph = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.pe = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.alk = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.mu = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.water = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.high_precision = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.user_punch = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.charge_balance = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} punch.percent_error = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * last model +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} last_model.exchange = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} last_model.gas_phase = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} last_model.s_s_assemblage = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} last_model.kinetics = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} last_model.pp_assemblage = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} last_model.add_formula = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} last_model.si = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} last_model.surface_comp = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} last_model.surface_charge = NULL; +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * Update hash table +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} keyword_hash = 0; +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * rates +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} rates = 0; +// COMMENT: {3/25/2010 2:37:25 PM} count_rates = 0; +// COMMENT: {3/25/2010 2:37:25 PM} initial_total_time = 0; +// COMMENT: {3/25/2010 2:37:25 PM} rate_m = 0; +// COMMENT: {3/25/2010 2:37:25 PM} rate_m0 = 0; +// COMMENT: {3/25/2010 2:37:25 PM} rate_p = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} rate_time = 0; +// COMMENT: {3/25/2010 2:37:25 PM} rate_sim_time_start = 0; +// COMMENT: {3/25/2010 2:37:25 PM} rate_sim_time_end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} rate_sim_time = 0; +// COMMENT: {3/25/2010 2:37:25 PM} rate_moles = 0; +// COMMENT: {3/25/2010 2:37:25 PM} initial_total_time = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * user_print, user_punch +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} user_print = 0; +// COMMENT: {3/25/2010 2:37:25 PM} user_punch = 0; +// COMMENT: {3/25/2010 2:37:25 PM} user_punch_headings = 0; +// COMMENT: {3/25/2010 2:37:25 PM} user_punch_count_headings = 0; +// COMMENT: {3/25/2010 2:37:25 PM}#ifdef PHREEQ98 +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * user_graph +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} user_graph = 0; +// COMMENT: {3/25/2010 2:37:25 PM} user_graph_headings = 0 +// COMMENT: {3/25/2010 2:37:25 PM} user_graph_count_headings = 0; +// COMMENT: {3/25/2010 2:37:25 PM}#endif +// COMMENT: {3/25/2010 2:37:25 PM} /* +// COMMENT: {3/25/2010 2:37:25 PM} Initialize llnl aqueous model parameters +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} llnl_temp = 0; +// COMMENT: {3/25/2010 2:37:25 PM} llnl_count_temp = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} llnl_adh = 0; +// COMMENT: {3/25/2010 2:37:25 PM} llnl_count_adh = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} llnl_bdh = 0; +// COMMENT: {3/25/2010 2:37:25 PM} llnl_count_bdh = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} llnl_bdot = 0; +// COMMENT: {3/25/2010 2:37:25 PM} llnl_count_bdot = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} llnl_co2_coefs = 0; +// COMMENT: {3/25/2010 2:37:25 PM} llnl_count_co2_coefs = 0; +// COMMENT: {3/25/2010 2:37:25 PM}/* +// COMMENT: {3/25/2010 2:37:25 PM} * +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} command_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} change_surf = 0; +// COMMENT: {3/25/2010 2:37:25 PM} change_surf_count = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM}#if defined(WINDOWS) || defined(_WINDOWS) +// COMMENT: {3/25/2010 2:37:25 PM} /* SRC pr.status = FALSE; */ +// COMMENT: {3/25/2010 2:37:25 PM}#endif +// COMMENT: {3/25/2010 2:37:25 PM} /* Initialize print here, not in global.h */ +// COMMENT: {3/25/2010 2:37:25 PM} pr.all = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.initial_solutions = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.initial_exchangers = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.reactions = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.gas_phase = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.s_s_assemblage = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.pp_assemblage = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.surface = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.exchange = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.kinetics = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.totals = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.eh = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.species = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.saturation_indices = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.irrev = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.mix = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.reaction = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.use = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.logfile = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.punch = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} if (phast == TRUE) +// COMMENT: {3/25/2010 2:37:25 PM} { +// COMMENT: {3/25/2010 2:37:25 PM} pr.status = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} } +// COMMENT: {3/25/2010 2:37:25 PM} else +// COMMENT: {3/25/2010 2:37:25 PM} { +// COMMENT: {3/25/2010 2:37:25 PM} pr.status = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} } +// COMMENT: {3/25/2010 2:37:25 PM} pr.inverse = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.dump = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.user_print = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.headings = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.user_graph = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.echo_input = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} count_warnings = 0; +// COMMENT: {3/25/2010 2:37:25 PM} pr.warnings = 100; +// COMMENT: {3/25/2010 2:37:25 PM} pr.initial_isotopes = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.isotope_ratios = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.isotope_alphas = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.hdf = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} pr.alkalinity = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} species_list = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} user_database = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} first_read_input = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} have_punch_name = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} selected_output_file_name = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} dump_file_name = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} /* calculate_value */ +// COMMENT: {3/25/2010 2:37:25 PM} max_calculate_value = MAX_ELTS; +// COMMENT: {3/25/2010 2:37:25 PM} count_calculate_value = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} calculate_value = 0; +// COMMENT: {3/25/2010 2:37:25 PM} calculate_value_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} /* isotope_ratio */ +// COMMENT: {3/25/2010 2:37:25 PM} max_isotope_ratio = MAX_ELTS; +// COMMENT: {3/25/2010 2:37:25 PM} count_isotope_ratio = 0; +// COMMENT: {3/25/2010 2:37:25 PM} isotope_ratio = 0; +// COMMENT: {3/25/2010 2:37:25 PM} isotope_ratio_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} /* isotope_value */ +// COMMENT: {3/25/2010 2:37:25 PM} max_isotope_alpha = MAX_ELTS; +// COMMENT: {3/25/2010 2:37:25 PM} count_isotope_alpha = 0; +// COMMENT: {3/25/2010 2:37:25 PM} isotope_alpha = 0; +// COMMENT: {3/25/2010 2:37:25 PM} isotope_alpha_hash_table = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} phreeqc_mpi_myself = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} copy_solution.n_user = copy_solution.start = copy_solution.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} copy_pp_assemblage.n_user = copy_pp_assemblage.start = copy_pp_assemblage.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} copy_exchange.n_user = copy_exchange.start = copy_exchange.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} copy_surface.n_user = copy_surface.start = copy_surface.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} copy_s_s_assemblage.n_user = copy_s_s_assemblage.start = copy_s_s_assemblage.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} copy_gas_phase.n_user = copy_gas_phase.start = copy_gas_phase.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} copy_kinetics.n_user = copy_kinetics.start = copy_kinetics.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} copy_mix.n_user = copy_mix.start = copy_mix.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} copy_irrev.n_user = copy_irrev.start = copy_irrev.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} copy_temperature.n_user = copy_temperature.start = copy_temperature.end = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} set_forward_output_to_log(FALSE); +// COMMENT: {3/25/2010 2:37:25 PM} simulation = 0; +// COMMENT: {3/25/2010 2:37:25 PM} /* +// COMMENT: {3/25/2010 2:37:25 PM} * cvode +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} cvode_init(); +// COMMENT: {3/25/2010 2:37:25 PM} /* +// COMMENT: {3/25/2010 2:37:25 PM} * Pitzer +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} pitzer_model = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} max_pitz_param = 100; +// COMMENT: {3/25/2010 2:37:25 PM} count_pitz_param = 0; +// COMMENT: {3/25/2010 2:37:25 PM} use_etheta = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} pitz_params = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} max_theta_param = 100; +// COMMENT: {3/25/2010 2:37:25 PM} count_theta_param = 0; +// COMMENT: {3/25/2010 2:37:25 PM} theta_params = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} ICON = TRUE; +// COMMENT: {3/25/2010 2:37:25 PM} OTEMP = 0.0; +// COMMENT: {3/25/2010 2:37:25 PM} for (i = 0; i < 23; i++) +// COMMENT: {3/25/2010 2:37:25 PM} { +// COMMENT: {3/25/2010 2:37:25 PM} BK[i] = 0.0; +// COMMENT: {3/25/2010 2:37:25 PM} DK[i] = 0.0; +// COMMENT: {3/25/2010 2:37:25 PM} } +// COMMENT: {3/25/2010 2:37:25 PM} pitzer_pe = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} /* +// COMMENT: {3/25/2010 2:37:25 PM} * SIT +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} sit_model = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} max_sit_param = 100; +// COMMENT: {3/25/2010 2:37:25 PM} count_sit_param = 0; +// COMMENT: {3/25/2010 2:37:25 PM} sit_params = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} /* +// COMMENT: {3/25/2010 2:37:25 PM} * to facilitate debuging +// COMMENT: {3/25/2010 2:37:25 PM} */ +// COMMENT: {3/25/2010 2:37:25 PM} dbg_use = &use; +// COMMENT: {3/25/2010 2:37:25 PM} dbg_solution = solution; +// COMMENT: {3/25/2010 2:37:25 PM} dbg_exchange = exchange; +// COMMENT: {3/25/2010 2:37:25 PM} dbg_surface = surface; +// COMMENT: {3/25/2010 2:37:25 PM} dbg_pp_assemblage = pp_assemblage; +// COMMENT: {3/25/2010 2:37:25 PM} dbg_kinetics = kinetics; +// COMMENT: {3/25/2010 2:37:25 PM} dbg_irrev = irrev; +// COMMENT: {3/25/2010 2:37:25 PM} dbg_mix = mix; +// COMMENT: {3/25/2010 2:37:25 PM} dbg_master = master; +// COMMENT: {3/25/2010 2:37:25 PM} calculating_deriv = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} numerical_deriv = FALSE; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} zeros = 0; +// COMMENT: {3/25/2010 2:37:25 PM} zeros_max = 1; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} cell_pore_volume = 0; +// COMMENT: {3/25/2010 2:37:25 PM} cell_volume = 0; +// COMMENT: {3/25/2010 2:37:25 PM} cell_porosity = 0; +// COMMENT: {3/25/2010 2:37:25 PM} cell_saturation = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} charge_group = NULL; +// COMMENT: {3/25/2010 2:37:25 PM} print_density = 0; +// COMMENT: {3/25/2010 2:37:25 PM} +// COMMENT: {3/25/2010 2:37:25 PM} return; +// COMMENT: {3/25/2010 2:37:25 PM}} bool IPhreeqc::GetOutputOn(void)const { @@ -1664,7 +1715,9 @@ int IPhreeqc::RunAccumulated(void) } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } catch(...) { @@ -1675,7 +1728,9 @@ int IPhreeqc::RunAccumulated(void) } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } } @@ -1696,8 +1751,8 @@ int IPhreeqc::RunFile(const char* filename) this->input_error = 0; -#if 0 - // create input stream + // open file + // std::ifstream ifs; ifs.open(filename); if (!ifs.is_open()) @@ -1709,24 +1764,12 @@ int IPhreeqc::RunFile(const char* filename) // this may throw this->do_run(sz_routine, &ifs, NULL, NULL, NULL, NULL); -#else - // open file - // - FILE* f = ::fopen(filename, "r"); - if (!f) - { - std::ostringstream oss; - oss << "RunFile: Unable to open:" << "\"" << filename << "\"."; - this->error_msg(oss.str().c_str(), STOP); // throws PhreeqcStop - } - - // this may throw - this->do_run(sz_routine, NULL, f, NULL, NULL, NULL); -#endif } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } catch(...) { @@ -1737,7 +1780,9 @@ int IPhreeqc::RunFile(const char* filename) } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } } @@ -1766,7 +1811,9 @@ int IPhreeqc::RunString(const char* input) } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } catch(...) { @@ -1777,7 +1824,9 @@ int IPhreeqc::RunString(const char* input) } catch (PhreeqcStop) { - // do nothing + assert(this->database_file == 0); + assert(this->input_file == 0); + assert(this->input_error > 0); } } diff --git a/src/IPhreeqc2.cpp b/src/IPhreeqc2.cpp new file mode 100644 index 00000000..232f36b1 --- /dev/null +++ b/src/IPhreeqc2.cpp @@ -0,0 +1,1257 @@ +#include "IPhreeqc2.h" + +// COMMENT: {3/25/2010 7:28:15 PM}#define protected public +#include "Phreeqc.h" /* Phreeqc */ +// COMMENT: {3/25/2010 7:28:18 PM}#undef protected + +#include +#include "ErrorReporter.hxx" +#include "SelectedOutput.hxx" +#include "dumper.h" + +int istream_getc(void *cookie); + + +typedef enum { + ACTION_ISOPEN = -100, +} module_action_type; + +const char OUTPUT_FILENAME[] = "phreeqc.out"; +const char ERROR_FILENAME[] = "phreeqc.err"; +const char LOG_FILENAME[] = "phreeqc.log"; +const char PUNCH_FILENAME[] = "selected.out"; + +IPhreeqc2::IPhreeqc2(void) +: ErrorReporter(0) +, WarningReporter(0) +, SelectedOutput(0) +, DatabaseLoaded(false) +, SelectedOutputOn(false) +, OutputOn(false) +, LogOn(false) +, ErrorOn(false) +, DumpOn(false) +, DumpStringOn(false) +, PhreeqcPtr(0) +{ + this->ErrorReporter = new CErrorReporter; + this->WarningReporter = new CErrorReporter; + this->SelectedOutput = new CSelectedOutput(); + this->PhreeqcPtr = new Phreeqc; + ASSERT(this->PhreeqcPtr->phast == 0); + this->UnLoadDatabase(); +} + +IPhreeqc2::~IPhreeqc2(void) +{ + delete this->PhreeqcPtr; +} + +int IPhreeqc2::handler2(const int action, const int type, const char *err_str, const int stop, void *cookie, const char *format, va_list args) +{ + int n = OK; + IPhreeqc2 *pThis = (IPhreeqc2*)cookie; + switch (action) + { + case Phreeqc::ACTION_OPEN: + n = pThis->open_handler2(type, err_str); + break; + + case Phreeqc::ACTION_OUTPUT: + n = pThis->output_handler2(type, err_str, stop, cookie, format, args); + break; + + default: + n = pThis->module_handler2(action, type, err_str, stop, cookie, format, args); + break; + } + + if (stop == STOP) + { + throw IPhreeqcStop(); + } + return n; +} + +int IPhreeqc2::output_handler2(const int type, const char *err_str, const int stop, void *cookie, const char *format, va_list args) +{ + assert(cookie == this); + + switch (type) + { + case Phreeqc::OUTPUT_ERROR: + if (this) + { + this->AddError("ERROR: "); + this->AddError(err_str); + this->AddError("\n"); + if (stop == STOP) + { + this->AddError("Stopping.\n"); + } + } + break; + + case Phreeqc::OUTPUT_WARNING: + if (this) + { + std::ostringstream oss; + oss << "WARNING: " << err_str << "\n"; + this->AddWarning(oss.str().c_str()); + } + break; + + case Phreeqc::OUTPUT_PUNCH: + this->AddSelectedOutput(err_str, format, args); + break; + + case Phreeqc::OUTPUT_PUNCH_END_ROW: + this->EndRow(); + break; + + } + return module_handler2(Phreeqc::ACTION_OUTPUT, type, err_str, stop, cookie, format, args); +} + +int IPhreeqc2::open_handler2(const int type, const char *file_name) +{ + int n = OK; + switch (type) + { + case Phreeqc::OUTPUT_PUNCH: + if (file_name) + { + if (this->PunchFileName.compare(file_name) != 0) + { + this->PunchFileName = file_name; + } + } + if (this->SelectedOutputOn) + { + n = module_handler2(Phreeqc::ACTION_OPEN, type, file_name, CONTINUE, this, NULL, NULL); + } + break; + default: + n = module_handler2(Phreeqc::ACTION_OPEN, type, file_name, CONTINUE, this, NULL, NULL); + break; + } + return n; +} + +int IPhreeqc2::module_handler2(const int action, const int type, const char *err_str, const int stop, void *cookie, const char *format, va_list args) +{ + IPhreeqc2* pThis = (IPhreeqc2*) cookie; + + switch (action) + { + case Phreeqc::ACTION_OPEN: + return pThis->module_open_handler2(type, err_str); + break; + case ACTION_ISOPEN: + return pThis->module_isopen_handler2(type); + break; + default: + return pThis->PhreeqcPtr->phreeqc_handler(action, type, err_str, stop, pThis->PhreeqcPtr, format, args); + break; + } + return ERROR; +} + +int IPhreeqc2::module_isopen_handler2(const int type) +{ + switch (type) + { + case Phreeqc::OUTPUT_PUNCH: + if (this->PhreeqcPtr->punch_file) return 1; + break; + default: + assert(0); + } + return 0; +} + +int IPhreeqc2::module_open_handler2(const int type, const char *file_name) +{ + assert(file_name && ::strlen(file_name)); + switch (type) + { + case Phreeqc::OUTPUT_MESSAGE: + if (this->PhreeqcPtr->output != NULL) + { + ::fclose(this->PhreeqcPtr->output); + this->PhreeqcPtr->output = NULL; + } + if ( (this->PhreeqcPtr->output = ::fopen(file_name, "w")) == NULL) + { + return ERROR; + } + break; + + case Phreeqc::OUTPUT_ERROR: + assert(this->PhreeqcPtr->error_file != stderr); + if (this->PhreeqcPtr->error_file != NULL) + { + ::fclose(this->PhreeqcPtr->error_file); + this->PhreeqcPtr->error_file = NULL; + } + if ( (this->PhreeqcPtr->error_file = ::fopen(file_name, "w")) == NULL) + { + return ERROR; + } + break; + + case Phreeqc::OUTPUT_LOG: + if (this->PhreeqcPtr->log_file != NULL) + { + ::fclose(this->PhreeqcPtr->log_file); + this->PhreeqcPtr->log_file = NULL; + } + if ( (this->PhreeqcPtr->log_file = ::fopen(file_name, "w")) == NULL) + { + return ERROR; + } + break; + + default: + return this->PhreeqcPtr->open_handler(type, file_name); + break; + + } + return(OK); +} + +int IPhreeqc2::output_isopen2(const int type) +{ + size_t i; + int isopen; + for (i = 0; i < this->PhreeqcPtr->count_output_callback; ++i) + { + isopen = (this->PhreeqcPtr->output_callbacks[i].callback)(ACTION_ISOPEN, type, NULL, CONTINUE, this->PhreeqcPtr->output_callbacks[i].cookie, NULL, NULL); + if (isopen) return 1; + } + return 0; +} + +// COMMENT: {3/25/2010 1:27:16 PM}int Phreeqc::EndRow(void) +// COMMENT: {3/25/2010 1:27:16 PM}{ +// COMMENT: {3/25/2010 1:27:16 PM} return OK; +// COMMENT: {3/25/2010 1:27:16 PM}} + +int IPhreeqc2::EndRow(void) +{ + if (this->SelectedOutput->GetRowCount() <= 1) + { + assert(this->PhreeqcPtr->n_user_punch_index >= 0); + // ensure all user_punch headings are included + for (int i = this->PhreeqcPtr->n_user_punch_index; i < this->PhreeqcPtr->user_punch_count_headings; ++i) + { + this->SelectedOutput->PushBackEmpty(this->PhreeqcPtr->user_punch_headings[i]); + } + } + return this->SelectedOutput->EndRow(); +} + +void IPhreeqc2::ClearAccumulatedLines(void) +{ + this->StringInput.erase(); +} + +size_t IPhreeqc2::AddError(const char* error_msg) +{ + return this->ErrorReporter->AddError(error_msg); +} + +size_t IPhreeqc2::AddWarning(const char* error_msg) +{ + return this->WarningReporter->AddError(error_msg); +} + +const std::string& IPhreeqc2::GetAccumulatedLines(void) +{ + return this->StringInput; +} + +void IPhreeqc2::OutputLines(void) +{ + std::cout << this->StringInput.c_str() << std::endl; +} + +int IPhreeqc2::LoadDatabase(const char* filename) +{ + try + { + // cleanup + // + this->UnLoadDatabase(); + this->SelectedOutput->Clear(); + + // open file + // + std::ifstream ifs; + ifs.open(filename); + + if (!ifs.is_open()) + { + std::ostringstream oss; + oss << "LoadDatabase: Unable to open:" << "\"" << filename << "\"."; + this->PhreeqcPtr->error_msg(oss.str().c_str(), STOP); // throws + } + + // read input + // + this->PhreeqcPtr->read_database(istream_getc, &ifs); + } + catch (IPhreeqcStop) + { + this->PhreeqcPtr->close_input_files(); + } + catch (...) + { + const char *errmsg = "LoadDatabase: An unhandled exception occured.\n"; + try + { + this->PhreeqcPtr->error_msg(errmsg, STOP); // throws IPhreeqcStop + } + catch (IPhreeqcStop) + { + // do nothing + } + } + + this->DatabaseLoaded = (this->PhreeqcPtr->input_error == 0); + return this->PhreeqcPtr->input_error; +} + +int IPhreeqc2::LoadDatabaseString(const char* input) +{ + try + { + // cleanup + // + this->UnLoadDatabase(); + + this->SelectedOutput->Clear(); + + std::string s(input); + std::istringstream iss(s); + + // read input + // + this->PhreeqcPtr->read_database(istream_getc, &iss); + } + catch (IPhreeqcStop) + { + this->PhreeqcPtr->close_input_files(); + } + catch(...) + { + const char *errmsg = "LoadDatabaseString: An unhandled exception occured.\n"; + try + { + this->PhreeqcPtr->error_msg(errmsg, STOP); // throws PhreeqcStop + } + catch (IPhreeqcStop) + { + // do nothing + } + } + + this->DatabaseLoaded = (this->PhreeqcPtr->input_error == 0); + return this->PhreeqcPtr->input_error; +} + +void IPhreeqc2::UnLoadDatabase(void) +{ + // init IPhreeqc + // + this->DatabaseLoaded = false; + + // clear error state + // + ASSERT(this->ErrorReporter); + this->ErrorReporter->Clear(); + this->LastErrorString.clear(); + + // clear warning state + // + ASSERT(this->WarningReporter); + this->WarningReporter->Clear(); + this->LastWarningString.clear(); + + // clear selectedoutput + // + ASSERT(this->SelectedOutput); + this->SelectedOutput->Clear(); + + // clear dump string + // + this->DumpString.clear(); + this->DumpLines.clear(); + + // initialize phreeqc + // + this->PhreeqcPtr->clean_up(); + this->PhreeqcPtr->add_output_callback(IPhreeqc2::handler2, this); + this->PhreeqcPtr->do_initialize(); + this->PhreeqcPtr->input_error = 0; +} + +bool IPhreeqc2::GetOutputOn(void)const +{ + return this->OutputOn; +} + +void IPhreeqc2::SetOutputOn(bool bValue) +{ + this->OutputOn = bValue; +} + +bool IPhreeqc2::GetSelectedOutputOn(void)const +{ + return this->SelectedOutputOn; +} + +void IPhreeqc2::SetSelectedOutputOn(bool bValue) +{ + this->SelectedOutputOn = bValue; +} + +bool IPhreeqc2::GetLogOn(void)const +{ + return this->LogOn; +} + +void IPhreeqc2::SetLogOn(bool bValue) +{ + this->LogOn = bValue; +} + +bool IPhreeqc2::GetDumpOn(void)const +{ + return this->DumpOn; +} + +void IPhreeqc2::SetDumpOn(bool bValue) +{ + this->DumpOn = bValue; +} + +bool IPhreeqc2::GetDumpStringOn(void)const +{ + return this->DumpStringOn; +} + +void IPhreeqc2::SetDumpStringOn(bool bValue) +{ + this->DumpStringOn = bValue; +} + +bool IPhreeqc2::GetErrorOn(void)const +{ + return this->ErrorOn; +} + +void IPhreeqc2::SetErrorOn(bool bValue) +{ + this->ErrorOn = bValue; +} + +void IPhreeqc2::AddSelectedOutput(const char* name, const char* format, va_list argptr) +{ + int bInt; + int bDouble; + int bString; + + int state; + int bLongDouble; + char ch; + + + /* state values + 0 Haven't found start(%) + 1 Just read start(%) + 2 Just read Flags(-0+ #) (zero or more) + 3 Just read Width + 4 Just read Precision start (.) + 5 Just read Size modifier + 6 Just read Type + */ + + if (name == NULL) { + return; + } + + bDouble = 0; + bInt = 0; + bString = 0; + + bLongDouble = 0; + + state = 0; + ch = *format++; + while (ch != '\0') + { + switch (state) + { + case 0: /* looking for Start specification (%) */ + switch (ch) + { + case '%': + state = 1; + break; + default: + break; + } + ch = *format++; + break; + case 1: /* reading Flags (zero or more(-,+,0,# or space)) */ + switch (ch) + { + case '-': case '0': case '+': case ' ': case '#': + ch = *format++; + break; + default: + state = 2; + break; + } + break; + case 2: /* reading Minimum field width (decimal integer constant) */ + switch (ch) + { + case '.': + state = 3; + ch = *format++; + break; + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + ch = *format++; + break; + default: + state = 4; + break; + } + break; + case 3: /* reading Precision specification (period already read) */ + switch (ch) + { + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': + ch = *format++; + break; + default: + state = 4; + break; + } + break; + case 4: /* reading Size modifier */ + switch (ch) + { + case 'l': + ch = *format++; + break; + case 'L': + bLongDouble = 1; + ch = *format++; + break; + case 'h': + ch = *format++; + break; + } + state = 5; + break; + case 5: /* reading Conversion letter */ + switch (ch) + { + case 'c': + break; + case 'd': + case 'i': + bInt = 1; + break; + case 'n': + case 'o': + case 'p': + break; + case 's': + bString = 1; + break; + case 'u': + case 'x': + case 'X': + case '%': + break; + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + bDouble = 1; + break; + default: + ASSERT(false); + break; + } + ch = '\0'; /* done */ + break; + } + } + + if (bDouble) + { + double valDouble; + + if (bLongDouble) + { + valDouble = (double)va_arg(argptr, long double); + } + else + { + valDouble = va_arg(argptr, double); + } + + this->SelectedOutput->PushBackDouble(name, valDouble); + } + else if (bInt) + { + int valInt; + valInt = va_arg(argptr, int); + + this->SelectedOutput->PushBackLong(name, (long)valInt); + } + else if (bString) + { + char* valString; + valString = (char *)va_arg(argptr, char *); + + this->SelectedOutput->PushBackString(name, valString); + } + else + { + ASSERT(false); + this->SelectedOutput->PushBackEmpty(name); + } +} + +const char* IPhreeqc2::GetLastErrorString(void) +{ + this->LastErrorString = ((CErrorReporter*)this->ErrorReporter)->GetOS()->str(); + return this->LastErrorString.c_str(); +} + +const char* IPhreeqc2::GetLastWarningString(void) +{ + this->LastWarningString = ((CErrorReporter*)this->WarningReporter)->GetOS()->str(); + return this->LastWarningString.c_str(); +} + +const char* IPhreeqc2::GetDumpString(void) +{ + return this->DumpString.c_str(); +} + + +void IPhreeqc2::check_database(const char* sz_routine) +{ + this->ErrorReporter->Clear(); + this->SelectedOutput->Clear(); + + if (!this->DatabaseLoaded) + { + std::ostringstream oss; + oss << sz_routine << ": No database is loaded"; + this->PhreeqcPtr->input_error = 1; + this->PhreeqcPtr->error_msg(oss.str().c_str(), STOP); // throws + } +} + +void IPhreeqc2::do_run(const char* sz_routine, std::istream* pis, FILE* fp, PFN_PRERUN_CALLBACK pfn_pre, PFN_POSTRUN_CALLBACK pfn_post, void *cookie) +{ + std::auto_ptr auto_iss(NULL); + char token[MAX_LENGTH]; + + if (this->OutputOn) + { + if (this->PhreeqcPtr->output_open(Phreeqc::OUTPUT_MESSAGE, OUTPUT_FILENAME) != OK) + { + std::ostringstream oss; + oss << sz_routine << ": Unable to open:" << "\"" << OUTPUT_FILENAME << "\".\n"; + this->PhreeqcPtr->warning_msg(oss.str().c_str()); + } + } + if (this->ErrorOn) + { + if (this->PhreeqcPtr->output_open(Phreeqc::OUTPUT_ERROR, ERROR_FILENAME) != OK) + { + std::ostringstream oss; + oss << sz_routine << ": Unable to open:" << "\"" << ERROR_FILENAME << "\".\n"; + this->PhreeqcPtr->warning_msg(oss.str().c_str()); + } + } + if (this->LogOn) + { + if (this->PhreeqcPtr->output_open(Phreeqc::OUTPUT_LOG, LOG_FILENAME) != OK) + { + std::ostringstream oss; + oss << sz_routine << ": Unable to open:" << "\"" << LOG_FILENAME << "\".\n"; + this->PhreeqcPtr->warning_msg(oss.str().c_str()); + } + } + +/* + * call pre-run callback + */ + if (pfn_pre) + { + pfn_pre(cookie); + } + +/* + * set read callback + */ + if (!pis) + { + if (fp) + { + this->PhreeqcPtr->set_read_callback(Phreeqc::getc_callback, fp, FALSE); + } + else + { + std::auto_ptr a_iss(new std::istringstream(this->GetAccumulatedLines())); + auto_iss = a_iss; + this->PhreeqcPtr->set_read_callback(istream_getc, auto_iss.get(), FALSE); + } + } + else + { + this->PhreeqcPtr->set_read_callback(istream_getc, pis, FALSE); + } + + +/* + * Read input data for simulation + */ + for (this->PhreeqcPtr->simulation = 1; ; this->PhreeqcPtr->simulation++) { + +#ifdef PHREEQ98 + AddSeries = !connect_simulations; +#endif + ::sprintf(token, "Reading input data for simulation %d.", this->PhreeqcPtr->simulation); + + this->PhreeqcPtr->output_msg(Phreeqc::OUTPUT_GUI_ERROR, "\nSimulation %d\n", this->PhreeqcPtr->simulation); + +#ifdef SWIG_SHARED_OBJ + int save_punch_in = this->PhreeqcPtr->punch.in; +#endif // SWIG_SHARED_OBJ + this->PhreeqcPtr->dup_print(token, TRUE); + if (this->PhreeqcPtr->read_input() == EOF) break; + +#ifdef SWIG_SHARED_OBJ + if (this->PhreeqcPtr->simulation > 1 && save_punch_in == TRUE && this->PhreeqcPtr->punch.new_def == TRUE) + { + std::ostringstream oss; + oss << sz_routine << ": Warning SELECTED_OUTPUT has been redefined.\n"; + this->PhreeqcPtr->warning_msg(oss.str().c_str()); + + } + if (this->PhreeqcPtr->simulation > 1 && this->PhreeqcPtr->keyword[39].keycount > 0) + { + std::ostringstream oss; + oss << sz_routine << ": Warning USER_PUNCH has been redefined.\n"; + this->PhreeqcPtr->warning_msg(oss.str().c_str()); + } +#endif // SWIG_SHARED_OBJ + + if (this->PhreeqcPtr->title_x != NULL) { + ::sprintf(token, "TITLE"); + this->PhreeqcPtr->dup_print(token, TRUE); + if (this->PhreeqcPtr->pr.headings == TRUE) this->PhreeqcPtr->output_msg(Phreeqc::OUTPUT_MESSAGE, "%s\n\n", this->PhreeqcPtr->title_x); + } + +#ifdef SWIG_SHARED_OBJ + if (this->PhreeqcPtr->punch.in == TRUE) + { + // + // (punch.in == TRUE) when any "RUN" has contained + // a SELECTED_OUTPUT block since the last LoadDatabase call. + // + // Since LoadDatabase inititializes punch.in to FALSE + // (via UnLoadDatabase...do_initialize) + // and punch.in is set to TRUE in read_selected_output + // + // This causes the SELECTED_OUTPUT to contain the same headings + // until another SELECTED_OUTPUT is defined which sets the variable + // punch.new_def to TRUE + // + // WHAT IF A USER_PUNCH IS DEFINED?? IS punch.new_def SET TO + // TRUE ??? + // + // + if (!this->SelectedOutputOn) ASSERT(!this->output_isopen2(Phreeqc::OUTPUT_PUNCH)); + + if (this->PhreeqcPtr->pr.punch == FALSE) + { + // No selected_output for this simulation + // this happens when + // PRINT; -selected_output false + // is given as input + // Note: this also disables the CSelectedOutput object + } + else + { + if (this->PhreeqcPtr->punch.new_def == FALSE) + { + if (this->SelectedOutputOn && !this->output_isopen2(Phreeqc::OUTPUT_PUNCH)) + { + // + // LoadDatabase + // do_run -- containing SELECTED_OUTPUT ****TODO**** check -file option + // another do_run without SELECTED_OUTPUT + // + std::string filename = this->PunchFileName; + this->PhreeqcPtr->output_open(Phreeqc::OUTPUT_PUNCH, filename.c_str()); + if (!this->output_isopen2(Phreeqc::OUTPUT_PUNCH)) + { + std::ostringstream oss; + oss << sz_routine << ": Unable to open:" << "\"" << filename << "\".\n"; + this->PhreeqcPtr->warning_msg(oss.str().c_str()); + } + else + { + // output selected_output headings + this->PhreeqcPtr->punch.new_def = TRUE; + this->PhreeqcPtr->tidy_punch(); + } + } + } + else + { + if (this->SelectedOutputOn && !this->output_isopen2(Phreeqc::OUTPUT_PUNCH)) + { + // This is a special case which could not occur in + // phreeqc + // + // LoadDatabase + // do_run -- containing SELECTED_OUTPUT ****TODO**** check -file option + // another do_run with SELECTED_OUTPUT + // + std::string filename = PUNCH_FILENAME; + if (this->PunchFileName.size()) + { + filename = this->PunchFileName; + } + this->PhreeqcPtr->output_open(Phreeqc::OUTPUT_PUNCH, filename.c_str()); + if (!this->output_isopen2(Phreeqc::OUTPUT_PUNCH)) + { + std::ostringstream oss; + oss << sz_routine << ": Unable to open:" << "\"" << filename << "\".\n"; + this->PhreeqcPtr->warning_msg(oss.str().c_str()); + } + else + { + // output selected_output headings + ASSERT(this->PhreeqcPtr->punch.new_def == TRUE); + this->PhreeqcPtr->tidy_punch(); + } + } + } + } + } + + if (!this->SelectedOutputOn) ASSERT(!this->output_isopen2(Phreeqc::OUTPUT_PUNCH)); + /* the converse is not necessarily true */ + + this->PhreeqcPtr->n_user_punch_index = -1; +#endif // SWIG_SHARED_OBJ + this->PhreeqcPtr->tidy_model(); +#ifdef PHREEQC_CPP + //test_classes(); +#endif +#ifdef PHREEQ98 + if (!phreeq98_debug) { +#endif + + +/* + * Calculate distribution of species for initial solutions + */ + if (this->PhreeqcPtr->new_solution) this->PhreeqcPtr->initial_solutions(TRUE); +/* + * Calculate distribution for exchangers + */ + if (this->PhreeqcPtr->new_exchange) this->PhreeqcPtr->initial_exchangers(TRUE); +/* + * Calculate distribution for surfaces + */ + if (this->PhreeqcPtr->new_surface) this->PhreeqcPtr->initial_surfaces(TRUE); +/* + * Calculate initial gas composition + */ + if (this->PhreeqcPtr->new_gas_phase) this->PhreeqcPtr->initial_gas_phases(TRUE); +/* + * Calculate reactions + */ + this->PhreeqcPtr->reactions(); +/* + * Calculate inverse models + */ + this->PhreeqcPtr->inverse_models(); +/* + * Calculate advection + */ + if (this->PhreeqcPtr->use.advect_in == TRUE) { + this->PhreeqcPtr->dup_print ("Beginning of advection calculations.", TRUE); + this->PhreeqcPtr->advection(); + } +/* + * Calculate transport + */ + if (this->PhreeqcPtr->use.trans_in == TRUE) { + this->PhreeqcPtr->dup_print ("Beginning of transport calculations.", TRUE); + this->PhreeqcPtr->transport(); + } + +#ifdef PHREEQC_CPP +/* + * run + */ + this->PhreeqcPtr->run_as_cells(); +#endif + +/* + * Copy + */ + if (this->PhreeqcPtr->new_copy) this->PhreeqcPtr->copy_entities(); +#ifdef PHREEQC_CPP + +/* + * dump + */ + dumper dump_info_save(this->PhreeqcPtr->dump_info); + if (this->DumpOn) + { + this->PhreeqcPtr->dump_entities(); + } + if (this->DumpStringOn) + { + this->PhreeqcPtr->dump_info = dump_info_save; + if (this->PhreeqcPtr->dump_info.Get_bool_any()) + { + std::ostringstream oss; + this->PhreeqcPtr->dump_ostream(oss); + if (this->PhreeqcPtr->dump_info.get_append()) + { + this->DumpString += oss.str(); + } + else + { + this->DumpString = oss.str(); + } + + /* Fill dump lines */ + this->DumpLines.clear(); + std::istringstream iss(this->DumpString); + std::string line; + while (std::getline(iss, line)) + { + this->DumpLines.push_back(line); + } + } + } +/* + * delete + */ + this->PhreeqcPtr->delete_entities(); +#endif + +/* + * End of simulation + */ + this->PhreeqcPtr->dup_print( "End of simulation.", TRUE); +#ifdef PHREEQ98 + } /* if (!phreeq98_debug) */ +#endif + } + +/* + * Display successful status + */ + this->PhreeqcPtr->do_status(); + +/* + * call post-run callback + */ + if (pfn_post) + { + pfn_post(cookie); + } + + if (this->PhreeqcPtr->input_error > 0) + { + std::ostringstream oss; + oss << "\n"; + oss << this->StringInput.c_str(); + oss << "\n"; + this->PhreeqcPtr->error_msg(oss.str().c_str(), CONTINUE); + } + this->update_errors(); +} + +VRESULT IPhreeqc2::AccumulateLine(const char *line) +{ + try + { + this->ErrorReporter->Clear(); + this->WarningReporter->Clear(); + this->StringInput.append(line); + this->StringInput.append("\n"); + return VR_OK; + } + catch (...) + { + this->AddError("AccumulateLine: An unhandled exception occured.\n"); + } + return VR_OUTOFMEMORY; +} + +int IPhreeqc2::RunAccumulated(void) +{ + static const char *sz_routine = "RunAccumulated"; + try + { + // this may throw + this->check_database(sz_routine); + + this->PhreeqcPtr->input_error = 0; + + // create input stream + std::istringstream iss(this->GetAccumulatedLines()); + + // this may throw + this->do_run(sz_routine, &iss, NULL, NULL, NULL, NULL); + } + catch (IPhreeqcStop) + { + // do nothing + } + catch(...) + { + const char *errmsg = "RunAccumulated: An unhandled exception occured.\n"; + try + { + this->PhreeqcPtr->error_msg(errmsg, STOP); // throws PhreeqcStop + } + catch (IPhreeqcStop) + { + // do nothing + } + } + + this->ClearAccumulatedLines(); + this->PhreeqcPtr->close_output_files(); + this->update_errors(); + + return this->PhreeqcPtr->input_error; +} + +int IPhreeqc2::RunFile(const char* filename) +{ + static const char *sz_routine = "RunFile"; + try + { + // this may throw + this->check_database(sz_routine); + + this->PhreeqcPtr->input_error = 0; + + // open file + // + std::ifstream ifs; + ifs.open(filename); + if (!ifs.is_open()) + { + std::ostringstream oss; + oss << "RunFile: Unable to open:" << "\"" << filename << "\"."; + this->PhreeqcPtr->error_msg(oss.str().c_str(), STOP); // throws + } + + // this may throw + this->do_run(sz_routine, &ifs, NULL, NULL, NULL, NULL); + } + catch (IPhreeqcStop) + { + this->PhreeqcPtr->close_input_files(); + } + catch(...) + { + const char *errmsg = "RunFile: An unhandled exception occured.\n"; + try + { + this->PhreeqcPtr->error_msg(errmsg, STOP); // throws PhreeqcStop + } + catch (IPhreeqcStop) + { + // do nothing + } + } + + this->PhreeqcPtr->close_output_files(); + this->update_errors(); + + return this->PhreeqcPtr->input_error; +} + +int IPhreeqc2::RunString(const char* input) +{ + static const char *sz_routine = "RunString"; + try + { + // this may throw + this->check_database(sz_routine); + + this->PhreeqcPtr->input_error = 0; + + // create input stream + std::string s(input); + std::istringstream iss(s); + + // this may throw + this->do_run(sz_routine, &iss, NULL, NULL, NULL, NULL); + } + catch (IPhreeqcStop) + { + this->PhreeqcPtr->close_input_files(); + } + catch(...) + { + const char *errmsg = "RunString: An unhandled exception occured.\n"; + try + { + this->PhreeqcPtr->error_msg(errmsg, STOP); // throws PhreeqcStop + } + catch (IPhreeqcStop) + { + // do nothing + } + } + + this->PhreeqcPtr->close_output_files(); + this->update_errors(); + + return this->PhreeqcPtr->input_error; +} + +int IPhreeqc2::GetSelectedOutputRowCount(void)const +{ + return (int)this->SelectedOutput->GetRowCount(); +} + +int IPhreeqc2::GetSelectedOutputColumnCount(void)const +{ + return (int)this->SelectedOutput->GetColCount(); +} + +VRESULT IPhreeqc2::GetSelectedOutputValue(int row, int col, VAR* pVAR) +{ + this->ErrorReporter->Clear(); + if (!pVAR) + { + this->AddError("GetSelectedOutputValue: VR_INVALIDARG pVAR is NULL.\n"); + this->update_errors(); + return VR_INVALIDARG; + } + + VRESULT v = this->SelectedOutput->Get(row, col, pVAR); + switch (v) + { + case VR_OK: + break; + case VR_OUTOFMEMORY: + this->AddError("GetSelectedOutputValue: VR_OUTOFMEMORY Out of memory.\n"); + break; + case VR_BADVARTYPE: + this->AddError("GetSelectedOutputValue: VR_BADVARTYPE pVar must be initialized(VarInit) and/or cleared(VarClear).\n"); + break; + case VR_INVALIDARG: + // not possible + break; + case VR_INVALIDROW: + this->AddError("GetSelectedOutputValue: VR_INVALIDROW Row index out of range.\n"); + break; + case VR_INVALIDCOL: + this->AddError("GetSelectedOutputValue: VR_INVALIDCOL Column index out of range.\n"); + break; + } + this->update_errors(); + return v; +} + +int IPhreeqc2::GetDumpLineCount(void)const +{ + return (int)this->DumpLines.size(); +} + +const char* IPhreeqc2::GetDumpLine(int n) +{ + static const char empty[] = ""; + if (n < 0 || n >= this->GetDumpLineCount()) + { + return empty; + } + return this->DumpLines[n].c_str(); +} + +int IPhreeqc2::GetErrorLineCount(void)const +{ + return (int)this->ErrorLines.size(); +} + +const char* IPhreeqc2::GetErrorLine(int n) +{ + static const char empty[] = ""; + if (n < 0 || n >= this->GetErrorLineCount()) + { + return empty; + } + return this->ErrorLines[n].c_str(); +} + +void IPhreeqc2::update_errors(void) +{ + this->LastErrorString = ((CErrorReporter*)this->ErrorReporter)->GetOS()->str(); + + this->ErrorLines.clear(); + std::istringstream iss(this->LastErrorString); + std::string line; + while (std::getline(iss, line)) + { + this->ErrorLines.push_back(line); + } +} + +std::list< std::string > IPhreeqc2::ListComponents(void) +{ + std::list< std::string > comps; + this->PhreeqcPtr->list_components(comps); + return comps; +} + +size_t IPhreeqc2::GetComponentCount(void) +{ + std::list< std::string > comps; + this->PhreeqcPtr->list_components(comps); + return comps.size(); +} + +const char* IPhreeqc2::GetComponent(int n) +{ + static const char empty[] = ""; + this->Components = this->ListComponents(); + if (n < 0 || n >= (int)this->Components.size()) + { + return empty; + } + std::list< std::string >::iterator it = this->Components.begin(); + for(int i = 0; i < n; ++i) + { + ++it; + } + return (*it).c_str(); +} diff --git a/src/IPhreeqcLib.cpp b/src/IPhreeqcLib.cpp new file mode 100644 index 00000000..de8ba6de --- /dev/null +++ b/src/IPhreeqcLib.cpp @@ -0,0 +1,468 @@ +#include "IPhreeqcLib.h" +#include "IPhreeqc2.h" +#include + + +int +CreateIPhreeqc(void) +{ + return IPhreeqcLib::CreateIPhreeqc(); +} + +IPL_RESULT +DestroyIPhreeqc(int n) +{ + return IPhreeqcLib::DestroyIPhreeqc(n); +} + +int +LoadDatabaseM(int n, const char* filename) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->LoadDatabase(filename); + } + return IPL_BADINSTANCE; +} + +int +LoadDatabaseStringM(int n, const char* input) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->LoadDatabaseString(input); + } + return IPL_BADINSTANCE; +} + +int +UnLoadDatabaseM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + IPhreeqcPtr->UnLoadDatabase(); + return IPL_OK; + } + return IPL_BADINSTANCE; +} + +const char* +GetLastErrorStringM(int n) +{ + static const char err_msg[] = "GetLastErrorString: Bad instance.\n"; + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->GetLastErrorString(); + } + return err_msg; +} + +const char* +GetDumpStringM(int n) +{ + static const char empty[] = ""; + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->GetDumpString(); + } + return empty; +} + +int +GetDumpLineCountM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->GetDumpLineCount(); + } + return 0; +} + +const char* +GetDumpLineM(int id, int n) +{ + static const char err_msg[] = "GetDumpLine: Bad instance.\n"; + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->GetDumpLine(n); + } + return err_msg; +} + +int +GetComponentCountM(int id) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->ListComponents().size(); + } + return 0; +} + +const char* +GetComponentM(int id, int n) +{ + static const char err_msg[] = "GetComponent: Bad instance.\n"; + static const char empty[] = ""; + static std::string comp; + + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(id); + if (IPhreeqcPtr) + { + std::list< std::string > comps = IPhreeqcPtr->ListComponents(); + if (n < 0 || n >= (int)comps.size()) + { + return empty; + } + std::list< std::string >::iterator it = comps.begin(); + for(int i = 0; i < n; ++i) + { + ++it; + } + comp = (*it); + return comp.c_str(); + } + return err_msg; +} + +IPL_RESULT +AccumulateLineM(int n, const char *line) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + switch (IPhreeqcPtr->AccumulateLine(line)) + { + case VR_OK: + return IPL_OK; + case VR_OUTOFMEMORY: + return IPL_OUTOFMEMORY; + default: + assert(false); + } + } + return IPL_BADINSTANCE; +} + +int +GetSelectedOutputOnM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + if (IPhreeqcPtr->GetSelectedOutputOn()) + { + return 1; + } + else + { + return 0; + } + } + return IPL_BADINSTANCE; +} + +IPL_RESULT +SetSelectedOutputOnM(int n, int value) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + IPhreeqcPtr->SetSelectedOutputOn(value != 0); + return IPL_OK; + } + return IPL_BADINSTANCE; +} + +int +GetOutputOnM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + if (IPhreeqcPtr->GetOutputOn()) + { + return 1; + } + else + { + return 0; + } + } + return IPL_BADINSTANCE; +} + +IPL_RESULT +SetOutputOnM(int n, int value) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + IPhreeqcPtr->SetOutputOn(value != 0); + return IPL_OK; + } + return IPL_BADINSTANCE; +} + +int +GetErrorOnM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + if (IPhreeqcPtr->GetErrorOn()) + { + return 1; + } + else + { + return 0; + } + } + return IPL_BADINSTANCE; +} + +IPL_RESULT +SetErrorOnM(int n, int value) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + IPhreeqcPtr->SetErrorOn(value != 0); + return IPL_OK; + } + return IPL_BADINSTANCE; +} + +int +GetLogOnM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + if (IPhreeqcPtr->GetLogOn()) + { + return 1; + } + else + { + return 0; + } + } + return IPL_BADINSTANCE; +} + +IPL_RESULT +SetLogOnM(int n, int value) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + IPhreeqcPtr->SetLogOn(value != 0); + return IPL_OK; + } + return IPL_BADINSTANCE; +} + + +int +GetDumpOnM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + if (IPhreeqcPtr->GetDumpOn()) + { + return 1; + } + else + { + return 0; + } + } + return IPL_BADINSTANCE; +} + +IPL_RESULT +SetDumpOnM(int n, int value) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + IPhreeqcPtr->SetDumpOn(value != 0); + return IPL_OK; + } + return IPL_BADINSTANCE; +} + +int +GetDumpStringOnM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + if (IPhreeqcPtr->GetDumpStringOn()) + { + return 1; + } + else + { + return 0; + } + } + return IPL_BADINSTANCE; +} + +IPL_RESULT +SetDumpStringOnM(int n, int value) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + IPhreeqcPtr->SetDumpStringOn(value != 0); + return IPL_OK; + } + return IPL_BADINSTANCE; +} + +int +RunAccumulatedM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->RunAccumulated(); + } + return IPL_BADINSTANCE; +} + +int +RunFileM(int n, const char* filename) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->RunFile(filename); + } + return IPL_BADINSTANCE; +} + +int +GetSelectedOutputRowCountM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->GetSelectedOutputRowCount(); + } + return IPL_BADINSTANCE; +} + +int +GetSelectedOutputColumnCountM(int n) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return IPhreeqcPtr->GetSelectedOutputColumnCount(); + } + return IPL_BADINSTANCE; +} + + +IPL_RESULT +GetSelectedOutputValueM(int n, int row, int col, VAR* pVAR) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + switch(IPhreeqcPtr->GetSelectedOutputValue(row, col, pVAR)) + { + case VR_OK: return IPL_OK; + case VR_OUTOFMEMORY: return IPL_OUTOFMEMORY; + case VR_BADVARTYPE: return IPL_BADVARTYPE; + case VR_INVALIDARG: return IPL_INVALIDARG; + case VR_INVALIDROW: return IPL_INVALIDROW; + case VR_INVALIDCOL: return IPL_INVALIDCOL; + default: + assert(false); + } + } + return IPL_BADINSTANCE; +} + +int +AddErrorM(int n, const char* error_msg) +{ + IPhreeqc2* IPhreeqcPtr = IPhreeqcLib::GetInstance(n); + if (IPhreeqcPtr) + { + return (int)IPhreeqcPtr->AddError(error_msg); + } + return IPL_BADINSTANCE; +} + +std::map IPhreeqcLib::Instances; +size_t IPhreeqcLib::InstancesIndex = 0; + +int +IPhreeqcLib::CreateIPhreeqc(void) +{ + int n = IPL_OUTOFMEMORY; + try + { + IPhreeqc2* IPhreeqcPtr = new IPhreeqc2; + if (IPhreeqcPtr) + { + std::map::value_type instance(IPhreeqcLib::InstancesIndex, IPhreeqcPtr); + std::pair::iterator, bool> pr = IPhreeqcLib::Instances.insert(instance); + if (pr.second) + { + n = (int) (*pr.first).first; + ++IPhreeqcLib::InstancesIndex; + } + } + } + catch(...) + { + return IPL_OUTOFMEMORY; + } + return n; +} + +IPL_RESULT +IPhreeqcLib::DestroyIPhreeqc(int n) +{ + IPL_RESULT retval = IPL_BADINSTANCE; + if (n >= 0) + { + std::map::iterator it = IPhreeqcLib::Instances.find(size_t(n)); + if (it != IPhreeqcLib::Instances.end()) + { + delete (*it).second; + IPhreeqcLib::Instances.erase(it); + retval = IPL_OK; + } + } + return retval; +} + +IPhreeqc2* +IPhreeqcLib::GetInstance(int n) +{ + std::map::iterator it = IPhreeqcLib::Instances.find(size_t(n)); + if (it != IPhreeqcLib::Instances.end()) + { + return (*it).second; + } + return 0; +} + diff --git a/src/module_files.cpp b/src/module_files.cpp index 3c27973d..7bfbab3b 100644 --- a/src/module_files.cpp +++ b/src/module_files.cpp @@ -2,12 +2,15 @@ #if defined(R_SO) #include "phreeqc_files.inl" #else -#include "phreeqcpp/phreeqc/phreeqc_files.c" +// COMMENT: {3/25/2010 12:36:14 PM}#include "phreeqcpp/phreeqc/phreeqc_files.c" #endif // COMMENT: {3/2/2010 4:06:35 PM}static int module_isopen_handler(const int type); // COMMENT: {3/2/2010 4:06:35 PM}static int module_open_handler(const int type, const char *file_name); +//{{{3/25/2010 12:37:19 PM} +#include +//}}{3/25/2010 12:37:19 PM} #include "IPhreeqc.hpp" int IPhreeqc::module_handler(const int action, const int type, const char *err_str, const int stop, void *cookie, const char *format, va_list args) diff --git a/src/module_output.cpp b/src/module_output.cpp index 51d2fc45..70c1561a 100644 --- a/src/module_output.cpp +++ b/src/module_output.cpp @@ -5,7 +5,7 @@ #if defined(R_SO) #include "output.inl" #else -#include "phreeqcpp/phreeqc/output.c" +// COMMENT: {3/25/2010 12:36:24 PM}#include "phreeqcpp/phreeqc/output.c" #endif diff --git a/testcpp/ex1 b/testcpp/ex1 new file mode 100644 index 00000000..7ca7ceb0 --- /dev/null +++ b/testcpp/ex1 @@ -0,0 +1,71 @@ +TITLE Example 1.--Add uranium and speciate seawater. +SOLUTION 1 SEAWATER FROM NORDSTROM ET AL. (1979) + units ppm + pH 8.22 + pe 8.451 + density 1.023 + temp 25.0 + redox O(0)/O(-2) + Ca 412.3 + Mg 1291.8 + Na 10768.0 + K 399.1 + Fe 0.002 + Mn 0.0002 pe + Si 4.28 + Cl 19353.0 + Alkalinity 141.682 as HCO3 + S(6) 2712.0 + N(5) 0.29 gfw 62.0 + N(-3) 0.03 as NH4 + U 3.3 ppb N(5)/N(-3) + O(0) 1.0 O2(g) -0.7 +SOLUTION_MASTER_SPECIES + U U+4 0.0 238.0290 238.0290 + U(4) U+4 0.0 238.0290 + U(5) UO2+ 0.0 238.0290 + U(6) UO2+2 0.0 238.0290 +SOLUTION_SPECIES + #primary master species for U + #is also secondary master species for U(4) + U+4 = U+4 + log_k 0.0 + U+4 + 4 H2O = U(OH)4 + 4 H+ + log_k -8.538 + delta_h 24.760 kcal + U+4 + 5 H2O = U(OH)5- + 5 H+ + log_k -13.147 + delta_h 27.580 kcal + #secondary master species for U(5) + U+4 + 2 H2O = UO2+ + 4 H+ + e- + log_k -6.432 + delta_h 31.130 kcal + #secondary master species for U(6) + U+4 + 2 H2O = UO2+2 + 4 H+ + 2 e- + log_k -9.217 + delta_h 34.430 kcal + UO2+2 + H2O = UO2OH+ + H+ + log_k -5.782 + delta_h 11.015 kcal + 2UO2+2 + 2H2O = (UO2)2(OH)2+2 + 2H+ + log_k -5.626 + delta_h -36.04 kcal + 3UO2+2 + 5H2O = (UO2)3(OH)5+ + 5H+ + log_k -15.641 + delta_h -44.27 kcal + UO2+2 + CO3-2 = UO2CO3 + log_k 10.064 + delta_h 0.84 kcal + UO2+2 + 2CO3-2 = UO2(CO3)2-2 + log_k 16.977 + delta_h 3.48 kcal + UO2+2 + 3CO3-2 = UO2(CO3)3-4 + log_k 21.397 + delta_h -8.78 kcal +PHASES + Uraninite + UO2 + 4 H+ = U+4 + 2 H2O + log_k -3.490 + delta_h -18.630 kcal +END + diff --git a/testcpp/phreeqc.dat b/testcpp/phreeqc.dat new file mode 100644 index 00000000..a8646ca2 --- /dev/null +++ b/testcpp/phreeqc.dat @@ -0,0 +1,1556 @@ +SOLUTION_MASTER_SPECIES +# +#element species alk gfw_formula element_gfw +# +H H+ -1. H 1.008 +H(0) H2 0.0 H +H(1) H+ -1. 0.0 +E e- 0.0 0.0 0.0 +O H2O 0.0 O 16.00 +O(0) O2 0.0 O +O(-2) H2O 0.0 0.0 +Ca Ca+2 0.0 Ca 40.08 +Mg Mg+2 0.0 Mg 24.312 +Na Na+ 0.0 Na 22.9898 +K K+ 0.0 K 39.102 +Fe Fe+2 0.0 Fe 55.847 +Fe(+2) Fe+2 0.0 Fe +Fe(+3) Fe+3 -2.0 Fe +Mn Mn+2 0.0 Mn 54.938 +Mn(+2) Mn+2 0.0 Mn +Mn(+3) Mn+3 0.0 Mn +Al Al+3 0.0 Al 26.9815 +Ba Ba+2 0.0 Ba 137.34 +Sr Sr+2 0.0 Sr 87.62 +Si H4SiO4 0.0 SiO2 28.0843 +Cl Cl- 0.0 Cl 35.453 +C CO3-2 2.0 HCO3 12.0111 +C(+4) CO3-2 2.0 HCO3 +C(-4) CH4 0.0 CH4 +Alkalinity CO3-2 1.0 Ca0.5(CO3)0.5 50.05 +S SO4-2 0.0 SO4 32.064 +S(6) SO4-2 0.0 SO4 +S(-2) HS- 1.0 S +N NO3- 0.0 N 14.0067 +N(+5) NO3- 0.0 N +N(+3) NO2- 0.0 N +N(0) N2 0.0 N +N(-3) NH4+ 0.0 N +B H3BO3 0.0 B 10.81 +P PO4-3 2.0 P 30.9738 +F F- 0.0 F 18.9984 +Li Li+ 0.0 Li 6.939 +Br Br- 0.0 Br 79.904 +Zn Zn+2 0.0 Zn 65.37 +Cd Cd+2 0.0 Cd 112.4 +Pb Pb+2 0.0 Pb 207.19 +Cu Cu+2 0.0 Cu 63.546 +Cu(+2) Cu+2 0.0 Cu +Cu(+1) Cu+1 0.0 Cu + +SOLUTION_SPECIES + +H+ = H+ + log_k 0.000 + -gamma 9.0000 0.0000 + +e- = e- + log_k 0.000 + +H2O = H2O + log_k 0.000 + +Ca+2 = Ca+2 + log_k 0.000 + -gamma 5.0000 0.1650 + +Mg+2 = Mg+2 + log_k 0.000 + -gamma 5.5000 0.2000 + +Na+ = Na+ + log_k 0.000 + -gamma 4.0000 0.0750 + +K+ = K+ + log_k 0.000 + -gamma 3.5000 0.0150 + +Fe+2 = Fe+2 + log_k 0.000 + -gamma 6.0000 0.0000 + +Mn+2 = Mn+2 + log_k 0.000 + -gamma 6.0000 0.0000 + +Al+3 = Al+3 + log_k 0.000 + -gamma 9.0000 0.0000 + +Ba+2 = Ba+2 + log_k 0.000 + -gamma 5.0000 0.0000 + +Sr+2 = Sr+2 + log_k 0.000 + -gamma 5.2600 0.1210 + +H4SiO4 = H4SiO4 + log_k 0.000 + +Cl- = Cl- + log_k 0.000 + -gamma 3.5000 0.0150 + +CO3-2 = CO3-2 + log_k 0.000 + -gamma 5.4000 0.0000 + +SO4-2 = SO4-2 + log_k 0.000 + -gamma 5.0000 -0.0400 + +NO3- = NO3- + log_k 0.000 + -gamma 3.0000 0.0000 + +H3BO3 = H3BO3 + log_k 0.000 + +PO4-3 = PO4-3 + log_k 0.000 + -gamma 4.0000 0.0000 + +F- = F- + log_k 0.000 + -gamma 3.5000 0.0000 + +Li+ = Li+ + log_k 0.000 + -gamma 6.0000 0.0000 + +Br- = Br- + log_k 0.000 + -gamma 3.0000 0.0000 + +Zn+2 = Zn+2 + log_k 0.000 + -gamma 5.0000 0.0000 + +Cd+2 = Cd+2 + log_k 0.000 + +Pb+2 = Pb+2 + log_k 0.000 + +Cu+2 = Cu+2 + log_k 0.000 + -gamma 6.0000 0.0000 + +H2O = OH- + H+ + log_k -14.000 + delta_h 13.362 kcal + -analytic -283.971 -0.05069842 13323.0 102.24447 -1119669.0 + -gamma 3.5000 0.0000 + +2 H2O = O2 + 4 H+ + 4 e- + log_k -86.08 + delta_h 134.79 kcal + +2 H+ + 2 e- = H2 + log_k -3.15 + delta_h -1.759 kcal + +CO3-2 + H+ = HCO3- + log_k 10.329 + delta_h -3.561 kcal + -analytic 107.8871 0.03252849 -5151.79 -38.92561 563713.9 + -gamma 5.4000 0.0000 + +CO3-2 + 2 H+ = CO2 + H2O + log_k 16.681 + delta_h -5.738 kcal + -analytic 464.1965 0.09344813 -26986.16 -165.75951 2248628.9 + +CO3-2 + 10 H+ + 8 e- = CH4 + 3 H2O + log_k 41.071 + delta_h -61.039 kcal + +SO4-2 + H+ = HSO4- + log_k 1.988 + delta_h 3.85 kcal + -analytic -56.889 0.006473 2307.9 19.8858 0.0 + +HS- = S-2 + H+ + log_k -12.918 + delta_h 12.1 kcal + -gamma 5.0000 0.0000 + +SO4-2 + 9 H+ + 8 e- = HS- + 4 H2O + log_k 33.65 + delta_h -60.140 kcal + -gamma 3.5000 0.0000 + +HS- + H+ = H2S + log_k 6.994 + delta_h -5.300 kcal + -analytical -11.17 0.02386 3279.0 + + +NO3- + 2 H+ + 2 e- = NO2- + H2O + log_k 28.570 + delta_h -43.760 kcal + -gamma 3.0000 0.0000 + +2 NO3- + 12 H+ + 10 e- = N2 + 6 H2O + log_k 207.080 + delta_h -312.130 kcal + +NH4+ = NH3 + H+ + log_k -9.252 + delta_h 12.48 kcal + -analytic 0.6322 -0.001225 -2835.76 + +NO3- + 10 H+ + 8 e- = NH4+ + 3 H2O + log_k 119.077 + delta_h -187.055 kcal + -gamma 2.5000 0.0000 + +NH4+ + SO4-2 = NH4SO4- + log_k 1.11 + +H3BO3 = H2BO3- + H+ + log_k -9.240 + delta_h 3.224 kcal +# -analytical 24.3919 0.012078 -1343.9 -13.2258 + +H3BO3 + F- = BF(OH)3- + log_k -0.400 + delta_h 1.850 kcal + +H3BO3 + 2 F- + H+ = BF2(OH)2- + H2O + log_k 7.63 + delta_h 1.618 kcal + +H3BO3 + 2 H+ + 3 F- = BF3OH- + 2 H2O + log_k 13.67 + delta_h -1.614 kcal + +H3BO3 + 3 H+ + 4 F- = BF4- + 3 H2O + log_k 20.28 + delta_h -1.846 kcal + +PO4-3 + H+ = HPO4-2 + log_k 12.346 + delta_h -3.530 kcal + -gamma 4.0000 0.0000 + +PO4-3 + 2 H+ = H2PO4- + log_k 19.553 + delta_h -4.520 kcal + -gamma 4.5000 0.0000 + +H+ + F- = HF + log_k 3.18 + delta_h 3.18 kcal + -analytic -2.033 0.012645 429.01 + +H+ + 2 F- = HF2- + log_k 3.760 + delta_h 4.550 kcal + +Ca+2 + H2O = CaOH+ + H+ + log_k -12.780 + +Ca+2 + CO3-2 = CaCO3 + log_k 3.224 + delta_h 3.545 kcal + -analytic -1228.732 -0.299440 35512.75 485.818 + +Ca+2 + CO3-2 + H+ = CaHCO3+ + log_k 11.435 + delta_h -0.871 kcal + -analytic 1317.0071 0.34546894 -39916.84 -517.70761 563713.9 + -gamma 5.4000 0.0000 + +Ca+2 + SO4-2 = CaSO4 + log_k 2.300 + delta_h 1.650 kcal + +Ca+2 + HSO4- = CaHSO4+ + log_k 1.08 + +Ca+2 + PO4-3 = CaPO4- + log_k 6.459 + delta_h 3.100 kcal + +Ca+2 + HPO4-2 = CaHPO4 + log_k 2.739 + delta_h 3.3 kcal + +Ca+2 + H2PO4- = CaH2PO4+ + log_k 1.408 + delta_h 3.4 kcal + +Ca+2 + F- = CaF+ + log_k 0.940 + delta_h 4.120 kcal + +Mg+2 + H2O = MgOH+ + H+ + log_k -11.440 + delta_h 15.952 kcal + +Mg+2 + CO3-2 = MgCO3 + log_k 2.98 + delta_h 2.713 kcal + -analytic 0.9910 0.00667 + +Mg+2 + H+ + CO3-2 = MgHCO3+ + log_k 11.399 + delta_h -2.771 kcal + -analytic 48.6721 0.03252849 -2614.335 -18.00263 563713.9 + +Mg+2 + SO4-2 = MgSO4 + log_k 2.370 + delta_h 4.550 kcal + +Mg+2 + PO4-3 = MgPO4- + log_k 6.589 + delta_h 3.100 kcal + +Mg+2 + HPO4-2 = MgHPO4 + log_k 2.87 + delta_h 3.3 kcal + +Mg+2 + H2PO4- = MgH2PO4+ + log_k 1.513 + delta_h 3.4 kcal + +Mg+2 + F- = MgF+ + log_k 1.820 + delta_h 3.200 kcal + +Na+ + H2O = NaOH + H+ + log_k -14.180 + +Na+ + CO3-2 = NaCO3- + log_k 1.270 + delta_h 8.910 kcal + +Na+ + HCO3- = NaHCO3 + log_k -0.25 + +Na+ + SO4-2 = NaSO4- + log_k 0.700 + delta_h 1.120 kcal + +Na+ + HPO4-2 = NaHPO4- + log_k 0.29 + +Na+ + F- = NaF + log_k -0.240 + +K+ + H2O = KOH + H+ + log_k -14.460 + +K+ + SO4-2 = KSO4- + log_k 0.850 + delta_h 2.250 kcal + -analytical 3.106 0.0 -673.6 + + +K+ + HPO4-2 = KHPO4- + log_k 0.29 + +Fe+2 + H2O = FeOH+ + H+ + log_k -9.500 + delta_h 13.200 kcal + +Fe+2 + Cl- = FeCl+ + log_k 0.140 + +Fe+2 + CO3-2 = FeCO3 + log_k 4.380 + +Fe+2 + HCO3- = FeHCO3+ + log_k 2.0 + +Fe+2 + SO4-2 = FeSO4 + log_k 2.250 + delta_h 3.230 kcal + +Fe+2 + HSO4- = FeHSO4+ + log_k 1.08 + +Fe+2 + 2HS- = Fe(HS)2 + log_k 8.95 + +Fe+2 + 3HS- = Fe(HS)3- + log_k 10.987 + +Fe+2 + HPO4-2 = FeHPO4 + log_k 3.6 + +Fe+2 + H2PO4- = FeH2PO4+ + log_k 2.7 + +Fe+2 + F- = FeF+ + log_k 1.000 + +Fe+2 = Fe+3 + e- + log_k -13.020 + delta_h 9.680 kcal + -gamma 9.0000 0.0000 + +Fe+3 + H2O = FeOH+2 + H+ + log_k -2.19 + delta_h 10.4 kcal + +Fe+3 + 2 H2O = Fe(OH)2+ + 2 H+ + log_k -5.67 + delta_h 17.1 kcal + +Fe+3 + 3 H2O = Fe(OH)3 + 3 H+ + log_k -12.56 + delta_h 24.8 kcal + +Fe+3 + 4 H2O = Fe(OH)4- + 4 H+ + log_k -21.6 + delta_h 31.9 kcal + +2 Fe+3 + 2 H2O = Fe2(OH)2+4 + 2 H+ + log_k -2.95 + delta_h 13.5 kcal + +3 Fe+3 + 4 H2O = Fe3(OH)4+5 + 4 H+ + log_k -6.3 + delta_h 14.3 kcal + +Fe+3 + Cl- = FeCl+2 + log_k 1.48 + delta_h 5.6 kcal + +Fe+3 + 2 Cl- = FeCl2+ + log_k 2.13 + +Fe+3 + 3 Cl- = FeCl3 + log_k 1.13 + +Fe+3 + SO4-2 = FeSO4+ + log_k 4.04 + delta_h 3.91 kcal + +Fe+3 + HSO4- = FeHSO4+2 + log_k 2.48 + +Fe+3 + 2 SO4-2 = Fe(SO4)2- + log_k 5.38 + delta_h 4.60 kcal + +Fe+3 + HPO4-2 = FeHPO4+ + log_k 5.43 + delta_h 5.76 kcal + +Fe+3 + H2PO4- = FeH2PO4+2 + log_k 5.43 + +Fe+3 + F- = FeF+2 + log_k 6.2 + delta_h 2.7 kcal + +Fe+3 + 2 F- = FeF2+ + log_k 10.8 + delta_h 4.8 kcal + +Fe+3 + 3 F- = FeF3 + log_k 14.0 + delta_h 5.4 kcal + +Mn+2 + H2O = MnOH+ + H+ + log_k -10.590 + delta_h 14.400 kcal + +Mn+2 + Cl- = MnCl+ + log_k 0.610 + +Mn+2 + 2 Cl- = MnCl2 + log_k 0.250 + +Mn+2 + 3 Cl- = MnCl3- + log_k -0.310 + +Mn+2 + CO3-2 = MnCO3 + log_k 4.900 + +Mn+2 + HCO3- = MnHCO3+ + log_k 1.95 + +Mn+2 + SO4-2 = MnSO4 + log_k 2.250 + delta_h 3.370 kcal + +Mn+2 + 2 NO3- = Mn(NO3)2 + log_k 0.600 + delta_h -0.396 kcal + +Mn+2 + F- = MnF+ + log_k 0.840 + +Mn+2 = Mn+3 + e- + log_k -25.510 + delta_h 25.800 kcal + +Al+3 + H2O = AlOH+2 + H+ + log_k -5.00 + delta_h 11.49 kcal + -analytic -38.253 0.0 -656.27 14.327 + +Al+3 + 2 H2O = Al(OH)2+ + 2 H+ + log_k -10.1 + delta_h 26.90 kcal + -analytic 88.500 0.0 -9391.6 -27.121 + +Al+3 + 3 H2O = Al(OH)3 + 3 H+ + log_k -16.9 + delta_h 39.89 kcal + -analytic 226.374 0.0 -18247.8 -73.597 + +Al+3 + 4 H2O = Al(OH)4- + 4 H+ + log_k -22.7 + delta_h 42.30 kcal + -analytic 51.578 0.0 -11168.9 -14.865 + +Al+3 + SO4-2 = AlSO4+ + log_k 3.5 + delta_h 2.29 kcal + +Al+3 + 2SO4-2 = Al(SO4)2- + log_k 5.0 + delta_h 3.11 kcal + +Al+3 + HSO4- = AlHSO4+2 + log_k 0.46 + +Al+3 + F- = AlF+2 + log_k 7.000 + delta_h 1.060 kcal + +Al+3 + 2 F- = AlF2+ + log_k 12.700 + delta_h 1.980 kcal + +Al+3 + 3 F- = AlF3 + log_k 16.800 + delta_h 2.160 kcal + +Al+3 + 4 F- = AlF4- + log_k 19.400 + delta_h 2.200 kcal + +Al+3 + 5 F- = AlF5-2 + log_k 20.600 + delta_h 1.840 kcal + +Al+3 + 6 F- = AlF6-3 + log_k 20.600 + delta_h -1.670 kcal + +H4SiO4 = H3SiO4- + H+ + log_k -9.83 + delta_h 6.12 kcal + -analytic -302.3724 -0.050698 15669.69 108.18466 -1119669.0 + +H4SiO4 = H2SiO4-2 + 2 H+ + log_k -23.0 + delta_h 17.6 kcal + -analytic -294.0184 -0.072650 11204.49 108.18466 -1119669.0 + +H4SiO4 + 4 H+ + 6 F- = SiF6-2 + 4 H2O + log_k 30.180 + delta_h -16.260 kcal + +Ba+2 + H2O = BaOH+ + H+ + log_k -13.470 + +Ba+2 + CO3-2 = BaCO3 + log_k 2.71 + delta_h 3.55 kcal + -analytic 0.113 0.008721 + +Ba+2 + HCO3- = BaHCO3+ + log_k 0.982 + delta_h 5.56 kcal + -analytical -3.0938 0.013669 0.0 0.0 0.0 + +Ba+2 + SO4-2 = BaSO4 + log_k 2.700 + +Sr+2 + H2O = SrOH+ + H+ + log_k -13.290 + -gamma 5.0000 0.0000 + +Sr+2 + CO3-2 + H+ = SrHCO3+ + log_k 11.509 + delta_h 2.489 kcal + -analytic 104.6391 0.04739549 -5151.79 -38.92561 563713.9 + -gamma 5.4000 0.0000 + +Sr+2 + CO3-2 = SrCO3 + log_k 2.81 + delta_h 5.22 kcal + -analytic -1.019 0.012826 + +Sr+2 + SO4-2 = SrSO4 + log_k 2.290 + delta_h 2.080 kcal + +Li+ + H2O = LiOH + H+ + log_k -13.640 + +Li+ + SO4-2 = LiSO4- + log_k 0.640 + +Cu+2 + e- = Cu+ + log_k 2.720 + delta_h 1.650 kcal + -gamma 2.5000 0.0000 + +Cu+2 + H2O = CuOH+ + H+ + log_k -8.000 + -gamma 4.0000 0.0000 + +Cu+2 + 2 H2O = Cu(OH)2 + 2 H+ + log_k -13.680 + +Cu+2 + 3 H2O = Cu(OH)3- + 3 H+ + log_k -26.900 + +Cu+2 + 4 H2O = Cu(OH)4-2 + 4 H+ + log_k -39.600 + +Cu+2 + SO4-2 = CuSO4 + log_k 2.310 + delta_h 1.220 kcal + +Zn+2 + H2O = ZnOH+ + H+ + log_k -8.96 + delta_h 13.4 kcal + +Zn+2 + 2 H2O = Zn(OH)2 + 2 H+ + log_k -16.900 + +Zn+2 + 3 H2O = Zn(OH)3- + 3 H+ + log_k -28.400 + +Zn+2 + 4 H2O = Zn(OH)4-2 + 4 H+ + log_k -41.200 + +Zn+2 + Cl- = ZnCl+ + log_k 0.43 + delta_h 7.79 kcal + +Zn+2 + 2 Cl- = ZnCl2 + log_k 0.45 + delta_h 8.5 kcal + +Zn+2 + 3Cl- = ZnCl3- + log_k 0.5 + delta_h 9.56 kcal + +Zn+2 + 4Cl- = ZnCl4-2 + log_k 0.2 + delta_h 10.96 kcal + +Zn+2 + CO3-2 = ZnCO3 + log_k 5.3 + +Zn+2 + 2CO3-2 = Zn(CO3)2-2 + log_k 9.63 + +Zn+2 + HCO3- = ZnHCO3+ + log_k 2.1 + +Zn+2 + SO4-2 = ZnSO4 + log_k 2.37 + delta_h 1.36 kcal + +Zn+2 + 2SO4-2 = Zn(SO4)2-2 + log_k 3.28 + +Cd+2 + H2O = CdOH+ + H+ + log_k -10.080 + delta_h 13.1 kcal + +Cd+2 + 2 H2O = Cd(OH)2 + 2 H+ + log_k -20.350 + +Cd+2 + 3 H2O = Cd(OH)3- + 3 H+ + log_k -33.300 + +Cd+2 + 4 H2O = Cd(OH)4-2 + 4 H+ + log_k -47.350 + +Cd+2 + Cl- = CdCl+ + log_k 1.980 + delta_h 0.59 kcal + +Cd+2 + 2 Cl- = CdCl2 + log_k 2.600 + delta_h 1.24 kcal + +Cd+2 + 3 Cl- = CdCl3- + log_k 2.400 + delta_h 3.9 kcal + +Cd+2 + CO3-2 = CdCO3 + log_k 2.9 + +Cd+2 + 2CO3-2 = Cd(CO3)2-2 + log_k 6.4 + +Cd+2 + HCO3- = CdHCO3+ + log_k 1.5 + +Cd+2 + SO4-2 = CdSO4 + log_k 2.460 + delta_h 1.08 kcal + +Cd+2 + 2SO4-2 = Cd(SO4)2-2 + log_k 3.5 + +Pb+2 + H2O = PbOH+ + H+ + log_k -7.710 + +Pb+2 + 2 H2O = Pb(OH)2 + 2 H+ + log_k -17.120 + +Pb+2 + 3 H2O = Pb(OH)3- + 3 H+ + log_k -28.060 + +Pb+2 + 4 H2O = Pb(OH)4-2 + 4 H+ + log_k -39.700 + +2 Pb+2 + H2O = Pb2OH+3 + H+ + log_k -6.360 + +Pb+2 + Cl- = PbCl+ + log_k 1.600 + delta_h 4.38 kcal + +Pb+2 + 2 Cl- = PbCl2 + log_k 1.800 + delta_h 1.08 kcal + +Pb+2 + 3 Cl- = PbCl3- + log_k 1.700 + delta_h 2.17 kcal + +Pb+2 + 4 Cl- = PbCl4-2 + log_k 1.380 + delta_h 3.53 kcal + +Pb+2 + CO3-2 = PbCO3 + log_k 7.240 + +Pb+2 + 2 CO3-2 = Pb(CO3)2-2 + log_k 10.640 + +Pb+2 + HCO3- = PbHCO3+ + log_k 2.9 + +Pb+2 + SO4-2 = PbSO4 + log_k 2.750 + +Pb+2 + 2 SO4-2 = Pb(SO4)2-2 + log_k 3.470 + +Pb+2 + NO3- = PbNO3+ + log_k 1.170 + +PHASES + +Calcite + CaCO3 = CO3-2 + Ca+2 + log_k -8.480 + delta_h -2.297 kcal + -analytic -171.9065 -0.077993 2839.319 71.595 + +Aragonite + CaCO3 = CO3-2 + Ca+2 + log_k -8.336 + delta_h -2.589 kcal + -analytic -171.9773 -0.077993 2903.293 71.595 + +Dolomite + CaMg(CO3)2 = Ca+2 + Mg+2 + 2 CO3-2 + log_k -17.090 + delta_h -9.436 kcal + +Siderite + FeCO3 = Fe+2 + CO3-2 + log_k -10.890 + delta_h -2.480 kcal + +Rhodochrosite + MnCO3 = Mn+2 + CO3-2 + log_k -11.130 + delta_h -1.430 kcal + +Strontianite + SrCO3 = Sr+2 + CO3-2 + log_k -9.271 + delta_h -0.400 kcal + -analytic 155.0305 0.0 -7239.594 -56.58638 + +Witherite + BaCO3 = Ba+2 + CO3-2 + log_k -8.562 + delta_h 0.703 kcal + -analytic 607.642 0.121098 -20011.25 -236.4948 + +Gypsum + CaSO4:2H2O = Ca+2 + SO4-2 + 2 H2O + log_k -4.580 + delta_h -0.109 kcal + -analytic 68.2401 0.0 -3221.51 -25.0627 + +Anhydrite + CaSO4 = Ca+2 + SO4-2 + log_k -4.360 + delta_h -1.710 kcal + -analytic 197.52 0.0 -8669.8 -69.835 + +Celestite + SrSO4 = Sr+2 + SO4-2 + log_k -6.630 + delta_h -1.037 kcal + -analytic -14805.9622 -2.4660924 756968.533 5436.3588 -40553604.0 + +Barite + BaSO4 = Ba+2 + SO4-2 + log_k -9.970 + delta_h 6.350 kcal + -analytic 136.035 0.0 -7680.41 -48.595 + +Hydroxyapatite + Ca5(PO4)3OH + 4 H+ = H2O + 3 HPO4-2 + 5 Ca+2 + log_k -3.421 + delta_h -36.155 kcal + +Fluorite + CaF2 = Ca+2 + 2 F- + log_k -10.600 + delta_h 4.690 kcal + -analytic 66.348 0.0 -4298.2 -25.271 + +SiO2(a) + SiO2 + 2 H2O = H4SiO4 + log_k -2.710 + delta_h 3.340 kcal + -analytic -0.26 0.0 -731.0 + +Chalcedony + SiO2 + 2 H2O = H4SiO4 + log_k -3.550 + delta_h 4.720 kcal + -analytic -0.09 0.0 -1032.0 + +Quartz + SiO2 + 2 H2O = H4SiO4 + log_k -3.980 + delta_h 5.990 kcal + -analytic 0.41 0.0 -1309.0 + +Gibbsite + Al(OH)3 + 3 H+ = Al+3 + 3 H2O + log_k 8.110 + delta_h -22.800 kcal + +Al(OH)3(a) + Al(OH)3 + 3 H+ = Al+3 + 3 H2O + log_k 10.800 + delta_h -26.500 kcal + +Kaolinite + Al2Si2O5(OH)4 + 6 H+ = H2O + 2 H4SiO4 + 2 Al+3 + log_k 7.435 + delta_h -35.300 kcal + +Albite + NaAlSi3O8 + 8 H2O = Na+ + Al(OH)4- + 3 H4SiO4 + log_k -18.002 + delta_h 25.896 kcal + +Anorthite + CaAl2Si2O8 + 8 H2O = Ca+2 + 2 Al(OH)4- + 2 H4SiO4 + log_k -19.714 + delta_h 11.580 kcal + +K-feldspar + KAlSi3O8 + 8 H2O = K+ + Al(OH)4- + 3 H4SiO4 + log_k -20.573 + delta_h 30.820 kcal + +K-mica + KAl3Si3O10(OH)2 + 10 H+ = K+ + 3 Al+3 + 3 H4SiO4 + log_k 12.703 + delta_h -59.376 kcal + +Chlorite(14A) + Mg5Al2Si3O10(OH)8 + 16H+ = 5Mg+2 + 2Al+3 + 3H4SiO4 + 6H2O + log_k 68.38 + delta_h -151.494 kcal + +Ca-Montmorillonite + Ca0.165Al2.33Si3.67O10(OH)2 + 12 H2O = 0.165Ca+2 + 2.33 Al(OH)4- + 3.67 H4SiO4 + 2 H+ + log_k -45.027 + delta_h 58.373 kcal + +Talc + Mg3Si4O10(OH)2 + 4 H2O + 6 H+ = 3 Mg+2 + 4 H4SiO4 + log_k 21.399 + delta_h -46.352 kcal + +Illite + K0.6Mg0.25Al2.3Si3.5O10(OH)2 + 11.2H2O = 0.6K+ + 0.25Mg+2 + 2.3Al(OH)4- + 3.5H4SiO4 + 1.2H+ + log_k -40.267 + delta_h 54.684 kcal + +Chrysotile + Mg3Si2O5(OH)4 + 6 H+ = H2O + 2 H4SiO4 + 3 Mg+2 + log_k 32.200 + delta_h -46.800 kcal + -analytic 13.248 0.0 10217.1 -6.1894 + +Sepiolite + Mg2Si3O7.5OH:3H2O + 4 H+ + 0.5H2O = 2 Mg+2 + 3 H4SiO4 + log_k 15.760 + delta_h -10.700 kcal + +Sepiolite(d) + Mg2Si3O7.5OH:3H2O + 4 H+ + 0.5H2O = 2 Mg+2 + 3 H4SiO4 + log_k 18.660 + +Hematite + Fe2O3 + 6 H+ = 2 Fe+3 + 3 H2O + log_k -4.008 + delta_h -30.845 kcal + +Goethite + FeOOH + 3 H+ = Fe+3 + 2 H2O + log_k -1.000 + delta_h -14.48 kcal + +Fe(OH)3(a) + Fe(OH)3 + 3 H+ = Fe+3 + 3 H2O + log_k 4.891 + +Pyrite + FeS2 + 2 H+ + 2 e- = Fe+2 + 2 HS- + log_k -18.479 + delta_h 11.300 kcal + +FeS(ppt) + FeS + H+ = Fe+2 + HS- + log_k -3.915 + +Mackinawite + FeS + H+ = Fe+2 + HS- + log_k -4.648 + +Sulfur + S + 2H+ + 2e- = H2S + log_k 4.882 + delta_h -9.5 kcal + +Vivianite + Fe3(PO4)2:8H2O = 3 Fe+2 + 2 PO4-3 + 8 H2O + log_k -36.000 + +Pyrolusite + MnO2 + 4 H+ + 2 e- = Mn+2 + 2 H2O + log_k 41.380 + delta_h -65.110 kcal + +Hausmannite + Mn3O4 + 8 H+ + 2 e- = 3 Mn+2 + 4 H2O + log_k 61.030 + delta_h -100.640 kcal + +Manganite + MnOOH + 3 H+ + e- = Mn+2 + 2 H2O + log_k 25.340 + +Pyrochroite + Mn(OH)2 + 2 H+ = Mn+2 + 2 H2O + log_k 15.200 + +Halite + NaCl = Na+ + Cl- + log_k 1.582 + delta_h 0.918 kcal + +CO2(g) + CO2 = CO2 + log_k -1.468 + delta_h -4.776 kcal + -analytic 108.3865 0.01985076 -6919.53 -40.45154 669365.0 + +O2(g) + O2 = O2 + log_k -2.960 + delta_h -1.844 kcal + +H2(g) + H2 = H2 + log_k -3.150 + delta_h -1.759 kcal + +H2O(g) + H2O = H2O + log_k 1.51 + delta_h -44.03 kJ +# Stumm and Morgan, from NBS and Robie, Hemmingway, and Fischer (1978) + +N2(g) + N2 = N2 + log_k -3.260 + delta_h -1.358 kcal + +H2S(g) + H2S = H2S + log_k -0.997 + delta_h -4.570 kcal + +CH4(g) + CH4 = CH4 + log_k -2.860 + delta_h -3.373 kcal + +NH3(g) + NH3 = NH3 + log_k 1.770 + delta_h -8.170 kcal + +Melanterite + FeSO4:7H2O = 7 H2O + Fe+2 + SO4-2 + log_k -2.209 + delta_h 4.910 kcal + -analytic 1.447 -0.004153 0.0 0.0 -214949.0 + +Alunite + KAl3(SO4)2(OH)6 + 6 H+ = K+ + 3 Al+3 + 2 SO4-2 + 6H2O + log_k -1.400 + delta_h -50.250 kcal + +Jarosite-K + KFe3(SO4)2(OH)6 + 6 H+ = 3 Fe+3 + 6 H2O + K+ + 2 SO4-2 + log_k -9.210 + delta_h -31.280 kcal + +Zn(OH)2(e) + Zn(OH)2 + 2 H+ = Zn+2 + 2 H2O + log_k 11.50 + +Smithsonite + ZnCO3 = Zn+2 + CO3-2 + log_k -10.000 + delta_h -4.36 kcal + +Sphalerite + ZnS + H+ = Zn+2 + HS- + log_k -11.618 + delta_h 8.250 kcal + +Willemite 289 + Zn2SiO4 + 4H+ = 2Zn+2 + H4SiO4 + log_k 15.33 + delta_h -33.37 kcal + +Cd(OH)2 + Cd(OH)2 + 2 H+ = Cd+2 + 2 H2O + log_k 13.650 + +Otavite 315 + CdCO3 = Cd+2 + CO3-2 + log_k -12.1 + delta_h -0.019 kcal + +CdSiO3 328 + CdSiO3 + H2O + 2H+ = Cd+2 + H4SiO4 + log_k 9.06 + delta_h -16.63 kcal + +CdSO4 329 + CdSO4 = Cd+2 + SO4-2 + log_k -0.1 + delta_h -14.74 kcal + +Cerrusite 365 + PbCO3 = Pb+2 + CO3-2 + log_k -13.13 + delta_h 4.86 kcal + +Anglesite 384 + PbSO4 = Pb+2 + SO4-2 + log_k -7.79 + delta_h 2.15 kcal + +Pb(OH)2 389 + Pb(OH)2 + 2H+ = Pb+2 + 2H2O + log_k 8.15 + delta_h -13.99 kcal + +EXCHANGE_MASTER_SPECIES + X X- +EXCHANGE_SPECIES + X- = X- + log_k 0.0 + + Na+ + X- = NaX + log_k 0.0 + -gamma 4.0 0.075 + + K+ + X- = KX + log_k 0.7 + -gamma 3.5 0.015 + delta_h -4.3 # Jardine & Sparks, 1984 + + Li+ + X- = LiX + log_k -0.08 + -gamma 6.0 0.0 + delta_h 1.4 # Merriam & Thomas, 1956 + + NH4+ + X- = NH4X + log_k 0.6 + -gamma 2.5 0.0 + delta_h -2.4 # Laudelout et al., 1968 + + Ca+2 + 2X- = CaX2 + log_k 0.8 + -gamma 5.0 0.165 + delta_h 7.2 # Van Bladel & Gheyl, 1980 + + Mg+2 + 2X- = MgX2 + log_k 0.6 + -gamma 5.5 0.2 + delta_h 7.4 # Laudelout et al., 1968 + + Sr+2 + 2X- = SrX2 + log_k 0.91 + -gamma 5.26 0.121 + delta_h 5.5 # Laudelout et al., 1968 + + Ba+2 + 2X- = BaX2 + log_k 0.91 + -gamma 5.0 0.0 + delta_h 4.5 # Laudelout et al., 1968 + + Mn+2 + 2X- = MnX2 + log_k 0.52 + -gamma 6.0 0.0 + + Fe+2 + 2X- = FeX2 + log_k 0.44 + -gamma 6.0 0.0 + + Cu+2 + 2X- = CuX2 + log_k 0.6 + -gamma 6.0 0.0 + + Zn+2 + 2X- = ZnX2 + log_k 0.8 + -gamma 5.0 0.0 + + Cd+2 + 2X- = CdX2 + log_k 0.8 + + Pb+2 + 2X- = PbX2 + log_k 1.05 + + Al+3 + 3X- = AlX3 + log_k 0.41 + -gamma 9.0 0.0 + + AlOH+2 + 2X- = AlOHX2 + log_k 0.89 + -gamma 0.0 0.0 +SURFACE_MASTER_SPECIES + Hfo_s Hfo_sOH + Hfo_w Hfo_wOH +SURFACE_SPECIES +# All surface data from +# Dzombak and Morel, 1990 +# +# +# Acid-base data from table 5.7 +# +# strong binding site--Hfo_s, + + Hfo_sOH = Hfo_sOH + log_k 0.0 + + Hfo_sOH + H+ = Hfo_sOH2+ + log_k 7.29 # = pKa1,int + + Hfo_sOH = Hfo_sO- + H+ + log_k -8.93 # = -pKa2,int + +# weak binding site--Hfo_w + + Hfo_wOH = Hfo_wOH + log_k 0.0 + + Hfo_wOH + H+ = Hfo_wOH2+ + log_k 7.29 # = pKa1,int + + Hfo_wOH = Hfo_wO- + H+ + log_k -8.93 # = -pKa2,int + +############################################### +# CATIONS # +############################################### +# +# Cations from table 10.1 or 10.5 +# +# Calcium + Hfo_sOH + Ca+2 = Hfo_sOHCa+2 + log_k 4.97 + + Hfo_wOH + Ca+2 = Hfo_wOCa+ + H+ + log_k -5.85 +# Strontium + Hfo_sOH + Sr+2 = Hfo_sOHSr+2 + log_k 5.01 + + Hfo_wOH + Sr+2 = Hfo_wOSr+ + H+ + log_k -6.58 + + Hfo_wOH + Sr+2 + H2O = Hfo_wOSrOH + 2H+ + log_k -17.60 +# Barium + Hfo_sOH + Ba+2 = Hfo_sOHBa+2 + log_k 5.46 + + Hfo_wOH + Ba+2 = Hfo_wOBa+ + H+ + log_k -7.2 # table 10.5 +# +# Cations from table 10.2 +# +# Cadmium + Hfo_sOH + Cd+2 = Hfo_sOCd+ + H+ + log_k 0.47 + + Hfo_wOH + Cd+2 = Hfo_wOCd+ + H+ + log_k -2.91 +# Zinc + Hfo_sOH + Zn+2 = Hfo_sOZn+ + H+ + log_k 0.99 + + Hfo_wOH + Zn+2 = Hfo_wOZn+ + H+ + log_k -1.99 +# Copper + Hfo_sOH + Cu+2 = Hfo_sOCu+ + H+ + log_k 2.89 + + Hfo_wOH + Cu+2 = Hfo_wOCu+ + H+ + log_k 0.6 # table 10.5 +# Lead + Hfo_sOH + Pb+2 = Hfo_sOPb+ + H+ + log_k 4.65 + + Hfo_wOH + Pb+2 = Hfo_wOPb+ + H+ + log_k 0.3 # table 10.5 +# +# Derived constants table 10.5 +# +# Magnesium + Hfo_wOH + Mg+2 = Hfo_wOMg+ + H+ + log_k -4.6 +# Manganese + Hfo_sOH + Mn+2 = Hfo_sOMn+ + H+ + log_k -0.4 # table 10.5 + + Hfo_wOH + Mn+2 = Hfo_wOMn+ + H+ + log_k -3.5 # table 10.5 +# Iron +# Hfo_sOH + Fe+2 = Hfo_sOFe+ + H+ +# log_k 0.7 # LFER using table 10.5 + +# Hfo_wOH + Fe+2 = Hfo_wOFe+ + H+ +# log_k -2.5 # LFER using table 10.5 + +# Iron, strong site: Appelo, Van der Weiden, Tournassat & Charlet, subm. + Hfo_sOH + Fe+2 = Hfo_sOFe+ + H+ + log_k -0.95 +# Iron, weak site: Liger et al., GCA 63, 2939, re-optimized for D&M + Hfo_wOH + Fe+2 = Hfo_wOFe+ + H+ + log_k -2.98 + + Hfo_wOH + Fe+2 + H2O = Hfo_wOFeOH + 2H+ + log_k -11.55 + +############################################### +# ANIONS # +############################################### +# +# Anions from table 10.6 +# +# Phosphate + Hfo_wOH + PO4-3 + 3H+ = Hfo_wH2PO4 + H2O + log_k 31.29 + + Hfo_wOH + PO4-3 + 2H+ = Hfo_wHPO4- + H2O + log_k 25.39 + + Hfo_wOH + PO4-3 + H+ = Hfo_wPO4-2 + H2O + log_k 17.72 +# +# Anions from table 10.7 +# +# Borate + Hfo_wOH + H3BO3 = Hfo_wH2BO3 + H2O + log_k 0.62 +# +# Anions from table 10.8 +# +# Sulfate + Hfo_wOH + SO4-2 + H+ = Hfo_wSO4- + H2O + log_k 7.78 + + Hfo_wOH + SO4-2 = Hfo_wOHSO4-2 + log_k 0.79 +# +# Derived constants table 10.10 +# + Hfo_wOH + F- + H+ = Hfo_wF + H2O + log_k 8.7 + + Hfo_wOH + F- = Hfo_wOHF- + log_k 1.6 +# +# Carbonate: Van Geen et al., 1994 reoptimized for HFO +# 0.15 g HFO/L has 0.344 mM sites == 2 g of Van Geen's Goethite/L +# +# Hfo_wOH + CO3-2 + H+ = Hfo_wCO3- + H2O +# log_k 12.56 +# +# Hfo_wOH + CO3-2 + 2H+= Hfo_wHCO3 + H2O +# log_k 20.62 + +# 9/19/96 +# Added analytical expression for H2S, NH3, KSO4. +# Added species CaHSO4+. +# Added delta H for Goethite. + +RATES + +########### +#K-feldspar +########### +# +# Sverdrup, H.U., 1990, The kinetics of base cation release due to +# chemical weathering: Lund University Press, Lund, 246 p. +# +# Example of KINETICS data block for K-feldspar rate: +# KINETICS 1 +# K-feldspar +# -m0 2.16 # 10% K-fsp, 0.1 mm cubes +# -m 1.94 +# -parms 1.36e4 0.1 + +K-feldspar + -start + 1 rem specific rate from Sverdrup, 1990, in kmol/m2/s + 2 rem parm(1) = 10 * (A/V, 1/dm) (recalc's sp. rate to mol/kgw) + 3 rem parm(2) = corrects for field rate relative to lab rate + 4 rem temp corr: from p. 162. E (kJ/mol) / R / 2.303 = H in H*(1/T-1/298) + + 10 dif_temp = 1/TK - 1/298 + 20 pk_H = 12.5 + 3134 * dif_temp + 30 pk_w = 15.3 + 1838 * dif_temp + 40 pk_OH = 14.2 + 3134 * dif_temp + 50 pk_CO2 = 14.6 + 1677 * dif_temp + #60 pk_org = 13.9 + 1254 * dif_temp # rate increase with DOC + 70 rate = 10^-pk_H * ACT("H+")^0.5 + 10^-pk_w + 10^-pk_OH * ACT("OH-")^0.3 + 71 rate = rate + 10^-pk_CO2 * (10^SI("CO2(g)"))^0.6 + #72 rate = rate + 10^-pk_org * TOT("Doc")^0.4 + 80 moles = parm(1) * parm(2) * rate * (1 - SR("K-feldspar")) * time + 81 rem decrease rate on precipitation + 90 if SR("K-feldspar") > 1 then moles = moles * 0.1 + 100 save moles + -end + +########### +#Albite +########### +# +# Sverdrup, H.U., 1990, The kinetics of base cation release due to +# chemical weathering: Lund University Press, Lund, 246 p. +# +# Example of KINETICS data block for Albite rate: +# KINETICS 1 +# Albite +# -m0 0.43 # 2% Albite, 0.1 mm cubes +# -parms 2.72e3 0.1 + +Albite + -start + 1 rem specific rate from Sverdrup, 1990, in kmol/m2/s + 2 rem parm(1) = 10 * (A/V, 1/dm) (recalc's sp. rate to mol/kgw) + 3 rem parm(2) = corrects for field rate relative to lab rate + 4 rem temp corr: from p. 162. E (kJ/mol) / R / 2.303 = H in H*(1/T-1/298) + + 10 dif_temp = 1/TK - 1/298 + 20 pk_H = 12.5 + 3359 * dif_temp + 30 pk_w = 14.8 + 2648 * dif_temp + 40 pk_OH = 13.7 + 3359 * dif_temp + #41 rem ^12.9 in Sverdrup, but larger than for oligoclase... + 50 pk_CO2 = 14.0 + 1677 * dif_temp + #60 pk_org = 12.5 + 1254 * dif_temp # ...rate increase for DOC + 70 rate = 10^-pk_H * ACT("H+")^0.5 + 10^-pk_w + 10^-pk_OH * ACT("OH-")^0.3 + 71 rate = rate + 10^-pk_CO2 * (10^SI("CO2(g)"))^0.6 + #72 rate = rate + 10^-pk_org * TOT("Doc")^0.4 + 80 moles = parm(1) * parm(2) * rate * (1 - SR("Albite")) * time + 81 rem decrease rate on precipitation + 90 if SR("Albite") > 1 then moles = moles * 0.1 + 100 save moles + -end + +######## +#Calcite +######## +# +# Plummer, L.N., Wigley, T.M.L., and Parkhurst, D.L., 1978, +# American Journal of Science, v. 278, p. 179-216. +# +# Example of KINETICS data block for calcite rate: +# +# KINETICS 1 +# Calcite +# -tol 1e-8 +# -m0 3.e-3 +# -m 3.e-3 +# -parms 5.0 0.6 +Calcite + -start + 1 REM Modified from Plummer and others, 1978 + 2 REM M = current moles of calcite + 3 REM M0 = initial moles of calcite + 4 REM parm(1) = Area/Volume, cm^2/L (or cm^2 per cell) + 5 REM parm(2) = exponent for M/M0 for surface area correction + 10 REM rate = 0 if no calcite and undersaturated + 20 si_cc = SI("Calcite") + 30 if (M <= 0 and si_cc < 0) then goto 300 + 40 k1 = 10^(0.198 - 444.0 / TK ) + 50 k2 = 10^(2.84 - 2177.0 / TK ) + 60 if TC <= 25 then k3 = 10^(-5.86 - 317.0 / TK ) + 70 if TC > 25 then k3 = 10^(-1.1 - 1737.0 / TK ) + 80 REM surface area calculation + 90 t = 1 + 100 if M0 > 0 then t = M/M0 + 110 if t = 0 then t = 1 + 120 area = PARM(1) * (t)^PARM(2) + 130 rf = k1 * ACT("H+") + k2 * ACT("CO2") + k3 * ACT("H2O") + 140 REM 1e-3 converts mmol to mol + 150 rate = area * 1e-3 * rf * (1 - 10^(2/3*si_cc)) + 160 moles = rate * TIME + 170 REM do not dissolve more calcite than present + 180 if (moles > M) then moles = M + 190 if (moles >= 0) then goto 300 + 200 REM do not precipitate more Ca or C(4) than present + 210 temp = TOT("Ca") + 220 mc = TOT("C(4)") + 230 if mc < temp then temp = mc + 240 if -moles > temp then moles = -temp + 300 SAVE moles + -end + +####### +#Pyrite +####### +# +# Williamson, M.A. and Rimstidt, J.D., 1994, +# Geochimica et Cosmochimica Acta, v. 58, p. 5443-5454. +# +# Example of KINETICS data block for pyrite rate: +# KINETICS 1 +# Pyrite +# -tol 1e-8 +# -m0 5.e-4 +# -m 5.e-4 +# -parms 2.0 0.67 .5 -0.11 +Pyrite + -start + 1 rem Williamson and Rimstidt, 1994 + 2 rem parm(1) = log10(A/V, 1/dm) parm(2) = exp for (m/m0) + 3 rem parm(3) = exp for O2 parm(4) = exp for H+ + + 10 if (m <= 0) then goto 200 + 20 if (si("Pyrite") >= 0) then goto 200 + 20 rate = -10.19 + parm(1) + parm(3)*lm("O2") + parm(4)*lm("H+") + parm(2)*log10(m/m0) + 30 moles = 10^rate * time + 40 if (moles > m) then moles = m + 200 save moles + -end + +########## +#Organic_C +########## +# +# Example of KINETICS data block for Organic_C rate: +# KINETICS 1 +# Organic_C +# -tol 1e-8 +# # m in mol/kgw +# -m0 5e-3 +# -m 5e-3 +Organic_C + -start + 1 rem Additive Monod kinetics + 2 rem Electron acceptors: O2, NO3, and SO4 + + 10 if (m <= 0) then goto 200 + 20 mO2 = mol("O2") + 30 mNO3 = tot("N(5)") + 40 mSO4 = tot("S(6)") + 50 rate = 1.57e-9*mO2/(2.94e-4 + mO2) + 1.67e-11*mNO3/(1.55e-4 + mNO3) + 60 rate = rate + 1.e-13*mSO4/(1.e-4 + mSO4) + 70 moles = rate * m * (m/m0) * time + 80 if (moles > m) then moles = m + 200 save moles + -end + +########### +#Pyrolusite +########### +# +# Postma, D. and Appelo, C.A.J., 2000, GCA 64, in press +# +# Example of KINETICS data block for Pyrolusite +# KINETICS 1-12 +# Pyrolusite +# -tol 1.e-7 +# -m0 0.1 +# -m 0.1 +Pyrolusite + -start + 5 if (m <= 0.0) then goto 200 + 7 sr_pl = sr("Pyrolusite") + 9 if abs(1 - sr_pl) < 0.1 then goto 200 + 10 if (sr_pl > 1.0) then goto 100 + #20 rem initially 1 mol Fe+2 = 0.5 mol pyrolusite. k*A/V = 1/time (3 cells) + #22 rem time (3 cells) = 1.432e4. 1/time = 6.98e-5 + 30 Fe_t = tot("Fe(2)") + 32 if Fe_t < 1.e-8 then goto 200 + 40 moles = 6.98e-5 * Fe_t * (m/m0)^0.67 * time * (1 - sr_pl) + 50 if moles > Fe_t / 2 then moles = Fe_t / 2 + 70 if moles > m then moles = m + 90 goto 200 + 100 Mn_t = tot("Mn") + 110 moles = 2e-3 * 6.98e-5 * (1-sr_pl) * time + 120 if moles <= -Mn_t then moles = -Mn_t + 200 save moles + -end +END diff --git a/testcpp/testcpp.cpp b/testcpp/testcpp.cpp new file mode 100644 index 00000000..681e88f7 --- /dev/null +++ b/testcpp/testcpp.cpp @@ -0,0 +1,24 @@ +#include +#include + +#define IPhreeqc IPhreeqc2 + +int main(int argc, char* argv[]) +{ + IPhreeqc obj; + obj.SetOutputOn(true); + if (obj.LoadDatabase("phreeqc.dat")) + { + goto error; + } + if (obj.RunFile("ex1")) + { + goto error; + } + std::cout << "Ok\n"; + return 0; +error: + std::cout << obj.GetLastErrorString(); + return 1; +} + diff --git a/testcpp/testcpp.vcproj b/testcpp/testcpp.vcproj new file mode 100644 index 00000000..853b529e --- /dev/null +++ b/testcpp/testcpp.vcproj @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testcpp/testcpp.vcproj.GS.charlton.user b/testcpp/testcpp.vcproj.GS.charlton.user new file mode 100644 index 00000000..f50373a5 --- /dev/null +++ b/testcpp/testcpp.vcproj.GS.charlton.user @@ -0,0 +1,65 @@ + + + + + + + + + + +