BOUT-dev
BOUT-dev copied to clipboard
Add ability to use variables from grid file in input file expressions
This adds the ability to read fields (2D and 3D) and doubles* from the grid file (mesh:file) and use them in expressions in the input file, for example to use coordinates directly from the grid generator:
[input:grid_variables]
rho = field2d
theta = field2d
scale = boutreal
[mesh]
B = (scale / rho) * cos(theta)
* ints can also be read, but the expression parser only handles doubles
This could also be used for something like region labels to the input file by having hypnotoad make a field which is 1.0 in that region and 0.0 elsewhere:
region_pfr = 1.0 if is_in_pfr else 0.0
and using like
[input:grid_variables]
region_pfr = field2d
[some_source]
function = region_pfr * cos(x) * whatever
We could probably also do this in BOUT++ directly, making fields for each boundary region.