flobject#

Module for accessing and modifying hierarchy of Fluent settings.

The only useful method is ‘get_root`, which returns the root object for accessing Fluent settings.

Child objects can be generally accessed or modified using attribute access. Named child objects can be accessed or modified using index operators.

Calling an object will return its current value.

Example#

>>> r = flobject.get_root(proxy)
>>> is_energy_on = r.setup.models.energy.enabled()
>>> r.setup.models.energy.enabled = True
>>> r.boundary_conditions.velocity_inlet['inlet'].vmag.constant = 20

Classes:

Action([name, parent])

Intermediate Base class for Command and Query class.

AllowedValuesMixin()

Provides allowed values.

Base([name, parent])

Provides the base class for settings and command objects.

BaseCommand([name, parent])

Executes command.

Boolean([name, parent])

A Boolean object representing a Boolean value setting.

BooleanList([name, parent])

A BooleanList object representing a Boolean list setting.

Command([name, parent])

Command object.

CommandWithPositionalArgs([name, parent])

Command Object supporting positional arguments.

CreatableNamedObjectMixin()

Provides creatable named objects for Fluent 2025 R1 and later.

CreatableNamedObjectMixinOld()

Provides creatable named objects for Fluent 2024 R2 and earlier.

FileName([name, parent])

Resolves MRO for child classes.

Filename([name, parent])

A Filename object representing a file name.

FilenameList([name, parent])

A FilenameList object represents a list of file names.

Group([name, parent])

A Group container object.

Integer([name, parent])

An Integer object representing an integer value setting.

IntegerList([name, parent])

An Integer object representing an integer list setting.

ListObject([name, parent])

A ListObject container is a container object, similar to a Python list object.

Map([name, parent])

A Map object representing key-value settings.

NamedObject([name, parent])

A NamedObject container is a container object similar to a Python dictionary object.

NamedObjectWildcardPath(flproxy, path, ...)

WildcardPath at a NamedObject path, so it can be looked up by wildcard again.

Numerical([name, parent])

Exposes attribute accessor on settings object - specific to numerical objects.

Property([name, parent])

Exposes attribute accessor on settings object.

Query([name, parent])

Query object.

Real([name, parent])

A Real object representing a real value setting.

RealList([name, parent])

A RealList object representing a real list setting.

RealNumerical([name, parent])

A RealNumerical object representing a real value setting, including single real values and containers of real values, such as lists.

RealVector([name, parent])

An object representing a 3D vector.

SettingsBase([name, parent])

Base class for settings objects.

String([name, parent])

A String object representing a string value setting.

StringList([name, parent])

A StringList object representing a string list setting.

Textual([name, parent])

Exposes attribute accessor on settings object - specific to string objects.

WildcardPath(flproxy, path, state_cls, ...)

Class wrapping a wildcard path to perform get_var and set_var on flproxy.

Exceptions:

DeprecatedSettingWarning

Provides deprecated settings warning.

InactiveObjectError(python_path)

Inactive object access.

UnstableSettingWarning

Provides unstable settings warning.

Functions:

assert_type(val, tp)

Assert type.

check_type(val, tp)

Check type of object.

find_children(obj[, identifier])

Returns path of all the child objects matching an identifier.

get_cls(name, info[, parent, version, ...])

Create a class for the object identified by "path".

get_root(flproxy[, version, interrupt, ...])

Get the root settings object.

to_python_name(fluent_name)

Convert a scheme string to a Python variable name.

class ansys.fluent.core.solver.flobject.Action(name=None, parent=None)#

Bases: Base

Intermediate Base class for Command and Query class.

Methods:

__init__([name, parent])

__init__ of Action class.

get_completer_info([prefix, excluded])

Get completer info of all arguments.

Attributes:

__init__(name=None, parent=None)#

__init__ of Action class.

argument_names = []#
get_completer_info(prefix='', excluded=None)#

Get completer info of all arguments.

Returns:
List[List[str]]

Name, type and docstring of all arguments.

class ansys.fluent.core.solver.flobject.AllowedValuesMixin#

Bases: object

Provides allowed values.

Methods:

allowed_values()

Get the allowed values of the object.

allowed_values()#

Get the allowed values of the object.

class ansys.fluent.core.solver.flobject.Base(name=None, parent=None)#

Bases: object

Provides the base class for settings and command objects.

Parameters:
namestr

Name of the object if a child of a named object.

parent: Base

Parent of the object.

Attributes:
flproxy

Proxy object.

obj_name

Name of the scheme of this object.

fluent_name

Methods:

__init__([name, parent])

__init__ of Base class.

after_execute(command_name, value, kwargs)

Executes after command execution.

before_execute(command_name, value, kwargs)

Executes before command execution.

find_object(relative_path)

Find object.

get_attr(attr[, attr_type_or_types])

Get the requested attribute for the object.

get_attrs(attrs[, recursive])

Get the requested attributes for the object.

is_active()

Whether the object is active.

is_read_only()

Whether the object is read-only.

set_flproxy(flproxy)

Set flproxy object.

Attributes:

flproxy

Proxy object.

fluent_name

obj_name

Name of the scheme of this object.

parent

Parent (container) object.

path

Path of the object.

python_name

Python name of this object.

python_path

Path of the object.

__init__(name=None, parent=None)#

__init__ of Base class.

after_execute(command_name, value, kwargs)#

Executes after command execution.

before_execute(command_name, value, kwargs)#

Executes before command execution.

find_object(relative_path)#

Find object.

property flproxy#

Proxy object.

The proxy object is set at the root level and accessed via the parent for the child classes.

fluent_name = None#
get_attr(attr, attr_type_or_types=None)#

Get the requested attribute for the object.

Parameters:
attrstr

attribute name

attr_type_or_typestype or tuple of type, optional

attribute type, by default None

Returns:
Any

attribute value

Raises:
InactiveObjectError

If any attribute other than "active? is queried when the object is not active.

get_attrs(attrs, recursive=False)#

Get the requested attributes for the object.

is_active()#

Whether the object is active.

is_read_only()#

Whether the object is read-only.

property obj_name: str#

Name of the scheme of this object.

By default, this returns the object’s static name. If the object is a child of a named object, the object’s name is returned.

property parent#

Parent (container) object.

property path: str#

Path of the object.

Constructed from the obj_name of self and the path of parent.

property python_name: str#

Python name of this object.

By default, this returns the object’s static name. If the object is a child of a named object, the object’s name is returned.

property python_path: str#

Path of the object.

Constructed in python syntax from ‘python_path’ and the parents python path.

set_flproxy(flproxy)#

Set flproxy object.

class ansys.fluent.core.solver.flobject.BaseCommand(name=None, parent=None)#

Bases: Action

Executes command.

Methods:

execute_command(*args, **kwds)

Execute command.

execute_command(*args, **kwds)#

Execute command.

class ansys.fluent.core.solver.flobject.Boolean(name=None, parent=None)#

Bases: SettingsBase[bool], Property

A Boolean object representing a Boolean value setting.

class ansys.fluent.core.solver.flobject.BooleanList(name=None, parent=None)#

Bases: SettingsBase[List[bool]], Property

A BooleanList object representing a Boolean list setting.

class ansys.fluent.core.solver.flobject.Command(name=None, parent=None)#

Bases: BaseCommand

Command object.

class ansys.fluent.core.solver.flobject.CommandWithPositionalArgs(name=None, parent=None)#

Bases: BaseCommand

Command Object supporting positional arguments.

class ansys.fluent.core.solver.flobject.CreatableNamedObjectMixin#

Bases: MutableMapping, Generic[ChildTypeT]

Provides creatable named objects for Fluent 2025 R1 and later.

class ansys.fluent.core.solver.flobject.CreatableNamedObjectMixinOld#

Bases: CreatableNamedObjectMixin

Provides creatable named objects for Fluent 2024 R2 and earlier.

Methods:

create([name])

Create a named object.

create(name='')#

Create a named object.

Parameters:
name: str

Name of the new object.

Returns:
Object

Object that has been created.

exception ansys.fluent.core.solver.flobject.DeprecatedSettingWarning#

Bases: PyFluentDeprecationWarning

Provides deprecated settings warning.

class ansys.fluent.core.solver.flobject.FileName(name=None, parent=None)#

Bases: Base

Resolves MRO for child classes.

class ansys.fluent.core.solver.flobject.Filename(name=None, parent=None)#

Bases: SettingsBase[str], Textual

A Filename object representing a file name.

Methods:

file_purpose()

Specifies whether this file is used as input or output by Fluent.

file_purpose()#

Specifies whether this file is used as input or output by Fluent.

class ansys.fluent.core.solver.flobject.FilenameList(name=None, parent=None)#

Bases: SettingsBase[List[str]], Textual

A FilenameList object represents a list of file names.

Methods:

file_purpose()

Specifies whether this file is used as input or output by Fluent.

file_purpose()#

Specifies whether this file is used as input or output by Fluent.

class ansys.fluent.core.solver.flobject.Group(name=None, parent=None)#

Bases: SettingsBase[Dict[str, StateType]]

A Group container object.

A Group object is a container similar to a C++ structure object. Child objects can be accessed via attribute access.

Attributes:
child_names: list[str]

Names of the child objects

command_names: list[str]

Names of the commands

Methods:

__init__([name, parent])

__init__ of Group class.

get_active_child_names()

Names of children that are currently active.

get_active_command_names()

Names of commands that are currently active.

get_active_query_names()

Names of queries that are currently active.

get_completer_info([prefix, excluded])

Get completer info of all children.

to_python_keys(value)

Convert value to have keys with Python names.

to_scheme_keys(value, root_cls, path)

Convert value to have keys with scheme names.

Attributes:

__init__(name=None, parent=None)#

__init__ of Group class.

child_names = []#
command_names = []#
get_active_child_names()#

Names of children that are currently active.

get_active_command_names()#

Names of commands that are currently active.

get_active_query_names()#

Names of queries that are currently active.

get_completer_info(prefix='', excluded=None)#

Get completer info of all children.

Returns:
List[List[str]]

Name, type and docstring of all children.

query_names = []#
classmethod to_python_keys(value)#

Convert value to have keys with Python names.

classmethod to_scheme_keys(value, root_cls, path)#

Convert value to have keys with scheme names.

Raises:
RuntimeError

If key is invalid.

exception ansys.fluent.core.solver.flobject.InactiveObjectError(python_path)#

Bases: RuntimeError

Inactive object access.

Methods:

__init__(python_path)

Initialize InactiveObjectError.

__init__(python_path)#

Initialize InactiveObjectError.

class ansys.fluent.core.solver.flobject.Integer(name=None, parent=None)#

Bases: SettingsBase[int], Numerical

An Integer object representing an integer value setting.

class ansys.fluent.core.solver.flobject.IntegerList(name=None, parent=None)#

Bases: SettingsBase[List[int]], Numerical

An Integer object representing an integer list setting.

class ansys.fluent.core.solver.flobject.ListObject(name=None, parent=None)#

Bases: SettingsBase[List[StateType]], Generic[ChildTypeT]

A ListObject container is a container object, similar to a Python list object. Generally, many such objects can be created.

Attributes:
command_names: list[str]

Names of the commands.

Methods

get_size()

Get the size of the list.

Methods:

__init__([name, parent])

__init__ of ListObject class.

get_size()

Return the number of elements in a list object.

to_python_keys(value)

Convert value to have keys with scheme names.

to_scheme_keys(value, root_cls, path)

Convert value to have keys with scheme names.

Attributes:

__init__(name=None, parent=None)#

__init__ of ListObject class.

command_names = []#
get_size()#

Return the number of elements in a list object.

Returns:
int
query_names = []#
classmethod to_python_keys(value)#

Convert value to have keys with scheme names.

classmethod to_scheme_keys(value, root_cls, path)#

Convert value to have keys with scheme names.

class ansys.fluent.core.solver.flobject.Map(name=None, parent=None)#

Bases: SettingsBase[Dict[str, StateType]]

A Map object representing key-value settings.

class ansys.fluent.core.solver.flobject.NamedObject(name=None, parent=None)#

Bases: SettingsBase[Dict[str, StateType]], Generic[ChildTypeT]

A NamedObject container is a container object similar to a Python dictionary object. Generally, many such objects can be created with different names.

Attributes:
command_names: list[str]

Names of the commands

Methods:

__init__([name, parent])

__init__ of NamedObject class.

get(name)

Return the child object by key.

get_completer_info([prefix, excluded])

Get completer info of all children.

get_object_names()

Object names.

items()

Items.

keys()

Object names.

to_python_keys(value)

Convert value to have keys with Python names.

to_scheme_keys(value, root_cls, path)

Convert value to have keys with scheme names.

user_creatable()

Whether the object is user-creatable.

values()

Object values.

Attributes:

__init__(name=None, parent=None)#

__init__ of NamedObject class.

command_names = []#
get(name)#

Return the child object by key.

Parameters:
namestr

Name of the child object.

Returns:
ChildTypeT

Child object.

get_completer_info(prefix='', excluded=None)#

Get completer info of all children.

Returns:
List[List[str]]

Name, type and docstring of all children.

get_object_names()#

Object names.

items()#

Items.

keys()#

Object names.

query_names = []#
classmethod to_python_keys(value)#

Convert value to have keys with Python names.

classmethod to_scheme_keys(value, root_cls, path)#

Convert value to have keys with scheme names.

user_creatable()#

Whether the object is user-creatable.

values()#

Object values.

class ansys.fluent.core.solver.flobject.NamedObjectWildcardPath(flproxy, path, state_cls, settings_cls, parent)#

Bases: WildcardPath

WildcardPath at a NamedObject path, so it can be looked up by wildcard again.

class ansys.fluent.core.solver.flobject.Numerical(name=None, parent=None)#

Bases: Property

Exposes attribute accessor on settings object - specific to numerical objects.

Methods:

max()

Get the maximum value of the object.

min()

Get the minimum value of the object.

max()#

Get the maximum value of the object.

min()#

Get the minimum value of the object.

class ansys.fluent.core.solver.flobject.Property(name=None, parent=None)#

Bases: Base

Exposes attribute accessor on settings object.

Methods:

default_value()

Gets the default value of the object.

default_value()#

Gets the default value of the object.

class ansys.fluent.core.solver.flobject.Query(name=None, parent=None)#

Bases: Action

Query object.

class ansys.fluent.core.solver.flobject.Real(name=None, parent=None)#

Bases: SettingsBase[real], RealNumerical

A Real object representing a real value setting.

Some Real objects also accept string arguments representing expression values.

Methods:

base_set_state([state])

Set the state of the object.

set_state([state])

Set the state of the object.

base_set_state(state=None, **kwargs)#

Set the state of the object.

set_state(state=None, **kwargs)#

Set the state of the object.

Parameters:
state

The type of state can be float, str (representing either an expression or a value with units), or an ansys.units.Quantity.

kwargsAny

Keyword arguments.

Raises:
UnhandledQuantity

If the quantity object cannot be handled for the given path. This can happen if the quantity attribute specifies an unsupported quantity, or if the units specified for the quantity are not supported.

class ansys.fluent.core.solver.flobject.RealList(name=None, parent=None)#

Bases: SettingsBase[List[real]], RealNumerical

A RealList object representing a real list setting.

Methods:

base_set_state([state])

Set the state of the object.

set_state([state])

Set the state of the object.

base_set_state(state=None, **kwargs)#

Set the state of the object.

set_state(state=None, **kwargs)#

Set the state of the object.

Parameters:
state

The type of state can be float, str (representing either an expression or a value with units), or an ansys.units.Quantity.

kwargsAny

Keyword arguments.

Raises:
UnhandledQuantity

If the quantity object cannot be handled for the given path. This can happen if the quantity attribute specifies an unsupported quantity, or if the units specified for the quantity are not supported.

class ansys.fluent.core.solver.flobject.RealNumerical(name=None, parent=None)#

Bases: Numerical

A RealNumerical object representing a real value setting, including single real values and containers of real values, such as lists.

Methods

as_quantity()

Get the current state of the object as an ansys.units.Quantity.

set_state(state)

Set the state of the object.

units()

Get the units string.

Methods:

as_quantity()

Get the state of the object as an ansys.units.Quantity.

set_state([state])

Set the state of the object.

units()

Get the physical units of the object as a string.

as_quantity()#

Get the state of the object as an ansys.units.Quantity.

set_state(state=None, **kwargs)#

Set the state of the object.

Parameters:
state

The type of state can be float, str (representing either an expression or a value with units), or an ansys.units.Quantity.

kwargsAny

Keyword arguments.

Raises:
UnhandledQuantity

If the quantity object cannot be handled for the given path. This can happen if the quantity attribute specifies an unsupported quantity, or if the units specified for the quantity are not supported.

units()#

Get the physical units of the object as a string.

class ansys.fluent.core.solver.flobject.RealVector(name=None, parent=None)#

Bases: SettingsBase[Tuple[real, real, real]], Numerical

An object representing a 3D vector.

A RealVector object representing a real vector setting consisting of three real values.

class ansys.fluent.core.solver.flobject.SettingsBase(name=None, parent=None)#

Bases: Base, Generic[StateT]

Base class for settings objects.

Methods

get_state()

Get the current state of the object.

set_state(state)

Set the state of the object.

Methods:

get_state()

Get the state of the object.

print_state([out, indent_factor])

Print the state of the object.

set_state([state])

Set the state of the object.

state_with_units()

Get the state of the object with units where available.

to_python_keys(value)

Convert value to have keys with Python names.

to_scheme_keys(value, root_cls, path)

Convert value to have keys with scheme names.

get_state()#

Get the state of the object.

print_state(out=None, indent_factor=2)#

Print the state of the object.

set_state(state=None, **kwargs)#

Set the state of the object.

state_with_units()#

Get the state of the object with units where available.

classmethod to_python_keys(value)#

Convert value to have keys with Python names.

This is overridden in the Group, NamedObject, and ListObject classes.

classmethod to_scheme_keys(value, root_cls, path)#

Convert value to have keys with scheme names.

This is overridden in the Group, NamedObject, and ListObject classes.

class ansys.fluent.core.solver.flobject.String(name=None, parent=None)#

Bases: SettingsBase[str], Textual

A String object representing a string value setting.

class ansys.fluent.core.solver.flobject.StringList(name=None, parent=None)#

Bases: SettingsBase[List[str]], Textual

A StringList object representing a string list setting.

class ansys.fluent.core.solver.flobject.Textual(name=None, parent=None)#

Bases: Property

Exposes attribute accessor on settings object - specific to string objects.

exception ansys.fluent.core.solver.flobject.UnstableSettingWarning#

Bases: PyFluentUserWarning

Provides unstable settings warning.

class ansys.fluent.core.solver.flobject.WildcardPath(flproxy, path, state_cls, settings_cls, parent)#

Bases: Group

Class wrapping a wildcard path to perform get_var and set_var on flproxy.

Methods:

__init__(flproxy, path, state_cls, ...)

__init__ of WildcardPath class.

items()

Items.

to_python_keys(value)

Convert value to have keys with Python names.

to_scheme_keys(value, root_cls, path)

Convert value to have keys with scheme names.

Attributes:

flproxy

Proxy object.

path

Path with wildcards.

__init__(flproxy, path, state_cls, settings_cls, parent)#

__init__ of WildcardPath class.

property flproxy#

Proxy object.

items()#

Items.

property path#

Path with wildcards.

to_python_keys(value)#

Convert value to have keys with Python names.

to_scheme_keys(value, root_cls, path)#

Convert value to have keys with scheme names.

ansys.fluent.core.solver.flobject.assert_type(val, tp)#

Assert type.

Raises:
TypeError

If the given value is not of the given type.

ansys.fluent.core.solver.flobject.check_type(val, tp)#

Check type of object.

ansys.fluent.core.solver.flobject.find_children(obj, identifier='*')#

Returns path of all the child objects matching an identifier.

Parameters:
obj: Object

Object whose children need to be queried.

identifier: str

Identifier to find specific children.

Returns:
List
ansys.fluent.core.solver.flobject.get_cls(name, info, parent=None, version=None, parent_taboo=None)#

Create a class for the object identified by “path”.

ansys.fluent.core.solver.flobject.get_root(flproxy, version='', interrupt=None, file_transfer_service=None, scheme_eval=None)#

Get the root settings object.

Parameters:
flproxy: Proxy

Object that interfaces with the Fluent backend.

interrupt: optional

To interrupt interruptible commands.

file_transfer_serviceoptional

File transfer service. Uploads/downloads files to/from the server.

scheme_evalAny

A gRPC service to execute Scheme code.

versionstr

Fluent version.

Returns:
root object
Raises:
RuntimeError

If hash values are inconsistent.

ansys.fluent.core.solver.flobject.to_python_name(fluent_name)#

Convert a scheme string to a Python variable name.

This function replaces symbols with _. Any ? symbols are ignored.