Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/4629.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update launcher tests for better coverage
20 changes: 20 additions & 0 deletions doc/source/user_guide/session/launching_ansys_fluent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,26 @@
solver.exit()
solver_connected.exit()

.. note::

PyFluent offers two Python interfaces for meshing:

- ``Meshing`` – meshing interface with an additional method to switch to solver mode.

Check failure on line 107 in doc/source/user_guide/session/launching_ansys_fluent.rst

View workflow job for this annotation

GitHub Actions / Documentation Style Check

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "doc/source/user_guide/session/launching_ansys_fluent.rst", "range": {"start": {"line": 107, "column": 18}}}, "severity": "ERROR"}
- ``PureMeshing`` – meshing interface without any solver switching features.

Check failure on line 108 in doc/source/user_guide/session/launching_ansys_fluent.rst

View workflow job for this annotation

GitHub Actions / Documentation Style Check

[vale] reported by reviewdog 🐶 [Google.EmDash] Don't put a space before or after a dash. Raw Output: {"message": "[Google.EmDash] Don't put a space before or after a dash.", "location": {"path": "doc/source/user_guide/session/launching_ansys_fluent.rst", "range": {"start": {"line": 108, "column": 22}}}, "severity": "ERROR"}

The two interfaces expose the **same meshing functionality**. The only difference is that
``Meshing`` includes ``switch_to_solver()``.

When connecting to an existing Fluent session
via :meth:`from_connection() <ansys.fluent.core.session_utilities.SessionBase.from_connection>`:

- Use ``PureMeshing.from_connection()`` if the session was launched for **meshing only**.
- Use ``Meshing.from_connection()`` if the session supports **meshing and solving**.
- You may also use ``PureMeshing.from_connection()`` with a session that supports solving,
if you intentionally want access **only to meshing features**.

A ``Meshing`` interface is not recommended for a **meshing-only** session, because
``switch_to_solver()`` would raise an error in that case.

Launch in `PIM <https://pypim.docs.pyansys.com/version/stable/>`_ mode
----------------------------------------------------------------------
Expand Down
15 changes: 10 additions & 5 deletions src/ansys/fluent/core/session_pure_meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@
class PureMeshing(BaseSession):
"""Encapsulates a Fluent meshing session.
A ``tui`` object
for meshing TUI commanding, and ``meshing`` and ``workflow``
objects for access to task-based meshing workflows are all
exposed here. No ``switch_to_solver`` method is available
in this mode.
``PureMeshing`` is useful in modular or containerized workflows
where meshing and solving are run in separate processes. It provides a
clear, restricted interface that matches the capabilities of a meshing-only
session, even if that session happens to run inside a Fluent build that
includes solver components.
It has a ``tui`` object for meshing TUI commanding, and ``meshing``
and ``workflow`` objects for access to task-based meshing workflows.
No ``switch_to_solver`` method is available in this mode.
"""

_rules = [
Expand Down
30 changes: 30 additions & 0 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,36 @@ def test_new_launch_fluent_api():
solver.exit()
solver_connected.exit()

solver_aero = pyfluent.SolverAero.from_install()
assert solver_aero.is_server_healthy()

ip = solver_aero.connection_properties.ip
port = solver_aero.connection_properties.port
password = solver_aero.connection_properties.password

solver_aero_connected = pyfluent.SolverAero.from_connection(
ip=ip, port=port, password=password
)
assert solver_aero_connected.is_server_healthy()

solver_aero.exit()
solver_aero_connected.exit()

meshing = pyfluent.Meshing.from_install()
assert meshing.is_server_healthy()

ip = meshing.connection_properties.ip
port = meshing.connection_properties.port
password = meshing.connection_properties.password

meshing_connected = pyfluent.Meshing.from_connection(
ip=ip, port=port, password=password
)
assert meshing_connected.is_server_healthy()

meshing.exit()
meshing_connected.exit()


def test_new_launch_fluent_api_from_container():
import ansys.fluent.core as pyfluent
Expand Down
Loading