case_file#

Reader for Fluent case files.

Example#

>>> from ansys.fluent.core import examples
>>> from ansys.fluent.core.filereader.case_file import CaseFile

>>> case_file_name = examples.download_file("Static_Mixer_Parameters.cas.h5", "pyfluent/static_mixer", return_without_path=False)

>>> reader = CaseFile(case_file_name=case_file_name) # Instantiate a CaseFile class
>>> input_parameters = reader.input_parameters()     # Get lists of input parameters
>>> output_parameters = reader.output_parameters()   # Get lists of output parameters

Classes:

CaseFile([case_file_name, project_file_name])

Class to read a Fluent case file.

CaseVariable(variables[, path])

Provides access to variables defined in the case.

EmptyContainer()

Empty Container.

InputParameter(raw_data)

Represents an input parameter.

InputParameterOld(raw_data)

Represents an input parameter (old format).

Mesh(file_handle)

Class to provide data from and information about Fluent mesh files.

MeshType(value[, names, module, qualname, ...])

Types of Mesh.

OutputParameter(raw_data)

Represents an output parameter.

RPVarProcessor(rp_vars_str)

Class to process RP Vars string to expose required outputs.

SettingsFile([settings_file_name])

Class to read a Fluent Settings file.

class ansys.fluent.core.filereader.case_file.CaseFile(case_file_name=None, project_file_name=None)#

Bases: RPVarProcessor

Class to read a Fluent case file.

Methods

get_mesh()

Get the mesh data.

Methods:

__init__([case_file_name, project_file_name])

Initialize a CaseFile object.

get_mesh()

Get the mesh data.

__init__(case_file_name=None, project_file_name=None)#

Initialize a CaseFile object. Exactly one file path argument must be specified.

Parameters:
case_file_namestr

The path of a case file.

project_file_namestr

The path of a project file from which the case file is selected.

get_mesh()#

Get the mesh data.

class ansys.fluent.core.filereader.case_file.CaseVariable(variables, path='')#

Bases: object

Provides access to variables defined in the case.

Methods:

__init__(variables[, path])

Initialize CaseVariable.

__init__(variables, path='')#

Initialize CaseVariable.

Parameters:
variablesdict

The variables dictionary.

pathstr

The path to the variables.

class ansys.fluent.core.filereader.case_file.EmptyContainer#

Bases: object

Empty Container.

class ansys.fluent.core.filereader.case_file.InputParameter(raw_data)#

Bases: object

Represents an input parameter.

Attributes:
namestr
value

The value of this input parameter, usually a string, qualified by units

Methods:

__init__(raw_data)

Initialize InputParameter.

Attributes:

numeric_value

Get the numeric value of a Fluent input parameter.

units

Get the unit label of a Fluent input parameter.

__init__(raw_data)#

Initialize InputParameter.

Parameters:
raw_dataDict[str, str]

Input parameter data as a nested dictionary.

property numeric_value: float#

Get the numeric value of a Fluent input parameter.

Returns:
float

Numeric value of the Fluent input parameter.

property units: str#

Get the unit label of a Fluent input parameter.

Returns:
str

Unit label of the Fluent input parameter.

class ansys.fluent.core.filereader.case_file.InputParameterOld(raw_data)#

Bases: object

Represents an input parameter (old format).

Attributes:
namestr
value

The value of this input parameter, usually a string, qualified by units

Methods:

__init__(raw_data)

Initialize InputParameter.

Attributes:

numeric_value

Get the numeric value of a Fluent input parameter.

units

Get the unit label of a Fluent input parameter.

__init__(raw_data)#

Initialize InputParameter.

Parameters:
raw_dataList

Input parameter data as a list.

property numeric_value: float#

Get the numeric value of a Fluent input parameter.

Returns:
float

Numeric value of the Fluent input parameter.

property units: str#

Get the unit label of a Fluent input parameter.

Returns:
str

Unit label of the Fluent input parameter.

class ansys.fluent.core.filereader.case_file.Mesh(file_handle)#

Bases: object

Class to provide data from and information about Fluent mesh files.

This class is applicable only to HDF5, Fluent’s default format for mesh files. HDF5 (Hierarchical Data Format version 5) is commonly used for storing large amounts of scientific data, including Fluent mesh data.

Methods

get_surface_ids()

Get a list of surface ids.

get_surface_names()

Get a list of surface names.

get_surface_locs(surface_id)

Get the min and max location index of surface.

get_connectivity(surface_id)

Get the surface connectivity.

get_vertices(surface_id)

Get list of vertices of the surface.

Methods:

__init__(file_handle)

Initialize the object.

get_connectivity(surface_id)

Returns numpy array of face connectivity data for a particular surface.

get_mesh_type()

Returns the type of the mesh.

