Merge branch 'control-loop' of git.gfz-potsdam.de:naaice/poet into control-loop

This commit is contained in:
rastogi 2025-10-02 13:21:57 +02:00
commit 104301dd5f
2 changed files with 14 additions and 2 deletions

View File

@ -60,6 +60,9 @@ pqc_to_grid <- function(pqc_mat, grid) {
# Convert the result matrix to a data frame # Convert the result matrix to a data frame
res_df <- as.data.frame(result_mat) res_df <- as.data.frame(result_mat)
# Add cell_ID column to beginning of res_df
res_df <- cbind(cell_ID = seq(0, nrow(res_df) - 1), res_df)
# Remove all columns which only contain NaN # Remove all columns which only contain NaN
# res_df <- res_df[, colSums(is.na(res_df)) != nrow(res_df)] # res_df <- res_df[, colSums(is.na(res_df)) != nrow(res_df)]

View File

@ -428,14 +428,23 @@ namespace poet
{ {
to_ignore.push_back(wp_id); to_ignore.push_back(wp_id);
} }
}
// HACK: remove the first element (cell_id) before sending to phreeqc
inout_chem[wp_id].erase(
inout_chem[wp_id].begin(), inout_chem[wp_id].begin() + 1);
}
this->pqc_runner->run(inout_chem, dTimestep, to_ignore); this->pqc_runner->run(inout_chem, dTimestep, to_ignore);
for (std::size_t wp_id = 0; wp_id < work_package.size; wp_id++) for (std::size_t wp_id = 0; wp_id < work_package.size; wp_id++)
{ {
if (work_package.mapping[wp_id] == CHEM_PQC) if (work_package.mapping[wp_id] == CHEM_PQC)
{ {
work_package.output[wp_id] = inout_chem[wp_id]; // HACK: as we removed the first element (cell_id) before sending to phreeqc,
// copy back with an offset of 1
work_package.output[wp_id] = work_package.input[wp_id];
std::copy(inout_chem[wp_id].begin(), inout_chem[wp_id].end(),
work_package.output[wp_id].begin() + 1);
} }
} }
} }