Tony's changes from 20180305

This commit is contained in:
David Parkhurst 2018-03-07 17:08:33 -07:00
parent b0fdcc41e4
commit 86a55b5b5d
8 changed files with 356 additions and 629 deletions

View File

@ -1134,11 +1134,8 @@ namespace zdg_ui2 {
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid)); System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
try try
{ {
#ifdef NPP //this->Icon = gcnew System::Drawing::Icon("c:\\phreeqc\\phreex.ico");
this->Icon = gcnew System::Drawing::Icon("c:\\phreeqc\\phreex.ico"); this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon")));
#else
this->Icon = (cli::safe_cast<System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon")));
#endif
} }
catch (...) catch (...)
{ {

View File

@ -106,6 +106,7 @@ public:
void Set_diffuse_layer_totals(cxxNameDouble & nd) {this->diffuse_layer_totals = nd;} void Set_diffuse_layer_totals(cxxNameDouble & nd) {this->diffuse_layer_totals = nd;}
std::map<LDBLE, cxxSurfDL> &Get_g_map(void) {return g_map;} std::map<LDBLE, cxxSurfDL> &Get_g_map(void) {return g_map;}
void Set_g_map(std::map<LDBLE, cxxSurfDL> & t) {g_map = t;} void Set_g_map(std::map<LDBLE, cxxSurfDL> & t) {g_map = t;}
std::map<LDBLE, LDBLE> &Get_z_gMCD_map(void) { return z_gMCD_map; } // z, exp(-zF Psi / RT) * fraction of dl water
std::map<int, double> & Get_dl_species_map(void) {return this->dl_species_map;} std::map<int, double> & Get_dl_species_map(void) {return this->dl_species_map;}
void Serialize(Dictionary & dictionary, std::vector < int >&ints, std::vector < double >&doubles); void Serialize(Dictionary & dictionary, std::vector < int >&ints, std::vector < double >&doubles);
void Deserialize(Dictionary & dictionary, std::vector < int >&ints, std::vector < double >&doubles, int &ii, int &dd); void Deserialize(Dictionary & dictionary, std::vector < int >&ints, std::vector < double >&doubles, int &ii, int &dd);
@ -122,6 +123,7 @@ protected:
// workspace variables // workspace variables
LDBLE sigma0, sigma1, sigma2, sigmaddl; LDBLE sigma0, sigma1, sigma2, sigmaddl;
std::map<LDBLE, cxxSurfDL> g_map; std::map<LDBLE, cxxSurfDL> g_map;
std::map<LDBLE, LDBLE> z_gMCD_map;
const static std::vector < std::string > vopts; const static std::vector < std::string > vopts;
std::map<int, double> dl_species_map; std::map<int, double> dl_species_map;
}; };

View File

@ -277,8 +277,8 @@ write_banner(void)
/* version */ /* version */
#ifdef NPP #ifdef NPP
//len = sprintf(buffer, "* PHREEQC-%s *", "3.4.1 AmpŠre"); //len = sprintf(buffer, "* PHREEQC-%s *", "3.4.2 AmpŠre");
len = sprintf(buffer, "* PHREEQC-%s *", "3.4.1"); len = sprintf(buffer, "* PHREEQC-%s *", "3.4.2");
#else #else
len = sprintf(buffer, "* PHREEQC-%s *", "@VERSION@"); len = sprintf(buffer, "* PHREEQC-%s *", "@VERSION@");
#endif #endif
@ -302,7 +302,7 @@ write_banner(void)
/* date */ /* date */
#ifdef NPP #ifdef NPP
len = sprintf(buffer, "%s", "February 15, 2018"); len = sprintf(buffer, "%s", "February 27, 2018");
#else #else
len = sprintf(buffer, "%s", "@VER_DATE@"); len = sprintf(buffer, "%s", "@VER_DATE@");
#endif #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)); screen_msg(sformatf("Database file: %s\n\n", token));
strcpy(db_file, token); strcpy(db_file, token);
#ifdef NPP #ifdef NPP
//output_msg(sformatf("Using PHREEQC: version 3.4.1 Ampère, compiled February 15, 2018\n")); //output_msg(sformatf("Using PHREEQC: version 3.4.2 Ampère, compiled February 27, 2018\n"));
#endif #endif
output_msg(sformatf(" Input file: %s\n", in_file)); output_msg(sformatf(" Input file: %s\n", in_file));
output_msg(sformatf(" Output file: %s\n", out_file)); output_msg(sformatf(" Output file: %s\n", out_file));
#ifdef NPP #ifdef NPP
output_msg(sformatf("Using PHREEQC: version 3.4.1, compiled February 15, 2018\n")); output_msg(sformatf("Using PHREEQC: version 3.4.2, compiled February 27, 2018\n"));
#endif #endif
output_msg(sformatf("Database file: %s\n\n", token)); output_msg(sformatf("Database file: %s\n\n", token));
#ifdef NPP #ifdef NPP

View File

@ -742,7 +742,7 @@ calc_all_donnan(void)
{ {
bool converge; bool converge;
int cd_m; int cd_m;
LDBLE new_g, f_psi, surf_chrg_eq, psi_avg, f_sinh, A_surf, ratio_aq; LDBLE new_g, f_psi, surf_chrg_eq, psi_avg, f_sinh, A_surf, ratio_aq, ratio_aq_tot;
LDBLE new_g2, f_psi2, surf_chrg_eq2, psi_avg2, dif, var1; LDBLE new_g2, f_psi2, surf_chrg_eq2, psi_avg2, dif, var1;
if (use.Get_surface_ptr() == NULL) if (use.Get_surface_ptr() == NULL)
@ -813,6 +813,7 @@ calc_all_donnan(void)
/* fill in g's */ /* fill in g's */
ratio_aq = charge_ptr->Get_mass_water() / mass_water_aq_x; ratio_aq = charge_ptr->Get_mass_water() / mass_water_aq_x;
ratio_aq_tot = charge_ptr->Get_mass_water() / mass_water_bulk_x;
for (it = charge_group_map.begin(); it != charge_group_map.end(); it++) for (it = charge_group_map.begin(); it != charge_group_map.end(); it++)
{ {
@ -821,13 +822,14 @@ calc_all_donnan(void)
{ {
charge_ptr->Get_g_map()[z].Set_g(0); charge_ptr->Get_g_map()[z].Set_g(0);
charge_ptr->Get_g_map()[z].Set_dg(0); charge_ptr->Get_g_map()[z].Set_dg(0);
charge_ptr->Get_z_gMCD_map()[z] = 0;
converge = true; converge = true;
continue; continue;
} }
new_g = ratio_aq * (exp(cd_m * z * psi_avg) - 1); new_g = ratio_aq * (exp(cd_m * z * psi_avg) - 1);
if (use.Get_surface_ptr()->Get_only_counter_ions() && if (use.Get_surface_ptr()->Get_only_counter_ions() && surf_chrg_eq * z > 0)
((surf_chrg_eq < 0 && z < 0) //((surf_chrg_eq < 0 && z < 0)
|| (surf_chrg_eq > 0 && z > 0))) // || (surf_chrg_eq > 0 && z > 0)))
new_g = -ratio_aq; new_g = -ratio_aq;
if (new_g <= -ratio_aq) if (new_g <= -ratio_aq)
new_g = -ratio_aq + G_TOL * 1e-3; new_g = -ratio_aq + G_TOL * 1e-3;
@ -861,7 +863,19 @@ calc_all_donnan(void)
{ {
charge_ptr->Get_g_map()[z].Set_dg(-z); charge_ptr->Get_g_map()[z].Set_dg(-z);
} }
/* save g for species */ /* save Boltzmann factor * water fraction for MCD calc's in transport */
if (converge)
{
if (use.Get_surface_ptr()->Get_only_counter_ions())
{
if (surf_chrg_eq * z > 0) // co-ions are not in the DL
charge_ptr->Get_z_gMCD_map()[z] = 0;
else // assume that counter-ions have the free water conc for diffusion
charge_ptr->Get_z_gMCD_map()[z] = ratio_aq_tot;
}
else
charge_ptr->Get_z_gMCD_map()[z] = (new_g / ratio_aq + 1) * ratio_aq_tot;
}
} }
if (debug_diffuse_layer == TRUE) if (debug_diffuse_layer == TRUE)
{ {

View File

@ -2303,7 +2303,6 @@ model_pz(void)
{ {
count_basis_change++; count_basis_change++;
//count_unknowns -= (int) s_list.size();
count_unknowns -= count_s_x; count_unknowns -= count_s_x;
reprep(); reprep();
full_pitzer = false; full_pitzer = false;

View File

@ -2286,13 +2286,13 @@ print_totals(void)
"Total alkalinity (eq/kg) = ", "Total alkalinity (eq/kg) = ",
(double) (total_alkalinity / mass_water_aq_x))); (double) (total_alkalinity / mass_water_aq_x)));
} }
if (carbon_unknown == NULL && total_carbon > 0.0) if (carbon_unknown == NULL && total_carbon)
{ {
output_msg(sformatf("%45s%11.3e\n", output_msg(sformatf("%45s%11.3e\n",
"Total carbon (mol/kg) = ", "Total carbon (mol/kg) = ",
(double) (total_carbon / mass_water_aq_x))); (double) (total_carbon / mass_water_aq_x)));
} }
if (total_co2 > 0.0) if (total_co2)
output_msg(sformatf("%45s%11.3e\n", "Total CO2 (mol/kg) = ", output_msg(sformatf("%45s%11.3e\n", "Total CO2 (mol/kg) = ",
(double) (total_co2 / mass_water_aq_x))); (double) (total_co2 / mass_water_aq_x)));
#ifdef NO_UTF8_ENCODING #ifdef NO_UTF8_ENCODING
@ -2309,7 +2309,7 @@ print_totals(void)
(double) patm_x)); (double) patm_x));
} }
if (potV_x != 0.0) if (potV_x)
{ {
output_msg(sformatf("%45s%5.2f\n", "Electrical Potential (Volt) = ", output_msg(sformatf("%45s%5.2f\n", "Electrical Potential (Volt) = ",
(double)potV_x)); (double)potV_x));

View File

@ -1313,7 +1313,6 @@ model_sit(void)
{ {
count_basis_change++; count_basis_change++;
//count_unknowns -= (int) s_list.size();
count_unknowns -= count_s_x; count_unknowns -= count_s_x;
reprep(); reprep();
full_pitzer = false; full_pitzer = false;

File diff suppressed because it is too large Load Diff