pyturbogrid_core#

Module in the ansys-turbogrid-api package that is internally used by modules in the pyturbogrid package for interactions with a running Ansys TurboGrid application.

class PyTurboGrid#

This class enables you to launch, interact with, and quit, a session of TurboGrid. Refer to the launcher module to see how to create an instance of this class.

__init__(socket_port: int | None, turbogrid_location_type: TurboGridLocationType, cfxtg_location: str, additional_args_str: str | None, additional_kw_args: dict | None, log_level=TurboGridLogLevel.INFO)#
read_inf(filename: str) None#

Read a blade model from a BladeGen *.inf file.

Parameters:

filename (str) – Name or path for the Bladegen *.inf file.

read_ndf(ndffilename: str, cadfilename: str, flowpath: str, bladerow: str, bladename: str) None#

Read a blade model from an NDF (*.ndf) file. TurboGrid uses the details in the NDF file to generate and import a CAD file containing the blade geometry.

Parameters:
  • ndffilename (str) – Name or path for the NDF (*.ndf) file.

  • cadfilename (str) – Name of the CAD *.x_b file to be generated.

  • flowpath (str) – Name of the flowpath to use.

  • bladerow (str) – Name of the blade row to select.

  • bladename (str) – Name of the blade to load.

read_session(filename: str) None#

Read a session file to repeat a previous session.

Parameters:

filename (str) – Name of the session file.

read_state(filename: str) None#

Restore a previous state from a saved state file.

Parameters:

filename (str) – Name of the state file.

save_mesh(filename: str, onefile: str, onedomain: str) None#

Save generated mesh to a file.

Parameters:
  • filename (str) – Name of the mesh file to save.

  • onefile (str) – If enabled (true), write all of the available meshes to a single mesh file. The default is true.

  • onedomain (str) – If enabled (true), combine any inlet and outlet domain meshes with the passage domain, to form a single assembly. The default is true.

save_state(filename: str) None#

Save TurboGrid state into a file.

Parameters:

filename (str) – Name of the file to save.

set_global_size_factor(global_size_factor: str) None#

Set global size factor.

Parameters:

global_size_factor (str) – Value to use as size factor in string format.

set_inlet_hub_position(parametric_hub_location: str) None#

Set the parametric position of the inlet line on the hub.

Parameters:

parametric_hub_location (str) – Value to be used as parametric location in string format.

set_inlet_shroud_position(parametric_shroud_location: str) None#

Set the parametric position of the inlet line on the shroud.

Parameters:

parametric_shroud_location (str) – Value to be used as parametric location in string format.

set_obj_param(object: str, param_val_pairs: str) None#

Update the value for a CCL object parameter.

Parameters:
  • object (str) – Name with full path for the CCL object.

  • param_val_pairs (str) – Name and value pair for the parameter to set.

set_outlet_hub_position(parametric_hub_location: str) None#

Set the parametric position of the outlet line on the hub.

Parameters:

parametric_hub_location (str) – Value to be used as parametric location in string format.

set_outlet_shroud_position(parametric_shroud_location: str) None#

Set the parametric position of the outlet line on the shroud.

Parameters:

parametric_shroud_location (str) – Value to be used as parametric location in string format.

set_topology_choice(atm_topology_choice: str) None#

Set the topology method to be used for the topology set generation process.

Parameters:

atm_topology_choice (str) – Name of the topology method to be used.

Example

>>> turbogrid.set_topology_choice("Single Round Round Refined")
set_topology_list(atm_topology_list: str) None#

Set the list of topology pieces to be used for topology generation.

Parameters:

atm_topology_list (str) – The topology piece names concatenated using underscores.

Example

>>> turbogrid.set_topology_list("LECircleHigh_TECircleLow")
start_session(filename: str) None#

Start recording a new TurboGrid session.

Parameters:

filename (str) – Name of the session file.

unsuspend(object: str) None#

Unsuspend a TurboGrid object.

Parameters:

object (str) – String specifying the name and type of the object to be unsuspended.

Example

>>> turbogrid.unsuspend(object="/TOPOLOGY SET")
query_mesh_statistics(domain: str) dict#

Returns mesh quality measures from TurboGrid for the current session and specified domain. Note: It is suggested to use the mesh_statistics module instead of directly calling this.

Parameters:

domain (str) – Name of the domain from which to obtain the measurements.

Returns:

A dictionary form of the quality measurements.

Return type:

dict

query_mesh_statistics_histogram_data(variable: str, domain: str, number_of_bins: int, upper_bound: float, lower_bound: float, bin_units: str, scale: str, use_absolute_values: bool, bin_divisions: list) dict#

Returns data that can be used to plot mesh statistics histograms.

Parameters:
  • variable (str) – Name of the quality measurement to query from the statistics.

  • domain (str) – Name of the domain from which to obtain the measuments.

  • number_of_bins (int) – Number of histogram columns to use.

  • upper_bound (float) – The maximum limit for the horizontal axis.

  • lower_bound (float) – The minimum limit for the horizontal axis.

  • bin_units (str) – The unit to use for the horizontal ax1s.

  • scale (str) – Scaling type for the horizontal axis: ‘linear’ or ‘logarithmic’.

  • use_absolute_values (bool) – Choice of whether to use absolute or percentage values on the vertical axis.

  • bin_divisions (list) – User-provided bin divisions.

Returns:

A dictionary form of the statistics for the requested quality measurement.

Return type:

dict

query_valid_topology_choices() list#

Returns the permitted topology methods for the blade geometry in the current session.

Returns:

List of topology method names.

Return type:

list

quit() None#

Quit the PyTurboGrid instance.

end_session() None#

Stop recording a TurboGrid session file.