pyEQL 1.4.0rc9__cp313-cp313-macosx_10_13_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (491) hide show
  1. pyEQL/__init__.py +50 -0
  2. pyEQL/_phreeqc.cpython-313-darwin.so +0 -0
  3. pyEQL/activity_correction.py +879 -0
  4. pyEQL/database/geothermal.dat +5693 -0
  5. pyEQL/database/llnl.dat +19305 -0
  6. pyEQL/database/phreeqc_license.txt +54 -0
  7. pyEQL/database/pyeql_db.json +35607 -0
  8. pyEQL/engines.py +1153 -0
  9. pyEQL/equilibrium.py +227 -0
  10. pyEQL/functions.py +281 -0
  11. pyEQL/phreeqc/__init__.py +5 -0
  12. pyEQL/phreeqc/bindings.cpp +84 -0
  13. pyEQL/phreeqc/core.py +239 -0
  14. pyEQL/phreeqc/database/Amm.dat +1968 -0
  15. pyEQL/phreeqc/database/CMakeLists.txt +32 -0
  16. pyEQL/phreeqc/database/ColdChem.dat +267 -0
  17. pyEQL/phreeqc/database/Concrete_PHR.dat +158 -0
  18. pyEQL/phreeqc/database/Concrete_PZ.dat +195 -0
  19. pyEQL/phreeqc/database/Kinec.v2.dat +12039 -0
  20. pyEQL/phreeqc/database/Kinec_v3.dat +12159 -0
  21. pyEQL/phreeqc/database/Makefile.am +28 -0
  22. pyEQL/phreeqc/database/Makefile.in +530 -0
  23. pyEQL/phreeqc/database/PHREEQC_ThermoddemV1.10_15Dec2020.dat +12965 -0
  24. pyEQL/phreeqc/database/Tipping_Hurley.dat +4137 -0
  25. pyEQL/phreeqc/database/__init__.py +0 -0
  26. pyEQL/phreeqc/database/core10.dat +6824 -0
  27. pyEQL/phreeqc/database/frezchem.dat +634 -0
  28. pyEQL/phreeqc/database/iso.dat +7235 -0
  29. pyEQL/phreeqc/database/llnl.dat +19310 -0
  30. pyEQL/phreeqc/database/minteq.dat +5654 -0
  31. pyEQL/phreeqc/database/minteq.v4.dat +13212 -0
  32. pyEQL/phreeqc/database/phreeqc.dat +1972 -0
  33. pyEQL/phreeqc/database/phreeqc_rates.dat +3158 -0
  34. pyEQL/phreeqc/database/pitzer.dat +1044 -0
  35. pyEQL/phreeqc/database/sit.dat +14348 -0
  36. pyEQL/phreeqc/database/wateq4f.dat +4036 -0
  37. pyEQL/phreeqc/ext/README.md +10 -0
  38. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/CMakeLists.txt +476 -0
  39. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/INSTALL +302 -0
  40. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/IPhreeqc.rc +61 -0
  41. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/IPhreeqcConfig.cmake.in +4 -0
  42. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/Makefile.am +8 -0
  43. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/Makefile.in +816 -0
  44. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/aclocal.m4 +1217 -0
  45. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/CTestScript.cmake +167 -0
  46. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/CSelectedOutput.cpp.o +0 -0
  47. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/IPhreeqc.cpp.o +0 -0
  48. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/IPhreeqcLib.cpp.o +0 -0
  49. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/IPhreeqc_interface_F.cpp.o +0 -0
  50. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/Var.c.o +0 -0
  51. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Dictionary.cpp.o +0 -0
  52. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/ExchComp.cxx.o +0 -0
  53. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Exchange.cxx.o +0 -0
  54. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/GasComp.cxx.o +0 -0
  55. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/GasPhase.cxx.o +0 -0
  56. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/ISolution.cxx.o +0 -0
  57. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/ISolutionComp.cxx.o +0 -0
  58. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/KineticsComp.cxx.o +0 -0
  59. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/NameDouble.cxx.o +0 -0
  60. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/NumKeyword.cxx.o +0 -0
  61. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PBasic.cpp.o +0 -0
  62. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PHRQ_io_output.cpp.o +0 -0
  63. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PPassemblage.cxx.o +0 -0
  64. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PPassemblageComp.cxx.o +0 -0
  65. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Phreeqc.cpp.o +0 -0
  66. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PhreeqcKeywords/Keywords.cpp.o +0 -0
  67. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Pressure.cxx.o +0 -0
  68. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Reaction.cxx.o +0 -0
  69. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/ReadClass.cxx.o +0 -0
  70. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SS.cxx.o +0 -0
  71. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SSassemblage.cxx.o +0 -0
  72. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SScomp.cxx.o +0 -0
  73. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SelectedOutput.cpp.o +0 -0
  74. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Serializer.cxx.o +0 -0
  75. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Solution.cxx.o +0 -0
  76. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SolutionIsotope.cxx.o +0 -0
  77. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/StorageBin.cxx.o +0 -0
  78. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/StorageBinList.cpp.o +0 -0
  79. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Surface.cxx.o +0 -0
  80. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SurfaceCharge.cxx.o +0 -0
  81. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SurfaceComp.cxx.o +0 -0
  82. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/System.cxx.o +0 -0
  83. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Temperature.cxx.o +0 -0
  84. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Use.cpp.o +0 -0
  85. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/UserPunch.cpp.o +0 -0
  86. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/advection.cpp.o +0 -0
  87. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/basicsubs.cpp.o +0 -0
  88. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cl1.cpp.o +0 -0
  89. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/common/PHRQ_base.cxx.o +0 -0
  90. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/common/PHRQ_io.cpp.o +0 -0
  91. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/common/Parser.cxx.o +0 -0
  92. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/common/Utils.cxx.o +0 -0
  93. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cvdense.cpp.o +0 -0
  94. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cvode.cpp.o +0 -0
  95. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cxxKinetics.cxx.o +0 -0
  96. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cxxMix.cxx.o +0 -0
  97. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/dense.cpp.o +0 -0
  98. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/dumper.cpp.o +0 -0
  99. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/gases.cpp.o +0 -0
  100. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/input.cpp.o +0 -0
  101. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/integrate.cpp.o +0 -0
  102. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/inverse.cpp.o +0 -0
  103. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/isotopes.cpp.o +0 -0
  104. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/kinetics.cpp.o +0 -0
  105. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/mainsubs.cpp.o +0 -0
  106. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/model.cpp.o +0 -0
  107. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/nvector.cpp.o +0 -0
  108. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/nvector_serial.cpp.o +0 -0
  109. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/parse.cpp.o +0 -0
  110. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/phqalloc.cpp.o +0 -0
  111. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/pitzer.cpp.o +0 -0
  112. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/pitzer_structures.cpp.o +0 -0
  113. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/prep.cpp.o +0 -0
  114. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/print.cpp.o +0 -0
  115. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/read.cpp.o +0 -0
  116. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/readtr.cpp.o +0 -0
  117. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/runner.cpp.o +0 -0
  118. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/sit.cpp.o +0 -0
  119. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/smalldense.cpp.o +0 -0
  120. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/spread.cpp.o +0 -0
  121. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/step.cpp.o +0 -0
  122. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/structures.cpp.o +0 -0
  123. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/sundialsmath.cpp.o +0 -0
  124. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/tally.cpp.o +0 -0
  125. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/tidy.cpp.o +0 -0
  126. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/transport.cpp.o +0 -0
  127. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/utilities.cpp.o +0 -0
  128. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CTestTestfile.cmake +6 -0
  129. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/DartConfiguration.tcl +109 -0
  130. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/cmake_install.cmake +45 -0
  131. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/libIPhreeqc.a +0 -0
  132. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/ar-lib +270 -0
  133. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/compile +347 -0
  134. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/config.guess +1441 -0
  135. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/config.sub +1813 -0
  136. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/depcomp +791 -0
  137. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/install-sh +508 -0
  138. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/ltmain.sh +11156 -0
  139. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/missing +215 -0
  140. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/test-driver +148 -0
  141. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/configure +23867 -0
  142. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/configure.ac +136 -0
  143. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Amm.dat +1968 -0
  144. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/CMakeLists.txt +32 -0
  145. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/ColdChem.dat +267 -0
  146. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Concrete_PHR.dat +158 -0
  147. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Concrete_PZ.dat +195 -0
  148. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Kinec.v2.dat +12039 -0
  149. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Kinec_v3.dat +12159 -0
  150. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Makefile.am +28 -0
  151. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Makefile.in +530 -0
  152. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/PHREEQC_ThermoddemV1.10_15Dec2020.dat +12965 -0
  153. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Tipping_Hurley.dat +4137 -0
  154. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/core10.dat +6824 -0
  155. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/frezchem.dat +634 -0
  156. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/iso.dat +7235 -0
  157. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/llnl.dat +19310 -0
  158. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/minteq.dat +5654 -0
  159. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/minteq.v4.dat +13212 -0
  160. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/phreeqc.dat +1972 -0
  161. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/phreeqc_rates.dat +3158 -0
  162. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/pitzer.dat +1044 -0
  163. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/sit.dat +14348 -0
  164. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/wateq4f.dat +4036 -0
  165. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/CMakeLists.txt +35 -0
  166. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/IPhreeqc.pdf +0 -0
  167. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Makefile.am +24 -0
  168. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Makefile.in +545 -0
  169. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/NOTICE +51 -0
  170. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Phreeqc_2_1999_manual.pdf +0 -0
  171. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Phreeqc_3_2013_manual.pdf +0 -0
  172. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/README +428 -0
  173. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/RELEASE +7294 -0
  174. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8h.html +5096 -0
  175. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8h_source.html +389 -0
  176. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8hpp.html +83 -0
  177. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8hpp_source.html +478 -0
  178. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/Var_8h.html +318 -0
  179. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/Var_8h_source.html +200 -0
  180. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/bc_s.png +0 -0
  181. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/bdwn.png +0 -0
  182. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqc.html +2274 -0
  183. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqc.png +0 -0
  184. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqcStop.html +69 -0
  185. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqcStop.png +0 -0
  186. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/closed.png +0 -0
  187. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +68 -0
  188. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/doxygen.css +1440 -0
  189. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/doxygen.png +0 -0
  190. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/dynsections.js +97 -0
  191. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2blank.png +0 -0
  192. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2doc.png +0 -0
  193. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2folderclosed.png +0 -0
  194. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2folderopen.png +0 -0
  195. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2lastnode.png +0 -0
  196. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2link.png +0 -0
  197. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2mlastnode.png +0 -0
  198. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2mnode.png +0 -0
  199. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2node.png +0 -0
  200. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2plastnode.png +0 -0
  201. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2pnode.png +0 -0
  202. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2splitbar.png +0 -0
  203. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2vertline.png +0 -0
  204. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/index.html +58 -0
  205. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/jquery.js +31 -0
  206. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/nav_f.png +0 -0
  207. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/nav_g.png +0 -0
  208. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/nav_h.png +0 -0
  209. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/open.png +0 -0
  210. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/structVAR.html +143 -0
  211. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/sync_off.png +0 -0
  212. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/sync_on.png +0 -0
  213. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_a.png +0 -0
  214. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_b.png +0 -0
  215. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_h.png +0 -0
  216. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_s.png +0 -0
  217. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tabs.css +60 -0
  218. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/phreeqc3.chm +0 -0
  219. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/CMakeLists.txt +11 -0
  220. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/Makefile.am +88 -0
  221. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/Makefile.in +696 -0
  222. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/CMakeLists.txt +1 -0
  223. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/CMakeLists.txt +35 -0
  224. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/CMakeLists.txt.in +21 -0
  225. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/README.txt +44 -0
  226. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/advect.c +101 -0
  227. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/ic +17 -0
  228. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/phreeqc.dat +1579 -0
  229. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/CMakeLists.txt +10 -0
  230. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/README.txt +3 -0
  231. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/CMakeLists.txt +9 -0
  232. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/phreeqc.dat +1582 -0
  233. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/runphreeqc.xls +0 -0
  234. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/withcallback.xls +0 -0
  235. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/CMakeLists.txt +11 -0
  236. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/Gypsum.py +52 -0
  237. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/parallel_advect.py +465 -0
  238. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/phreeqc.dat +1582 -0
  239. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/pitzer.dat +790 -0
  240. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/wateq4f.dat +3846 -0
  241. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/CMakeLists.txt +1 -0
  242. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/CMakeLists.txt +35 -0
  243. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/CMakeLists.txt.in +20 -0
  244. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/README.txt +45 -0
  245. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/advect.cpp +110 -0
  246. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/ic +17 -0
  247. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/phreeqc.dat +1579 -0
  248. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/CMakeLists.txt +1 -0
  249. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/CMakeLists.txt +44 -0
  250. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/CMakeLists.txt.in +24 -0
  251. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/README.txt +45 -0
  252. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/advect.F90 +102 -0
  253. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/ic +17 -0
  254. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/phreeqc.dat +1579 -0
  255. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/CMakeLists.txt +26 -0
  256. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/CMakeLists.txt.in +20 -0
  257. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/README.txt +37 -0
  258. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/ex2 +26 -0
  259. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/main.cpp +20 -0
  260. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/phreeqc.dat +1837 -0
  261. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/post-install.cmake.in +7 -0
  262. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/CMakeLists.txt +185 -0
  263. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/FileTest.cpp +171 -0
  264. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/FileTest.h +34 -0
  265. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/Makefile.am +18 -0
  266. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/Makefile.in +466 -0
  267. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestCVar.cpp +9 -0
  268. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestIPhreeqc.cpp +4901 -0
  269. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestIPhreeqcLib.cpp +4644 -0
  270. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestSelectedOutput.cpp +669 -0
  271. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestVar.cpp +10 -0
  272. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/conv_fail.in +11 -0
  273. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/dump +42 -0
  274. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/iso.dat +7231 -0
  275. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/kinn20140218 +349 -0
  276. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/missing_e.dat +1556 -0
  277. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/multi_punch +105 -0
  278. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/multi_punch_no_set +102 -0
  279. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/phreeqc.dat.90a6449 +1935 -0
  280. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/phreeqc.dat.old +1556 -0
  281. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/libtool.m4 +8388 -0
  282. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/ltoptions.m4 +437 -0
  283. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/ltsugar.m4 +124 -0
  284. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/ltversion.m4 +23 -0
  285. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/lt~obsolete.m4 +99 -0
  286. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/resource.h +14 -0
  287. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/CSelectedOutput.cpp +401 -0
  288. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/CSelectedOutput.hxx +77 -0
  289. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/CVar.hxx +162 -0
  290. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Debug.h +12 -0
  291. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/ErrorReporter.hxx +70 -0
  292. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.cpp +1889 -0
  293. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.f.inc +91 -0
  294. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.f90.inc +603 -0
  295. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.h +2182 -0
  296. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.hpp +1027 -0
  297. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqcCallbacks.h +19 -0
  298. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqcF.f +653 -0
  299. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqcLib.cpp +1098 -0
  300. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc_interface.F90 +1283 -0
  301. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc_interface_F.cpp +535 -0
  302. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc_interface_F.h +162 -0
  303. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Makefile.am +210 -0
  304. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Makefile.in +1294 -0
  305. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/README.Fortran +17 -0
  306. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Var.c +84 -0
  307. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Var.h +152 -0
  308. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Version.h +36 -0
  309. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fimpl.h +282 -0
  310. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap.cpp +646 -0
  311. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap.h +163 -0
  312. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap1.cpp +24 -0
  313. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap2.cpp +24 -0
  314. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap3.cpp +24 -0
  315. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap4.cpp +24 -0
  316. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap5.cpp +24 -0
  317. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap6.cpp +25 -0
  318. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap7.cpp +25 -0
  319. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap8.cpp +24 -0
  320. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartHandler.cpp +225 -0
  321. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartHandler.h +59 -0
  322. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartObject.cpp +1382 -0
  323. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartObject.h +444 -0
  324. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/CurveObject.cpp +42 -0
  325. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/CurveObject.h +79 -0
  326. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Dictionary.cpp +41 -0
  327. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Dictionary.h +28 -0
  328. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ExchComp.cxx +398 -0
  329. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ExchComp.h +117 -0
  330. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Exchange.cxx +466 -0
  331. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Exchange.h +74 -0
  332. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Form1.h +1184 -0
  333. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Form1.resX +36 -0
  334. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasComp.cxx +265 -0
  335. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasComp.h +59 -0
  336. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasPhase.cxx +659 -0
  337. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasPhase.h +103 -0
  338. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolution.cxx +40 -0
  339. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolution.h +53 -0
  340. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolutionComp.cxx +202 -0
  341. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolutionComp.h +138 -0
  342. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/KineticsComp.cxx +318 -0
  343. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/KineticsComp.h +81 -0
  344. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NA.h +1 -0
  345. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NameDouble.cxx +537 -0
  346. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NameDouble.h +66 -0
  347. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NumKeyword.cxx +190 -0
  348. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NumKeyword.h +67 -0
  349. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PBasic.cpp +8350 -0
  350. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PBasic.h +572 -0
  351. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PHRQ_io_output.cpp +411 -0
  352. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblage.cxx +375 -0
  353. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblage.h +70 -0
  354. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblageComp.cxx +441 -0
  355. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblageComp.h +83 -0
  356. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Phreeqc.cpp +2087 -0
  357. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Phreeqc.h +2164 -0
  358. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PhreeqcKeywords/Keywords.cpp +242 -0
  359. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PhreeqcKeywords/Keywords.h +104 -0
  360. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Pressure.cxx +417 -0
  361. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Pressure.h +43 -0
  362. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Reaction.cxx +284 -0
  363. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Reaction.h +57 -0
  364. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ReadClass.cxx +1150 -0
  365. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SS.cxx +609 -0
  366. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SS.h +128 -0
  367. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SSassemblage.cxx +317 -0
  368. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SSassemblage.h +59 -0
  369. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SScomp.cxx +297 -0
  370. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SScomp.h +66 -0
  371. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SelectedOutput.cpp +115 -0
  372. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SelectedOutput.h +209 -0
  373. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Serializer.cxx +213 -0
  374. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Serializer.h +42 -0
  375. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Solution.cxx +1795 -0
  376. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Solution.h +154 -0
  377. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SolutionIsotope.cxx +333 -0
  378. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SolutionIsotope.h +85 -0
  379. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBin.cxx +1507 -0
  380. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBin.h +141 -0
  381. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBinList.cpp +358 -0
  382. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBinList.h +81 -0
  383. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Surface.cxx +837 -0
  384. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Surface.h +108 -0
  385. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceCharge.cxx +617 -0
  386. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceCharge.h +137 -0
  387. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceComp.cxx +509 -0
  388. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceComp.h +70 -0
  389. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/System.cxx +103 -0
  390. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/System.h +89 -0
  391. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Temperature.cxx +423 -0
  392. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Temperature.h +42 -0
  393. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Use.cpp +78 -0
  394. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Use.h +159 -0
  395. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/UserPunch.cpp +32 -0
  396. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/UserPunch.h +39 -0
  397. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ZedGraph.dll +0 -0
  398. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/advection.cpp +140 -0
  399. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/basicsubs.cpp +4333 -0
  400. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cl1.cpp +881 -0
  401. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_base.cxx +117 -0
  402. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_base.h +48 -0
  403. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_exports.h +20 -0
  404. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_io.cpp +914 -0
  405. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_io.h +207 -0
  406. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Parser.cxx +1331 -0
  407. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Parser.h +310 -0
  408. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Utils.cxx +263 -0
  409. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Utils.h +29 -0
  410. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/phrqtype.h +18 -0
  411. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvdense.cpp +566 -0
  412. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvdense.h +267 -0
  413. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvode.cpp +3939 -0
  414. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvode.h +940 -0
  415. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxKinetics.cxx +617 -0
  416. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxKinetics.h +78 -0
  417. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxMix.cxx +154 -0
  418. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxMix.h +58 -0
  419. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dense.cpp +175 -0
  420. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dense.h +341 -0
  421. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dumper.cpp +277 -0
  422. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dumper.h +60 -0
  423. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/gases.cpp +748 -0
  424. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/global_structures.h +1672 -0
  425. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/input.cpp +133 -0
  426. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/integrate.cpp +1219 -0
  427. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/inverse.cpp +5135 -0
  428. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/isotopes.cpp +1813 -0
  429. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/kinetics.cpp +3180 -0
  430. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/mainsubs.cpp +2320 -0
  431. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/model.cpp +5843 -0
  432. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector.cpp +272 -0
  433. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector.h +485 -0
  434. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector_serial.cpp +1032 -0
  435. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector_serial.h +369 -0
  436. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/parse.cpp +1044 -0
  437. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/phqalloc.cpp +316 -0
  438. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/phqalloc.h +47 -0
  439. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/pitzer.cpp +2709 -0
  440. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/pitzer_structures.cpp +225 -0
  441. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/prep.cpp +6267 -0
  442. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/print.cpp +3673 -0
  443. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/read.cpp +10245 -0
  444. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/readtr.cpp +1495 -0
  445. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/runner.cpp +158 -0
  446. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/runner.h +33 -0
  447. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sit.cpp +1684 -0
  448. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/smalldense.cpp +324 -0
  449. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/smalldense.h +261 -0
  450. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/spread.cpp +1309 -0
  451. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/step.cpp +1566 -0
  452. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/structures.cpp +3381 -0
  453. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sundialsmath.cpp +133 -0
  454. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sundialsmath.h +162 -0
  455. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sundialstypes.h +183 -0
  456. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/tally.cpp +1288 -0
  457. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/tidy.cpp +5600 -0
  458. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/transport.cpp +6403 -0
  459. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/utilities.cpp +1339 -0
  460. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/thread.h +64 -0
  461. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/CMakeLists.txt +133 -0
  462. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/Makefile.am +45 -0
  463. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/Makefile.in +1128 -0
  464. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/ex2.in +26 -0
  465. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/main.f90 +31 -0
  466. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/main77.f +6 -0
  467. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/main_fortran.cxx +8 -0
  468. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/phreeqc.dat.in +1556 -0
  469. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/test_c.c +148 -0
  470. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/test_cxx.cxx +152 -0
  471. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/test_f90.F90 +328 -0
  472. pyEQL/phreeqc/iphreeqc_wrapper.cpp +75 -0
  473. pyEQL/phreeqc/solution.py +74 -0
  474. pyEQL/phreeqc/var.py +50 -0
  475. pyEQL/presets/Ringers lactate.yaml +20 -0
  476. pyEQL/presets/__init__.py +17 -0
  477. pyEQL/presets/normal saline.yaml +17 -0
  478. pyEQL/presets/rainwater.yaml +17 -0
  479. pyEQL/presets/seawater.yaml +29 -0
  480. pyEQL/presets/urine.yaml +26 -0
  481. pyEQL/presets/wastewater.yaml +21 -0
  482. pyEQL/py.typed +0 -0
  483. pyEQL/salt_ion_match.py +112 -0
  484. pyEQL/solute.py +163 -0
  485. pyEQL/solution.py +2714 -0
  486. pyEQL/utils.py +237 -0
  487. pyeql-1.4.0rc9.dist-info/METADATA +130 -0
  488. pyeql-1.4.0rc9.dist-info/RECORD +491 -0
  489. pyeql-1.4.0rc9.dist-info/WHEEL +6 -0
  490. pyeql-1.4.0rc9.dist-info/licenses/AUTHORS.md +21 -0
  491. pyeql-1.4.0rc9.dist-info/licenses/LICENSE.txt +20 -0