get_surface_ids()

Returns list of ids of all available surfaces.

get_surface_locs(surface_id)

Returns range of surface locations for a particular surface.

get_surface_names()

Returns list of names of all available surfaces.

get_vertices(surface_id)

Returns numpy array of vertices data for a particular surface.

__init__(file_handle)#

Initialize the object.

get_connectivity(surface_id)#

Returns numpy array of face connectivity data for a particular surface.

get_mesh_type()#

Returns the type of the mesh.

get_surface_ids()#

Returns list of ids of all available surfaces.

get_surface_locs(surface_id)#

Returns range of surface locations for a particular surface.

get_surface_names()#

Returns list of names of all available surfaces.

get_vertices(surface_id)#

Returns numpy array of vertices data for a particular surface.

class ansys.fluent.core.filereader.case_file.MeshType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

Types of Mesh.

Attributes:

SURFACE = 'surface'#
UNKNOWN = 'unknown'#
VOLUME = 'volume'#
class ansys.fluent.core.filereader.case_file.OutputParameter(raw_data)#

Bases: object

Represents an output parameter.

Attributes:
namestr

Methods:

__init__(raw_data)

Initialize OutputParameter.

__init__(raw_data)#

Initialize OutputParameter.

Parameters:
raw_datalist

Output parameter as a nested list.

class ansys.fluent.core.filereader.case_file.RPVarProcessor(rp_vars_str)#

Bases: object

Class to process RP Vars string to expose required outputs.

Methods

input_parameters()

Get a list of input parameter objects

output_parameters()

Get a list of output parameter objects

num_dimensions()

Get the dimensionality of the case (2 or 3)

precision()

Get the precision (1 or 2 for 1D of 2D)

iter_count()

Get the number of iterations

rp_vars()

Get dictionary of all RP vars

rp_var(name)

Get specific RP var by name, either by providing the Scheme name: reader.rp_var(“rad/enable-netm?”) or a pythonic version: reader.rp_var.rad.enable_netm__q()

has_rp_var(name)

Whether case has particular RP var

config_vars()

Get dictionary of all RP vars

config_var(name)

Get specific config var by name, either by providing the Scheme name: reader.config_var(“rp-3d?”) or a pythonic version: reader.config_var.rp_3d__q()

has_config_var(name)

Whether case has particular config var

Methods:

__init__(rp_vars_str)

Initialize a RPVarProcessor object.

config_vars()

Get the config variables associated with this case.

has_config_var(name)

Get whether the case has a given variable.

has_rp_var(name)

Find if this case has the given rpvar.

input_parameters()

Get the input parameters.

iter_count()

Get the number of iterations associated with this case.

num_dimensions()

Get the dimensionality associated with this case.

output_parameters()

Get the output parameters.

precision()

Get the precision associated with this case (single or double).

rp_vars()

Get the rpvars associated with this case.

Attributes:

config_var

Access the config variables associated with this case.

rp_var

Access the rpvars associated with this case.

__init__(rp_vars_str)#

Initialize a RPVarProcessor object.

Parameters:
rp_vars_str :str

RP Vars string.

property config_var: CaseVariable#

Access the config variables associated with this case.

Returns:
CaseVariable

The config variables associated with this case.

config_vars()#

Get the config variables associated with this case.

Returns:
dict

The config variables associated with this case.

has_config_var(name)#

Get whether the case has a given variable.

has_rp_var(name)#

Find if this case has the given rpvar.

Parameters:
namestr

Name of the rpvar.

Returns:
bool

Whether this case has the given rpvar.

input_parameters()#

Get the input parameters.

Returns:
List[InputParameter] | List[InputParameterOld]

The list of input parameters.

iter_count()#

Get the number of iterations associated with this case.

Returns:
int

The number of iterations associated with this case.

num_dimensions()#

Get the dimensionality associated with this case.

Returns:
int

The number of dimensions.

output_parameters()#

Get the output parameters.

Returns:
List[OutputParameter]

The list of output parameters.

precision()#

Get the precision associated with this case (single or double).

Returns:
int

Either 1 or 2 to indicate single or double precision respectively.

property rp_var: CaseVariable#

Access the rpvars associated with this case.

Returns:
CaseVariable

The rpvars associated with this case.

rp_vars()#

Get the rpvars associated with this case.

Returns:
dict

The rpvars associated with this case.

class ansys.fluent.core.filereader.case_file.SettingsFile(settings_file_name=None)#

Bases: RPVarProcessor

Class to read a Fluent Settings file.

Methods:

__init__([settings_file_name])

Initialize a SettingsFile object.

__init__(settings_file_name=None)#

Initialize a SettingsFile object. Exactly one file path argument must be specified.

Parameters:
settings_file_namestr

The path of a settings file.