From 9b38cd2dc1638ffe91256c92d279770ef7f87602 Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Tue, 2 Apr 2024 20:24:11 +0000 Subject: [PATCH] Add check_sign_cal_dol_dht and fuzz_input_dht_keys functions --- bench/dolo/het/dolo_200.R | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/bench/dolo/het/dolo_200.R b/bench/dolo/het/dolo_200.R index 8d1ef2c4a..53aee210d 100644 --- a/bench/dolo/het/dolo_200.R +++ b/bench/dolo/het/dolo_200.R @@ -28,6 +28,31 @@ diffusion_setup <- list( alpha_y = 1e-6 ) +check_sign_cal_dol_dht <- function(old, new) { + if ((old["Calcite"] == 0) != (new["Calcite"] == 0)) { + return(TRUE) + } + if ((old["Dolomite"] == 0) != (new["Dolomite"] == 0)) { + return(TRUE) + } + return(FALSE) +} + +fuzz_input_dht_keys <- function(input) { + dht_species <- c( + "H" = 3, + "O" = 3, + "Charge" = 3, + "C(4)" = 6, + "Ca" = 6, + "Cl" = 3, + "Mg" = 5, + "Calcite" = 4, + "Dolomite" = 4 + ) + return(input[names(dht_species)]) +} + chemistry_setup <- list( dht_species = c( "H" = 3, @@ -39,6 +64,10 @@ chemistry_setup <- list( "Mg" = 5, "Calcite" = 4, "Dolomite" = 4 + ), + hooks = list( + dht_fill = check_sign_cal_dol_dht, + dht_fuzz = fuzz_input_dht_keys ) )