@@ -0,0 +1,3673 @@
1
+ //Note to encode in ANSI with NP++
2
+ #include "Utils.h"
3
+ #include "Phreeqc.h"
4
+ #include "phqalloc.h"
5
+ #include <stdarg.h>
6
+ #include <assert.h>
7
+ #include "Temperature.h"
8
+ #include "cxxMix.h"
9
+ #include "Exchange.h"
10
+ #include "GasPhase.h"
11
+ #include "Reaction.h"
12
+ #include "PPassemblage.h"
13
+ #include "SSassemblage.h"
14
+ #include "cxxKinetics.h"
15
+ #include "Solution.h"
16
+ #include "Surface.h"
17
+
18
+ #if defined(_MSC_VER) && (_MSC_VER <= 1400) // VS2005
19
+ # define nullptr NULL
20
+ #endif
21
+
22
+ #if __cplusplus < 201103L // Check if C++ standard is pre-C++11
23
+ # ifndef nullptr
24
+ # define nullptr NULL
25
+ # endif
26
+ #endif
27
+
28
+ #if defined(PHREEQCI_GUI)
29
+ #ifdef _DEBUG
30
+ #define new DEBUG_NEW
31
+ #undef THIS_FILE
32
+ static char THIS_FILE[] = __FILE__;
33
+ #endif
34
+ #endif
35
+
36
+ /* ---------------------------------------------------------------------- */
37
+ int Phreeqc::
38
+ array_print(LDBLE * array_l, int row_count, int column_count,
39
+ int l_max_column_count)
40
+ /* ---------------------------------------------------------------------- */
41
+ {
42
+ int i, j, k;
43
+
44
+ for (i = 0; i < row_count; i++)
45
+ {
46
+ k = 0;
47
+ output_msg(sformatf("%d\n", i));
48
+ for (j = 0; j < column_count; j++)
49
+ {
50
+ if (k > 7)
51
+ {
52
+ output_msg(sformatf("\n"));
53
+ k = 0;
54
+ }
55
+ output_msg(sformatf("%11.2e",
56
+ (double) array_l[i * l_max_column_count + j]));
57
+ k++;
58
+ }
59
+ if (k != 0)
60
+ {
61
+ output_msg(sformatf("\n"));
62
+ }
63
+ output_msg(sformatf("\n"));
64
+ }
65
+ output_msg(sformatf("\n"));
66
+ return (OK);
67
+ }
68
+
69
+ /* ---------------------------------------------------------------------- */
70
+ int Phreeqc::
71
+ set_pr_in_false(void)
72
+ /* ---------------------------------------------------------------------- */
73
+ {
74
+ // set pr_in to false for subsequent steps...
75
+ if (use.Get_pp_assemblage_in())
76
+ {
77
+ for (int i = 0; i < count_unknowns; i++)
78
+ {
79
+ if (x[i]->type == PP)
80
+ x[i]->phase->pr_in = false;
81
+ }
82
+ }
83
+ if (use.Get_gas_phase_ptr())
84
+ {
85
+ cxxGasPhase *gas_phase_ptr = use.Get_gas_phase_ptr();
86
+ for (size_t i = 0; i < gas_phase_ptr->Get_gas_comps().size(); i++)
87
+ {
88
+ cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]);
89
+ int k;
90
+ class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE);
91
+ if (phase_ptr)
92
+ phase_ptr->pr_in = false;
93
+ }
94
+ }
95
+ return (OK);
96
+ }
97
+ /* ---------------------------------------------------------------------- */
98
+ int Phreeqc::
99
+ print_all(void)
100
+ /* ---------------------------------------------------------------------- */
101
+ {
102
+ /*
103
+ * Print each block of results in sequence to file output
104
+ * also print selected output to punch_file
105
+ * Each routine is controlled by a variable in structure print.
106
+ * print.all == FALSE will turn off all prints.
107
+ */
108
+ if (pr.all == FALSE)
109
+ {
110
+ set_pr_in_false();
111
+ return (OK);
112
+ }
113
+ /*
114
+ * Makes sorted list including all species for each valence state
115
+ */
116
+ if (pr.surface == TRUE || pr.exchange == TRUE || pr.species == TRUE)
117
+ {
118
+ species_list_sort();
119
+ }
120
+ /*
121
+ * Print results
122
+ */
123
+ s_h2o->lm = s_h2o->la;
124
+ print_using();
125
+ print_mix();
126
+ print_reaction();
127
+ print_kinetics();
128
+ print_user_print();
129
+ print_gas_phase();
130
+ print_pp_assemblage();
131
+ print_ss_assemblage();
132
+ print_surface();
133
+ print_exchange();
134
+ print_initial_solution_isotopes();
135
+ print_isotope_ratios();
136
+ print_isotope_alphas();
137
+ print_totals();
138
+ print_eh();
139
+ print_species();
140
+ print_alkalinity();
141
+ print_saturation_indices();
142
+ if (!pr.saturation_indices)
143
+ set_pr_in_false();
144
+ return (OK);
145
+ }
146
+
147
+ /* ---------------------------------------------------------------------- */
148
+ int Phreeqc::
149
+ punch_all(void)
150
+ /* ---------------------------------------------------------------------- */
151
+ {
152
+ //#ifndef PHREEQ98 /* if not PHREEQ98 use the standard declaration */
153
+ // if (pr.hdf == FALSE && (punch.in == FALSE || pr.punch == FALSE) && user_graph->commands == NULL)
154
+ // return (OK);
155
+ ///*
156
+ // * Punch results
157
+ // */
158
+ // if (state == TRANSPORT || state == PHAST || state == ADVECTION)
159
+ // {
160
+ // use.Get_kinetics_ptr() = kinetics_bsearch(use.Get_n_kinetics_user(), &i);
161
+ // }
162
+ // else if (use.Get_kinetics_in() != FALSE)
163
+ // {
164
+ // use.Get_kinetics_ptr() = kinetics_bsearch(-2, &i);
165
+ // }
166
+ //#else /* if PHREEQ98 execute punch_user_graph first, that is, before punch.in and pr.punch is checked */
167
+ if (state == TRANSPORT || state == PHAST || state == ADVECTION)
168
+ {
169
+ use.Set_kinetics_ptr(Utilities::Rxn_find(Rxn_kinetics_map, use.Get_n_kinetics_user()));
170
+ }
171
+ else if (use.Get_kinetics_in() != FALSE)
172
+ {
173
+ use.Set_kinetics_ptr(Utilities::Rxn_find(Rxn_kinetics_map, -2));
174
+ }
175
+ #if defined PHREEQ98
176
+ if (pr.user_graph == TRUE)
177
+ {
178
+ punch_user_graph();
179
+ }
180
+ #elif defined MULTICHART
181
+ if (pr.user_graph == TRUE)
182
+ {
183
+ chart_handler.Punch_user_graph(this);
184
+ }
185
+ #endif
186
+ //if (pr.hdf == FALSE && (punch.in == FALSE || pr.punch == FALSE))
187
+ if (pr.hdf == FALSE && (SelectedOutput_map.size() == 0 || pr.punch == FALSE))
188
+ return (OK);
189
+ std::map < int, SelectedOutput >::iterator so_it = SelectedOutput_map.begin();
190
+ for ( ; so_it != SelectedOutput_map.end(); so_it++)
191
+ {
192
+ current_selected_output = &(so_it->second);
193
+ if (pr.punch == FALSE ||
194
+ current_selected_output == NULL ||
195
+ !current_selected_output->Get_active() /* ||
196
+ current_selected_output->Get_punch_ostream() == NULL*/)
197
+ continue;
198
+ phrq_io->Set_punch_ostream(current_selected_output->Get_punch_ostream());
199
+
200
+ // UserPunch
201
+ std::map < int, UserPunch >::iterator up_it = UserPunch_map.find(current_selected_output->Get_n_user());
202
+ current_user_punch = up_it == UserPunch_map.end() ? NULL : &(up_it->second);
203
+ punch_identifiers();
204
+ punch_totals();
205
+ punch_molalities();
206
+ punch_activities();
207
+ punch_pp_assemblage();
208
+ punch_saturation_indices();
209
+ punch_gas_phase();
210
+ punch_kinetics();
211
+ punch_ss_assemblage();
212
+ punch_isotopes();
213
+ punch_calculate_values();
214
+ punch_user_punch();
215
+ /*
216
+ * new line for punch_file
217
+ */
218
+ if (current_selected_output->Get_new_line() && this->Get_output_newline())
219
+ punch_msg("\n");
220
+ this->Set_output_newline(true);
221
+
222
+ /*
223
+ * signal end of row
224
+ */
225
+ fpunchf_end_row("\n");
226
+ punch_flush();
227
+ }
228
+ current_selected_output = NULL;
229
+ current_user_punch = NULL;
230
+ phrq_io->Set_punch_ostream(NULL);
231
+ return (OK);
232
+ }
233
+ /* ---------------------------------------------------------------------- */
234
+ int Phreeqc::
235
+ print_diffuse_layer(cxxSurfaceCharge *charge_ptr)
236
+ /* ---------------------------------------------------------------------- */
237
+ {
238
+ /*
239
+ * Prints total moles of each element in diffuse layer
240
+ * Remove comment to print total moles of each species
241
+ */
242
+ LDBLE mass_water_surface, r, sum_surfs;
243
+ LDBLE molality, moles_excess, moles_surface, d;
244
+
245
+ if (use.Get_surface_ptr() == NULL)
246
+ return (OK);
247
+ /*
248
+ * Find position of component in surface charge data
249
+ */
250
+ int j;
251
+ for (j = 0; j < count_unknowns; j++)
252
+ {
253
+ if (x[j]->type != SURFACE_CB)
254
+ continue;
255
+ cxxSurfaceCharge * charge_ptr_search = use.Get_surface_ptr()->Find_charge(x[j]->surface_charge);
256
+ if (charge_ptr->Get_name() == charge_ptr_search->Get_name())
257
+ {
258
+ break;
259
+ }
260
+ }
261
+ if (j >= count_unknowns)
262
+ {
263
+ error_string = sformatf(
264
+ "In print_diffuse_layer: component not found, %s.",
265
+ charge_ptr->Get_name().c_str());
266
+ error_msg(error_string, STOP);
267
+ }
268
+ /*
269
+ * Loop through all surface components, calculate each H2O surface (diffuse layer),
270
+ * H2O aq, and H2O bulk (diffuse layers plus aqueous).
271
+ */
272
+
273
+ if (mass_water_surfaces_x != 0)
274
+ {
275
+ d = 100 * charge_ptr->Get_mass_water() / mass_water_surfaces_x;
276
+ }
277
+ else
278
+ {
279
+ d = 0.0;
280
+ }
281
+ output_msg(sformatf(
282
+ "\tWater in diffuse layer: %8.3e kg, %4.1f%% of total DDL-water.\n",
283
+ (double) charge_ptr->Get_mass_water(), (double) d));
284
+ if (print_viscosity && d > 0)
285
+ {
286
+ cxxSurface * surf_ptr = use.Get_surface_ptr();
287
+ if (surf_ptr->Get_calc_viscosity())
288
+ {
289
+ viscosity(surf_ptr);
290
+ viscosity(nullptr);
291
+ if (d == 100)
292
+ output_msg(sformatf(
293
+ "\t\t calculated viscosity: %7.5f mPa s.\n", (double)charge_ptr->Get_DDL_viscosity()));
294
+ else
295
+ output_msg(sformatf(
296
+ "\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()));
297
+ }
298
+ else
299
+ output_msg(sformatf(
300
+ "\t\t viscosity: %7.5f mPa s for DDL water.\n", (double)charge_ptr->Get_DDL_viscosity() * viscos));
301
+ }
302
+
303
+ if (use.Get_surface_ptr()->Get_debye_lengths() > 0 && d > 0)
304
+ {
305
+ sum_surfs = 0.0;
306
+ for (j = 0; j < count_unknowns; j++)
307
+ {
308
+ if (x[j]->type != SURFACE_CB)
309
+ continue;
310
+ cxxSurfaceCharge * charge_ptr_search = use.Get_surface_ptr()->Find_charge(x[j]->surface_charge);
311
+ sum_surfs +=
312
+ charge_ptr_search->Get_specific_area() * charge_ptr_search->Get_grams();
313
+ }
314
+ r = 0.002 * mass_water_bulk_x / sum_surfs;
315
+ output_msg(sformatf(
316
+ "\tRadius of total pore: %8.3e m; of free pore: %8.3e m.\n",
317
+ (double) r, (double) (r - use.Get_surface_ptr()->Get_thickness())));
318
+ }
319
+
320
+ if (debug_diffuse_layer == TRUE)
321
+ {
322
+ output_msg(sformatf(
323
+ "\n\t\tDistribution of species in diffuse layer\n\n"));
324
+ output_msg(sformatf(
325
+ "\n\tSpecies \t Moles \tMoles excess\t g\n"));
326
+ }
327
+ if ((mass_water_surface = charge_ptr->Get_mass_water()))
328
+ {
329
+ count_elts = 0;
330
+ paren_count = 0;
331
+ for (j = 0; j < (int)this->s_x.size(); j++)
332
+ {
333
+ if (s_x[j]->type > HPLUS)
334
+ continue;
335
+ molality = under(s_x[j]->lm);
336
+ moles_excess = mass_water_aq_x * molality * (charge_ptr->Get_g_map()[s_x[j]->z].Get_g() * s_x[j]->erm_ddl +
337
+ mass_water_surface / mass_water_aq_x * (s_x[j]->erm_ddl - 1));
338
+ moles_surface = mass_water_surface * molality + moles_excess;
339
+ if (debug_diffuse_layer == TRUE)
340
+ {
341
+ output_msg(sformatf("\t%-12s\t%12.3e\t%12.3e\t%12.3e\n",
342
+ s_x[j]->name, moles_surface, moles_excess,
343
+ charge_ptr->Get_g_map()[s_x[j]->z].Get_g()));
344
+ }
345
+ /*
346
+ * Accumulate elements in diffuse layer
347
+ */
348
+ add_elt_list(s_x[j]->next_elt, moles_surface);
349
+ }
350
+ /*
351
+ Utilities::strcpy_safe(token, MAX_LENGTH, s_h2o->name);
352
+ ptr = &(token[0]);
353
+ get_elts_in_species (&ptr, mass_water_surface / gfw_water);
354
+ */
355
+ elt_list_combine();
356
+ /*
357
+ * Print totals
358
+ */
359
+ if (use.Get_surface_ptr()->Get_dl_type() != cxxSurface::DONNAN_DL)
360
+ {
361
+ output_msg(sformatf(
362
+ "\n\tTotal moles in diffuse layer (excluding water)\n\n"));
363
+ }
364
+ else
365
+ {
366
+ LDBLE exp_g = charge_ptr->Get_g_map()[1].Get_g() * mass_water_aq_x / ((1 - charge_ptr->Get_f_free()) * mass_water_surface) + 1;
367
+ LDBLE psi_DL = -log(exp_g) * R_KJ_DEG_MOL * tk_x / F_KJ_V_EQ;
368
+ if (use.Get_surface_ptr()->Get_correct_D())
369
+ {
370
+ output_msg(sformatf(
371
+ "\n\tTotal moles in diffuse layer (excluding water), Donnan corrected to match Poisson-Boltzmann."));
372
+ output_msg(sformatf(
373
+ "\n\tDonnan Layer potential, psi_DL = %10.3e V, for (1 - f_free) of DL water = %10.3e kg (f_free = %5.3f).\n\tBoltzmann factor, exp(-psi_DL * z * z_corr * F / RT) = %9.3e (= c_DL / c_free if z is +1)",
374
+ psi_DL, (1 - charge_ptr->Get_f_free()) * mass_water_surface, charge_ptr->Get_f_free(), exp_g));
375
+ output_msg(sformatf(
376
+ "\n\t\tThus: Moles of Na+ = (c_DL * (1 - f_free) + f_free) * c_free * kg DDL-water\n\n"));
377
+ }
378
+ else
379
+ {
380
+ output_msg(sformatf(
381
+ "\n\tTotal moles in diffuse layer (excluding water), Donnan calculation."));
382
+ output_msg(sformatf(
383
+ "\n\tDonnan Layer potential, psi_DL = %10.3e V.\n\tBoltzmann factor, exp(-psi_DL * F / RT) = %9.3e (= c_DL / c_free if z is +1).\n\n",
384
+ psi_DL, exp_g));
385
+ }
386
+ }
387
+ output_msg(sformatf("\tElement \t Moles\n"));
388
+ for (j = 0; j < count_elts; j++)
389
+ {
390
+ output_msg(sformatf("\t%-14s\t%12.4e\n",
391
+ elt_list[j].elt->name, (double)elt_list[j].coef));
392
+ }
393
+ }
394
+ return (OK);
395
+ }
396
+
397
+ /* ---------------------------------------------------------------------- */
398
+ int Phreeqc::
399
+ print_eh(void)
400
+ /* ---------------------------------------------------------------------- */
401
+ {
402
+ /*
403
+ * Prints eh calculated from redox couples
404
+ * Only calculates eh if two redox states of an element have mass balance
405
+ * equations.
406
+ */
407
+ int i, j, k, first;
408
+ LDBLE pe, eh;
409
+ class master *master_ptr0, *master_ptr1;
410
+ char token[MAX_LENGTH];
411
+
412
+ if (pr.eh == FALSE || pr.all == FALSE)
413
+ return (OK);
414
+
415
+ tk_x = tc_x + 273.15;
416
+
417
+ first = TRUE;
418
+ for (i = 0; i < (int)master.size(); i++)
419
+ {
420
+ if (master[i]->in != TRUE)
421
+ continue;
422
+ if (master[i]->primary == TRUE)
423
+ continue;
424
+ /*
425
+ * Secondary master species has mass balance equation
426
+ */
427
+ master_ptr0 = master[i]->elt->primary;
428
+ for (k = i + 1; k < (int)master.size(); k++)
429
+ {
430
+ if (master[k]->in != TRUE)
431
+ continue;
432
+ master_ptr1 = master[k]->elt->primary;
433
+ if (master_ptr1 != master_ptr0)
434
+ break;
435
+ /*
436
+ * Another secondary master species of same element has mass balance equation
437
+ * Rewrite equations to calculate pe
438
+ */
439
+ rewrite_master_to_secondary(master[k], master[i]);
440
+ trxn_swap("e-");
441
+ /* debug
442
+ trxn_print();
443
+ */
444
+ /*
445
+ * Calculate pe, eh
446
+ */
447
+ pe = -k_calc(trxn.logk, tk_x, patm_x * PASCAL_PER_ATM);
448
+ for (j = 1; j < count_trxn; j++)
449
+ {
450
+ pe -= trxn.token[j].s->la * trxn.token[j].coef;
451
+ }
452
+ eh = ((LOG_10 * R_KJ_DEG_MOL * tk_x) / F_KJ_V_EQ) * pe;
453
+ /*
454
+ * Print heading
455
+ */
456
+ if (first == TRUE)
457
+ {
458
+ print_centered("Redox couples");
459
+ output_msg(sformatf("\t%-15s%12s%12s\n\n",
460
+ "Redox couple", "pe", "Eh (volts)"));
461
+ first = FALSE;
462
+ }
463
+ /*
464
+ * Print result
465
+ */
466
+ Utilities::strcpy_safe(token, MAX_LENGTH, master[i]->elt->name);
467
+ Utilities::strcat_safe(token, MAX_LENGTH, "/");
468
+ Utilities::strcat_safe(token, MAX_LENGTH, master[k]->elt->name);
469
+ output_msg(sformatf("\t%-15s%12.4f%12.4f\n", token,
470
+ (double) pe, (double) eh));
471
+ }
472
+ }
473
+ if (first == FALSE)
474
+ output_msg(sformatf("\n"));
475
+ return (OK);
476
+ }
477
+ /* ---------------------------------------------------------------------- */
478
+ int Phreeqc::
479
+ print_exchange(void)
480
+ /* ---------------------------------------------------------------------- */
481
+ {
482
+ /*
483
+ * Print moles of each exchange species
484
+ */
485
+ int i;
486
+ cxxExchange * exchange_ptr;
487
+ const char *name, *name1;
488
+ class master *master_ptr;
489
+ LDBLE dum, dum2;
490
+ /*
491
+ * Print exchange data
492
+ */
493
+ exchange_ptr = use.Get_exchange_ptr();
494
+ if (exchange_ptr == NULL || pr.exchange == FALSE || pr.all == FALSE)
495
+ return (OK);
496
+
497
+ if (state >= REACTION)
498
+ {
499
+ print_centered("Exchange composition");
500
+ }
501
+ /*
502
+ * Print list of species
503
+ */
504
+
505
+ s_h2o->lm = s_h2o->la;
506
+ name = s_hplus->secondary->elt->name;
507
+ for (i = 0; i < (int)species_list.size(); i++)
508
+ {
509
+ /*
510
+ * Get name of master species
511
+ */
512
+ if (species_list[i].s->type != EX)
513
+ continue;
514
+ if (species_list[i].master_s->secondary != NULL)
515
+ {
516
+ master_ptr = species_list[i].master_s->secondary;
517
+ name1 = species_list[i].master_s->secondary->elt->name;
518
+ }
519
+ else
520
+ {
521
+ master_ptr = species_list[i].master_s->primary;
522
+ name1 = species_list[i].master_s->primary->elt->name;
523
+ }
524
+ /*
525
+ * Check if new master species, print total molality
526
+ */
527
+ if (name1 != name)
528
+ {
529
+ name = name1;
530
+ output_msg(sformatf("%-14s%12.3e mol", name,
531
+ (double) master_ptr->unknown->moles));
532
+ cxxExchange *exchange_ptr = (cxxExchange *) (use.Get_exchange_ptr());
533
+ if (master_ptr->unknown->exch_comp == NULL)
534
+ {
535
+ error_string = sformatf("Exchange unknown has no exchange component for exchanger %s."
536
+ "\nIs the same name used for a SURFACE and an EXCHANGER?",
537
+ master_ptr->unknown->description);
538
+ error_msg(error_string, STOP);
539
+ }
540
+ const cxxExchComp *exchange_comp_ptr = exchange_ptr->Find_comp(master_ptr->unknown->exch_comp);
541
+ assert(exchange_comp_ptr);
542
+ if (exchange_comp_ptr->Get_phase_name().size() > 0)
543
+ {
544
+ output_msg(sformatf("\t[%g (mol %s)/(mol %s)]",
545
+ (double) exchange_comp_ptr->Get_phase_proportion(),
546
+ exchange_comp_ptr->Get_formula().c_str(),
547
+ exchange_comp_ptr->Get_phase_name().c_str()));
548
+ }
549
+ else if (exchange_comp_ptr->Get_rate_name().size() > 0)
550
+ {
551
+ output_msg(sformatf(
552
+ "\t[%g (mol %s)/(mol kinetic reactant %s)]",
553
+ (double) exchange_comp_ptr->Get_phase_proportion(),
554
+ exchange_comp_ptr->Get_formula().c_str(),
555
+ exchange_comp_ptr->Get_rate_name().c_str()));
556
+ }
557
+ output_msg(sformatf("\n\n"));
558
+ /* Heading for species */
559
+ output_msg(sformatf("\t%-15s%12s%12s%12s%10s\n", " ", " ",
560
+ "Equiv- ", "Equivalent", "Log "));
561
+ output_msg(sformatf("\t%-15s%12s%12s%12s%10s\n\n",
562
+ "Species", "Moles ", "alents ", "Fraction", "Gamma"));
563
+ }
564
+ /*
565
+ * Print species data
566
+ */
567
+ if (master_ptr->total > 1.0e-16)
568
+ {
569
+ if (species_list[i].s->equiv != 0.0)
570
+ {
571
+ dum = fabs(species_list[i].s->equiv) / master_ptr->total;
572
+ }
573
+ else
574
+ {
575
+ if (species_list[i].master_s->z == 0)
576
+ {
577
+ dum = 1 / master_ptr->total;
578
+ }
579
+ else
580
+ {
581
+ dum = 1;
582
+ }
583
+ }
584
+ if (species_list[i].master_s->z != 0.0)
585
+ {
586
+ dum2 = fabs(species_list[i].master_s->z);
587
+ }
588
+ else
589
+ {
590
+ dum2 = 1;
591
+ }
592
+ output_msg(sformatf("\t%-15s%12.3e%12.3e%12.3e%10.3f\n",
593
+ species_list[i].s->name,
594
+ (double) species_list[i].s->moles,
595
+ (double) (species_list[i].s->moles * dum2 *
596
+ species_list[i].s->equiv),
597
+ (double) (species_list[i].s->moles *
598
+ dum /* / dum2 */ ),
599
+ (double) (species_list[i].s->lg - log10(dum))));
600
+ }
601
+ }
602
+ output_msg(sformatf("\n"));
603
+ return (OK);
604
+ }
605
+ /* ---------------------------------------------------------------------- */
606
+ int Phreeqc::
607
+ print_gas_phase(void)
608
+ /* ---------------------------------------------------------------------- */
609
+ {
610
+ /*
611
+ * Prints gas phase composition if present
612
+ */
613
+ LDBLE lp, moles, initial_moles, delta_moles;
614
+ class rxn_token *rxn_ptr;
615
+ char info[MAX_LENGTH];
616
+ bool PR = false;
617
+
618
+ if (pr.gas_phase == FALSE || pr.all == FALSE)
619
+ return (OK);
620
+ if (use.Get_gas_phase_ptr() == NULL)
621
+ return (OK);
622
+
623
+ cxxGasPhase *gas_phase_ptr = use.Get_gas_phase_ptr();
624
+ if (gas_phase_ptr->Get_v_m() >= 0.01)
625
+ PR = true;
626
+ if (gas_phase_ptr->Get_type() == cxxGasPhase::GP_PRESSURE)
627
+ {
628
+ if (gas_unknown == NULL)
629
+ return (OK);
630
+ if (gas_unknown->moles < 1e-12)
631
+ {
632
+ snprintf(info, sizeof(info), "Fixed-pressure gas phase %d dissolved completely",
633
+ use.Get_n_gas_phase_user());
634
+ print_centered(info);
635
+ return (OK);
636
+ }
637
+ gas_phase_ptr->Set_total_moles(gas_unknown->moles);
638
+ gas_phase_ptr->Set_volume(gas_phase_ptr->Get_total_moles() * R_LITER_ATM * tk_x /
639
+ gas_phase_ptr->Get_total_p());
640
+ if (PR)
641
+ gas_phase_ptr->Set_volume(gas_phase_ptr->Get_v_m() * gas_unknown->moles);
642
+ }
643
+ /*
644
+ * Print heading
645
+ */
646
+ print_centered("Gas phase");
647
+ output_msg(sformatf("Total pressure: %5.2f atmospheres",
648
+ (double) gas_phase_ptr->Get_total_p()));
649
+ if (gas_phase_ptr->Get_total_p() >= MAX_P_NONLLNL && llnl_temp.size() == 0)
650
+ output_msg(" WARNING: Program limit.\n");
651
+ else if (PR)
652
+ output_msg(" (Peng-Robinson calculation)\n");
653
+ else
654
+ output_msg(" \n");
655
+ output_msg(sformatf(" Gas volume: %10.2e liters\n",
656
+ (double) gas_phase_ptr->Get_volume()));
657
+ if(gas_phase_ptr->Get_total_moles() > 0)
658
+ {
659
+ if (PR)
660
+ {
661
+ output_msg(sformatf(" Molar volume: %10.2e liters/mole",
662
+ (double) (gas_phase_ptr->Get_v_m())));
663
+ }
664
+ else
665
+ {
666
+ output_msg(sformatf(" Molar volume: %10.2e liters/mole",
667
+ (double) (gas_phase_ptr->Get_volume() / gas_phase_ptr->Get_total_moles())));
668
+ }
669
+ }
670
+ if (/*!numerical_fixed_volume && */((PR && gas_phase_ptr->Get_v_m() <= 0.016)))
671
+ output_msg(" WARNING: Program limit for Peng-Robinson.\n");
672
+ else
673
+ output_msg("\n");
674
+ if (PR)
675
+ output_msg(sformatf( " P * Vm / RT: %8.5f (Compressibility Factor Z) \n",
676
+ (double) (gas_phase_ptr->Get_total_p() * gas_phase_ptr->Get_v_m() / (R_LITER_ATM * tk_x))));
677
+
678
+
679
+ output_msg(sformatf("\n%68s\n%78s\n", "Moles in gas",
680
+ "----------------------------------"));
681
+ if (PR)
682
+ output_msg(sformatf( "%-11s%12s%12s%7s%12s%12s%12s\n\n", "Component",
683
+ "log P", "P", "phi", "Initial", "Final", "Delta"));
684
+ else
685
+ output_msg(sformatf("%-18s%12s%12s%12s%12s%12s\n\n", "Component",
686
+ "log P", "P", "Initial", "Final", "Delta"));
687
+
688
+ for (size_t j = 0; j < gas_phase_ptr->Get_gas_comps().size(); j++)
689
+ {
690
+ /*
691
+ * Calculate partial pressure
692
+ */
693
+ cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[j]);
694
+ int k;
695
+ class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE);
696
+ if (phase_ptr->in == TRUE)
697
+ {
698
+ lp = -phase_ptr->lk;
699
+ for (rxn_ptr =
700
+ &phase_ptr->rxn_x.token[0] + 1;
701
+ rxn_ptr->s != NULL; rxn_ptr++)
702
+ {
703
+ lp += rxn_ptr->s->la * rxn_ptr->coef;
704
+ }
705
+ lp -= phase_ptr->pr_si_f;
706
+ moles = phase_ptr->moles_x;
707
+ }
708
+ else
709
+ {
710
+ lp = -99.99;
711
+ moles = 0;
712
+ phase_ptr->p_soln_x = 0;
713
+ }
714
+ /*
715
+ * Print gas composition
716
+ */
717
+ if (state != TRANSPORT && state != PHAST)
718
+ {
719
+ initial_moles = gc_ptr->Get_moles();
720
+ delta_moles = phase_ptr->moles_x - gc_ptr->Get_moles();
721
+ }
722
+ else
723
+ {
724
+ initial_moles = gc_ptr->Get_initial_moles();
725
+ delta_moles = gc_ptr->Get_initial_moles() -
726
+ gc_ptr->Get_moles();
727
+ }
728
+ if (moles <= MIN_TOTAL)
729
+ moles = 0.0;
730
+ if (fabs(delta_moles) <= MIN_TOTAL)
731
+ delta_moles = 0.0;
732
+ if (PR)
733
+ {
734
+ output_msg(sformatf("%-11s%12.2f%12.3e%7.3f%12.3e%12.3e%12.3e\n",
735
+ phase_ptr->name,
736
+ (double) lp,
737
+ (double) phase_ptr->p_soln_x,
738
+ (double) phase_ptr->pr_phi,
739
+ (double) initial_moles,
740
+ (double) moles,
741
+ (double) delta_moles));
742
+ }
743
+ else
744
+ output_msg(sformatf("%-18s%12.2f%12.3e%12.3e%12.3e%12.3e\n",
745
+ phase_ptr->name,
746
+ (double) lp,
747
+ (double) phase_ptr->p_soln_x,
748
+ (double) initial_moles,
749
+ (double) moles,
750
+ (double) delta_moles));
751
+ //if (!strcmp(phase_ptr->name, "H2O(g)") && phase_ptr->p_soln_x == 90)
752
+ // output_msg(" WARNING: The pressure of H2O(g) is fixed to the program limit.\n");
753
+
754
+ }
755
+ output_msg("\n");
756
+ return (OK);
757
+ }
758
+ /* ---------------------------------------------------------------------- */
759
+ int Phreeqc::
760
+ print_ss_assemblage(void)
761
+ /* ---------------------------------------------------------------------- */
762
+ {
763
+ /*
764
+ * Prints solid solution composition if present
765
+ */
766
+ int i, j;
767
+ LDBLE delta_moles;
768
+ LDBLE nb, nc, xb, xb1, xb2, xb1moles, xb2moles;
769
+
770
+ if (pr.ss_assemblage == FALSE || pr.all == FALSE)
771
+ return (OK);
772
+ if (use.Get_ss_assemblage_ptr() == NULL)
773
+ return (OK);
774
+ /*
775
+ * Print heading
776
+ */
777
+ print_centered("Solid solutions");
778
+ output_msg(sformatf("\n"));
779
+ output_msg(sformatf("%-15s %22s %11s %11s %11s\n\n",
780
+ "Solid solution", "Component", "Moles", "Delta moles",
781
+ "Mole fract"));
782
+ /*
783
+ * Print solid solutions
784
+ */
785
+ std::vector<cxxSS *> ss_ptrs = use.Get_ss_assemblage_ptr()->Vectorize();
786
+ for (j = 0; j < (int) ss_ptrs.size(); j++)
787
+ {
788
+ cxxSS * ss_ptr = ss_ptrs[j];
789
+ if (ss_ptr->Get_ss_in())
790
+ {
791
+ /* solid solution name, moles */
792
+ output_msg(sformatf("%-15s %22s %11.2e\n",
793
+ ss_ptr->Get_name().c_str(), " ",
794
+ (double) ss_ptr->Get_total_moles()));
795
+ /* component name, moles, delta moles, mole fraction */
796
+
797
+ for (i = 0; i < (int) ss_ptr->Get_ss_comps().size(); i++)
798
+ {
799
+ cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[i]);
800
+ if (state != TRANSPORT && state != PHAST)
801
+ {
802
+ delta_moles =
803
+ comp_ptr->Get_moles() -
804
+ comp_ptr->Get_initial_moles() -
805
+ comp_ptr->Get_delta();
806
+ }
807
+ else
808
+ {
809
+ delta_moles =
810
+ comp_ptr->Get_moles() -
811
+ comp_ptr->Get_init_moles();
812
+ }
813
+ output_msg(sformatf(
814
+ "%15s %22s %11.2e %11.2e %11.2e\n", " ",
815
+ comp_ptr->Get_name().c_str(),
816
+ (double) comp_ptr->Get_moles(), (double) delta_moles,
817
+ (double) (comp_ptr->Get_moles() /
818
+ ss_ptr->Get_total_moles())));
819
+ }
820
+ if (ss_ptr->Get_miscibility())
821
+ {
822
+ cxxSScomp *comp0_ptr = &(ss_ptr->Get_ss_comps()[0]);
823
+ cxxSScomp *comp1_ptr = &(ss_ptr->Get_ss_comps()[1]);
824
+ nc = comp0_ptr->Get_moles();
825
+ nb = comp1_ptr->Get_moles();
826
+ xb = nb / (nb + nc);
827
+ xb1 = ss_ptr->Get_xb1();
828
+ xb2 = ss_ptr->Get_xb2();
829
+
830
+ if (xb > xb1 && xb < xb2)
831
+ {
832
+ xb2moles = (xb1 - 1) / xb1 * nb + nc;
833
+ xb2moles = xb2moles / ((xb1 - 1) / xb1 * xb2 + (1 - xb2));
834
+ xb1moles = (nb - xb2moles * xb2) / xb1;
835
+ output_msg(sformatf(
836
+ "\n%14s Solid solution is in miscibility gap\n",
837
+ " "));
838
+ output_msg(sformatf(
839
+ "%14s End members in pct of %s\n\n", " ",
840
+ comp1_ptr->Get_name().c_str()));
841
+ output_msg(sformatf("%22s %11g pct %11.2e\n",
842
+ " ", (double) xb1, (double) xb1moles));
843
+ output_msg(sformatf("%22s %11g pct %11.2e\n",
844
+ " ", (double) xb2, (double) xb2moles));
845
+ }
846
+ }
847
+ }
848
+ else
849
+ {
850
+ /* solid solution name, moles */
851
+ output_msg(sformatf("%-15s %22s %11.2e\n",
852
+ ss_ptr->Get_name().c_str(), " ",
853
+ (double) 0.0));
854
+ /* component name, moles, delta moles, mole fraction */
855
+ for (i = 0; i < (int) ss_ptr->Get_ss_comps().size(); i++)
856
+ {
857
+ cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[i]);
858
+ if (state != TRANSPORT && state != PHAST)
859
+ {
860
+ delta_moles =
861
+ comp_ptr->Get_moles() -
862
+ comp_ptr->Get_initial_moles() -
863
+ comp_ptr->Get_delta();
864
+ }
865
+ else
866
+ {
867
+ delta_moles =
868
+ comp_ptr->Get_moles() -
869
+ comp_ptr->Get_init_moles();
870
+ }
871
+ output_msg(sformatf(
872
+ "%15s %22s %11.2e %11.2e %11.2e\n", " ",
873
+ comp_ptr->Get_name().c_str(),
874
+ (double) 0, (double) delta_moles, (double) 0));
875
+ }
876
+ }
877
+ }
878
+ output_msg(sformatf("\n"));
879
+ return (OK);
880
+ }
881
+ /* ---------------------------------------------------------------------- */
882
+ int Phreeqc::
883
+ print_reaction(void)
884
+ /* ---------------------------------------------------------------------- */
885
+ {
886
+ /*
887
+ * prints irreversible reaction as defined and as
888
+ * relative moles of each element and total amount
889
+ * of reaction
890
+ */
891
+ cxxReaction *reaction_ptr;
892
+ if (pr.use == FALSE || pr.all == FALSE)
893
+ return (OK);
894
+ if (state < REACTION || use.Get_reaction_in() == FALSE)
895
+ return (OK);
896
+ if (state == TRANSPORT && transport_step == 0)
897
+ return (OK);
898
+ reaction_ptr = use.Get_reaction_ptr();
899
+ /*
900
+ * Print amount of reaction
901
+ */
902
+ output_msg(sformatf("Reaction %d.\t%s\n\n", use.Get_n_reaction_user(),
903
+ reaction_ptr->Get_description().c_str()));
904
+ output_msg(sformatf(
905
+ "\t%11.3e moles of the following reaction have been added:\n\n",
906
+ (double) step_x));
907
+ /*
908
+ * Print reaction
909
+ */
910
+ output_msg(sformatf("\t%-15s%10s\n", " ", "Relative"));
911
+ output_msg(sformatf("\t%-15s%10s\n\n", "Reactant", "moles"));
912
+ cxxNameDouble::const_iterator cit = reaction_ptr->Get_reactantList().begin();
913
+ for ( ; cit != reaction_ptr->Get_reactantList().end(); cit++)
914
+ {
915
+ output_msg(sformatf("\t%-15s%13.5f\n",
916
+ cit->first.c_str(), (double) cit->second));
917
+ }
918
+ output_msg(sformatf("\n"));
919
+ /*
920
+ * Debug
921
+ */
922
+
923
+ output_msg(sformatf("\t%-15s%10s\n", " ", "Relative"));
924
+ output_msg(sformatf("\t%-15s%10s\n", "Element", "moles"));
925
+ cit = reaction_ptr->Get_elementList().begin();
926
+ for ( ; cit != reaction_ptr->Get_elementList().end(); cit++)
927
+ {
928
+ class element * elt_ptr = element_store(cit->first.c_str());
929
+ assert(elt_ptr);
930
+ output_msg(sformatf("\t%-15s%13.5f\n",
931
+ elt_ptr->name,
932
+ (double) cit->second));
933
+ }
934
+ output_msg(sformatf("\n"));
935
+ return (OK);
936
+ }
937
+ /* ---------------------------------------------------------------------- */
938
+ int Phreeqc::
939
+ print_kinetics(void)
940
+ /* ---------------------------------------------------------------------- */
941
+ {
942
+ /*
943
+ * prints kinetic reaction,
944
+ * should be called only on final kinetic step
945
+ */
946
+ LDBLE sim_time;
947
+ cxxKinetics *kinetics_ptr;
948
+ if (pr.kinetics == FALSE || pr.all == FALSE)
949
+ return (OK);
950
+ if (state < REACTION)
951
+ return (OK);
952
+ kinetics_ptr = NULL;
953
+ if (use.Get_kinetics_in() == TRUE)
954
+ {
955
+ if (state == TRANSPORT || state == PHAST || state == ADVECTION)
956
+ {
957
+ kinetics_ptr = Utilities::Rxn_find(Rxn_kinetics_map, use.Get_n_kinetics_user());
958
+ }
959
+ else
960
+ {
961
+ kinetics_ptr = Utilities::Rxn_find(Rxn_kinetics_map, -2);
962
+ }
963
+ }
964
+ if (kinetics_ptr == NULL)
965
+ return (OK);
966
+ /*
967
+ * determine time step
968
+ */
969
+ if (state == TRANSPORT || state == PHAST)
970
+ {
971
+ kin_time_x = timest;
972
+ }
973
+ else if (state == ADVECTION)
974
+ {
975
+ kin_time_x = advection_kin_time;
976
+ }
977
+ sim_time = 0.;
978
+ if (run_info.Get_run_cells())
979
+ {
980
+ sim_time = rate_sim_time;
981
+ }
982
+ else
983
+ {
984
+ if (incremental_reactions == TRUE)
985
+ {
986
+ if (!kinetics_ptr->Get_equalIncrements())
987
+ {
988
+ for (int i = 0; i < reaction_step; i++)
989
+ {
990
+ if (i < (int) kinetics_ptr->Get_steps().size())
991
+ {
992
+ sim_time += kinetics_ptr->Get_steps()[i];
993
+ }
994
+ else
995
+ {
996
+ sim_time += kinetics_ptr->Get_steps().back();
997
+ }
998
+ }
999
+ }
1000
+ else
1001
+ {
1002
+ if (reaction_step > kinetics_ptr->Get_count())
1003
+ {
1004
+ sim_time = kinetics_ptr->Get_steps().front();
1005
+ }
1006
+ else
1007
+ {
1008
+ sim_time =
1009
+ reaction_step * kinetics_ptr->Get_steps().front() /
1010
+ ((LDBLE) (kinetics_ptr->Get_count()));
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+ /*
1016
+ * Print amount of reaction
1017
+ */
1018
+ if (phast == FALSE)
1019
+ {
1020
+ output_msg(sformatf("Kinetics %d.\t%s\n\n",
1021
+ use.Get_n_kinetics_user(), kinetics_ptr->Get_description().c_str()));
1022
+ }
1023
+ else
1024
+ {
1025
+ output_msg(sformatf("Kinetics.\n\n"));
1026
+ }
1027
+ /*
1028
+ * Print reaction
1029
+ */
1030
+ if (state == TRANSPORT)
1031
+ {
1032
+ output_msg(sformatf("\tTime: %g seconds\n",
1033
+ (double) (initial_total_time + transport_step * timest)));
1034
+ output_msg(sformatf("\tTime step: %g seconds\n\n",
1035
+ (double) kin_time_x));
1036
+ }
1037
+ else if (state == ADVECTION)
1038
+ {
1039
+ output_msg(sformatf("\tTime: %g seconds\n",
1040
+ (double) (initial_total_time +
1041
+ advection_step * advection_kin_time)));
1042
+ output_msg(sformatf("\tTime step: %g seconds\n\n",
1043
+ (double) kin_time_x));
1044
+ }
1045
+ else if (state == PHAST)
1046
+ {
1047
+ output_msg(sformatf("\tTime: %g seconds\n",
1048
+ (double) rate_sim_time_end));
1049
+ output_msg(sformatf("\tTime step: %g seconds\n\n",
1050
+ (double) kin_time_x));
1051
+ }
1052
+ else if (state == REACTION)
1053
+ {
1054
+ if (incremental_reactions == FALSE)
1055
+ {
1056
+ output_msg(sformatf("\tTime step: %g seconds\n\n",
1057
+ (double) kin_time_x));
1058
+ }
1059
+ else
1060
+ {
1061
+ output_msg(sformatf(
1062
+ "\tTime step: %g seconds (Incremented time: %g seconds)\n\n",
1063
+ (double) kin_time_x, (double) sim_time));
1064
+ }
1065
+ }
1066
+ output_msg(sformatf("\t%-15s%12s%12s %-15s%12s\n\n",
1067
+ "Rate name", "Delta Moles", "Total Moles", "Reactant",
1068
+ "Coefficient"));
1069
+ for (size_t i = 0; i < kinetics_ptr->Get_kinetics_comps().size(); i++)
1070
+ {
1071
+ cxxKineticsComp *kinetics_comp_ptr = &(kinetics_ptr->Get_kinetics_comps()[i]);
1072
+ if (state != TRANSPORT && state != PHAST)
1073
+ {
1074
+ output_msg(sformatf("\t%-15s%12.3e%12.3e",
1075
+ kinetics_comp_ptr->Get_rate_name().c_str(),
1076
+ (double) -kinetics_comp_ptr->Get_moles(),
1077
+ (double) kinetics_comp_ptr->Get_m()));
1078
+ }
1079
+ else
1080
+ {
1081
+ output_msg(sformatf("\t%-15s%12.3e%12.3e",
1082
+ kinetics_comp_ptr->Get_rate_name().c_str(),
1083
+ (double) (kinetics_comp_ptr->Get_m() -
1084
+ kinetics_comp_ptr->Get_initial_moles()),
1085
+ (double) kinetics_comp_ptr->Get_m()));
1086
+ }
1087
+ cxxNameDouble::iterator it = kinetics_comp_ptr->Get_namecoef().begin();
1088
+ for ( ; it != kinetics_comp_ptr->Get_namecoef().end(); it++)
1089
+ {
1090
+ std::string name = it->first;
1091
+ LDBLE coef = it->second;
1092
+ if (it == kinetics_comp_ptr->Get_namecoef().begin())
1093
+ {
1094
+ output_msg(sformatf(" %-15s%12g\n",
1095
+ name.c_str(),
1096
+ (double) coef));
1097
+ }
1098
+ else
1099
+ {
1100
+ output_msg(sformatf("\t%39s %-15s%12g\n", " ",
1101
+ name.c_str(),
1102
+ (double) coef));
1103
+ }
1104
+ }
1105
+ }
1106
+ output_msg(sformatf("\n"));
1107
+ return (OK);
1108
+ }
1109
+ #ifdef SKIP
1110
+ /* ---------------------------------------------------------------------- */
1111
+ int Phreeqc::
1112
+ print_master_reactions(void)
1113
+ /* ---------------------------------------------------------------------- */
1114
+ {
1115
+ /*
1116
+ * Debugging print routine to test primary and secondary reactions
1117
+ */
1118
+ int i;
1119
+ class rxn_token *next_token;
1120
+
1121
+ for (i = 0; i < (int)master.size(); i++)
1122
+ {
1123
+ output_msg(sformatf("%s\t%s\n\tPrimary reaction\n",
1124
+ master[i]->elt->name, master[i]->s->name));
1125
+ next_token = master[i]->rxn_primary.token;
1126
+ for (; next_token->s != NULL; next_token++)
1127
+ {
1128
+ output_msg(sformatf("\t\t%s\t%f\n", next_token->s->name,
1129
+ (double) next_token->coef));
1130
+ }
1131
+ output_msg(sformatf("\n\tSecondary reaction:\n"));
1132
+ if (master[i]->rxn_secondary != NULL)
1133
+ {
1134
+ next_token = master[i]->rxn_secondary.token;
1135
+ for (; next_token->s != NULL; next_token++)
1136
+ {
1137
+ output_msg(sformatf("\t\t%s\t%f\n",
1138
+ next_token->s->name, (double) next_token->coef));
1139
+ }
1140
+ }
1141
+ output_msg(sformatf("\n\tRedox reaction:\n"));
1142
+ if (*(master[i]->pe_rxn) != NULL)
1143
+ {
1144
+ next_token = (*(master[i]->pe_rxn))->token;
1145
+ for (; next_token->s != NULL; next_token++)
1146
+ {
1147
+ output_msg(sformatf("\t\t%s\t%f\n",
1148
+ next_token->s->name, (double) next_token->coef));
1149
+ }
1150
+ }
1151
+ output_msg(sformatf("\n"));
1152
+ }
1153
+ return (OK);
1154
+ }
1155
+ #endif
1156
+ /* ---------------------------------------------------------------------- */
1157
+ int Phreeqc::
1158
+ print_mix(void)
1159
+ /* ---------------------------------------------------------------------- */
1160
+ {
1161
+ /*
1162
+ * prints definition of mixing, solution number and multiplier
1163
+ */
1164
+ cxxMix * mix_ptr;
1165
+ cxxSolution *solution_ptr;
1166
+
1167
+ if (pr.use == FALSE || pr.all == FALSE)
1168
+ return (OK);
1169
+ if (use.Get_mix_in() == FALSE || state < REACTION)
1170
+ return (OK);
1171
+ if (state == TRANSPORT)
1172
+ {
1173
+ mix_ptr = Utilities::Rxn_find(Rxn_mix_map, use.Get_n_mix_user());
1174
+ }
1175
+ else
1176
+ {
1177
+ mix_ptr = Utilities::Rxn_find(Rxn_mix_map, use.Get_n_mix_user_orig());
1178
+ }
1179
+ if (mix_ptr == NULL)
1180
+ {
1181
+ mix_ptr = use.Get_mix_ptr();
1182
+ }
1183
+ /*
1184
+ * Print mixture data
1185
+ */
1186
+ if (mix_ptr == NULL)
1187
+ {
1188
+ return (OK);
1189
+
1190
+ }
1191
+ if (state == TRANSPORT)
1192
+ {
1193
+ output_msg(sformatf("Mixture %d.\t%s\n\n", use.Get_n_mix_user(),
1194
+ mix_ptr->Get_description().c_str()));
1195
+ }
1196
+ else
1197
+ {
1198
+ output_msg(sformatf("Mixture %d.\t%s\n\n", mix_ptr->Get_n_user(),
1199
+ mix_ptr->Get_description().c_str()));
1200
+ }
1201
+ std::map<int, LDBLE>::const_iterator cit;
1202
+ for (cit = mix_ptr->Get_mixComps().begin(); cit != mix_ptr->Get_mixComps().end(); cit++)
1203
+ {
1204
+ solution_ptr = Utilities::Rxn_find(Rxn_solution_map, cit->first);
1205
+ if (solution_ptr == NULL)
1206
+ {
1207
+ input_error++;
1208
+ return (ERROR);
1209
+ }
1210
+ output_msg(sformatf("\t%11.3e Solution %d\t%-55s\n",
1211
+ (double) cit->second,
1212
+ cit->first, solution_ptr->Get_description().c_str()));
1213
+ }
1214
+ output_msg(sformatf("\n"));
1215
+ return (OK);
1216
+ }
1217
+ /* ---------------------------------------------------------------------- */
1218
+ int Phreeqc::
1219
+ print_saturation_indices(void)
1220
+ /* ---------------------------------------------------------------------- */
1221
+ {
1222
+ /*
1223
+ * Prints saturation indices of all applicable pure_phases
1224
+ */
1225
+ int i;
1226
+ LDBLE si, iap;
1227
+ LDBLE lk;
1228
+ LDBLE la_eminus;
1229
+ class rxn_token *rxn_ptr;
1230
+ CReaction *reaction_ptr;
1231
+ bool gas = true;
1232
+
1233
+ if (pr.saturation_indices == FALSE || pr.all == FALSE)
1234
+ return (OK);
1235
+ if (state == INITIAL_SOLUTION)
1236
+ {
1237
+ iap = 0;
1238
+ for (size_t tok = 1; tok < pe_x[default_pe_x].Get_tokens().size() - 1; tok++)
1239
+ {
1240
+ iap += pe_x[default_pe_x].Get_tokens()[tok].coef * pe_x[default_pe_x].Get_tokens()[tok].s->la;
1241
+ /* fprintf(output,"\t%s\t%f\t%f\n", rxn_ptr->s->name, rxn_ptr->coef, rxn_ptr->s->la ); */
1242
+ }
1243
+ lk = k_calc(pe_x[default_pe_x].Get_logk(), tk_x, patm_x * PASCAL_PER_ATM);
1244
+ la_eminus = lk + iap;
1245
+ /* fprintf(output,"\t%s\t%f\n", "pe", si ); */
1246
+ }
1247
+ else
1248
+ {
1249
+ la_eminus = s_eminus->la;
1250
+ }
1251
+ /* If a fixed pressure gas-phase disappeared, no PR for the SI's of gases... */
1252
+ if (use.Get_gas_phase_ptr() != NULL)
1253
+ {
1254
+ cxxGasPhase * gas_phase_ptr = use.Get_gas_phase_ptr();
1255
+ if (gas_phase_ptr->Get_type() == cxxGasPhase::GP_PRESSURE)
1256
+ {
1257
+ if (gas_unknown == NULL || gas_unknown->moles < 1e-12)
1258
+ gas = false;
1259
+ }
1260
+ }
1261
+
1262
+ /*
1263
+ * Print heading
1264
+ */
1265
+ print_centered("Saturation indices");
1266
+ output_msg(sformatf(" %-15s%9s%8s%9s%3d%4s%3d%4s\n\n", "Phase", "SI**",
1267
+ "log IAP", "log K(", int(tk_x), " K, ", int(floor(patm_x + 0.5)), " atm)"));
1268
+
1269
+ for (i = 0; i < (int)phases.size(); i++)
1270
+ {
1271
+ if (phases[i]->in == FALSE || phases[i]->type != SOLID)
1272
+ continue;
1273
+ /* check for solids and gases in equation */
1274
+ if (phases[i]->replaced)
1275
+ reaction_ptr = &phases[i]->rxn_s;
1276
+ else
1277
+ reaction_ptr = &phases[i]->rxn;
1278
+ /*
1279
+ * Print saturation index
1280
+ */
1281
+ reaction_ptr->logk[delta_v] = calc_delta_v(*reaction_ptr, true) -
1282
+ phases[i]->logk[vm0];
1283
+ if (reaction_ptr->logk[delta_v])
1284
+ mu_terms_in_logk = true;
1285
+ lk = k_calc(reaction_ptr->logk, tk_x, patm_x * PASCAL_PER_ATM);
1286
+ iap = 0.0;
1287
+ for (rxn_ptr = &reaction_ptr->token[0] + 1; rxn_ptr->s != NULL;
1288
+ rxn_ptr++)
1289
+ {
1290
+ if (rxn_ptr->s != s_eminus)
1291
+ {
1292
+ iap += (rxn_ptr->s->lm + rxn_ptr->s->lg) * rxn_ptr->coef;
1293
+ }
1294
+ else
1295
+ {
1296
+ iap += la_eminus * rxn_ptr->coef;
1297
+ }
1298
+ }
1299
+ si = -lk + iap;
1300
+
1301
+ output_msg(sformatf(" %-15s%7.2f %8.2f%8.2f %s",
1302
+ phases[i]->name, (double) si, (double) iap, (double) lk,
1303
+ phases[i]->formula));
1304
+ if (gas && phases[i]->pr_in && phases[i]->pr_p)
1305
+ {
1306
+ if (phases[i]->moles_x || state == INITIAL_SOLUTION)
1307
+ {
1308
+ output_msg(sformatf("\t%s%5.1f%s%5.3f",
1309
+ " Pressure ", (double) phases[i]->pr_p, " atm, phi ", (double) phases[i]->pr_phi));
1310
+ } else
1311
+ {
1312
+ for (int j = 0; j < count_unknowns; j++)
1313
+ {
1314
+ if (x[j]->type != PP)
1315
+ continue;
1316
+ if (!strcmp(x[j]->phase->name, phases[i]->name))
1317
+ {
1318
+ if (x[j]->moles)
1319
+ output_msg(sformatf("\t%s%5.1f%s%5.3f",
1320
+ " Pressure ", (double) phases[i]->pr_p, " atm, phi ", (double) phases[i]->pr_phi));
1321
+ break;
1322
+ }
1323
+ }
1324
+ }
1325
+ }
1326
+ phases[i]->pr_in = false;
1327
+ output_msg("\n");
1328
+ }
1329
+ output_msg(sformatf("\n%s\n%s",
1330
+ "**For a gas, SI = log10(fugacity). Fugacity = pressure * phi / 1 atm.",
1331
+ " For ideal gases, phi = 1."));
1332
+ output_msg("\n\n");
1333
+
1334
+ return (OK);
1335
+ }
1336
+ /* ---------------------------------------------------------------------- */
1337
+ int Phreeqc::
1338
+ print_pp_assemblage(void)
1339
+ /* ---------------------------------------------------------------------- */
1340
+ {
1341
+ /*
1342
+ * Prints saturation indices and masses of pure_phases in pp_assemblage
1343
+ */
1344
+ int j, k;
1345
+ LDBLE si, iap, lk;
1346
+ char token[MAX_LENGTH];
1347
+ class rxn_token *rxn_ptr;
1348
+ class phase *phase_ptr;
1349
+
1350
+ if (pr.pp_assemblage == FALSE || pr.all == FALSE)
1351
+ return (OK);
1352
+ if (pure_phase_unknown == NULL)
1353
+ return (OK);
1354
+ /*
1355
+ * Print heading
1356
+ */
1357
+ print_centered("Phase assemblage");
1358
+ output_msg(sformatf("%73s\n", "Moles in assemblage"));
1359
+ output_msg(sformatf("%-14s%8s%2s%7s %11s", "Phase", "SI", " ", "log IAP",
1360
+ "log K(T, P)"));
1361
+ output_msg(sformatf(" %8s%12s%12s", " Initial", " Final",
1362
+ " Delta"));
1363
+ output_msg("\n\n");
1364
+
1365
+ for (j = 0; j < count_unknowns; j++)
1366
+ {
1367
+ if (x[j]->type != PP)
1368
+ continue;
1369
+ //cxxPPassemblage * pp_assemblage_ptr = Utilities::Rxn_find(Rxn_pp_assemblage_map, use.Get_n_pp_assemblage_user());
1370
+ //cxxPPassemblageComp * comp_ptr = pp_assemblage_ptr->Find(x[j]->pp_assemblage_comp_name);
1371
+ cxxPPassemblageComp * comp_ptr = (cxxPPassemblageComp * ) x[j]->pp_assemblage_comp_ptr; // appt, is sometimes lost??
1372
+ /*
1373
+ * Print saturation index
1374
+ */
1375
+ iap = 0.0;
1376
+ phase_ptr = x[j]->phase;
1377
+ if (x[j]->phase->rxn_x.token.size() == 0 || phase_ptr->in == FALSE)
1378
+ {
1379
+ output_msg(sformatf("%-18s%23s", x[j]->phase->name,
1380
+ "Element not present."));
1381
+ }
1382
+ else
1383
+ {
1384
+ phase_ptr = x[j]->phase;
1385
+ phase_ptr->rxn.logk[delta_v] = calc_delta_v(*&phase_ptr->rxn, true) -
1386
+ phase_ptr->logk[vm0];
1387
+ if (phase_ptr->rxn.logk[delta_v])
1388
+ mu_terms_in_logk = true;
1389
+ lk = k_calc(phase_ptr->rxn.logk, tk_x, patm_x * PASCAL_PER_ATM);
1390
+ for (rxn_ptr = &phase_ptr->rxn.token[0] + 1; rxn_ptr->s != NULL;
1391
+ rxn_ptr++)
1392
+ {
1393
+ if (rxn_ptr->s != s_eminus)
1394
+ {
1395
+ iap += (rxn_ptr->s->lm + rxn_ptr->s->lg) * rxn_ptr->coef;
1396
+ }
1397
+ else
1398
+ {
1399
+ iap += s_eminus->la * rxn_ptr->coef;
1400
+ }
1401
+ }
1402
+ si = -lk + iap;
1403
+ /*
1404
+ for (rxn_ptr = x[j]->phase->rxn_x.token + 1; rxn_ptr->s != NULL; rxn_ptr++) {
1405
+ iap += rxn_ptr->s->la * rxn_ptr->coef;
1406
+ }
1407
+ si = -x[j]->phase->lk + iap;
1408
+ output_msg(OUTPUT_MESSAGE,"\t%-15s%7.2f%8.2f%8.2f", x[j]->phase->name, (double) si, (double) iap, (double) x[j]->phase->lk);
1409
+ */
1410
+ output_msg(sformatf("%-14s%8.2f %7.2f %8.2f",
1411
+ x[j]->phase->name, (double) si, (double) iap, (double) lk));
1412
+ }
1413
+ /*
1414
+ * Print pure phase assemblage data
1415
+ */
1416
+ if (x[j]->moles < 0.0)
1417
+ x[j]->moles = 0.0;
1418
+ if (state != TRANSPORT && state != PHAST)
1419
+ {
1420
+ snprintf(token, sizeof(token), " %11.3e %11.3e %11.3e",
1421
+ (double) (comp_ptr->Get_moles() +
1422
+ comp_ptr->Get_delta()), (double) x[j]->moles,
1423
+ (double) (x[j]->moles - comp_ptr->Get_moles() -
1424
+ comp_ptr->Get_delta()));
1425
+ }
1426
+ else
1427
+ {
1428
+ snprintf(token, sizeof(token), " %11.3e %11.3e %11.3e",
1429
+ (double) comp_ptr->Get_initial_moles(),
1430
+ (double) x[j]->moles,
1431
+ (double) (x[j]->moles - comp_ptr->Get_initial_moles()));
1432
+ }
1433
+ if (x[j]->moles <= 0.0)
1434
+ {
1435
+ for (k = 0; k < 11; k++)
1436
+ {
1437
+ token[13 + k] = ' ';
1438
+ }
1439
+ }
1440
+ if (comp_ptr->Get_add_formula().size() == 0)
1441
+ {
1442
+ output_msg(sformatf("%37s\n", token));
1443
+ }
1444
+ else
1445
+ {
1446
+ output_msg(sformatf("\n %-18s%-15s%36s\n",
1447
+ comp_ptr->Get_add_formula().c_str(), " is reactant", token));
1448
+ }
1449
+ }
1450
+ output_msg("\n");
1451
+ return (OK);
1452
+ }
1453
+
1454
+ /* ---------------------------------------------------------------------- */
1455
+ int Phreeqc::
1456
+ print_species(void)
1457
+ /* ---------------------------------------------------------------------- */
1458
+ {
1459
+ /*
1460
+ * Prints description of solution, uses array species_list for
1461
+ * order of aqueous species.
1462
+ */
1463
+ int i;
1464
+ const char *name, *name1;
1465
+ class master *master_ptr;
1466
+ LDBLE min;
1467
+ LDBLE lm;
1468
+
1469
+ if (pr.species == FALSE || pr.all == FALSE)
1470
+ return (OK);
1471
+ min = -1000;
1472
+ print_centered("Distribution of species");
1473
+ /*
1474
+ * Heading for species
1475
+ */
1476
+ if (pitzer_model == TRUE)
1477
+ {
1478
+ if (ICON == TRUE)
1479
+ {
1480
+ output_msg(sformatf("%60s%10s\n", "MacInnes", "MacInnes"));
1481
+ output_msg(sformatf("%40s%10s%10s%10s%10s\n",
1482
+ "MacInnes", "Log", "Log", "Log", "mole V"));
1483
+ }
1484
+ else
1485
+ {
1486
+ output_msg(sformatf("%60s%10s\n", "Unscaled", "Unscaled"));
1487
+ output_msg(sformatf("%40s%10s%10s%10s%10s\n",
1488
+ "Unscaled", "Log", "Log", "Log", "mole V"));
1489
+ }
1490
+ }
1491
+ else
1492
+ {
1493
+ output_msg(sformatf("%50s%10s%10s%10s\n", "Log", "Log", "Log", "mole V"));
1494
+ }
1495
+ #ifdef NO_UTF8_ENCODING
1496
+ output_msg(sformatf(" %-13s%12s%12s%10s%10s%10s%10s\n\n", "Species",
1497
+ "Molality", "Activity", "Molality", "Activity", "Gamma", "cm3/mol"));
1498
+ #else
1499
+ output_msg(sformatf(" %-13s%12s%12s%10s%10s%10s%11s\n\n", "Species",
1500
+ "Molality", "Activity", "Molality", "Activity", "Gamma", "cm³/mol"));
1501
+ #endif
1502
+ /*
1503
+ * Print list of species
1504
+ */
1505
+ s_h2o->lm = s_h2o->la;
1506
+ name = s_hplus->secondary->elt->name;
1507
+ for (i = 0; i < (int)species_list.size(); i++)
1508
+ {
1509
+ /*
1510
+ * Get name of master species
1511
+ */
1512
+ if (species_list[i].s->type == EX)
1513
+ continue;
1514
+ if (species_list[i].s->type == SURF)
1515
+ continue;
1516
+ if (species_list[i].master_s->secondary != NULL)
1517
+ {
1518
+ master_ptr = species_list[i].master_s->secondary;
1519
+ name1 = species_list[i].master_s->secondary->elt->name;
1520
+ }
1521
+ else
1522
+ {
1523
+ master_ptr = species_list[i].master_s->primary;
1524
+ name1 = species_list[i].master_s->primary->elt->name;
1525
+ }
1526
+ /*
1527
+ * Check if new master species, print total molality
1528
+ */
1529
+ if (name1 != name)
1530
+ {
1531
+ name = name1;
1532
+ output_msg(sformatf("%-11s%12.3e\n", name,
1533
+ (double) (master_ptr->total / mass_water_aq_x)));
1534
+ min = censor * master_ptr->total / mass_water_aq_x;
1535
+ if (min > 0)
1536
+ {
1537
+ min = log10(min);
1538
+ }
1539
+ else
1540
+ {
1541
+ min = -1000.;
1542
+ }
1543
+ }
1544
+ /*
1545
+ * Print species data
1546
+ */
1547
+ if (species_list[i].s->lm > min)
1548
+ {
1549
+ if (species_list[i].s == s_h2o)
1550
+ {
1551
+ lm = log10(s_h2o->moles / mass_water_aq_x);
1552
+ }
1553
+ else
1554
+ {
1555
+ lm = species_list[i].s->lm;
1556
+ }
1557
+ output_msg(sformatf(
1558
+ " %-13s%12.3e%12.3e%10.3f%10.3f%10.3f",
1559
+ species_list[i].s->name,
1560
+ (double) ((species_list[i].s->moles) /
1561
+ mass_water_aq_x),
1562
+ (double) under(species_list[i].s->lm +
1563
+ species_list[i].s->lg), (double) lm,
1564
+ (double) (species_list[i].s->lm +
1565
+ species_list[i].s->lg),
1566
+ (double) species_list[i].s->lg));
1567
+ //if (species_list[i].s->logk[vm_tc] || !strcmp(species_list[i].s->name, "H+"))
1568
+ if (species_list[i].s->logk[vm_tc] || species_list[i].s == s_hplus)
1569
+ output_msg(sformatf("%10.2f\n",
1570
+ (double) species_list[i].s->logk[vm_tc]));
1571
+ else
1572
+ output_msg(sformatf(" (0) \n"));
1573
+ }
1574
+ }
1575
+ output_msg(sformatf("\n"));
1576
+ return (OK);
1577
+ }
1578
+ /* ---------------------------------------------------------------------- */
1579
+ int Phreeqc::
1580
+ print_surface(void)
1581
+ /* ---------------------------------------------------------------------- */
1582
+ {
1583
+ /*
1584
+ * Prints description of surface, including charge and potential,
1585
+ * grams and specific area, moles of each species on surface sites,
1586
+ * and description of diffuse layer if applicable.
1587
+ */
1588
+ cxxSurface *surface_ptr;
1589
+ std::string name, token;
1590
+ class master *master_ptr;
1591
+ LDBLE molfrac, charge;
1592
+ /*
1593
+ * Print surface speciation
1594
+ */
1595
+ surface_ptr = use.Get_surface_ptr();
1596
+ if (surface_ptr == NULL || pr.surface == FALSE || pr.all == FALSE)
1597
+ return (OK);
1598
+ if (surface_ptr->Get_type() == cxxSurface::CD_MUSIC)
1599
+ return (print_surface_cd_music());
1600
+
1601
+ if (state >= REACTION)
1602
+ {
1603
+ print_centered("Surface composition");
1604
+ }
1605
+ /*
1606
+ * Print list of species
1607
+ */
1608
+
1609
+ s_h2o->lm = s_h2o->la;
1610
+ if (use.Get_surface_ptr()->Get_type() == cxxSurface::DDL)
1611
+ {
1612
+ output_msg(sformatf("%-14s\n", "Diffuse Double Layer Surface-Complexation Model\n"));
1613
+ }
1614
+ else if (use.Get_surface_ptr()->Get_type() == cxxSurface::CCM)
1615
+ {
1616
+ output_msg(sformatf("%-14s\n", "Constant Capacitance Surface-Complexation Model\n"));
1617
+ }
1618
+ for (int j = 0; j < count_unknowns; j++)
1619
+ {
1620
+ /*if (use.Get_surface_ptr()->edl == TRUE) { */
1621
+ if (use.Get_surface_ptr()->Get_type() == cxxSurface::DDL || use.Get_surface_ptr()->Get_type() == cxxSurface::CCM)
1622
+ {
1623
+ if (x[j]->type != SURFACE_CB)
1624
+ continue;
1625
+ name = x[j]->master[0]->elt->name;
1626
+ Utilities::replace("_psi", "", name);
1627
+ }
1628
+ else
1629
+ {
1630
+ if (x[j]->type != SURFACE)
1631
+ continue;
1632
+ token = x[j]->master[0]->elt->name;
1633
+ Utilities::replace("_", " ", token);
1634
+ std::string::iterator b = token.begin();
1635
+ std::string::iterator e = token.end();
1636
+ CParser::copy_token(name, b, e);
1637
+ }
1638
+ output_msg(sformatf("%-14s\n", name.c_str()));
1639
+ /*
1640
+ * Description of surface
1641
+ */
1642
+ if (dl_type_x != cxxSurface::NO_DL)
1643
+ {
1644
+ output_msg(sformatf(
1645
+ "\t%11.3e Surface + diffuse layer charge, eq\n",
1646
+ (double) x[j]->f));
1647
+ }
1648
+ /*if (use.Get_surface_ptr()->edl == TRUE && diffuse_layer_x == FALSE) { */
1649
+ if ((use.Get_surface_ptr()->Get_type() == cxxSurface::DDL || use.Get_surface_ptr()->Get_type() == cxxSurface::CCM) && dl_type_x == cxxSurface::NO_DL)
1650
+ {
1651
+ charge = x[j]->f;
1652
+ }
1653
+ else
1654
+ {
1655
+ charge = calc_surface_charge(name.c_str());
1656
+ }
1657
+ output_msg(sformatf("\t%11.3e Surface charge, eq\n",
1658
+ (double) charge));
1659
+ if (x[j]->type == SURFACE_CB)
1660
+ {
1661
+ cxxSurfaceCharge * charge_ptr = use.Get_surface_ptr()->Find_charge(x[j]->surface_charge);
1662
+ if ((charge_ptr->Get_specific_area() *
1663
+ charge_ptr->Get_grams()) > 0)
1664
+ {
1665
+ #ifdef NO_UTF8_ENCODING
1666
+ output_msg(sformatf("\t%11.3e sigma, C/m2\n",
1667
+ #else
1668
+ output_msg(sformatf("\t%11.3e sigma, C/m²\n",
1669
+ #endif
1670
+ (double) (charge * F_C_MOL /
1671
+ (charge_ptr->Get_specific_area() *
1672
+ charge_ptr->Get_grams()))));
1673
+ }
1674
+ else
1675
+ {
1676
+ #ifdef NO_UTF8_ENCODING
1677
+ output_msg(sformatf("\tundefined sigma, C/m2\n"));
1678
+ #else
1679
+ output_msg(sformatf("\tundefined sigma, C/m²\n"));
1680
+ #endif
1681
+ }
1682
+ if (use.Get_surface_ptr()->Get_type() == cxxSurface::CCM)
1683
+ {
1684
+ output_msg(sformatf("\t%11.3e capacitance, F/m^2\n",
1685
+ (double) (charge_ptr->Get_capacitance0())));
1686
+ }
1687
+ output_msg(sformatf("\t%11.3e psi, V\n",
1688
+ (double) (x[j]->master[0]->s->la * 2 * R_KJ_DEG_MOL *
1689
+ tk_x * LOG_10 / F_KJ_V_EQ)));
1690
+ output_msg(sformatf("\t%11.3e -F*psi/RT\n",
1691
+ (double) (x[j]->master[0]->s->la * (-2) * LOG_10)));
1692
+ output_msg(sformatf("\t%11.3e exp(-F*psi/RT)\n",
1693
+ exp(x[j]->master[0]->s->la * (-2) * LOG_10)));
1694
+ cxxSurfaceComp * comp_ptr = surface_ptr->Find_comp(x[j]->surface_comp);
1695
+ if (comp_ptr->Get_phase_name().size() > 0)
1696
+ {
1697
+ output_msg(sformatf(
1698
+ #ifdef NO_UTF8_ENCODING
1699
+ "\t%11.3e specific area, m2/mol %s\n",
1700
+ #else
1701
+ "\t%11.3e specific area, m²/mol %s\n",
1702
+ #endif
1703
+ (double) charge_ptr->Get_specific_area(),
1704
+ comp_ptr->Get_phase_name().c_str()));
1705
+ output_msg(sformatf(
1706
+ #ifdef NO_UTF8_ENCODING
1707
+ "\t%11.3e m2 for %11.3e moles of %s\n\n",
1708
+ #else
1709
+ "\t%11.3e m² for %11.3e moles of %s\n\n",
1710
+ #endif
1711
+ (double) (charge_ptr->Get_grams() *
1712
+ charge_ptr->Get_specific_area()),
1713
+ (double) charge_ptr->Get_grams(),
1714
+ comp_ptr->Get_phase_name().c_str()));
1715
+ }
1716
+ else if (comp_ptr->Get_rate_name().size() > 0)
1717
+ {
1718
+ output_msg(sformatf(
1719
+ #ifdef NO_UTF8_ENCODING
1720
+ "\t%11.3e specific area, m2/mol %s\n",
1721
+ #else
1722
+ "\t%11.3e specific area, m²/mol %s\n",
1723
+ #endif
1724
+ (double) charge_ptr->Get_specific_area(),
1725
+ comp_ptr->Get_rate_name().c_str()));
1726
+ output_msg(sformatf(
1727
+ #ifdef NO_UTF8_ENCODING
1728
+ "\t%11.3e m2 for %11.3e moles of %s\n\n",
1729
+ #else
1730
+ "\t%11.3e m² for %11.3e moles of %s\n\n",
1731
+ #endif
1732
+ (double) (charge_ptr->Get_grams() *
1733
+ charge_ptr->Get_specific_area()),
1734
+ (double) charge_ptr->Get_grams(),
1735
+ comp_ptr->Get_rate_name().c_str()));
1736
+ }
1737
+ else
1738
+ {
1739
+ output_msg(sformatf(
1740
+ #ifdef NO_UTF8_ENCODING
1741
+ "\t%11.3e specific area, m2/g\n",
1742
+ #else
1743
+ "\t%11.3e specific area, m²/g\n",
1744
+ #endif
1745
+ (double) charge_ptr->Get_specific_area()));
1746
+ #ifdef NO_UTF8_ENCODING
1747
+ output_msg(sformatf("\t%11.3e m2 for %11.3e g\n\n",
1748
+ #else
1749
+ output_msg(sformatf("\t%11.3e m² for %11.3e g\n\n",
1750
+ #endif
1751
+ (double) (charge_ptr->Get_specific_area() *
1752
+ charge_ptr->Get_grams()),
1753
+ (double) charge_ptr->Get_grams()));
1754
+ }
1755
+ if (dl_type_x != cxxSurface::NO_DL)
1756
+ print_diffuse_layer(charge_ptr);
1757
+ output_msg(sformatf("\n"));
1758
+ /*
1759
+ * Heading for species
1760
+ */
1761
+ for (int k = j - 1; k < count_unknowns; k++)
1762
+ {
1763
+ if (x[k]->type != SURFACE)
1764
+ continue;
1765
+ if (x[j] != x[k]->potential_unknown)
1766
+ continue;
1767
+ master_ptr = x[k]->master[0];
1768
+ output_msg(sformatf("%-14s\n",
1769
+ x[k]->master[0]->elt->name));
1770
+ output_msg(sformatf("\t%11.3e moles",
1771
+ (double) x[k]->moles));
1772
+ cxxSurfaceComp * comp_k_ptr = surface_ptr->Find_comp(x[k]->surface_comp);
1773
+ if (comp_k_ptr->Get_phase_name().size() > 0)
1774
+ {
1775
+ output_msg(sformatf("\t[%g mol/(mol %s)]\n",
1776
+ (double) comp_k_ptr->Get_phase_proportion(),
1777
+ comp_k_ptr->Get_phase_name().c_str()));
1778
+ }
1779
+ else if (comp_k_ptr->Get_rate_name().size() > 0)
1780
+ {
1781
+ output_msg(sformatf(
1782
+ "\t[%g mol/(mol kinetic reactant %s)]\n",
1783
+ (double) comp_k_ptr->Get_phase_proportion(),
1784
+ comp_k_ptr->Get_rate_name().c_str()));
1785
+ }
1786
+ else
1787
+ {
1788
+ output_msg(sformatf("\n"));
1789
+ }
1790
+ output_msg(sformatf("\t%-15s%12s%12s%12s%12s\n", " ",
1791
+ " ", "Mole", " ", "Log"));
1792
+ output_msg(sformatf("\t%-15s%12s%12s%12s%12s\n\n",
1793
+ "Species", "Moles", "Fraction", "Molality",
1794
+ "Molality"));
1795
+ for (int i = 0; i < (int)species_list.size(); i++)
1796
+ {
1797
+ if (species_list[i].master_s != master_ptr->s)
1798
+ continue;
1799
+ /*
1800
+ * Print species data
1801
+ */
1802
+ if (x[k]->moles >= MIN_RELATED_SURFACE)
1803
+ {
1804
+ molfrac =
1805
+ (LDBLE) (species_list[i].s->moles) / x[k]->moles *
1806
+ species_list[i].s->equiv;
1807
+ }
1808
+ else
1809
+ {
1810
+ molfrac = 0.0;
1811
+ }
1812
+ output_msg(sformatf(
1813
+ "\t%-15s%12.3e%12.3f%12.3e%12.3f\n",
1814
+ species_list[i].s->name,
1815
+ (double) species_list[i].s->moles,
1816
+ (double) molfrac,
1817
+ (double) (species_list[i].s->moles /
1818
+ mass_water_aq_x),
1819
+ log10(species_list[i].s->moles /
1820
+ mass_water_aq_x)));
1821
+ }
1822
+ output_msg(sformatf("\n"));
1823
+ }
1824
+ }
1825
+ else
1826
+ {
1827
+ int k = j;
1828
+ master_ptr = x[k]->master[0];
1829
+ output_msg(sformatf("%-14s\n", x[k]->master[0]->elt->name));
1830
+ output_msg(sformatf("\t%11.3e moles\n",
1831
+ (double) x[k]->moles));
1832
+ output_msg(sformatf("\t%-15s%12s%12s%12s%12s\n", " ", " ",
1833
+ "Mole", " ", "Log"));
1834
+ output_msg(sformatf("\t%-15s%12s%12s%12s%12s\n\n",
1835
+ "Species", "Moles", "Fraction", "Molality",
1836
+ "Molality"));
1837
+ for (int i = 0; i < (int)species_list.size(); i++)
1838
+ {
1839
+ if (species_list[i].master_s != master_ptr->s)
1840
+ continue;
1841
+ /*
1842
+ * Print species data
1843
+ */
1844
+ if (x[k]->moles >= MIN_RELATED_SURFACE)
1845
+ {
1846
+ molfrac =
1847
+ (double) (species_list[i].s->moles) / x[k]->moles *
1848
+ species_list[i].s->equiv;
1849
+ }
1850
+ else
1851
+ {
1852
+ molfrac = 0.0;
1853
+ }
1854
+ output_msg(sformatf(
1855
+ "\t%-15s%12.3e%12.3f%12.3e%12.3f\n",
1856
+ species_list[i].s->name,
1857
+ (double) species_list[i].s->moles,
1858
+ (double) molfrac,
1859
+ (double) (species_list[i].s->moles /
1860
+ mass_water_aq_x),
1861
+ log10(species_list[i].s->moles / mass_water_aq_x)));
1862
+ }
1863
+ output_msg(sformatf("\n"));
1864
+ }
1865
+ }
1866
+ return (OK);
1867
+ }
1868
+
1869
+ /* ---------------------------------------------------------------------- */
1870
+ int Phreeqc::
1871
+ print_surface_cd_music(void)
1872
+ /* ---------------------------------------------------------------------- */
1873
+ {
1874
+ /*
1875
+ * Prints description of cd music surfaces, including charge and potential,
1876
+ * grams and specific area, moles of each species on surface sites,
1877
+ * and description of diffuse layer if applicable.
1878
+ */
1879
+ cxxSurface *surface_ptr;
1880
+ std::string name;
1881
+ class master *master_ptr, *master_ptr0, *master_ptr1, *master_ptr2;
1882
+ class unknown *unknown_ptr0, *unknown_ptr1, *unknown_ptr2;
1883
+ LDBLE molfrac, charge0, charge1, charge2, sum;
1884
+ /*
1885
+ * Print surface speciation
1886
+ */
1887
+ surface_ptr = use.Get_surface_ptr();
1888
+ if (surface_ptr == NULL || pr.surface == FALSE || pr.all == FALSE)
1889
+ return (OK);
1890
+
1891
+ if (state >= REACTION)
1892
+ {
1893
+ print_centered("Surface composition");
1894
+ }
1895
+ /*
1896
+ * Print list of species
1897
+ */
1898
+
1899
+ s_h2o->lm = s_h2o->la;
1900
+ for (int j = 0; j < count_unknowns; j++)
1901
+ {
1902
+ if (x[j]->type != SURFACE_CB)
1903
+ continue;
1904
+ name = x[j]->master[0]->elt->name;
1905
+ Utilities::replace("_psi", "", name);
1906
+ output_msg(sformatf("%-14s\n", name.c_str()));
1907
+ cxxSurfaceCharge * charge_ptr = use.Get_surface_ptr()->Find_charge(x[j]->surface_charge);
1908
+ /*
1909
+ * Description of surface
1910
+ */
1911
+ if (dl_type_x != cxxSurface::NO_DL)
1912
+ {
1913
+ output_msg(sformatf("\t%11.3e Surface + diffuse layer charge, eq\n\n",
1914
+ (double)(x[(size_t)j + 2]->f + (charge_ptr->Get_sigma0() + charge_ptr->Get_sigma1()) * (charge_ptr->Get_specific_area() * charge_ptr->Get_grams()) / F_C_MOL)));
1915
+ }
1916
+ master_ptr0 =
1917
+ surface_get_psi_master(charge_ptr->Get_name().c_str(), SURF_PSI);
1918
+ master_ptr1 =
1919
+ surface_get_psi_master(charge_ptr->Get_name().c_str(), SURF_PSI1);
1920
+ master_ptr2 =
1921
+ surface_get_psi_master(charge_ptr->Get_name().c_str(), SURF_PSI2);
1922
+ unknown_ptr0 = x[master_ptr0->unknown->number];
1923
+ unknown_ptr1 = x[master_ptr1->unknown->number];
1924
+ unknown_ptr2 = x[master_ptr2->unknown->number];
1925
+
1926
+ charge0 = unknown_ptr0->f;
1927
+ charge1 = unknown_ptr1->f;
1928
+ if (dl_type_x != cxxSurface::NO_DL)
1929
+ {
1930
+ charge2 =
1931
+ charge_ptr->Get_sigma2() *
1932
+ (charge_ptr->Get_specific_area() *
1933
+ charge_ptr->Get_grams()) / F_C_MOL;
1934
+ }
1935
+ else
1936
+ {
1937
+ charge2 = unknown_ptr2->f;
1938
+ }
1939
+ sum = 0;
1940
+ for (size_t k = 0; k < x[j]->comp_unknowns.size(); k++)
1941
+ {
1942
+ sum +=
1943
+ x[j]->comp_unknowns[k]->moles *
1944
+ x[j]->comp_unknowns[k]->master[0]->s->z;
1945
+ }
1946
+ output_msg(sformatf("\t%11.3e Surface charge, plane 0, eq\n",
1947
+ (double) (charge0 + sum)));
1948
+ output_msg(sformatf("\t%11.3e Surface charge, plane 1, eq\n",
1949
+ (double) charge1));
1950
+ output_msg(sformatf("\t%11.3e Surface charge, plane 2, eq\n",
1951
+ (double) charge2));
1952
+ output_msg(sformatf(
1953
+ "\t%11.3e Sum of surface charge, all planes, eq\n\n",
1954
+ (double) (charge0 + sum + charge1 + charge2)));
1955
+ if (x[j]->type == SURFACE_CB)
1956
+ {
1957
+ if ((charge_ptr->Get_specific_area() *
1958
+ charge_ptr->Get_grams()) > 0)
1959
+ {
1960
+ output_msg(sformatf(
1961
+ #ifdef NO_UTF8_ENCODING
1962
+ "\t%11.3e sigma, plane 0, C/m2\n",
1963
+ #else
1964
+ "\t%11.3e sigma, plane 0, C/m²\n",
1965
+ #endif
1966
+ (double) charge_ptr->Get_sigma0()));
1967
+ output_msg(sformatf(
1968
+ #ifdef NO_UTF8_ENCODING
1969
+ "\t%11.3e sigma, plane 1, C/m2\n",
1970
+ #else
1971
+ "\t%11.3e sigma, plane 1, C/m²\n",
1972
+ #endif
1973
+ (double) charge_ptr->Get_sigma1()));
1974
+ output_msg(sformatf(
1975
+ #ifdef NO_UTF8_ENCODING
1976
+ "\t%11.3e sigma, plane 2, C/m2\n",
1977
+ #else
1978
+ "\t%11.3e sigma, plane 2, C/m²\n",
1979
+ #endif
1980
+ (double) charge_ptr->Get_sigma2()));
1981
+ output_msg(sformatf(
1982
+ #ifdef NO_UTF8_ENCODING
1983
+ "\t%11.3e sigma, diffuse layer, C/m2\n\n",
1984
+ #else
1985
+ "\t%11.3e sigma, diffuse layer, C/m²\n\n",
1986
+ #endif
1987
+ (double) charge_ptr->Get_sigmaddl()));
1988
+ }
1989
+ else
1990
+ {
1991
+ #ifdef NO_UTF8_ENCODING
1992
+ output_msg(sformatf("\tundefined sigma, C/m2\n"));
1993
+ #else
1994
+ output_msg(sformatf("\tundefined sigma, C/m²\n"));
1995
+ #endif
1996
+ }
1997
+ output_msg(sformatf("\t%11.3e psi, plane 0, V\n",
1998
+ (double) (-master_ptr0->s->la * LOG_10 * R_KJ_DEG_MOL * tk_x / F_KJ_V_EQ)));
1999
+ output_msg(sformatf("\t%11.3e psi, plane 1, V\n",
2000
+ (double) (-master_ptr1->s->la * LOG_10 * R_KJ_DEG_MOL * tk_x / F_KJ_V_EQ)));
2001
+ output_msg(sformatf("\t%11.3e psi, plane 2, V\n\n",
2002
+ (double) (-master_ptr2->s->la * LOG_10 * R_KJ_DEG_MOL * tk_x / F_KJ_V_EQ)));
2003
+ output_msg(sformatf("\t%11.3e exp(-F*psi/RT), plane 0\n",
2004
+ (double) (exp(master_ptr0->s->la * LOG_10))));
2005
+ output_msg(sformatf("\t%11.3e exp(-F*psi/RT), plane 1\n",
2006
+ (double) (exp(master_ptr1->s->la * LOG_10))));
2007
+ output_msg(sformatf(
2008
+ "\t%11.3e exp(-F*psi/RT), plane 2\n\n",
2009
+ (double) (exp(master_ptr2->s->la * LOG_10))));
2010
+
2011
+ output_msg(sformatf("\t%11.3e capacitance 0-1, F/m^2\n",
2012
+ (double) (charge_ptr->Get_capacitance0())));
2013
+ output_msg(sformatf("\t%11.3e capacitance 1-2, F/m^2\n",
2014
+ (double) (charge_ptr->Get_capacitance1())));
2015
+ cxxSurfaceComp * comp_ptr = surface_ptr->Find_comp(x[j]->surface_comp);
2016
+ if (comp_ptr->Get_phase_name().size() > 0)
2017
+ {
2018
+ output_msg(sformatf(
2019
+ "\t%11.3e specific area, m^2/mol %s\n",
2020
+ (double) charge_ptr->Get_specific_area(),
2021
+ comp_ptr->Get_phase_name().c_str()));
2022
+ output_msg(sformatf(
2023
+ "\t%11.3e m^2 for %11.3e moles of %s\n\n",
2024
+ (double) (charge_ptr->Get_grams() *
2025
+ charge_ptr->Get_specific_area()),
2026
+ (double) charge_ptr->Get_grams(),
2027
+ comp_ptr->Get_phase_name().c_str()));
2028
+ }
2029
+ else if (comp_ptr->Get_rate_name().size() > 0)
2030
+ {
2031
+ output_msg(sformatf(
2032
+ "\t%11.3e specific area, m^2/mol %s\n",
2033
+ (double) charge_ptr->Get_specific_area(),
2034
+ comp_ptr->Get_rate_name().c_str()));
2035
+ output_msg(sformatf(
2036
+ "\t%11.3e m^2 for %11.3e moles of %s\n\n",
2037
+ (double) (charge_ptr->Get_grams() *
2038
+ charge_ptr->Get_specific_area()),
2039
+ (double) charge_ptr->Get_grams(),
2040
+ comp_ptr->Get_rate_name().c_str()));
2041
+ }
2042
+ else
2043
+ {
2044
+ output_msg(sformatf(
2045
+ "\t%11.3e specific area, m^2/g\n",
2046
+ (double) charge_ptr->Get_specific_area()));
2047
+ output_msg(sformatf("\t%11.3e m^2 for %11.3e g\n\n",
2048
+ (double) (charge_ptr->Get_specific_area() *
2049
+ charge_ptr->Get_grams()),
2050
+ (double) charge_ptr->Get_grams()));
2051
+ }
2052
+ if (dl_type_x != cxxSurface::NO_DL)
2053
+ print_diffuse_layer(charge_ptr);
2054
+ output_msg(sformatf("\n"));
2055
+ /*
2056
+ * Heading for species
2057
+ */
2058
+ for (int k = j - 1; k < count_unknowns; k++)
2059
+ {
2060
+ if (x[k]->type != SURFACE)
2061
+ continue;
2062
+ if (x[j] != x[k]->potential_unknown)
2063
+ continue;
2064
+ master_ptr = x[k]->master[0];
2065
+ output_msg(sformatf("%-14s\n",
2066
+ x[k]->master[0]->elt->name));
2067
+ output_msg(sformatf("\t%11.3e moles",
2068
+ (double) x[k]->moles));
2069
+ cxxSurfaceComp * comp_k_ptr = surface_ptr->Find_comp(x[k]->surface_comp);
2070
+ if (comp_k_ptr->Get_phase_name().size() > 0)
2071
+ {
2072
+ output_msg(sformatf("\t[%g mol/(mol %s)]\n",
2073
+ (double) comp_k_ptr->Get_phase_proportion(),
2074
+ comp_k_ptr->Get_phase_name().c_str()));
2075
+ }
2076
+ else if (comp_k_ptr->Get_rate_name().size() > 0)
2077
+ {
2078
+ output_msg(sformatf(
2079
+ "\t[%g mol/(mol kinetic reactant %s)]\n",
2080
+ (double) comp_k_ptr->Get_phase_proportion(),
2081
+ comp_k_ptr->Get_rate_name().c_str()));
2082
+ }
2083
+ else
2084
+ {
2085
+ output_msg(sformatf("\n"));
2086
+ }
2087
+ output_msg(sformatf("\t%-20s%12s%12s%12s%12s\n", " ",
2088
+ " ", "Mole", " ", "Log"));
2089
+ output_msg(sformatf("\t%-20s%12s%12s%12s%12s\n\n",
2090
+ "Species", "Moles", "Fraction", "Molality",
2091
+ "Molality"));
2092
+ for (int i = 0; i < (int)species_list.size(); i++)
2093
+ {
2094
+ if (species_list[i].master_s != master_ptr->s)
2095
+ continue;
2096
+ /*
2097
+ * Print species data
2098
+ */
2099
+ if (x[k]->moles >= MIN_RELATED_SURFACE)
2100
+ {
2101
+ molfrac =
2102
+ (LDBLE) (species_list[i].s->moles) / x[k]->moles *
2103
+ species_list[i].s->equiv;
2104
+ }
2105
+ else
2106
+ {
2107
+ molfrac = 0.0;
2108
+ }
2109
+ output_msg(sformatf(
2110
+ "\t%-20s%12.3e%12.3f%12.3e%12.3f\n",
2111
+ species_list[i].s->name,
2112
+ (double) species_list[i].s->moles,
2113
+ (double) molfrac,
2114
+ (double) (species_list[i].s->moles /
2115
+ mass_water_aq_x),
2116
+ log10(species_list[i].s->moles /
2117
+ mass_water_aq_x)));
2118
+ }
2119
+ output_msg(sformatf("\n"));
2120
+ }
2121
+ }
2122
+ }
2123
+ return (OK);
2124
+ }
2125
+
2126
+ /* ---------------------------------------------------------------------- */
2127
+ int Phreeqc::
2128
+ print_totals(void)
2129
+ /* ---------------------------------------------------------------------- */
2130
+ {
2131
+ /*
2132
+ * Print total concentrations of elements, molality and moles.
2133
+ */
2134
+ int i, pure_water;
2135
+ LDBLE dens;
2136
+
2137
+ if (pr.totals == FALSE || pr.all == FALSE)
2138
+ return (OK);
2139
+ print_centered("Solution composition");
2140
+ pure_water = TRUE;
2141
+ output_msg(sformatf("\t%-15s%12s%12s\n\n", "Elements", "Molality",
2142
+ "Moles"));
2143
+ for (i = 0; i < count_unknowns; i++)
2144
+ {
2145
+ if (x[i] == alkalinity_unknown)
2146
+ {
2147
+ output_msg(sformatf("\t%-15s%12.3e%12.3e\n",
2148
+ "Alkalinity",
2149
+ (double) (x[i]->f / mass_water_aq_x),
2150
+ (double) x[i]->f));
2151
+ pure_water = FALSE;
2152
+ }
2153
+ if (x[i] == ph_unknown)
2154
+ continue;
2155
+ if (x[i] == pe_unknown)
2156
+ continue;
2157
+ if (x[i] == charge_balance_unknown)
2158
+ {
2159
+ output_msg(sformatf("\t%-15s%12.3e%12.3e",
2160
+ x[i]->description,
2161
+ (double) (x[i]->sum / mass_water_aq_x),
2162
+ (double) x[i]->sum));
2163
+ output_msg(sformatf(" Charge balance\n"));
2164
+ pure_water = FALSE;
2165
+ continue;
2166
+ }
2167
+ if (x[i]->type == SOLUTION_PHASE_BOUNDARY)
2168
+ {
2169
+ output_msg(sformatf("\t%-15s%12.3e%12.3e",
2170
+ x[i]->description,
2171
+ (double) (x[i]->sum / mass_water_aq_x),
2172
+ (double) x[i]->sum));
2173
+ output_msg(sformatf(" Equilibrium with %s\n",
2174
+ x[i]->phase->name));
2175
+ pure_water = FALSE;
2176
+ continue;
2177
+ }
2178
+ if (x[i]->type == MB)
2179
+ {
2180
+ output_msg(sformatf("\t%-15s%12.3e%12.3e\n",
2181
+ x[i]->description,
2182
+ (double) (x[i]->sum / mass_water_aq_x),
2183
+ (double) x[i]->sum));
2184
+ pure_water = FALSE;
2185
+ }
2186
+ }
2187
+
2188
+ if (pure_water == TRUE)
2189
+ {
2190
+ output_msg(sformatf("\t%-15s\n", "Pure water"));
2191
+ }
2192
+ /*
2193
+ * Description of solution
2194
+ */
2195
+ output_msg(sformatf("\n"));
2196
+ print_centered("Description of solution");
2197
+ /*
2198
+ * pH
2199
+ */
2200
+ output_msg(sformatf("%45s%7.3f ", "pH = ",
2201
+ (double) (-(s_hplus->la))));
2202
+ if (ph_unknown == NULL)
2203
+ {
2204
+ output_msg(sformatf("\n"));
2205
+ }
2206
+ else if (ph_unknown == charge_balance_unknown)
2207
+ {
2208
+ output_msg(sformatf(" Charge balance\n"));
2209
+ }
2210
+ else if (ph_unknown->type == SOLUTION_PHASE_BOUNDARY)
2211
+ {
2212
+ output_msg(sformatf(" Equilibrium with %s\n",
2213
+ ph_unknown->phase->name));
2214
+ }
2215
+ else if (ph_unknown->type == ALK)
2216
+ {
2217
+ output_msg(sformatf(" Adjust alkalinity\n"));
2218
+ }
2219
+ /*
2220
+ * pe
2221
+ */
2222
+ output_msg(sformatf("%45s%7.3f ", "pe = ",
2223
+ (double) (-(s_eminus->la))));
2224
+ if (pe_unknown == NULL)
2225
+ {
2226
+ output_msg(sformatf("\n"));
2227
+ }
2228
+ else if (pe_unknown == charge_balance_unknown)
2229
+ {
2230
+ output_msg(sformatf(" Charge balance\n"));
2231
+ }
2232
+ else if (pe_unknown->type == SOLUTION_PHASE_BOUNDARY)
2233
+ {
2234
+ output_msg(sformatf(" Equilibrium with %s\n",
2235
+ pe_unknown->phase->name));
2236
+ }
2237
+ else if (pe_unknown->type == MH)
2238
+ {
2239
+ output_msg(sformatf(" Adjusted to redox equilibrium\n"));
2240
+ }
2241
+ /*
2242
+ * Others
2243
+ */
2244
+ calc_SC();
2245
+ if (SC > 0)
2246
+ {
2247
+ //output_msg(sformatf("%36s%i%7s%i\n",
2248
+ #ifdef NO_UTF8_ENCODING
2249
+ output_msg(sformatf("%35s%3.0f%7s%i\n",
2250
+ "Specific Conductance (uS/cm, ", tc_x, "oC) = ", (int) SC));
2251
+ #else
2252
+ output_msg(sformatf("%36s%3.0f%7s%i\n",
2253
+ "Specific Conductance (µS/cm, ", tc_x, "°C) = ", (int) SC));
2254
+ #endif
2255
+ }
2256
+ /* VP: Density Start */
2257
+ if (print_density)
2258
+ {
2259
+ dens = calc_dens();
2260
+ #ifdef NO_UTF8_ENCODING
2261
+ output_msg(sformatf("%45s%9.5f", "Density (g/cm3) = ",
2262
+ #else
2263
+ output_msg(sformatf("%46s%9.5f", "Density (g/cm³) = ",
2264
+ #endif
2265
+ (double) dens));
2266
+ if (state == INITIAL_SOLUTION && use.Get_solution_ptr()->Get_initial_data()->Get_calc_density())
2267
+ {
2268
+ output_msg(sformatf(" (Iterated) "));
2269
+ }
2270
+ if (dens > 1.999) output_msg(sformatf("%18s", " (Program limit)"));
2271
+ output_msg(sformatf("\n"));
2272
+ output_msg(sformatf("%45s%9.5f\n", " Volume (L) = ",
2273
+ (double) calc_solution_volume()));
2274
+ }
2275
+ /* VP: Density End */
2276
+ //#ifdef NPP
2277
+ if (print_viscosity)
2278
+ {
2279
+ viscosity(nullptr);
2280
+ output_msg(sformatf("%45s%9.5f", "Viscosity (mPa s) = ", (double) viscos));
2281
+ if (tc_x > 200 && !pure_water)
2282
+ {
2283
+ #ifdef NO_UTF8_ENCODING
2284
+ output_msg(sformatf("%18s\n",
2285
+ " (solute contributions limited to 200 oC)"));
2286
+ #else
2287
+ output_msg(sformatf("%18s\n",
2288
+ " (solute contributions limited to 200 °C)"));
2289
+ #endif
2290
+ }
2291
+ else output_msg(sformatf("\n"));
2292
+ }
2293
+ //#endif
2294
+ output_msg(sformatf("%45s%7.3f\n", "Activity of water = ",
2295
+ exp(s_h2o->la * LOG_10)));
2296
+ output_msg(sformatf("%45s%11.3e\n", "Ionic strength (mol/kgw) = ",
2297
+ (double) mu_x));
2298
+ output_msg(sformatf("%45s%11.3e\n", "Mass of water (kg) = ",
2299
+ (double) mass_water_aq_x));
2300
+ if (alkalinity_unknown == NULL)
2301
+ {
2302
+ output_msg(sformatf("%45s%11.3e\n",
2303
+ "Total alkalinity (eq/kg) = ",
2304
+ (double) (total_alkalinity / mass_water_aq_x)));
2305
+ }
2306
+ if (carbon_unknown == NULL && total_carbon)
2307
+ {
2308
+ output_msg(sformatf("%45s%11.3e\n",
2309
+ "Total carbon (mol/kg) = ",
2310
+ (double) (total_carbon / mass_water_aq_x)));
2311
+ }
2312
+ if (total_co2)
2313
+ output_msg(sformatf("%45s%11.3e\n", "Total CO2 (mol/kg) = ",
2314
+ (double) (total_co2 / mass_water_aq_x)));
2315
+ #ifdef NO_UTF8_ENCODING
2316
+ output_msg(sformatf("%45s%6.2f\n", "Temperature (oC) = ",
2317
+ #else
2318
+ output_msg(sformatf("%46s%6.2f\n", "Temperature (°C) = ",
2319
+ #endif
2320
+ (double) tc_x));
2321
+
2322
+ if (patm_x != 1.0)
2323
+ {
2324
+ /* only print if different than default */
2325
+ output_msg(sformatf("%45s%5.2f\n", "Pressure (atm) = ",
2326
+ (double) patm_x));
2327
+ }
2328
+
2329
+ if (potV_x)
2330
+ {
2331
+ output_msg(sformatf("%45s%5.2f\n", "Electrical Potential (Volt) = ",
2332
+ (double)potV_x));
2333
+ }
2334
+
2335
+ output_msg(sformatf("%45s%11.3e\n", "Electrical balance (eq) = ",
2336
+ (double) cb_x));
2337
+ output_msg(sformatf("%45s%6.2f\n",
2338
+ "Percent error, 100*(Cat-|An|)/(Cat+|An|) = ",
2339
+ (double) (100 * cb_x / total_ions_x)));
2340
+ if (iterations == overall_iterations)
2341
+ output_msg(sformatf("%45s%3d\n", "Iterations = ", iterations));
2342
+ else
2343
+ output_msg(sformatf("%45s%3d (%d overall)\n", "Iterations = ", iterations, overall_iterations));
2344
+ if (pitzer_model == TRUE || sit_model == TRUE)
2345
+ {
2346
+ if (always_full_pitzer == FALSE)
2347
+ {
2348
+ output_msg(sformatf("%45s%3d\n", "Gamma iterations = ",
2349
+ gamma_iterations));
2350
+ }
2351
+ else
2352
+ {
2353
+ output_msg(sformatf("%45s%3d\n", "Gamma iterations = ",
2354
+ iterations));
2355
+ }
2356
+ output_msg(sformatf("%45s%9.5f\n", "Osmotic coefficient = ",
2357
+ (double) COSMOT));
2358
+ if (print_density) output_msg(sformatf("%45s%9.5f\n", "Density of water = ",
2359
+ (double) DW0));
2360
+ }
2361
+ output_msg(sformatf("%45s%e\n", "Total H = ", (double) total_h_x));
2362
+ output_msg(sformatf("%45s%e\n", "Total O = ", (double) total_o_x));
2363
+ output_msg(sformatf("\n"));
2364
+
2365
+ return (OK);
2366
+ }
2367
+ /* ---------------------------------------------------------------------- */
2368
+ int Phreeqc::
2369
+ print_user_print(void)
2370
+ /* ---------------------------------------------------------------------- */
2371
+ {
2372
+ /*
2373
+ * Print with user defined BASIC print routine
2374
+ */
2375
+ cxxKinetics *kinetics_ptr;
2376
+
2377
+ char l_command[] = "run";
2378
+
2379
+ if (pr.user_print == FALSE || pr.all == FALSE)
2380
+ return (OK);
2381
+ if (user_print->commands.size() == 0)
2382
+ return (OK);
2383
+ kinetics_ptr = NULL;
2384
+ if (use.Get_kinetics_in() == TRUE)
2385
+ {
2386
+ kinetics_ptr = use.Get_kinetics_ptr();
2387
+ if (state == TRANSPORT || state == PHAST || state == ADVECTION)
2388
+ {
2389
+ use.Set_kinetics_ptr(Utilities::Rxn_find(Rxn_kinetics_map, use.Get_n_kinetics_user()));
2390
+ }
2391
+ else
2392
+ {
2393
+ use.Set_kinetics_ptr(Utilities::Rxn_find(Rxn_kinetics_map, -2));
2394
+ }
2395
+ }
2396
+ print_centered("User print");
2397
+ if (user_print->new_def == TRUE)
2398
+ {
2399
+ /* basic_renumber(user_print->commands, &user_print->linebase, &user_print->varbase, &user_print->loopbase); */
2400
+ if (basic_compile
2401
+ (user_print->commands.c_str(), &user_print->linebase,
2402
+ &user_print->varbase, &user_print->loopbase) != 0)
2403
+ {
2404
+ error_msg("Fatal Basic error in USER_PRINT.", STOP);
2405
+ }
2406
+ user_print->new_def = FALSE;
2407
+ }
2408
+ if (basic_run
2409
+ (l_command, user_print->linebase, user_print->varbase,
2410
+ user_print->loopbase) != 0)
2411
+ {
2412
+ error_msg("Fatal Basic error in USER_PRINT.", STOP);
2413
+ }
2414
+ if (this->output_newline) {
2415
+ output_msg(sformatf("\n"));
2416
+ }
2417
+ this->Set_output_newline(true);
2418
+ if (use.Get_kinetics_in() == TRUE)
2419
+ {
2420
+ use.Set_kinetics_ptr(kinetics_ptr);
2421
+ }
2422
+ return (OK);
2423
+ }
2424
+
2425
+ /* ---------------------------------------------------------------------- */
2426
+ int Phreeqc::
2427
+ print_using(void)
2428
+ /* ---------------------------------------------------------------------- */
2429
+ {
2430
+ /*
2431
+ * Print entities used in calculation
2432
+ */
2433
+ cxxMix * mix_ptr;
2434
+ cxxSolution *solution_ptr;
2435
+
2436
+ if (pr.use == FALSE || pr.all == FALSE)
2437
+ return (OK);
2438
+ if (state < REACTION || phast == TRUE)
2439
+ return (OK);
2440
+ /*
2441
+ * Mixture or Solution
2442
+ */
2443
+ if (use.Get_mix_in() == TRUE)
2444
+ {
2445
+ if (state == TRANSPORT)
2446
+ {
2447
+ mix_ptr = Utilities::Rxn_find(Rxn_mix_map, use.Get_n_mix_user());
2448
+ }
2449
+ else
2450
+ {
2451
+ mix_ptr = Utilities::Rxn_find(Rxn_mix_map, use.Get_n_mix_user_orig());
2452
+ }
2453
+ if (mix_ptr == NULL)
2454
+ {
2455
+ mix_ptr = use.Get_mix_ptr();
2456
+ }
2457
+ if (mix_ptr != NULL)
2458
+ {
2459
+ if (state == TRANSPORT)
2460
+ {
2461
+ output_msg(sformatf("Using mix %d.\t%s\n",
2462
+ use.Get_n_mix_user(), mix_ptr->Get_description().c_str()));
2463
+ }
2464
+ else
2465
+ {
2466
+ output_msg(sformatf("Using mix %d.\t%s\n",
2467
+ use.Get_n_mix_user_orig(), mix_ptr->Get_description().c_str()));
2468
+ }
2469
+
2470
+ }
2471
+ }
2472
+ else
2473
+ {
2474
+ solution_ptr = Utilities::Rxn_find(Rxn_solution_map, use.Get_n_solution_user());
2475
+ output_msg(sformatf("Using solution %d.\t%s\n",
2476
+ use.Get_n_solution_user(), solution_ptr->Get_description().c_str()));
2477
+ }
2478
+ /*
2479
+ * Exchange and surface
2480
+ */
2481
+ if (use.Get_exchange_in())
2482
+ {
2483
+ cxxExchange *exchange_ptr = Utilities::Rxn_find(Rxn_exchange_map, use.Get_n_exchange_user());
2484
+ output_msg(sformatf("Using exchange %d.\t%s\n",
2485
+ use.Get_n_exchange_user(), exchange_ptr->Get_description().c_str()));
2486
+ }
2487
+ if (use.Get_surface_in())
2488
+ {
2489
+ cxxSurface *surface_ptr = Utilities::Rxn_find(Rxn_surface_map, use.Get_n_surface_user());
2490
+ output_msg(sformatf("Using surface %d.\t%s\n",
2491
+ use.Get_n_surface_user(), surface_ptr->Get_description().c_str()));
2492
+ }
2493
+ if (use.Get_pp_assemblage_in() == TRUE)
2494
+ {
2495
+ cxxPPassemblage * pp_assemblage_ptr = Utilities::Rxn_find(Rxn_pp_assemblage_map, use.Get_n_pp_assemblage_user());
2496
+ output_msg(sformatf("Using pure phase assemblage %d.\t%s\n",
2497
+ use.Get_n_pp_assemblage_user(), pp_assemblage_ptr->Get_description().c_str()));
2498
+ }
2499
+ if (use.Get_ss_assemblage_in() == TRUE)
2500
+ {
2501
+ cxxSSassemblage * ss_assemblage_ptr = Utilities::Rxn_find(Rxn_ss_assemblage_map, use.Get_n_ss_assemblage_user());
2502
+ output_msg(sformatf(
2503
+ "Using solid solution assemblage %d.\t%s\n",
2504
+ use.Get_n_ss_assemblage_user(),
2505
+ ss_assemblage_ptr->Get_description().c_str()));
2506
+ }
2507
+ if (use.Get_gas_phase_in())
2508
+ {
2509
+ cxxGasPhase * gas_phase_ptr = Utilities::Rxn_find(Rxn_gas_phase_map, use.Get_n_gas_phase_user());
2510
+ output_msg(sformatf("Using gas phase %d.\t%s\n",
2511
+ use.Get_n_gas_phase_user(), gas_phase_ptr->Get_description().c_str()));
2512
+ }
2513
+ if (use.Get_temperature_in())
2514
+ {
2515
+ cxxTemperature *temperature_ptr = Utilities::Rxn_find(Rxn_temperature_map, use.Get_n_temperature_user());
2516
+ output_msg(sformatf("Using temperature %d.\t%s\n",
2517
+ use.Get_n_temperature_user(), temperature_ptr->Get_description().c_str()));
2518
+ }
2519
+ if (use.Get_pressure_in())
2520
+ {
2521
+ cxxPressure *pressure_ptr = Utilities::Rxn_find(Rxn_pressure_map, use.Get_n_pressure_user());
2522
+ output_msg(sformatf("Using pressure %d.\t%s\n",
2523
+ use.Get_n_pressure_user(), pressure_ptr->Get_description().c_str()));
2524
+ }
2525
+ if (use.Get_reaction_in())
2526
+ {
2527
+ if (state != TRANSPORT || transport_step > 0)
2528
+ {
2529
+ cxxReaction *reaction_ptr = Utilities::Rxn_find(Rxn_reaction_map, use.Get_n_reaction_user());
2530
+ output_msg(sformatf("Using reaction %d.\t%s\n",
2531
+ use.Get_n_reaction_user(), reaction_ptr->Get_description().c_str()));
2532
+ }
2533
+ }
2534
+ if (use.Get_kinetics_in())
2535
+ {
2536
+ cxxKinetics * kinetics_ptr;
2537
+ if (state == TRANSPORT || state == PHAST || state == ADVECTION)
2538
+ {
2539
+ kinetics_ptr = Utilities::Rxn_find(Rxn_kinetics_map, use.Get_n_kinetics_user());
2540
+ }
2541
+ else
2542
+ {
2543
+ kinetics_ptr = Utilities::Rxn_find(Rxn_kinetics_map, -2);
2544
+ }
2545
+ output_msg(sformatf("Using kinetics %d.\t%s\n",
2546
+ use.Get_n_kinetics_user(), kinetics_ptr->Get_description().c_str()));
2547
+ }
2548
+ output_msg(sformatf("\n"));
2549
+ return (OK);
2550
+ }
2551
+
2552
+ /* ---------------------------------------------------------------------- */
2553
+ int Phreeqc::
2554
+ punch_gas_phase(void)
2555
+ /* ---------------------------------------------------------------------- */
2556
+ {
2557
+ /*
2558
+ * Prints selected gas phase data
2559
+ */
2560
+ //int i;
2561
+ LDBLE p, total_moles, volume;
2562
+ LDBLE moles;
2563
+ bool PR = false;
2564
+
2565
+ //if (punch.count_gases <= 0)
2566
+ if (current_selected_output->Get_gases().size() == 0)
2567
+ return (OK);
2568
+ p = 0.0;
2569
+ total_moles = 0.0;
2570
+ volume = 0.0;
2571
+ cxxGasPhase * gas_phase_ptr = use.Get_gas_phase_ptr();
2572
+
2573
+ if (gas_unknown != NULL && use.Get_gas_phase_ptr() != NULL)
2574
+ {
2575
+ if (gas_phase_ptr->Get_v_m() >= 0.01)
2576
+ {
2577
+ PR = true;
2578
+ }
2579
+ if (gas_phase_ptr->Get_type() == cxxGasPhase::GP_PRESSURE)
2580
+ {
2581
+ if (gas_unknown->moles >= 1e-12)
2582
+ {
2583
+ gas_phase_ptr->Set_total_moles(gas_unknown->moles);
2584
+ gas_phase_ptr->Set_volume(
2585
+ gas_phase_ptr->Get_total_moles() * R_LITER_ATM * tk_x /
2586
+ gas_phase_ptr->Get_total_p());
2587
+ if (PR)
2588
+ {
2589
+ gas_phase_ptr->Set_volume(gas_phase_ptr->Get_v_m() * gas_unknown->moles);
2590
+ }
2591
+ }
2592
+ else
2593
+ {
2594
+ gas_phase_ptr->Set_volume(0);
2595
+ }
2596
+ }
2597
+ p = gas_phase_ptr->Get_total_p();
2598
+ total_moles = gas_phase_ptr->Get_total_moles();
2599
+ //volume = total_moles * R_LITER_ATM * tk_x / gas_phase_ptr->Get_total_p();
2600
+ //if (gas_phase_ptr->Get_v_m() > 0.03)
2601
+ // volume = 0.03 * gas_phase_ptr->Get_total_moles();
2602
+ volume = gas_phase_ptr->Get_volume();
2603
+
2604
+ }
2605
+ if (!current_selected_output->Get_high_precision())
2606
+ {
2607
+ fpunchf("pressure", "%12.4e\t", (double) p);
2608
+ fpunchf("total mol", "%12.4e\t", (double) total_moles);
2609
+ fpunchf("volume", "%12.4e\t", (double) volume);
2610
+ }
2611
+ else
2612
+ {
2613
+ fpunchf("pressure", "%20.12e\t", (double) p);
2614
+ fpunchf("total mol", "%20.12e\t", (double) total_moles);
2615
+ fpunchf("volume", "%20.12e\t", (double) volume);
2616
+ }
2617
+ for (size_t i = 0; i < current_selected_output->Get_gases().size(); i++)
2618
+ {
2619
+ moles = 0.0;
2620
+ if (gas_phase_ptr != NULL && current_selected_output->Get_gases()[i].second != NULL)
2621
+ {
2622
+ for (size_t j = 0; j < gas_phase_ptr->Get_gas_comps().size(); j++)
2623
+ {
2624
+ cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[j]);
2625
+ int k;
2626
+ class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str() , &k, FALSE);
2627
+ if (phase_ptr != current_selected_output->Get_gases()[i].second)
2628
+ continue;
2629
+ moles = phase_ptr->moles_x;
2630
+ if (moles <= MIN_TOTAL)
2631
+ moles = 0.0;
2632
+ break;
2633
+ }
2634
+ }
2635
+ if (!current_selected_output->Get_high_precision())
2636
+ {
2637
+ fpunchf(sformatf("g_%s", current_selected_output->Get_gases()[i].first.c_str()), "%12.4e\t", (double) moles);
2638
+ }
2639
+ else
2640
+ {
2641
+ fpunchf(sformatf("g_%s", current_selected_output->Get_gases()[i].first.c_str()), "%20.12e\t",
2642
+ (double) moles);
2643
+ }
2644
+ }
2645
+ return (OK);
2646
+ }
2647
+ /* ---------------------------------------------------------------------- */
2648
+ int Phreeqc::
2649
+ punch_ss_assemblage(void)
2650
+ /* ---------------------------------------------------------------------- */
2651
+ {
2652
+ /*
2653
+ * Prints solid solution composition if present
2654
+ */
2655
+ //int j, k;
2656
+ int found;
2657
+ LDBLE moles;
2658
+
2659
+ /*
2660
+ * Print solid solutions
2661
+ */
2662
+ for (size_t k = 0; k < current_selected_output->Get_s_s().size(); k++)
2663
+ {
2664
+ found = FALSE;
2665
+ if (use.Get_ss_assemblage_ptr() != NULL)
2666
+ {
2667
+ std::vector<cxxSS *> ss_ptrs = use.Get_ss_assemblage_ptr()->Vectorize();
2668
+ for (int j = 0; j < (int) ss_ptrs.size(); j++)
2669
+ {
2670
+ cxxSS * ss_ptr = ss_ptrs[j];
2671
+ for (int i = 0; i < (int) ss_ptr->Get_ss_comps().size(); i++)
2672
+ {
2673
+ cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[i]);
2674
+
2675
+ if (strcmp_nocase(current_selected_output->Get_s_s()[k].first.c_str(), comp_ptr->Get_name().c_str()) == 0)
2676
+ {
2677
+ if (ss_ptr->Get_ss_in())
2678
+ {
2679
+ moles = comp_ptr->Get_moles();
2680
+ }
2681
+ else
2682
+ {
2683
+ moles = 0;
2684
+ }
2685
+ if (!current_selected_output->Get_high_precision())
2686
+ {
2687
+ fpunchf(sformatf("s_%s", current_selected_output->Get_s_s()[k].first.c_str()),
2688
+ "%12.4e\t", (double) moles);
2689
+ }
2690
+ else
2691
+ {
2692
+ fpunchf(sformatf("s_%s", current_selected_output->Get_s_s()[k].first.c_str()),
2693
+ "%20.12e\t", (double) moles);
2694
+ }
2695
+ found = TRUE;
2696
+ break;
2697
+ }
2698
+ }
2699
+ if (found == TRUE)
2700
+ break;
2701
+ }
2702
+ }
2703
+ if (found == FALSE)
2704
+ {
2705
+ if (!current_selected_output->Get_high_precision())
2706
+ {
2707
+ fpunchf(sformatf("s_%s", current_selected_output->Get_s_s()[k].first.c_str()), "%12.4e\t", (double) 0.0);
2708
+ }
2709
+ else
2710
+ {
2711
+ fpunchf(sformatf("s_%s", current_selected_output->Get_s_s()[k].first.c_str()), "%20.12e\t",
2712
+ (double) 0.0);
2713
+ }
2714
+ }
2715
+ }
2716
+ return (OK);
2717
+ }
2718
+
2719
+ /* ---------------------------------------------------------------------- */
2720
+ int Phreeqc::
2721
+ punch_totals(void)
2722
+ /* ---------------------------------------------------------------------- */
2723
+ {
2724
+ /*
2725
+ * Print total concentrations of elements, molality and moles.
2726
+ */
2727
+ //int j;
2728
+ LDBLE molality;
2729
+
2730
+ for (size_t j = 0; j < current_selected_output->Get_totals().size(); j++)
2731
+ {
2732
+ if (current_selected_output->Get_totals()[j].second == NULL)
2733
+ {
2734
+ molality = 0.0;
2735
+ }
2736
+ else if (((class master *) current_selected_output->Get_totals()[j].second)->primary == TRUE)
2737
+ {
2738
+ if (strncmp(current_selected_output->Get_totals()[j].first.c_str(), "Alkalinity", 20) == 0)
2739
+ {
2740
+ molality = total_alkalinity / mass_water_aq_x;
2741
+ } else
2742
+ {
2743
+ molality = ((class master *) current_selected_output->Get_totals()[j].second)->total_primary / mass_water_aq_x;
2744
+ }
2745
+ }
2746
+ else
2747
+ {
2748
+ molality = ((class master *) current_selected_output->Get_totals()[j].second)->total / mass_water_aq_x;
2749
+ }
2750
+ if (!current_selected_output->Get_high_precision())
2751
+ {
2752
+ fpunchf(sformatf("%s(mol/kgw)", current_selected_output->Get_totals()[j].first.c_str()),
2753
+ "%12.4e\t", (double) molality);
2754
+ }
2755
+ else
2756
+ {
2757
+ fpunchf(sformatf("%s(mol/kgw)", current_selected_output->Get_totals()[j].first.c_str()),
2758
+ "%20.12e\t", (double) molality);
2759
+ }
2760
+ }
2761
+ return (OK);
2762
+ }
2763
+
2764
+ /* ---------------------------------------------------------------------- */
2765
+ int Phreeqc::
2766
+ punch_molalities(void)
2767
+ /* ---------------------------------------------------------------------- */
2768
+ {
2769
+ /*
2770
+ * Print concentrations of species (aq, ex, surf)
2771
+ */
2772
+ //int j;
2773
+ LDBLE molality;
2774
+
2775
+ for (size_t j = 0; j < current_selected_output->Get_molalities().size(); j++)
2776
+ {
2777
+ molality = 0.0;
2778
+ if (current_selected_output->Get_molalities()[j].second != NULL
2779
+ && ((class species *) current_selected_output->Get_molalities()[j].second)->in == TRUE)
2780
+ {
2781
+ molality = ((class species *) current_selected_output->Get_molalities()[j].second)->moles / mass_water_aq_x;
2782
+ }
2783
+ if (!current_selected_output->Get_high_precision())
2784
+ {
2785
+ fpunchf(sformatf("m_%s(mol/kgw)", current_selected_output->Get_molalities()[j].first.c_str()),
2786
+ "%12.4e\t", (double) molality);
2787
+ }
2788
+ else
2789
+ {
2790
+ fpunchf(sformatf("m_%s(mol/kgw)", current_selected_output->Get_molalities()[j].first.c_str()),
2791
+ "%20.12e\t", (double) molality);
2792
+ }
2793
+ }
2794
+ return (OK);
2795
+ }
2796
+
2797
+ /* ---------------------------------------------------------------------- */
2798
+ int Phreeqc::
2799
+ punch_activities(void)
2800
+ /* ---------------------------------------------------------------------- */
2801
+ {
2802
+ /*
2803
+ * Print concentrations of species (aq, ex, surf)
2804
+ */
2805
+ //int j;
2806
+ LDBLE la;
2807
+
2808
+ for (size_t j = 0; j < current_selected_output->Get_activities().size(); j++)
2809
+ {
2810
+ la = -999.999;
2811
+ if (current_selected_output->Get_activities()[j].second != NULL
2812
+ && ((class species *) current_selected_output->Get_activities()[j].second)->in == TRUE)
2813
+ {
2814
+ /*la = punch.activities[j].s->lm + punch.activities[j].s->lg; */
2815
+ la = log_activity(current_selected_output->Get_activities()[j].first.c_str());
2816
+ }
2817
+ if (!current_selected_output->Get_high_precision())
2818
+ {
2819
+ fpunchf(sformatf("la_%s", current_selected_output->Get_activities()[j].first.c_str()), "%12.4e\t",
2820
+ (double) la);
2821
+ }
2822
+ else
2823
+ {
2824
+ fpunchf(sformatf("la_%s", current_selected_output->Get_activities()[j].first.c_str()),
2825
+ "%20.12e\t", (double) la);
2826
+ }
2827
+ }
2828
+ return (OK);
2829
+ }
2830
+
2831
+ /* ---------------------------------------------------------------------- */
2832
+ int Phreeqc::
2833
+ punch_pp_assemblage(void)
2834
+ /* ---------------------------------------------------------------------- */
2835
+ {
2836
+ /*
2837
+ * Prints masses of selected pure_phases in pp_assemblage
2838
+ */
2839
+ //int i, j;
2840
+ LDBLE moles, delta_moles;
2841
+ for (size_t i = 0; i < current_selected_output->Get_pure_phases().size(); i++)
2842
+ {
2843
+ delta_moles = 0;
2844
+ moles = 0.0;
2845
+ if (current_selected_output->Get_pure_phases()[i].second != NULL)
2846
+ {
2847
+ for (int j = 0; j < count_unknowns; j++)
2848
+ {
2849
+ if (x.size() == 0 || x[j]->type != PP)
2850
+ continue;
2851
+ //cxxPPassemblageComp * comp_ptr = pp_assemblage_ptr->Find(x[j]->pp_assemblage_comp_name);
2852
+ cxxPPassemblageComp * comp_ptr = (cxxPPassemblageComp * ) x[j]->pp_assemblage_comp_ptr;
2853
+ /*
2854
+ * Print pure phase assemblage data
2855
+ */
2856
+ if (current_selected_output->Get_pure_phases()[i].second != x[j]->phase)
2857
+ continue;
2858
+ if (state != TRANSPORT && state != PHAST)
2859
+ {
2860
+ moles = x[j]->moles;
2861
+ delta_moles =
2862
+ x[j]->moles - comp_ptr->Get_moles() -
2863
+ comp_ptr->Get_delta();
2864
+ }
2865
+ else
2866
+ {
2867
+ moles = x[j]->moles;
2868
+ delta_moles =
2869
+ x[j]->moles - comp_ptr->Get_initial_moles();
2870
+ }
2871
+ break;
2872
+ }
2873
+ }
2874
+ if (!current_selected_output->Get_high_precision())
2875
+ {
2876
+ fpunchf(current_selected_output->Get_pure_phases()[i].first.c_str(), "%12.4e\t", (double) moles);
2877
+ fpunchf(sformatf("d_%s", current_selected_output->Get_pure_phases()[i].first.c_str()), "%12.4e\t",
2878
+ (double) delta_moles);
2879
+ }
2880
+ else
2881
+ {
2882
+ fpunchf(current_selected_output->Get_pure_phases()[i].first.c_str(), "%20.12e\t", (double) moles);
2883
+ fpunchf(sformatf("d_%s", current_selected_output->Get_pure_phases()[i].first.c_str()),
2884
+ "%20.12e\t", (double) delta_moles);
2885
+ }
2886
+ }
2887
+ return (OK);
2888
+ }
2889
+
2890
+ #define PHAST_NULL(x) (phast ? NULL : x)
2891
+ /* ---------------------------------------------------------------------- */
2892
+ int Phreeqc::
2893
+ punch_identifiers(void)
2894
+ /* ---------------------------------------------------------------------- */
2895
+ {
2896
+ /*
2897
+ * prints series of integers to identify simulation number,
2898
+ * state of calculations, reaction or transport step number,
2899
+ * and temp, ph, pe, and mass of water for each line
2900
+ * of selected output.
2901
+ */
2902
+ const char *sformat;
2903
+ const char *dformat;
2904
+ const char *gformat;
2905
+ int i;
2906
+ char token[MAX_LENGTH];
2907
+
2908
+ //if (punch.in == FALSE)
2909
+ // return (OK);
2910
+ if (!current_selected_output->Get_high_precision())
2911
+ {
2912
+ sformat = "%12s\t";
2913
+ dformat = "%12d\t";
2914
+ gformat = "%12g\t";
2915
+ }
2916
+ else
2917
+ {
2918
+ sformat = "%20s\t";
2919
+ dformat = "%20d\t";
2920
+ gformat = "%20g\t";
2921
+ }
2922
+
2923
+ /*
2924
+ * simulation or simul_tr
2925
+ */
2926
+
2927
+ if (current_selected_output->Get_sim())
2928
+ {
2929
+ if (state != TRANSPORT && state != PHAST)
2930
+ {
2931
+ fpunchf(PHAST_NULL("sim"), dformat, simulation);
2932
+ }
2933
+ else
2934
+ {
2935
+ fpunchf(PHAST_NULL("sim"), dformat, simul_tr);
2936
+ }
2937
+ }
2938
+ if (current_selected_output->Get_state())
2939
+ {
2940
+ switch (state)
2941
+ {
2942
+ case 0:
2943
+ Utilities::strcpy_safe(token, MAX_LENGTH, "init");
2944
+ break;
2945
+ case 1:
2946
+ Utilities::strcpy_safe(token, MAX_LENGTH, "i_soln");
2947
+ break;
2948
+ case 2:
2949
+ Utilities::strcpy_safe(token, MAX_LENGTH, "i_exch");
2950
+ break;
2951
+ case 3:
2952
+ Utilities::strcpy_safe(token, MAX_LENGTH, "i_surf");
2953
+ break;
2954
+ case 4:
2955
+ Utilities::strcpy_safe(token, MAX_LENGTH, "i_gas");
2956
+ break;
2957
+ case 5:
2958
+ Utilities::strcpy_safe(token, MAX_LENGTH, "react");
2959
+ break;
2960
+ case 6:
2961
+ Utilities::strcpy_safe(token, MAX_LENGTH, "inverse");
2962
+ break;
2963
+ case 7:
2964
+ Utilities::strcpy_safe(token, MAX_LENGTH, "advect");
2965
+ break;
2966
+ case 8:
2967
+ Utilities::strcpy_safe(token, MAX_LENGTH, "transp");
2968
+ break;
2969
+ default:
2970
+ Utilities::strcpy_safe(token, MAX_LENGTH, "unknown");
2971
+ break;
2972
+ }
2973
+ fpunchf(PHAST_NULL("state"), sformat, token);
2974
+
2975
+ }
2976
+ /*
2977
+ * solution number or cell number and time
2978
+ */
2979
+ if (current_selected_output->Get_soln())
2980
+ {
2981
+ if (state == TRANSPORT || state == PHAST)
2982
+ {
2983
+ fpunchf(PHAST_NULL("soln"), dformat, cell);
2984
+ }
2985
+ else if (state == ADVECTION)
2986
+ {
2987
+ fpunchf(PHAST_NULL("soln"), dformat, use.Get_n_solution_user());
2988
+ }
2989
+ else if (state < REACTION)
2990
+ {
2991
+ fpunchf(PHAST_NULL("soln"), dformat, use.Get_solution_ptr()->Get_n_user());
2992
+ }
2993
+ else
2994
+ {
2995
+ if (use.Get_mix_in() == TRUE)
2996
+ {
2997
+ if (state != TRANSPORT)
2998
+ {
2999
+ fpunchf(PHAST_NULL("soln"), dformat, use.Get_n_mix_user_orig());
3000
+ }
3001
+ else
3002
+ {
3003
+ fpunchf(PHAST_NULL("soln"), dformat, use.Get_n_mix_user());
3004
+ }
3005
+
3006
+ }
3007
+ else
3008
+ {
3009
+ fpunchf(PHAST_NULL("soln"), dformat, use.Get_n_solution_user());
3010
+ }
3011
+ }
3012
+ }
3013
+ if (current_selected_output->Get_dist())
3014
+ {
3015
+ if (state == ADVECTION)
3016
+ {
3017
+ fpunchf(PHAST_NULL("dist_x"), gformat, (double)use.Get_n_solution_user());
3018
+ }
3019
+ else if (state == TRANSPORT)
3020
+ {
3021
+ fpunchf(PHAST_NULL("dist_x"), gformat,
3022
+ (double) cell_data[cell].mid_cell_x);
3023
+ }
3024
+ else
3025
+ {
3026
+ fpunchf(PHAST_NULL("dist_x"), gformat, (double)-99);
3027
+ }
3028
+ }
3029
+ if (current_selected_output->Get_time())
3030
+ {
3031
+ LDBLE reaction_time = kin_time_x;
3032
+ if (state == REACTION && incremental_reactions == TRUE
3033
+ && use.Get_kinetics_ptr() != NULL)
3034
+ {
3035
+ if (!use.Get_kinetics_ptr()->Get_equalIncrements())
3036
+ {
3037
+ reaction_time = 0.0;
3038
+ for (i = 0; i < reaction_step; i++)
3039
+ {
3040
+ if (i < (int) use.Get_kinetics_ptr()->Get_steps().size())
3041
+ {
3042
+ reaction_time += use.Get_kinetics_ptr()->Get_steps()[i];
3043
+ }
3044
+ else
3045
+ {
3046
+ reaction_time +=
3047
+ use.Get_kinetics_ptr()->Get_steps().back();
3048
+ }
3049
+ }
3050
+ }
3051
+ else
3052
+ {
3053
+ if (reaction_step > use.Get_kinetics_ptr()->Get_count())
3054
+ {
3055
+ reaction_time = use.Get_kinetics_ptr()->Get_steps().front();
3056
+ }
3057
+ else
3058
+ {
3059
+ reaction_time =
3060
+ reaction_step * use.Get_kinetics_ptr()->Get_steps().front() /
3061
+ ((LDBLE) (use.Get_kinetics_ptr()->Get_count()));
3062
+ }
3063
+ }
3064
+ }
3065
+ if (state == REACTION)
3066
+ {
3067
+ fpunchf(PHAST_NULL("time"), gformat, (double) reaction_time);
3068
+ }
3069
+ else if (state == TRANSPORT || state == PHAST)
3070
+ {
3071
+ fpunchf(PHAST_NULL("time"), gformat,
3072
+ (double) (initial_total_time + rate_sim_time));
3073
+ }
3074
+ else if (state == ADVECTION)
3075
+ {
3076
+ if (advection_kin_time_defined == TRUE)
3077
+ {
3078
+ fpunchf(PHAST_NULL("time"), gformat,
3079
+ (double) (initial_total_time + rate_sim_time));
3080
+ }
3081
+ else
3082
+ {
3083
+ fpunchf(PHAST_NULL("time"), gformat, (double)advection_step);
3084
+ }
3085
+ }
3086
+ else
3087
+ {
3088
+ fpunchf(PHAST_NULL("time"), gformat, (double)-99);
3089
+ }
3090
+ }
3091
+
3092
+ /*
3093
+ * reaction or transport step
3094
+ */
3095
+ if (current_selected_output->Get_step())
3096
+ {
3097
+ if (state == REACTION)
3098
+ {
3099
+ fpunchf(PHAST_NULL("step"), dformat, reaction_step);
3100
+ }
3101
+ else if (state == ADVECTION)
3102
+ {
3103
+ fpunchf(PHAST_NULL("step"), dformat, advection_step);
3104
+ }
3105
+ else if (state == TRANSPORT)
3106
+ {
3107
+ fpunchf(PHAST_NULL("step"), dformat, transport_step);
3108
+ }
3109
+ else
3110
+ {
3111
+ fpunchf(PHAST_NULL("step"), dformat, -99);
3112
+ }
3113
+ }
3114
+ if (current_selected_output->Get_ph())
3115
+ {
3116
+ if (!current_selected_output->Get_high_precision())
3117
+ {
3118
+ fpunchf("pH", "%12g\t", (double) (-s_hplus->la));
3119
+ }
3120
+ else
3121
+ {
3122
+ fpunchf("pH", "%20.12e\t", (double) (-s_hplus->la));
3123
+ }
3124
+ }
3125
+ if (current_selected_output->Get_pe())
3126
+ {
3127
+ if (!current_selected_output->Get_high_precision())
3128
+ {
3129
+ fpunchf("pe", "%12g\t", (double) (-s_eminus->la));
3130
+ }
3131
+ else
3132
+ {
3133
+ fpunchf("pe", "%20.12e\t", (double) (-s_eminus->la));
3134
+ }
3135
+ }
3136
+ if (current_selected_output->Get_rxn())
3137
+ {
3138
+ if (state >= REACTION && use.Get_reaction_in() == TRUE)
3139
+ {
3140
+ if (!current_selected_output->Get_high_precision())
3141
+ {
3142
+ fpunchf("reaction", "%12.4e\t", (double) step_x);
3143
+ }
3144
+ else
3145
+ {
3146
+ fpunchf("reaction", "%20.12e\t", (double) step_x);
3147
+ }
3148
+ }
3149
+ else
3150
+ {
3151
+ if (!current_selected_output->Get_high_precision())
3152
+ {
3153
+ fpunchf("reaction", "%12d\t", -99);
3154
+ }
3155
+ else
3156
+ {
3157
+ fpunchf("reaction", "%20d\t", -99);
3158
+ }
3159
+ }
3160
+ }
3161
+ if (current_selected_output->Get_temp())
3162
+ {
3163
+ if (!current_selected_output->Get_high_precision())
3164
+ {
3165
+ fpunchf("temp(C)", "%12.3f\t", (double) tc_x);
3166
+ }
3167
+ else
3168
+ {
3169
+ fpunchf("temp(C)", "%20.12e\t", (double) tc_x);
3170
+ }
3171
+ }
3172
+ if (current_selected_output->Get_alk())
3173
+ {
3174
+ if (!current_selected_output->Get_high_precision())
3175
+ {
3176
+ fpunchf("Alk(eq/kgw)", "%12g\t",
3177
+ (double) (total_alkalinity / mass_water_aq_x));
3178
+ }
3179
+ else
3180
+ {
3181
+ fpunchf("Alk(eq/kgw)", "%20.12e\t",
3182
+ (double) (total_alkalinity / mass_water_aq_x));
3183
+ }
3184
+ }
3185
+ if (current_selected_output->Get_mu())
3186
+ {
3187
+ if (!current_selected_output->Get_high_precision())
3188
+ {
3189
+ fpunchf("mu", "%12g\t", (double) mu_x);
3190
+ }
3191
+ else
3192
+ {
3193
+ fpunchf("mu", "%20.12e\t", (double) mu_x);
3194
+ }
3195
+ }
3196
+ if (current_selected_output->Get_water())
3197
+ {
3198
+ if (!current_selected_output->Get_high_precision())
3199
+ {
3200
+ fpunchf("mass_H2O", "%12g\t", (double) mass_water_aq_x);
3201
+ }
3202
+ else
3203
+ {
3204
+ fpunchf("mass_H2O", "%20.12e\t", (double) mass_water_aq_x);
3205
+ }
3206
+ }
3207
+ if (current_selected_output->Get_charge_balance())
3208
+ {
3209
+ if (!current_selected_output->Get_high_precision())
3210
+ {
3211
+ fpunchf("charge(eq)", "%12g\t", (double) cb_x);
3212
+ }
3213
+ else
3214
+ {
3215
+ fpunchf("charge(eq)", "%20.12e\t", (double) cb_x);
3216
+ }
3217
+ }
3218
+ if (current_selected_output->Get_percent_error())
3219
+ {
3220
+ if (!current_selected_output->Get_high_precision())
3221
+ {
3222
+ fpunchf("pct_err", "%12g\t",
3223
+ (double) (100 * cb_x / total_ions_x));
3224
+ }
3225
+ else
3226
+ {
3227
+ fpunchf("pct_err", "%20.12e\t",
3228
+ (double) (100 * cb_x / total_ions_x));
3229
+ }
3230
+ }
3231
+ punch_flush();
3232
+ return (OK);
3233
+ }
3234
+
3235
+ #undef PHAST_NULL
3236
+ /* ---------------------------------------------------------------------- */
3237
+ int Phreeqc::
3238
+ punch_saturation_indices(void)
3239
+ /* ---------------------------------------------------------------------- */
3240
+ {
3241
+ /*
3242
+ * Prints saturation indices of selected phases
3243
+ */
3244
+ //int i;
3245
+ LDBLE si, iap;
3246
+ class rxn_token *rxn_ptr;
3247
+
3248
+ for (size_t i = 0; i < current_selected_output->Get_si().size(); i++)
3249
+ {
3250
+ if (current_selected_output->Get_si()[i].second == NULL || ((class phase *) current_selected_output->Get_si()[i].second)->in == FALSE)
3251
+ {
3252
+ si = -999.999;
3253
+ }
3254
+ else
3255
+ {
3256
+ /*
3257
+ * Print saturation index
3258
+ */
3259
+ iap = 0.0;
3260
+ for (rxn_ptr = &(((class phase *) current_selected_output->Get_si()[i].second)->rxn_x.token[0]) + 1;
3261
+ rxn_ptr->s != NULL; rxn_ptr++)
3262
+ {
3263
+ iap += rxn_ptr->s->la * rxn_ptr->coef;
3264
+ }
3265
+ si = -((class phase *) current_selected_output->Get_si()[i].second)->lk + iap;
3266
+ }
3267
+ if (!current_selected_output->Get_high_precision())
3268
+ {
3269
+ fpunchf(sformatf("si_%s", current_selected_output->Get_si()[i].first.c_str()), "%12.4f\t", (double) si);
3270
+ }
3271
+ else
3272
+ {
3273
+ fpunchf(sformatf("si_%s", current_selected_output->Get_si()[i].first.c_str()), "%20.12e\t", (double) si);
3274
+ }
3275
+ }
3276
+ return (OK);
3277
+ }
3278
+ /* ---------------------------------------------------------------------- */
3279
+ int Phreeqc::
3280
+ punch_kinetics(void)
3281
+ /* ---------------------------------------------------------------------- */
3282
+ {
3283
+ /*
3284
+ * prints kinetic reaction,
3285
+ * should be called only on final kinetic step
3286
+ */
3287
+ cxxKinetics *kinetics_ptr;
3288
+ LDBLE moles, delta_moles;
3289
+
3290
+ kinetics_ptr = NULL;
3291
+ if (use.Get_kinetics_in() == TRUE)
3292
+ {
3293
+ if (state == TRANSPORT || state == PHAST || state == ADVECTION)
3294
+ {
3295
+ kinetics_ptr = Utilities::Rxn_find(Rxn_kinetics_map, use.Get_n_kinetics_user());
3296
+ }
3297
+ else
3298
+ {
3299
+ kinetics_ptr = Utilities::Rxn_find(Rxn_kinetics_map, -2);
3300
+ }
3301
+ }
3302
+ for (size_t i = 0; i < current_selected_output->Get_kinetics().size(); i++)
3303
+ {
3304
+ moles = 0.0;
3305
+ delta_moles = 0.0;
3306
+ if (kinetics_ptr != NULL)
3307
+ {
3308
+ for (size_t j = 0; j < kinetics_ptr->Get_kinetics_comps().size(); j++)
3309
+ {
3310
+ cxxKineticsComp * kinetics_comp_ptr = &(kinetics_ptr->Get_kinetics_comps()[j]);
3311
+ if (strcmp_nocase
3312
+ (current_selected_output->Get_kinetics()[i].first.c_str(),
3313
+ kinetics_comp_ptr->Get_rate_name().c_str()) == 0)
3314
+ {
3315
+ if (state != TRANSPORT && state != PHAST)
3316
+ {
3317
+ moles = kinetics_comp_ptr->Get_m();
3318
+ delta_moles = - kinetics_comp_ptr->Get_moles();
3319
+ }
3320
+ else
3321
+ {
3322
+ moles = kinetics_comp_ptr->Get_m();
3323
+ delta_moles =
3324
+ kinetics_comp_ptr->Get_m() -
3325
+ kinetics_comp_ptr->Get_initial_moles();
3326
+ }
3327
+ break;
3328
+ }
3329
+ }
3330
+ }
3331
+ if (!current_selected_output->Get_high_precision())
3332
+ {
3333
+ fpunchf(sformatf("k_%s", current_selected_output->Get_kinetics()[i].first.c_str()), "%12.4e\t",
3334
+ (double) moles);
3335
+ fpunchf(sformatf("dk_%s", current_selected_output->Get_kinetics()[i].first.c_str()), "%12.4e\t",
3336
+ (double) delta_moles);
3337
+ }
3338
+ else
3339
+ {
3340
+ fpunchf(sformatf("k_%s", current_selected_output->Get_kinetics()[i].first.c_str()), "%20.12e\t",
3341
+ (double) moles);
3342
+ fpunchf(sformatf("dk_%s", current_selected_output->Get_kinetics()[i].first.c_str()), "%20.12e\t",
3343
+ (double) delta_moles);
3344
+ }
3345
+ }
3346
+ return (OK);
3347
+ }
3348
+ /* ---------------------------------------------------------------------- */
3349
+ int Phreeqc::
3350
+ punch_user_punch(void)
3351
+ /* ---------------------------------------------------------------------- */
3352
+ {
3353
+ /*
3354
+ * Punch with user defined BASIC print routine
3355
+ */
3356
+ char l_command[] = "run";
3357
+
3358
+ n_user_punch_index = 0;
3359
+ //if (punch.user_punch == FALSE)
3360
+ // return (OK);
3361
+ if (current_user_punch == NULL || !current_selected_output->Get_user_punch())
3362
+ return OK;
3363
+
3364
+ class rate * user_punch = current_user_punch->Get_rate();
3365
+
3366
+ if (user_punch->commands.c_str() == 0)
3367
+ return (OK);
3368
+ if (user_punch->new_def == TRUE)
3369
+ {
3370
+ if (basic_compile
3371
+ (user_punch->commands.c_str(), &user_punch->linebase,
3372
+ &user_punch->varbase, &user_punch->loopbase) != 0)
3373
+ {
3374
+ error_msg("Fatal Basic error in USER_PUNCH.", STOP);
3375
+ }
3376
+ user_punch->new_def = FALSE;
3377
+ }
3378
+ if (basic_run
3379
+ (l_command, user_punch->linebase, user_punch->varbase,
3380
+ user_punch->loopbase) != 0)
3381
+ {
3382
+ error_msg("Fatal Basic error in USER_PUNCH.", STOP);
3383
+ }
3384
+ return (OK);
3385
+ }
3386
+
3387
+ #if defined PHREEQ98
3388
+ /* ---------------------------------------------------------------------- */
3389
+ int Phreeqc::
3390
+ punch_user_graph(void)
3391
+ /* ---------------------------------------------------------------------- */
3392
+ {
3393
+ /*
3394
+ * Graph with user defined BASIC print routine
3395
+ */
3396
+ char command[] = "run";
3397
+
3398
+ colnr = 0;
3399
+ /* if (pr.user_graph == FALSE || pr.all == FALSE) return(OK); */
3400
+ /* if (punch.user_punch == FALSE) return(OK); */
3401
+ /* if (punch.in == FALSE) return(OK); */
3402
+ if (user_graph->commands == NULL)
3403
+ return (OK);
3404
+ if (((state == INITIAL_SOLUTION) || (state == INITIAL_EXCHANGE)
3405
+ || (state == INITIAL_SURFACE) || (state == INITIAL_GAS_PHASE))
3406
+ && (graph_initial_solutions == FALSE))
3407
+ return (OK);
3408
+ if (FirstCallToUSER_GRAPH)
3409
+ AddSeries = TRUE;
3410
+ if (state == REACTION)
3411
+ {
3412
+ /*if (reaction_step == 1) AddSeries = TRUE;
3413
+ else AddSeries = FALSE; */
3414
+ if (reaction_step == 1 && !connect_simulations)
3415
+ AddSeries = TRUE;
3416
+ if (reaction_step > 1)
3417
+ AddSeries = FALSE;
3418
+ }
3419
+ if (state == ADVECTION)
3420
+ {
3421
+ if (advection_step == 0 && graph_initial_solutions == FALSE)
3422
+ return (OK);
3423
+ if (((chart_type == 1) && (advection_step == punch_ad_modulus)) ||
3424
+ ((chart_type == 0) && (advection_step != prev_advection_step)))
3425
+ AddSeries = TRUE;
3426
+ else
3427
+ AddSeries = FALSE;
3428
+ }
3429
+ if (state == TRANSPORT)
3430
+ {
3431
+ if (transport_step == 0 && graph_initial_solutions == FALSE)
3432
+ return (OK);
3433
+ if (((chart_type == 1) && (transport_step == punch_modulus)) ||
3434
+ ((chart_type == 0) && (transport_step != prev_transport_step)))
3435
+ AddSeries = TRUE;
3436
+ else
3437
+ AddSeries = FALSE;
3438
+ }
3439
+ if (user_graph->new_def == TRUE)
3440
+ {
3441
+ if (basic_compile
3442
+ (user_graph->commands, &user_graph->linebase,
3443
+ &user_graph->varbase, &user_graph->loopbase) != 0)
3444
+ {
3445
+ error_msg("Fatal Basic error in USER_GRAPH.", STOP);
3446
+ }
3447
+ user_graph->new_def = FALSE;
3448
+ }
3449
+ if (basic_run
3450
+ (command, user_graph->linebase, user_graph->varbase,
3451
+ user_graph->loopbase) != 0)
3452
+ {
3453
+ error_msg("Fatal Basic error in USER_GRAPH.", STOP);
3454
+ }
3455
+ if (state == ADVECTION)
3456
+ prev_advection_step = advection_step;
3457
+ if (state == TRANSPORT)
3458
+ prev_transport_step = transport_step;
3459
+ /*if (state == REACTION) prev_reaction_step = reaction_step; */
3460
+
3461
+ if (FirstCallToUSER_GRAPH)
3462
+ {
3463
+ start_chart(0);
3464
+ }
3465
+
3466
+ FirstCallToUSER_GRAPH = FALSE;
3467
+
3468
+ return (OK);
3469
+ }
3470
+ #endif
3471
+ #if defined(MULTICHART)
3472
+ /* ---------------------------------------------------------------------- */
3473
+ int Phreeqc::
3474
+ punch_user_graph(void)
3475
+ /* ---------------------------------------------------------------------- */
3476
+ {
3477
+ /*
3478
+ * Graph with user defined BASIC print routine
3479
+ */
3480
+ char command[] = "run";
3481
+ ChartObject *chart = chart_handler.Get_current_chart();
3482
+ if (chart == NULL) return OK;
3483
+
3484
+ chart->Set_AddSeries(false);
3485
+
3486
+ if (chart->Get_rate_command_list().size() == 0)
3487
+ return (OK);
3488
+
3489
+ // Skip initial calculations if initial_solutions == false
3490
+ if (((state == INITIAL_SOLUTION) || (state == INITIAL_EXCHANGE)
3491
+ || (state == INITIAL_SURFACE) || (state == INITIAL_GAS_PHASE))
3492
+ && (chart->Get_graph_initial_solutions() == false))
3493
+ return (OK);
3494
+
3495
+ if (state == REACTION)
3496
+ {
3497
+ /*if (reaction_step == 1) AddSeries = TRUE;
3498
+ else AddSeries = FALSE; */
3499
+ if (reaction_step == 1)
3500
+ chart->Set_AddSeries(true);
3501
+ if (reaction_step > 1)
3502
+ chart->Set_AddSeries(false);
3503
+ }
3504
+
3505
+ if (state == ADVECTION)
3506
+ {
3507
+
3508
+ if (advection_step == 0 && chart->Get_graph_initial_solutions() == false)
3509
+ return (OK);
3510
+ if (
3511
+ ((chart->Get_chart_type() == 1) && (advection_step == punch_ad_modulus)) ||
3512
+ ((chart->Get_chart_type() == 0) && (advection_step != chart->Get_prev_advection_step()))
3513
+ )
3514
+ {
3515
+ chart->Set_AddSeries(true);
3516
+ }
3517
+ else
3518
+ chart->Set_AddSeries(false);
3519
+ }
3520
+ if (state == TRANSPORT)
3521
+ {
3522
+ if (transport_step == 0 && chart->Get_graph_initial_solutions() == FALSE)
3523
+ return (OK);
3524
+ if (
3525
+ ((chart->Get_chart_type() == 1) && (transport_step == punch_modulus)) ||
3526
+ ((chart->Get_chart_type() == 0) && (transport_step != chart->Get_prev_transport_step()))
3527
+ )
3528
+ {
3529
+ chart->Set_AddSeries(true);
3530
+ }
3531
+ else
3532
+ {
3533
+ chart->Set_AddSeries(false);
3534
+ }
3535
+ }
3536
+
3537
+ // From cmdplot_xy merged into transport and advection above
3538
+
3539
+ // From plotXY
3540
+ if (chart->Get_FirstCallToUSER_GRAPH())
3541
+ chart->Set_prev_sim_no(simulation);
3542
+ else
3543
+ {
3544
+ if (simulation != chart->Get_prev_sim_no())
3545
+ {
3546
+ chart->Set_AddSeries(true);
3547
+ }
3548
+ }
3549
+ chart->Set_prev_sim_no(simulation);
3550
+ if (chart->Get_AddSeries() && !chart->Get_connect_simulations())
3551
+ {
3552
+ chart->Add_new_series();
3553
+ }
3554
+
3555
+ chart->Set_colnr(chart->Get_ColumnOffset());
3556
+ chart->Initialize_graph_pts();
3557
+ if (chart->Get_rate_new_def())
3558
+ {
3559
+ if (basic_compile
3560
+ (chart->Get_user_graph()->commands.c_str(), &chart->Get_user_graph()->linebase,
3561
+ &chart->Get_user_graph()->varbase, &chart->Get_user_graph()->loopbase) != 0)
3562
+ {
3563
+ error_msg("Fatal Basic error in USER_GRAPH.", STOP);
3564
+ }
3565
+ chart->Set_rate_new_def(false);
3566
+ }
3567
+
3568
+ // basic_run calculates points for all graph and plotxy curves
3569
+ // colnr identifies the curve and is incremented as each Y/Y2 curve point is added
3570
+ if (basic_run
3571
+ (command, chart->Get_user_graph()->linebase,
3572
+ chart->Get_user_graph()->varbase, chart->Get_user_graph()->loopbase) != 0)
3573
+ {
3574
+ error_msg("Fatal Basic error in USER_GRAPH.", STOP);
3575
+ }
3576
+ chart->Finalize_graph_pts();
3577
+
3578
+ if (state == ADVECTION)
3579
+ chart->Set_prev_advection_step(advection_step);
3580
+ if (state == TRANSPORT)
3581
+ chart->Set_prev_transport_step(transport_step);
3582
+
3583
+ if (chart->Get_FirstCallToUSER_GRAPH())
3584
+ {
3585
+ chart->start_chart();
3586
+ }
3587
+ chart->Set_new_ug(false);
3588
+
3589
+ chart->Set_FirstCallToUSER_GRAPH(false);
3590
+
3591
+ return (OK);
3592
+ }
3593
+ #endif // MULTICHART
3594
+
3595
+ char * Phreeqc::
3596
+ sformatf(const char *format, ...)
3597
+ {
3598
+ bool success = false;
3599
+ do
3600
+ {
3601
+ va_list args;
3602
+ va_start(args, format);
3603
+ int j = vsnprintf(sformatf_buffer, sformatf_buffer_size, format, args);
3604
+ success = (j > 0 && j < (int) sformatf_buffer_size);
3605
+ va_end(args);
3606
+ if (!success)
3607
+ {
3608
+ sformatf_buffer_size *= 2;
3609
+ sformatf_buffer = (char *) PHRQ_realloc(sformatf_buffer, sformatf_buffer_size * sizeof(char));
3610
+ if (sformatf_buffer == NULL) malloc_error();
3611
+ }
3612
+ }
3613
+ while (!success);
3614
+
3615
+ return sformatf_buffer;
3616
+ }
3617
+
3618
+ /* ---------------------------------------------------------------------- */
3619
+ int Phreeqc::
3620
+ print_alkalinity(void)
3621
+ /* ---------------------------------------------------------------------- */
3622
+ {
3623
+ /*
3624
+ * Prints description of solution, uses array species_list for
3625
+ * order of aqueous species.
3626
+ */
3627
+ int j;
3628
+ std::vector<class species_list> alk_list;
3629
+ LDBLE min;
3630
+
3631
+ if (pr.alkalinity == FALSE || pr.all == FALSE)
3632
+ return (OK);
3633
+ print_centered("Distribution of alkalinity");
3634
+ alk_list.clear();
3635
+ j = 0;
3636
+ for (size_t i = 0; i < this->s_x.size(); i++)
3637
+ {
3638
+ if (s_x[i]->alk == 0.0)
3639
+ continue;
3640
+ alk_list.resize(alk_list.size() + 1);
3641
+ alk_list[j].master_s = s_hplus;
3642
+ alk_list[j].s = s_x[i];
3643
+ alk_list[j].coef = s_x[i]->alk;
3644
+ j++;
3645
+ }
3646
+ min = fabs(censor * total_alkalinity / mass_water_aq_x);
3647
+ if (alk_list.size() > 0)
3648
+ {
3649
+ output_msg(sformatf("\t%26s%11.3e\n\n",
3650
+ "Total alkalinity (eq/kgw) = ",
3651
+ (double) (total_alkalinity / mass_water_aq_x)));
3652
+ output_msg(sformatf("\t%-15s%12s%12s%10s\n\n", "Species",
3653
+ "Alkalinity", "Molality", "Alk/Mol"));
3654
+ if (alk_list.size() > 1) qsort(&alk_list[0], alk_list.size(),
3655
+ (size_t) sizeof(class species_list), species_list_compare_alk);
3656
+ for (size_t i = 0; i < alk_list.size(); i++)
3657
+ {
3658
+ if (fabs(alk_list[i].s->alk * (alk_list[i].s->moles) /
3659
+ mass_water_aq_x) < min)
3660
+ continue;
3661
+ output_msg(sformatf("\t%-15s%12.3e%12.3e%10.2f\n",
3662
+ alk_list[i].s->name,
3663
+ (double) (alk_list[i].s->alk *
3664
+ (alk_list[i].s->moles) / mass_water_aq_x),
3665
+ (double) ((alk_list[i].s->moles) / mass_water_aq_x),
3666
+ (double) (alk_list[i].s->alk)));
3667
+ }
3668
+ }
3669
+
3670
+ output_msg(sformatf("\n"));
3671
+ return (OK);
3672
+ }
3673
+