batch_ops#

Batch RPC service.

Classes:

BatchOps(session)

Class to execute operations in batch in Fluent.

BatchOpsService(channel, metadata)

Class wrapping methods in batch RPC service.

class ansys.fluent.core.services.batch_ops.BatchOps(session)#

Bases: object

Class to execute operations in batch in Fluent.

Examples

>>> with pyfluent.BatchOps(solver):
>>>     solver.tui.file.read_case("mixing_elbow.cas.h5")
>>>     solver.results.graphics.mesh["mesh-1"] = {}

Above code will execute both operations through a single gRPC call upon exiting the with block.

Operations that perform queries in Fluent are executed immediately, while others are queued for batch execution. Some queries are executed behind the scenes while queueing an operation for batch execution, and we must ensure that they do not depend on previously queued operations.

For example,

>>> with pyfluent.BatchOps(solver):
>>>     solver.tui.file.read_case("mixing_elbow.cas.h5")
>>>     solver.results.graphics.mesh["mesh-1"] = {}
>>>     solver.results.graphics.mesh["mesh-1"].surfaces_list = ["wall-elbow"]

will throw a KeyError as solver.results.graphics.mesh["mesh-1"] attempts to access the mesh-1 mesh object which has not been created yet.

Classes:

Op(package, service, method, request_body)

Class to create a single batch operation.

Methods:

add_op(package, service, method, request)

Queue a single batch operation.

clear_ops()

Clear all queued batch operations.

instance()

Get the BatchOps instance.

class Op(package, service, method, request_body)#

Bases: object

Class to create a single batch operation.

Methods:

__init__(package, service, method, request_body)

__init__ method of Op class.

update_result(status, data)

Update results after the batch operation is executed.

__init__(package, service, method, request_body)#

__init__ method of Op class.

update_result(status, data)#

Update results after the batch operation is executed.

add_op(package, service, method, request)#

Queue a single batch operation. Only the non-getter operations will be queued.

Parameters:
packagestr

gRPC package name

servicestr

gRPC service name

methodstr

gRPC method name

requestAny

gRPC request message

Returns:
BatchOps.Op

BatchOps.Op object with a queued attribute which is true if the operation has been queued.

clear_ops()#

Clear all queued batch operations.

classmethod instance()#

Get the BatchOps instance.

Returns:
BatchOps

BatchOps instance

class ansys.fluent.core.services.batch_ops.BatchOpsService(channel, metadata)#

Bases: object

Class wrapping methods in batch RPC service.

Methods:

__init__(channel, metadata)

__init__ method of BatchOpsService class.

execute(request)

Execute RPC of BatchOps service.

__init__(channel, metadata)#

__init__ method of BatchOpsService class.

execute(request)#

Execute RPC of BatchOps service.