ansys-fluent-core 0.28.dev0__py3-none-any.whl → 0.28.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ansys-fluent-core might be problematic. Click here for more details.

Files changed (63) hide show
  1. ansys/fluent/core/__init__.py +15 -16
  2. ansys/fluent/core/_version.py +1 -1
  3. ansys/fluent/core/codegen/allapigen.py +0 -3
  4. ansys/fluent/core/codegen/builtin_settingsgen.py +5 -20
  5. ansys/fluent/core/codegen/print_fluent_version.py +9 -14
  6. ansys/fluent/core/codegen/walk_api.py +57 -0
  7. ansys/fluent/core/fluent_connection.py +26 -22
  8. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  9. ansys/fluent/core/generated/datamodel_252/meshing.py +21 -0
  10. ansys/fluent/core/generated/datamodel_252/preferences.py +7 -0
  11. ansys/fluent/core/generated/fluent_version_252.py +3 -3
  12. ansys/fluent/core/generated/meshing/tui_252.py +1183 -1133
  13. ansys/fluent/core/generated/solver/settings_252.py +8944 -6572
  14. ansys/fluent/core/generated/solver/settings_252.pyi +6357 -5352
  15. ansys/fluent/core/generated/solver/tui_252.py +3039 -2473
  16. ansys/fluent/core/journaling.py +4 -4
  17. ansys/fluent/core/launcher/fluent_container.py +31 -7
  18. ansys/fluent/core/launcher/launcher.py +3 -2
  19. ansys/fluent/core/launcher/launcher_utils.py +9 -0
  20. ansys/fluent/core/launcher/process_launch_string.py +8 -6
  21. ansys/fluent/core/launcher/pyfluent_enums.py +6 -3
  22. ansys/fluent/core/launcher/server_info.py +25 -2
  23. ansys/fluent/core/launcher/slurm_launcher.py +6 -3
  24. ansys/fluent/core/launcher/standalone_launcher.py +11 -9
  25. ansys/fluent/core/post_objects/post_helper.py +16 -10
  26. ansys/fluent/core/services/__init__.py +2 -0
  27. ansys/fluent/core/services/api_upgrade.py +11 -9
  28. ansys/fluent/core/services/app_utilities.py +408 -0
  29. ansys/fluent/core/services/datamodel_se.py +42 -5
  30. ansys/fluent/core/services/datamodel_tui.py +5 -2
  31. ansys/fluent/core/services/field_data.py +1 -0
  32. ansys/fluent/core/services/reduction.py +2 -0
  33. ansys/fluent/core/services/settings.py +5 -2
  34. ansys/fluent/core/session.py +27 -4
  35. ansys/fluent/core/session_pure_meshing.py +1 -1
  36. ansys/fluent/core/session_solver.py +0 -1
  37. ansys/fluent/core/solver/__init__.py +6 -0
  38. ansys/fluent/core/solver/flobject.py +15 -27
  39. ansys/fluent/core/solver/function/reduction.py +3 -0
  40. ansys/fluent/core/solver/settings_builtin_data.py +1 -1
  41. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +5 -5
  42. ansys/fluent/core/streaming_services/events_streaming.py +336 -52
  43. ansys/fluent/tests/conftest.py +30 -0
  44. ansys/fluent/tests/test_builtin_settings.py +1 -1
  45. ansys/fluent/tests/test_codegen.py +0 -410
  46. ansys/fluent/tests/test_datamodel_api.py +449 -0
  47. ansys/fluent/tests/test_datamodel_service.py +64 -64
  48. ansys/fluent/tests/test_events_manager.py +24 -6
  49. ansys/fluent/tests/test_field_data.py +32 -0
  50. ansys/fluent/tests/test_launcher.py +30 -2
  51. ansys/fluent/tests/test_mapped_api.py +774 -0
  52. ansys/fluent/tests/test_reduction.py +30 -0
  53. ansys/fluent/tests/test_session.py +16 -1
  54. ansys/fluent/tests/test_settings_api.py +21 -0
  55. ansys/fluent/tests/test_solution_variables.py +27 -0
  56. ansys/fluent/tests/util/__init__.py +36 -0
  57. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/METADATA +4 -3
  58. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/RECORD +61 -58
  59. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/WHEEL +1 -1
  60. ansys/fluent/core/codegen/settingsgen_old.py +0 -535
  61. ansys/fluent/tests/fluent/test_version/test.py +0 -2
  62. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/AUTHORS +0 -0
  63. {ansys_fluent_core-0.28.dev0.dist-info → ansys_fluent_core-0.28.1.dist-info}/LICENSE +0 -0
