ansys.fluent.core.workflow#

Workflow module that wraps and extends the core functionality.

Classes:

ArgumentWrapper(task, arg)

Wrapper for a single task argument.

ArgumentsWrapper(task)

Wrapper for a dictionary of task arguments.

BaseTask(command_source, task)

Base class Task representation for wrapping a Workflow TaskObject instance, adding methods to discover more about the relationships between TaskObjects.

ClassicWorkflow(workflow, command_source, ...)

Wraps a meshing workflow object.

CommandTask(command_source, task)

Intermediate base class task representation for wrapping a Workflow TaskObject instance, adding attributes related to commanding.

CompositeTask(command_source, task)

Composite task representation for wrapping a Workflow TaskObject instance of TaskType Composite.

CompoundChild(command_source, task)

Compound Child representation for wrapping a Workflow TaskObject instance of TaskType Compound Child.

CompoundTask(command_source, task)

Compound task representation for wrapping a Workflow TaskObject instance of TaskType Compound.

ConditionalTask(command_source, task)

Conditional task representation for wrapping a Workflow TaskObject instance of TaskType Conditional.

ReadOnlyObject(cmd)

Removes set_state() to implement read-only behavior.

SimpleTask(command_source, task)

Simple task representation for wrapping a Workflow TaskObject instance of TaskType Simple.

TaskContainer(command_source)

Wrap a workflow TaskObject container.

Workflow(workflow, command_source, ...)

Wraps a workflow object, adding methods to discover more about the relationships between task objects.

Exceptions:

CommandInstanceCreationError(task_name)

Raised when an attempt to create an instance of a task command fails.

Functions:

camel_to_snake_case(camel_case_str)

Convert camel case input string to snake case output string.

snake_to_camel_case(snake_case_str, ...)

Populate the snake-case attribute map and return camel case of the passed attribute.

class ansys.fluent.core.workflow.ArgumentWrapper(task, arg)#

Bases: PyCallableStateObject

Wrapper for a single task argument.

Methods:

__init__(task, arg)

Initialize ArgumentWrapper.

get_state([explicit_only])

Get the state of this argument.

set_state(value)

Set the state of the argument.

__init__(task, arg)#

Initialize ArgumentWrapper.

Parameters:
taskBaseTask

The task holding these arguments.

arg: str

Argument name.

get_state(explicit_only=False)#

Get the state of this argument.

Parameters:
explicit_onlybool

Whether to return the explicitly set value or the full derived value.

set_state(value)#

Set the state of the argument.

Parameters:
valueAny

Value of the argument.

class ansys.fluent.core.workflow.ArgumentsWrapper(task)#

Bases: PyCallableStateObject

Wrapper for a dictionary of task arguments.

Methods:

__init__(task)

Initialize ArgumentsWrapper.

get_state([explicit_only])

Get the state of the arguments.

set_state(args)

Overwrite arguments.

update_dict(args)

Merge with arguments.

__init__(task)#

Initialize ArgumentsWrapper.

Parameters:
taskBaseTask

Task holding these arguments.

get_state(explicit_only=False)#

Get the state of the arguments.

Parameters:
explicit_onlybool

Whether to only include explicitly set values. Otherwise, all values are included.

set_state(args)#

Overwrite arguments.

Parameters:
argsdict

State of the arguments.

Raises:
ValueError

If input is invalid.

update_dict(args)#

Merge with arguments.

Parameters:
argsdict

State of the arguments.

Raises:
ValueError

If input is invalid.

class ansys.fluent.core.workflow.BaseTask(command_source, task)#

Bases: object

Base class Task representation for wrapping a Workflow TaskObject instance, adding methods to discover more about the relationships between TaskObjects.

Methods

get_direct_upstream_tasks()

get_direct_downstream_tasks()

tasks()

inactive_tasks()

get_id()

get_idx()

__getattr__(attr)

__setattr__(attr, value)

__dir__()

__call__()

Methods:

__init__(command_source, task)

Initialize BaseTask.

add_child_to_task()

Add a child task.

