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:
|
Class to read a Fluent case file. |
|
Provides access to variables defined in the case. |
Empty Container. |
|
|
Represents an input parameter. |
|
Represents an input parameter (old format). |
|
Class to provide data from and information about Fluent mesh files. |
|
Types of Mesh. |
|
Represents an output parameter. |
|
Class to process RP Vars string to expose required outputs. |
|
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.
- 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.
- class ansys.fluent.core.filereader.case_file.InputParameter(raw_data)#
Bases:
object
Represents an input parameter.
- Attributes:
- name
str
- value
The value of this input parameter, usually a string, qualified by units
- name
Methods:
__init__
(raw_data)Initialize InputParameter.
Attributes:
Get the numeric value of a Fluent input parameter.
Get the unit label of a Fluent input parameter.
- __init__(raw_data)#
Initialize InputParameter.
- class ansys.fluent.core.filereader.case_file.InputParameterOld(raw_data)#
Bases:
object
Represents an input parameter (old format).
- Attributes:
- name
str
- value
The value of this input parameter, usually a string, qualified by units
- name
Methods:
__init__
(raw_data)Initialize InputParameter.
Attributes:
Get the numeric value of a Fluent input parameter.
Get the unit label of a Fluent input parameter.
- __init__(raw_data)#
Initialize InputParameter.
- Parameters:
- raw_data
List
Input parameter data as a list.
- raw_data
- 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.
Returns the type of the mesh.
Returns list of ids of all available surfaces.
get_surface_locs
(surface_id)Returns range of surface locations for a particular surface.
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:
- name
str
- name
Methods:
__init__
(raw_data)Initialize OutputParameter.
- 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.
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.
Get the input parameters.
Get the number of iterations associated with this case.
Get the dimensionality associated with this case.
Get the output parameters.
Get the precision associated with this case (single or double).
rp_vars
()Get the rpvars associated with this case.
Attributes:
Access the config variables associated with this case.
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.
- 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.
- 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.