vs2di.runConfig: Run configuration with VS2dh model

Description Usage Arguments Value Examples

View source: R/vs2dhRunModel.R

Description

Run configuration with VS2dh model

Usage

1
2
3
vs2di.runConfig(conf, engine = "vs2dh", tDir = tempdir(),
  returnOutput = TRUE, openTargetDir = TRUE, showWarnings = TRUE,
  dbgRun = TRUE, dbg = TRUE)

Arguments

conf

as retrieved by vs2dh.ReadConfig (i.e. importing a working VS2DH configuration from an vs2h.dat file) or completley in R using function vs2dh.Configure() (ATTENTION: DEFAULT PARAMETERISATION FOR vs2dh.Configure() CURRENTLY YIELDS NO RUNNING VS2DH MODEL CONFIGURATION)

engine

model engine 'vs2dh' (for flow & heat modelling) or 'vs2dt' (for flow & solute transport) (Default: "vs2dh")

tDir

target directory where vs2dh model input/output files should be stored. (Default: tempdir())

returnOutput

if TRUE model output files variables.out, balance.out and obsPoints.out are imported into R completely; vs2dh.out (only warnings imported) (Default: TRUE)

openTargetDir

If TRUE path containing model files will be opened in explorer (Default: FALSE)

showWarnings

if TRUE print warning messages during simulation on screen (default: TRUE)

dbgRun

if true text output on screen on model run progress

dbg

if true text output on screen on additional model run progress

Value

Import & write VS2dh model results in R object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
### Testing import and writing functions with 
### Folder which contains the subfolders with the different models to test: 
model.main.path <- system.file("extdata", "vs2dh_example", package = "kwb.vs2dh")
#### Using vs2dh.dat file contained in subfolders example1, example2, tutorial1
#### for testing (i.e. ignore example3 due to long run time, but this also works!)
exampleModels <- c(paste0("example", 1:2), "tutorial1")
### Create result list in R for storing model outputs for each model in a separate
### sublist 
res <- list()
#### Loop through all example model input files & plot temperature distribution
for (testModel in exampleModels)
{
 model.path <- file.path(model.main.path, testModel)
 cat(sprintf("Testing model in %s\n", model.path ))
 cat("1.Step: importing configuration to R.....")
 conf <- vs2dh.ReadConfig(model.path = model.path)
 cat("Done!")
 cat("2.Step: Run vs2di.runConfig():")
 tDir <- file.path(tempdir(), testModel)
 res[[testModel]] <- vs2di.runConfig(conf = conf, tDir = tDir)
 cat("3.Step: Plot temperature distribution...")
 vs2dh.plotVariables(para = "Temp", 
                     data = res[[testModel]]$variables,
                     main = testModel  ### nice label by using model folder name
                    )
  cat("Done!")
} 

## End(Not run)

KWB-R/kwb.vs2dh documentation built on Sept. 10, 2019, 12:20 p.m.