testGolemRunner + example

This commit is contained in:
Marco De Lucia 2025-07-28 12:26:20 +02:00
parent 281595c39f
commit 64d9685b97
3 changed files with 1606 additions and 28 deletions

1497
poet/test/phreeqc_kin.dat Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
SOLUTION 1
units mol/kgw
pH 6.653
pe -3.167
water 1
temp 17
Na 1e-15
Cl 1e-15 charge
Ca 1e-15
C 1e-15
Fe 4.386e-9
S 8.772e-9
Al 5.031e-7
Si 5.031e-7
PURE 1
Pyrite 0.0 2.5e-4
KINETICS 1
Kaolinite
-m 1.5e-4
-parms 0.6 100000
SOLUTION 2
units mol/kgw
pH 6.921
pe -1.258
water 1
temp 17
Na 1e-15
Cl 1e-15 charge
Ca 1e-15
C 1e-15
Fe 1e-15
S 1e-15
Al 1e-15
Si 7.963e-5
PURE 2
Pyrite 0.0 2.1e-4
KINETICS 2
Quartz
-m 2.2e-4
-parms 0.01 1
SOLUTION 3
units mol/kgw
pH 9.963
pe -6.769
temp 17
Na 1e-15
Cl 1e-15
Ca 1.345e-4
C 1.345e-4
Fe 1.433e-8
S 2.866e-8
Al 2.692e-5
Si 2.692e-5
PURE 3
Pyrite 0 2e-4
Calcite 0 1e-4
KINETICS 3
Kaolinite
-m 1.4e-3
-parms 0.6 1000
Siderite
-m 1.2e-12
-parms 1.2 10
SOLUTION 4
units mol/kgw
temp 17
pH 5.576
pe 4 O2(g) -1
Cl 0.0003 charge
Na 0.0003
C 1e-15 CO2(g) -3.38
Ca 1e-15
Fe 1e-15
S 1e-15
Al 1e-15
Si 1e-15
SOLUTION 5
units mol/kgw
temp 35
pH 7
pe 4
Cl 0.003 charge
Na 0.003
C(4) 2.333e-3
RUN_CELLS
-cells 1 2 3 4 5
END

View File

@ -1,4 +1,4 @@
// Time-stamp: "Last modified 2024-12-02 17:37:08 delucia"
// Time-stamp: "Last modified 2025-07-28 12:23:47 delucia"
#include <iostream>
#include <iomanip>
#include <linux/limits.h>
@ -99,12 +99,6 @@ int main(int argc, char *argv[]) {
std::vector<double> &cell_values = exported_mat.values;
std::cout << ":: Values in the PhreeqcMatrix: \n";
// std::cout << exported_mat.names << "\n";
// std::cout << cell_values << "\n";
// END INIT
//// Phreeqc RUN through the new Runner class
@ -117,39 +111,28 @@ int main(int argc, char *argv[]) {
const auto matrix_values = stl_mat.values;
const auto num_columns = stl_mat.names.size();
const auto spec_names = stl_mat.names;
// container to pass in/out
std::vector<std::vector<double>> simulationInOut;
// grid cells
const std::size_t num_cells = 10;
const std::size_t half_cells = 5;
// copy the values to the InOut vector. We replicate cell 1
for (std::size_t index = 0; index < num_cells; ++index) {
if (index < half_cells) {
simulationInOut.push_back(std::vector<double>(
matrix_values.begin(), matrix_values.begin() + num_columns));
} else {
simulationInOut.push_back(std::vector<double>(
matrix_values.begin() + num_columns, matrix_values.end()));
}
for (std::size_t index = 0; index < n; ++index) {
simulationInOut.push_back(std::vector<double>(
matrix_values.begin() + num_columns*index, matrix_values.begin() + num_columns*(index +1)));
}
const double timestep = 100.;
// compute 1 timestep
runner.run(simulationInOut, timestep);
for (std::size_t cell_index = 0; cell_index < simulationInOut.size(); ++cell_index) {
const bool is_first_half = cell_index < half_cells;
if (is_first_half) {
std::cout << "Grid element: " << cell_index << " \n";
for (std::size_t spec = 0; spec < num_columns; ++spec) {
std::cout << ":" << spec_names[spec] << "=" << simulationInOut[cell_index][spec];
}
std::cout << "\n";
std::cout << "Grid element: " << cell_index << " \n";
for (std::size_t spec = 0; spec < num_columns; ++spec) {
std::cout << ":" << spec_names[spec] << "=" << simulationInOut[cell_index][spec];
}
std::cout << "\n";
}