This function runs the SWAP model for the given project directory, and optionally, a certain swap_file.

  • If you desire, you can automatically match the output of the SWAP model to the data provided in the rswap_observed_data.csv file by setting autoset_output to TRUE.

  • verbose will print not only model running status, but also what rswap is doing

  • timeout allows you to set the maximum runtime of the model

run_swap(
  project_path,
  swap_file = "swap.swp",
  autoset_output = F,
  force = T,
  verbose = F,
  timeout = Inf
)

Arguments

project_path

path to the project directory (string)

swap_file

name of the *.swp main file (leave blank for "swap.swp")

autoset_output

If set to TRUE, rswap will automatically detect your observed data provided in the observed file and match it to the SWAP output. if this is set to FALSE, then INLIST csv must be set by the user either manually or with set_swap_output() or change_swap_par() for several other rswap function to work

force

If an rswap directory already exists, no new one will be generated/reloaded unless force=TRUE defaults to true.

verbose

print status? (flag)

timeout

number of seconds before run timeout (unlimited by default) (numeric)

Value

Returns the status code of the run.

Details

If you pass more than one project_path, then rswap will run your multiple projects in parallel using run_swap_parallel(). If you would like finer control over the parallel specific parameters, please use that function.

This function does more than simply run the model, it does the following, in this order:

  1. Build the rswap directory: build_rswap_directory()

  2. Parses the main swap file: parse_swap_file()

  3. Updates several parameters in the main file (such as paths, and output settings): set_swap_output()

  4. Writes the new SWAP main file: write_swp_file()

  5. Runs the new SWAP main file.

@seealso run_swap_parallel()