delete()

Delete this task from the workflow.

display_name()

Display name.

get_direct_downstream_tasks()

Get the list of tasks downstream of this one and directly connected by a data dependency.

get_direct_upstream_tasks()

Get the list of tasks upstream of this one and directly connected by a data dependency.

get_id()

Get the unique string identifier of this task, as it is in the application.

get_idx()

Get the unique integer index of this task, as it is in the application.

inactive_tasks()

Get the inactive ordered child list.

mark_as_updated()

Mark tasks in workflow as updated.

python_name()

Get the Pythonic name of this task from the underlying application.

rename(new_name)

Rename the current task to a given name.

task_names()

Get the list of the Python names for the available tasks.

tasks([recompute])

Get the ordered task list held by this task.

update_child_tasks(setup_type_changed)

Update child tasks.

Attributes:

insertable_tasks

Tasks that can be inserted after the current task.

__init__(command_source, task)#

Initialize BaseTask.

Parameters:
command_sourceWorkflowWrapper

Set of workflow commands.

taskstr

Name of this task.

add_child_to_task()#

Add a child task.

delete()#

Delete this task from the workflow.

display_name()#

Display name.

get_direct_downstream_tasks()#

Get the list of tasks downstream of this one and directly connected by a data dependency.

Returns:
list

Downstream task list.

get_direct_upstream_tasks()#

Get the list of tasks upstream of this one and directly connected by a data dependency.

Returns:
list

Upstream task list.

get_id()#

Get the unique string identifier of this task, as it is in the application.

Returns:
str

The string identifier.

get_idx()#

Get the unique integer index of this task, as it is in the application.

Returns:
int

The integer index.

inactive_tasks()#

Get the inactive ordered child list.

Returns:
list

Inactive ordered children.

property insertable_tasks#

Tasks that can be inserted after the current task.

mark_as_updated()#

Mark tasks in workflow as updated.

python_name()#

Get the Pythonic name of this task from the underlying application.

Returns:
str

Pythonic name of the task.

rename(new_name)#

Rename the current task to a given name.

task_names()#

Get the list of the Python names for the available tasks.

tasks(recompute=True)#

Get the ordered task list held by this task.

This method sort tasks in terms of the workflow order and only includes this task’s top-level tasks. You can obtain other tasks by calling the tasks() method on a parent task.

Given the workflow:

Workflow
├── A
├── B
│   ├── C
│   └── D
└── E

C and D are the ordered children of task B.

Returns:
list

Ordered children.

update_child_tasks(setup_type_changed)#

Update child tasks.

class ansys.fluent.core.workflow.ClassicWorkflow(workflow, command_source, fluent_version)#

Bases: object

Wraps a meshing workflow object.

Methods

__getattr__(attr)

__dir__()

__call__()

Attributes:

TaskObject

Get a TaskObject container wrapper that 'holds' the underlying TaskObjects.

Methods:

__init__(workflow, command_source, ...)

Initialize ClassicWorkflow.

property TaskObject: TaskContainer#

Get a TaskObject container wrapper that ‘holds’ the underlying TaskObjects.

The wrapper adds extra functionality.

__init__(workflow, command_source, fluent_version)#

Initialize ClassicWorkflow.

Parameters:
workflowPyMenuGeneric

The workflow object.

command_sourcePyMenuGeneric

The application root for commanding.

exception ansys.fluent.core.workflow.CommandInstanceCreationError(task_name)#

Bases: RuntimeError

Raised when an attempt to create an instance of a task command fails.

Methods:

__init__(task_name)

Initialize CommandInstanceCreationError.

__init__(task_name)#

Initialize CommandInstanceCreationError.

class ansys.fluent.core.workflow.CommandTask(command_source, task)#

Bases: BaseTask

Intermediate base class task representation for wrapping a Workflow TaskObject instance, adding attributes related to commanding.

Classes without these attributes cannot be commanded.

Methods:

__init__(command_source, task)

Initialize CommandTask.

Attributes:

arguments

Get the task's arguments.

command_arguments

