Skip to content

Commit

Permalink
added test case for the dl_type error, generated charge imbalance
Browse files Browse the repository at this point in the history
  • Loading branch information
dlparkhurst committed Nov 17, 2024
1 parent 540b049 commit d29af24
Show file tree
Hide file tree
Showing 4 changed files with 382 additions and 0 deletions.
1 change: 1 addition & 0 deletions mytest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ set(TESTS
diff_c
dissolve_only
dist_x
dl_type_error
donly
DonnanBug
dump_test
Expand Down
49 changes: 49 additions & 0 deletions mytest/dl_type_error
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
DATABASE ../database/phreeqc.dat
SELECTED_OUTPUT 101
file dl_type_error.sel
USER_PUNCH 101
headings Mu SC
start
10 PUNCH STR_F$(MU, 20, 12)
20 PUNCH STR_F$(SC, 20, 10)
end
RATES
Decay
-start
40 SAVE moles
-end
SOLUTION
-units mol/kgw
pH 8
Na 1
P 1 charge
Si 1e-10
END
SURFACE
Hfo_w 0.1 1 600
-donnan
END
KINETICS
Decay
-m 1
-formula Si -1
-steps 10
-rk 1
END
USER_GRAPH 1
-headings time Si Charge
-axis_titles "Time, seconds" "Molality" "Charge balance, equivalents"
-axis_scale y_axis auto auto auto auto
-initial_solutions false
-connect_simulations true
-plot_concentration_vs x
-start
10 GRAPH_X TOTAL_TIME
20 GRAPH_Y log10(TOT("Si"))
30 GRAPH_SY CHARGE_BALANCE
-end
-active true
END
RUN_CELLS
-cell 1
END
329 changes: 329 additions & 0 deletions mytest/dl_type_error.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,329 @@
Input file: dl_type_error
Output file: dl_type_error.out
Database file: ../database/phreeqc.dat

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

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

DATABASE ../database/phreeqc.dat
SELECTED_OUTPUT 101
file dl_type_error.sel
USER_PUNCH 101
headings Mu SC
start
10 PUNCH STR_F$(MU, 20, 12)
20 PUNCH STR_F$(SC, 20, 10)
end
------------------
End of simulation.
------------------

------------------------------------
Reading input data for simulation 2.
------------------------------------

RATES
Decay
start
40 SAVE moles
end
SOLUTION
units mol/kgw
pH 8
Na 1
P 1 charge
Si 1e-10
END
-------------------------------------------
Beginning of initial solution calculations.
-------------------------------------------

Initial solution 1.

-----------------------------Solution composition------------------------------

Elements Molality Moles

Na 1.000e+00 1.000e+00
P 5.072e-01 5.072e-01 Charge balance
Si 1.000e-10 1.000e-10

----------------------------Description of solution----------------------------

pH = 8.000
pe = 4.000
Specific Conductance (µS/cm, 25°C) = 39420
Density (g/cm³) = 1.04881
Volume (L) = 1.02181
Viscosity (mPa s) = 1.03500
Activity of water = 0.976
Ionic strength (mol/kgw) = 1.258e+00
Mass of water (kg) = 1.000e+00
Total alkalinity (eq/kg) = 4.928e-01
Temperature (°C) = 25.00
Electrical balance (eq) = 7.518e-10
Percent error, 100*(Cat-|An|)/(Cat+|An|) = 0.00
Iterations = 6
Total H = 1.115340e+02
Total O = 5.753495e+01

----------------------------Distribution of species----------------------------

Log Log Log mole V
Species Molality Activity Molality Activity Gamma cm³/mol

OH- 1.757e-06 9.882e-07 -5.755 -6.005 -0.250 -1.71
H+ 1.357e-08 1.000e-08 -7.867 -8.000 -0.133 0.00
H2O 5.551e+01 9.764e-01 1.744 -0.010 0.000 18.07
H(0) 1.060e-27
H2 5.299e-28 7.079e-28 -27.276 -27.150 0.126 28.61
Na 1.000e+00
Na+ 8.825e-01 6.612e-01 -0.054 -0.180 -0.125 -0.17
NaHPO4- 1.175e-01 7.566e-02 -0.930 -1.121 -0.191 122.70
O(0) 1.187e-38
O2 5.935e-39 7.929e-39 -38.227 -38.101 0.126 30.40
P 5.072e-01
HPO4-2 3.746e-01 5.868e-02 -0.426 -1.231 -0.805 10.82
NaHPO4- 1.175e-01 7.566e-02 -0.930 -1.121 -0.191 122.70
H2PO4- 1.468e-02 9.452e-03 -1.833 -2.024 -0.191 35.66
PO4-3 3.190e-04 2.646e-06 -3.496 -5.577 -2.081 -15.23
H3PO4 1.042e-08 1.392e-08 -7.982 -7.856 0.126 47.41
Si 1.000e-10
H4SiO4 9.675e-11 1.293e-10 -10.014 -9.889 0.126 52.08
H3SiO4- 3.246e-12 1.906e-12 -11.489 -11.720 -0.231 29.00
H2SiO4-2 7.554e-17 1.297e-17 -16.122 -16.887 -0.765 (0)

------------------------------Saturation indices-------------------------------

Phase SI** log IAP log K(298 K, 1 atm)

Chalcedony -6.32 -9.87 -3.55 SiO2
H2(g) -24.05 -27.15 -3.10 H2
H2O(g) -1.51 -0.01 1.50 H2O
O2(g) -35.21 -38.10 -2.89 O2
Quartz -5.89 -9.87 -3.98 SiO2
SiO2(a) -7.16 -9.87 -2.71 SiO2

**For a gas, SI = log10(fugacity). Fugacity = pressure * phi / 1 atm.
For ideal gases, phi = 1.

------------------
End of simulation.
------------------

------------------------------------
Reading input data for simulation 3.
------------------------------------

SURFACE
Hfo_w 0.1 1 600
donnan
END
------------------
End of simulation.
------------------

------------------------------------
Reading input data for simulation 4.
------------------------------------

KINETICS
Decay
m 1
formula Si -1
steps 10
rk 1
END
------------------
End of simulation.
------------------

------------------------------------
Reading input data for simulation 5.
------------------------------------

USER_GRAPH 1
-headings time Si Charge
-axis_titles "Time, seconds" "Molality" "Charge balance, equivalents"
-axis_scale y_axis auto auto auto auto
-initial_solutions false
-connect_simulations true
-plot_concentration_vs x
-start
10 GRAPH_X TOTAL_TIME
20 GRAPH_Y log10(TOT("Si"))
30 GRAPH_SY CHARGE_BALANCE
-end
-active true
END
------------------
End of simulation.
------------------

------------------------------------
Reading input data for simulation 6.
------------------------------------

RUN_CELLS
-cell 1
END
--------------------------
Beginning of run as cells.
--------------------------

-----------------------------------------
Beginning of batch-reaction calculations.
-----------------------------------------

Reaction step 1.

Using solution 1.
Using surface 1.
Using kinetics 1.

Kinetics 1.

Time step: 10 seconds

Rate name Delta Moles Total Moles Reactant Coefficient

Decay -0.000e+00 1.000e+00 Si -1

------------------------------Surface composition------------------------------

Diffuse Double Layer Surface-Complexation Model

Hfo
-3.759e-10 Surface + diffuse layer charge, eq
-6.626e-03 Surface charge, eq
-1.066e+00 sigma, C/m²
-1.423e-01 psi, V
5.538e+00 -F*psi/RT
2.542e+02 exp(-F*psi/RT)
1.000e+00 specific area, m²/g
6.000e+02 m² for 6.000e+02 g

Water in diffuse layer: 6.000e-03 kg, 100.0% of total DDL-water.
viscosity: 0.00000 mPa s for DDL water.

Total moles in diffuse layer (excluding water), Donnan calculation.
Donnan Layer potential, psi_DL = -1.270e-02 V.
Boltzmann factor, exp(-psi_DL * F / RT) = 1.639e+00 (= c_DL / c_free if z is +1).

Element Moles
H 1.7761e-03
Na 9.0866e-03
O 4.8512e-03
P 1.2127e-03
Si 6.1252e-16

Hfo_w
1.000e-01 moles
Mole Log
Species Moles Fraction Molality Molality

Hfo_wOH 4.713e-02 0.471 4.719e-02 -1.326
Hfo_wOH2+ 2.773e-02 0.277 2.777e-02 -1.556
Hfo_wHPO4- 1.345e-02 0.135 1.347e-02 -1.871
Hfo_wPO4-2 9.533e-03 0.095 9.546e-03 -2.020
Hfo_wO- 1.835e-03 0.018 1.838e-03 -2.736
Hfo_wH2PO4 3.225e-04 0.003 3.229e-04 -3.491
Hfo_wH2SiO4- 4.832e-11 0.000 4.839e-11 -10.315
Hfo_wH3SiO4 4.611e-11 0.000 4.617e-11 -10.336
Hfo_wHSiO4-2 5.426e-12 0.000 5.434e-12 -11.265

-----------------------------Solution composition------------------------------

Elements Molality Moles

Na 9.923e-01 9.909e-01
P 4.833e-01 4.827e-01
Si 1.437e-13 1.435e-13

----------------------------Description of solution----------------------------

pH = 9.925 Charge balance
pe = -10.914 Adjusted to redox equilibrium
Specific Conductance (µS/cm, 25°C) = 39932
Density (g/cm³) = 1.04684
Volume (L) = 1.02002
Viscosity (mPa s) = 1.03726
Activity of water = 0.976
Ionic strength (mol/kgw) = 1.309e+00
Mass of water (kg) = 9.986e-01
Total alkalinity (eq/kg) = 5.090e-01
Temperature (°C) = 25.00
Electrical balance (eq) = -2.351e-09
Percent error, 100*(Cat-|An|)/(Cat+|An|) = -0.00
Iterations = 0 (30 overall)
Total H = 1.114155e+02
Total O = 5.736017e+01

----------------------------Distribution of species----------------------------

Log Log Log mole V
Species Molality Activity Molality Activity Gamma cm³/mol

OH- 1.486e-04 8.320e-05 -3.828 -4.080 -0.252 -1.63
H+ 1.613e-10 1.187e-10 -9.792 -9.925 -0.133 0.00
H2O 5.551e+01 9.759e-01 1.744 -0.011 0.000 18.07
H(0) 9.954e-02
H2 4.977e-02 6.727e-02 -1.303 -1.172 0.131 28.61
Na 9.923e-01
Na+ 8.833e-01 6.654e-01 -0.054 -0.177 -0.123 -0.15
NaHPO4- 1.090e-01 6.994e-02 -0.963 -1.155 -0.193 126.28
O(0) 0.000e+00
O2 0.000e+00 0.000e+00 -90.188 -90.057 0.131 30.40
P 4.833e-01
HPO4-2 3.486e-01 5.390e-02 -0.458 -1.268 -0.811 10.91
NaHPO4- 1.090e-01 6.994e-02 -0.963 -1.155 -0.193 126.28
PO4-3 2.564e-02 2.047e-04 -1.591 -3.689 -2.098 -15.09
H2PO4- 1.606e-04 1.031e-04 -3.794 -3.987 -0.193 35.74
H3PO4 1.333e-12 1.802e-12 -11.875 -11.744 0.131 47.41
Si 1.437e-13
H3SiO4- 1.064e-13 6.224e-14 -12.973 -13.206 -0.233 29.02
H4SiO4 3.707e-14 5.011e-14 -13.431 -13.300 0.131 52.08
H2SiO4-2 2.102e-16 3.566e-17 -15.677 -16.448 -0.770 (0)

------------------------------Saturation indices-------------------------------

Phase SI** log IAP log K(298 K, 1 atm)

Chalcedony -9.73 -13.28 -3.55 SiO2
H2(g) 1.93 -1.17 -3.10 H2
H2O(g) -1.51 -0.01 1.50 H2O
O2(g) -87.16 -90.06 -2.89 O2
Quartz -9.30 -13.28 -3.98 SiO2
SiO2(a) -10.57 -13.28 -2.71 SiO2

**For a gas, SI = log10(fugacity). Fugacity = pressure * phi / 1 atm.
For ideal gases, phi = 1.

------------------
End of simulation.
------------------

------------------------------------
Reading input data for simulation 7.
------------------------------------

-------------------------------
End of Run after 2.467 Seconds.
-------------------------------

3 changes: 3 additions & 0 deletions mytest/dl_type_error.sel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Mu SC
1.258047983469 39420.3633966330
1.308789599523 39932.2352633495

0 comments on commit d29af24

Please # to comment.