From bb7e684d8f4faa23dac9106473d7f1df78e12551 Mon Sep 17 00:00:00 2001 From: Marco De Lucia Date: Fri, 12 Jan 2024 12:50:54 +0100 Subject: [PATCH] fix: updated bench/barite/{barite.R, barite_interp_eval.R}, added bench/barite/barite_200.R --- bench/barite/barite.R | 68 ++++++++------- bench/barite/barite_200.R | 138 ++++++++++++++++++++++++++++++ bench/barite/barite_interp_eval.R | 87 ++++++++----------- 3 files changed, 209 insertions(+), 84 deletions(-) create mode 100644 bench/barite/barite_200.R diff --git a/bench/barite/barite.R b/bench/barite/barite.R index 0543ff39a..7d73de75b 100644 --- a/bench/barite/barite.R +++ b/bench/barite/barite.R @@ -1,5 +1,4 @@ -## Time-stamp: "Last modified 2023-08-02 13:59:22 mluebke" - +## Time-stamp: "Last modified 2024-01-12 12:39:14 delucia" database <- normalizePath("../share/poet/bench/barite/db_barite.dat") input_script <- normalizePath("../share/poet/bench/barite/barite.pqi") @@ -16,11 +15,11 @@ types <- c("scratch", "phreeqc", "rds") init_cell <- list( "H" = 110.0124, "O" = 55.5087, - "Charge" = -1.217E-09, - "Ba" = 1.E-10, - "Cl" = 2.E-10, - "S" = 6.205E-4, - "Sr" = 6.205E-4, + "Charge" = -1.216307845207e-09, + "Ba" = 1.E-12, + "Cl" = 2.E-12, + "S(6)" = 6.204727095976e-04, + "Sr" = 6.204727095976e-04, "Barite" = 0.001, "Celestite" = 1 ) @@ -28,7 +27,11 @@ init_cell <- list( grid <- list( n_cells = c(n, m), s_cells = c(1, 1), - type = types[1] + type = types[1], + init_cell = as.data.frame(init_cell, check.names = FALSE), + props = names(init_cell), + database = database, + input_script = input_script ) @@ -40,26 +43,20 @@ grid <- list( ## initial conditions init_diffu <- list( - #"H" = 110.0124, - "H" = 0.00000028904, - #"O" = 55.5087, - "O" = 0.000000165205, - #"Charge" = -1.217E-09, - "Charge" = -3.337E-08, - "Ba" = 1.E-10, - "Cl" = 1.E-10, - "S(6)" = 6.205E-4, - "Sr" = 6.205E-4 + "H" = 110.0124, + "O" = 55.5087, + "Charge" = -1.216307845207e-09, + "Ba" = 1.E-12, + "Cl" = 2.E-12, + "S(6)" = 6.204727095976e-04, + "Sr" = 6.204727095976e-04 ) injection_diff <- list( list( - #"H" = 111.0124, - "H" = 0.0000002890408, - #"O" = 55.50622, - "O" = 0.00002014464, - #"Charge" = -3.337E-08, - "Charge" = -3.337000004885E-08, + "H" = 111.0124, + "O" = 55.50622, + "Charge" = -3.336970273297e-08, "Ba" = 0.1, "Cl" = 0.2, "S(6)" = 0, @@ -84,11 +81,12 @@ alpha_diffu <- c( ## ) boundary <- list( - "N" = rep(1, n), + "N" = c(1,1, rep(0, n-2)), ## "N" = rep(0, n), "E" = rep(0, n), "S" = rep(0, n), - "W" = rep(0, n) +# "W" = rep(0, n) + "W" = c(1,1, rep(0, n-2)) ) diffu_list <- names(alpha_diffu) @@ -112,15 +110,19 @@ diffusion <- list( ## # Needed when using DHT dht_species <- c( - "H" = 10, - "O" = 10, - "Charge" = 3, - "Ba" = 5, - "Cl" = 5, - "S(6)" = 5, - "Sr" = 5 + "H" = 7, + "O" = 7, + "Charge" = 4, + "Ba" = 7, + "Cl" = 7, + "S(6)" = 7, + "Sr" = 7, + "Barite" = 4, + "Celestite" = 4 ) + + chemistry <- list( database = database, input_script = input_script, diff --git a/bench/barite/barite_200.R b/bench/barite/barite_200.R new file mode 100644 index 000000000..76526b00e --- /dev/null +++ b/bench/barite/barite_200.R @@ -0,0 +1,138 @@ +## Time-stamp: "Last modified 2024-01-12 12:49:03 delucia" + +database <- normalizePath("../share/poet/bench/barite/db_barite.dat") +input_script <- normalizePath("../share/poet/bench/barite/barite.pqi") +## database <- normalizePath("/home/work/simR/Rphree/poetsims/Sims/Hans/db_barite.dat") +## input_script <- normalizePath("/home/work/simR/Rphree/poetsims/Sims/Hans/barite.pqi") + +################################################################# +## Section 1 ## +## Grid initialization ## +################################################################# + +n <- 200 +m <- 200 + +init_cell <- list( + "H" = 110.0124, + "O" = 55.5087, + "Charge" = -1.216307845207e-09, + "Ba" = 1.E-12, + "Cl" = 2.E-12, + "S(6)" = 6.204727095976e-04, + "Sr" = 6.204727095976e-04, + "Barite" = 0.001, + "Celestite" = 1 +) + +grid <- list( + n_cells = c(n, m), + s_cells = c(1, 1), + type = "scratch", + init_cell = as.data.frame(init_cell, check.names = FALSE), + props = names(init_cell), + database = database, + input_script = input_script +) + + +################################################################## +## Section 2 ## +## Diffusion parameters and boundary conditions ## +################################################################## + +## initial conditions + +init_diffu <- list( + "H" = 110.0124, + "O" = 55.5087, + "Charge" = -1.216307845207e-09, + "Ba" = 1.E-12, + "Cl" = 2.E-12, + "S(6)" = 6.204727095976e-04, + "Sr" = 6.204727095976e-04 +) + +injection_diff <- list( + list( + "H" = 111.0124, + "O" = 55.50622, + "Charge" = -3.336970273297e-08, + "Ba" = 0.1, + "Cl" = 0.2, + "S(6)" = 0, + "Sr" = 0) +) + +## diffusion coefficients +alpha_diffu <- c( + "H" = 1E-06, + "O" = 1E-06, + "Charge" = 1E-06, + "Ba" = 1E-06, + "Cl" = 1E-06, + "S(6)" = 1E-06, + "Sr" = 1E-06 +) + +boundary <- list( + "N" = c(1,1, rep(0, n-2)), + "E" = rep(0, n), + "S" = rep(0, n), + "W" = c(1,1, rep(0, n-2)) +) + +diffu_list <- names(alpha_diffu) + +vecinj <- do.call(rbind.data.frame, injection_diff) +names(vecinj) <- names(init_diffu) + +diffusion <- list( + init = as.data.frame(init_diffu, check.names = FALSE), + vecinj = vecinj, + vecinj_index = boundary, + alpha = alpha_diffu +) + +################################################################# +## Section 3 ## +## Chemistry module (Phreeqc) ## +################################################################# + +## DHT significant digits +dht_species <- c( + "H" = 7, + "O" = 7, + "Charge" = 4, + "Ba" = 7, + "Cl" = 7, + "S(6)" = 7, + "Sr" = 7, + "Barite" = 4, + "Celestite" = 4 +) + +chemistry <- list( + database = database, + input_script = input_script, + dht_species = dht_species +) + +################################################################# +## Section 4 ## +## Putting all those things together ## +################################################################# + +iterations <- 50 +dt <- 100 + +setup <- list( + grid = grid, + diffusion = diffusion, + chemistry = chemistry, + iterations = iterations, + timesteps = rep(dt, iterations), + store_result = TRUE, + out_save = seq(1, iterations) + ## out_save = c(1, 5, 10, seq(50, iterations, by=50)) +) diff --git a/bench/barite/barite_interp_eval.R b/bench/barite/barite_interp_eval.R index fcbe4884b..6f2b79a34 100644 --- a/bench/barite/barite_interp_eval.R +++ b/bench/barite/barite_interp_eval.R @@ -1,4 +1,4 @@ -## Time-stamp: "Last modified 2023-07-21 15:04:49 mluebke" +## Time-stamp: "Last modified 2024-01-12 11:35:11 delucia" database <- normalizePath("../share/poet/bench/barite/db_barite.dat") input_script <- normalizePath("../share/poet/bench/barite/barite.pqi") @@ -16,18 +16,18 @@ types <- c("scratch", "phreeqc", "rds") init_cell <- list( "H" = 110.0124, "O" = 55.5087, - "Charge" = -1.217E-09, - "Ba" = 1.E-10, - "Cl" = 2.E-10, - "S" = 6.205E-4, - "Sr" = 6.205E-4, + "Charge" = -1.216307845207e-09, + "Ba" = 1.E-12, + "Cl" = 2.E-12, + "S(6)" = 6.204727095976e-04, + "Sr" = 6.204727095976e-04, "Barite" = 0.001, "Celestite" = 1 ) grid <- list( n_cells = c(n, m), - s_cells = c(n / 10, m / 10), + s_cells = c(1, 1), type = types[1], init_cell = as.data.frame(init_cell, check.names = FALSE), props = names(init_cell), @@ -44,56 +44,42 @@ grid <- list( ## initial conditions init_diffu <- list( - # "H" = 110.0124, - "H" = 0.00000028904, - # "O" = 55.5087, - "O" = 0.000000165205, - # "Charge" = -1.217E-09, - "Charge" = -3.337E-08, - "Ba" = 1.E-10, - "Cl" = 1.E-10, - "S(6)" = 6.205E-4, - "Sr" = 6.205E-4 + "H" = 110.0124, + "O" = 55.5087, + "Charge" = -1.216307845207e-09, + "Ba" = 1.E-12, + "Cl" = 2.E-12, + "S(6)" = 6.204727095976e-04, + "Sr" = 6.204727095976e-04 ) injection_diff <- list( - list( - # "H" = 111.0124, - "H" = 0.0000002890408, - # "O" = 55.50622, - "O" = 0.00002014464, - # "Charge" = -3.337E-08, - "Charge" = -3.337000004885E-08, - "Ba" = 0.1, - "Cl" = 0.2, - "S(6)" = 0, - "Sr" = 0 - ) + list( + "H" = 111.0124, + "O" = 55.50622, + "Charge" = -3.336970273297e-08, + "Ba" = 0.1, + "Cl" = 0.2, + "S(6)" = 0, + "Sr" = 0) ) ## diffusion coefficients alpha_diffu <- c( - "H" = 1E-06, - "O" = 1E-06, + "H" = 1E-06, + "O" = 1E-06, "Charge" = 1E-06, "Ba" = 1E-06, "Cl" = 1E-06, - "S(6)" = 1E-06, + "S(6)" = 1E-06, "Sr" = 1E-06 ) -vecinj_inner <- list( - l1 = c(1, floor(n / 2), floor(m / 2)) - ## l2 = c(2,80,80), - ## l3 = c(2,60,80) -) - boundary <- list( - # "N" = rep(1, n), - "N" = rep(0, n), + "N" = c(1,1, rep(0, n-2)), "E" = rep(0, n), "S" = rep(0, n), - "W" = rep(0, n) + "W" = c(1,1, rep(0, n-2)) ) diffu_list <- names(alpha_diffu) @@ -104,7 +90,6 @@ names(vecinj) <- names(init_diffu) diffusion <- list( init = as.data.frame(init_diffu, check.names = FALSE), vecinj = vecinj, - vecinj_inner = vecinj_inner, vecinj_index = boundary, alpha = alpha_diffu ) @@ -116,13 +101,15 @@ diffusion <- list( ## # Needed when using DHT dht_species <- c( - "H" = 10, - "O" = 10, - "Charge" = 3, - "Ba" = 5, - "Cl" = 5, - "S(6)" = 5, - "Sr" = 5 + "H" = 7, + "O" = 7, + "Charge" = 4, + "Ba" = 7, + "Cl" = 7, + "S(6)" = 7, + "Sr" = 7, + "Barite" = 4, + "Celestite" = 4 ) chemistry <- list( @@ -135,8 +122,6 @@ chemistry <- list( ## Section 4 ## ## Putting all those things together ## ################################################################# - - iterations <- 200 dt <- 250