Skip to content

Commit 5b5187e

Browse files
chore: Update launcher tests for better coverage (#4629)
## Context Extensive test coverage for the launcher APIs from session classes is introduced. One issue is when a 'PureMeshing' session is launched from PyFluent and 'Meshing' session is connected to it using the launcher api, it might be confusing for users, as now no mechanism exists in server to inform client that it has been launched in 'PureMeshing' mode. **Hence, this limitation is to be documented.** ## Change Summary Tests were added for extensive coverage of launcher APIs and the limitation is documented. ## Impact No direct impact, only a limitation as mentioned above to be documented. **There are four possible connection patterns:** Meshing → Meshing | ✔ Safe | Full capabilities preserved PureMeshing → PureMeshing | ✔ Safe | Capabilities match exactly Meshing → PureMeshing | ✔ Allowed | API connects to a subset of available capabilities PureMeshing → Meshing | ⚠ Not recommended | Meshing API expects solver features that a pure-meshing session cannot provide The fourth scenario is problematic because Meshing may assume capabilities (e.g., solver mode switching) that are not enabled in a pure-meshing session, leading to inconsistent or undefined behavior. In later Fluent release we might consider updating the app-utilities, as suggested by @mkundu1 "An implementation can be done by adding a new method set_pure_meshing_app_mode in the app_utilities service. The new method will be called to set a flag in Fluent when the Fluent session is launched or connected from a PureMeshing PyFluent session. That flag will be checked in get_app_modemethod of app_utilities. We can also block switch-to-solver operation within Fluent when that flag is set." --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 7b0e8d1 commit 5b5187e

File tree

4 files changed

+60
-6
lines changed

4 files changed

+60
-6
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update launcher tests for better coverage

doc/source/user_guide/session/launching_ansys_fluent.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,26 @@ Use this method when:
100100
solver.exit()
101101
solver_connected.exit()
102102
103+
.. note::
104+
105+
PyFluent offers two Python interfaces for meshing:
106+
107+
- ``Meshing``: meshing interface with an additional method to switch to solver mode.
108+
- ``PureMeshing``: meshing interface without any solver switching features.
109+
110+
The two interfaces expose the **same meshing functionality**. The only difference is that
111+
``Meshing`` includes ``switch_to_solver()``.
112+
113+
When connecting to an existing Fluent session
114+
via :meth:`from_connection() <ansys.fluent.core.session_utilities.SessionBase.from_connection>`:
115+
116+
- Use ``PureMeshing.from_connection()`` if the session was launched for **meshing only**.
117+
- Use ``Meshing.from_connection()`` if the session supports **meshing and solving**.
118+
- You may also use ``PureMeshing.from_connection()`` with a session that supports solving,
119+
if you intentionally want access **only to meshing features**.
120+
121+
A ``Meshing`` interface is not recommended for a **meshing-only** session, because
122+
``switch_to_solver()`` would raise an error in that case.
103123

104124
Launch in `PIM <https://pypim.docs.pyansys.com/version/stable/>`_ mode
105125
----------------------------------------------------------------------

src/ansys/fluent/core/session_pure_meshing.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,16 @@
4141

4242

4343
class PureMeshing(BaseSession):
44-
"""Encapsulates a Fluent meshing session.
44+
"""Encapsulates a Fluent meshing session with a meshing-only Python interface.
4545
46-
A ``tui`` object
47-
for meshing TUI commanding, and ``meshing`` and ``workflow``
48-
objects for access to task-based meshing workflows are all
49-
exposed here. No ``switch_to_solver`` method is available
50-
in this mode.
46+
``PureMeshing`` is designed for workflows where meshing and solving are run as
47+
separate stages or in different environments, such as modular or containerized
48+
deployments. It provides a clean API that focuses solely on meshing tasks.
49+
50+
This interface exposes:
51+
52+
- ``workflow`` and ``meshing`` objects for task-based meshing operations.
53+
- ``tui`` for scripting via the legacy Text User Interface (when needed).
5154
"""
5255

5356
_rules = [

tests/test_session.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,36 @@ def test_new_launch_fluent_api():
695695
solver.exit()
696696
solver_connected.exit()
697697

698+
solver_aero = pyfluent.SolverAero.from_install()
699+
assert solver_aero.is_server_healthy()
700+
701+
ip = solver_aero.connection_properties.ip
702+
port = solver_aero.connection_properties.port
703+
password = solver_aero.connection_properties.password
704+
705+
solver_aero_connected = pyfluent.SolverAero.from_connection(
706+
ip=ip, port=port, password=password
707+
)
708+
assert solver_aero_connected.is_server_healthy()
709+
710+
solver_aero.exit()
711+
solver_aero_connected.exit()
712+
713+
meshing = pyfluent.Meshing.from_install()
714+
assert meshing.is_server_healthy()
715+
716+
ip = meshing.connection_properties.ip
717+
port = meshing.connection_properties.port
718+
password = meshing.connection_properties.password
719+
720+
meshing_connected = pyfluent.Meshing.from_connection(
721+
ip=ip, port=port, password=password
722+
)
723+
assert meshing_connected.is_server_healthy()
724+
725+
meshing.exit()
726+
meshing_connected.exit()
727+
698728

699729
def test_new_launch_fluent_api_from_container():
700730
import ansys.fluent.core as pyfluent

0 commit comments

Comments
 (0)