Run: Call an external code wrapped through Funz.

View source: R/client.R

RunR Documentation

Call an external code wrapped through Funz.

Description

Call an external code wrapped through Funz.

Usage

Run(
  model = NULL,
  input.files,
  input.variables = NULL,
  all.combinations = FALSE,
  output.expressions = NULL,
  run.control = list(force.retry = 2, cache.dir = NULL),
  monitor.control = list(sleep = 5, display.fun = NULL),
  archive.dir = NULL,
  out.filter = NULL,
  verbosity = 1
)

Arguments

model

name of the code wrapper to use. See .Funz.Models global var for a list of possible values.

input.files

list of files to give as input for the code.

input.variables

data.frame of input variable values. If more than one experiment (i.e. nrow >1), experiments will be launched simultaneously on the Funz grid.

all.combinations

if FALSE, input.variables variables are grouped (default), else, if TRUE experiments are an expaanded grid of input.variables

output.expressions

list of interest output from the code. Will become the names() of return list.

run.control

list of control parameters: 'force.retry' is number of retries before failure, 'cache.dir' setup array of directories to search inside before real launching calculations.

monitor.control

list of monitor parameters: sleep (delay time between two checks of results), display.fun (function to display project cases status).

archive.dir

define an arbitrary output directory where results (cases, csv files) are stored.

out.filter

what output(s) to retreive in returned object.

verbosity

0-10, print information while running.

Value

list of array results from the code, arrays size being equal to input.variables arrays size.

Examples

## Not run: 
# Basic response surface of Branin function. R is used as the model, for testing purpose.
calcs = startCalculators(5) # Will start calculator instances later used by Run()
Run(model = "R",
  input.files = file.path(Funz:::FUNZ_HOME,"samples","branin.R"),
  input.variables = list(x1=seq(0,1,by=0.1),x2=seq(0,1,by=0.1)),
  all.combinations=TRUE,
  output.expressions = "z")
persp(z=matrix(unlist(.Funz.Last.run$results$z),nrow=11),zlab="z")
stopCalculators(calcs) # Shutdown calculators (otherwise stay in background)

# More realistic case using Modelica. Assumes that (Open)Modelica is already installed.
install.Model("Modelica") # Install Modelica plugin
calcs = startCalculators(5) # Will start calculator instances later used by Run()
NewtonCooling = Run(model = "Modelica",
  input.files = file.path(Funz:::FUNZ_HOME,"samples","NewtonCooling.mo.par"),
  input.variables = list(convection=seq(0.001,1,by=0.05)),
  output.expressions = "min(T)")
plot(NewtonCooling$convection, NewtonCooling$`min(T)`)
stopCalculators(calcs) # Shutdown calculators (otherwise stay in background)

## End(Not run)

Funz/Funz.R documentation built on Jan. 28, 2024, 11:39 p.m.