ansys-fluent-core 0.34.dev0__py3-none-any.whl → 0.35.dev0__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 (108) hide show
  1. ansys/fluent/core/__init__.py +48 -84
  2. ansys/fluent/core/codegen/allapigen.py +2 -2
  3. ansys/fluent/core/codegen/builtin_settingsgen.py +41 -13
  4. ansys/fluent/core/codegen/datamodelgen.py +3 -1
  5. ansys/fluent/core/codegen/print_fluent_version.py +2 -2
  6. ansys/fluent/core/codegen/settingsgen.py +18 -6
  7. ansys/fluent/core/codegen/tuigen.py +6 -5
  8. ansys/fluent/core/data_model_cache.py +2 -2
  9. ansys/fluent/core/docker/docker_compose.py +11 -9
  10. ansys/fluent/core/docker/utils.py +35 -0
  11. ansys/fluent/core/examples/downloads.py +8 -11
  12. ansys/fluent/core/exceptions.py +13 -1
  13. ansys/fluent/core/field_data_interfaces.py +239 -38
  14. ansys/fluent/core/file_session.py +167 -61
  15. ansys/fluent/core/fluent_connection.py +41 -26
  16. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  17. ansys/fluent/core/generated/datamodel_231/flicing.py +40 -40
  18. ansys/fluent/core/generated/datamodel_231/meshing.py +231 -231
  19. ansys/fluent/core/generated/datamodel_232/flicing.py +50 -50
  20. ansys/fluent/core/generated/datamodel_232/meshing.py +189 -189
  21. ansys/fluent/core/generated/datamodel_241/flicing.py +30 -30
  22. ansys/fluent/core/generated/datamodel_241/meshing.py +290 -290
  23. ansys/fluent/core/generated/datamodel_242/flicing.py +50 -50
  24. ansys/fluent/core/generated/datamodel_242/meshing.py +331 -331
  25. ansys/fluent/core/generated/datamodel_242/part_management.py +6 -6
  26. ansys/fluent/core/generated/datamodel_251/flicing.py +65 -65
  27. ansys/fluent/core/generated/datamodel_251/meshing.py +300 -300
  28. ansys/fluent/core/generated/datamodel_251/part_management.py +6 -6
  29. ansys/fluent/core/generated/datamodel_252/flicing.py +25 -25
  30. ansys/fluent/core/generated/datamodel_252/meshing.py +382 -382
  31. ansys/fluent/core/generated/datamodel_252/part_management.py +10 -10
  32. ansys/fluent/core/generated/datamodel_261/flicing.py +45 -45
  33. ansys/fluent/core/generated/datamodel_261/meshing.py +454 -435
  34. ansys/fluent/core/generated/datamodel_261/part_management.py +5 -5
  35. ansys/fluent/core/generated/datamodel_261/preferences.py +7 -0
  36. ansys/fluent/core/generated/fluent_version_252.py +1 -1
  37. ansys/fluent/core/generated/fluent_version_261.py +3 -3
  38. ansys/fluent/core/generated/meshing/tui_261.py +54 -3
  39. ansys/fluent/core/generated/solver/settings_231.py +1 -0
  40. ansys/fluent/core/generated/solver/settings_231.pyi +3025 -1
  41. ansys/fluent/core/generated/solver/settings_232.py +1 -0
  42. ansys/fluent/core/generated/solver/settings_232.pyi +3425 -1
  43. ansys/fluent/core/generated/solver/settings_241.py +1 -0
  44. ansys/fluent/core/generated/solver/settings_241.pyi +4423 -1
  45. ansys/fluent/core/generated/solver/settings_242.py +1 -0
  46. ansys/fluent/core/generated/solver/settings_242.pyi +5474 -1
  47. ansys/fluent/core/generated/solver/settings_251.py +11 -0
  48. ansys/fluent/core/generated/solver/settings_251.pyi +6006 -1
  49. ansys/fluent/core/generated/solver/settings_252.py +11 -1
  50. ansys/fluent/core/generated/solver/settings_252.pyi +6782 -2
  51. ansys/fluent/core/generated/solver/settings_261.py +5592 -2740
  52. ansys/fluent/core/generated/solver/settings_261.pyi +10335 -1994
  53. ansys/fluent/core/generated/solver/settings_builtin.py +560 -38
  54. ansys/fluent/core/generated/solver/settings_builtin.pyi +24 -18
  55. ansys/fluent/core/generated/solver/tui_261.py +409 -285
  56. ansys/fluent/core/launcher/container_launcher.py +25 -6
  57. ansys/fluent/core/launcher/error_handler.py +1 -1
  58. ansys/fluent/core/launcher/fluent_container.py +97 -45
  59. ansys/fluent/core/launcher/launch_options.py +5 -4
  60. ansys/fluent/core/launcher/launcher.py +18 -2
  61. ansys/fluent/core/launcher/launcher_utils.py +63 -15
  62. ansys/fluent/core/launcher/pim_launcher.py +17 -3
  63. ansys/fluent/core/launcher/process_launch_string.py +3 -2
  64. ansys/fluent/core/launcher/server_info.py +7 -3
  65. ansys/fluent/core/launcher/slurm_launcher.py +4 -2
  66. ansys/fluent/core/launcher/standalone_launcher.py +6 -3
  67. ansys/fluent/core/launcher/watchdog.py +6 -6
  68. ansys/fluent/core/launcher/watchdog_exec +1 -1
  69. ansys/fluent/core/logger.py +3 -1
  70. ansys/fluent/core/module_config.py +358 -0
  71. ansys/fluent/core/pyfluent_warnings.py +9 -3
  72. ansys/fluent/core/report.py +2 -2
  73. ansys/fluent/core/search.py +34 -13
  74. ansys/fluent/core/services/__init__.py +2 -2
  75. ansys/fluent/core/services/api_upgrade.py +3 -2
  76. ansys/fluent/core/services/app_utilities.py +39 -0
  77. ansys/fluent/core/services/datamodel_se.py +4 -2
  78. ansys/fluent/core/services/deprecated_field_data.py +4 -4
  79. ansys/fluent/core/services/field_data.py +185 -49
  80. ansys/fluent/core/services/health_check.py +3 -1
  81. ansys/fluent/core/services/interceptors.py +8 -6
  82. ansys/fluent/core/services/reduction.py +16 -5
  83. ansys/fluent/core/services/settings.py +1 -0
  84. ansys/fluent/core/session.py +47 -4
  85. ansys/fluent/core/session_pure_meshing.py +6 -6
  86. ansys/fluent/core/session_pure_meshing.pyi +1 -0
  87. ansys/fluent/core/session_shared.py +4 -4
  88. ansys/fluent/core/session_solver.py +41 -10
  89. ansys/fluent/core/session_solver.pyi +1 -0
  90. ansys/fluent/core/session_utilities.py +7 -0
  91. ansys/fluent/core/solver/error_message.py +2 -2
  92. ansys/fluent/core/solver/flobject.py +192 -123
  93. ansys/fluent/core/solver/function/reduction.py +37 -9
  94. ansys/fluent/core/solver/settings_builtin_bases.py +3 -3
  95. ansys/fluent/core/solver/settings_builtin_data.py +7 -17
  96. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +3 -2
  97. ansys/fluent/core/streaming_services/datamodel_streaming.py +3 -1
  98. ansys/fluent/core/streaming_services/events_streaming.py +2 -18
  99. ansys/fluent/core/system_coupling.py +3 -1
  100. ansys/fluent/core/utils/__init__.py +0 -7
  101. ansys/fluent/core/utils/data_transfer.py +3 -3
  102. ansys/fluent/core/utils/file_transfer_service.py +24 -15
  103. ansys/fluent/core/utils/fluent_version.py +4 -6
  104. ansys/fluent/core/utils/networking.py +21 -11
  105. {ansys_fluent_core-0.34.dev0.dist-info → ansys_fluent_core-0.35.dev0.dist-info}/METADATA +10 -11
  106. {ansys_fluent_core-0.34.dev0.dist-info → ansys_fluent_core-0.35.dev0.dist-info}/RECORD +108 -106
  107. {ansys_fluent_core-0.34.dev0.dist-info → ansys_fluent_core-0.35.dev0.dist-info}/WHEEL +1 -1
  108. {ansys_fluent_core-0.34.dev0.dist-info/licenses → ansys_fluent_core-0.35.dev0.dist-info}/LICENSE +0 -0
