From 60e9d926b45c15553a2dc102dc14e3d8cb61df19 Mon Sep 17 00:00:00 2001 From: aheinri5 <Anna@netzkritzler.de> Date: Fri, 18 Dec 2020 22:41:37 +0100 Subject: [PATCH] [example] Added example setup file for ensemble --- inst/examples/ensemble_example.R | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 inst/examples/ensemble_example.R diff --git a/inst/examples/ensemble_example.R b/inst/examples/ensemble_example.R new file mode 100644 index 0000000..5503313 --- /dev/null +++ b/inst/examples/ensemble_example.R @@ -0,0 +1,51 @@ +detach("package:r2ogs6", unload=TRUE) +library(r2ogs6) + + +#This is where the user defines their data. + + +#===== SET UP SIMULATION OBJECT ===== + + +# If you run this, alter ogs_bin_path below to fit your installation location! + +ogs_bin_path <- paste0("D:/Programme/OpenGeoSys/", + "ogs-6.3.2-Windows-10.0.14393-x64-python-3.7.2-de-utils", + "/bin/") + +#First, we need to create a simulation object. + +ogs6_obj <- OGS6$new(sim_name = "my_sim", + sim_id = 1, + sim_path = "D:/OGS_Sim/", + ogs_bin_path = ogs_bin_path) + + +#===== READ IN .prj FILE ===== + + +# This will only work if the working directory is r2ogs6! + +prj_path <- paste0("inst/extdata/flow_free_expansion/flow_free_expansion.prj") + +# # Alternative path (also system dependent) +# alt_path = paste0("D:\\Programme\\OpenGeoSys\\", +# "ogs-master-Tests-Data-HydroMechanics\\", +# "Tests\\Data\\HydroMechanics\\IdealGas\\", +# "flow_no_strain\\flow_no_strain.prj") + +read_in_prj(ogs6_obj, prj_path) + +ogs6_ens <- OGS6_Ensemble$new( + ogs6_obj = ogs6_obj, + parameters = list(list(ogs6_obj$parameters[[2]]$value, c(.4, .5, .6))) +) + + +#===== Execution ===== + + +#Calls OGS6 validators, exports all necessary files and starts OpenGeoSys6 + +ogs6_ens$run_simulation() -- GitLab