ansys-fluent-core 0.20.dev9__py3-none-any.whl → 0.20.dev10__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 (39) hide show
  1. ansys/fluent/core/__init__.py +1 -1
  2. ansys/fluent/core/_version.py +1 -1
  3. ansys/fluent/core/data/api_tree_231.pickle +0 -0
  4. ansys/fluent/core/data/api_tree_232.pickle +0 -0
  5. ansys/fluent/core/data/api_tree_241.pickle +0 -0
  6. ansys/fluent/core/data/api_tree_242.pickle +0 -0
  7. ansys/fluent/core/fluent_connection.py +5 -5
  8. ansys/fluent/core/launcher/standalone_launcher.py +1 -1
  9. ansys/fluent/core/meshing/tui_231.py +6497 -6497
  10. ansys/fluent/core/meshing/tui_232.py +7573 -7573
  11. ansys/fluent/core/meshing/tui_241.py +7803 -7803
  12. ansys/fluent/core/meshing/tui_242.py +8059 -8059
  13. ansys/fluent/core/session.py +12 -12
  14. ansys/fluent/core/session_meshing.py +1 -1
  15. ansys/fluent/core/session_pure_meshing.py +1 -1
  16. ansys/fluent/core/session_solver.py +5 -5
  17. ansys/fluent/core/session_solver_lite.py +1 -1
  18. ansys/fluent/core/solver/flobject.py +57 -52
  19. ansys/fluent/core/solver/settings_242/__init__.py +1 -1
  20. ansys/fluent/core/solver/settings_242/plane_surface_child.py +1 -1
  21. ansys/fluent/core/solver/tui_231.py +35045 -34364
  22. ansys/fluent/core/solver/tui_232.py +26365 -26365
  23. ansys/fluent/core/solver/tui_241.py +28076 -28076
  24. ansys/fluent/core/solver/tui_242.py +29096 -29096
  25. ansys/fluent/core/systemcoupling.py +1 -1
  26. ansys/fluent/core/utils/setup_for_fluent.py +1 -1
  27. ansys/fluent/core/workflow.py +4 -4
  28. ansys/fluent/tests/test_field_data.py +16 -0
  29. ansys/fluent/tests/test_flobject.py +6 -1
  30. ansys/fluent/tests/test_fluent_session.py +4 -4
  31. ansys/fluent/tests/test_launcher_remote.py +9 -7
  32. ansys/fluent/tests/test_reduction.py +36 -25
  33. ansys/fluent/tests/test_session.py +6 -6
  34. ansys/fluent/tests/test_settings_api.py +49 -12
  35. ansys/fluent/tests/test_solution_variables.py +17 -0
  36. {ansys_fluent_core-0.20.dev9.dist-info → ansys_fluent_core-0.20.dev10.dist-info}/METADATA +2 -2
  37. {ansys_fluent_core-0.20.dev9.dist-info → ansys_fluent_core-0.20.dev10.dist-info}/RECORD +39 -39
  38. {ansys_fluent_core-0.20.dev9.dist-info → ansys_fluent_core-0.20.dev10.dist-info}/LICENSE +0 -0
  39. {ansys_fluent_core-0.20.dev9.dist-info → ansys_fluent_core-0.20.dev10.dist-info}/WHEEL +0 -0
@@ -110,10 +110,10 @@ class BaseSession:
110
110
  file_transfer_service: Optional[Any] = None,
111
111
  ):
112
112
  """Build a BaseSession object from fluent_connection object."""
113
- self.fluent_connection = fluent_connection
113
+ self._fluent_connection = fluent_connection
114
114
  self._file_transfer_service = file_transfer_service
115
- self._error_state = self.fluent_connection._error_state
116
- self.scheme_eval = self.fluent_connection.scheme_eval
115
+ self._error_state = fluent_connection._error_state
116
+ self.scheme_eval = fluent_connection.scheme_eval
117
117
  self.rp_vars = RPVars(self.scheme_eval.string_eval)
118
118
  self._preferences = None
119
119
  self.journal = Journal(self.scheme_eval)
