From a31d3a86a1e1a54d7692fa9d221c1850e1d8bbc7 Mon Sep 17 00:00:00 2001 From: mayankansys Date: Mon, 16 Mar 2026 17:06:11 +0530 Subject: [PATCH 1/5] feat: added the changes --- src/ansys/fluent/core/session.py | 27 +++++++++++++++++++++++++++ tests/test_launcher.py | 13 +++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/ansys/fluent/core/session.py b/src/ansys/fluent/core/session.py index 423fa213b0c..847f9bac6e4 100644 --- a/src/ansys/fluent/core/session.py +++ b/src/ansys/fluent/core/session.py @@ -312,6 +312,33 @@ def id(self) -> str: """Return the session ID.""" return self._fluent_connection._id + @property + def precision(self) -> int: + """Return the current solver precision. + + Returns + ------- + int + ``1`` for single precision, ``2`` for double precision. + """ + return 2 if self.scheme.eval("(rp-double?)") else 1 + + @property + def dimension(self) -> int: + """Return the current dimensionality. + + Returns + ------- + int + ``2`` for 2D, ``3`` for 3D. + """ + return 3 if self.scheme.eval("(rp-3d?)") else 2 + + @property + def processor_count(self) -> int: + """Return the current processor count.""" + return int(str(self.rp_vars("parallel/nprocs_string")).strip('"')) + def start_journal(self, file_name: str): """Executes tui command to start journal.""" warnings.warn("Use -> journal.start()", PyFluentDeprecationWarning) diff --git a/tests/test_launcher.py b/tests/test_launcher.py index d6b7c73f11f..a541c12712d 100644 --- a/tests/test_launcher.py +++ b/tests/test_launcher.py @@ -531,16 +531,17 @@ def test_additional_arguments_fluent_launch_args_string(): def test_processor_count(): - def get_processor_count(solver): - return int(solver.rp_vars("parallel/nprocs_string").strip('"')) - grpc_kwds = get_grpc_launcher_args_for_gh_runs() - with pyfluent.launch_fluent(processor_count=2, **grpc_kwds) as solver: - assert get_processor_count(solver) == 2 + with pyfluent.launch_fluent( + dimension=2, precision="single", processor_count=2, **grpc_kwds + ) as solver: + assert solver.dimension == 2 + assert solver.precision == 1 + assert solver.processor_count == 2 # The following check is not yet supported for container launch # https://github.com/ansys/pyfluent/issues/2624 # with pyfluent.launch_fluent(additional_arguments="-t2") as solver: - # assert get_processor_count(solver) == 2 + # assert solver.processor_count == 2 def test_container_mount_source_target(caplog): From 585c1ec4b0ef17f21ab6526317aaa476e51be316 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:39:17 +0000 Subject: [PATCH 2/5] chore: adding changelog file 4994.added.md [dependabot-skip] --- doc/changelog.d/4994.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/4994.added.md diff --git a/doc/changelog.d/4994.added.md b/doc/changelog.d/4994.added.md new file mode 100644 index 00000000000..9b0ce9bcfd2 --- /dev/null +++ b/doc/changelog.d/4994.added.md @@ -0,0 +1 @@ +Added the changes From 44310c1145df1d57c7d867e123a2ebd2cb0a56ad Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Tue, 17 Mar 2026 07:22:29 +0000 Subject: [PATCH 3/5] chore: adding changelog file 4994.added.md [dependabot-skip] --- doc/changelog.d/4994.added.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.d/4994.added.md b/doc/changelog.d/4994.added.md index 9b0ce9bcfd2..188764c1ab6 100644 --- a/doc/changelog.d/4994.added.md +++ b/doc/changelog.d/4994.added.md @@ -1 +1 @@ -Added the changes +Add BaseSession runtime properties for precision, dimension, and processor count From 1ae5df34d22bbe8868e1252d1e2b4694280ddf02 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Tue, 17 Mar 2026 07:37:15 +0000 Subject: [PATCH 4/5] chore: adding changelog file 4994.added.md [dependabot-skip] --- doc/changelog.d/4994.added.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.d/4994.added.md b/doc/changelog.d/4994.added.md index 188764c1ab6..2a493648762 100644 --- a/doc/changelog.d/4994.added.md +++ b/doc/changelog.d/4994.added.md @@ -1 +1 @@ -Add BaseSession runtime properties for precision, dimension, and processor count +Add BaseSession changes From 2dea0317aefcc2c8916ef001ffaf5eff8a106528 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Tue, 17 Mar 2026 16:02:35 +0000 Subject: [PATCH 5/5] chore: adding changelog file 4994.added.md [dependabot-skip] --- doc/changelog.d/4994.added.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.d/4994.added.md b/doc/changelog.d/4994.added.md index 2a493648762..36d9bcfc548 100644 --- a/doc/changelog.d/4994.added.md +++ b/doc/changelog.d/4994.added.md @@ -1 +1 @@ -Add BaseSession changes +Add BaseSession solver properties