@@ -4,14 +4,14 @@
4
4
  class Journal:
5
5
  """Control the writing of Fluent Python journals."""
6
6
 
7
- def __init__(self, scheme_eval):
7
+ def __init__(self, app_utilities):
8
8
  """__init__ method of Journal class."""
9
- self.scheme_eval = scheme_eval
9
+ self._app_utilities = app_utilities
10
10
 
11
11
  def start(self, file_name: str):
12
12
  """Start writing a Fluent Python journal at the specified file_name."""
13
- self.scheme_eval.exec([f'(api-start-python-journal "{file_name}")'])
13
+ self._app_utilities.start_python_journal(journal_name=file_name)
14
14
 
15
15
  def stop(self):
16
16
  """Stop writing the Fluent Python journal."""
17
- self.scheme_eval.exec(["(api-stop-python-journal)"])
17
+ self._app_utilities.stop_python_journal()
@@ -240,14 +240,15 @@ def configure_container_dict(
240
240
  f"Starting Fluent container mounted to {mount_source}, with this path available as {mount_target} for the Fluent session running inside the container."
241
241
  )
242
242
 
243
- if "ports" not in container_dict:
244
- if not port:
245
- port = get_free_port()
246
- container_dict.update(ports={str(port): port}) # container port : host port
247
- else:
243
+ if not port and "ports" in container_dict:
248
244
  # take the specified 'port', OR the first port value from the specified 'ports', for Fluent to use
249
- if not port:
250
- port = next(iter(container_dict["ports"].values()))
245
+ port = next(iter(container_dict["ports"].values()))
246
+ if not port and pyfluent.LAUNCH_FLUENT_PORT:
247
+ port = pyfluent.LAUNCH_FLUENT_PORT
248
+ if not port:
249
+ port = get_free_port()
250
+
251
+ container_dict.update(ports={str(port): port}) # container port : host port
251
252
 
252
253
  if "environment" not in container_dict:
253
254
  if not license_server:
