Skip to content

Commit

Permalink
Squashed 'src/phast/PhreeqcRM/' changes from 158df405..eeaef501
Browse files Browse the repository at this point in the history
eeaef501 Merge commit 'a8d7cd2842a31971fc695b7dc840f84ee5120cf1'
a8d7cd28 Squashed 'src/' changes from 8717ceaa..17e19110

git-subtree-dir: src/phast/PhreeqcRM
git-subtree-split: eeaef501e2a7344ced6db15128a62e5eb3399630
  • Loading branch information
Darth Vader committed Aug 29, 2024
1 parent 391f80c commit 0bbbef6
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 47 deletions.
2 changes: 2 additions & 0 deletions src/IPhreeqcPhast/IPhreeqc/phreeqcpp/PBasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4732,6 +4732,8 @@ factor(struct LOC_exec * LINK)

case tokviscos:
{
if (PhreeqcPtr->print_viscosity)
PhreeqcPtr->viscosity(nullptr);
n.UU.val = (parse_all) ? 1 : PhreeqcPtr->viscos;
}
break;
Expand Down
37 changes: 34 additions & 3 deletions src/IPhreeqcPhast/IPhreeqc/phreeqcpp/basicsubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,11 @@ diff_c(const char *species_name)

Dw *= viscos_0_25 / viscos_0;
}
if (s_ptr->dw_a_v_dif)
if (s_ptr->dw_a_v_dif && print_viscosity)
{
viscosity(nullptr);
Dw *= pow(viscos_0 / viscos, s_ptr->dw_a_v_dif);
}
return Dw;
}

Expand Down Expand Up @@ -235,8 +238,11 @@ setdiff_c(const char *species_name, double d, double d_v_d)

Dw *= viscos_0_25 / viscos_0;
}
if (d_v_d)
Dw *= pow(viscos_0 / viscos, d_v_d);
if (d_v_d && print_viscosity)
{
viscosity(nullptr);
Dw *= pow(viscos_0 / viscos, s_ptr->dw_a_v_dif);
}
return Dw;
}
/* ---------------------------------------------------------------------- */
Expand Down Expand Up @@ -269,6 +275,8 @@ calc_SC(void)
// }
//}
av = 0;
if (print_viscosity)
viscosity(nullptr);
if (!Falk)
{
for (i = 0; i < (int)this->s_x.size(); i++)
Expand Down Expand Up @@ -1171,6 +1179,29 @@ diff_layer_total(const char* total_name, const char* surface_name)
return (0);
}
}
else if (strcmp_nocase("viscos_ddl", total_name) == 0)
{
if (dl_type_x != cxxSurface::NO_DL)
{
cxxSurfaceCharge* charge_ptr = use.Get_surface_ptr()->Find_charge(x[j]->surface_charge);
if (charge_ptr->Get_mass_water() > 0)
{
cxxSurface * surf_ptr = use.Get_surface_ptr();
if (surf_ptr->Get_calc_viscosity())
{
viscosity(surf_ptr);
viscosity(nullptr);
return charge_ptr->Get_DDL_viscosity();
}
else
return charge_ptr->Get_DDL_viscosity() * viscos;
}
}
else
{
return (0);
}
}
/*
* find total moles of each element in diffuse layer...
*/
Expand Down
85 changes: 75 additions & 10 deletions src/IPhreeqcPhast/IPhreeqc/phreeqcpp/class_main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef NPP
#ifdef DOS
#include <windows.h>
#endif
#endif
#include "Phreeqc.h"

#include "NameDouble.h"
Expand Down Expand Up @@ -122,12 +124,18 @@ main_method(int argc, char *argv[])
{
return errors;
}
#ifdef NPP
#ifdef DOS
write_banner();
#endif
#else
#ifndef NO_UTF8_ENCODING
#ifdef DOS
SetConsoleOutputCP(CP_UTF8);
#endif
write_banner();
#endif
#endif

/*
* Initialize arrays
Expand Down Expand Up @@ -214,11 +222,17 @@ main_method(int argc, char *argv[])
{
return errors;
}
#ifdef NPP
#ifdef DOS
write_banner();
#endif
#else
#ifndef NO_UTF8_ENCODING
#ifdef DOS
SetConsoleOutputCP(CP_UTF8);
#endif
write_banner();
#endif
#endif

/*
Expand Down Expand Up @@ -281,6 +295,7 @@ main_method(int argc, char *argv[])
return 0;
}
#endif //TEST_COPY
#ifdef NPP
/* ---------------------------------------------------------------------- */
int Phreeqc::
write_banner(void)
Expand All @@ -293,16 +308,69 @@ write_banner(void)
char buffer[80];
int len, indent;
screen_msg(
" █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█\n");
" ÛßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßÛ\n");
screen_msg(
" \n");
" º º\n");

/* version */
#ifdef NPP
len = sprintf(buffer, "* PHREEQC-%s *", "3.7.3");
len = sprintf(buffer, "* PHREEQC-%s *", "3.8.0");
#else
len = snprintf(buffer, sizeof(buffer), "* PHREEQC-%s *", "@VERSION@");
len = sprintf(buffer, "* PHREEQC-%s *", "@VERSION@");
#endif
indent = (49 - len) / 2;
screen_msg(sformatf("%14cº%*c%s%*cº\n", ' ', indent, ' ', buffer,
49 - indent - len, ' '));