@@ -149,14 +149,14 @@ class BaseSession:
149
149
  fluent_connection._channel, fluent_connection._metadata
150
150
  )
151
151
  self.events_manager = EventsManager(
152
- self._events_service, self._error_state, self.fluent_connection._id
152
+ self._events_service, self._error_state, fluent_connection._id
153
153
  )
154
154
 
155
155
  self._monitors_service = service_creator("monitors").create(
156
156
  fluent_connection._channel, fluent_connection._metadata, self._error_state
157
157
  )
158
158
  self.monitors_manager = MonitorsManager(
159
- self.fluent_connection._id, self._monitors_service
159
+ fluent_connection._id, self._monitors_service
160
160
  )
161
161
 
162
162
  self.events_manager.register_callback(
@@ -168,7 +168,7 @@ class BaseSession:
168
168
 
169
169
  self.events_manager.start()
170
170
 
171
- self._field_data_service = self.fluent_connection.create_grpc_service(
171
+ self._field_data_service = self._fluent_connection.create_grpc_service(
172
172
  FieldDataService, self._error_state
173
173
  )
174
174
 
@@ -187,7 +187,7 @@ class BaseSession:
187
187
  _session.scheme_eval,
188
188
  )
189
189
  self.field_data_streaming = FieldDataStreaming(
190
- _session.fluent_connection._id, _session._field_data_service
190
+ _session._fluent_connection._id, _session._field_data_service
191
191
  )
192
192
 
193
193
  self.fields = Fields(self)
@@ -202,7 +202,7 @@ class BaseSession:
202
202
  self.health_check_service = fluent_connection.health_check_service
203
203
  self.connection_properties = fluent_connection.connection_properties
204
204
 
205
- self.fluent_connection.register_finalizer_cb(
205
+ self._fluent_connection.register_finalizer_cb(
206
206
  self.datamodel_service_se.unsubscribe_all_events
207
207
  )
208
208
  for obj in (
@@ -211,7 +211,7 @@ class BaseSession:
211
211
  self.events_manager,
212
212
  self.monitors_manager,
213
213
  ):
214
- self.fluent_connection.register_finalizer_cb(obj.stop)
214
+ self._fluent_connection.register_finalizer_cb(obj.stop)
215
215
 
216
216
  @property
217
217
  def field_info(self):
@@ -243,7 +243,7 @@ class BaseSession:
243
243
  @property
244
244
  def id(self) -> str:
245
245
  """Return the session ID."""
246
- return self.fluent_connection._id
246
+ return self._fluent_connection._id
247
247
 
248
248
  def start_journal(self, file_name: str):
249
249
  """Executes tui command to start journal."""
@@ -301,12 +301,12 @@ class BaseSession:
301
301
  def exit(self, **kwargs) -> None:
302
302
  """Exit session."""
303
303
  logger.debug("session.exit() called")
304
- self.fluent_connection.exit(**kwargs)
304
+ self._fluent_connection.exit(**kwargs)
305
305
 
306
306
  def force_exit(self) -> None:
307
307
  """Immediately terminates the Fluent session, losing unsaved progress and
308
308
  data."""
309
- self.fluent_connection.force_exit()
309
+ self._fluent_connection.force_exit()
310
310
 
311
311
  def upload(self, file_name: str):
312
312
  """Upload a file to the server.
@@ -38,7 +38,7 @@ class Meshing(PureMeshing):
38
38
  def _switch_to_solver(self) -> Any:
39
39
  self.tui.switch_to_solution_mode("yes")
40
40
  solver_session = Solver(
41
- fluent_connection=self.fluent_connection,
41
+ fluent_connection=self._fluent_connection,
42
42
  file_transfer_service=self._file_transfer_service,
43
43
  )
44
44
  delattr(self, "switch_to_solver")
@@ -67,7 +67,7 @@ class PureMeshing(BaseSession):
67
67
  rules=_rules,
68
68
  no_commands_diff_state=pyfluent.DATAMODEL_USE_NOCOMMANDS_DIFF_STATE,
69
69
  )
70
- self.fluent_connection.register_finalizer_cb(stream.stop)
70
+ self._fluent_connection.register_finalizer_cb(stream.stop)
71
71
 
72
72
  @property
73
73
  def tui(self):
@@ -60,7 +60,7 @@ def _import_settings_root(root):
60
60
  api_keys = root.child_names
61
61
 
62
62
  for root_item in api_keys:
63
- _class_dict[root_item] = getattr(root, root_item)
63
+ _class_dict[root_item] = root.__dict__[root_item]
64
64
 
65
65
  settings_api_root = type("SettingsRoot", (object,), _class_dict)
66
66
  return settings_api_root()
@@ -106,7 +106,7 @@ class Solver(BaseSession):
106
106
  self.fields.solution_variable_info = SolutionVariableInfo(
107
107
  self._solution_variable_service
108
108
  )
109
- self._reduction_service = self.fluent_connection.create_grpc_service(
109
+ self._reduction_service = self._fluent_connection.create_grpc_service(
110
110
  ReductionService, self._error_state
111
111
  )
112
112
  if FluentVersion(self._version) >= FluentVersion.v241:
@@ -208,7 +208,7 @@ class Solver(BaseSession):
208
208
  flproxy=self._settings_service,
209
209
  version=self._version,
210
210
  file_transfer_service=self._file_transfer_service,
211
- scheme_eval=self.fluent_connection.scheme_eval.scheme_eval,
211
+ scheme_eval=self._fluent_connection.scheme_eval.scheme_eval,
212
212
  )
213
213
  return self._settings_root
214
214
 
@@ -233,7 +233,7 @@ class Solver(BaseSession):
233
233
  except Exception as ex:
234
234
  raise RuntimeError("Unable to read mesh") from ex
235
235
  state = self.settings.get_state()
236
- self.build_from_fluent_connection(fut_session.fluent_connection)
236
+ self.build_from_fluent_connection(fut_session._fluent_connection)
237
237
  # TODO temporary fix till set_state at settings root is fixed
238
238
  _set_state_safe(self.settings, state)
239
239
 
@@ -248,7 +248,7 @@ class Solver(BaseSession):
248
248
  import ansys.fluent.core as pyfluent
249
249
 
250
250
  self.file.read(file_type="case", file_name=file_name, lightweight_setup=True)
251
- launcher_args = dict(self.fluent_connection.launcher_args)
251
+ launcher_args = dict(self._fluent_connection.launcher_args)
252
252
  launcher_args.pop("lightweight_mode", None)
253
253
  launcher_args["case_file_name"] = file_name
254
254
  fut: Future = asynchronous(pyfluent.launch_fluent)(**launcher_args)
@@ -32,5 +32,5 @@ class SolverLite(Solver):
32
32
 
33
33
  def switch_to_full_solver(self):
34
34
  """A switch to move to the full-solver session from solver-lite."""
35
- solver_session = Solver(fluent_connection=self.fluent_connection)
35
+ solver_session = Solver(fluent_connection=self._fluent_connection)
36
36
  return solver_session
@@ -185,6 +185,7 @@ class Base:
185
185
  self._setattr("_file_transfer_service", None)
186
186
  if name is not None:
187
187
  self._setattr("_name", name)
188
+ self._setattr("_child_alias_objs", {})
188
189
 
189
190
  def set_flproxy(self, flproxy):
190
191
  """Set flproxy object."""
@@ -328,20 +329,19 @@ class Base:
328
329
  attr = self.get_attr(_InlineConstants.is_active)
329
330
  return False if attr is False else True
330
331
 
331
- def _is_stable(self) -> bool:
332
+ def _check_stable(self) -> None:
332
333
  """Whether the object is stable."""
333
- if self.is_active():
334
- attr = self.get_attr(_InlineConstants.is_stable)
335
- else:
336
- attr = True
337
- attr = False if attr is False else True
338
- if attr is False:
334
+ if not self.is_active():
335
+ return
336
+ attr = self.get_attr(_InlineConstants.is_stable)
337
+ attr = True if attr is None else attr
338
+ if not attr:
339
339
  warnings.warn(
340
- f"The API feature at {self.path} is not stable. "
340
+ f"The API feature at '{self.path}' is not stable. "
341
341
  f"It is not guaranteed that it is fully validated and "
342
- f"there is no commitment to its backwards compatibility."
342
+ f"there is no commitment to its backwards compatibility.",
343
+ UnstableSettingWarning,
343
344
  )
344
- return attr
345
345
 
346
346
  def is_read_only(self) -> bool:
347
347
  """Whether the object is read-only."""
@@ -519,6 +519,12 @@ class DeprecatedSettingWarning(FutureWarning):
519
519
  pass
520
520
 
521
521
 
522
+ class UnstableSettingWarning(UserWarning):
523
+ """Provides unstable settings warning."""
524
+
525
+ pass
526
+
527
+
522
528
  _show_warning_orig = warnings.showwarning
523
529
 
524
530
 
@@ -646,12 +652,10 @@ class SettingsBase(Base, Generic[StateT]):
646
652
  for k, v in value.items():
647
653
  if hasattr(cls, "_child_aliases") and k in cls._child_aliases:
648
654
  alias = cls._child_aliases[k]
649
- if not isinstance(alias, str):
650
- alias = alias.alias_path
651
655
  # TODO: handle ".." in alias path
652
656
  if ".." in alias:
653
657
  raise NotImplementedError(
654
- 'Cannot handle ".." in alias path while setting state.'
658
+ 'Cannot handle ".." in alias path while setting dictionary state.'
655
659
  )
656
660
  ret_alias = ret
657
661
  comps = alias.split("/")
@@ -992,24 +996,26 @@ class Group(SettingsBase[DictStateType]):
992
996
  return ret
993
997
 
994
998
  def _get_parent_of_active_child_names(self, name):
995
- parents = ""
996
- path_list = []
997
- for parent in self.get_active_child_names():
998
- try:
999
- if hasattr(getattr(self, parent), str(name)):
1000
- path_list.append(f" {self.python_path}.{parent}.{str(name)}")
1001
- if len(parents) != 0:
1002
- parents += ", " + parent
1003
- else:
1004
- parents += parent
1005
- except AttributeError:
1006
- pass
1007
- if len(path_list):
1008
- print(f"\n {str(name)} can be accessed from the following paths: \n")
1009
- for path in path_list:
1010
- print(path)
1011
- if len(parents):
1012
- return f"\n {name} is a child of {parents} \n"
999
+ with warnings.catch_warnings():
1000
+ warnings.filterwarnings(action="ignore", category=UnstableSettingWarning)
1001
+ parents = ""
1002
+ path_list = []
1003
+ for parent in self.get_active_child_names():
1004
+ try:
1005
+ if hasattr(getattr(self, parent), str(name)):
1006
+ path_list.append(f" {self.python_path}.{parent}.{str(name)}")
1007
+ if len(parents) != 0:
1008
+ parents += ", " + parent
1009
+ else:
1010
+ parents += parent
1011
+ except AttributeError:
1012
+ pass
1013
+ if len(path_list):
1014
+ print(f"\n {str(name)} can be accessed from the following paths: \n")
1015
+ for path in path_list:
1016
+ print(path)
1017
+ if len(parents):
1018
+ return f"\n {name} is a child of {parents} \n"
1013
1019
 
1014
1020
  def __getattribute__(self, name):
1015
1021
  if name in super().__getattribute__("child_names"):
@@ -1017,16 +1023,18 @@ class Group(SettingsBase[DictStateType]):
1017
1023
  raise InactiveObjectError(self.python_path)
1018
1024
  alias = super().__getattribute__("_child_aliases").get(name)
1019
1025
  if alias:
1020
- if isinstance(alias, str):
1026
+ alias_obj = self._child_alias_objs.get(name)
1027
+ if alias_obj is None:
1021
1028
  obj = self.find_object(alias)
1022
- # replacing aliased paths with alias objects in _child_aliases
1023
- alias_obj = self._child_aliases[name] = _create_child(
1029
+ alias_obj = self._child_alias_objs[name] = _create_child(
1024
1030
  obj.__class__, None, obj.parent, alias
1025
1031
  )
1026
- return alias_obj
1027
- return alias
1032
+ return alias_obj
1028
1033
  try:
1029
- return super().__getattribute__(name)
1034
+ attr = super().__getattribute__(name)
1035
+ if name in super().__getattribute__("_child_classes"):
1036
+ attr._check_stable()
1037
+ return attr
1030
1038
  except AttributeError as ex:
1031
1039
  self._get_parent_of_active_child_names(name)
1032
1040
  error_msg = allowed_name_error_message(
@@ -1315,14 +1323,13 @@ class NamedObject(SettingsBase[DictStateType], Generic[ChildTypeT]):
1315
1323
  def __getattr__(self, name: str):
1316
1324
  alias = self._child_aliases.get(name)
1317
1325
  if alias:
1318
- if isinstance(alias, str):
1326
+ alias_obj = self._child_alias_objs.get(name)
1327
+ if alias_obj is None:
1319
1328
  obj = self.find_object(alias)
1320
- # replacing aliased paths with alias objects in _child_aliases
1321
- alias_obj = self._child_aliases[name] = _create_child(
1329
+ alias_obj = self._child_alias_objs[name] = _create_child(
1322
1330
  obj.__class__, None, obj.parent, alias
1323
1331
  )
1324
- return alias_obj
1325
- return alias
1332
+ return alias_obj
1326
1333
  else:
1327
1334
  return getattr(super(), name)
1328
1335
 
@@ -1433,14 +1440,13 @@ class ListObject(SettingsBase[ListStateType], Generic[ChildTypeT]):
1433
1440
  def __getattr__(self, name: str):
1434
1441
  alias = self._child_aliases.get(name)
1435
1442
  if alias:
1436
- if isinstance(alias, str):
1443
+ alias_obj = self._child_alias_objs.get(name)
1444
+ if alias_obj is None:
1437
1445
  obj = self.find_object(alias)
1438
- # replacing aliased paths with alias objects in _child_aliases
1439
- alias_obj = self._child_aliases[name] = _create_child(
1446
+ alias_obj = self._child_alias_objs[name] = _create_child(
1440
1447
  obj.__class__, None, obj.parent, alias
1441
1448
  )
1442
- return alias_obj
1443
- return alias
1449
+ return alias_obj
1444
1450
  else:
1445
1451
  return getattr(super(), name)
1446
1452
 
@@ -1512,14 +1518,13 @@ class Action(Base):
1512
1518
  def __getattr__(self, name: str):
1513
1519
  alias = self._child_aliases.get(name)
1514
1520
  if alias:
1515
- if isinstance(alias, str):
1521
+ alias_obj = self._child_alias_objs.get(name)
1522
+ if alias_obj is None:
1516
1523
  obj = self.find_object(alias)
1517
- # replacing aliased paths with alias objects in _child_aliases
1518
- alias_obj = self._child_aliases[name] = _create_child(
1524
+ alias_obj = self._child_alias_objs[name] = _create_child(
1519
1525
  obj.__class__, None, obj.parent, alias
1520
1526
  )
1521
- return alias_obj
1522
- return alias
1527
+ return alias_obj
1523
1528
  else:
1524
1529
  return getattr(super(), name)
1525
1530
 
@@ -5,5 +5,5 @@
5
5
  """A package providing Fluent's Settings Objects in Python."""
6
6
  from ansys.fluent.core.solver.flobject import *
7
7
 
8
- SHASH = "ed400e777918fd20d1501bfc8e08395dbbac65aa275e660cdef0a842087f86d4"
8
+ SHASH = "5d4d7352ed86930fd93f62053dd2ad4472eea398bb68d92f9e3a437a902f6266"
9
9
  from .root import root
@@ -65,7 +65,7 @@ class plane_surface_child(Group):
65
65
  )
66
66
 
67
67
  _child_aliases = dict(
68
- point_normal="normal",
69
68
  point_vector="point",
69
+ point_normal="normal",
70
70
  )
71
71