solution_variables#

Wrappers over SVAR gRPC service of Fluent.

Classes:

SolutionVariableData(service, ...)

Provides access to Fluent SVAR data on zones.

SolutionVariableInfo(service)

Provide access to Fluent SVARs and Zones information.

SolutionVariableService(channel, metadata)

SVAR service of Fluent.

Exceptions:

SvarError(solution_variable_name, allowed_values)

Exception class for errors in solution variable name.

ZoneError(zone_name, allowed_values)

Exception class for errors in Zone name.

Functions:

extract_svars(solution_variables_data)

Extracts SVAR data via a server call.

class ansys.fluent.core.services.solution_variables.SolutionVariableData(service, solution_variable_info)#

Bases: object

Provides access to Fluent SVAR data on zones.

Examples

>>> solution_variable_data = solver_session.fields.solution_variable_data
>>> sv_t_wall_fluid=solver_session.fields.solution_variable_data.get_data(solution_variable_name="SV_T", domain_name="mixture", zone_names=["fluid", "wall"])
>>> print(sv_t_wall_fluid.domain)
>>> 'mixture'
>>> print(sv_t_wall_fluid.zones)
>>> ['fluid', 'wall']
>>> fluid_temp = sv_t_wall_fluid['fluid']
>>> print(fluid_temp.size)
>>> 13852
>>> print(fluid_temp.dtype)
>>> float64
>>> print(fluid_temp)
>>> array([600., 600., 600., ..., 600., 600., 600.])
>>> wall_temp_array = solution_variable_data.create_empty_array("SV_T", "wall")
>>> fluid_temp_array =solution_variable_data.create_empty_array("SV_T", "fluid")
>>> wall_temp_array[:]= 500
>>> fluid_temp_array[:]= 600
>>> zone_names_to_solution_variable_data = {'wall':wall_temp_array, 'fluid':fluid_temp_array}
>>> solution_variable_data.set_data(solution_variable_name="SV_T", domain_name="mixture", zone_names_to_solution_variable_data=zone_names_to_solution_variable_data)

Classes:

Data(domain_name, zone_id_name_map, ...)

Solution variable data.

Methods:

__init__(service, solution_variable_info)

Initialize SolutionVariableData.

create_empty_array(solution_variable_name, ...)

Get numpy zeros array for the SVAR on a zone.

get_data(solution_variable_name, zone_names)

Get SVAR data on zones.

get_svar_data(svar_name, zone_names[, ...])

Get solution variable data.

set_data(solution_variable_name, ...[, ...])

Set SVAR data on zones.

set_svar_data(svar_name, zone_names_to_svar_data)

Set solution variable data.

class Data(domain_name, zone_id_name_map, solution_variable_data)#

Bases: object

Solution variable data.

Methods:

__init__(domain_name, zone_id_name_map, ...)

Initialize Data.

Attributes:

data

Solution variable data.

domain

Domain name.

zones

Zone name.

__init__(domain_name, zone_id_name_map, solution_variable_data)#

Initialize Data.

property data#

Solution variable data.

property domain#

Domain name.

property zones#

Zone name.

__init__(service, solution_variable_info)#

Initialize SolutionVariableData.

create_empty_array(solution_variable_name, zone_name, domain_name='mixture')#

Get numpy zeros array for the SVAR on a zone.

This array can be populated with values to set SVAR data.

get_data(solution_variable_name, zone_names, domain_name='mixture')#

Get SVAR data on zones.

Parameters:
solution_variable_namestr

Name of the SVAR.

zone_names: List[str]

Zone names list for SVAR data.

domain_namestr, optional

Domain name. The default is mixture.

Returns:
SolutionVariableData.Data

Object containing SVAR data.

get_svar_data(svar_name, zone_names, domain_name='mixture')#

Get solution variable data.

set_data(solution_variable_name, zone_names_to_solution_variable_data, domain_name='mixture')#

Set SVAR data on zones.

Parameters:
solution_variable_namestr

Name of the SVAR.

zone_names_to_solution_variable_data: Dict[str, np.array]

Dictionary containing zone names for SVAR data.

domain_namestr, optional

Domain name. The default is mixture.

Returns:
None
set_svar_data(svar_name, zone_names_to_svar_data, domain_name='mixture')#

Set solution variable data.

class ansys.fluent.core.services.solution_variables.SolutionVariableInfo(service)#

Bases: object

Provide access to Fluent SVARs and Zones information.

Examples

>>> solution_variable_info = solver_session.fields.solution_variable_info
>>> wall_fluid_info = solution_variable_info.get_variables_info(zone_names=['wall' , "fluid"], domain_name="mixture")
>>> print(wall_fluid_info.solution_variables)
>>> ['SV_CENTROID', 'SV_D', 'SV_H', 'SV_K', 'SV_P', 'SV_T', 'SV_U', 'SV_V', 'SV_W']
>>> solution_variable_info_centroid = wall_fluid_info['SV_CENTROID']
>>> print(solution_variable_info_centroid)
>>> name:SV_CENTROID dimension:3 field_type:<class 'numpy.float64'>
>>> zones_info = solution_variable_info.get_zones_info()
>>> print(zones_info.zones)
>>> ['fluid', 'wall', 'symmetry', 'pressure-outlet-7', 'velocity-inlet-6', 'velocity-inlet-5', 'default-interior']
>>> zone_info = zones_info['wall']
>>> print(zone_info)
>>> name:wall count: 3630 zone_id:3 zone_type:wall thread_type:Face

