diff --git a/doc/.vale.ini b/doc/.vale.ini index 344c6c4a70cd..4785e968a749 100644 --- a/doc/.vale.ini +++ b/doc/.vale.ini @@ -20,7 +20,7 @@ WordTemplate = \b(?:%s)\b Packages = Google # Define the Ansys vocabulary -Vocab = ANSYS +Vocab = ANSYS, rp, config [*.{md,rst}] diff --git a/doc/source/api/core/casereader.rst b/doc/source/api/core/casereader.rst new file mode 100644 index 000000000000..aa38449c2fd1 --- /dev/null +++ b/doc/source/api/core/casereader.rst @@ -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() diff --git a/doc/source/api/core/index.rst b/doc/source/api/core/index.rst index a534743c9546..12033c6e27d9 100644 --- a/doc/source/api/core/index.rst +++ b/doc/source/api/core/index.rst @@ -18,6 +18,7 @@ and Fluent meshing and solver components. launcher utils + casereader meshing/index solver/index diff --git a/src/ansys/fluent/core/filereader/casereader.py b/src/ansys/fluent/core/filereader/casereader.py index 848742d2ae33..bb8ad2b4b450 100644 --- a/src/ansys/fluent/core/filereader/casereader.py +++ b/src/ansys/fluent/core/filereader/casereader.py @@ -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