water <- define_water(ph = 7, temp = 25, alk = 10)
# Dose 1 mg/L of hydrochloric acid
dosed_water <- chemdose_ph(water, hcl = 1)
dosed_water@ph
# Dose 1 mg/L of hydrochloric acid and 5 mg/L of alum simultaneously
dosed_water <- chemdose_ph(water, hcl = 1, alum = 5)
dosed_water@ph
# Dose 1 mg/L of hydrochloric acid and 5 mg/L of alum sequentially
dosed_water1 <- chemdose_ph(water, hcl = 1)
dosed_water1@ph
dosed_water2 <- chemdose_ph(dosed_water1, alum = 5)
dosed_water2@ph
# Softening:
water2 <- define_water(ph = 7, temp = 25, alk = 100, tot_hard = 350)
dosed_water1 <- chemdose_ph(water2, caco3 = -100)
dosed_water1@ph
dosed_water2 <- chemdose_ph(water2, caco3 = -100, softening_correction = TRUE)
dosed_water2@ph
library(dplyr)
example_df <- water_df %>%
slice_head(n = 3) %>%
define_water_chain() %>%
chemdose_ph_chain(input_water = "defined_water", naoh = 5)
example_df <- water_df %>%
slice_head(n = 3) %>%
define_water_chain() %>%
mutate(
hcl = c(2, 4, 6),
Caustic = 20
) %>%
chemdose_ph_chain(mgoh2 = c(20, 55), co2 = 4, naoh = Caustic)
# \donttest{
# Initialize parallel processing
library(furrr)
plan(multisession, workers = 2) # Remove the workers argument to use all available compute
example_df <- water_df %>%
define_water_chain() %>%
chemdose_ph_chain(naoh = 5)
# Optional: explicitly close multisession processing
plan(sequential)
# }
Run the code above in your browser using DataLab