mirror of
https://git.gfz-potsdam.de/naaice/poet.git
synced 2025-12-13 11:28:24 +01:00
Refactor benchmark files to current POET input expectations
This commit is contained in:
parent
7febb31bf9
commit
a2f04836a4
@ -18,8 +18,9 @@ mpirun -np 4 ./poet --interp barite_interp_eval.R barite_results
|
||||
|
||||
* List of Files
|
||||
|
||||
- =barite.R=: POET input script for a 20x20 simulation grid
|
||||
- =barite_interp_eval.R=: POET input script for a 400x200 simulation
|
||||
- =barite_het.R=: POET input script with homogeneous zones for a 5x2 simulation
|
||||
grid
|
||||
- =barite_200.R=: POET input script for a 200x200 simulation
|
||||
grid
|
||||
- =db_barite.dat=: PHREEQC database containing the kinetic expressions
|
||||
for barite and celestite, stripped down from =phreeqc.dat=
|
||||
|
||||
@ -1,149 +0,0 @@
|
||||
## 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")
|
||||
|
||||
#################################################################
|
||||
## Section 1 ##
|
||||
## Grid initialization ##
|
||||
#################################################################
|
||||
|
||||
n <- 20
|
||||
m <- 20
|
||||
|
||||
types <- c("scratch", "phreeqc", "rds")
|
||||
|
||||
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 = types[1],
|
||||
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
|
||||
)
|
||||
|
||||
## vecinj_inner <- list(
|
||||
## l1 = c(1,20,20),
|
||||
## l2 = c(2,80,80),
|
||||
## l3 = c(2,60,80)
|
||||
## )
|
||||
|
||||
boundary <- list(
|
||||
"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" = 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_inner = vecinj_inner,
|
||||
vecinj_index = boundary,
|
||||
alpha = alpha_diffu
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 3 ##
|
||||
## Chemistry module (Phreeqc) ##
|
||||
#################################################################
|
||||
|
||||
|
||||
## # Needed when using DHT
|
||||
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 <- 4
|
||||
dt <- 100
|
||||
|
||||
setup <- list(
|
||||
grid = grid,
|
||||
diffusion = diffusion,
|
||||
chemistry = chemistry,
|
||||
iterations = iterations,
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE,
|
||||
out_save = seq(1, iterations)
|
||||
)
|
||||
@ -1,25 +1,32 @@
|
||||
SELECTED_OUTPUT
|
||||
-high_precision true
|
||||
-reset false
|
||||
-kinetic_reactants Barite Celestite
|
||||
-saturation_indices Barite Celestite
|
||||
SOLUTION 1
|
||||
units mol/kgw
|
||||
water 1
|
||||
temperature 25
|
||||
pH 7
|
||||
pe 10.799
|
||||
Ba 0.1
|
||||
Cl 0.2
|
||||
S 1e-9
|
||||
Sr 1e-9
|
||||
KINETICS 1
|
||||
Barite
|
||||
-m 0.001
|
||||
-parms 50. # reactive surface area
|
||||
-tol 1e-9
|
||||
Celestite
|
||||
-m 1
|
||||
-parms 10.0 # reactive surface area
|
||||
-tol 1e-9
|
||||
units mol/kgw
|
||||
water 1
|
||||
temperature 25
|
||||
pH 7
|
||||
PURE 1
|
||||
Celestite 0.0 1
|
||||
END
|
||||
|
||||
RUN_CELLS
|
||||
-cells 1
|
||||
|
||||
COPY solution 1 2
|
||||
|
||||
KINETICS 2
|
||||
Barite
|
||||
-m 0.001
|
||||
-parms 50. # reactive surface area
|
||||
-tol 1e-9
|
||||
Celestite
|
||||
-m 1
|
||||
-parms 10.0 # reactive surface area
|
||||
-tol 1e-9
|
||||
END
|
||||
|
||||
SOLUTION 3
|
||||
units mol/kgw
|
||||
water 1
|
||||
temperature 25
|
||||
Ba 0.1
|
||||
Cl 0.2
|
||||
END
|
||||
@ -1,105 +1,39 @@
|
||||
## Time-stamp: "Last modified 2024-01-12 12:49:03 delucia"
|
||||
cols <- 200
|
||||
rows <- 200
|
||||
|
||||
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")
|
||||
s_cols <- 1
|
||||
s_rows <- 1
|
||||
|
||||
#################################################################
|
||||
## Section 1 ##
|
||||
## Grid initialization ##
|
||||
#################################################################
|
||||
grid_def <- matrix(2, nrow = rows, ncol = cols)
|
||||
|
||||
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
|
||||
# Define grid configuration for POET model
|
||||
grid_setup <- list(
|
||||
pqc_in_file = "./barite.pqi",
|
||||
pqc_db_file = "./db_barite.dat", # Path to the database file for Phreeqc
|
||||
grid_def = grid_def, # Definition of the grid, containing IDs according to the Phreeqc input script
|
||||
grid_size = c(s_rows, s_cols), # Size of the grid in meters
|
||||
constant_cells = c() # IDs of cells with constant concentration
|
||||
)
|
||||
|
||||
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
|
||||
bound_length <- 2
|
||||
|
||||
bound_def <- list(
|
||||
"type" = rep("constant", bound_length),
|
||||
"sol_id" = rep(3, bound_length),
|
||||
"cell" = seq(1, bound_length)
|
||||
)
|
||||
|
||||
homogenous_alpha <- 1e-6
|
||||
|
||||
##################################################################
|
||||
## 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
|
||||
diffusion_setup <- list(
|
||||
boundaries = list(
|
||||
"W" = bound_def,
|
||||
"N" = bound_def
|
||||
),
|
||||
alpha_x = homogenous_alpha,
|
||||
alpha_y = homogenous_alpha
|
||||
)
|
||||
|
||||
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,
|
||||
@ -112,27 +46,13 @@ dht_species <- c(
|
||||
"Celestite" = 4
|
||||
)
|
||||
|
||||
chemistry <- list(
|
||||
database = database,
|
||||
input_script = input_script,
|
||||
dht_species = dht_species
|
||||
chemistry_setup <- list(
|
||||
dht_species = dht_species
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 4 ##
|
||||
## Putting all those things together ##
|
||||
#################################################################
|
||||
|
||||
iterations <- 50
|
||||
dt <- 100
|
||||
|
||||
# Define a setup list for simulation configuration
|
||||
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))
|
||||
Grid = grid_setup, # Parameters related to the grid structure
|
||||
Diffusion = diffusion_setup, # Parameters related to the diffusion process
|
||||
Chemistry = chemistry_setup
|
||||
)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
iterations <- 200
|
||||
dt <- 3600
|
||||
iterations <- 50
|
||||
dt <- 100
|
||||
|
||||
list(
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE
|
||||
)
|
||||
)
|
||||
@ -1,136 +0,0 @@
|
||||
## 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")
|
||||
|
||||
#################################################################
|
||||
## Section 1 ##
|
||||
## Grid initialization ##
|
||||
#################################################################
|
||||
|
||||
n <- 400
|
||||
m <- 200
|
||||
|
||||
types <- c("scratch", "phreeqc", "rds")
|
||||
|
||||
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 = types[1],
|
||||
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) ##
|
||||
#################################################################
|
||||
|
||||
## # Needed when using DHT
|
||||
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 <- 200
|
||||
dt <- 250
|
||||
|
||||
setup <- list(
|
||||
grid = grid,
|
||||
diffusion = diffusion,
|
||||
chemistry = chemistry,
|
||||
iterations = iterations,
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE,
|
||||
out_save = seq(1, iterations)
|
||||
)
|
||||
@ -18,16 +18,13 @@ mpirun -np 4 ./poet --dht --interp dolo_interp_long.R dolo_interp_long_res
|
||||
|
||||
* List of Files
|
||||
|
||||
- =dolo_diffu_inner.R=: POET input script for a 100x100 simulation
|
||||
grid
|
||||
- =dolo_interp_long.R=: POET input script for a 400x200 simulation
|
||||
- =dolo_interp.R=: POET input script for a 400x200 simulation
|
||||
grid
|
||||
- =dolo_diffu_inner_large.R=: POET input script for a 400x200
|
||||
simulation grid
|
||||
- =phreeqc_kin.dat=: PHREEQC database containing the kinetic expressions
|
||||
for dolomite and celestite, stripped down from =phreeqc.dat=
|
||||
- =dol.pqi=: PHREEQC input script for the chemical system
|
||||
# - =dolo.R=: POET input script for a 20x20 simulation grid
|
||||
# - =dolo_diffu_inner_large.R=: POET input script for a 400x200
|
||||
# simulation grid
|
||||
|
||||
* Chemical system
|
||||
|
||||
|
||||
@ -34,5 +34,10 @@ SOLUTION 3
|
||||
Cl 0.002
|
||||
END
|
||||
|
||||
RUN_CELLS
|
||||
-cells 2-3
|
||||
SOLUTION 4
|
||||
units mol/kgw
|
||||
water 1
|
||||
temp 25
|
||||
Mg 0.002
|
||||
Cl 0.002
|
||||
END
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
grid_def <- matrix(2, nrow = 10, ncol = 10)
|
||||
rows <- 2000
|
||||
cols <- 1000
|
||||
|
||||
grid_def <- matrix(2, nrow = rows, ncol = cols)
|
||||
|
||||
# Define grid configuration for POET model
|
||||
grid_setup <- list(
|
||||
pqc_in_file = "./dol.pqi",
|
||||
pqc_db_file = "./phreeqc_kin.dat", # Path to the database file for Phreeqc
|
||||
grid_def = grid_def, # Definition of the grid, containing IDs according to the Phreeqc input script
|
||||
grid_size = c(ncol(grid_def) / 10, nrow(grid_def) / 10), # Size of the grid in meters
|
||||
grid_size = c(rows, cols) / 100, # Size of the grid in meters
|
||||
constant_cells = c() # IDs of cells with constant concentration
|
||||
)
|
||||
|
||||
@ -13,9 +16,9 @@ bound_size <- 2
|
||||
|
||||
diffusion_setup <- list(
|
||||
inner_boundaries = list(
|
||||
"row" = c(1, 10),
|
||||
"col" = c(1, 10),
|
||||
"sol_id" = c(3, 3)
|
||||
"row" = c(200, 800, 800),
|
||||
"col" = c(400, 1400, 1600),
|
||||
"sol_id" = c(3, 4, 4)
|
||||
),
|
||||
alpha_x = 1e-6,
|
||||
alpha_y = 1e-6
|
||||
@ -1,8 +1,10 @@
|
||||
iterations <- 500
|
||||
dt <- 500
|
||||
dt <- 50
|
||||
|
||||
out_save <- seq(5, iterations, by = 5)
|
||||
|
||||
list(
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE,
|
||||
out_save = seq(50, iterations, by = 50)
|
||||
out_save = out_save
|
||||
)
|
||||
@ -1,28 +1,40 @@
|
||||
grid_def <- matrix(2, nrow = 200, ncol = 200)
|
||||
rows <- 400
|
||||
cols <- 200
|
||||
|
||||
grid_def <- matrix(2, nrow = rows, ncol = cols)
|
||||
|
||||
# Define grid configuration for POET model
|
||||
grid_setup <- list(
|
||||
pqc_in_file = "./dol.pqi",
|
||||
pqc_db_file = "./phreeqc_kin.dat", # Path to the database file for Phreeqc
|
||||
grid_def = grid_def, # Definition of the grid, containing IDs according to the Phreeqc input script
|
||||
grid_size = c(ncol(grid_def), nrow(grid_def)), # Size of the grid in meters
|
||||
grid_size = c(5, 2.5), # Size of the grid in meters
|
||||
constant_cells = c() # IDs of cells with constant concentration
|
||||
)
|
||||
|
||||
bound_size <- 2
|
||||
bound_def_we <- list(
|
||||
"type" = rep("constant", rows),
|
||||
"sol_id" = rep(1, rows),
|
||||
"cell" = seq(1, rows)
|
||||
)
|
||||
|
||||
bound_def_ns <- list(
|
||||
"type" = rep("constant", cols),
|
||||
"sol_id" = rep(1, cols),
|
||||
"cell" = seq(1, cols)
|
||||
)
|
||||
|
||||
diffusion_setup <- list(
|
||||
boundaries = list(
|
||||
"W" = list(
|
||||
"type" = rep("constant", bound_size),
|
||||
"sol_id" = rep(3, bound_size),
|
||||
"cell" = seq(1, bound_size)
|
||||
),
|
||||
"N" = list(
|
||||
"type" = rep("constant", bound_size),
|
||||
"sol_id" = rep(3, bound_size),
|
||||
"cell" = seq(1, bound_size)
|
||||
)
|
||||
"W" = bound_def_we,
|
||||
"E" = bound_def_we,
|
||||
"N" = bound_def_ns,
|
||||
"S" = bound_def_ns
|
||||
),
|
||||
inner_boundaries = list(
|
||||
"row" = floor(rows / 2),
|
||||
"col" = floor(cols / 2),
|
||||
"sol_id" = c(3)
|
||||
),
|
||||
alpha_x = 1e-6,
|
||||
alpha_y = 1e-6
|
||||
10
bench/dolo/dolo_interp_rt.R
Normal file
10
bench/dolo/dolo_interp_rt.R
Normal file
@ -0,0 +1,10 @@
|
||||
iterations <- 20000
|
||||
dt <- 200
|
||||
|
||||
out_save <- seq(50, iterations, by = 50)
|
||||
|
||||
list(
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE,
|
||||
out_save = out_save
|
||||
)
|
||||
@ -1,51 +0,0 @@
|
||||
## Time-stamp: "Last modified 2022-12-16 20:26:03 delucia"
|
||||
|
||||
source("../../../util/data_evaluation/RFun_Eval.R")
|
||||
|
||||
sd <- ReadRTSims("naaice_2d")
|
||||
|
||||
sd <- ReadRTSims("Sim2D")
|
||||
|
||||
|
||||
sd <- ReadRTSims("inner")
|
||||
|
||||
tim <- readRDS("inner/timings.rds")
|
||||
|
||||
|
||||
simtimes <- sapply(sd, "[","simtime")
|
||||
|
||||
## workhorse function to be used with package "animation"
|
||||
PlotAn <- function(tot, prop, grid, breaks) {
|
||||
for (step in seq(1, length(tot))) {
|
||||
snap <- tot[[step]]$C
|
||||
time <- tot[[step]]$simtime/3600/24
|
||||
ind <- match(prop, colnames(snap))
|
||||
Plot2DCellData(snap[,ind], grid=grid, contour=FALSE, breaks=breaks, nlevels=length(breaks), scale=TRUE, main=paste0(prop," after ", time, "days"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
options(width=110)
|
||||
library(viridis)
|
||||
|
||||
Plot2DCellData(sd$iter_050$C$Cl, nx=1/100, ny=1/100, contour = TRUE,
|
||||
nlevels = 12, palette = "heat.colors",
|
||||
rev.palette = TRUE, scale = TRUE, main="Cl")
|
||||
|
||||
Plot2DCellData(sd$iter_050$C$Dolomite, nx=100, ny=100, contour = FALSE,
|
||||
nlevels = 12, palette = "heat.colors",
|
||||
rev.palette = TRUE, scale = TRUE, )
|
||||
|
||||
cairo_pdf("naaice_inner_Dolo.pdf", width=8, height = 6, family="serif")
|
||||
Plot2DCellData(sd$iter_100$C$Dolomite, nx=100, ny=100, contour = FALSE,
|
||||
nlevels = 12, palette = "viridis",
|
||||
rev.palette = TRUE, scale = TRUE, plot.axes = FALSE,
|
||||
main="2D Diffusion - Dolomite after 2E+4 s (100 iterations)")
|
||||
dev.off()
|
||||
|
||||
cairo_pdf("naaice_inner_Mg.pdf", width=8, height = 6, family="serif")
|
||||
Plot2DCellData(sd$iter_100$C$Mg, nx=100, ny=100, contour = FALSE,
|
||||
nlevels = 12, palette = "terrain.colors",
|
||||
rev.palette = TRUE, scale = TRUE, plot.axes=FALSE,
|
||||
main="2D Diffusion - Mg after 2E+4 s (100 iterations)")
|
||||
dev.off()
|
||||
@ -1,35 +0,0 @@
|
||||
SELECTED_OUTPUT
|
||||
-high_precision true
|
||||
-reset false
|
||||
-time
|
||||
-soln
|
||||
-temperature true
|
||||
-water true
|
||||
-pH
|
||||
-pe
|
||||
-totals C Ca Cl Mg
|
||||
-kinetic_reactants Calcite Dolomite
|
||||
-equilibrium O2g
|
||||
|
||||
SOLUTION 1
|
||||
units mol/kgw
|
||||
temp 25.0
|
||||
water 1
|
||||
pH 9.91 charge
|
||||
pe 4.0
|
||||
C 1.2279E-04
|
||||
Ca 1.2279E-04
|
||||
Cl 1E-12
|
||||
Mg 1E-12
|
||||
PURE 1
|
||||
O2g -0.1675 10
|
||||
KINETICS 1
|
||||
Calcite
|
||||
-m 0.000207
|
||||
-parms 0.0032
|
||||
-tol 1e-10
|
||||
Dolomite
|
||||
-m 0.0
|
||||
-parms 0.00032
|
||||
-tol 1e-10
|
||||
END
|
||||
@ -1,190 +0,0 @@
|
||||
## Time-stamp: "Last modified 2023-08-16 17:04:42 mluebke"
|
||||
|
||||
database <- normalizePath("../share/poet/bench/dolo/phreeqc_kin.dat")
|
||||
input_script <- normalizePath("../share/poet/bench/dolo/dolo_inner.pqi")
|
||||
|
||||
#################################################################
|
||||
## Section 1 ##
|
||||
## Grid initialization ##
|
||||
#################################################################
|
||||
|
||||
n <- 100
|
||||
m <- 100
|
||||
|
||||
types <- c("scratch", "phreeqc", "rds")
|
||||
|
||||
init_cell <- list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = -5.0822e-19,
|
||||
"C(4)" = 1.2279E-4,
|
||||
"Ca" = 1.2279E-4,
|
||||
"Cl" = 0,
|
||||
"Mg" = 0,
|
||||
"O2g" = 0.499957,
|
||||
"Calcite" = 2.07e-4,
|
||||
"Dolomite" = 0
|
||||
)
|
||||
|
||||
grid <- list(
|
||||
n_cells = c(n, m),
|
||||
s_cells = c(1, 1),
|
||||
type = types[1]
|
||||
)
|
||||
|
||||
|
||||
##################################################################
|
||||
## Section 2 ##
|
||||
## Diffusion parameters and boundary conditions ##
|
||||
##################################################################
|
||||
|
||||
## initial conditions
|
||||
init_diffu <- list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = -5.0822e-19,
|
||||
"C(4)" = 1.2279E-4,
|
||||
"Ca" = 1.2279E-4,
|
||||
"Cl" = 0,
|
||||
"Mg" = 0
|
||||
)
|
||||
|
||||
## diffusion coefficients
|
||||
alpha_diffu <- c(
|
||||
"H" = 1E-6,
|
||||
"O" = 1E-6,
|
||||
"Charge" = 1E-6,
|
||||
"C(4)" = 1E-6,
|
||||
"Ca" = 1E-6,
|
||||
"Cl" = 1E-6,
|
||||
"Mg" = 1E-6
|
||||
)
|
||||
|
||||
## list of boundary conditions/inner nodes
|
||||
vecinj_diffu <- list(
|
||||
list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = 1.90431e-16,
|
||||
"C(4)" = 0,
|
||||
"Ca" = 0,
|
||||
"Cl" = 0.002,
|
||||
"Mg" = 0.001
|
||||
),
|
||||
list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = 1.90431e-16,
|
||||
"C(4)" = 0,
|
||||
"Ca" = 0.0,
|
||||
"Cl" = 0.004,
|
||||
"Mg" = 0.002
|
||||
)
|
||||
)
|
||||
|
||||
vecinj_inner <- list(
|
||||
l1 = c(1, 20, 20),
|
||||
l2 = c(2, 80, 80),
|
||||
l3 = c(2, 60, 80)
|
||||
)
|
||||
|
||||
boundary <- list(
|
||||
# "N" = c(1, rep(0, n-1)),
|
||||
"N" = rep(0, n),
|
||||
"E" = rep(0, n),
|
||||
"S" = rep(0, n),
|
||||
"W" = rep(0, n)
|
||||
)
|
||||
|
||||
diffu_list <- names(alpha_diffu)
|
||||
|
||||
vecinj <- do.call(rbind.data.frame, vecinj_diffu)
|
||||
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
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 3 ##
|
||||
## Chemistry module (Phreeqc) ##
|
||||
#################################################################
|
||||
|
||||
|
||||
## # Needed when using DHT
|
||||
dht_species <- c(
|
||||
"H" = 10,
|
||||
"O" = 10,
|
||||
"Charge" = 3,
|
||||
"C(4)" = 5,
|
||||
"Ca" = 5,
|
||||
"Cl" = 5,
|
||||
"Mg" = 5,
|
||||
"Calcite" = 5,
|
||||
"Dolomite" = 5
|
||||
)
|
||||
|
||||
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) {
|
||||
return(input[names(dht_species)])
|
||||
}
|
||||
|
||||
check_sign_cal_dol_interp <- function(to_interp, data_set) {
|
||||
data_set <- as.data.frame(do.call(rbind, data_set), check.names = FALSE, optional = TRUE)
|
||||
names(data_set) <- names(dht_species)
|
||||
cal <- (data_set$Calcite == 0) == (to_interp["Calcite"] == 0)
|
||||
dol <- (data_set$Dolomite == 0) == (to_interp["Dolomite"] == 0)
|
||||
|
||||
cal_dol_same_sig <- cal == dol
|
||||
return(rev(which(!cal_dol_same_sig)))
|
||||
}
|
||||
|
||||
check_neg_cal_dol <- function(result) {
|
||||
neg_sign <- (result["Calcite"] <- 0) || (result["Dolomite"] < 0)
|
||||
return(any(neg_sign))
|
||||
}
|
||||
|
||||
hooks <- list(
|
||||
dht_fill = check_sign_cal_dol_dht,
|
||||
dht_fuzz = fuzz_input_dht_keys,
|
||||
interp_pre_func = check_sign_cal_dol_interp,
|
||||
interp_post_func = check_neg_cal_dol
|
||||
)
|
||||
|
||||
chemistry <- list(
|
||||
database = database,
|
||||
input_script = input_script,
|
||||
dht_species = dht_species,
|
||||
hooks = hooks
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 4 ##
|
||||
## Putting all those things together ##
|
||||
#################################################################
|
||||
|
||||
|
||||
iterations <- 10
|
||||
dt <- 200
|
||||
|
||||
setup <- list(
|
||||
grid = grid,
|
||||
diffusion = diffusion,
|
||||
chemistry = chemistry,
|
||||
iterations = iterations,
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE
|
||||
)
|
||||
@ -1,190 +0,0 @@
|
||||
## Time-stamp: "Last modified 2023-08-16 17:05:04 mluebke"
|
||||
|
||||
database <- normalizePath("../share/poet/bench/dolo/phreeqc_kin.dat")
|
||||
input_script <- normalizePath("../share/poet/bench/dolo/dolo_inner.pqi")
|
||||
|
||||
#################################################################
|
||||
## Section 1 ##
|
||||
## Grid initialization ##
|
||||
#################################################################
|
||||
|
||||
n <- 2000
|
||||
m <- 1000
|
||||
|
||||
types <- c("scratch", "phreeqc", "rds")
|
||||
|
||||
init_cell <- list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = -5.0822e-19,
|
||||
"C" = 1.2279E-4,
|
||||
"Ca" = 1.2279E-4,
|
||||
"Cl" = 0,
|
||||
"Mg" = 0,
|
||||
"O2g" = 0.499957,
|
||||
"Calcite" = 2.07e-4,
|
||||
"Dolomite" = 0
|
||||
)
|
||||
|
||||
grid <- list(
|
||||
n_cells = c(n, m),
|
||||
s_cells = c(20, 10),
|
||||
type = types[1]
|
||||
)
|
||||
|
||||
|
||||
##################################################################
|
||||
## Section 2 ##
|
||||
## Diffusion parameters and boundary conditions ##
|
||||
##################################################################
|
||||
|
||||
## initial conditions
|
||||
init_diffu <- list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = -5.0822e-19,
|
||||
"C(4)" = 1.2279E-4,
|
||||
"Ca" = 1.2279E-4,
|
||||
"Cl" = 0,
|
||||
"Mg" = 0
|
||||
)
|
||||
|
||||
## diffusion coefficients
|
||||
alpha_diffu <- c(
|
||||
"H" = 1E-6,
|
||||
"O" = 1E-6,
|
||||
"Charge" = 1E-6,
|
||||
"C(4)" = 1E-6,
|
||||
"Ca" = 1E-6,
|
||||
"Cl" = 1E-6,
|
||||
"Mg" = 1E-6
|
||||
)
|
||||
|
||||
## list of boundary conditions/inner nodes
|
||||
vecinj_diffu <- list(
|
||||
list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = 1.90431e-16,
|
||||
"C(4)" = 0,
|
||||
"Ca" = 0,
|
||||
"Cl" = 0.002,
|
||||
"Mg" = 0.001
|
||||
),
|
||||
list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = 1.90431e-16,
|
||||
"C(4)" = 0,
|
||||
"Ca" = 0.0,
|
||||
"Cl" = 0.004,
|
||||
"Mg" = 0.002
|
||||
)
|
||||
)
|
||||
|
||||
vecinj_inner <- list(
|
||||
l1 = c(1, 400, 200),
|
||||
l2 = c(2, 1400, 800),
|
||||
l3 = c(2, 1600, 800)
|
||||
)
|
||||
|
||||
boundary <- list(
|
||||
# "N" = c(1, rep(0, n-1)),
|
||||
"N" = rep(0, n),
|
||||
"E" = rep(0, m),
|
||||
"S" = rep(0, n),
|
||||
"W" = rep(0, m)
|
||||
)
|
||||
|
||||
diffu_list <- names(alpha_diffu)
|
||||
|
||||
vecinj <- do.call(rbind.data.frame, vecinj_diffu)
|
||||
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
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 3 ##
|
||||
## Chemistry module (Phreeqc) ##
|
||||
#################################################################
|
||||
|
||||
## # Needed when using DHT
|
||||
dht_species <- c(
|
||||
"H" = 10,
|
||||
"O" = 10,
|
||||
"Charge" = 3,
|
||||
"C(4)" = 5,
|
||||
"Ca" = 5,
|
||||
"Cl" = 5,
|
||||
"Mg" = 5,
|
||||
"Calcite" = 5,
|
||||
"Dolomite" = 5
|
||||
)
|
||||
|
||||
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) {
|
||||
return(input[names(dht_species)])
|
||||
}
|
||||
|
||||
check_sign_cal_dol_interp <- function(to_interp, data_set) {
|
||||
data_set <- as.data.frame(do.call(rbind, data_set), check.names = FALSE, optional = TRUE)
|
||||
names(data_set) <- names(dht_species)
|
||||
cal <- (data_set$Calcite == 0) == (to_interp["Calcite"] == 0)
|
||||
dol <- (data_set$Dolomite == 0) == (to_interp["Dolomite"] == 0)
|
||||
|
||||
cal_dol_same_sig <- cal == dol
|
||||
return(rev(which(!cal_dol_same_sig)))
|
||||
}
|
||||
|
||||
check_neg_cal_dol <- function(result) {
|
||||
neg_sign <- (result["Calcite"] <- 0) || (result["Dolomite"] < 0)
|
||||
return(any(neg_sign))
|
||||
}
|
||||
|
||||
hooks <- list(
|
||||
dht_fill = check_sign_cal_dol_dht,
|
||||
dht_fuzz = fuzz_input_dht_keys,
|
||||
interp_pre_func = check_sign_cal_dol_interp,
|
||||
interp_post_func = check_neg_cal_dol
|
||||
)
|
||||
|
||||
chemistry <- list(
|
||||
database = database,
|
||||
input_script = input_script,
|
||||
dht_species = dht_species,
|
||||
hooks = hooks
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 4 ##
|
||||
## Putting all those things together ##
|
||||
#################################################################
|
||||
|
||||
|
||||
iterations <- 500
|
||||
dt <- 50
|
||||
|
||||
setup <- list(
|
||||
grid = grid,
|
||||
diffusion = diffusion,
|
||||
chemistry = chemistry,
|
||||
iterations = iterations,
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE,
|
||||
out_save = seq(5, iterations, by = 5)
|
||||
)
|
||||
@ -1,28 +0,0 @@
|
||||
SELECTED_OUTPUT
|
||||
-high_precision true
|
||||
-reset false
|
||||
-kinetic_reactants Calcite Dolomite
|
||||
-equilibrium O2g
|
||||
|
||||
SOLUTION 1
|
||||
units mol/kgw
|
||||
temp 25.0
|
||||
water 1
|
||||
pH 9.91 charge
|
||||
pe 4.0
|
||||
C 1.2279E-04
|
||||
Ca 1.2279E-04
|
||||
Cl 1E-12
|
||||
Mg 1E-12
|
||||
PURE 1
|
||||
O2g -0.1675 10
|
||||
KINETICS 1
|
||||
Calcite
|
||||
-m 0.00020
|
||||
-parms 0.05
|
||||
-tol 1e-10
|
||||
Dolomite
|
||||
-m 0.0
|
||||
-parms 0.005
|
||||
-tol 1e-10
|
||||
END
|
||||
@ -1,204 +0,0 @@
|
||||
## Time-stamp: "Last modified 2023-08-16 14:57:25 mluebke"
|
||||
|
||||
database <- normalizePath("../share/poet/bench/dolo/phreeqc_kin.dat")
|
||||
input_script <- normalizePath("../share/poet/bench/dolo/dolo_inner.pqi")
|
||||
|
||||
#################################################################
|
||||
## Section 1 ##
|
||||
## Grid initialization ##
|
||||
#################################################################
|
||||
|
||||
n <- 400
|
||||
m <- 200
|
||||
|
||||
types <- c("scratch", "phreeqc", "rds")
|
||||
|
||||
init_cell <- list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = -5.0822e-19,
|
||||
"C" = 1.2279E-4,
|
||||
"Ca" = 1.2279E-4,
|
||||
"Cl" = 0,
|
||||
"Mg" = 0,
|
||||
"O2g" = 0.499957,
|
||||
"Calcite" = 2.07e-4,
|
||||
"Dolomite" = 0
|
||||
)
|
||||
|
||||
grid <- list(
|
||||
n_cells = c(n, m),
|
||||
s_cells = c(5, 2.5),
|
||||
type = types[1]
|
||||
)
|
||||
|
||||
|
||||
##################################################################
|
||||
## Section 2 ##
|
||||
## Diffusion parameters and boundary conditions ##
|
||||
##################################################################
|
||||
|
||||
## initial conditions
|
||||
init_diffu <- list(
|
||||
"H" = 1.110124E+02,
|
||||
"O" = 5.550833E+01,
|
||||
"Charge" = -1.216307659761E-09,
|
||||
"C(4)" = 1.230067028174E-04,
|
||||
"Ca" = 1.230067028174E-04,
|
||||
"Cl" = 0,
|
||||
"Mg" = 0
|
||||
)
|
||||
|
||||
## diffusion coefficients
|
||||
alpha_diffu <- c(
|
||||
"H" = 1E-6,
|
||||
"O" = 1E-6,
|
||||
"Charge" = 1E-6,
|
||||
"C(4)" = 1E-6,
|
||||
"Ca" = 1E-6,
|
||||
"Cl" = 1E-6,
|
||||
"Mg" = 1E-6
|
||||
)
|
||||
|
||||
## list of boundary conditions/inner nodes
|
||||
vecinj_diffu <- list(
|
||||
list(
|
||||
"H" = 1.110124E+02,
|
||||
"O" = 5.550796E+01,
|
||||
"Charge" = -3.230390327801E-08,
|
||||
"C(4)" = 0,
|
||||
"Ca" = 0,
|
||||
"Cl" = 0.002,
|
||||
"Mg" = 0.001
|
||||
),
|
||||
list(
|
||||
"H" = 110.683,
|
||||
"O" = 55.3413,
|
||||
"Charge" = 1.90431e-16,
|
||||
"C(4)" = 0,
|
||||
"Ca" = 0.0,
|
||||
"Cl" = 0.004,
|
||||
"Mg" = 0.002
|
||||
),
|
||||
init_diffu
|
||||
)
|
||||
|
||||
vecinj_inner <- list(
|
||||
l1 = c(1, floor(n / 2), floor(m / 2))
|
||||
# l2 = c(2,1400,800),
|
||||
# l3 = c(2,1600,800)
|
||||
)
|
||||
|
||||
boundary <- list(
|
||||
# "N" = c(1, rep(0, n-1)),
|
||||
"N" = rep(3, n),
|
||||
"E" = rep(3, m),
|
||||
"S" = rep(3, n),
|
||||
"W" = rep(3, m)
|
||||
)
|
||||
|
||||
diffu_list <- names(alpha_diffu)
|
||||
|
||||
vecinj <- do.call(rbind.data.frame, vecinj_diffu)
|
||||
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
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 3 ##
|
||||
## Chemistry module (Phreeqc) ##
|
||||
#################################################################
|
||||
|
||||
|
||||
## # optional when using DHT
|
||||
dht_species <- c(
|
||||
"H" = 3,
|
||||
"O" = 3,
|
||||
"Charge" = 3,
|
||||
"C(4)" = 6,
|
||||
"Ca" = 6,
|
||||
"Cl" = 3,
|
||||
"Mg" = 5,
|
||||
"Calcite" = 4,
|
||||
"Dolomite" = 4
|
||||
)
|
||||
|
||||
## # Optional when using Interpolation (example with less key species and custom
|
||||
## # significant digits)
|
||||
|
||||
# pht_species <- c(
|
||||
# "C(4)" = 3,
|
||||
# "Ca" = 3,
|
||||
# "Mg" = 2,
|
||||
# "Calcite" = 2,
|
||||
# "Dolomite" = 2
|
||||
# )
|
||||
|
||||
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) {
|
||||
return(input[names(dht_species)])
|
||||
}
|
||||
|
||||
check_sign_cal_dol_interp <- function(to_interp, data_set) {
|
||||
data_set <- as.data.frame(do.call(rbind, data_set), check.names = FALSE, optional = TRUE)
|
||||
names(data_set) <- names(dht_species)
|
||||
cal <- (data_set$Calcite == 0) == (to_interp["Calcite"] == 0)
|
||||
dol <- (data_set$Dolomite == 0) == (to_interp["Dolomite"] == 0)
|
||||
|
||||
cal_dol_same_sig <- cal == dol
|
||||
return(rev(which(!cal_dol_same_sig)))
|
||||
}
|
||||
|
||||
check_neg_cal_dol <- function(result) {
|
||||
neg_sign <- (result["Calcite"] < 0) || (result["Dolomite"] < 0)
|
||||
return(neg_sign)
|
||||
}
|
||||
|
||||
hooks <- list(
|
||||
dht_fill = check_sign_cal_dol_dht,
|
||||
dht_fuzz = fuzz_input_dht_keys,
|
||||
interp_pre_func = check_sign_cal_dol_interp,
|
||||
interp_post_func = check_neg_cal_dol
|
||||
)
|
||||
|
||||
chemistry <- list(
|
||||
database = database,
|
||||
input_script = input_script,
|
||||
dht_species = dht_species,
|
||||
hooks = hooks
|
||||
# pht_species = pht_species
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 4 ##
|
||||
## Putting all those things together ##
|
||||
#################################################################
|
||||
|
||||
|
||||
iterations <- 20000
|
||||
dt <- 200
|
||||
|
||||
setup <- list(
|
||||
grid = grid,
|
||||
diffusion = diffusion,
|
||||
chemistry = chemistry,
|
||||
iterations = iterations,
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE,
|
||||
out_save = c(1, seq(50, iterations, by = 50))
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@ -37,3 +37,27 @@ EXCHANGE 1
|
||||
Z 0.0012585
|
||||
Y 0.0009418
|
||||
END
|
||||
|
||||
SOLUTION 2
|
||||
temp 13
|
||||
units mol/kgw
|
||||
|
||||
C(-4) 2.92438561098248e-21
|
||||
C(4) 2.65160558871092e-06
|
||||
Ca 2.89001071336443e-05
|
||||
Cl 0.000429291158114428
|
||||
Fe(2) 1.90823391198114e-07
|
||||
Fe(3) 3.10832423034763e-12
|
||||
H(0) 2.7888235127385e-15
|
||||
K 2.5301787e-06
|
||||
Mg 2.31391999937907e-05
|
||||
Na 0.00036746969
|
||||
S(-2) 1.01376078438546e-14
|
||||
S(2) 1.42247026981542e-19
|
||||
S(4) 9.49422092568557e-18
|
||||
S(6) 2.19812504654191e-05
|
||||
Sr 6.01218519999999e-07
|
||||
U(4) 4.82255946569383e-12
|
||||
U(5) 5.49050615347901e-13
|
||||
U(6) 1.32462838991902e-09
|
||||
END
|
||||
|
||||
@ -20,7 +20,7 @@ mpirun -np 4 ./poet surfex.R surfex_res
|
||||
- =ex.R=: POET input script for a 100x100 simulation grid, only
|
||||
exchange
|
||||
- =ExBase.pqi=: PHREEQC input script for the =ex.R= model
|
||||
- =surfex.R=: POET input script for a 100x100 simulation grid
|
||||
- =surfex.R=: POET input script for a 1000x1000 simulation grid
|
||||
considering both cation exchange and surface complexation
|
||||
- =SurfExBase.pqi=: PHREEQC input script for the =surfex.R= model
|
||||
- =SMILE_2021_11_01_TH.dat=: PHREEQC database containing the
|
||||
|
||||
@ -54,3 +54,27 @@ EXCHANGE 1
|
||||
Z 0.0012585
|
||||
Y 0.0009418
|
||||
END
|
||||
|
||||
SOLUTION 2
|
||||
temp 13
|
||||
units mol/kgw
|
||||
|
||||
C(-4) 2.92438561098248e-21
|
||||
C(4) 2.65160558871092e-06
|
||||
Ca 2.89001071336443e-05
|
||||
Cl 0.000429291158114428
|
||||
Fe(2) 1.90823391198114e-07
|
||||
Fe(3) 3.10832423034763e-12
|
||||
H(0) 2.7888235127385e-15
|
||||
K 2.5301787e-06
|
||||
Mg 2.31391999937907e-05
|
||||
Na 0.00036746969
|
||||
S(-2) 1.01376078438546e-14
|
||||
S(2) 1.42247026981542e-19
|
||||
S(4) 9.49422092568557e-18
|
||||
S(6) 2.19812504654191e-05
|
||||
Sr 6.01218519999999e-07
|
||||
U(4) 4.82255946569383e-12
|
||||
U(5) 5.49050615347901e-13
|
||||
U(6) 1.32462838991902e-09
|
||||
END
|
||||
@ -1,140 +1,37 @@
|
||||
## Time-stamp: "Last modified 2023-08-02 13:59:35 mluebke"
|
||||
rows <- 100
|
||||
cols <- 100
|
||||
|
||||
database <- normalizePath("./SMILE_2021_11_01_TH.dat")
|
||||
input_script <- normalizePath("./ExBase.pqi")
|
||||
grid_def <- matrix(1, nrow = rows, ncol = cols)
|
||||
|
||||
cat(paste(":: R This is a test 1\n"))
|
||||
# Define grid configuration for POET model
|
||||
grid_setup <- list(
|
||||
pqc_in_file = "./SurfExBase.pqi",
|
||||
pqc_db_file = "./SMILE_2021_11_01_TH.dat", # Path to the database file for Phreeqc
|
||||
grid_def = grid_def, # Definition of the grid, containing IDs according to the Phreeqc input script
|
||||
grid_size = c(1, 1), # Size of the grid in meters
|
||||
constant_cells = c() # IDs of cells with constant concentration
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 1 ##
|
||||
## Grid initialization ##
|
||||
#################################################################
|
||||
bound_def <- list(
|
||||
"type" = rep("constant", cols),
|
||||
"sol_id" = rep(2, cols),
|
||||
"cell" = seq(1, cols)
|
||||
)
|
||||
|
||||
n <- 100
|
||||
m <- 100
|
||||
|
||||
types <- c("scratch", "phreeqc", "rds")
|
||||
|
||||
init_cell <- list(H = 1.476571028625e-01,
|
||||
O = 7.392297218936e-02,
|
||||
Charge = -1.765225732724e-18,
|
||||
`C(-4)` = 2.477908970828e-21,
|
||||
`C(4)` = 2.647623016916e-06,
|
||||
Ca = 2.889623169138e-05,
|
||||
Cl = 4.292806181039e-04,
|
||||
`Fe(2)` =1.908142472666e-07,
|
||||
`Fe(3)` =3.173306589931e-12,
|
||||
`H(0)` =2.675642675119e-15,
|
||||
K = 2.530134809667e-06,
|
||||
Mg =2.313806319294e-05,
|
||||
Na =3.674633059628e-04,
|
||||
`S(-2)` = 8.589766637180e-15,
|
||||
`S(2)` = 1.205284362720e-19,
|
||||
`S(4)` = 9.108958772790e-18,
|
||||
`S(6)` = 2.198092329098e-05,
|
||||
Sr = 6.012080128154e-07,
|
||||
`U(4)` = 1.039668623852e-14,
|
||||
`U(5)` = 1.208394829796e-15,
|
||||
`U(6)` = 2.976409147150e-12)
|
||||
|
||||
grid <- list(
|
||||
n_cells = c(n, m),
|
||||
s_cells = c(1, 1),
|
||||
type = "scratch"
|
||||
diffusion_setup <- list(
|
||||
boundaries = list(
|
||||
"N" = bound_def
|
||||
),
|
||||
alpha_x = 1e-6,
|
||||
alpha_y = 1e-6
|
||||
)
|
||||
|
||||
|
||||
##################################################################
|
||||
## Section 2 ##
|
||||
## Diffusion parameters and boundary conditions ##
|
||||
##################################################################
|
||||
|
||||
vecinj_diffu <- list(
|
||||
list(H = 0.147659686316291,
|
||||
O = 0.0739242798146046,
|
||||
Charge = 7.46361643222701e-20,
|
||||
`C(-4)` = 2.92438561098248e-21,
|
||||
`C(4)` = 2.65160558871092e-06,
|
||||
Ca = 2.89001071336443e-05,
|
||||
Cl = 0.000429291158114428,
|
||||
`Fe(2)` = 1.90823391198114e-07,
|
||||
`Fe(3)` = 3.10832423034763e-12,
|
||||
`H(0)` = 2.7888235127385e-15,
|
||||
K = 2.5301787e-06,
|
||||
Mg = 2.31391999937907e-05,
|
||||
Na = 0.00036746969,
|
||||
`S(-2)` = 1.01376078438546e-14,
|
||||
`S(2)` = 1.42247026981542e-19,
|
||||
`S(4)` = 9.49422092568557e-18,
|
||||
`S(6)` = 2.19812504654191e-05,
|
||||
Sr = 6.01218519999999e-07,
|
||||
`U(4)` = 4.82255946569383e-12,
|
||||
`U(5)` = 5.49050615347901e-13,
|
||||
`U(6)` = 1.32462838991902e-09)
|
||||
)
|
||||
|
||||
vecinj <- do.call(rbind.data.frame, vecinj_diffu)
|
||||
names(vecinj) <- grid$props
|
||||
|
||||
## diffusion coefficients
|
||||
alpha_diffu <- c(H = 1E-6, O = 1E-6, Charge = 1E-6, `C(-4)` = 1E-6,
|
||||
`C(4)` = 1E-6, Ca = 1E-6, Cl = 1E-6, `Fe(2)` = 1E-6,
|
||||
`Fe(3)` = 1E-6, `H(0)` = 1E-6, K = 1E-6, Mg = 1E-6,
|
||||
Na = 1E-6, `S(-2)` = 1E-6, `S(2)` = 1E-6,
|
||||
`S(4)` = 1E-6, `S(6)` = 1E-6, Sr = 1E-6,
|
||||
`U(4)` = 1E-6, `U(5)` = 1E-6, `U(6)` = 1E-6)
|
||||
|
||||
## list of boundary conditions/inner nodes
|
||||
|
||||
## vecinj_inner <- list(
|
||||
## list(1,1,1)
|
||||
## )
|
||||
|
||||
boundary <- list(
|
||||
"N" = rep(1, n),
|
||||
"E" = rep(0, n),
|
||||
"S" = rep(0, n),
|
||||
"W" = rep(0, n)
|
||||
)
|
||||
|
||||
diffu_list <- names(alpha_diffu)
|
||||
|
||||
vecinj <- do.call(rbind.data.frame, vecinj_diffu)
|
||||
names(vecinj) <- names(init_cell)
|
||||
|
||||
diffusion <- list(
|
||||
init = as.data.frame(init_cell, check.names = FALSE),
|
||||
vecinj = vecinj,
|
||||
# vecinj_inner = vecinj_inner,
|
||||
vecinj_index = boundary,
|
||||
alpha = alpha_diffu
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 3 ##
|
||||
## Chemistry module (Phreeqc) ##
|
||||
#################################################################
|
||||
|
||||
|
||||
chemistry <- list(
|
||||
database = database,
|
||||
input_script = input_script
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 4 ##
|
||||
## Putting all those things together ##
|
||||
#################################################################
|
||||
|
||||
|
||||
iterations <- 10
|
||||
dt <- 200
|
||||
chemistry_setup <- list()
|
||||
|
||||
# Define a setup list for simulation configuration
|
||||
setup <- list(
|
||||
grid = grid,
|
||||
diffusion = diffusion,
|
||||
chemistry = chemistry,
|
||||
iterations = iterations,
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE
|
||||
)
|
||||
Grid = grid_setup, # Parameters related to the grid structure
|
||||
Diffusion = diffusion_setup, # Parameters related to the diffusion process
|
||||
Chemistry = chemistry_setup # Parameters related to the chemistry process
|
||||
)
|
||||
7
bench/surfex/ex_rt.R
Normal file
7
bench/surfex/ex_rt.R
Normal file
@ -0,0 +1,7 @@
|
||||
iterations <- 10
|
||||
dt <- 200
|
||||
|
||||
list(
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE
|
||||
)
|
||||
@ -1,141 +1,37 @@
|
||||
## Time-stamp: "Last modified 2023-08-02 13:59:44 mluebke"
|
||||
rows <- 1000
|
||||
cols <- 1000
|
||||
|
||||
database <- normalizePath("../share/poet/bench/surfex/SMILE_2021_11_01_TH.dat")
|
||||
input_script <- normalizePath("../share/poet/bench/surfex/SurfExBase.pqi")
|
||||
grid_def <- matrix(1, nrow = rows, ncol = cols)
|
||||
|
||||
cat(paste(":: R This is a test 1\n"))
|
||||
# Define grid configuration for POET model
|
||||
grid_setup <- list(
|
||||
pqc_in_file = "./SurfExBase.pqi",
|
||||
pqc_db_file = "./SMILE_2021_11_01_TH.dat", # Path to the database file for Phreeqc
|
||||
grid_def = grid_def, # Definition of the grid, containing IDs according to the Phreeqc input script
|
||||
grid_size = c(rows, cols) / 10, # Size of the grid in meters
|
||||
constant_cells = c() # IDs of cells with constant concentration
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 1 ##
|
||||
## Grid initialization ##
|
||||
#################################################################
|
||||
bound_def <- list(
|
||||
"type" = rep("constant", cols),
|
||||
"sol_id" = rep(2, cols),
|
||||
"cell" = seq(1, cols)
|
||||
)
|
||||
|
||||
n <- 1000
|
||||
m <- 1000
|
||||
|
||||
types <- c("scratch", "phreeqc", "rds")
|
||||
|
||||
init_cell <- list(H = 1.476571028625e-01,
|
||||
O = 7.392297218936e-02,
|
||||
Charge = -1.765225732724e-18,
|
||||
`C(-4)` = 2.477908970828e-21,
|
||||
`C(4)` = 2.647623016916e-06,
|
||||
Ca = 2.889623169138e-05,
|
||||
Cl = 4.292806181039e-04,
|
||||
`Fe(2)` =1.908142472666e-07,
|
||||
`Fe(3)` =3.173306589931e-12,
|
||||
`H(0)` =2.675642675119e-15,
|
||||
K = 2.530134809667e-06,
|
||||
Mg =2.313806319294e-05,
|
||||
Na =3.674633059628e-04,
|
||||
`S(-2)` = 8.589766637180e-15,
|
||||
`S(2)` = 1.205284362720e-19,
|
||||
`S(4)` = 9.108958772790e-18,
|
||||
`S(6)` = 2.198092329098e-05,
|
||||
Sr = 6.012080128154e-07,
|
||||
`U(4)` = 1.039668623852e-14,
|
||||
`U(5)` = 1.208394829796e-15,
|
||||
`U(6)` = 2.976409147150e-12)
|
||||
|
||||
grid <- list(
|
||||
n_cells = c(n, m),
|
||||
s_cells = c(n/10, m/10),
|
||||
type = "scratch"
|
||||
diffusion_setup <- list(
|
||||
boundaries = list(
|
||||
"N" = bound_def
|
||||
),
|
||||
alpha_x = 1e-6,
|
||||
alpha_y = 1e-6
|
||||
)
|
||||
|
||||
|
||||
##################################################################
|
||||
## Section 2 ##
|
||||
## Diffusion parameters and boundary conditions ##
|
||||
##################################################################
|
||||
|
||||
vecinj_diffu <- list(
|
||||
list(H = 0.147659686316291,
|
||||
O = 0.0739242798146046,
|
||||
Charge = 7.46361643222701e-20,
|
||||
`C(-4)` = 2.92438561098248e-21,
|
||||
`C(4)` = 2.65160558871092e-06,
|
||||
Ca = 2.89001071336443e-05,
|
||||
Cl = 0.000429291158114428,
|
||||
`Fe(2)` = 1.90823391198114e-07,
|
||||
`Fe(3)` = 3.10832423034763e-12,
|
||||
`H(0)` = 2.7888235127385e-15,
|
||||
K = 2.5301787e-06,
|
||||
Mg = 2.31391999937907e-05,
|
||||
Na = 0.00036746969,
|
||||
`S(-2)` = 1.01376078438546e-14,
|
||||
`S(2)` = 1.42247026981542e-19,
|
||||
`S(4)` = 9.49422092568557e-18,
|
||||
`S(6)` = 2.19812504654191e-05,
|
||||
Sr = 6.01218519999999e-07,
|
||||
`U(4)` = 4.82255946569383e-12,
|
||||
`U(5)` = 5.49050615347901e-13,
|
||||
`U(6)` = 1.32462838991902e-09)
|
||||
)
|
||||
|
||||
vecinj <- do.call(rbind.data.frame, vecinj_diffu)
|
||||
names(vecinj) <- grid$props
|
||||
|
||||
## diffusion coefficients
|
||||
alpha_diffu <- c(H = 1E-6, O = 1E-6, Charge = 1E-6, `C(-4)` = 1E-6,
|
||||
`C(4)` = 1E-6, Ca = 1E-6, Cl = 1E-6, `Fe(2)` = 1E-6,
|
||||
`Fe(3)` = 1E-6, `H(0)` = 1E-6, K = 1E-6, Mg = 1E-6,
|
||||
Na = 1E-6, `S(-2)` = 1E-6, `S(2)` = 1E-6,
|
||||
`S(4)` = 1E-6, `S(6)` = 1E-6, Sr = 1E-6,
|
||||
`U(4)` = 1E-6, `U(5)` = 1E-6, `U(6)` = 1E-6)
|
||||
|
||||
## list of boundary conditions/inner nodes
|
||||
|
||||
## vecinj_inner <- list(
|
||||
## list(1,1,1)
|
||||
## )
|
||||
|
||||
boundary <- list(
|
||||
"N" = rep(1, n),
|
||||
"E" = rep(0, n),
|
||||
"S" = rep(0, n),
|
||||
"W" = rep(0, n)
|
||||
)
|
||||
|
||||
diffu_list <- names(alpha_diffu)
|
||||
|
||||
vecinj <- do.call(rbind.data.frame, vecinj_diffu)
|
||||
names(vecinj) <- names(init_cell)
|
||||
|
||||
diffusion <- list(
|
||||
init = as.data.frame(init_cell, check.names = FALSE),
|
||||
vecinj = vecinj,
|
||||
# vecinj_inner = vecinj_inner,
|
||||
vecinj_index = boundary,
|
||||
alpha = alpha_diffu
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 3 ##
|
||||
## Chemistry module (Phreeqc) ##
|
||||
#################################################################
|
||||
|
||||
|
||||
chemistry <- list(
|
||||
database = database,
|
||||
input_script = input_script
|
||||
)
|
||||
|
||||
#################################################################
|
||||
## Section 4 ##
|
||||
## Putting all those things together ##
|
||||
#################################################################
|
||||
|
||||
|
||||
iterations <- 100
|
||||
dt <- 200
|
||||
chemistry_setup <- list()
|
||||
|
||||
# Define a setup list for simulation configuration
|
||||
setup <- list(
|
||||
grid = grid,
|
||||
diffusion = diffusion,
|
||||
chemistry = chemistry,
|
||||
iterations = iterations,
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE,
|
||||
out_save = c(5, iterations)
|
||||
)
|
||||
Grid = grid_setup, # Parameters related to the grid structure
|
||||
Diffusion = diffusion_setup, # Parameters related to the diffusion process
|
||||
Chemistry = chemistry_setup # Parameters related to the chemistry process
|
||||
)
|
||||
10
bench/surfex/surfex_rt.R
Normal file
10
bench/surfex/surfex_rt.R
Normal file
@ -0,0 +1,10 @@
|
||||
iterations <- 100
|
||||
dt <- 200
|
||||
|
||||
out_save <- seq(5, iterations, by = 5)
|
||||
|
||||
list(
|
||||
timesteps = rep(dt, iterations),
|
||||
store_result = TRUE,
|
||||
out_save = out_save
|
||||
)
|
||||
Loading…
x
Reference in New Issue
Block a user