@@ -318,6 +319,29 @@ def configure_container_dict(
318
319
  container_dict["environment"] = {}
319
320
  container_dict["environment"]["FLUENT_NO_AUTOMATIC_TRANSCRIPT"] = "1"
320
321
 
322
+ if (
323
+ os.getenv("REMOTING_NEW_DM_API") == "1"
324
+ or os.getenv("REMOTING_MAPPED_NEW_DM_API") == "1"
325
+ ):
326
+ if "environment" not in container_dict:
327
+ container_dict["environment"] = {}
328
+ if os.getenv("REMOTING_NEW_DM_API") == "1":
329
+ container_dict["environment"]["REMOTING_NEW_DM_API"] = "1"
330
+ if os.getenv("REMOTING_MAPPED_NEW_DM_API") == "1":
331
+ container_dict["environment"]["REMOTING_MAPPED_NEW_DM_API"] = "1"
332
+
333
+ if pyfluent.LAUNCH_FLUENT_IP or os.getenv("REMOTING_SERVER_ADDRESS"):
334
+ if "environment" not in container_dict:
335
+ container_dict["environment"] = {}
336
+ container_dict["environment"]["REMOTING_SERVER_ADDRESS"] = (
337
+ pyfluent.LAUNCH_FLUENT_IP or os.getenv("REMOTING_SERVER_ADDRESS")
338
+ )
339
+
340
+ if pyfluent.LAUNCH_FLUENT_SKIP_PASSWORD_CHECK:
341
+ if "environment" not in container_dict:
342
+ container_dict["environment"] = {}
343
+ container_dict["environment"]["FLUENT_LAUNCHED_FROM_PYFLUENT"] = "1"
344
+
321
345
  fluent_commands = ["-gu", f"-sifile={container_server_info_file}"] + args
322
346
 
323
347
  container_dict_default = {}
@@ -168,8 +168,9 @@ def launch_fluent(
168
168
  See also :mod:`~ansys.fluent.core.launcher.fluent_container`.
169
169
  dry_run : bool, optional
170
170
  Defaults to False. If True, will not launch Fluent, and will instead print configuration information
171
- that would be used as if Fluent was being launched. If dry running a container start,
172
- ``launch_fluent()`` will return the configured ``container_dict``.
171
+ that would be used as if Fluent was being launched. If dry running a standalone start
172
+ ``launch_fluent()`` will return a tuple containing Fluent launch string and the server info file name.
173
+ If dry running a container start, ``launch_fluent()`` will return the configured ``container_dict``.
173
174
  cleanup_on_exit : bool, optional
174
175
  Whether to shut down the connected Fluent session when PyFluent is
175
176
  exited, or the ``exit()`` method is called on the session instance,
@@ -43,6 +43,15 @@ def _get_subprocess_kwargs_for_fluent(env: Dict[str, Any], argvals) -> Dict[str,
43
43
  del fluent_env["PARA_NPROCS"]
44
44
  del fluent_env["PARA_MESH_NPROCS"]
45
45
 
46
+ if pyfluent.LAUNCH_FLUENT_IP:
47
+ fluent_env["REMOTING_SERVER_ADDRESS"] = pyfluent.LAUNCH_FLUENT_IP
48
+
49
+ if pyfluent.LAUNCH_FLUENT_PORT:
50
+ fluent_env["REMOTING_PORTS"] = f"{pyfluent.LAUNCH_FLUENT_PORT}/portspan=2"
51
+
52
+ if pyfluent.LAUNCH_FLUENT_SKIP_PASSWORD_CHECK:
53
+ fluent_env["FLUENT_LAUNCHED_FROM_PYFLUENT"] = "1"
54
+
46
55
  if not is_slurm:
47
56
  if pyfluent.INFER_REMOTING_IP and "REMOTING_SERVER_ADDRESS" not in fluent_env:
48
57
  remoting_ip = find_remoting_ip()
@@ -137,7 +137,14 @@ def get_fluent_exe_path(**launch_argvals) -> Path:
137
137
  return fluent_root / "bin" / "fluent"
138
138
 
139
139
  # Look for Fluent exe path in the following order:
140
- # 1. product_version parameter passed with launch_fluent
140
+ # 1. Custom Path provided by the user in launch_fluent
141
+ fluent_path = launch_argvals.get("fluent_path")
142
+ if fluent_path:
143
+ # Return the fluent_path string verbatim. The path may not even exist
144
+ # in the current machine if user wants to launch fluent externally (dry_run use case).
145
+ return fluent_path
146
+
147
+ # 2. product_version parameter passed with launch_fluent
141
148
  product_version = launch_argvals.get("product_version")
142
149
  if product_version:
143
150
  return get_exe_path(get_fluent_root(FluentVersion(product_version)))
@@ -147,10 +154,5 @@ def get_fluent_exe_path(**launch_argvals) -> Path:
147
154
  if fluent_root:
148
155
  return get_exe_path(Path(fluent_root))
149
156
 
150
- # 2. Custom Path provided by the user in launch_fluent
151
- fluent_path = launch_argvals.get("fluent_path")
152
- if fluent_path:
153
- return Path(fluent_path)
154
-
155
157
  # 3. the latest ANSYS version from AWP_ROOT environment variables
156
158
  return get_exe_path(get_fluent_root(FluentVersion.get_latest_installed()))
@@ -276,9 +276,7 @@ def _get_running_session_mode(
276
276
  return session_mode.get_fluent_value()
277
277
 
278
278
 
279
- def _get_standalone_launch_fluent_version(
280
- product_version: FluentVersion | str | float | int | None,
281
- ) -> FluentVersion | None:
279
+ def _get_standalone_launch_fluent_version(argvals) -> FluentVersion | None:
282
280
  """Determine the Fluent version during the execution of the ``launch_fluent()``
283
281
  method in standalone mode.
284
282
 
@@ -295,9 +293,14 @@ def _get_standalone_launch_fluent_version(
295
293
 
296
294
  # Look for Fluent version in the following order:
297
295
  # 1. product_version parameter passed with launch_fluent
296
+ product_version = argvals.get("product_version")
298
297
  if product_version:
299
298
  return FluentVersion(product_version)
300
299
 
300
+ # If fluent_path is provided, we cannot determine the Fluent version, so returning None.
301
+ if argvals.get("fluent_path"):
302
+ return None
303
+
301
304
  # (DEV) if "PYFLUENT_FLUENT_ROOT" environment variable is defined, we cannot
302
305
  # determine the Fluent version, so returning None.
303
306
  if os.getenv("PYFLUENT_FLUENT_ROOT"):
@@ -10,7 +10,27 @@ from ansys.fluent.core.launcher.error_handler import IpPortNotProvided
10
10
  from ansys.fluent.core.session import _parse_server_info_file
11
11
 
12
12
 
13
- def _get_server_info_file_name(use_tmpdir=True):
13
+ def _get_server_info_file_names(use_tmpdir=True) -> tuple[str, str]:
14
+ """Returns a tuple containing server and client-side file names with the server connection information.
15
+ When server and client are in a different machine, the environment variable SERVER_INFO_DIR
16
+ can be set to a shared directory between the two machines and the server-info file will be
17
+ created in that directory. The value of the environment variable SERVER_INFO_DIR can be
18
+ different for the server and client machines. The relative path of the server-side server-info
19
+ file is passed to Fluent launcher and PyFluent connects to the server using the absolute path
20
+ of the client-side server-info file. A typical use case of the environment variable
21
+ SERVER_INFO_DIR is as follows:
22
+ - Server machine environment variable: SERVER_INFO_DIR=/mnt/shared
23
+ - Client machine environment variable: SERVER_INFO_DIR=\\\\server\\shared
24
+ - Server-side server-info file: /mnt/shared/serverinfo-xyz.txt
25
+ - Client-side server-info file: \\\\server\\shared\\serverinfo-xyz.txt
26
+ - Fluent launcher command: fluent ... -sifile=serverinfo-xyz.txt ...
27
+ - From PyFluent: connect_to_fluent(server_info_file_name="\\\\server\\shared\\serverinfo-xyz.txt")
28
+
29
+ When the environment variable SERVER_INFO_DIR is not set, the server-side and client-side
30
+ file paths for the server-info file are identical. The server-info file is created in the
31
+ temporary directory if ``use_tmpdir`` is True, otherwise it is created in the current working
32
+ directory.
33
+ """
14
34
  server_info_dir = os.getenv("SERVER_INFO_DIR")
15
35
  dir_ = (
16
36
  Path(server_info_dir)
@@ -19,7 +39,10 @@ def _get_server_info_file_name(use_tmpdir=True):
19
39
  )
20
40
  fd, file_name = tempfile.mkstemp(suffix=".txt", prefix="serverinfo-", dir=str(dir_))
21
41
  os.close(fd)
22
- return file_name
42
+ if server_info_dir:
43
+ return Path(file_name).name, file_name
44
+ else:
45
+ return file_name, file_name
23
46
 
24
47
 
25
48
  def _get_server_info(
@@ -64,7 +64,7 @@ from ansys.fluent.core.launcher.pyfluent_enums import (
64
64
  UIMode,
65
65
  _get_argvals_and_session,
66
66
  )
67
- from ansys.fluent.core.launcher.server_info import _get_server_info_file_name
67
+ from ansys.fluent.core.launcher.server_info import _get_server_info_file_names
68
68
  from ansys.fluent.core.session_meshing import Meshing
69
69
  from ansys.fluent.core.session_pure_meshing import PureMeshing
70
70
  from ansys.fluent.core.session_solver import Solver
@@ -416,11 +416,14 @@ class SlurmLauncher:
416
416
  )
417
417
 
418
418
  def _prepare(self):
419
- self._server_info_file_name = _get_server_info_file_name(use_tmpdir=False)
419
+ server_info_file_name_for_server, server_info_file_name_for_client = (
420
+ _get_server_info_file_names(use_tmpdir=False)
421
+ )
422
+ self._server_info_file_name = server_info_file_name_for_client
420
423
  self._argvals.update(self._argvals["scheduler_options"])
421
424
  launch_cmd = _generate_launch_string(
422
425
  self._argvals,
423
- self._server_info_file_name,
426
+ server_info_file_name_for_server,
424
427
  )
425
428
 
426
429
  self._sifile_last_mtime = Path(self._server_info_file_name).stat().st_mtime
@@ -43,7 +43,7 @@ from ansys.fluent.core.launcher.pyfluent_enums import (
43
43
  )
44
44
  from ansys.fluent.core.launcher.server_info import (
45
45
  _get_server_info,
46
- _get_server_info_file_name,
46
+ _get_server_info_file_names,
47
47
  )
48
48
  import ansys.fluent.core.launcher.watchdog as watchdog
49
49
  from ansys.fluent.core.utils.fluent_version import FluentVersion
@@ -128,8 +128,9 @@ class StandaloneLauncher:
128
128
  exited, or the ``exit()`` method is called on the session instance,
129
129
  or if the session instance becomes unreferenced. The default is ``True``.
130
130
  dry_run : bool, optional
131
- Defaults to False. If True, will not launch Fluent, and will instead print configuration information
132
- that would be used as if Fluent was being launched.
131
+ Defaults to False. If True, will not launch Fluent, and will print configuration information
132
+ that would be used as if Fluent was being launched. If True, the ``call()`` method will return
133
+ a tuple containing Fluent launch string and the server info file name.
133
134
  start_transcript : bool, optional
134
135
  Whether to start streaming the Fluent transcript in the client. The
135
136
  default is ``True``. You can stop and start the streaming of the
@@ -188,9 +189,7 @@ class StandaloneLauncher:
188
189
  self.argvals["start_timeout"] = 60
189
190
  if self.argvals["lightweight_mode"] is None:
190
191
  self.argvals["lightweight_mode"] = False
191
- fluent_version = _get_standalone_launch_fluent_version(
192
- self.argvals["product_version"]
193
- )
192
+ fluent_version = _get_standalone_launch_fluent_version(self.argvals)
194
193
  if fluent_version:
195
194
  _raise_non_gui_exception_in_windows(self.argvals["ui_mode"], fluent_version)
196
195
 
@@ -200,10 +199,13 @@ class StandaloneLauncher:
200
199
  if os.getenv("PYFLUENT_FLUENT_DEBUG") == "1":
201
200
  self.argvals["fluent_debug"] = True
202
201
 
203
- self._server_info_file_name = _get_server_info_file_name()
202
+ server_info_file_name_for_server, server_info_file_name_for_client = (
203
+ _get_server_info_file_names()
204
+ )
205
+ self._server_info_file_name = server_info_file_name_for_client
204
206
  self._launch_string = _generate_launch_string(
205
207
  self.argvals,
206
- self._server_info_file_name,
208
+ server_info_file_name_for_server,
207
209
  )
208
210
 
209
211
  self._sifile_last_mtime = Path(self._server_info_file_name).stat().st_mtime
@@ -232,7 +234,7 @@ class StandaloneLauncher:
232
234
  def __call__(self):
233
235
  if self.argvals["dry_run"]:
234
236
  print(f"Fluent launch string: {self._launch_string}")
235
- return
237
+ return self._launch_string, self._server_info_file_name
236
238
  try:
237
239
  logger.debug(f"Launching Fluent with command: {self._launch_cmd}")
238
240
 
@@ -2,6 +2,9 @@
2
2
 
3
3
  import re
4
4
 
5
+ from ansys.fluent.core.solver.flunits import get_si_unit_for_fluent_quantity
6
+ from ansys.fluent.core.utils.fluent_version import FluentVersion
7
+
5
8
 
6
9
  class IncompleteISOSurfaceDefinition(RuntimeError):
7
10
  """Raised when iso-surface definition is incomplete."""
@@ -94,11 +97,9 @@ class PostAPIHelper:
94
97
  def delete_surface_on_server(self):
95
98
  """Deletes the surface on server."""
96
99
  if self.obj.definition.type() == "iso-surface":
97
- self._get_api_handle().iso_surface.delete(self._surface_name_on_server)
100
+ del self._get_api_handle().iso_surface[self._surface_name_on_server]
98
101
  elif self.obj.definition.type() == "plane-surface":
99
- self._get_api_handle().plane_surface.delete(
100
- self._surface_name_on_server
101
- )
102
+ del self._get_api_handle().plane_surface[self._surface_name_on_server]
102
103
 
103
104
  def __init__(self, obj):
104
105
  """__init__ method of PostAPIHelper class."""
@@ -127,15 +128,20 @@ class PostAPIHelper:
127
128
  # Following functions will be deprecated in future.
128
129
  def get_vector_fields(self):
129
130
  """Returns vector field."""
130
- return self.field_info.get_vector_fields_info()
131
+ return self.field_info().get_vector_fields_info()
131
132
 
132
133
  def get_field_unit(self, field):
133
134
  """Returns the unit of the field."""
134
- quantity = self._field_unit_quantity(field)
135
- if quantity == "*null*":
136
- return ""
137
- scheme_eval_str = f"(units/get-pretty-wb-units-from-dimension (units/inquire-dimension '{quantity}))"
138
- return " ".join(self._scheme_str_to_py_list(scheme_eval_str))
135
+ session = self.obj.get_root().session
136
+ if FluentVersion(session.scheme_eval.version) < FluentVersion.v252:
137
+ quantity = self._field_unit_quantity(field)
138
+ if quantity == "*null*":
139
+ return ""
140
+ scheme_eval_str = f"(units/get-pretty-wb-units-from-dimension (units/inquire-dimension '{quantity}))"
141
+ return " ".join(self._scheme_str_to_py_list(scheme_eval_str))
142
+ else:
143
+ fields_info = self.field_info().get_scalar_fields_info()
144
+ return get_si_unit_for_fluent_quantity(fields_info[field]["quantity_name"])
139
145
 
140
146
  def _field_unit_quantity(self, field):
141
147
  scheme_eval_str = f"(cdr (assq 'units (%fill-render-info '{field})))"
@@ -1,5 +1,6 @@
1
1
  """Provides a module to create gRPC services."""
2
2
 
3
+ from ansys.fluent.core.services.app_utilities import AppUtilities
3
4
  from ansys.fluent.core.services.batch_ops import BatchOpsService
4
5
  from ansys.fluent.core.services.datamodel_se import (
5
6
  DatamodelService as DatamodelService_SE,
@@ -22,6 +23,7 @@ from ansys.fluent.core.services.solution_variables import (
22
23
  from ansys.fluent.core.services.transcript import TranscriptService
23
24
 
24
25
  _service_cls_by_name = {
26
+ "app_utilities": AppUtilities,
25
27
  "health_check": HealthCheckService,
26
28
  "datamodel": DatamodelService_SE,
27
29
  "tui": DatamodelService_TUI,
@@ -3,7 +3,7 @@
3
3
  import os
4
4
  from typing import TypeVar
5
5
 
6
- from ansys.fluent.core.services.scheme_eval import SchemeEval
6
+ from ansys.fluent.core.services.app_utilities import AppUtilities
7
7
  from ansys.fluent.core.utils.fluent_version import FluentVersion
8
8
 
9
9
  _TApiUpgradeAdvisor = TypeVar("_TApiUpgradeAdvisor", bound="ApiUpgradeAdvisor")
@@ -12,11 +12,17 @@ _TApiUpgradeAdvisor = TypeVar("_TApiUpgradeAdvisor", bound="ApiUpgradeAdvisor")
12
12
  class ApiUpgradeAdvisor:
13
13
  """API upgrade advisor."""
14
14
 
15
- def __init__(self, scheme_eval: SchemeEval, version: str, mode: str) -> None:
15
+ def __init__(
16
+ self,
17
+ app_utilities: AppUtilities,
18
+ version: str,
19
+ mode: str,
20
+ ) -> None:
16
21
  """Initialize ApiUpgradeAdvisor."""
17
- self._scheme_eval = scheme_eval.scheme_eval
22
+ self._app_utilities = app_utilities
18
23
  self._version = version
19
24
  self._mode = mode
25
+ self._id = None
20
26
 
21
27
  def _can_advise(self) -> bool:
22
28
  return (
@@ -27,16 +33,12 @@ class ApiUpgradeAdvisor:
27
33
 
28
34
  def __enter__(self) -> _TApiUpgradeAdvisor:
29
35
  if self._can_advise():
30
- self._scheme_eval("(define pyfluent-journal-str-port (open-output-string))")
31
- self._scheme_eval("(api-echo-python-port pyfluent-journal-str-port)")
36
+ self._id = self._app_utilities.start_python_journal()
32
37
  return self
33
38
 
34
39
  def __exit__(self, exc_type, exc_value, exc_tb) -> None:
35
40
  if self._can_advise():
36
- self._scheme_eval("(api-unecho-python-port pyfluent-journal-str-port)")
37
- journal_str = self._scheme_eval(
38
- "(close-output-port pyfluent-journal-str-port)"
39
- ).strip()
41
+ journal_str = (self._app_utilities.stop_python_journal(self._id)).strip()
40
42
  if (
41
43
  journal_str.startswith("solver.")
42
44
  and not journal_str.startswith("solver.tui")