ansys-fluent-core 0.14.dev0__py3-none-any.whl → 0.14.dev2__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 (80) hide show
  1. ansys/fluent/core/__init__.py +12 -12
  2. ansys/fluent/core/_version.py +1 -1
  3. ansys/fluent/core/docs/README.rst +26 -26
  4. ansys/fluent/core/examples/downloads.py +28 -16
  5. ansys/fluent/core/filereader/case_file.py +20 -11
  6. ansys/fluent/core/fluent_connection.py +21 -1
  7. ansys/fluent/core/launcher/fluent_container.py +1 -1
  8. ansys/fluent/core/launcher/fluent_launcher_options.json +10 -0
  9. ansys/fluent/core/launcher/launcher.py +29 -15
  10. ansys/fluent/core/meshing/tui_231.py +7642 -7642
  11. ansys/fluent/core/services/datamodel_se.py +142 -110
  12. ansys/fluent/core/services/field_data.py +278 -29
  13. ansys/fluent/core/services/meshing_queries.py +1795 -0
  14. ansys/fluent/core/services/settings.py +1 -1
  15. ansys/fluent/core/services/svar.py +606 -0
  16. ansys/fluent/core/session_pure_meshing.py +4 -5
  17. ansys/fluent/core/solver/flobject.py +59 -2
  18. ansys/fluent/core/solver/settings_222/change_type.py +1 -1
  19. ansys/fluent/core/solver/settings_222/clear_generated_data.py +1 -1
  20. ansys/fluent/core/solver/settings_222/compute_2.py +1 -1
  21. ansys/fluent/core/solver/settings_222/delete_design_points.py +1 -1
  22. ansys/fluent/core/solver/settings_222/position_1.py +1 -1
  23. ansys/fluent/core/solver/settings_222/setup_unsteady_statistics.py +1 -1
  24. ansys/fluent/core/solver/settings_222/target.py +1 -1
  25. ansys/fluent/core/solver/settings_222/up_vector.py +1 -1
  26. ansys/fluent/core/solver/settings_222/update_selected.py +1 -1
  27. ansys/fluent/core/solver/settings_222/write_1.py +1 -1
  28. ansys/fluent/core/solver/settings_222/write_views.py +1 -1
  29. ansys/fluent/core/solver/settings_231/abaqus.py +2 -2
  30. ansys/fluent/core/solver/settings_231/activate_cell_zone.py +1 -1
  31. ansys/fluent/core/solver/settings_231/calculate_patch.py +2 -2
  32. ansys/fluent/core/solver/settings_231/change_type.py +1 -1
  33. ansys/fluent/core/solver/settings_231/clear_generated_data.py +1 -1
  34. ansys/fluent/core/solver/settings_231/compute_1.py +1 -1
  35. ansys/fluent/core/solver/settings_231/convert_skewed_cells_1.py +1 -1
  36. ansys/fluent/core/solver/settings_231/custom_heat_flux.py +1 -1
  37. ansys/fluent/core/solver/settings_231/customize_fmg_initialization.py +2 -2
  38. ansys/fluent/core/solver/settings_231/delete_design_points.py +1 -1
  39. ansys/fluent/core/solver/settings_231/export_1.py +1 -1
  40. ansys/fluent/core/solver/settings_231/export_modifications.py +1 -1
  41. ansys/fluent/core/solver/settings_231/film_heat_transfer.py +1 -1
  42. ansys/fluent/core/solver/settings_231/film_mass_flow.py +1 -1
  43. ansys/fluent/core/solver/settings_231/forces.py +4 -4
  44. ansys/fluent/core/solver/settings_231/heat_transfer_1.py +1 -1
  45. ansys/fluent/core/solver/settings_231/heat_transfer_sensible.py +1 -1
  46. ansys/fluent/core/solver/settings_231/mass_flow_1.py +1 -1
  47. ansys/fluent/core/solver/settings_231/mechanical_apdl.py +1 -1
  48. ansys/fluent/core/solver/settings_231/mechanical_apdl_input.py +2 -2
  49. ansys/fluent/core/solver/settings_231/modified_setting.py +1 -1
  50. ansys/fluent/core/solver/settings_231/moments.py +2 -2
  51. ansys/fluent/core/solver/settings_231/number_density.py +2 -2
  52. ansys/fluent/core/solver/settings_231/particle_summary.py +1 -1
  53. ansys/fluent/core/solver/settings_231/position_1.py +1 -1
  54. ansys/fluent/core/solver/settings_231/pressure_work_1.py +1 -1
  55. ansys/fluent/core/solver/settings_231/print_histogram.py +1 -1
  56. ansys/fluent/core/solver/settings_231/projected_surface_area.py +2 -2
  57. ansys/fluent/core/solver/settings_231/rad_heat_trans.py +1 -1
  58. ansys/fluent/core/solver/settings_231/read_journal.py +1 -1
  59. ansys/fluent/core/solver/settings_231/rotate.py +2 -2
  60. ansys/fluent/core/solver/settings_231/sample_1.py +4 -4
  61. ansys/fluent/core/solver/settings_231/set_ambient_color.py +1 -1
  62. ansys/fluent/core/solver/settings_231/set_light.py +2 -2
  63. ansys/fluent/core/solver/settings_231/setup_unsteady_statistics.py +1 -1
  64. ansys/fluent/core/solver/settings_231/surface_integrals.py +1 -1
  65. ansys/fluent/core/solver/settings_231/taitherm.py +1 -1
  66. ansys/fluent/core/solver/settings_231/target.py +1 -1
  67. ansys/fluent/core/solver/settings_231/translate.py +1 -1
  68. ansys/fluent/core/solver/settings_231/up_vector.py +1 -1
  69. ansys/fluent/core/solver/settings_231/update_selected.py +1 -1
  70. ansys/fluent/core/solver/settings_231/viscous_work.py +1 -1
  71. ansys/fluent/core/solver/settings_231/volume_integrals.py +1 -1
  72. ansys/fluent/core/solver/settings_231/write_1.py +1 -1
  73. ansys/fluent/core/solver/settings_231/write_histogram.py +1 -1
  74. ansys/fluent/core/solver/settings_231/write_views.py +1 -1
  75. ansys/fluent/core/solver/tui_231.py +36423 -36423
  76. {ansys_fluent_core-0.14.dev0.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/METADATA +30 -30
  77. {ansys_fluent_core-0.14.dev0.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/RECORD +80 -78
  78. {ansys_fluent_core-0.14.dev0.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/LICENSE +0 -0
  79. {ansys_fluent_core-0.14.dev0.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/WHEEL +0 -0
  80. {ansys_fluent_core-0.14.dev0.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/top_level.txt +0 -0
@@ -18,7 +18,7 @@ from ansys.fluent.core.session import BaseSession as Fluent # noqa: F401
18
18
  from ansys.fluent.core.utils import fldoc
19
19
  from ansys.fluent.core.utils.setup_for_fluent import setup_for_fluent # noqa: F401
20
20
 
21
- _VERSION_INFO = "Build date: April 19, 2023 01:18 UTC ShaID: 7342352a1"
21
+ _VERSION_INFO = "Build date: May 19, 2023 17:23 UTC ShaID: 162e819"
22
22
  """Global variable indicating the version of the PyFluent package - Empty by default"""
23
23
 
24
24
  _THIS_DIRNAME = os.path.dirname(__file__)
@@ -56,17 +56,8 @@ with open(yaml_path, "rt") as f:
56
56
  logging.config.dictConfig(config)
57
57
 
58
58
  # Setup data directory
59
- try:
60
- USER_DATA_PATH = appdirs.user_data_dir("ansys_fluent_core")
61
- if not os.path.exists(USER_DATA_PATH):
62
- os.makedirs(USER_DATA_PATH)
63
-
64
- EXAMPLES_PATH = os.path.join(USER_DATA_PATH, "examples")
65
- if not os.path.exists(EXAMPLES_PATH):
66
- os.makedirs(EXAMPLES_PATH)
67
-
68
- except Exception:
69
- pass
59
+ USER_DATA_PATH = appdirs.user_data_dir(appname="ansys_fluent_core", appauthor="Ansys")
60
+ EXAMPLES_PATH = os.path.join(USER_DATA_PATH, "examples")
70
61
 
71
62
  BUILDING_GALLERY = False
72
63
 
@@ -77,3 +68,12 @@ INFER_REMOTING_IP = True
77
68
  INFER_REMOTING_IP_TIMEOUT_PER_IP = 2
78
69
 
79
70
  pydoc.text.docother = fldoc.docother.__get__(pydoc.text, pydoc.TextDoc)
71
+
72
+ # Whether to use datamodel state caching
73
+ DATAMODEL_USE_STATE_CACHE = True
74
+
75
+ # Whether to use datamodel attribute caching
76
+ DATAMODEL_USE_ATTR_CACHE = True
77
+
78
+ # Whether stream and cache commands state
79
+ DATAMODEL_USE_NOCOMMANDS_DIFF_STATE = True
@@ -6,7 +6,7 @@ version_info = 0, 1, 'dev0'
6
6
  """
7
7
 
8
8
  # major, minor, patch
9
- version_info = 0, 14, "dev0"
9
+ version_info = 0, 14, "dev2"
10
10
 
11
11
  # Nice string for the version
12
12
  __version__ = ".".join(map(str, version_info))
@@ -10,12 +10,12 @@ PyFluent
10
10
  :target: https://pypi.org/project/ansys-fluent-core
11
11
  :alt: PyPI
12
12
 
13
- .. |GH-CI| image:: https://github.com/pyansys/pyfluent/actions/workflows/ci.yml/badge.svg
14
- :target: https://github.com/pyansys/pyfluent/actions/workflows/ci.yml
13
+ .. |GH-CI| image:: https://github.com/ansys/pyfluent/actions/workflows/ci.yml/badge.svg
14
+ :target: https://github.com/ansys/pyfluent/actions/workflows/ci.yml
15
15
  :alt: GH-CI
16
16
 
17
- .. |codecov| image:: https://codecov.io/gh/pyansys/pyfluent/branch/main/graph/badge.svg
18
- :target: https://codecov.io/gh/pyansys/pyfluent
17
+ .. |codecov| image:: https://codecov.io/gh/ansys/pyfluent/branch/main/graph/badge.svg
18
+ :target: https://codecov.io/gh/ansys/pyfluent
19
19
 
20
20
  .. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
21
21
  :target: https://opensource.org/licenses/MIT
@@ -25,8 +25,8 @@ PyFluent
25
25
  :target: https://github.com/psf/black
26
26
  :alt: Black
27
27
 
28
- .. |pre-commit| image:: https://results.pre-commit.ci/badge/github/pyansys/pyfluent/main.svg
29
- :target: https://results.pre-commit.ci/latest/github/pyansys/pyfluent/main
28
+ .. |pre-commit| image:: https://results.pre-commit.ci/badge/github/ansys/pyfluent/main.svg
29
+ :target: https://results.pre-commit.ci/latest/github/ansys/pyfluent/main
30
30
  :alt: pre-commit.ci status
31
31
 
32
32
  Overview
@@ -44,14 +44,14 @@ Documentation and issues
44
44
  For comprehensive information on PyFluent, see the latest release
45
45
  `documentation <https://fluent.docs.pyansys.com>`_.
46
46
 
47
- On the `PyFluent Issues <https://github.com/pyansys/pyfluent/issues>`_ page, you can create
47
+ On the `PyFluent Issues <https://github.com/ansys/pyfluent/issues>`_ page, you can create
48
48
  issues to submit questions, report bugs, and request new features. To reach
49
49
  the project support team, email `pyansys.core@ansys.com <pyansys.core@ansys.com>`_.
50
50
 
51
51
  Installation
52
52
  ------------
53
- The ``ansys-fluent-core`` package supports Python 3.7 through Python
54
- 3.10 on Windows and Linux.
53
+ The ``ansys-fluent-core`` package supports Python 3.8 through Python
54
+ 3.11 on Windows and Linux.
55
55
 
56
56
  Install the latest release from `PyPI
57
57
  <https://pypi.org/project/ansys-fluent-core/>`_ with:
@@ -65,7 +65,7 @@ the latest release with:
65
65
 
66
66
  .. code:: console
67
67
 
68
- git clone https://github.com/pyansys/pyfluent.git
68
+ git clone https://github.com/ansys/pyfluent.git
69
69
  cd pyfluent
70
70
  pip install pip -U
71
71
  pip install -e .
@@ -74,7 +74,22 @@ the latest release with:
74
74
  Dependencies
75
75
  ------------
76
76
  You must have a licensed copy of Ansys Fluent installed locally. PyFluent
77
- supports Fluent 2022 R2 and later.
77
+ supports Fluent 2022 R2 and later. The Windows installation of Ansys Fluent automatically
78
+ sets the required environment variables so that PyFluent can find the Ansys Fluent
79
+ installation. Using Fluent 2023 R1 (or 23.1) installed in the default directory as an
80
+ example, the installer automatically sets the ``AWP_ROOT231`` environment variable to point
81
+ to ``C:\Program Files\ANSYS Inc\v231``.
82
+
83
+ On Linux, the required environment variable is not set automatically, and can be set for the
84
+ current user in the current shell session, using Fluent 2023 R1 in the default installation
85
+ directory as an example, before running PyFluent, with:
86
+
87
+ .. code:: console
88
+
89
+ export AWP_ROOT231=/usr/ansys_inc/v231
90
+
91
+ For this setting to persist between different shell sessions for the current user, the same
92
+ export command can instead be added to the user's ``~/.profile`` file.
78
93
 
79
94
  Getting started
80
95
  ---------------
@@ -89,21 +104,6 @@ To launch Fluent from Python, use the ``launch_fluent`` method:
89
104
  solver_session = pyfluent.launch_fluent(mode="solver")
90
105
  solver_session.health_check_service.is_serving
91
106
 
92
- On Windows systems the environment variable ``AWP_ROOT<ver>`` is configured
93
- when Fluent is installed, where ``<ver>`` is the Fluent release number such as
94
- ``231`` for release 2023 R1. PyFluent automatically uses this environment
95
- variable to locate the latest Fluent installation. On Linux systems configure
96
- ``AWP_ROOT<ver>`` to point to the absolute path of an Ansys installation such as
97
- ``/apps/ansys_inc/v231``.
98
-
99
- To use a non-default installation location set ``AWP_ROOT<ver>`` or set the
100
- ``PYFLUENT_FLUENT_ROOT`` environment variable to the ``<install location>/<version>/fluent`` directory,
101
- where ``<version>`` is the Fluent release that you would like to use.
102
- For example, ``v231`` uses release 2023 R1.
103
-
104
- For information on other ways of specifying the Fluent location for PyFluent,
105
- see `Frequently asked questions <https://fluent.docs.pyansys.com/release/0.12/getting_started/faqs.html>`_.
106
-
107
107
  Basic usage
108
108
  ~~~~~~~~~~~
109
109
  You can use the ``solver_session.tui`` interface to run all Fluent TUI commands:
@@ -8,7 +8,9 @@ Examples
8
8
  >>> filename
9
9
  '/home/user/.local/share/ansys_fluent_core/examples/bracket.iges'
10
10
  """
11
+ import logging
11
12
  import os
13
+ import re
12
14
  import shutil
13
15
  from typing import Optional
14
16
  import urllib.request
@@ -17,12 +19,6 @@ import zipfile
17
19
  import ansys.fluent.core as pyfluent
18
20
 
19
21
 
20
- def get_ext(filename: str) -> str:
21
- """Extract the extension of a file."""
22
- ext = os.path.splitext(filename)[1].lower()
23
- return ext
24
-
25
-
26
22
  def delete_downloads() -> bool:
27
23
  """Delete all downloaded examples to free space or update the files."""
28
24
  shutil.rmtree(pyfluent.EXAMPLES_PATH)
@@ -45,25 +41,41 @@ def _get_file_url(filename: str, directory: Optional[str] = None) -> str:
45
41
  return f"https://github.com/pyansys/example-data/raw/master/{filename}"
46
42
 
47
43
 
48
- def _retrieve_file(url: str, filename: str):
44
+ def _retrieve_file(url: str, filename: str, save_path: Optional[str] = None) -> str:
45
+ if save_path is None:
46
+ save_path = pyfluent.EXAMPLES_PATH
47
+ else:
48
+ save_path = os.path.abspath(save_path)
49
+ local_path = os.path.join(save_path, os.path.basename(filename))
50
+ local_path_no_zip = re.sub(".zip$", "", local_path)
49
51
  # First check if file has already been downloaded
50
- local_path = os.path.join(pyfluent.EXAMPLES_PATH, os.path.basename(filename))
51
- local_path_no_zip = local_path.replace(".zip", "")
52
52
  if os.path.isfile(local_path_no_zip) or os.path.isdir(local_path_no_zip):
53
- return local_path_no_zip, None
53
+ logging.info("File already exists.")
54
+ logging.info(f"File path: {local_path_no_zip}")
55
+ return local_path_no_zip
56
+
57
+ logging.info("Downloading specified file...")
58
+
59
+ # Check if save path exists
60
+ if not os.path.exists(save_path):
61
+ os.makedirs(save_path)
54
62
 
55
63
  # grab the correct url retriever
56
64
  urlretrieve = urllib.request.urlretrieve
57
65
 
58
66
  # Perform download
59
- saved_file, resp = urlretrieve(url)
67
+ saved_file, _ = urlretrieve(url)
60
68
  shutil.move(saved_file, local_path)
61
- if get_ext(local_path) in [".zip"]:
69
+ if local_path.endswith(".zip"):
62
70
  _decompress(local_path)
63
- local_path = local_path[:-4]
64
- return local_path, resp
71
+ local_path = local_path_no_zip
72
+ logging.info("Download successful.")
73
+ logging.info(f"File path: {local_path}")
74
+ return local_path
65
75
 
66
76
 
67
- def download_file(filename: str, directory: Optional[str] = None):
77
+ def download_file(
78
+ filename: str, directory: Optional[str] = None, save_path: Optional[str] = None
79
+ ):
68
80
  url = _get_file_url(filename, directory)
69
- return _retrieve_file(url, filename)[0]
81
+ return _retrieve_file(url, filename, save_path)
@@ -49,6 +49,12 @@ class InputParameter:
49
49
  self.name = v.strip('"')
50
50
  elif k == "definition":
51
51
  self.value = v.strip('"')
52
+ if "[" in self.value:
53
+ sep_index = self.value.index("[")
54
+ if not self.value[sep_index - 1] == " ":
55
+ self.value = "".join(
56
+ (self.value[:sep_index], " ", self.value[sep_index:])
57
+ )
52
58
 
53
59
  @property
54
60
  def units(self) -> str:
@@ -183,32 +189,35 @@ class CaseFile:
183
189
  raise FileNotFoundError(
184
190
  "Please provide a valid fluent project file path"
185
191
  )
192
+
186
193
  try:
187
- if "".join(Path(case_filepath).suffixes) == ".cas.h5":
194
+ if Path(case_filepath).match("*.cas.h5"):
188
195
  file = h5py.File(case_filepath)
189
196
  settings = file["settings"]
190
197
  rpvars = settings["Rampant Variables"][0]
191
198
  rp_vars_str = rpvars.decode()
192
- elif Path(case_filepath).suffix == ".cas":
199
+ elif Path(case_filepath).match("*.cas"):
193
200
  with open(case_filepath, "rb") as file:
194
201
  rp_vars_str = file.read()
195
202
  rp_vars_str = _get_processed_string(rp_vars_str)
196
- elif "".join(Path(case_filepath).suffixes) == ".cas.gz":
203
+ elif Path(case_filepath).match("*.cas.gz"):
197
204
  with gzip.open(case_filepath, "rb") as file:
198
205
  rp_vars_str = file.read()
199
206
  rp_vars_str = _get_processed_string(rp_vars_str)
200
207
  else:
201
- raise RuntimeError()
208
+ error_message = (
209
+ "Could not read case file. "
210
+ "Only valid Case files (.h5, .cas, .cas.gz) can be read. "
211
+ )
212
+ raise RuntimeError(error_message)
202
213
 
203
214
  except FileNotFoundError as e:
204
- raise RuntimeError(f"The case file {case_filepath} cannot be found.") from e
215
+ raise FileNotFoundError(
216
+ f"The case file {case_filepath} cannot be found."
217
+ ) from e
205
218
 
206
- except OSError:
207
- error_message = (
208
- "Could not read case file. "
209
- "Only valid Case files (.h5, .cas, .cas.gz) can be read. "
210
- )
211
- raise RuntimeError(error_message)
219
+ except OSError as e:
220
+ raise OSError(f"Error while reading case file {case_filepath}") from e
212
221
 
213
222
  except BaseException as e:
214
223
  raise RuntimeError(f"Could not read case file {case_filepath}") from e
@@ -20,10 +20,15 @@ from ansys.fluent.core.services.datamodel_tui import (
20
20
  from ansys.fluent.core.services.events import EventsService
21
21
  from ansys.fluent.core.services.field_data import FieldData, FieldDataService, FieldInfo
22
22
  from ansys.fluent.core.services.health_check import HealthCheckService
23
+ from ansys.fluent.core.services.meshing_queries import (
24
+ MeshingQueries,
25
+ MeshingQueriesService,
26
+ )
23
27
  from ansys.fluent.core.services.monitor import MonitorsService
24
28
  from ansys.fluent.core.services.reduction import Reduction, ReductionService
25
29
  from ansys.fluent.core.services.scheme_eval import SchemeEval, SchemeEvalService
26
30
  from ansys.fluent.core.services.settings import SettingsService
31
+ from ansys.fluent.core.services.svar import SVARData, SVARInfo, SVARService
27
32
  from ansys.fluent.core.streaming_services.datamodel_event_streaming import (
28
33
  DatamodelEvents,
29
34
  )
@@ -211,6 +216,11 @@ class FluentConnection:
211
216
  self.events_manager.start()
212
217
  self.datamodel_service_tui = DatamodelService_TUI(self._channel, self._metadata)
213
218
 
219
+ self.meshing_queries_service = MeshingQueriesService(
220
+ self._channel, self._metadata
221
+ )
222
+ self.meshing_queries = MeshingQueries(self.meshing_queries_service)
223
+
214
224
  self.datamodel_service_se = DatamodelService_SE(self._channel, self._metadata)
215
225
  self.datamodel_events = DatamodelEvents(self.datamodel_service_se)
216
226
  self.datamodel_events.start()
@@ -228,11 +238,13 @@ class FluentConnection:
228
238
 
229
239
  self._field_data_service = FieldDataService(self._channel, self._metadata)
230
240
  self.field_info = FieldInfo(self._field_data_service)
231
-
232
241
  self.field_data = FieldData(
233
242
  self._field_data_service, self.field_info, _IsDataValid(self.scheme_eval)
234
243
  )
235
244
 
245
+ self._svar_service = SVARService(self._channel, self._metadata)
246
+ self.svar_info = SVARInfo(self._svar_service)
247
+
236
248
  self.journal = Journal(self.scheme_eval)
237
249
 
238
250
  self._cleanup_on_exit = cleanup_on_exit
@@ -257,6 +269,14 @@ class FluentConnection:
257
269
  )
258
270
  FluentConnection._monitor_thread.cbs.append(self._finalizer)
259
271
 
272
+ @property
273
+ def svar_data(self) -> SVARData:
274
+ """Return the SVARData handle."""
275
+ try:
276
+ return SVARData(self._svar_service, self.svar_info)
277
+ except RuntimeError:
278
+ return None
279
+
260
280
  @property
261
281
  def id(self) -> str:
262
282
  """Return the session id."""
@@ -55,7 +55,7 @@ def start_fluent_container(mounted_from: str, mounted_to: str, args: List[str])
55
55
  f"REMOTING_PORTS={port}/portspan=2",
56
56
  "-l",
57
57
  f"test_name={test_name}",
58
- f"ghcr.io/pyansys/pyfluent:{image_tag}",
58
+ f"ghcr.io/ansys/pyfluent:{image_tag}",
59
59
  "-gu",
60
60
  f"-sifile={container_sifile}",
61
61
  ]
@@ -40,5 +40,15 @@
40
40
  "false": ""
41
41
  },
42
42
  "fluent_format": "{}"
43
+ },
44
+ "gpu": {
45
+ "type": "bool",
46
+ "default": "null",
47
+ "fluent_required": false,
48
+ "fluent_map": {
49
+ "true": " -gpu",
50
+ "false": ""
51
+ },
52
+ "fluent_format": "{}"
43
53
  }
44
54
  }
@@ -39,6 +39,7 @@ def _is_windows():
39
39
  class FluentVersion(Enum):
40
40
  """An enumeration over supported Fluent versions."""
41
41
 
42
+ version_24R1 = "24.1.0"
42
43
  version_23R2 = "23.2.0"
43
44
  version_23R1 = "23.1.0"
44
45
  version_22R2 = "22.2.0"
@@ -52,9 +53,9 @@ class FluentVersion(Enum):
52
53
  return FluentVersion(version)
53
54
  else:
54
55
  raise RuntimeError(
55
- f"The passed version '{version[:-2]}' does not exist."
56
- f" Available version strings are: "
57
- f"{[ver.value for ver in FluentVersion]} "
56
+ f"The specified version '{version[:-2]}' is not supported."
57
+ + f" Supported versions are: "
58
+ + ", ".join([ver.value for ver in FluentVersion][::-1])
58
59
  )
59
60
 
60
61
  def __str__(self):
@@ -76,9 +77,8 @@ def get_ansys_version() -> str:
76
77
  def get_fluent_exe_path(**launch_argvals) -> Path:
77
78
  """Get Fluent executable path. The path is searched in the following order.
78
79
 
79
- 1. ``PYFLUENT_FLUENT_ROOT`` environment variable.
80
- 2. ``product_version`` parameter passed with ``launch_fluent``.
81
- 3. The latest ANSYS version from ``AWP_ROOTnnn``` environment variables.
80
+ 1. ``product_version`` parameter passed with ``launch_fluent``.
81
+ 2. The latest ANSYS version from ``AWP_ROOTnnn``` environment variables.
82
82
 
83
83
  Returns
84
84
  -------
@@ -96,18 +96,18 @@ def get_fluent_exe_path(**launch_argvals) -> Path:
96
96
  else:
97
97
  return fluent_root / "bin" / "fluent"
98
98
 
99
- # Look for Fluent exe path in the following order:
100
- # 1. "PYFLUENT_FLUENT_ROOT" environment variable
99
+ # (DEV) "PYFLUENT_FLUENT_ROOT" environment variable
101
100
  fluent_root = os.getenv("PYFLUENT_FLUENT_ROOT")
102
101
  if fluent_root:
103
102
  return get_exe_path(Path(fluent_root))
104
103
 
105
- # 2. product_version parameter passed with launch_fluent
104
+ # Look for Fluent exe path in the following order:
105
+ # 1. product_version parameter passed with launch_fluent
106
106
  product_version = launch_argvals.get("product_version")
107
107
  if product_version:
108
108
  return get_exe_path(get_fluent_root(FluentVersion(product_version)))
109
109
 
110
- # 3. the latest ANSYS version from AWP_ROOT environment variables
110
+ # 2. the latest ANSYS version from AWP_ROOT environment variables
111
111
  ansys_version = get_ansys_version()
112
112
  return get_exe_path(get_fluent_root(FluentVersion(ansys_version)))
113
113
 
@@ -304,8 +304,9 @@ def _get_session_info(argvals, mode: Union[LaunchMode, str, None] = None):
304
304
 
305
305
  def _raise_exception_g_gu_in_windows_os(additional_arguments: str) -> None:
306
306
  """If -g or -gu is passed in Windows OS, the exception should be raised."""
307
+ additional_arg_list = additional_arguments.split()
307
308
  if _is_windows() and (
308
- ("-g" in additional_arguments) or ("-gu" in additional_arguments)
309
+ ("-g" in additional_arg_list) or ("-gu" in additional_arg_list)
309
310
  ):
310
311
  raise ValueError("'-g' and '-gu' is not supported on windows platform.")
311
312
 
@@ -459,6 +460,7 @@ def launch_fluent(
459
460
  server_info_filepath: str = None,
460
461
  password: str = None,
461
462
  py: bool = None,
463
+ gpu: bool = None,
462
464
  cwd: str = None,
463
465
  topy: Union[str, list] = None,
464
466
  **kwargs,
@@ -550,6 +552,8 @@ def launch_fluent(
550
552
  Password to connect to existing Fluent instance.
551
553
  py : bool, optional
552
554
  If True, Fluent will run in Python mode. Default is None.
555
+ gpu : bool, optional
556
+ If True, Fluent will start with GPU Solver.
553
557
  cwd: str, Optional
554
558
  Path to specify current working directory to launch fluent from the defined directory as
555
559
  current working directory.
@@ -645,11 +649,17 @@ def launch_fluent(
645
649
  logger.info(
646
650
  "Starting Fluent remotely. The startup configuration will be ignored."
647
651
  )
652
+
653
+ if product_version:
654
+ fluent_product_version = "".join(product_version.split("."))[:-1]
655
+ else:
656
+ fluent_product_version = "latest"
657
+
648
658
  return launch_remote_fluent(
649
659
  session_cls=new_session,
650
660
  start_timeout=start_timeout,
651
661
  start_transcript=start_transcript,
652
- product_version="".join(get_ansys_version().split("."))[:-1],
662
+ product_version=fluent_product_version,
653
663
  cleanup_on_exit=cleanup_on_exit,
654
664
  meshing_mode=meshing_mode,
655
665
  dimensionality=version,
@@ -661,12 +671,16 @@ def launch_fluent(
661
671
  args = _build_fluent_launch_args_string(**argvals).split()
662
672
  if meshing_mode:
663
673
  args.append(" -meshing")
674
+
675
+ save_path = pyfluent.EXAMPLES_PATH
676
+ # Check if save path exists
677
+ if not os.path.exists(save_path):
678
+ os.makedirs(save_path)
679
+
664
680
  # Assumes the container OS will be able to create the
665
681
  # EXAMPLES_PATH of host OS. With the Fluent docker
666
682
  # container, the following currently works only in linux.
667
- port, password = start_fluent_container(
668
- pyfluent.EXAMPLES_PATH, pyfluent.EXAMPLES_PATH, args
669
- )
683
+ port, password = start_fluent_container(save_path, save_path, args)
670
684
  return new_session(
671
685
  fluent_connection=FluentConnection(
672
686
  start_timeout=start_timeout,