diff --git a/src/phreeqcpp/Phreeqc.cpp b/src/phreeqcpp/Phreeqc.cpp index 55e52146..0bb5116e 100644 --- a/src/phreeqcpp/Phreeqc.cpp +++ b/src/phreeqcpp/Phreeqc.cpp @@ -1001,7 +1001,11 @@ void Phreeqc::init(void) /* phrq_io_output.cpp ------------------------------- */ forward_output_to_log = 0; /* phreeqc_files.cpp ------------------------------- */ - default_data_base = string_duplicate("phreeqc.dat"); +#ifdef NPP + default_data_base = string_duplicate("c:\\phreeqc\\database\\phreeqc.dat"); +#else + default_data_base = string_duplicate("phreeqc.dat"); +#endif #ifdef PHREEQ98 int outputlinenr; char *LogFileNameC; diff --git a/src/phreeqcpp/class_main.cpp b/src/phreeqcpp/class_main.cpp index 88e19156..a67f1d06 100644 --- a/src/phreeqcpp/class_main.cpp +++ b/src/phreeqcpp/class_main.cpp @@ -277,8 +277,8 @@ write_banner(void) /* version */ #ifdef NPP - //len = sprintf(buffer, "* PHREEQC-%s *", "3.4.2 AmpŠre"); - len = sprintf(buffer, "* PHREEQC-%s *", "3.4.2"); + //len = sprintf(buffer, "* PHREEQC-%s *", "3.4.4 AmpŠre"); + len = sprintf(buffer, "* PHREEQC-%s *", "3.4.4"); #else len = sprintf(buffer, "* PHREEQC-%s *", "@VERSION@"); #endif @@ -302,7 +302,7 @@ write_banner(void) /* date */ #ifdef NPP - len = sprintf(buffer, "%s", "February 27, 2018"); + len = sprintf(buffer, "%s", "April 5, 2018"); #else len = sprintf(buffer, "%s", "@VER_DATE@"); #endif @@ -492,12 +492,12 @@ process_file_names(int argc, char *argv[], std::istream **db_cookie, screen_msg(sformatf("Database file: %s\n\n", token)); strcpy(db_file, token); #ifdef NPP - //output_msg(sformatf("Using PHREEQC: version 3.4.2 Ampère, compiled February 27, 2018\n")); + //output_msg(sformatf("Using PHREEQC: version 3.4.4 Ampère, compiled April 5, 2018\n")); #endif output_msg(sformatf(" Input file: %s\n", in_file)); output_msg(sformatf(" Output file: %s\n", out_file)); #ifdef NPP - output_msg(sformatf("Using PHREEQC: version 3.4.2, compiled February 27, 2018\n")); + output_msg(sformatf("Using PHREEQC: version 3.4.4, compiled April 5, 2018\n")); #endif output_msg(sformatf("Database file: %s\n\n", token)); #ifdef NPP diff --git a/src/phreeqcpp/integrate.cpp b/src/phreeqcpp/integrate.cpp index fa3fb255..aec69a1a 100644 --- a/src/phreeqcpp/integrate.cpp +++ b/src/phreeqcpp/integrate.cpp @@ -754,6 +754,7 @@ calc_all_donnan(void) /* * calculate g for each surface... */ + initial_surface_water(); converge = TRUE; for (int j = 0; j < count_unknowns; j++) { @@ -791,9 +792,9 @@ calc_all_donnan(void) cd_m = -1; } surf_chrg_eq = A_surf * f_sinh * sinh(f_psi) / F_C_MOL; - if (surf_chrg_eq < -5e3) + if (fabs(surf_chrg_eq) > 5e3) { - surf_chrg_eq = -5e3; + surf_chrg_eq = (surf_chrg_eq < 0 ? -5e3 : 5e3); var1 = surf_chrg_eq / (A_surf * f_sinh / F_C_MOL); var1 = (var1 + sqrt(var1 * var1 + 1)); f_psi = (var1 > 1e-8 ? log(var1) : -18.4); @@ -1053,15 +1054,13 @@ calc_psi_avg(cxxSurfaceCharge *charge_ptr, LDBLE surf_chrg_eq) for (it = charge_group_map.begin(); it != charge_group_map.end(); it++) { LDBLE z = it->first; + if (!z || (use.Get_surface_ptr()->Get_only_counter_ions() && surf_chrg_eq * z > 0)) + continue; LDBLE eq = it->second; /* multiply with ratio_aq for multiplier options cp and cm in calc_all_donnan (not used now)... */ temp = exp(-z * p) * ratio_aq; - if (use.Get_surface_ptr()->Get_only_counter_ions() && - ((surf_chrg_eq < 0 && z < 0) - || (surf_chrg_eq > 0 && z > 0))) - temp = 0.0; fd += eq * temp; fd1 -= z * eq * temp; } diff --git a/src/phreeqcpp/kinetics.cpp b/src/phreeqcpp/kinetics.cpp index 9b50c43e..8af6cafc 100644 --- a/src/phreeqcpp/kinetics.cpp +++ b/src/phreeqcpp/kinetics.cpp @@ -2539,7 +2539,6 @@ run_reactions(int i, LDBLE kin_time, int use_mix, LDBLE step_fraction) iopt[j] = 0; ropt[j] = 0; } - /* * Do mix first */ @@ -2552,9 +2551,9 @@ run_reactions(int i, LDBLE kin_time, int use_mix, LDBLE step_fraction) cvode_rate_sim_time = rate_sim_time; if (multi_Dflag) - converge = set_and_run_wrapper(i, NOMIX, FALSE, i, 0.0); + converge = set_and_run_wrapper(i, NOMIX, FALSE, i, step_fraction); else - converge = set_and_run_wrapper(i, use_mix, FALSE, i, 0.0); + converge = set_and_run_wrapper(i, use_mix, FALSE, i, step_fraction); if (converge == MASS_BALANCE) error_msg ("Negative concentration in system. Stopping calculation.", @@ -2570,7 +2569,6 @@ run_reactions(int i, LDBLE kin_time, int use_mix, LDBLE step_fraction) { cvode_ss_assemblage_save = new cxxSSassemblage(*ss_assemblage_ptr); } - /* allocate space for CVODE */ kinetics_machEnv = M_EnvInit_Serial(n_reactions); kinetics_machEnv->phreeqc_ptr = this; @@ -2735,8 +2733,8 @@ run_reactions(int i, LDBLE kin_time, int use_mix, LDBLE step_fraction) use.Set_ss_assemblage_ptr(Utilities::Rxn_find(Rxn_ss_assemblage_map, cvode_ss_assemblage_save->Get_n_user())); } calc_final_kinetic_reaction(kinetics_ptr); - if (set_and_run_wrapper(i, NOMIX, TRUE, nsaver, 1.0) == - MASS_BALANCE) + if (set_and_run_wrapper(i, NOMIX, TRUE, nsaver, 0) == + MASS_BALANCE) { /*error_msg("FAIL 2 after successful integration in CVode", CONTINUE); */ warning_msg("FAIL 2 after successful integration in CVode"); diff --git a/src/phreeqcpp/model.cpp b/src/phreeqcpp/model.cpp index 818bfdff..0700ae16 100644 --- a/src/phreeqcpp/model.cpp +++ b/src/phreeqcpp/model.cpp @@ -3749,7 +3749,7 @@ reset(void) (double) mass_water_surfaces_x)); } x[i]->master[0]->s->moles = mass_water_aq_x / gfw_water; -/*appt */ + if (use.Get_surface_ptr() != NULL) { if (use.Get_surface_ptr()->Get_debye_lengths() > 0) diff --git a/src/phreeqcpp/readtr.cpp b/src/phreeqcpp/readtr.cpp index f63d76d6..54d13d9c 100644 --- a/src/phreeqcpp/readtr.cpp +++ b/src/phreeqcpp/readtr.cpp @@ -905,7 +905,7 @@ read_transport(void) cell_data[punch_temp[i]].punch = TRUE; } } - else if (simul_tr == 1) + else if (simul_tr == 1 || old_cells != count_cells) for (i = 0; i < all_cells; i++) cell_data[i].punch = TRUE; /* @@ -928,7 +928,7 @@ read_transport(void) cell_data[print_temp[i]].print = TRUE; } } - else if (simul_tr == 1) + else if (simul_tr == 1 || old_cells != count_cells) for (i = 0; i < all_cells; i++) cell_data[i].print = TRUE; //#define OLD_POROSITY