Classes:

SolutionVariables(solution_variables_info)

Class containing information for multiple solution variables.

ZonesInfo(zones_info, domains_info)

Class containing information for multiple zones.

Methods:

__init__(service)

Initialize SolutionVariableInfo.

get_svars_info(zone_names[, domain_name])

Get solution variables info.

get_variables_info(zone_names[, domain_name])

Get SVARs info for zones in the domain.

get_zones_info()

Get Zones info.

class SolutionVariables(solution_variables_info)#

Bases: object

Class containing information for multiple solution variables.

Classes:

SolutionVariable(solution_variable_info)

Class containing information for single solution variable.

Methods:

__init__(solution_variables_info)

Initialize SolutionVariables.

Attributes:

solution_variables

Solution variables.

svars

Solution variables.

class SolutionVariable(solution_variable_info)#

Bases: object

Class containing information for single solution variable.

Methods:

__init__(solution_variable_info)

Initialize SolutionVariable.

__init__(solution_variable_info)#

Initialize SolutionVariable.

__init__(solution_variables_info)#

Initialize SolutionVariables.

property solution_variables: List[str]#

Solution variables.

property svars: List[str]#

Solution variables.

class ZonesInfo(zones_info, domains_info)#

Bases: object

Class containing information for multiple zones.

Classes:

ZoneInfo(zone_info)

Class containing information for single zone.

Methods:

__init__(zones_info, domains_info)

Initialize ZonesInfo.

domain_id(domain_name)

Get domain id.

Attributes:

domains

Get domain names.

zones

Get zone names.

class ZoneInfo(zone_info)#

Bases: object

Class containing information for single zone.

Classes:

PartitionsInfo(partition_info)

Class containing information for partitions.

Methods:

__init__(zone_info)

Initialize ZoneInfo.

Attributes:

count

Get zone count.

class PartitionsInfo(partition_info)#

Bases: object

Class containing information for partitions.

Methods:

__init__(partition_info)

Initialize PartitionsInfo.

__init__(partition_info)#

Initialize PartitionsInfo.

__init__(zone_info)#

Initialize ZoneInfo.

property count: int#

Get zone count.

__init__(zones_info, domains_info)#

Initialize ZonesInfo.

domain_id(domain_name)#

Get domain id.

property domains: List[str]#

Get domain names.

property zones: List[str]#

Get zone names.

__init__(service)#

Initialize SolutionVariableInfo.

get_svars_info(zone_names, domain_name='mixture')#

Get solution variables info.

get_variables_info(zone_names, domain_name='mixture')#

Get SVARs info for zones in the domain.

Parameters:
zone_namesList[str]

List of zone names.

domain_name: str, optional

Domain name.The default is mixture.

Returns:
SolutionVariableInfo.SolutionVariables

Object containing information for SVARs which are common for list of zone names.

get_zones_info()#

Get Zones info.

Parameters:
None
Returns:
SolutionVariableInfo.ZonesInfo

Object containing information for all zones.

class ansys.fluent.core.services.solution_variables.SolutionVariableService(channel, metadata)#

Bases: object

SVAR service of Fluent.

Methods:

__init__(channel, metadata)

__init__ method of SVAR service class.

get_data(request)

GetSvarData RPC of SVAR service.

get_variables_info(request)

GetSvarsInfo RPC of SVAR service.

get_zones_info(request)

GetZonesInfo RPC of SVAR service.

set_data(request)

SetSvarData RPC of SVAR service.

__init__(channel, metadata)#

__init__ method of SVAR service class.

get_data(request)#

GetSvarData RPC of SVAR service.

get_variables_info(request)#

GetSvarsInfo RPC of SVAR service.

get_zones_info(request)#

GetZonesInfo RPC of SVAR service.

set_data(request)#

SetSvarData RPC of SVAR service.

exception ansys.fluent.core.services.solution_variables.SvarError(solution_variable_name, allowed_values)#

Bases: ValueError

Exception class for errors in solution variable name.

Methods:

__init__(solution_variable_name, allowed_values)

Initialize SvarError.

__init__(solution_variable_name, allowed_values)#

Initialize SvarError.

exception ansys.fluent.core.services.solution_variables.ZoneError(zone_name, allowed_values)#

Bases: ValueError

Exception class for errors in Zone name.

Methods:

__init__(zone_name, allowed_values)

Initialize ZoneError.

__init__(zone_name, allowed_values)#

Initialize ZoneError.

ansys.fluent.core.services.solution_variables.extract_svars(solution_variables_data)#

Extracts SVAR data via a server call.