use "native" input as rounding without pH/pe calculation

This commit is contained in:
Max Lübke 2023-01-10 14:44:45 +01:00 committed by Max Luebke
parent dfdd890410
commit 3c6b1f5cfb
3 changed files with 11 additions and 11 deletions

View File

@ -6,8 +6,8 @@ input_script <- normalizePath("../data/dol.pqi")
## Grid initialization ##
#################################################################
n <- 5
m <- 5
n <- 100
m <- 100
types <- c("scratch", "phreeqc", "rds")
@ -168,8 +168,8 @@ selout <- c(
# Needed when using DHT
signif_vector <- c(7, 7, 7, 7, 7, 7, 7, 5, 5, 7)
prop_type <- c("act", "act", "act", "act", "logact", "logact", "ignore", "act", "act", "act")
signif_vector <- c(10, 10, 10, 7, 7, 7, 7, 0, 5, 5)
prop_type <- c("", "", "", "act", "act", "act", "act", "ignore", "", "")
prop <- names(init_cell)
chemistry <- list(

View File

@ -60,7 +60,7 @@ ChemWorker::ChemWorker(SimParams &params, RInside &R_, Grid &grid_,
if (this->dht_enabled) {
uint32_t iKeyCount = this->prop_names.size() - 1 + (dt_differ);
uint32_t iKeyCount = this->prop_names.size() + (dt_differ);
uint32_t iDataCount = this->prop_names.size();
if (world_rank == 1)
@ -173,10 +173,10 @@ void ChemWorker::doWork(MPI_Status &probe_status) {
std::vector<double> vecCurrWP(
mpi_buffer,
mpi_buffer + (local_work_package_size * this->prop_names.size()));
std::vector<double> vecDHTKeys = vecCurrWP;
std::vector<int32_t> vecMappingWP(this->wp_size);
std::vector<std::vector<double>> vecDHTResults;
std::vector<double> vecDHTKeys;
std::vector<bool> vecNeedPhreeqc(this->wp_size, true);
for (uint32_t i = 0; i < local_work_package_size; i++) {
@ -197,8 +197,8 @@ void ChemWorker::doWork(MPI_Status &probe_status) {
if (dht_enabled) {
/* check for values in DHT */
dht_get_start = MPI_Wtime();
vecDHTKeys = this->phreeqc_rm->ReplaceTotalsByPotentials(
vecCurrWP, local_work_package_size);
// vecDHTKeys = this->phreeqc_rm->ReplaceTotalsByPotentials(
// vecCurrWP, local_work_package_size);
vecDHTResults =
dht->checkDHT(local_work_package_size, vecNeedPhreeqc, vecDHTKeys, dt);
dht_get_end = MPI_Wtime();

View File

@ -81,7 +81,7 @@ auto DHT_Wrapper::checkDHT(int length, std::vector<bool> &out_result_index,
void *key;
int res;
// var count -> count of variables per grid cell
int var_count = dht_prop_type_vector.size() - 1;
int var_count = dht_prop_type_vector.size();
std::vector<std::vector<double>> data(length);
// loop over every grid cell contained in work package
for (int i = 0; i < length; i++) {
@ -124,13 +124,13 @@ void DHT_Wrapper::fillDHT(int length, const std::vector<bool> &result_index,
int var_count = dht_prop_type_vector.size();
// loop over every grid cell contained in work package
for (int i = 0; i < length; i++) {
key = (void *)&(work_package[i * (var_count - 1)]);
key = (void *)&(work_package[i * var_count]);
data = (void *)&(results[i * var_count]);
// If true grid cell was simulated, needs to be inserted into dht
if (result_index[i]) {
// fuzz data (round, logarithm etc.)
auto vecFuzz = fuzzForDHT(var_count - 1, key, dt);
auto vecFuzz = fuzzForDHT(var_count, key, dt);
// insert simulated data with fuzzed key into DHT
res = DHT_write(dht_object, vecFuzz.data(), data);