Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ WordTemplate = \b(?:%s)\b
Packages = Google

# Define the Ansys vocabulary
Vocab = ANSYS
Vocab = ANSYS, rp, config

[*.{md,rst}]

Expand Down
55 changes: 55 additions & 0 deletions doc/source/api/core/casereader.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
.. _ref_casereader:

Case reader
===========

Case reader provides a reader for fluent case files.

Sample usage
------------

You can use the case reader by importing it and passing a case file path.
The following example show the usage of case reader with a case file (.cas.h5)
read from examples repository as shown:

.. code-block:: python

>>> from ansys.fluent.core import examples
>>> from ansys.fluent.core.filereader.casereader import CaseReader

>>> case_filepath = examples.download_file("Static_Mixer_Parameters.cas.h5", "pyfluent/static_mixer")
>>> reader = CaseReader(case_filepath=case_filepath)
>>> reader.precision()
2
>>> reader.num_dimensions()
3
>>> {p.name: p.value for p in reader.input_parameters()}
{'inlet1_vel': '1 [m/s]', 'inlet1_temp': '300 [K]', 'inlet2_vel': '1 [m/s]', 'inlet2_temp': '350 [K]'}
>>> {p.name: p.units for p in reader.output_parameters()}
{'outlet-temp-avg-op': 'K', 'outlet-vel-avg-op': 'm s^-1'}

Additional features
-------------------
Along with the basic functionality, case reader also has a bunch of useful features, like:

Supports multiple file formats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The case reader can read fluent case files in .cas, .cas.h5 and .cas.gz in both text and binary formats.

Takes project path as argument
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Case reader also has an option to take a fluent project path (.flprj) as argument and locate the
case file path.

.. code-block:: python

>>> reader = CaseReader(project_filepath="Dir1/Dir2/project.flprj")

Capability to read rp and config vars
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Case reader can provide the rp and config vars as well.

.. code-block:: python

>>> reader.rp_vars()
>>> reader.config_vars()
1 change: 1 addition & 0 deletions doc/source/api/core/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and Fluent meshing and solver components.

launcher
utils
casereader
meshing/index
solver/index

2 changes: 1 addition & 1 deletion src/ansys/fluent/core/filereader/casereader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Instantiate a case reader

reader = CaseReader(hdf5_case_filepath=case_filepath)
reader = CaseReader(case_filepath=case_filepath)

Get lists of input and output parameters

Expand Down