ansys-fluent-core 0.14.dev1__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.
- ansys/fluent/core/__init__.py +12 -12
- ansys/fluent/core/_version.py +1 -1
- ansys/fluent/core/docs/README.rst +26 -26
- ansys/fluent/core/examples/downloads.py +28 -16
- ansys/fluent/core/filereader/case_file.py +20 -11
- ansys/fluent/core/launcher/fluent_container.py +1 -1
- ansys/fluent/core/launcher/fluent_launcher_options.json +10 -0
- ansys/fluent/core/launcher/launcher.py +29 -15
- ansys/fluent/core/meshing/tui_231.py +7265 -7265
- ansys/fluent/core/services/datamodel_se.py +142 -110
- ansys/fluent/core/services/meshing_queries.py +920 -361
- ansys/fluent/core/session_pure_meshing.py +4 -5
- ansys/fluent/core/solver/flobject.py +20 -2
- ansys/fluent/core/solver/settings_222/change_type.py +1 -1
- ansys/fluent/core/solver/settings_222/clear_generated_data.py +1 -1
- ansys/fluent/core/solver/settings_222/compute_2.py +1 -1
- ansys/fluent/core/solver/settings_222/delete_design_points.py +1 -1
- ansys/fluent/core/solver/settings_222/position_1.py +1 -1
- ansys/fluent/core/solver/settings_222/setup_unsteady_statistics.py +1 -1
- ansys/fluent/core/solver/settings_222/target.py +1 -1
- ansys/fluent/core/solver/settings_222/up_vector.py +1 -1
- ansys/fluent/core/solver/settings_222/update_selected.py +1 -1
- ansys/fluent/core/solver/settings_222/write_1.py +1 -1
- ansys/fluent/core/solver/settings_222/write_views.py +1 -1
- ansys/fluent/core/solver/settings_231/abaqus.py +2 -2
- ansys/fluent/core/solver/settings_231/activate_cell_zone.py +1 -1
- ansys/fluent/core/solver/settings_231/calculate_patch.py +2 -2
- ansys/fluent/core/solver/settings_231/change_type.py +1 -1
- ansys/fluent/core/solver/settings_231/clear_generated_data.py +1 -1
- ansys/fluent/core/solver/settings_231/compute_1.py +1 -1
- ansys/fluent/core/solver/settings_231/convert_skewed_cells_1.py +1 -1
- ansys/fluent/core/solver/settings_231/custom_heat_flux.py +1 -1
- ansys/fluent/core/solver/settings_231/customize_fmg_initialization.py +2 -2
- ansys/fluent/core/solver/settings_231/delete_design_points.py +1 -1
- ansys/fluent/core/solver/settings_231/export_1.py +1 -1
- ansys/fluent/core/solver/settings_231/export_modifications.py +1 -1
- ansys/fluent/core/solver/settings_231/film_heat_transfer.py +1 -1
- ansys/fluent/core/solver/settings_231/film_mass_flow.py +1 -1
- ansys/fluent/core/solver/settings_231/forces.py +4 -4
- ansys/fluent/core/solver/settings_231/heat_transfer_1.py +1 -1
- ansys/fluent/core/solver/settings_231/heat_transfer_sensible.py +1 -1
- ansys/fluent/core/solver/settings_231/mass_flow_1.py +1 -1
- ansys/fluent/core/solver/settings_231/mechanical_apdl.py +1 -1
- ansys/fluent/core/solver/settings_231/mechanical_apdl_input.py +2 -2
- ansys/fluent/core/solver/settings_231/modified_setting.py +1 -1
- ansys/fluent/core/solver/settings_231/moments.py +2 -2
- ansys/fluent/core/solver/settings_231/number_density.py +2 -2
- ansys/fluent/core/solver/settings_231/particle_summary.py +1 -1
- ansys/fluent/core/solver/settings_231/position_1.py +1 -1
- ansys/fluent/core/solver/settings_231/pressure_work_1.py +1 -1
- ansys/fluent/core/solver/settings_231/print_histogram.py +1 -1
- ansys/fluent/core/solver/settings_231/projected_surface_area.py +2 -2
- ansys/fluent/core/solver/settings_231/rad_heat_trans.py +1 -1
- ansys/fluent/core/solver/settings_231/read_journal.py +1 -1
- ansys/fluent/core/solver/settings_231/rotate.py +2 -2
- ansys/fluent/core/solver/settings_231/sample_1.py +4 -4
- ansys/fluent/core/solver/settings_231/set_ambient_color.py +1 -1
- ansys/fluent/core/solver/settings_231/set_light.py +2 -2
- ansys/fluent/core/solver/settings_231/setup_unsteady_statistics.py +1 -1
- ansys/fluent/core/solver/settings_231/surface_integrals.py +1 -1
- ansys/fluent/core/solver/settings_231/taitherm.py +1 -1
- ansys/fluent/core/solver/settings_231/target.py +1 -1
- ansys/fluent/core/solver/settings_231/translate.py +1 -1
- ansys/fluent/core/solver/settings_231/up_vector.py +1 -1
- ansys/fluent/core/solver/settings_231/update_selected.py +1 -1
- ansys/fluent/core/solver/settings_231/viscous_work.py +1 -1
- ansys/fluent/core/solver/settings_231/volume_integrals.py +1 -1
- ansys/fluent/core/solver/settings_231/write_1.py +1 -1
- ansys/fluent/core/solver/settings_231/write_histogram.py +1 -1
- ansys/fluent/core/solver/settings_231/write_views.py +1 -1
- ansys/fluent/core/solver/tui_231.py +36777 -37552
- {ansys_fluent_core-0.14.dev1.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/METADATA +29 -29
- {ansys_fluent_core-0.14.dev1.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/RECORD +76 -76
- {ansys_fluent_core-0.14.dev1.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/LICENSE +0 -0
- {ansys_fluent_core-0.14.dev1.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/WHEEL +0 -0
- {ansys_fluent_core-0.14.dev1.dist-info → ansys_fluent_core-0.14.dev2.dist-info}/top_level.txt +0 -0
ansys/fluent/core/__init__.py
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
60
|
-
|
|
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
|
ansys/fluent/core/_version.py
CHANGED
|
@@ -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/
|
|
14
|
-
:target: https://github.com/
|
|
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/
|
|
18
|
-
:target: https://codecov.io/gh/
|
|
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/
|
|
29
|
-
:target: https://results.pre-commit.ci/latest/github/
|
|
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/
|
|
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.
|
|
54
|
-
3.
|
|
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/
|
|
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
|
-
|
|
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,
|
|
67
|
+
saved_file, _ = urlretrieve(url)
|
|
60
68
|
shutil.move(saved_file, local_path)
|
|
61
|
-
if
|
|
69
|
+
if local_path.endswith(".zip"):
|
|
62
70
|
_decompress(local_path)
|
|
63
|
-
local_path =
|
|
64
|
-
|
|
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(
|
|
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)
|
|
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
|
|
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).
|
|
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
|
|
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
|
-
|
|
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
|
|
215
|
+
raise FileNotFoundError(
|
|
216
|
+
f"The case file {case_filepath} cannot be found."
|
|
217
|
+
) from e
|
|
205
218
|
|
|
206
|
-
except OSError:
|
|
207
|
-
|
|
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
|
|
@@ -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/
|
|
58
|
+
f"ghcr.io/ansys/pyfluent:{image_tag}",
|
|
59
59
|
"-gu",
|
|
60
60
|
f"-sifile={container_sifile}",
|
|
61
61
|
]
|
|
@@ -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
|
|
56
|
-
f"
|
|
57
|
-
|
|
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. ``
|
|
80
|
-
2.
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
|
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=
|
|
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,
|