From 821892aa163ed6c2f580067a1df365e66a93e586 Mon Sep 17 00:00:00 2001 From: Prithwish Mukherjee Date: Fri, 21 Oct 2022 17:08:57 +0530 Subject: [PATCH 1/5] Added documentation for case reader --- doc/source/api/core/casereader.rst | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 doc/source/api/core/casereader.rst diff --git a/doc/source/api/core/casereader.rst b/doc/source/api/core/casereader.rst new file mode 100644 index 000000000000..04edbb82f4be --- /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_filepath. +The following example show the usage of case reader with a case file (.cas.h5) +read from examples repo 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 aw well. + +.. code-block:: python + + >>> reader.rp_vars() + >>> reader.config_vars() From d29c82b410dbd6b141dbdbe61bceeb093f17207c Mon Sep 17 00:00:00 2001 From: Prithwish Mukherjee Date: Fri, 21 Oct 2022 17:09:53 +0530 Subject: [PATCH 2/5] Minor in-code doc update in case reader --- src/ansys/fluent/core/filereader/casereader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From c114d539cfc9259a1797402c364d4c62f91b7467 Mon Sep 17 00:00:00 2001 From: Prithwish Mukherjee Date: Fri, 21 Oct 2022 17:31:33 +0530 Subject: [PATCH 3/5] vale corrections --- doc/source/api/core/casereader.rst | 10 +++++----- doc/source/api/core/index.rst | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/source/api/core/casereader.rst b/doc/source/api/core/casereader.rst index 04edbb82f4be..612eea07e92d 100644 --- a/doc/source/api/core/casereader.rst +++ b/doc/source/api/core/casereader.rst @@ -1,6 +1,6 @@ .. _ref_casereader: -Case Reader +Case reader =========== Case reader provides a reader for fluent case files. @@ -8,9 +8,9 @@ Case reader provides a reader for fluent case files. Sample usage ------------ -You can use the case reader by importing it and passing a case_filepath. +You can use the case reader by importing it and passing a case filepath. The following example show the usage of case reader with a case file (.cas.h5) -read from examples repo as shown: +read from examples repository as shown: .. code-block:: python @@ -45,9 +45,9 @@ case file path. >>> reader = CaseReader(project_filepath="Dir1/Dir2/project.flprj") -Capability to read rp and config vars +Capability to read 'rp' and 'config' vars ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Case reader can provide the rp and config vars aw well. +Case reader can provide the 'rp' and 'config' vars as well. .. code-block:: python 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 From c61e03ad35f7888472aa412ab58ce9ed4b0cf89f Mon Sep 17 00:00:00 2001 From: Prithwish Mukherjee Date: Fri, 21 Oct 2022 17:35:03 +0530 Subject: [PATCH 4/5] Updated vale vocab --- doc/.vale.ini | 2 +- doc/source/api/core/casereader.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 index 612eea07e92d..11a097fcee2e 100644 --- a/doc/source/api/core/casereader.rst +++ b/doc/source/api/core/casereader.rst @@ -8,7 +8,7 @@ Case reader provides a reader for fluent case files. Sample usage ------------ -You can use the case reader by importing it and passing a case filepath. +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: From cdcc32ead5414c737c4d74ffc3e58112554072bf Mon Sep 17 00:00:00 2001 From: Prithwish Mukherjee Date: Fri, 21 Oct 2022 17:36:18 +0530 Subject: [PATCH 5/5] -- --- doc/source/api/core/casereader.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/api/core/casereader.rst b/doc/source/api/core/casereader.rst index 11a097fcee2e..aa38449c2fd1 100644 --- a/doc/source/api/core/casereader.rst +++ b/doc/source/api/core/casereader.rst @@ -45,9 +45,9 @@ case file path. >>> reader = CaseReader(project_filepath="Dir1/Dir2/project.flprj") -Capability to read 'rp' and 'config' vars +Capability to read rp and config vars ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Case reader can provide the 'rp' and 'config' vars as well. +Case reader can provide the rp and config vars as well. .. code-block:: python