Scheme code evaluation#

Each session provides an instance of SchemeEval on which Fluent’s scheme code can be executed.

class ansys.fluent.core.services.scheme_eval.Symbol(str)#

Class representing the symbol datatype in Fluent.

Attributes:
strstr

Underlying string representation

class ansys.fluent.core.services.scheme_eval.SchemeEval(service)#

Class on which Fluent’s scheme code can be executed.

Methods

eval(val)

Evaluates a scheme expression, returns Python value

exec(commands, wait, silent)

Executes a sequence of scheme commands, returns TUI output string

string_eval(input)

Evaluates a scheme expression in string format, returns string

scheme_eval(input)

Evaluates a scheme expression in string format, returns Python value

eval(val)#

Evaluates a scheme expression.

Parameters:
valAny

Input scheme expression represented as Python datatype

Returns:
Any

Output scheme value represented as Python datatype

Return type:

Any

exec(commands, wait=True, silent=True)#

Executes a sequence of scheme commands.

Parameters:
commandsSequence[str]

Sequence of scheme commands in string format

waitbool, optional

Specifies whether to wait until execution completes, by default True

silentbool, optional

Specifies whether to execute silently, by default True

Returns:
str

Output as string

Return type:

str

scheme_eval(input)#

Evaluates a scheme expression in string format.

Parameters:
inputstr

Input scheme expression in string format

Returns:
str

Output scheme value represented as Python datatype

Return type:

Any

string_eval(input)#

Evaluates a scheme expression in string format.

Parameters:
inputstr

Input scheme expression in string format

Returns:
str

Output scheme value in string format

Return type:

str

Examples#

>>> from ansys.fluent.core.services.scheme_eval import Symbol as S
>>> session.scheme_eval.eval([S('+'), 2, 3])
5
>>> session.scheme_eval.eval([S('rpgetvar'), [S('string->symbol'), "mom/relax"]])
0.7
>>> session.scheme_eval.exec(('(ti-menu-load-string "/report/system/proc-stats")',))
>>> # Returns TUI output string
>>> session.scheme_eval.string_eval("(+ 2 3)")
'5'
>>> session.scheme_eval.string_eval("(rpgetvar 'mom/relax)")
'0.7'
>>> session.scheme_eval.scheme_eval("(+ 2 3)")
5
>>> session.scheme_eval.scheme_eval("(rpgetvar 'mom/relax)")
0.7