32.5. Meshing Workflow Objects

The Python Console is also available in Fluent's meshing mode, where you can interact with Fluent's Pythonic meshing interface. From here, you have access to either the general purpose Fluent meshing text user interface (using the tui object) or to a datamodel-driven structure of workflows, tasks, and their settings (using the workflow object).

The tui object makes available general Fluent meshing tools such as mesh, boundary, material_point, size_functions, display, report, diagnostics, and more.

The workflow object makes available access to either the Watertight Geometry or the Fault-tolerant Meshing workflow. Each workflow has a series of tasks that are designed to streamline the meshing process. Once you initialize a specific workflow (using the InitializeWorkflow method), you can then access the corresponding tasks therein (using the TaskObject object) and make various adjustments to their settings .

For example:

>>> meshing.workflow.InitializeWorkflow(WorkflowType='Watertight Geometry')
>>> meshing.workflow.TaskObject['Import Geometry'].Arguments = {'FileName' : 
'manifold.scdoc', 'LengthUnit' : 'in'}
>>> meshing.workflow.TaskObject['Import Geometry'].Execute()

32.5.1. Meshing Workflow Command Argument Objects

The Fluent meshing workflows primarily use a series of tasks that need to be performed in a particular order, where each particular task has a series of related settings. As such, the workflow's tasks act as commands and the task settings effectively act as command arguments. Thus, it is useful to represent command arguments as objects, where you can use corresponding commands to create and delete command argument objects as needed (create_instance() for instance). You can subsequently create instances of such command objects and their arguments, allowing you to control the command objects, edit their arguments, query their attributes, and delete the instances as needed.

For instance, consider the Import Geometry task of the Watertight Geometry meshing workflow, where you can set the CAD file name, its file type, its length units, and so forth, prior to updating the task. In the Python Console, you could write:

>>> import_geometry = meshing.ImportGeometry.create_instance()
>>> import_geometry.get_state()
{'CadImportOptions': {'OneObjectPer': 'Program-controlled'}, 'FileFormat': 'CAD', 'FileName': None, 
'ImportCadPreferences': {'ShowImportCadPreferences': False}, 'ImportType': 'Single File', 
'LengthUnit': 'mm', 'UseBodyLabels': 'No'}
>>> 

From this new instance of the ImportGeometry object (import_geometry), the get_state() method lists the available arguments that you can set for this command object. From here, you edit those arguments and query their attributes just like any other state. The command can also then be executed using the execute() method.

Objects can also expose attribute methods such as is_active(), is_read_only(), allowed_values(), default_value(), min(), and max().

In order to determine whether an argument is active or not, you can perform a check:

>>> import_geometry.get_state()
{'CadImportOptions': {'OneObjectPer': 'Program-controlled'}, 'FileFormat': 'CAD', 'FileName': None, 
'ImportCadPreferences': {'ShowImportCadPreferences': False}, 'ImportType': 'Single File', 
'LengthUnit': 'mm', 'UseBodyLabels': 'No'}
>>> import_geometry.ImportType.is_active()
True

Note:  These objects and methods are available when performing Python scripting with respect to the meshing workflows and the various Fluent workspaces.