PhreeqcUsers Discussion Forum

Registrations currently disabled due to excessive spam. Please email phreeqcusers at gmail.com to request an account.
Welcome Guest
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • BASIC functions »
  • Issue with transport number T_SC
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: Issue with transport number T_SC  (Read 1512 times)

khwee

  • Contributor
  • Posts: 8
Issue with transport number T_SC
« on: 28/06/23 14:06 »
I noticed something strange while working with T_SC to output the transport number of ions. Below are snippets of the output.

In the code, two simple solutions are defined. Even though Mg is given zero concentration in Solution 2, phreeqc outputs some values for T_SC("Mg+2") and T_SC("MgHCO3+"). I was expecting simple zeroes. I could input 1e-10 or other very small numbers for Mg, making the transport number of Mg species smaller than 1e-10 and therefore negligible. But I would like to know if there is something that I did wrong which caused the issue, or if there is a bug in phreeqc.

FYI I also tried SOLUTION_SPREAD and the same issue persists. It doesn't matter how the solutions are ordered, the issue always happens to the second and the subsequent solutions.

Code: [Select]
   Input file: test T_SC.phr
  Output file: test T_SC.phr.out
Using PHREEQC: version 3.7.3, compiled December 2, 2021
Database file: c:\phreeqc\database\phreeqc.dat

------------------
Reading data base.
------------------

SOLUTION_MASTER_SPECIES
SOLUTION_SPECIES
PHASES
EXCHANGE_MASTER_SPECIES
EXCHANGE_SPECIES
SURFACE_MASTER_SPECIES
SURFACE_SPECIES
RATES
END
------------------------------------
Reading input data for simulation 1.
------------------------------------

PRINT
reset false
user_print true
SOLUTION 1
units mmole/kgw
Ca 0
Mg 1 charge
Alkalinity 1
SOLUTION 2
units mmole/kgw
Ca 1 charge
Mg 0
Alkalinity 1
USER_PRINT
start
10 PRINT "Solution number : ", CELL_NO
20 PRINT "Transference number (Ca+2, CaHCO3+) : ", T_SC("Ca+2"), T_SC("CaHCO3+")
30 PRINT "Transference number (Mg+2, MgHCO3+) : ", T_SC("Mg+2"), T_SC("MgHCO3+")
40 PRINT "Transference number (Na+, Cl-, SO4-2) : ", T_SC("Na+"), T_SC("Cl-"), T_SC("SO4-2")
end
END
----------------------------------User print-----------------------------------

Solution number :             1
Transference number (Ca+2, CaHCO3+) :             0            0
Transference number (Mg+2, MgHCO3+) :    5.2916e-01   9.2752e-04
Transference number (Na+, Cl-, SO4-2) :             0            0            0

----------------------------------User print-----------------------------------

Solution number :             2
Transference number (Ca+2, CaHCO3+) :    5.5282e-01   1.0133e-03
Transference number (Mg+2, MgHCO3+) :    5.0275e-01   8.8123e-04
Transference number (Na+, Cl-, SO4-2) :             0            0            0

-------------------------------
End of Run after 0.675 Seconds.
-------------------------------
Logged

dlparkhurst

  • Global Moderator
  • *****
  • Posts: 4074
Re: Issue with transport number T_SC
« Reply #1 on: 29/06/23 15:51 »
You have indeed found a bug.

You can either restrict the print to the species in the current system, possibly by using the SYS("aq" Basic function, or, you can replace the following two methods in basicsubs.cpp and compile the batch version of PHREEQC. We will fix all of the PHREEQC programs in the next release. Thanks.

Code: [Select]
/* ---------------------------------------------------------------------- */
LDBLE Phreeqc::
calc_t_sc(const char* name)
/* ---------------------------------------------------------------------- */
{
char token[MAX_LENGTH];
class species* s_ptr;

strcpy(token, name);
s_ptr = s_search(token);
if (s_ptr != NULL && s_ptr->in)
{
if (!s_ptr->z)
return (0);
calc_SC();
if (!SC)
return (0);
LDBLE t = s_ptr->dw_t_SC * 1e7 * F_C_MOL * F_C_MOL / (R_KJ_DEG_MOL * 298150.0) * viscos_0_25 / viscos_0;
return (t / SC);
}
return (0);
}

/* ---------------------------------------------------------------------- */
LDBLE Phreeqc::
calc_f_visc(const char* name)
/* ---------------------------------------------------------------------- */
{
char token[MAX_LENGTH];
class species* s_ptr;

if (print_viscosity)
{
strcpy(token, name);
s_ptr = s_search(token);
if (s_ptr != NULL && s_ptr->in)
return s_ptr->dw_t_visc;
}
return 0;
}
Logged

khwee

  • Contributor
  • Posts: 8
Re: Issue with transport number T_SC
« Reply #2 on: 30/06/23 01:22 »
Thank you so much for your guidance dlparkhurst!
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • Beginners »
  • BASIC functions »
  • Issue with transport number T_SC
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2