In finite element software, there is a notion of an ‘input file’, that is, input to the solver program, that contains the mesh, the boundary conditions, material properties, algorithmic choices and so on. In their full generality, boundary conditions are functions that map (timestep, coordinate) to a scalar or vector. What is the best way to implement functions as part of the input file? My current thinking is that the input file should have anonymous functions written in the Julia source language (with the `->`

operator). The solver can call ‘parse’ on these and then store the resulting expression in a dictionary: `Dict{DOFIndex, Function}`

, where `DOFIndex`

is the index of the degree-of-freedom to which the condition is applied. This raises a few questions:

(1) Is there a better approach?

(2) After the solver has parsed these anonymous functions and stored them in the Dict, what steps are necessary to prevent an excessive amount of run-time dispatch? Type annotations?

(3) If, down the road, this code is published, then I would like the solver to have safeguards that ensure that the anonymous functions in the ‘input file’ don’t have unwanted or even malicious side effects. Is there a notion of ‘safe’ functions in Julia, or perhaps a way to execute a function in a sandbox?

Thanks,

Steve Vavasis