Add check_sign_cal_dol_dht and fuzz_input_dht_keys functions

This commit is contained in:
Max Luebke 2024-04-02 20:24:11 +00:00
parent 04ce6d35d6
commit 246fbf4434

View File

@ -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
)
)