The pyfluent.py module#

Summary#

PyFluentBackend

Persistent PyFluent Solver session.

resolve_fluent_launch_config

Merge caller overrides with stock launch defaults.

Description#

PyFluent backend for the Solve leaf.

Holds a persistent ansys.fluent.core.Solver session. All live-context work delegates to ansys.fluent.mcp.common.introspection so the logic is generic and caller-driven. There is no hardcoded list of named-object collections. This matches the behavior of the legacy /fluent_get_targeted_context endpoint in aali-flowkit-python.

PyFluent is an optional dependency. Install with this command:

pip install ansys-fluent-mcp[pyfluent]

If Pyfluent is not importable, connect() returns a typed error instead of raising at import time.

Module detail#

pyfluent.resolve_fluent_launch_config(*, precision: str = FLUENT_LAUNCH_DEFAULTS['precision'], processor_count: int = FLUENT_LAUNCH_DEFAULTS['processor_count'], ui_mode: str = FLUENT_LAUNCH_DEFAULTS['ui_mode'], product_version: str | None = None, dimension: int | str | None = None, mode: str | None = None, gpu: bool | list[int] | str | None = None, journal_file_names: str | list[str] | None = None, case_file_name: str | None = None, case_data_file_name: str | None = None, cwd: str | None = None, fluent_path: str | None = None, env: dict[str, Any] | None = None, graphics_driver: str | None = None, scheduler_options: dict[str, Any] | None = None, start_timeout: int | None = None, cleanup_on_exit: bool | None = None, additional_arguments: str | None = None) dict[str, Any]#

Merge caller overrides with stock launch defaults.

Returns the effective configuration. What is actually launched with is echoed back to the user. Only keys the caller explicitly set (or that have non-None defaults) appear. gpu stays absent for CPU unless the user opted in.

Parameters:
precisionstr

Precision to supply to the function.

processor_countint

Processor count to supply to the function.

ui_modestr

Ui mode to supply to the function.

product_versionOptional[str]

Product version to supply to the function.

dimensionOptional[int | str]

Dimension to supply to the function.

modeOptional[str]

Mode to supply to the function.

gpuOptional[bool | list[int] | str]

GPU to supply to the function.

journal_file_namesOptional[str | list[str]]

Journal file names to supply to the function.

case_file_nameOptional[str]

Case file name to supply to the function.

case_data_file_nameOptional[str]

Case data file name to supply to the function.

cwdOptional[str]

Command to supply to the function.

fluent_pathOptional[str]

Fluent path to supply to the function.

envOptional[dict[str, Any]]

Environment mapping to read instead of the process environment.

graphics_driverOptional[str]

Graphics driver to supply to the function.

scheduler_optionsOptional[dict[str, Any]]

Scheduler options to supply to the function.

start_timeoutOptional[int]

Start timeout to supply to the function.

cleanup_on_exitOptional[bool]

Cleanup on exit to supply to the function.

additional_argumentsOptional[str]

Additional arguments to supply to the function.

Returns:
dict[str, Any]

Mapping containing the operation result.

pyfluent.FLUENT_LAUNCH_DEFAULTS: dict[str, Any]#
pyfluent.logger#