From c8832f97593345693cbbc3bf268107b1c21696b2 Mon Sep 17 00:00:00 2001 From: mayankansys Date: Fri, 20 Mar 2026 12:07:25 +0530 Subject: [PATCH 1/8] updated the session file --- doc/source/user_guide/session/session.rst | 37 +++++++++++++++-------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/doc/source/user_guide/session/session.rst b/doc/source/user_guide/session/session.rst index 2cf0baeac8e..378c34dea41 100644 --- a/doc/source/user_guide/session/session.rst +++ b/doc/source/user_guide/session/session.rst @@ -5,17 +5,27 @@ Using PyFluent sessions ======================= -You can obtain a PyFluent session object by calling either of the functions, :func:`launch_fluent() -` or :func:`connect_to_fluent() `. +The encouraged way to create a PyFluent session is to use the ``from_<...>`` class methods on a session type, for +example :meth:`Solver.from_install() `, +:meth:`Solver.from_container() `, +:meth:`Solver.from_connection() `, or +:meth:`Solver.from_pim() `. +For full details see :ref:`ref_launch_guide`. +For example, to launch a solver session from a local Fluent installation: .. code:: python >>> import ansys.fluent.core as pyfluent >>> from ansys.fluent.core.examples import download_file >>> case_file_name = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow") - >>> data_file_name = download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow") - >>> solver_session = pyfluent.launch_fluent(case_data_file_name=case_file_name) + >>> solver_session = pyfluent.Solver.from_install(case_file_name=case_file_name) + +.. note:: + + You can also use the lower-level :func:`launch_fluent() ` + and :func:`connect_to_fluent() ` functions, + but the ``from_<...>`` class methods are recommended for new code. Solution mode sessions @@ -51,7 +61,7 @@ session that starts a second Fluent instance and is independent of your PyFluent .. code:: python >>> import ansys.fluent.core as pyfluent - >>> meshing_session = pyfluent.launch_fluent(mode=pyfluent.FluentMode.MESHING) + >>> meshing_session = pyfluent.Meshing.from_install() A uniform interface exists across solver settings objects. For instance, @@ -165,7 +175,7 @@ You can also create a :obj:`~ansys.fluent.core.session_pure_meshing.PureMeshing` .. code:: python >>> import ansys.fluent.core as pyfluent - >>> pure_meshing = pyfluent.launch_fluent(mode=pyfluent.FluentMode.PURE_MESHING) + >>> pure_meshing = pyfluent.PureMeshing.from_install() The only difference between the two meshing session types is that a pure session cannot be @@ -208,8 +218,8 @@ within its intended scope: >>> from ansys.fluent.core.examples import download_file >>> from ansys.fluent.core import using >>> from ansys.fluent.core.solver import ReadCase, Viscous - >>> solver_session_1 = pyfluent.launch_fluent() - >>> solver_session_2 = pyfluent.launch_fluent() + >>> solver_session_1 = pyfluent.Solver.from_install() + >>> solver_session_2 = pyfluent.Solver.from_install() >>> case_file = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow") >>> with using(solver_session_1): ... ReadCase()(file_name=case_file) @@ -295,9 +305,12 @@ each session can be ended independently of the others. Calling the ``exit()`` me Each Fluent session terminates in this scenario because both PyFluent :ref:`Session ` objects were obtained by -calling the :func:`launch_fluent() ` function. If the :func:`connect_to_fluent() ` function were used instead, the -Fluent session would terminate upon the ``exit()`` method call if and only if the :func:`connect_to_fluent() ` -function were called with the argument value ``cleanup_on_exit=True``. +using a ``from_<...>`` launch method (for example, :meth:`from_install() `). +If :meth:`from_connection() ` were used instead, the +Fluent session would not be terminated upon ``exit()`` by default. +For configurable cleanup behavior when attaching to an existing Fluent process, +use :func:`connect_to_fluent() ` +directly with its ``cleanup_on_exit`` parameter. Session exiting can also happen implicitly when :ref:`Session ` objects are garbage collected. The same rules apply regarding Fluent termination whether the exit is explicit via an ``.exit()`` method call or implicit. @@ -308,7 +321,7 @@ being garbage collected: .. code:: python >>> def run_solver(): - >>> solver_session = pyfluent.launch_fluent() + >>> solver_session = pyfluent.Solver.from_install() >>> # >>> # solver is exited at the end of the function From 042f7d427fdd371b1e99e5a12a27b1143f09b1a3 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Fri, 20 Mar 2026 06:43:06 +0000 Subject: [PATCH 2/8] chore: adding changelog file 5005.documentation.md [dependabot-skip] --- doc/changelog.d/5005.documentation.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/5005.documentation.md diff --git a/doc/changelog.d/5005.documentation.md b/doc/changelog.d/5005.documentation.md new file mode 100644 index 00000000000..607d2f094b5 --- /dev/null +++ b/doc/changelog.d/5005.documentation.md @@ -0,0 +1 @@ +Updated the session file From d226da55433461a5582920c5c451bfda1aae466f Mon Sep 17 00:00:00 2001 From: mayankansys Date: Tue, 7 Apr 2026 11:36:47 +0530 Subject: [PATCH 3/8] updated --- doc/rstgen.py | 25 +++++++++++++++++++++---- pyproject.toml | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/doc/rstgen.py b/doc/rstgen.py index 279f5eba4a7..f6b6bed6c5f 100644 --- a/doc/rstgen.py +++ b/doc/rstgen.py @@ -1,6 +1,7 @@ """Provides a module for generating Fluent Datamodel and TUI RST files.""" import fnmatch +import importlib import os import pathlib from pathlib import Path @@ -282,9 +283,25 @@ def _write_datamodel_index_doc(datamodels: list, mode: str): f.write(f".. _ref_{mode}_datamodel:\n\n") f.write(f"{datamodel_mode}\n") f.write(f"{'=' * len(datamodel_mode)}\n\n") - f.write(".. automodule:: ansys.fluent.core.datamodel\n") - f.write(" :autosummary:\n\n") - f.write(" :autosummary-members:\n\n") + generated_datamodel_pkg = _get_file_or_folder(mode=mode, is_datamodel=True) + candidate_modules = [ + "ansys.fluent.core.datamodel", + f"ansys.fluent.core.generated.{generated_datamodel_pkg}", + ] + + datamodel_module_name = None + for candidate in candidate_modules: + try: + importlib.import_module(candidate) + datamodel_module_name = candidate + break + except Exception: + pass + + if datamodel_module_name is not None: + f.write(f".. automodule:: {datamodel_module_name}\n") + f.write(" :autosummary:\n\n") + f.write(" :autosummary-members:\n\n") f.write(".. toctree::\n") f.write(" :hidden:\n\n") for datamodel in datamodels: @@ -371,7 +388,7 @@ def _write_doc(menu: type, mode: str, is_datamodel: bool): f.write(f"{'=' * len(title)}\n\n") f.write(f".. autoclass:: {menu_name}\n") f.write( - f" :members: {', '.join(_get_sorted_members(menu['without_members']))}\n" + f" :members: {',\n'.join(_get_sorted_members(menu['without_members']))}\n" ) f.write(" :show-inheritance:\n") f.write(" :undoc-members:\n") diff --git a/pyproject.toml b/pyproject.toml index cc2e4244d40..a8da395ff30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -213,7 +213,7 @@ name = "Test" showcontent = true [tool.bandit] -exclude_dirs = ["src/ansys/fluent/core/generated", "examples", "tests"] +exclude_dirs = ["src/ansys/fluent/core/generated", "examples", "tests", "doc/_build"] skips = [ "B403", # Only for pickle module. "B404", From 2b5d183aaa80a2d2ed446cdbc4826bdef9db4f7b Mon Sep 17 00:00:00 2001 From: mayankansys Date: Thu, 9 Apr 2026 12:42:51 +0530 Subject: [PATCH 4/8] update --- doc/source/cheatsheet/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/source/cheatsheet/.gitignore b/doc/source/cheatsheet/.gitignore index 2efb7a86116..ad293093b07 100644 --- a/doc/source/cheatsheet/.gitignore +++ b/doc/source/cheatsheet/.gitignore @@ -1 +1,2 @@ -/.quarto/ \ No newline at end of file +/.quarto/ +**/*.quarto_ipynb From 458c2560dbeb8c833e16e319cca22e8ba62cb72c Mon Sep 17 00:00:00 2001 From: mayankansys Date: Thu, 9 Apr 2026 12:55:51 +0530 Subject: [PATCH 5/8] updated rstgen --- doc/rstgen.py | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/doc/rstgen.py b/doc/rstgen.py index f6b6bed6c5f..279f5eba4a7 100644 --- a/doc/rstgen.py +++ b/doc/rstgen.py @@ -1,7 +1,6 @@ """Provides a module for generating Fluent Datamodel and TUI RST files.""" import fnmatch -import importlib import os import pathlib from pathlib import Path @@ -283,25 +282,9 @@ def _write_datamodel_index_doc(datamodels: list, mode: str): f.write(f".. _ref_{mode}_datamodel:\n\n") f.write(f"{datamodel_mode}\n") f.write(f"{'=' * len(datamodel_mode)}\n\n") - generated_datamodel_pkg = _get_file_or_folder(mode=mode, is_datamodel=True) - candidate_modules = [ - "ansys.fluent.core.datamodel", - f"ansys.fluent.core.generated.{generated_datamodel_pkg}", - ] - - datamodel_module_name = None - for candidate in candidate_modules: - try: - importlib.import_module(candidate) - datamodel_module_name = candidate - break - except Exception: - pass - - if datamodel_module_name is not None: - f.write(f".. automodule:: {datamodel_module_name}\n") - f.write(" :autosummary:\n\n") - f.write(" :autosummary-members:\n\n") + f.write(".. automodule:: ansys.fluent.core.datamodel\n") + f.write(" :autosummary:\n\n") + f.write(" :autosummary-members:\n\n") f.write(".. toctree::\n") f.write(" :hidden:\n\n") for datamodel in datamodels: @@ -388,7 +371,7 @@ def _write_doc(menu: type, mode: str, is_datamodel: bool): f.write(f"{'=' * len(title)}\n\n") f.write(f".. autoclass:: {menu_name}\n") f.write( - f" :members: {',\n'.join(_get_sorted_members(menu['without_members']))}\n" + f" :members: {', '.join(_get_sorted_members(menu['without_members']))}\n" ) f.write(" :show-inheritance:\n") f.write(" :undoc-members:\n") From 4401436219926701d9b5d97f01ed252d10c6c150 Mon Sep 17 00:00:00 2001 From: mayankansys Date: Thu, 9 Apr 2026 12:59:34 +0530 Subject: [PATCH 6/8] update --- doc/source/cheatsheet/.gitignore | 3 +-- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/source/cheatsheet/.gitignore b/doc/source/cheatsheet/.gitignore index ad293093b07..2efb7a86116 100644 --- a/doc/source/cheatsheet/.gitignore +++ b/doc/source/cheatsheet/.gitignore @@ -1,2 +1 @@ -/.quarto/ -**/*.quarto_ipynb +/.quarto/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index b0420cb3680..71d8819d9e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -213,7 +213,7 @@ name = "Test" showcontent = true [tool.bandit] -exclude_dirs = ["src/ansys/fluent/core/generated", "examples", "tests", "doc/_build"] +exclude_dirs = ["src/ansys/fluent/core/generated", "examples", "tests"] skips = [ "B403", # Only for pickle module. "B404", From 71ebf22ba37f7ba5b8dd6808825fdbe48b50f018 Mon Sep 17 00:00:00 2001 From: Mayank Kumar Date: Thu, 9 Apr 2026 14:37:39 +0530 Subject: [PATCH 7/8] Update doc/source/user_guide/session/session.rst Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- doc/source/user_guide/session/session.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/user_guide/session/session.rst b/doc/source/user_guide/session/session.rst index 378c34dea41..9599c3f5c17 100644 --- a/doc/source/user_guide/session/session.rst +++ b/doc/source/user_guide/session/session.rst @@ -10,7 +10,7 @@ example :meth:`Solver.from_install() `, :meth:`Solver.from_connection() `, or :meth:`Solver.from_pim() `. -For full details see :ref:`ref_launch_guide`. +For full details, see :ref:`ref_launch_guide`. For example, to launch a solver session from a local Fluent installation: From f9da2b64718828d426d058945773c37ee33b80ca Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Thu, 9 Apr 2026 11:15:26 +0000 Subject: [PATCH 8/8] chore: adding changelog file 5005.documentation.md [dependabot-skip] --- doc/changelog.d/5005.documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.d/5005.documentation.md b/doc/changelog.d/5005.documentation.md index 607d2f094b5..89e1071f2f3 100644 --- a/doc/changelog.d/5005.documentation.md +++ b/doc/changelog.d/5005.documentation.md @@ -1 +1 @@ -Updated the session file +Updated the session file [skip tests]