Get the task's arguments in read-only form (deprecated).

__init__(command_source, task)#

Initialize CommandTask.

Parameters:
command_sourceWorkflowWrapper

The set of workflow commands.

taskstr

The name of this task.

property arguments: ArgumentsWrapper#

Get the task’s arguments.

Returns:
ArgumentsWrapper

The task’s arguments.

property command_arguments: ReadOnlyObject#

Get the task’s arguments in read-only form (deprecated).

Returns:
ReadOnlyObject

The task’s arguments.

class ansys.fluent.core.workflow.CompositeTask(command_source, task)#

Bases: BaseTask

Composite task representation for wrapping a Workflow TaskObject instance of TaskType Composite.

Methods:

__init__(command_source, task)

Initialize CompositeTask.

insert_composite_child_task(command_name)

Insert a composite child task based on the Python name.

Attributes:

arguments

Get the task's arguments (empty for CompositeTask).

command_arguments

Get the task's arguments in read-only form (deprecated).

__init__(command_source, task)#

Initialize CompositeTask.

Parameters:
command_sourceWorkflowWrapper

The set of workflow commands.

taskstr

The name of this task.

property arguments: dict#

Get the task’s arguments (empty for CompositeTask).

Returns:
dict

The task’s arguments (empty).

property command_arguments: ReadOnlyObject#

Get the task’s arguments in read-only form (deprecated).

Returns:
ReadOnlyObject

The task’s arguments.

insert_composite_child_task(command_name)#

Insert a composite child task based on the Python name.

class ansys.fluent.core.workflow.CompoundChild(command_source, task)#

Bases: SimpleTask

Compound Child representation for wrapping a Workflow TaskObject instance of TaskType Compound Child.

Methods:

__init__(command_source, task)

Initialize CompoundChild.

python_name()

Get the Pythonic name of this task.

__init__(command_source, task)#

Initialize CompoundChild.

Parameters:
command_sourceWorkflowWrapper

The set of workflow commands.

taskstr

The name of this task.

python_name()#

Get the Pythonic name of this task.

Returns:
str

Pythonic name of the task.

class ansys.fluent.core.workflow.CompoundTask(command_source, task)#

Bases: CommandTask

Compound task representation for wrapping a Workflow TaskObject instance of TaskType Compound.

Methods:

__init__(command_source, task)

Initialize CompoundTask.

add_child_and_update([state, defer_update])

Add a child to this CompoundTask and update.

compound_child(name)

Get the compound child task of this CompoundTask by name.

insert_compound_child_task()

Insert a compound child task.

last_child()

Get the last child of this CompoundTask and set their Python name.

__init__(command_source, task)#

Initialize CompoundTask.

Parameters:
command_sourceWorkflowWrapper

The set of workflow commands.

taskstr

The name of this task.

add_child_and_update(state=None, defer_update=None)#

Add a child to this CompoundTask and update.

Parameters:
statedict | None

Optional state.

defer_updatebool, default: False

Whether to defer the update.

compound_child(name)#

Get the compound child task of this CompoundTask by name.

Parameters:
namestr

name

Returns:
BaseTask

the named child of this CompoundTask

insert_compound_child_task()#

Insert a compound child task.

last_child()#

Get the last child of this CompoundTask and set their Python name.

Returns:
BaseTask

the last child of this CompoundTask

class ansys.fluent.core.workflow.ConditionalTask(command_source, task)#

Bases: CommandTask

Conditional task representation for wrapping a Workflow TaskObject instance of TaskType Conditional.

Methods:

__init__(command_source, task)

Initialize ConditionalTask.

inactive_tasks()

Get the inactive ordered task list held by this task.

__init__(command_source, task)#

Initialize ConditionalTask.

Parameters:
command_sourceWorkflowWrapper

The set of workflow commands.

taskstr

The name of this task.

inactive_tasks()#

Get the inactive ordered task list held by this task.

Returns:
list

Inactive ordered children.

class ansys.fluent.core.workflow.ReadOnlyObject(cmd)#

