2.3. Customizing Workflows

By default, the guided workflows consist of several existing tasks that represent common operations for mesh preparation. In addition, you can add and remove certain tasks as needed, depending on where you are in the workflow, and the specific level of complexity for your own desired workflow. Each task requires certain inputs and provides certain outputs that other tasks may depend upon, so only certain task may be available to add to the workflow, depending on previous tasks.

The tasks available for the Watertight Geometry workflow are described in Using the Watertight Geometry Meshing Guided Workflows, whereas the tasks available for the Fault-tolerant Meshing workflow are described in Using the Fault-tolerant Meshing Workflow.

The following tasks can be added to a workflow multiple times:

  • Update Regions

  • Add Boundary Type

  • Update Boundaries

  • Run Custom Journal

Customized workflows can be saved and reused later. For more information, see Saving and Loading Workflows.

Standard journals (Creating and Reading Journal Files) are supported in the workflows as well. While using the workflows, only the values that you change are recorded in the journal, making them cleaner and easier to read. Any workflow-related commands use the workflow prefix. For example:

...
(%py-exec "workflow.InitializeWorkflow(WorkflowType=r'Watertight Geometry')")
(%py-exec "workflow.TaskObject['Import Geometry'].Arguments.set_state(
{r'FileName': r'D:/sample/elbow.scdoc',})")
(%py-exec "workflow.TaskObject['Import Geometry'].Execute()")
...
(%py-exec "workflow.TaskObject['Describe Geometry'].Execute()")
(cx-use-window-id 1)
(cx-set-camera-relative '(38.4549 14.9899 -8.62383) '(0 0 0) 
'(-0.0370945 -0.0108113 -0.141883) 0 0)
(cx-use-window-id 1)
(cx-set-camera-relative '(24.2404 9.77983 -16.4746) '(0 0 0) 
'(-0.0533986 -0.0213353 -0.0927949) 0 0)
(%py-exec "workflow.TaskObject['Create Regions'].Arguments.set_state(
{r'NumberOfFlowVolumes': 6,})")
...

Customized journal files can be created and added to either workflow (Running Custom Journal Commands), and must be created from scratch (that is, in a fresh, new Fluent Meshing session). The following example demonstrates a customized scoped prism control file for boundary layers. The example creates prism controls and sets various properties such as the name, type, first height, etc.

(
("fuselage-prisms" "last-ratio" 0.2 6 40 1.3 "fluid-1" "fluid-regions" "" 
"selected-face-zones" "*fuselage*")
("rest-prisms" "last-ratio" 0.1 8 40 1.1 "fluid-1" "fluid-regions" "" "selected-face-zones" 
"*fin* *pylon* *pod* *wing* ")
)

Custom journal scripts (or even another upstream task) may, occasionally, lead to zone name changes. These zone name changes make it potentially difficult to later correctly identify zones, and leads to potential problems with other zone-based tasks. Fluent alleviates this problem by using a zone's bounding box to identify a zone based on its location, rather than by its name.

2.3.1. Customizing Your Journal Files Using Python

More advanced customizations are available using a Python interface that can provide easier access to all meshing workflow commands and their values.

  • To access the Python console, enter the following in the Fluent Meshing console window:

    Meshing> (%py-console)

    This provides you with access to a Python interface where you can interact with Fluent Meshing workflow commands.

  • You can obtain specific information about a workflow task using the help() method for a specific TaskObject in the workflow, as in

    workflow.TaskObject['<task-name>'].help()

    where <task-name> refers to any named task in the workflows. For instance, the following is an example of the Import Geometry task:

    >>> workflow.TaskObject['Import Geometry'].help()
    NamedObject: TaskObject (Import Geometry)
      Currently active: True
      Members: 
      String: TaskType
        Currently active: True
        Allowed values: [Simple, Composite, Compound, Conditional, Compound Child]
      String: ObjectPath
        Currently active: True
      String: CommandName
        Currently active: True
      ListString: TaskList
        Currently active: False
        Default value: []
      ListString: InactiveTaskList
        Currently active: False
        Default value: []
      String: State
        Currently active: True
        Allowed values: [Out-of-date, Attention-required, Up-to-date, Forced-up-to-date]
      ListString: Errors
        Currently active: True
      ListString: Warnings
        Currently active: True
      Dict: Arguments
        Currently active: True
        Default value: {}
    
        A valid state template, derived from the corresponding ImportGeometry command, 
        which can be assigned to this Arguments object:
          {r'AppendMesh': False,r'CadImportOptions': {r'CreateCADAssemblies': False,
    r'ExtractFeatures': True,r'FeatureAngle': 40,r'ImportCurvatureDataFromCAD': True,
    r'ImportNamedSelections': True,r'ImportPartNames': False,r'OneObjectPer': r'Program-controlled',
    r'OneZonePer': r'Body',r'OpenAllCadInSubdirectories': False,r'SavePMDBIntermediateFile': False,
    r'UsePartOrBodyAsSuffix': False,},r'Directory': None,r'FileFormat': r'CAD',r'FileName': None,
    r'ImportCadPreferences': {r'CIRefaceting': False,r'CISeparation': r'none',r'CISeparationAngle': 40,
    r'CITolerence': 0,r'EdgeLabel': r'no',r'MaxFacetLength': 0,r'ShowImportCadPreferences': False,},
    r'ImportType': r'Single File',r'LengthUnit': r'mm',r'MeshFileName': None,r'MeshUnit': r'm',
    r'NumParts': None,r'Pattern': None,}
    
        Valid dict elements, derived from the corresponding ImportGeometry command:
          String: FileFormat
            Display text: File Format
            Currently active: True
            Default value: CAD
            Allowed values: [CAD, Mesh]
          String: LengthUnit
            Display text: Units
            Currently active: True
            Default value: mm
            Allowed values: [m, cm, mm, in, ft, um, nm]
          String: MeshUnit
            Display text: File Units
            Currently active: False
            Default value: m
            Allowed values: [m, cm, mm, in, ft, um, nm]
          String: FileName
            Display text: File Name
            Currently active: True
          String: MeshFileName
            Display text: File Name
            Currently active: False
          Real: NumParts
            Display text: Number of Parts
            Currently active: True
          String: ImportType
            Display text: Import Type
            Currently active: True
            Default value: Single File
            Allowed values: [Single File, Directory Pattern]
          Bool: AppendMesh
            Display text: Append Mesh
            Currently active: True
            Default value: False
          String: Directory
            Display text: Directory
            Currently active: True
          String: Pattern
            Display text: Pattern
            Currently active: True
          Struct: ImportCadPreferences
            Display text: Import Geometry Preferences
            Currently active: True
            Members: 
            Bool: ShowImportCadPreferences
              Display text: Advanced Options
              Currently active: True
              Default value: False
            String: CISeparation
              Display text: Separate Zone By
              Currently active: False
              Default value: none
              Allowed values: [none, region, region & angle]
            Real: CISeparationAngle
              Display text: Separation Angle [deg]
              Currently active: False
              Default value: 40
              Minumum value: 0
            Real: CITolerence
              Display text: Tolerance
              Currently active: False
              Default value: 0
              Minumum value: 0
            Real: MaxFacetLength
              Display text: Max Facet Length
              Currently active: False
              Default value: 0
              Minumum value: 0
            Bool: CIRefaceting
              Display text: Use custom faceting
              Currently active: False
              Default value: False
          Struct: CadImportOptions
            Currently active: True
            Members: 
            String: OneObjectPer
              Display text: One Object Per
              Currently active: True
              Default value: Program-controlled
              Allowed values: [Body, Part, File, Selection, Program-controlled]
    
    
  • To print all available commands, use the following:

    >>> dir(meshing)

    Note that commands use a similar naming convention that reflects the names of the actual tasks in the workflow (for example, CreateRegions or ModifyMeshRefinement).

  • To print all arguments for a command, use its help() method, for instance:

    >>>meshing.ImportGeometry.help()

    When viewing the listing of a command's arguments, you will notice that the command's arguments are named similarly to the actual fields for the corresponding task in the workflow. In addition, for each argument, there are allowed values, default values, display text, and so forth.

    Each object also contains its own help text, containing usage examples that can be easily copied and pasted into your journal files.

    The following is an example using the help() method for the ImportGeometry object:

    >>> meshing.ImportGeometry.help()
    Command: ImportGeometry
    Supported keyword arguments:
      String: FileFormat
        Display text: File Format
        Currently active: True
        Default value: CAD
        Allowed values: [CAD, Mesh]
      String: LengthUnit
        Display text: Units
        Currently active: True
        Default value: mm
        Allowed values: [m, cm, mm, in, ft, um, nm]
      String: MeshUnit
        Display text: File Units
        Currently active: False
        Default value: m
        Allowed values: [m, cm, mm, in, ft, um, nm]
      String: FileName
        Display text: File Name
        Currently active: True
      String: MeshFileName
        Display text: File Name
        Currently active: False
      Struct: ImportCadPreferences
        Display text: Import Geometry Preferences
        Currently active: True
        Members: 
        Bool: ShowImportCadPreferences
          Display text: Advanced Options
          Currently active: True
          Default value: False
        String: CISeparation
          Display text: Separate Zone By
          Currently active: False
          Default value: none
          Allowed values: [none, region, region & angle]
        Real: CISeparationAngle
          Display text: Separation Angle [deg]
          Currently active: False
          Default value: 40
          Minumum value: 0
        Real: CITolerence
          Display text: Tolerance
          Currently active: False
          Default value: 0
          Minumum value: 0
        Real: MaxFacetLength
          Display text: Max Facet Length
          Currently active: False
          Default value: 0
          Minumum value: 0
        Bool: CIRefaceting
          Display text: Use custom faceting
          Currently active: False
          Default value: False
      Struct: CadImportOptions
        Currently active: True
        Members: 
        String: OneObjectPer
          Display text: One Object Per
          Currently active: True
          Default value: Program-controlled
          Allowed values: [Body, Part, File, Selection, Program-controlled]
      
    Example usage: 
      ImportGeometry(CadImportOptions={r'OneObjectPer': r'Program-controlled',}, 
    FileFormat=r'CAD', FileName=None, ImportCadPreferences={r'ShowImportCadPreferences': False,}, 
    LengthUnit=r'mm')