screen_msg(
" º º\n");
screen_msg(
" º A hydrogeochemical transport model º\n");
screen_msg(
" º º\n");
screen_msg(
" º by º\n");
screen_msg(
" º D.L. Parkhurst and C.A.J. Appelo º\n");
screen_msg(
" º º\n");


/* date */
#ifdef NPP
len = sprintf(buffer, "%s", "August 27, 2024, with bug-fixes and new items");
#else
len = sprintf(buffer, "%s", "@VER_DATE@");
#endif
indent = (49 - len) / 2;
screen_msg(sformatf("%14cº%*c%s%*cº\n", ' ', indent, ' ', buffer,
49 - indent - len, ' '));

screen_msg(
" ÛÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÛ\n\n");

#endif
return 0;
}
#else
/* ---------------------------------------------------------------------- */
int Phreeqc::
write_banner(void)
/* ---------------------------------------------------------------------- */
{
#ifdef TESTING
return OK;
#endif
#ifndef NO_UTF8_ENCODING
char buffer[80];
int len, indent;
screen_msg(
" █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█\n");
screen_msg(
" ║ ║\n");

/* version */
len = snprintf(buffer, sizeof(buffer), "* PHREEQC-%s *", "@VERSION@");
indent = (44 - len) / 2;
screen_msg(sformatf("%14c║%*c%s%*c║\n", ' ', indent, ' ', buffer,
44 - indent - len, ' '));
Expand All @@ -322,11 +390,7 @@ write_banner(void)


/* date */
#ifdef NPP
len = sprintf(buffer, "%s", "March 14, 2024, with bug-fixes and new items");
#else
len = snprintf(buffer, sizeof(buffer), "%s", "@VER_DATE@");
#endif
indent = (44 - len) / 2;
screen_msg(sformatf("%14c║%*c%s%*c║\n", ' ', indent, ' ', buffer,
44 - indent - len, ' '));
Expand All @@ -336,6 +400,7 @@ write_banner(void)
#endif
return 0;
}
#endif

/* ---------------------------------------------------------------------- */
int Phreeqc::
Expand Down Expand Up @@ -507,7 +572,7 @@ process_file_names(int argc, char *argv[], std::istream **db_cookie,
output_msg(sformatf(" Input file: %s\n", in_file.c_str()));
output_msg(sformatf(" Output file: %s\n", out_file.c_str()));
#ifdef NPP
output_msg(sformatf("Using PHREEQC: version 3.7.3, compiled March 14, 2024, with bug-fixes and new items\n"));
output_msg(sformatf("Using PHREEQC: version 3.8.2, compiled August 27, 2024, with bug-fixes and new items\n"));
#endif
output_msg(sformatf("Database file: %s\n\n", token.c_str()));
#ifdef NPP
Expand All @@ -516,7 +581,7 @@ process_file_names(int argc, char *argv[], std::istream **db_cookie,
/*
* local cleanup
*/

line = (char *) free_check_null(line);
line_save = (char *) free_check_null(line_save);

Expand Down
26 changes: 18 additions & 8 deletions src/IPhreeqcPhast/IPhreeqc/phreeqcpp/print.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//Note to encode in ANSI with NP++
#include "Utils.h"
#include "Phreeqc.h"
#include "phqalloc.h"
Expand Down Expand Up @@ -270,14 +271,23 @@ print_diffuse_layer(cxxSurfaceCharge *charge_ptr)
output_msg(sformatf(
"\tWater in diffuse layer: %8.3e kg, %4.1f%% of total DDL-water.\n",
(double) charge_ptr->Get_mass_water(), (double) d));
if (charge_ptr->Get_DDL_viscosity())
if (print_viscosity && d > 0)
{
if (d == 100)
output_msg(sformatf(
"\t\t viscosity: %7.5f mPa s.\n", (double)charge_ptr->Get_DDL_viscosity()));
cxxSurface * surf_ptr = use.Get_surface_ptr();
if (surf_ptr->Get_calc_viscosity())
{
viscosity(surf_ptr);
viscosity(nullptr);
if (d == 100)
output_msg(sformatf(
"\t\t calculated viscosity: %7.5f mPa s.\n", (double)charge_ptr->Get_DDL_viscosity()));
else
output_msg(sformatf(
"\t\t calculated viscosity: %7.5f mPa s for this DDL water. (%7.5f mPa s for total DDL-water.)\n", (double)charge_ptr->Get_DDL_viscosity(), (double)use.Get_surface_ptr()->Get_DDL_viscosity()));
}
else
output_msg(sformatf(
"\t\t viscosity: %7.5f mPa s for this DDL water. (%7.5f mPa s for total DDL-water.)\n", (double)charge_ptr->Get_DDL_viscosity(), (double)use.Get_surface_ptr()->Get_DDL_viscosity()));
output_msg(sformatf(
"\t\t viscosity: %7.5f mPa s for DDL water.\n", (double)charge_ptr->Get_DDL_viscosity() * viscos));
}

if (use.Get_surface_ptr()->Get_debye_lengths() > 0 && d > 0)
Expand Down Expand Up @@ -2256,8 +2266,8 @@ print_totals(void)
//#ifdef NPP
if (print_viscosity)
{
output_msg(sformatf("%45s%9.5f", "Viscosity (mPa s) = ",
(double) viscos));
viscosity(nullptr);
output_msg(sformatf("%45s%9.5f", "Viscosity (mPa s) = ", (double) viscos));
if (tc_x > 200 && !pure_water)
{
#ifdef NO_UTF8_ENCODING
Expand Down
Loading

0 comments on commit 0bbbef6

Please # to comment.