@@ -23,7 +23,6 @@
23
23
  """Provides a module for datamodel event streaming."""
24
24
 
25
25
  import logging
26
- import os
27
26
  import threading
28
27
  from typing import Callable
29
28
 
@@ -62,6 +61,8 @@ class DatamodelEvents(StreamingService):
62
61
 
63
62
  def _process_streaming(self, id, stream_begin_method, started_evt, *args, **kwargs):
64
63
  """Processes datamodel events."""
64
+ from ansys.fluent.core import config
65
+
65
66
  request = DataModelProtoModule.EventRequest(*args, **kwargs)
66
67
  responses = self._streaming_service.begin_streaming(
67
68
  request, started_evt, id=id, stream_begin_method=stream_begin_method
@@ -69,7 +70,7 @@ class DatamodelEvents(StreamingService):
69
70
  while True:
70
71
  try:
71
72
  response: DataModelProtoModule.EventResponse = next(responses)
72
- if os.getenv("PYFLUENT_HIDE_LOG_SECRETS") != "1":
73
+ if not config.hide_log_secrets:
73
74
  network_logger.debug(
74
75
  f"GRPC_TRACE: RPC = /grpcRemoting.DataModel/BeginEventStreaming, response = {MessageToDict(response)}"
75
76
  )
@@ -57,7 +57,9 @@ class DatamodelStream(StreamingService):
57
57
  """Processes datamodel events."""
58
58
  data_model_request = datamodel_se_pb2.DataModelRequest(*args, **kwargs)
59
59
  data_model_request.rules = rules
60
- data_model_request.returnstatechanges = pyfluent.DATAMODEL_RETURN_STATE_CHANGES
60
+ data_model_request.returnstatechanges = (
61
+ pyfluent.config.datamodel_return_state_changes
62
+ )
61
63
  if no_commands_diff_state:
62
64
  data_model_request.diffstate = datamodel_se_pb2.DIFFSTATE_NOCOMMANDS
63
65
  responses = self._streaming_service.begin_streaming(
@@ -281,30 +281,14 @@ class SolutionInitializedEventInfo(
281
281
  class ReportDefinitionUpdatedEventInfo(
282
282
  EventInfoBase, event=SolverEvent.REPORT_DEFINITION_UPDATED
283
283
  ):
284
- """Information about the event triggered when a report definition is updated.
285
-
286
- Attributes
287
- ----------
288
- report_name : str
289
- Report name.
290
- """
291
-
292
- report_name: str = field(metadata=dict(deprecated_name="reportdefinitionname"))
284
+ """Information about the event triggered when a report definition is updated."""
293
285
 
294
286
 
295
287
  @dataclass
296
288
  class ReportPlotSetUpdatedEventInfo(
297
289
  EventInfoBase, event=SolverEvent.REPORT_PLOT_SET_UPDATED
298
290
  ):
299
- """Information about the event triggered when a report plot set is updated.
300
-
301
- Attributes
302
- ----------
303
- plot_set_name : str
304
- Plot set name.
305
- """
306
-
307
- plot_set_name: str = field(metadata=dict(deprecated_name="plotsetname"))
291
+ """Information about the event triggered when a report plot set is updated."""
308
292
 
309
293
 
310
294
  class ResidualPlotUpdatedEventInfo(
@@ -252,7 +252,9 @@ class SystemCoupling:
252
252
  # the local Fluent container working directory will correspond to
253
253
  # pyfluent.EXAMPLES_PATH in the host, so that is where the SCP file
254
254
  # will be written.
255
- examples_path_scp = os.path.join(pyfluent.EXAMPLES_PATH, scp_file_name)
255
+ examples_path_scp = os.path.join(
256
+ pyfluent.config.examples_path, scp_file_name
257
+ )
256
258
  if os.path.exists(examples_path_scp):
257
259
  scp_file_name = examples_path_scp
258
260
 
@@ -42,13 +42,6 @@ def load_module(module_name, file_path):
42
42
  return module
43
43
 
44
44
 
45
- def get_examples_download_dir():
46
- """Return the path to the examples download directory."""
47
- parent_path = Path.home() / "Downloads"
48
- parent_path.mkdir(exist_ok=True)
49
- return parent_path / "ansys_fluent_core_examples"
50
-
51
-
52
45
  def get_user_data_dir():
53
46
  """Return the path to the user data directory."""
54
47
  if sys.platform == "win32":
@@ -114,7 +114,7 @@ def transfer_case(
114
114
  """
115
115
  inside_container = source_instance.connection_properties.inside_container
116
116
  if not workdir:
117
- workdir = Path(pyfluent.EXAMPLES_PATH)
117
+ workdir = Path(pyfluent.config.examples_path)
118
118
  else:
119
119
  workdir = Path(workdir)
120
120
  if inside_container:
@@ -122,9 +122,9 @@ def transfer_case(
122
122
  network_logger.warning(
123
123
  "Fluent is running inside a container, and no 'container_workdir' was specified for "
124
124
  "'transfer_case'. Assuming that the default container mount path "
125
- f"'{pyfluent.CONTAINER_MOUNT_TARGET}' is being used. "
125
+ f"'{pyfluent.config.container_mount_target}' is being used. "
126
126
  )
127
- container_workdir = PurePosixPath(pyfluent.CONTAINER_MOUNT_TARGET)
127
+ container_workdir = PurePosixPath(pyfluent.config.container_mount_target)
128
128
  network_logger.debug(f"container_workdir: {container_workdir}")
129
129
  else:
130
130
  container_workdir = PurePosixPath(container_workdir)
@@ -537,6 +537,9 @@ class PimFileTransferService:
537
537
  )
538
538
  except ModuleNotFoundError:
539
539
  pass
540
+ self.cwd = os.getcwd()
541
+ self.instance_name = self.pim_instance.name.replace("instances/", "")
542
+ self.instance_dir = os.path.join(self.cwd, self.instance_name)
540
543
 
541
544
  def file_exists_on_remote(self, file_name: str) -> bool:
542
545
  """Check if remote file exists.
@@ -604,16 +607,18 @@ class PimFileTransferService:
604
607
  if self.is_configured():
605
608
  for file in files:
606
609
  if os.path.isfile(file):
607
- if not self.file_service.file_exist(os.path.basename(file)):
608
- self.upload_file(
609
- file_name=file, remote_file_name=remote_file_name
610
- )
611
- print(f"\n{os.path.basename(file_name)} uploaded.\n")
610
+ if os.path.exists(self.instance_dir):
611
+ shutil.copy2(file, self.instance_dir)
612
612
  else:
613
- warnings.warn(
614
- f"\n{file} with the same name exists at the remote location.\n",
615
- PyFluentUserWarning,
616
- )
613
+ if not self.file_service.file_exist(os.path.basename(file)):
614
+ self.upload_file(
615
+ file_name=file, remote_file_name=remote_file_name
616
+ )
617
+ else:
618
+ warnings.warn(
619
+ f"\n{file} with the same name exists at the remote location.\n",
620
+ PyFluentUserWarning,
621
+ )
617
622
  elif not self.file_service.file_exist(os.path.basename(file)):
618
623
  raise FileNotFoundError(f"{file} does not exist.")
619
624
 
@@ -642,7 +647,7 @@ class PimFileTransferService:
642
647
  else:
643
648
  raise FileNotFoundError("Remote file does not exist.")
644
649
 
645
- def download(self, file_name: list[str] | str, local_directory: str | None = "."):
650
+ def download(self, file_name: list[str] | str, local_directory: str | None = None):
646
651
  """Download a file from the server.
647
652
 
648
653
  Parameters
@@ -652,6 +657,7 @@ class PimFileTransferService:
652
657
  local_directory : str, optional
653
658
  Local directory. The default is the current working directory.
654
659
  """
660
+ download_directory = local_directory if local_directory else self.cwd
655
661
  files = [file_name] if isinstance(file_name, str) else file_name
656
662
  if self.is_configured():
657
663
  for file in files:
@@ -661,11 +667,14 @@ class PimFileTransferService:
661
667
  PyFluentUserWarning,
662
668
  )
663
669
  else:
664
- self.download_file(
665
- file_name=os.path.basename(file),
666
- local_directory=local_directory,
667
- )
668
- print(f"\n{os.path.basename(file_name)} downloaded.\n")
670
+ download_file_name = os.path.join(self.instance_dir, file)
671
+ if os.path.exists(download_file_name):
672
+ shutil.copy2(download_file_name, download_directory)
673
+ else:
674
+ self.download_file(
675
+ file_name=os.path.basename(file),
676
+ local_directory=download_directory,
677
+ )
669
678
 
670
679
  def __call__(self, pim_instance: Any | None = None):
671
680
  self.pim_instance = pim_instance
@@ -162,7 +162,7 @@ class FluentVersion(Enum):
162
162
  FluentVersion
163
163
  FluentVersion member corresponding to the latest release.
164
164
  """
165
- return cls(pyfluent.FLUENT_RELEASE_VERSION)
165
+ return cls(pyfluent.config.fluent_release_version)
166
166
 
167
167
  @classmethod
168
168
  def current_dev(cls):
@@ -173,7 +173,7 @@ class FluentVersion(Enum):
173
173
  FluentVersion
174
174
  FluentVersion member corresponding to the latest development version.
175
175
  """
176
- return cls(pyfluent.FLUENT_DEV_VERSION)
176
+ return cls(pyfluent.config.fluent_dev_version)
177
177
 
178
178
  @property
179
179
  def awp_var(self):
@@ -188,7 +188,7 @@ class FluentVersion(Enum):
188
188
  @property
189
189
  def docker_image_tag(self):
190
190
  """Get the Fluent version as a Docker image tag."""
191
- return f"v{self.value}"
191
+ return f"v{self.value.rsplit('.', 1)[0]}.latest"
192
192
 
193
193
  def __lt__(self, other):
194
194
  if isinstance(other, FluentVersion):
@@ -201,9 +201,7 @@ class FluentVersion(Enum):
201
201
 
202
202
  def __str__(self) -> str:
203
203
  """String output for the Fluent version."""
204
- return (
205
- f"Fluent version 20{self.value.split('.')[0]} R{self.value.split('.')[1]}"
206
- )
204
+ return f"Ansys Fluent 20{self.value.split('.')[0]} R{self.value.split('.')[1]}"
207
205
 
208
206
 
209
207
  class FluentVersionSet(Set[FluentVersion]):
@@ -79,16 +79,26 @@ def find_remoting_ip() -> str:
79
79
  str
80
80
  remoting ip address
81
81
  """
82
- from ansys.fluent.core import INFER_REMOTING_IP_TIMEOUT_PER_IP
83
-
84
- for addrinfo in socket.getaddrinfo(
85
- "localhost",
86
- 0,
87
- family=socket.AF_INET,
88
- type=socket.SOCK_STREAM,
89
- flags=socket.AI_PASSIVE,
90
- ):
91
- ip = addrinfo[-1][0]
82
+ from ansys.fluent.core import config
83
+
84
+ all_ips = [
85
+ addrinfo[-1][0]
86
+ for addrinfo in socket.getaddrinfo(
87
+ "localhost",
88
+ 0,
89
+ family=socket.AF_INET,
90
+ type=socket.SOCK_STREAM,
91
+ flags=socket.AI_PASSIVE,
92
+ )
93
+ ]
94
+ # Check if we can establish a gRPC connection using localhost first
95
+ # before trying other IPs. It has been observed that in some systems,
96
+ # although we can establish a test gRPC connection using one of the
97
+ # resolved IP addresses in addrinfo, PyFluent fails to connect to Fluent
98
+ # using that IP address. Using localhost usually helps in such cases.
99
+ all_ips.insert(0, "localhost")
100
+
101
+ for ip in all_ips:
92
102
  port = get_free_port()
93
103
  address = f"{ip}:{port}"
94
104
  with _GrpcServer(address):
@@ -98,7 +108,7 @@ def find_remoting_ip() -> str:
98
108
  if (
99
109
  stub.Check(
100
110
  health_pb2.HealthCheckRequest(),
101
- timeout=INFER_REMOTING_IP_TIMEOUT_PER_IP,
111
+ timeout=config.infer_remoting_ip_timeout_per_ip,
102
112
  ).status
103
113
  == health_pb2.HealthCheckResponse.ServingStatus.SERVING
104
114
  ):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.3
2
2
  Name: ansys-fluent-core
3
- Version: 0.34.dev0
3
+ Version: 0.35.dev0
4
4
  Summary: PyFluent provides Pythonic access to Ansys Fluent.
5
5
  Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
6
6
  Maintainer-email: "ANSYS, Inc." <pyansys.core@ansys.com>
@@ -10,11 +10,10 @@ Classifier: Development Status :: 4 - Beta
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Operating System :: OS Independent
13
- License-File: LICENSE
14
- Requires-Dist: ansys-api-fluent>=0.3.35
13
+ Requires-Dist: ansys-api-fluent>=0.3.36
15
14
  Requires-Dist: ansys-platform-instancemanagement~=1.1
16
15
  Requires-Dist: ansys-tools-filetransfer>=0.1,<0.3
17
- Requires-Dist: ansys-units>=0.6.dev1,<1.0
16
+ Requires-Dist: ansys-units>=0.7.0,<1.0
18
17
  Requires-Dist: defusedxml>=0.7.1
19
18
  Requires-Dist: deprecated>=1.2.18
20
19
  Requires-Dist: docker>=7.1.0
@@ -23,12 +22,12 @@ Requires-Dist: grpcio-health-checking>=1.30.0
23
22
  Requires-Dist: grpcio-status>=1.26.0
24
23
  Requires-Dist: nltk>=3.9.1
25
24
  Requires-Dist: numpy>=1.14.0,<3.0.0
26
- Requires-Dist: pandas>=1.1.0,<2.3
25
+ Requires-Dist: pandas>=1.1.0,<3.0.0
27
26
  Requires-Dist: pyansys-tools-report>=0.8.1
28
27
  Requires-Dist: pyyaml>=6.0
29
28
  Requires-Dist: Sphinx==8.1.3 ; extra == "docs"
30
29
  Requires-Dist: jupyter_sphinx==0.5.3 ; extra == "docs"
31
- Requires-Dist: numpydoc==1.8.0 ; extra == "docs"
30
+ Requires-Dist: numpydoc==1.9.0 ; extra == "docs"
32
31
  Requires-Dist: matplotlib==3.10.3 ; extra == "docs"
33
32
  Requires-Dist: ansys-sphinx-theme==1.5.2 ; extra == "docs"
34
33
  Requires-Dist: pypandoc==1.15 ; extra == "docs"
@@ -49,12 +48,12 @@ Requires-Dist: python-pptx>=0.6.23 ; extra == "docs"
49
48
  Requires-Dist: quarto-cli==1.7.32 ; extra == "docs"
50
49
  Requires-Dist: pdf2image==1.17.0 ; extra == "docs"
51
50
  Requires-Dist: seaborn>=0.13.2 ; extra == "docs"
52
- Requires-Dist: h5py==3.13.0 ; extra == "reader"
53
- Requires-Dist: pytest==8.3.5 ; extra == "tests"
54
- Requires-Dist: pytest-cov==6.1.1 ; extra == "tests"
51
+ Requires-Dist: h5py==3.14.0 ; extra == "reader"
52
+ Requires-Dist: pytest==8.4.1 ; extra == "tests"
53
+ Requires-Dist: pytest-cov==6.2.1 ; extra == "tests"
55
54
  Requires-Dist: pytest-mock==3.14.1 ; extra == "tests"
56
55
  Requires-Dist: pytest-xdist==3.7.0 ; extra == "tests"
57
- Requires-Dist: pyfakefs==5.8.0 ; extra == "tests"
56
+ Requires-Dist: pyfakefs==5.9.1 ; extra == "tests"
58
57
  Project-URL: Documentation, https://fluent.docs.pyansys.com/
59
58
  Project-URL: Source, https://github.com/ansys/pyfluent
60
59
  Project-URL: Tracker, https://github.com/ansys/pyfluent/issues