Transfer data#

You use the ‘transfer_case` method to transfer a case or mesh file between instances of Fluent. You must specify a source instance and one or more destination instances.

Sample usage#

To use the transfer_case method to transfer a mesh or a case file, you import the file and pass the source, destination instances, and the file type. You can either generate the files in the parent instance or just read the file.

This example shows how you use the transfer_case method to read a mesh file in a pure meshing session and transfer it to a solver session.

>>> import ansys.fluent.core as pyfluent
>>> from ansys.fluent.core.examples import download_file
>>> from ansys.fluent.core.utils.data_transfer import transfer_case

>>> mesh_file_name = download_file("mixing_elbow.msh.h5", "pyfluent/mixing_elbow")
>>> pure_meshing_session = pyfluent.launch_fluent(mode="pure-meshing")
>>> pure_meshing_session.tui.file.read_mesh(import_file_name)

>>> solver_session = pyfluent.launch_fluent(mode="solver")

>>> transfer_case(
>>>     source_instance=meshing,
>>>     solvers=[solver],
>>>     file_type="mesh",
>>>     file_name_stem='',
>>>     num_files_to_try=1,
>>>     clean_up_temp_file=True,
>>>     overwrite_previous=True
>>> )

Similarly, you can use the transfer_case method to transfer a case file from one instance of Fluent to another.

Session to session data transfer, supporting Fluent in all modes.

Exceptions:

MeshWriteError()

Raised when mesh write is unsuccessful.

Functions:

transfer_case(source_instance, solvers, ...)

Transfer case between instances.

exception ansys.fluent.core.utils.data_transfer.MeshWriteError#

Bases: RuntimeError

Raised when mesh write is unsuccessful.

__init__()#
ansys.fluent.core.utils.data_transfer.transfer_case(source_instance, solvers, file_type, file_name_stem, num_files_to_try, clean_up_temp_file, overwrite_previous, workdir=None, container_workdir=None)#

Transfer case between instances.

Parameters:
source_instanceobject

Fluent instance (tested for meshing instance)

solversiterable

Sequence of solver instances

file_typestr

“case” or “mesh”

file_name_stemstr

Optional file name stem

num_files_to_tryint

Optional number of files to try to write, each with a different generated name. Defaults to 1

clean_up_temp_file: bool

Whether to remove the file at the end

overwrite_previous: bool

Whether to overwrite the file if it already exists

workdirstr, optional

Working directory that is accessible by the Fluent client as well as PyFluent.

container_workdirstr, optional

If using a Fluent container image, specifies the working directory that is accessible by the Fluent client inside the container, which should also be mounted to the container from the host system path specified in workdir.

Returns:
None
Raises:
MeshWriteError

If mesh cannot be written from source_instance.