Bases: object

Removes set_state() to implement read-only behavior.

Methods:

__init__(cmd)

Initialize this object.

is_read_only()

Get the read-only status of this object.

__init__(cmd)#

Initialize this object.

is_read_only()#

Get the read-only status of this object.

class ansys.fluent.core.workflow.SimpleTask(command_source, task)#

Bases: CommandTask

Simple task representation for wrapping a Workflow TaskObject instance of TaskType Simple.

Methods:

__init__(command_source, task)

Initialize SimpleTask.

tasks([recompute])

Get the ordered task list held by the workflow.

__init__(command_source, task)#

Initialize SimpleTask.

Parameters:
command_sourceWorkflowWrapper

The set of workflow commands.

taskstr

The name of this task.

tasks(recompute=True)#

Get the ordered task list held by the workflow.

SimpleTasks have no TaskList.

class ansys.fluent.core.workflow.TaskContainer(command_source)#

Bases: PyCallableStateObject

Wrap a workflow TaskObject container.

Methods

__iter__()

__getitem__(attr)

__getattr__(attr)

__dir__()

Methods:

__init__(command_source)

Initialize TaskContainer.

get_state()

Get state.

items()

Get state items.

__init__(command_source)#

Initialize TaskContainer.

Parameters:
command_sourceWorkflowWrapper

The set of workflow commands.

get_state()#

Get state.

items()#

Get state items.

class ansys.fluent.core.workflow.Workflow(workflow, command_source, fluent_version)#

Bases: object

Wraps a workflow object, adding methods to discover more about the relationships between task objects.

Methods

tasks()

__getattr__(attr)

__dir__()

__call__()

Methods:

__init__(workflow, command_source, ...)

Initialize WorkflowWrapper.

delete_tasks(list_of_tasks)

Delete the provided list of tasks.

inactive_tasks()

Get the inactive ordered task list held by this task.

load_state(list_of_roots)

Load the state of the workflow.

save_workflow(file_path)

Save the current workflow to the location provided.

task(name)

Get a TaskObject by name, in a BaseTask wrapper.

task_names()

Get the list of the Python names for the available tasks.

tasks([recompute])

Get the ordered task list held by the workflow.

Attributes:

insertable_tasks

Tasks that can be inserted on a blank workflow.

__init__(workflow, command_source, fluent_version)#

Initialize WorkflowWrapper.

Parameters:
workflowPyMenuGeneric

The workflow object.

command_sourcePyMenuGeneric

The application root for commanding.

delete_tasks(list_of_tasks)#

Delete the provided list of tasks.

Parameters:
list_of_tasks: list[str]

List of task items.

Returns:
None
Raises:
ValueError

If ‘task’ does not match a task name, no tasks are deleted.

static inactive_tasks()#

Get the inactive ordered task list held by this task.

Returns:
list

Inactive ordered children.

property insertable_tasks#

Tasks that can be inserted on a blank workflow.

load_state(list_of_roots)#

Load the state of the workflow.

save_workflow(file_path)#

Save the current workflow to the location provided.

task(name)#

Get a TaskObject by name, in a BaseTask wrapper.

The wrapper adds extra functionality.

Parameters:
namestr

Task name - the display name, not the internal ID.

Returns
——-
BaseTask

wrapped task object.

task_names()#

Get the list of the Python names for the available tasks.

tasks(recompute=True)#

Get the ordered task list held by the workflow.

This method sort tasks in terms of the workflow order and only includes this task’s top-level tasks. You can obtain other tasks by calling the tasks() method on a parent task.

Consider the following workflow.

Given the workflow:

Workflow
├── A
├── B
│   ├── C
│   └── D
└── E

The ordered children of the workflow are A, B, E, while B has ordered children C and D.

ansys.fluent.core.workflow.camel_to_snake_case(camel_case_str)#

Convert camel case input string to snake case output string.

ansys.fluent.core.workflow.snake_to_camel_case(snake_case_str, camel_case_strs)#

Populate the snake-case attribute map and return camel case of the passed attribute.