Skip to content

Conversation

mkundu1
Copy link
Contributor

@mkundu1 mkundu1 commented Jan 23, 2024

The AutoPauseEvent included in the new version can be used to implement #2361 - execute a Python callback in PyFluent at the end of each time-step. Following is a working code which can be expanded into a PyFluent feature.

solver.tui.solve.execute_commands.add_edit(
    "command-1",
    "no",
    1,
    "time-step",
    "\"(events/transmit 'auto-pause (cons 2 (rpgetvar 'time-step)))(grpcserver/auto-pause (is-server-running?) 'pyfluent)\""
)

indices = []
def on_pause(session_id, event_info):
    indices.append(event_info.index)
    solver.scheme_eval.scheme_eval('(grpcserver/auto-resume (is-server-running?) "pyfluent")')

solver.events_manager.register_callback("AutoPauseEvent", on_pause)

@mkundu1 mkundu1 merged commit b32e1df into main Jan 23, 2024
@mkundu1 mkundu1 deleted the maint/ansys-api-version branch January 23, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants