Run.B90: Run the LWF-Brook90 hydrological model and return results

Description Usage Arguments Value Examples

View source: R/RunBrook90.R

Description

Takes all necessary information needed to run the LWF-Brook90 hydrological model, writes input files, starts the external executable via a system-call and returns the results.

Usage

1
2
3
4
5
Run.B90(project.dir, options.b90, param.b90, climate, soil,
  outputmat = choose_output.B90(edit = FALSE), output.log = "",
  out.dir = "out/", path_b90.exe = "b90.exe", output.param.options = TRUE,
  keep.log.on.success = TRUE, keep.outputfiles = TRUE, verbose = TRUE,
  write.climate.in = TRUE, run.model = TRUE)

Arguments

project.dir

directory-name of the project where the input and output files are located. Will be created, if not existing.

options.b90

named list of model control options. Use MakeOptions.B90 to generate a list with default model control options.

param.b90

Named list of model input parameters. Use MakeParam.B90 to generate a list with default model parameters.

climate

data.frame with daily climate data. The names of climate have to correspond to arguments dates, tmax, tmin, wind, prec, vappres, globrad, sunhours) of writeClimate.in.

soil

data.frame containing the hydraulic properties of the soil layers. Each row represents one layer, containing the layers' boundaries and soil hydraulic parameters. The columns names for the upper and lower layer boundaries are upper and lower (m, negative downwards), the parameters of the van Genuchten retention functions are ths, thr, alpha [m-1], npar, and the parameters of the Mualem conductivity function ksat [mm d-1] and tort. The volume fraction of stones has to be named gravel.

outputmat

a [10,5]-matrix flagging the desired model-output. Use choose_output.B90 to generate and edit default output matrix.

output.log

Logical or filename where 'stdout' of system2-call is sent. The default output.log = "" sents all command-line model-output to the R console, output.log = FALSE discards stdout. All other names will create a text file containing the model runtime output.

out.dir

path where to write the output-files.

path_b90.exe

filename of the executable code. The default setting looks for the executable 'b90.exe' within 'project.dir'.

output.param.options

append 'param.b90', 'options.b90', 'soil' and daily plant properties ('plant.devt', as derived from parameters and written to 'climate.in') to the result?

keep.log.on.success

keep the file 'output.log' after a successful simulation? In case of simulation errors the 'output.log' file (if specified) is kept anyway for inspection purposes.

keep.outputfiles

keep the model .asc output files after running and returning the output?

verbose

print messages to the console? Default is TRUE.

write.climate.in

should the climate file be written or not to save execution time? Ignored if no 'Climate.in' is found in 'project.dir/in'.

run.model

run the executable or only create input files? Default is TRUE.

Value

Returns the model-output from the files found in 'out.dir' as a list of data.frames (data.tables), along with the execution time of the simulation, and input-parameters and options if desired.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#Set up lists containing model control options and model parameters:

param.b90 <- MakeParam.B90()
options.b90 <- MakeOptions.B90()

# Set start and end Dates for the simulation

options.b90$startdate <- as.Date("2000-01-01")
options.b90$enddate <- as.Date("2004-12-31")

# Derive soil hydraulic properties from soil physical properties
# using pedotransfer functions

soil <- cbind(soil_slb1, hydpar_wessolek_mvg(soil_slb1$texture))

# Run LWF-Brook90
b90.result <- Run.B90(project.dir = "example_run_b90",
                      options.b90 = options.b90,
                      param.b90 = param.b90.b90,
                      climate = meteo_slb1,
                      soil = soil,
                      path_b90.exe = "b90.exe")

pschmidtwalter/brook90r documentation built on Sept. 26, 2018, 5:17 p.m.