Skip to content
Snippets Groups Projects
Commit 8ff2fffc authored by Ruben Heinrich's avatar Ruben Heinrich
Browse files

[docs] changed prefixes in tests and vignettes

parent 7157f940
No related branches found
No related tags found
1 merge request!13Resolve "Rename ogs_ prefixes to ogs6_ and r2ogs6_prefixes to prj_"
...@@ -64,7 +64,7 @@ test_that("to_node reads parameter names implicitly if not given", { ...@@ -64,7 +64,7 @@ test_that("to_node reads parameter names implicitly if not given", {
test_that("to_node works for simple classes", { test_that("to_node works for simple classes", {
#Test for a single class element #Test for a single class element
parameter <- r2ogs6_parameter(name = "pressure0", parameter <- prj_parameter(name = "pressure0",
type = "Constant", type = "Constant",
values = 1e5) values = 1e5)
...@@ -79,7 +79,7 @@ test_that("to_node works for simple classes", { ...@@ -79,7 +79,7 @@ test_that("to_node works for simple classes", {
1e5) 1e5)
#Test for a wrapper list #Test for a wrapper list
parameter_2 <- r2ogs6_parameter(name = "pressure1", parameter_2 <- prj_parameter(name = "pressure1",
type = "Constant", type = "Constant",
values = c(0, 0)) values = c(0, 0))
...@@ -98,7 +98,7 @@ test_that("to_node works for simple classes", { ...@@ -98,7 +98,7 @@ test_that("to_node works for simple classes", {
test_that("to_node works for classes that have lists as parameters", { test_that("to_node works for classes that have lists as parameters", {
insitu <- r2ogs6_insitu(c("script_1", insitu <- prj_insitu(c("script_1",
"script_2", "script_2",
"script_3")) "script_3"))
...@@ -112,13 +112,13 @@ test_that("to_node works for classes that have lists as parameters", { ...@@ -112,13 +112,13 @@ test_that("to_node works for classes that have lists as parameters", {
test_that("to_node works for classes that have subclasses", { test_that("to_node works for classes that have subclasses", {
process_variable <- r2ogs6_process_variable( process_variable <- prj_process_variable(
name = "pressure", name = "pressure",
components = 1, components = 1,
order = 1, order = 1,
initial_condition = "pressure0", initial_condition = "pressure0",
boundary_conditions = list( boundary_conditions = list(
r2ogs6_boundary_condition( prj_boundary_condition(
type = "Neumann", type = "Neumann",
parameter = "flux", parameter = "flux",
component = 0, component = 0,
...@@ -145,16 +145,16 @@ test_that("to_node works for classes that have subclasses", { ...@@ -145,16 +145,16 @@ test_that("to_node works for classes that have subclasses", {
test_that("to_node works for classes that have attributes", { test_that("to_node works for classes that have attributes", {
tl_process <- r2ogs6_tl_process( tl_process <- prj_tl_process(
ref = "HM", ref = "HM",
nonlinear_solver = "basic_newton", nonlinear_solver = "basic_newton",
convergence_criterion = r2ogs6_convergence_criterion( convergence_criterion = prj_convergence_criterion(
type = "PerComponentDeltaX", type = "PerComponentDeltaX",
norm_type = "NORM2", norm_type = "NORM2",
reltols = "5e-8 1e10 1e10" reltols = "5e-8 1e10 1e10"
), ),
time_discretization = list(type = "BackwardEuler"), time_discretization = list(type = "BackwardEuler"),
time_stepping = r2ogs6_time_stepping( time_stepping = prj_time_stepping(
type = "FixedTimeStepping", type = "FixedTimeStepping",
t_initial = 0, t_initial = 0,
t_end = 100, t_end = 100,
...@@ -174,7 +174,7 @@ test_that("to_node works for classes that have attributes", { ...@@ -174,7 +174,7 @@ test_that("to_node works for classes that have attributes", {
test_that("to_node works for classes that have non-exported wrappers", { test_that("to_node works for classes that have non-exported wrappers", {
#Test for a single class element #Test for a single class element
parameter <- r2ogs6_parameter(name = "pressure0", parameter <- prj_parameter(name = "pressure0",
type = "Constant", type = "Constant",
values = 1e5, values = 1e5,
index_values = list("1", "1 2"), index_values = list("1", "1 2"),
...@@ -190,14 +190,14 @@ test_that("to_node works for classes that have non-exported wrappers", { ...@@ -190,14 +190,14 @@ test_that("to_node works for classes that have non-exported wrappers", {
}) })
test_that("to_node works for r2ogs6_process class", { test_that("to_node works for prj_process class", {
process <- r2ogs6_process( process <- prj_process(
name = "HM", name = "HM",
type = "HYDRO_MECHANICS", type = "HYDRO_MECHANICS",
integration_order = 3, integration_order = 3,
dimension = 2, dimension = 2,
constitutive_relation = r2ogs6_constitutive_relation( constitutive_relation = prj_constitutive_relation(
type = "LinearElasticIsotropic", type = "LinearElasticIsotropic",
youngs_modulus = "E", youngs_modulus = "E",
poissons_ratio = "nu" poissons_ratio = "nu"
......
...@@ -19,37 +19,37 @@ test_that("construct_add_call works", { ...@@ -19,37 +19,37 @@ test_that("construct_add_call works", {
list_call <- construct_add_call(my_list) list_call <- construct_add_call(my_list)
expect_equal(list_call, "list(a = c(2, 3, 4),\nb = c(\"a\", \"b\", \"c\"))") expect_equal(list_call, "list(a = c(2, 3, 4),\nb = c(\"a\", \"b\", \"c\"))")
ogs_param <- r2ogs6_parameter("a", ogs6_param <- prj_parameter("a",
"t", "t",
NULL, NULL,
c(0, 1)) c(0, 1))
ogs_param_call <- construct_add_call(ogs_param) ogs6_param_call <- construct_add_call(ogs6_param)
expect_equal(ogs_param_call, paste0("ogs6_obj$add(", expect_equal(ogs6_param_call, paste0("ogs6_obj$add(",
"r2ogs6_parameter(name = \"a\",\n", "prj_parameter(name = \"a\",\n",
"type = \"t\",\n", "type = \"t\",\n",
"values = c(0, 1)))\n")) "values = c(0, 1)))\n"))
ogs_meshes <- list("mesh_1", ogs6_meshes <- list("mesh_1",
"mesh_2") "mesh_2")
ogs_mesh_call <- construct_add_call(ogs_meshes) ogs6_mesh_call <- construct_add_call(ogs6_meshes)
expect_equal(ogs_mesh_call, paste0("list(\"mesh_1\",\n\"mesh_2\")")) expect_equal(ogs6_mesh_call, paste0("list(\"mesh_1\",\n\"mesh_2\")"))
}) })
test_that("construct_add_call handles OGS6_gml correctly", { test_that("construct_add_call handles OGS6_gml correctly", {
ogs_gml <- OGS6_gml$new(name = "test", ogs6_gml <- OGS6_gml$new(name = "test",
points = tibble::tibble(x = c(0), points = tibble::tibble(x = c(0),
y = c(0), y = c(0),
z = c(0))) z = c(0)))
ogs_gml_call <- construct_add_call(ogs_gml) ogs6_gml_call <- construct_add_call(ogs6_gml)
expect_equal(ogs_gml_call, expect_equal(ogs6_gml_call,
paste0("ogs6_obj$add(OGS6_gml$new(name = \"test\",\n", paste0("ogs6_obj$add(OGS6_gml$new(name = \"test\",\n",
"points = tibble::tibble(x = 0,\ny = 0,\nz = 0)))\n")) "points = tibble::tibble(x = 0,\ny = 0,\nz = 0)))\n"))
}) })
...@@ -57,15 +57,15 @@ test_that("construct_add_call handles OGS6_gml correctly", { ...@@ -57,15 +57,15 @@ test_that("construct_add_call handles OGS6_gml correctly", {
test_that("construct_add_call handles Ellipsis correctly", { test_that("construct_add_call handles Ellipsis correctly", {
ogs_parameter <- r2ogs6_parameter(name = "test", ogs6_parameter <- prj_parameter(name = "test",
type = "test", type = "test",
index_values = list("1", "1 2"), index_values = list("1", "1 2"),
index_values = list("2", "2 3")) index_values = list("2", "2 3"))
ogs_param_call <- construct_add_call(ogs_parameter) ogs6_param_call <- construct_add_call(ogs6_parameter)
expect_equal(ogs_param_call, expect_equal(ogs6_param_call,
paste0("ogs6_obj$add(r2ogs6_parameter(name = ", paste0("ogs6_obj$add(prj_parameter(name = ",
"\"test\",\ntype = \"test\",\nindex_values = ", "\"test\",\ntype = \"test\",\nindex_values = ",
"list(index = 1,\nvalues = c(1, 2)),\n", "list(index = 1,\nvalues = c(1, 2)),\n",
"index_values = list(index = 2,\nvalues = c(2, 3))))\n")) "index_values = list(index = 2,\nvalues = c(2, 3))))\n"))
...@@ -74,9 +74,9 @@ test_that("construct_add_call handles Ellipsis correctly", { ...@@ -74,9 +74,9 @@ test_that("construct_add_call handles Ellipsis correctly", {
test_that("delete_keywords_from_str works", { test_that("delete_keywords_from_str works", {
test_str <- "r2ogs6_object(a = \"foo\", repeat = \"bar\")" test_str <- "prj_object(a = \"foo\", repeat = \"bar\")"
test_str <- delete_keywords_from_str(test_str) test_str <- delete_keywords_from_str(test_str)
expect_equal(test_str, "r2ogs6_object(a = \"foo\", \"bar\")") expect_equal(test_str, "prj_object(a = \"foo\", \"bar\")")
}) })
...@@ -7,7 +7,7 @@ test_that("OGS6$clear() works as expected", { ...@@ -7,7 +7,7 @@ test_that("OGS6$clear() works as expected", {
sim_name = "sim", sim_name = "sim",
sim_path = "sim_path") sim_path = "sim_path")
ogs6_obj$add(r2ogs6_parameter( ogs6_obj$add(prj_parameter(
name = "pressure0", name = "pressure0",
type = "Constant", type = "Constant",
values = 1e5 values = 1e5
...@@ -25,7 +25,7 @@ test_that("OGS6$add() works", { ...@@ -25,7 +25,7 @@ test_that("OGS6$add() works", {
sim_name = "sim", sim_name = "sim",
sim_path = "sim_path") sim_path = "sim_path")
ogs6_obj$add(r2ogs6_parameter( ogs6_obj$add(prj_parameter(
name = "pressure0", name = "pressure0",
type = "Constant", type = "Constant",
values = 1e5 values = 1e5
......
...@@ -7,13 +7,13 @@ test_that("OGS6_Ensemble initialization works", { ...@@ -7,13 +7,13 @@ test_that("OGS6_Ensemble initialization works", {
sim_name = "sim", sim_name = "sim",
sim_path = "sim_path") sim_path = "sim_path")
ogs6_obj$add(r2ogs6_parameter( ogs6_obj$add(prj_parameter(
name = "pressure0", name = "pressure0",
type = "Constant", type = "Constant",
value = 1 value = 1
)) ))
ogs6_obj$add(r2ogs6_parameter( ogs6_obj$add(prj_parameter(
name = "pressure1", name = "pressure1",
type = "Constant", type = "Constant",
value = 4 value = 4
...@@ -62,13 +62,13 @@ test_that("OGS6_Ensemble initialization works", { ...@@ -62,13 +62,13 @@ test_that("OGS6_Ensemble initialization works", {
}) })
test_that("ogs_get_combinations works", { test_that("ogs6_get_combinations works", {
a <- c(1, 2, 3, 4) a <- c(1, 2, 3, 4)
b <- c("a", "b", "c") b <- c("a", "b", "c")
c <- c("+", "-") c <- c("+", "-")
combinations <- ogs_get_combinations(a, b, c) combinations <- ogs6_get_combinations(a, b, c)
a_long <- combinations[[1]] a_long <- combinations[[1]]
b_long <- combinations[[2]] b_long <- combinations[[2]]
c_long <- combinations[[3]] c_long <- combinations[[3]]
......
test_that("new_r2ogs6_parameter basic validation is working", { test_that("new_prj_parameter basic validation is working", {
expect_error(r2ogs6_parameter("my_param", c(0, 0), c(0, 0))) expect_error(prj_parameter("my_param", c(0, 0), c(0, 0)))
expect_error(r2ogs6_parameter(c(0, 0), "my_type", c(0, 0))) expect_error(prj_parameter(c(0, 0), "my_type", c(0, 0)))
}) })
test_that("new_r2ogs6_time_loop basic validation is working", { test_that("new_prj_time_loop basic validation is working", {
expect_error(new_r2ogs6_time_loop( expect_error(new_prj_time_loop(
list("missing"), list("missing"),
r2ogs6_tl_output( prj_tl_output(
type = "VTK", type = "VTK",
prefix = "flow_no_strain_pcs_{:process_id}", prefix = "flow_no_strain_pcs_{:process_id}",
suffix = "_ts_{:timestep}_t_{:time}", suffix = "_ts_{:timestep}_t_{:time}",
...@@ -15,9 +15,9 @@ test_that("new_r2ogs6_time_loop basic validation is working", { ...@@ -15,9 +15,9 @@ test_that("new_r2ogs6_time_loop basic validation is working", {
)) ))
expect_error(new_r2ogs6_time_loop( expect_error(new_prj_time_loop(
list( list(
r2ogs6_tl_process( prj_tl_process(
ref = "HM", ref = "HM",
nonlinear_solver = "basic_newton", nonlinear_solver = "basic_newton",
convergence_criterion = list( convergence_criterion = list(
......
...@@ -48,7 +48,7 @@ test_that("node_to_object works for simple lists", { ...@@ -48,7 +48,7 @@ test_that("node_to_object works for simple lists", {
test_that("order_parameters works for classes with Ellipsis argument", { test_that("order_parameters works for classes with Ellipsis argument", {
ogs_parameter <- r2ogs6_parameter(name = "test", ogs6_parameter <- prj_parameter(name = "test",
type = "test", type = "test",
index_values = list("1", "1 2")) index_values = list("1", "1 2"))
...@@ -56,7 +56,7 @@ test_that("order_parameters works for classes with Ellipsis argument", { ...@@ -56,7 +56,7 @@ test_that("order_parameters works for classes with Ellipsis argument", {
index_values = list("1", "1 2"), index_values = list("1", "1 2"),
name = "test") name = "test")
class_name <- "r2ogs6_parameter" class_name <- "prj_parameter"
ordered_parameters <- order_parameters(parameters, ordered_parameters <- order_parameters(parameters,
class_name) class_name)
......
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
# helper function to skip tests if we don't have OpenGeoSys 6 dependencies # helper function to skip tests if we don't have OpenGeoSys 6 dependencies
skip_if_ogs6_missing <- function() { skip_if_ogs6_missing <- function() {
ogs_path <- paste0(unlist(options("r2ogs6.default_ogs_bin_path")), ogs6_path <- paste0(unlist(options("r2ogs6.default_ogs6_bin_path")),
"ogs.exe") "ogs.exe")
if(!file.exists(ogs_path)){ if(!file.exists(ogs6_path)){
skip("ogs.exe not available for testing") skip("ogs.exe not available for testing")
} }
skip("Skipping tests that call ogs_run_simulation()") skip("Skipping tests that call ogs6_run_simulation()")
} }
test_that("ogs_run_simulation works for flow_no_strain.prj", { test_that("ogs6_run_simulation works for flow_no_strain.prj", {
skip_if_ogs6_missing() skip_if_ogs6_missing()
...@@ -34,7 +34,7 @@ test_that("ogs_run_simulation works for flow_no_strain.prj", { ...@@ -34,7 +34,7 @@ test_that("ogs_run_simulation works for flow_no_strain.prj", {
read_in_prj(ogs6_obj, prj_path) read_in_prj(ogs6_obj, prj_path)
# Run simulation # Run simulation
e <- ogs_run_simulation(ogs6_obj) e <- ogs6_run_simulation(ogs6_obj)
# Check exit code # Check exit code
expect_equal(e, 0) expect_equal(e, 0)
...@@ -52,7 +52,7 @@ test_that("ogs_run_simulation works for flow_no_strain.prj", { ...@@ -52,7 +52,7 @@ test_that("ogs_run_simulation works for flow_no_strain.prj", {
#===== Export utility ===== #===== Export utility =====
test_that("ogs_export_sim_files works", { test_that("ogs6_export_sim_files works", {
extdata_path <- system.file("extdata/test_tempdirs/", package = "r2ogs6") extdata_path <- system.file("extdata/test_tempdirs/", package = "r2ogs6")
test_path <- paste0(extdata_path, "/export_all_sim_files_test") test_path <- paste0(extdata_path, "/export_all_sim_files_test")
...@@ -68,7 +68,7 @@ test_that("ogs_export_sim_files works", { ...@@ -68,7 +68,7 @@ test_that("ogs_export_sim_files works", {
prj_path) prj_path)
# Now export all files # Now export all files
ogs_export_sim_files(ogs6_obj) ogs6_export_sim_files(ogs6_obj)
expect_equal(file.exists(paste0(test_path, "/circle_1e1_axi.prj")), expect_equal(file.exists(paste0(test_path, "/circle_1e1_axi.prj")),
TRUE) TRUE)
......
...@@ -5,16 +5,16 @@ ...@@ -5,16 +5,16 @@
test_that("get_class_from_xpath() works", { test_that("get_class_from_xpath() works", {
expect_equal(get_class_from_xpath("processes/process"), expect_equal(get_class_from_xpath("processes/process"),
"r2ogs6_process") "prj_process")
xpath = "time_loop/processes/process/convergence_criterion" xpath = "time_loop/processes/process/convergence_criterion"
expect_equal(get_class_from_xpath(xpath), expect_equal(get_class_from_xpath(xpath),
"r2ogs6_convergence_criterion") "prj_convergence_criterion")
}) })
test_that("get_tag_from_class() works", { test_that("get_tag_from_class() works", {
expect_equal(get_tag_from_class(class_name = "r2ogs6_tl_process"), expect_equal(get_tag_from_class(class_name = "prj_tl_process"),
"process") "process")
}) })
...@@ -25,7 +25,7 @@ test_that("get_tag_from_xpath() works", { ...@@ -25,7 +25,7 @@ test_that("get_tag_from_xpath() works", {
test_that("prj_top_level_classes() works", { test_that("prj_top_level_classes() works", {
expect_equal(prj_top_level_classes()[["processes"]], "r2ogs6_process") expect_equal(prj_top_level_classes()[["processes"]], "prj_process")
}) })
......
...@@ -132,10 +132,10 @@ Ta-daa, you now have some nice stubs. Copy them into a script in the `R` folder ...@@ -132,10 +132,10 @@ Ta-daa, you now have some nice stubs. Copy them into a script in the `R` folder
Now that we have a class, we need to tell the package it exists. This is so when we're reading in or exporting a `.prj` file, it knows to automatically turn the content of our `nonlinear_solver` tag into an object of our new class and the other way around. To achieve this, execute the code in `data_raw/xpaths_for_classes.R`. What this will do is update the `xpaths_for_classes` parameter, adding an entry for your class. Afterwards, run `xpaths_for_classes[["your_class_name"]]`. It should return the `xpath` parameter of your class like so: Now that we have a class, we need to tell the package it exists. This is so when we're reading in or exporting a `.prj` file, it knows to automatically turn the content of our `nonlinear_solver` tag into an object of our new class and the other way around. To achieve this, execute the code in `data_raw/xpaths_for_classes.R`. What this will do is update the `xpaths_for_classes` parameter, adding an entry for your class. Afterwards, run `xpaths_for_classes[["your_class_name"]]`. It should return the `xpath` parameter of your class like so:
```{r} ```{r}
xpaths_for_classes[["r2ogs6_process"]] xpaths_for_classes[["prj_process"]]
# A class can have multiple xpaths if the represented node occurs at different positions. # A class can have multiple xpaths if the represented node occurs at different positions.
xpaths_for_classes[["r2ogs6_convergence_criterion"]] xpaths_for_classes[["prj_convergence_criterion"]]
``` ```
If the class you've created is a `.prj` top level class or a child of a top level wrapper node like `processes`, add a corresponding `OGS6` private parameter and an active field. For example, the `processes` node is represented as a list, so I added the private parameter `.processes = list()` and the active field `processes`. If the class you've created is a `.prj` top level class or a child of a top level wrapper node like `processes`, add a corresponding `OGS6` private parameter and an active field. For example, the `processes` node is represented as a list, so I added the private parameter `.processes = list()` and the active field `processes`.
......
...@@ -32,7 +32,7 @@ After loading `r2ogs6`, we can set the package options so it knows where to look ...@@ -32,7 +32,7 @@ After loading `r2ogs6`, we can set the package options so it knows where to look
```r ```r
# Set path for OpenGeoSys 6 # Set path for OpenGeoSys 6
options("r2ogs6.default_ogs_bin_path" = "your_ogs_bin_path") options("r2ogs6.default_ogs6_bin_path" = "your_ogs6_bin_path")
# Set path for Python # Set path for Python
options("r2ogs6.use_python" = "your_python_path") options("r2ogs6.use_python" = "your_python_path")
...@@ -88,10 +88,10 @@ The results of `get_status()` already gave us a hint what we can add. We'll go f ...@@ -88,10 +88,10 @@ The results of `get_status()` already gave us a hint what we can add. We'll go f
```r ```r
# To take a look at the documentation, use ? followed by the name of a class # To take a look at the documentation, use ? followed by the name of a class
?r2ogs6_process ?prj_process
``` ```
As a rule of thumb, classes are named with the prefix `r2ogs6_` followed by their XML tag name in the `.prj` file. The only exceptions to this rule are subclasses where this would lead to duplicate class names. The class `r2ogs6_time_loop` for example contains a subclass representing a `process` child element which is not to be confused with the `process` children of the first level `processes` node directly under the root node of the `.prj` file. Because of this, that subclass is named `r2ogs6_tl_process`. As a rule of thumb, classes are named with the prefix `prj_` followed by their XML tag name in the `.prj` file. The only exceptions to this rule are subclasses where this would lead to duplicate class names. The class `prj_time_loop` for example contains a subclass representing a `process` child element which is not to be confused with the `process` children of the first level `processes` node directly under the root node of the `.prj` file. Because of this, that subclass is named `prj_tl_process`.
(...) (...)
...@@ -104,7 +104,7 @@ Let's try adding something now. ...@@ -104,7 +104,7 @@ Let's try adding something now.
To add data to our simulation object, we use `OGS6$add()`. To add data to our simulation object, we use `OGS6$add()`.
```{r} ```{r}
ogs6_obj$add(r2ogs6_parameter( ogs6_obj$add(prj_parameter(
name = "pressure0", name = "pressure0",
type = "Constant", type = "Constant",
value = 1 value = 1
...@@ -114,7 +114,7 @@ To add data to our simulation object, we use `OGS6$add()`. ...@@ -114,7 +114,7 @@ To add data to our simulation object, we use `OGS6$add()`.
## Running the simulation ## Running the simulation
As soon as we've added all necessary parameters, we can try starting our simulation by calling `ogs_run_simulation(ogs6_obj, write_logfile = TRUE)`. This will run a few additional checks and then start OpenGeoSys 6. If `write_logfile` is set to `FALSE`, the output from OpenGeoSys 6 will be shown on the console. As soon as we've added all necessary parameters, we can try starting our simulation by calling `ogs6_run_simulation(ogs6_obj, write_logfile = TRUE)`. This will run a few additional checks and then start OpenGeoSys 6. If `write_logfile` is set to `FALSE`, the output from OpenGeoSys 6 will be shown on the console.
## Running multiple simulations ## Running multiple simulations
...@@ -133,7 +133,7 @@ To set up an ensemble run, we first need a base simulation object. Conveniently, ...@@ -133,7 +133,7 @@ To set up an ensemble run, we first need a base simulation object. Conveniently,
Internally, the `OGS6_Ensemble` object clones the `OGS6` object provided to it and for these clones, it overwrites the parameters we defined with the values we provided. The parameters we define must belong to the same `OGS6` object we passed to the ensemble object as a blueprint via the `ogs6_obj` argument. Internally, the `OGS6_Ensemble` object clones the `OGS6` object provided to it and for these clones, it overwrites the parameters we defined with the values we provided. The parameters we define must belong to the same `OGS6` object we passed to the ensemble object as a blueprint via the `ogs6_obj` argument.
Note that for our example, I'm altering the first object in `ogs6_obj$parameters` because so far, one `r2ogs6_parameter` is the only thing we have added to our simulation. Don't let the `parameters` argument of the `OGS6_Ensemble` constructor confuse you though - you can define all kinds of parameters here and aren't limited to variables of `r2ogs6_parameter`. If we had defined a `r2ogs6_process` already, we could have passed the variable `ogs6_obj$processes[[1]]$reference_temperature` along with the value vector `c(20, 30, 40)` to the `OGS6_Ensemble` constructor. Note that for our example, I'm altering the first object in `ogs6_obj$parameters` because so far, one `prj_parameter` is the only thing we have added to our simulation. Don't let the `parameters` argument of the `OGS6_Ensemble` constructor confuse you though - you can define all kinds of parameters here and aren't limited to variables of `prj_parameter`. If we had defined a `prj_process` already, we could have passed the variable `ogs6_obj$processes[[1]]$reference_temperature` along with the value vector `c(20, 30, 40)` to the `OGS6_Ensemble` constructor.
We can check if the initialization of our ensemble object worked like this: We can check if the initialization of our ensemble object worked like this:
...@@ -145,7 +145,7 @@ We can check if the initialization of our ensemble object worked like this: ...@@ -145,7 +145,7 @@ We can check if the initialization of our ensemble object worked like this:
Note that the class variables of `OGS6_Ensemble` objects are read-only, so be sure to define all parameters during initialization. Note that the class variables of `OGS6_Ensemble` objects are read-only, so be sure to define all parameters during initialization.
To start an ensemble run, we call `ogs6_ens$ogs_run_simulation(parallel = FALSE)`. This calls `ogs_run_simulation()` on each of the simulation objects in `ogs6_ens$ensemble`. Depending on the size of our ensemble and the available system resources, it might make sense to set the `parallel` parameter to `TRUE`. To start an ensemble run, we call `ogs6_ens$ogs6_run_simulation(parallel = FALSE)`. This calls `ogs6_run_simulation()` on each of the simulation objects in `ogs6_ens$ensemble`. Depending on the size of our ensemble and the available system resources, it might make sense to set the `parallel` parameter to `TRUE`.
NOTE: Parallelization depends on the OS: A fork cluster is used on UNIX-like Systems while on Windows systems, a socket cluster is used. Parallelization hasn't been tested on Windows yet. NOTE: Parallelization depends on the OS: A fork cluster is used on UNIX-like Systems while on Windows systems, a socket cluster is used. Parallelization hasn't been tested on Windows yet.
...@@ -156,4 +156,4 @@ Chaining simulations works in a similar manner to creating ensembles. The main d ...@@ -156,4 +156,4 @@ Chaining simulations works in a similar manner to creating ensembles. The main d
... ...
To start a chain run, we call `ogs6_chain$ogs_run_simulation()`. This calls `ogs_run_simulation()` on the base object and then reads in the information required to start the next simulation from the output files produced by OpenGeoSys 6 (based on the parameters we defined). Since chain runs can't be parallelized, this might take a while. To start a chain run, we call `ogs6_chain$ogs6_run_simulation()`. This calls `ogs6_run_simulation()` on the base object and then reads in the information required to start the next simulation from the output files produced by OpenGeoSys 6 (based on the parameters we defined). Since chain runs can't be parallelized, this might take a while.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment