[CL] New Phreeqc Interface #2640
Current chemical solver interface between OGS-6 and Phreeqc works in a conventional way (via file-based approach). That is, in each time step, Phreeqc input file is prepared for speciation calculation and phreeqc output file is then parsed for result updates. This approach is not computationally efficient.
New Phreeqc Interface by direct memory access
Thanks to Dima's instruction and Wenqing's help, we hereby provide an alternative interface by direct memory access. This approach allows us not to process Phreeqc input and output files any more. This feature greatly cuts down computation costs. In the small-scale kinetic reactant benchmark added in this pull request (containing 201 nodes), computation time by Phreeqc reduces from ~0.05 seconds to ~0.03 seconds (in average) in each time step. We gain 60% speed-up. In another intermediate-scale test (not included in this pull request, download by IntermediateScaleKineticReactantBenchmark.zip containing 24461 nodes, with the same chemical configuration as in the small-scale test), Phreeqc runtime decreases from ~40 seconds to ~2 seconds. We acquire 20x speed-up. Speed-up effect becomes more and more significant with the increase of number of nodes (also referred as number of chemical system).
In addition, using this alternative interface prevents from precision lost in truncation.