launcher#

Module for launching a local instance of Ansys TurboGrid.

Classes:

TurboGridVersion(value)

Provide an enumeration over supported TurboGrid versions.

Functions:

get_latest_ansys_version()

Get the latest installed Ansys version from AWP_ROOTxxx environment variables.

get_turbogrid_exe_path(**launch_argvals)

Get the path to a local installation of TurboGrid.

launch_turbogrid([product_version, ...])

Launch TurboGrid locally in server mode.

launch_turbogrid_ansys_labs([...])

Launch TurboGrid from within the Ansys Labs environment.

launch_turbogrid_container(...)

class ansys.turbogrid.core.launcher.launcher.TurboGridVersion(value)#

Bases: Enum

Provide an enumeration over supported TurboGrid versions.

Attributes:

version_23R2

version_24R1

version_24R2

version_25R1

version_23R2 = '23.2.0'#
version_24R1 = '24.1.0'#
version_24R2 = '24.2.0'#
version_25R1 = '25.1.0'#
ansys.turbogrid.core.launcher.launcher.get_latest_ansys_version() str#

Get the latest installed Ansys version from AWP_ROOTxxx environment variables.

Note

The xxx is the three-digit Ansys version. For example, the AWP_ROOT232 environment variable specifies the path to the directory where Ansys 2023 R2 is installed. If Ansys 2023 R2 is installed in the default directory on Windows, the value for this environment variable is C:\Program Files\ANSYS Inc\v232.

Returns#

str

Latest installed Ansys version in this format: "23.2.0".

ansys.turbogrid.core.launcher.launcher.get_turbogrid_exe_path(**launch_argvals) Path#

Get the path to a local installation of TurboGrid.

The path is obtained by searching in this order:

  1. The path specified by the turbogrid_path parameter from launch_argvals.

  2. The path specified by the PYTURBOGRID_TURBOGRID_ROOT environment variable.

  3. The path of the TurboGrid installation specified by the product_version parameter from launch_argvals, using the corresponding AWP_ROOTxxx environment variable.

  4. The path of the TurboGrid installation from the AWP_ROOTxxx environment variable for the latest installed Ansys version.

Returns#

Path

Path of a local TurboGrid installation.

ansys.turbogrid.core.launcher.launcher.launch_turbogrid(product_version: str | None = None, turbogrid_path: str | None = None, log_level: TurboGridLogLevel = TurboGridLogLevel.INFO, turbogrid_location_type=TurboGridLocationType.TURBOGRID_INSTALL, additional_args_str: str | None = None, additional_kw_args: dict | None = None, port: int | None = None, host: str = '127.0.0.1', log_filename_suffix: str = '', **kwargs) PyTurboGrid#

Launch TurboGrid locally in server mode.

Parameters#

product_versionstr, default: None

Version of TurboGrid to use in the numeric format. For example, "23.2.0" for 2023 R2. The default is None, in which case the latest installed version is used.

turbogrid_pathstr, default: None

Path to the cfxtg command for starting TurboGrid. The default is None, in which case the value for the product_version parameter is used.

log_levelpyturbogrid_core.PyTurboGrid.TurboGridLogLevel, default: INFO

Level of logging information written to the terminal. The default is INFO. Options are INFO, WARNING, ERROR, CRITICAL, and DEBUG. This setting also affects the level of output that is written to the log files.

additional_args_strstr, default: None

Additional arguments to send to TurboGrid.

additional_kw_argsdict, default: None

Additional arguments to send to TurboGrid.

portint, default: None

Port for TurboGrid communications. The default is None, in which case an available port is automatically selected.

hoststr, default: 127.0.0.1 (this is the local host IP for windows and linux)

Host for TurboGrid communications. The default is 127.0.0.1, or the local host

log_filename_suffixstr, default: “”

Suffix for name of the log files written out.

Returns#

pyturbogrid_core.PyTurboGrid

TurboGrid session.

ansys.turbogrid.core.launcher.launcher.launch_turbogrid_ansys_labs(product_version: str = 'latest', log_level: TurboGridLogLevel = TurboGridLogLevel.INFO) PyTurboGrid#

Launch TurboGrid from within the Ansys Labs environment.

Parameters#

product_versionstr, default: latest

Version of TurboGrid to launch in the Ansys Labs environment. Only certain versions are supported.

log_levelpyturbogrid_core.PyTurboGrid.TurboGridLogLevel, default: INFO

Level of logging information written to the terminal. The default is INFO. Options are INFO, WARNING, ERROR, CRITICAL, and DEBUG. This setting also affects the level of output that is written to the log files.

Returns#

pyturbogrid_core.PyTurboGrid

TurboGrid session.

ansys.turbogrid.core.launcher.launcher.launch_turbogrid_container(cfxtg_command_name, image_name, container_name, cfx_version, license_file, keep_stopped_containers, container_env_dict) deployed_tg_container#