ansys-fluent-core 0.31.dev1__py3-none-any.whl → 0.31.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 (59) hide show
  1. ansys/fluent/core/__init__.py +11 -3
  2. ansys/fluent/core/codegen/settingsgen.py +6 -0
  3. ansys/fluent/core/codegen/tuigen.py +1 -2
  4. ansys/fluent/core/docker/docker_compose.py +243 -0
  5. ansys/fluent/core/field_data_interfaces.py +6 -0
  6. ansys/fluent/core/file_session.py +158 -128
  7. ansys/fluent/core/filereader/data_file.py +11 -0
  8. ansys/fluent/core/filereader/pre_processor.py +22 -0
  9. ansys/fluent/core/fluent_connection.py +48 -20
  10. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  11. ansys/fluent/core/generated/datamodel_231/flicing.py +35 -35
  12. ansys/fluent/core/generated/datamodel_231/meshing.py +189 -189
  13. ansys/fluent/core/generated/datamodel_232/flicing.py +35 -35
  14. ansys/fluent/core/generated/datamodel_232/meshing.py +237 -237
  15. ansys/fluent/core/generated/datamodel_241/flicing.py +45 -45
  16. ansys/fluent/core/generated/datamodel_241/meshing.py +295 -295
  17. ansys/fluent/core/generated/datamodel_242/flicing.py +60 -60
  18. ansys/fluent/core/generated/datamodel_242/meshing.py +285 -285
  19. ansys/fluent/core/generated/datamodel_242/part_management.py +6 -6
  20. ansys/fluent/core/generated/datamodel_251/flicing.py +55 -55
  21. ansys/fluent/core/generated/datamodel_251/meshing.py +370 -370
  22. ansys/fluent/core/generated/datamodel_251/part_management.py +6 -6
  23. ansys/fluent/core/generated/datamodel_252/flicing.py +55 -55
  24. ansys/fluent/core/generated/datamodel_252/meshing.py +790 -428
  25. ansys/fluent/core/generated/datamodel_252/part_management.py +10 -10
  26. ansys/fluent/core/generated/datamodel_252/preferences.py +1 -1
  27. ansys/fluent/core/generated/fluent_version_252.py +4 -4
  28. ansys/fluent/core/generated/meshing/tui_252.py +1133 -1178
  29. ansys/fluent/core/generated/solver/settings_252.py +2241 -1649
  30. ansys/fluent/core/generated/solver/settings_252.pyi +1785 -1430
  31. ansys/fluent/core/generated/solver/settings_builtin.pyi +104 -0
  32. ansys/fluent/core/generated/solver/tui_252.py +2174 -2005
  33. ansys/fluent/core/launcher/container_launcher.py +39 -8
  34. ansys/fluent/core/launcher/fluent_container.py +61 -22
  35. ansys/fluent/core/launcher/launcher.py +24 -13
  36. ansys/fluent/core/launcher/launcher_utils.py +8 -0
  37. ansys/fluent/core/launcher/process_launch_string.py +2 -6
  38. ansys/fluent/core/launcher/slurm_launcher.py +1 -0
  39. ansys/fluent/core/report.py +2 -0
  40. ansys/fluent/core/services/deprecated_field_data.py +74 -46
  41. ansys/fluent/core/services/field_data.py +104 -69
  42. ansys/fluent/core/services/reduction.py +55 -66
  43. ansys/fluent/core/services/solution_variables.py +9 -1
  44. ansys/fluent/core/session.py +15 -12
  45. ansys/fluent/core/session_meshing.py +3 -0
  46. ansys/fluent/core/session_solver.py +20 -43
  47. ansys/fluent/core/session_utilities.py +429 -0
  48. ansys/fluent/core/solver/flobject.py +28 -0
  49. ansys/fluent/core/utils/deprecate.py +46 -0
  50. ansys/fluent/core/utils/file_transfer_service.py +19 -3
  51. ansys/fluent/core/utils/fluent_version.py +42 -11
  52. ansys/fluent/core/variable_strategies/__init__.py +29 -0
  53. ansys/fluent/core/variable_strategies/expr.py +186 -0
  54. ansys/fluent/core/variable_strategies/field.py +186 -0
  55. ansys/fluent/core/variable_strategies/svar.py +61 -0
  56. {ansys_fluent_core-0.31.dev1.dist-info → ansys_fluent_core-0.31.1.dist-info}/METADATA +9 -6
  57. {ansys_fluent_core-0.31.dev1.dist-info → ansys_fluent_core-0.31.1.dist-info}/RECORD +59 -53
  58. {ansys_fluent_core-0.31.dev1.dist-info → ansys_fluent_core-0.31.1.dist-info}/WHEEL +1 -1
  59. {ansys_fluent_core-0.31.dev1.dist-info → ansys_fluent_core-0.31.1.dist-info/licenses}/LICENSE +0 -0
@@ -74,6 +74,9 @@ from ansys.fluent.core.pyfluent_warnings import (
74
74
  PyFluentUserWarning,
75
75
  )
76
76
  from ansys.fluent.core.utils.fluent_version import FluentVersion
77
+ from ansys.fluent.core.variable_strategies import (
78
+ FluentFieldDataNamingStrategy as naming_strategy,
79
+ )
77
80
 
78
81
  from . import _docstrings
79
82
  from .error_message import allowed_name_error_message, allowed_values_error
@@ -196,6 +199,9 @@ def to_python_name(fluent_name: str) -> str:
196
199
  return name
197
200
 
198
201
 
202
+ _to_field_name_str = naming_strategy().to_string if naming_strategy else lambda s: s
203
+
204
+
199
205
  def _get_python_path_comps(obj):
200
206
  """Get python path components for traversing class hierarchy."""
201
207
  comps = []
@@ -628,6 +634,18 @@ class RealNumerical(Numerical):
628
634
  class Textual(Property):
629
635
  """Exposes attribute accessor on settings object - specific to string objects."""
630
636
 
637
+ def set_state(self, state: StateT | None = None, **kwargs):
638
+ """Set the state of the object.
639
+
640
+ Parameters
641
+ ----------
642
+ state
643
+ Either str or VariableDescriptor.
644
+ kwargs : Any
645
+ Keyword arguments.
646
+ """
647
+ return self.base_set_state(state=_to_field_name_str(state), **kwargs)
648
+
631
649
 
632
650
  class DeprecatedSettingWarning(PyFluentDeprecationWarning):
633
651
  """Provides deprecated settings warning."""
@@ -853,6 +871,9 @@ class String(SettingsBase[str], Textual):
853
871
 
854
872
  _state_type = str
855
873
 
874
+ base_set_state = SettingsBase[str].set_state
875
+ set_state = Textual.set_state
876
+
856
877
 
857
878
  class Filename(SettingsBase[str], Textual):
858
879
  """A ``Filename`` object representing a file name."""
@@ -1164,6 +1185,10 @@ class Group(SettingsBase[DictStateType]):
1164
1185
  raise
1165
1186
 
1166
1187
  def __setattr__(self, name: str, value):
1188
+ # 'settings_source' will be set to settings object when they are created from builtin settings classes.
1189
+ # We don't allow overwriting it.
1190
+ if name == "settings_source":
1191
+ raise AttributeError("Cannot overwrite settings_source after it is set.")
1167
1192
  attr = None
1168
1193
  try:
1169
1194
  attr = getattr(self, name)
@@ -2103,6 +2128,9 @@ def get_cls(name, info, parent=None, version=None, parent_taboo=None):
2103
2128
  dct["_child_classes"] = {}
2104
2129
  cls = type(pname, bases, dct)
2105
2130
 
2131
+ deprecated_version = info.get("deprecated_version", "")
2132
+ cls._deprecated_version = deprecated_version
2133
+
2106
2134
  taboo = set(dir(cls))
2107
2135
  taboo |= set(
2108
2136
  [
@@ -23,14 +23,60 @@
23
23
  """Module that provides a method to handle deprecated arguments."""
24
24
 
25
25
  import functools
26
+ from functools import wraps
26
27
  import logging
27
28
  import warnings
28
29
 
30
+ from deprecated.sphinx import deprecated
31
+
29
32
  from ansys.fluent.core.pyfluent_warnings import PyFluentDeprecationWarning
30
33
 
31
34
  logger = logging.getLogger("pyfluent.general")
32
35
 
33
36
 
37
+ def all_deprecators(
38
+ deprecate_arg_mappings,
39
+ data_type_converter,
40
+ deprecated_version,
41
+ deprecated_reason,
42
+ warn_message,
43
+ ):
44
+ """Decorator that applies multiple deprecators to a function."""
45
+
46
+ def decorator(func):
47
+ decorated = func
48
+ for mapping in deprecate_arg_mappings:
49
+ decorated = deprecate_argument(
50
+ old_arg=mapping["old_arg"],
51
+ new_arg=mapping["new_arg"],
52
+ converter=mapping.get("converter", lambda x: x),
53
+ warning_cls=PyFluentDeprecationWarning,
54
+ )(decorated)
55
+ if data_type_converter:
56
+ decorated = deprecate_arguments(
57
+ converter=data_type_converter,
58
+ warning_cls=PyFluentDeprecationWarning,
59
+ )(decorated)
60
+ decorated = deprecated(
61
+ version=deprecated_version,
62
+ reason=deprecated_reason,
63
+ )(decorated)
64
+
65
+ @wraps(decorated)
66
+ def wrapper(*args, **kwargs):
67
+ if warn_message:
68
+ warnings.warn(
69
+ warn_message,
70
+ PyFluentDeprecationWarning,
71
+ stacklevel=2,
72
+ )
73
+ return decorated(*args, **kwargs)
74
+
75
+ return wrapper
76
+
77
+ return decorator
78
+
79
+
34
80
  def deprecate_argument(
35
81
  old_arg,
36
82
  new_arg,
@@ -31,7 +31,7 @@ import warnings
31
31
 
32
32
  from ansys.fluent.core.pyfluent_warnings import PyFluentUserWarning
33
33
  from ansys.fluent.core.utils import get_user_data_dir
34
- from ansys.fluent.core.utils.deprecate import deprecate_argument
34
+ from ansys.fluent.core.utils.deprecate import all_deprecators
35
35
  import ansys.platform.instancemanagement as pypim
36
36
 
37
37
  # Host path which is mounted to the file-transfer-service container
@@ -229,8 +229,24 @@ class ContainerFileTransferStrategy(FileTransferStrategy):
229
229
  >>> solver_session.download(file_name="write_elbow.cas.h5", local_directory="<local_directory_path>")
230
230
  """
231
231
 
232
- @deprecate_argument("container_mount_path", "mount_target")
233
- @deprecate_argument("host_mount_path", "mount_source")
232
+ @all_deprecators(
233
+ deprecate_arg_mappings=[
234
+ {
235
+ "old_arg": "container_mount_path",
236
+ "new_arg": "mount_target",
237
+ "converter": lambda old_arg_val: old_arg_val,
238
+ },
239
+ {
240
+ "old_arg": "host_mount_path",
241
+ "new_arg": "mount_source",
242
+ "converter": lambda old_arg_val: old_arg_val,
243
+ },
244
+ ],
245
+ data_type_converter=None,
246
+ deprecated_version="v0.23.dev1",
247
+ deprecated_reason="'container_mount_path' and 'host_mount_path' are deprecated. Use 'mount_target' and 'mount_source' instead.",
248
+ warn_message="",
249
+ )
234
250
  def __init__(
235
251
  self,
236
252
  image_name: str | None = None,
@@ -25,6 +25,9 @@
25
25
  from enum import Enum
26
26
  from functools import total_ordering
27
27
  import os
28
+ from pathlib import Path
29
+ import platform
30
+ from typing import Any
28
31
 
29
32
  import ansys.fluent.core as pyfluent
30
33
 
@@ -32,7 +35,19 @@ import ansys.fluent.core as pyfluent
32
35
  class AnsysVersionNotFound(RuntimeError):
33
36
  """Raised when Ansys version is not found."""
34
37
 
35
- pass
38
+ def __init__(self, version: Any):
39
+ """Initialize VersionNotFound.
40
+
41
+ Parameters
42
+ ----------
43
+ version : str
44
+ Version that was not found.
45
+ """
46
+ super().__init__(
47
+ f"The specified version '{version}' is not supported."
48
+ + " Supported versions are: "
49
+ + ", ".join([member.value for member in FluentVersion][::-1])
50
+ )
36
51
 
37
52
 
38
53
  class ComparisonError(RuntimeError):
@@ -74,6 +89,7 @@ class FluentVersion(Enum):
74
89
  FluentVersion.v232.awp_var == 'AWP_ROOT232'
75
90
  """
76
91
 
92
+ v261 = "26.1.0"
77
93
  v252 = "25.2.0"
78
94
  v251 = "25.1.0"
79
95
  v242 = "24.2.0"
@@ -83,7 +99,7 @@ class FluentVersion(Enum):
83
99
  v222 = "22.2.0"
84
100
 
85
101
  @classmethod
86
- def _missing_(cls, version):
102
+ def _missing_(cls, version: Any):
87
103
  if isinstance(version, (int, float, str)):
88
104
  version = str(version)
89
105
  if len(version) == 3:
@@ -92,11 +108,8 @@ class FluentVersion(Enum):
92
108
  for member in cls:
93
109
  if version == member.value:
94
110
  return member
95
- raise AnsysVersionNotFound(
96
- f"The specified version '{version[:-2]}' is not supported."
97
- + " Supported versions are: "
98
- + ", ".join([member.value for member in cls][::-1])
99
- )
111
+
112
+ raise AnsysVersionNotFound(version[:-2])
100
113
 
101
114
  @classmethod
102
115
  def get_latest_installed(cls):
@@ -110,15 +123,33 @@ class FluentVersion(Enum):
110
123
 
111
124
  Raises
112
125
  ------
113
- AnsysVersionNotFound
126
+ FileNotFoundError
114
127
  If an Ansys version cannot be found.
115
128
  """
116
129
  for member in cls:
117
- if member.awp_var in os.environ:
130
+ if member.awp_var in os.environ and member.get_fluent_exe_path().exists():
118
131
  return member
119
132
 
120
- raise AnsysVersionNotFound(
121
- "Verify the value of the 'AWP_ROOT' environment variable."
133
+ raise FileNotFoundError(
134
+ "Unable to locate a compatible Ansys Fluent installation. "
135
+ "Ensure that an environment variable like 'AWP_ROOT242' or 'AWP_ROOT251' "
136
+ "points to a supported Ansys version, and that Fluent is included in the installation."
137
+ )
138
+
139
+ def get_fluent_exe_path(self) -> Path:
140
+ """Get the path for the Fluent executable file.
141
+
142
+ Returns
143
+ -------
144
+ Path
145
+ Fluent executable path.
146
+ """
147
+ awp_root = os.environ[self.awp_var]
148
+ fluent_root = Path(awp_root) / "fluent"
149
+ return (
150
+ fluent_root / "ntbin" / "win64" / "fluent.exe"
151
+ if platform.system() == "Windows"
152
+ else fluent_root / "bin" / "fluent"
122
153
  )
123
154
 
124
155
  @classmethod
@@ -0,0 +1,29 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ """
24
+ Provides ConversionStrategy classes for mapping VariableDescriptor to variable names used in Fluent.
25
+ """
26
+
27
+ from .expr import FluentExprNamingStrategy # noqa: F401
28
+ from .field import FluentFieldDataNamingStrategy # noqa: F401
29
+ from .svar import FluentSVarNamingStrategy # noqa: F401
@@ -0,0 +1,186 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ """
24
+ Provides a ConversionStrategy for mapping VariableDescriptor to variable names used in Fluent expressions.
25
+ """
26
+
27
+ try:
28
+ from ansys.units.variable_descriptor import (
29
+ MappingConversionStrategy,
30
+ VariableCatalog,
31
+ )
32
+ except ModuleNotFoundError:
33
+ MappingConversionStrategy = None
34
+
35
+
36
+ if MappingConversionStrategy:
37
+
38
+ class FluentExprNamingStrategy(MappingConversionStrategy):
39
+ """This strategy handles conversion of selected VariableCatalog into Fluent's
40
+ server-side expression variable naming conventions.
41
+ """
42
+
43
+ _c = VariableCatalog
44
+
45
+ _mapping = {
46
+ # pressure
47
+ _c.PRESSURE: "StaticPressure",
48
+ _c.STATIC_PRESSURE: "StaticPressure",
49
+ _c.ABSOLUTE_PRESSURE: "AbsolutePressure",
50
+ _c.DYNAMIC_PRESSURE: "DynamicPressure",
51
+ _c.TOTAL_PRESSURE: "TotalPressure",
52
+ _c.PRESSURE_COEFFICIENT: "PressureCoefficient",
53
+ # velocity
54
+ _c.AXIAL_VELOCITY: "AxialVelocity",
55
+ _c.CONVECTIVE_COURANT_NUMBER: "ElementConvectionCourantNumber",
56
+ _c.CELL_REYNOLDS_NUMBER: "ElementReynoldsNumber",
57
+ _c.fluent.HELICITY: "Helicity",
58
+ _c.fluent.LAMBDA_2_CRITERION: "Lambda2Criterion",
59
+ _c.MESH_VELOCITY: "MeshVelocity",
60
+ _c.MESH_VELOCITY_X: "MeshVelocity.x",
61
+ _c.MESH_VELOCITY_Y: "MeshVelocity.y",
62
+ _c.MESH_VELOCITY_Z: "MeshVelocity.z",
63
+ _c.MESH_VELOCITY_MAGNITUDE: "MeshVelocityMagnitude",
64
+ _c.NORMALIZED_Q_CRITERION: "QCriterionNormalized",
65
+ _c.Q_CRITERION: "QCriterionRaw",
66
+ _c.RADIAL_VELOCITY: "RadialVelocity",
67
+ _c.TANGENTIAL_VELOCITY: "TangentialVelocity",
68
+ _c.VELOCITY: "Velocity",
69
+ _c.VELOCITY_X: "Velocity.x",
70
+ _c.VELOCITY_Y: "Velocity.y",
71
+ _c.VELOCITY_Z: "Velocity.z",
72
+ _c.VELOCITY_MAGNITUDE: "VelocityMagnitude",
73
+ _c.fluent.VELOCITY_ANGLE: "VelocityAngle",
74
+ _c.VORTICITY: "Vorticity",
75
+ _c.VORTICITY_X: "Vorticity.x",
76
+ _c.VORTICITY_Y: "Vorticity.y",
77
+ _c.VORTICITY_Z: "Vorticity.z",
78
+ _c.VORTICITY_MAGNITUDE: "VorticityMagnitude",
79
+ # density
80
+ _c.DENSITY: "Density",
81
+ _c.fluent.DENSITY_ALL: "DensityAll",
82
+ # "properties"
83
+ _c.DYNAMIC_VISCOSITY: "DynamicViscosity",
84
+ _c.PRANDTL_NUMBER: "PrandtlNumber",
85
+ _c.SPECIFIC_HEAT_CAPACITY: "SpecificHeatCapacity",
86
+ _c.THERMAL_CONDUCTIVITY: "ThermalConductivity",
87
+ # turbulence
88
+ _c.EFFECTIVE_PRANDTL_NUMBER: "EffectivePrandtlNumber",
89
+ _c.EFFECTIVE_THERMAL_CONDUCTIVITY: "EffectiveThermalConductivity",
90
+ _c.EFFECTIVE_VISCOSITY: "EffectiveViscosity",
91
+ _c.PRODUCTION_OF_TURBULENT_KINETIC_ENERGY: "Productionofk",
92
+ _c.SPECIFIC_DISSIPATION_RATE: "SpecificDissipationRateOmega",
93
+ _c.TURBULENT_DISSIPATION_RATE: "TurbulenceDissipationRate",
94
+ _c.TURBULENT_INTENSITY: "TurbulenceIntensity",
95
+ _c.TURBULENT_VISCOSITY: "TurbulenceViscosity",
96
+ _c.TURBULENT_VISCOSITY_RATIO: "TurbulenceViscosityRatio",
97
+ _c.TURBULENT_KINETIC_ENERGY: "TurbulentKineticEnergyk",
98
+ _c.TURBULENT_REYNOLDS_NUMBER: "TurbulentReynoldsNumberRe_y",
99
+ _c.WALL_Y_PLUS: "WallYplus",
100
+ _c.WALL_Y_STAR: "WallYstar",
101
+ # wall fluxes
102
+ _c.SURFACE_HEAT_TRANSFER_COEFFICIENT: "HeatTransferCoefficient",
103
+ _c.SKIN_FRICTION_COEFFICIENT: "SkinFrictionCoefficient",
104
+ _c.SURFACE_HEAT_FLUX: "SurfaceHeatFlux",
105
+ _c.SURFACE_HEAT_TRANSFER_COEFFICIENT: "SurfaceHeatTransferCoefficient",
106
+ _c.SURFACE_NUSSELT_NUMBER: "SurfaceNusseltNumber",
107
+ _c.SURFACE_STANTON_NUMBER: "SurfaceStantonNumber",
108
+ _c.WALL_ADJACENT_HEAT_TRANSFER_COEFFICIENT: "WallAdjacentHeatTransferCoef",
109
+ _c.WALL_SHEAR_STRESS: "WallShearStressVector",
110
+ _c.WALL_SHEAR_STRESS_X: "WallShearStressVector.x",
111
+ _c.WALL_SHEAR_STRESS_Y: "WallShearStressVector.y",
112
+ _c.WALL_SHEAR_STRESS_Z: "WallShearStressVector.z",
113
+ _c.WALL_SHEAR_STRESS_MAGNITUDE: "WallShearStressVector.mag",
114
+ _c.fluent.Y_PLUS_BASED_HEAT_TRANSFER_COEFFICIENT: "YplusBasedHeatTranCoef",
115
+ # residuals
116
+ _c.fluent.MASS_IMBALANCE: "MassImbalance",
117
+ # derivatives
118
+ _c.fluent.PRESSURE_HESSIAN_INDICATOR: "PressureHessianIndicator",
119
+ _c.STRAIN_RATE: "StrainRate",
120
+ _c.fluent.DVELOCITY_DX: "dVelocitydx",
121
+ _c.fluent.DVELOCITY_DX_X: "dVelocitydx.x",
122
+ _c.fluent.DVELOCITY_DX_Y: "dVelocitydx.y",
123
+ _c.fluent.DVELOCITY_DX_Z: "dVelocitydx.z",
124
+ _c.fluent.DVELOCITY_DX_MAGNITUDE: "dVelocitydx.mag",
125
+ _c.fluent.DVELOCITY_DY: "dVelocitydy",
126
+ _c.fluent.DVELOCITY_DY_X: "dVelocitydy.x",
127
+ _c.fluent.DVELOCITY_DY_Y: "dVelocitydy.y",
128
+ _c.fluent.DVELOCITY_DY_Z: "dVelocitydy.z",
129
+ _c.fluent.DVELOCITY_DY_MAGNITUDE: "dVelocitydy.mag",
130
+ _c.fluent.DVELOCITY_DZ: "dVelocitydz",
131
+ _c.fluent.DVELOCITY_DZ_X: "dVelocitydz.x",
132
+ _c.fluent.DVELOCITY_DZ_Y: "dVelocitydz.y",
133
+ _c.fluent.DVELOCITY_DZ_Z: "dVelocitydz.z",
134
+ _c.fluent.DVELOCITY_DZ_MAGNITUDE: "dVelocitydz.mag",
135
+ # temperature
136
+ _c.SPECIFIC_ENTHALPY: "SpecificEnthalpy",
137
+ _c.SPECIFIC_ENTROPY: "SpecificEntropy",
138
+ _c.SPECIFIC_INTERNAL_ENERGY: "SpecificInternalEnergy",
139
+ _c.SPECIFIC_TOTAL_ENERGY: "SpecificTotalEnergy",
140
+ _c.TEMPERATURE: "StaticTemperature",
141
+ _c.SPECIFIC_TOTAL_ENTHALPY: "SpecificTotalEnthalpy",
142
+ _c.fluent.TOTAL_ENTHALPY_DEVIATION: "TotalEnthalpyDeviation",
143
+ _c.TOTAL_TEMPERATURE: "TotalTemperature",
144
+ _c.WALL_ADJACENT_TEMPERATURE: "WallAdjacentTemperature",
145
+ _c.WALL_TEMPERATURE: "WallTemperature",
146
+ _c.WALL_TEMPERATURE_THIN: "WallTemperatureThin",
147
+ _c.fluent.Y_PLUS_BASED_HEAT_TRANSFER_COEFFICIENT: "YplusBasedHeatTranRefTemperature",
148
+ # mesh
149
+ _c.mesh.ANISOTROPIC_ADAPTION_CELLS: "AnisotropicAdaptionCells",
150
+ _c.mesh.BOUNDARY_CELL_DISTANCE: "BoundaryCellDistance",
151
+ _c.mesh.BOUNDARY_LAYER_CELLS: "BoundaryLayerCells",
152
+ _c.mesh.BOUNDARY_NORMAL_DISTANCE: "BoundaryNormalDistance",
153
+ _c.mesh.BOUNDARY_VOLUME_DISTANCE: "BoundaryVolumeDistance",
154
+ _c.mesh.CELL_EQUIANGLE_SKEW: "CellEquiangleSkew",
155
+ _c.mesh.CELL_EQUIVOLUME_SKEW: "CellEquivolumeSkew",
156
+ _c.mesh.CELL_PARENT_INDEX: "CellParentIndex",
157
+ _c.mesh.CELL_REFINE_LEVEL: "CellRefineLevel",
158
+ _c.mesh.CELL_VOLUME: "CellVolume",
159
+ _c.mesh.CELL_VOLUME_CHANGE: "CellVolumeChange",
160
+ _c.mesh.ELEMENT_ASPECT_RATIO: "ElementAspectRatio",
161
+ _c.mesh.ELEMENT_WALL_DISTANCE: "ElementWallDistance",
162
+ _c.mesh.FACE_AREA_MAGNITUDE: "FaceAreaMagnitude",
163
+ _c.mesh.FACE_HANDEDNESS: "FaceHandedness",
164
+ _c.mesh.INTERFACE_OVERLAP_FRACTION: "InterfaceOverlapFraction",
165
+ _c.mesh.MARK_POOR_ELEMENTS: "MarkPoorElements",
166
+ _c.POSITION: "Position",
167
+ _c.POSITION_X: "Position.x",
168
+ _c.POSITION_Y: "Position.y",
169
+ _c.POSITION_Z: "Position.z",
170
+ _c.POSITION_MAGNITUDE: "Position.mag",
171
+ _c.mesh.SMOOTHED_CELL_REFINE_LEVEL: "SmoothedCellRefineLevel",
172
+ _c.mesh.X_FACE_AREA: "XFaceArea",
173
+ _c.mesh.Y_FACE_AREA: "YFaceArea",
174
+ _c.mesh.Z_FACE_AREA: "ZFaceArea",
175
+ _c.mesh.ACTIVE_CELL_PARTITION: "ActiveElementPartition",
176
+ _c.mesh.CELL_ELEMENT_TYPE: "CellElementType",
177
+ _c.mesh.CELL_ID: "CellId",
178
+ _c.mesh.CELL_WEIGHT: "CellWeight",
179
+ _c.mesh.CELL_ZONE_INDEX: "CellZoneIndex",
180
+ _c.mesh.CELL_ZONE_TYPE: "CellZoneType",
181
+ _c.mesh.PARTITION_NEIGHBOURS: "PartitionNeighbors",
182
+ _c.mesh.STORED_CELL_PARTITIION: "StoredElementPartition",
183
+ }
184
+
185
+ else:
186
+ FluentExprNamingStrategy = None
@@ -0,0 +1,186 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ """
24
+ Provides a ConversionStrategy for mapping VariableDescriptor to names used in Fluent's field data API.
25
+ """
26
+
27
+ try:
28
+ from ansys.units.variable_descriptor import (
29
+ MappingConversionStrategy,
30
+ VariableCatalog,
31
+ )
32
+ except ModuleNotFoundError:
33
+ MappingConversionStrategy = None
34
+
35
+
36
+ if MappingConversionStrategy:
37
+
38
+ class FluentFieldDataNamingStrategy(MappingConversionStrategy):
39
+ """This strategy handles conversion of selected
40
+ VariableCatalog into Fluent's server-side field variable naming conventions.
41
+ """
42
+
43
+ _c = VariableCatalog
44
+
45
+ _mapping = {
46
+ # pressure
47
+ _c.PRESSURE: "pressure",
48
+ _c.STATIC_PRESSURE: "pressure",
49
+ _c.ABSOLUTE_PRESSURE: "absolute-pressure",
50
+ _c.DYNAMIC_PRESSURE: "dynamic-pressure",
51
+ _c.TOTAL_PRESSURE: "total-pressure",
52
+ _c.PRESSURE_COEFFICIENT: "pressure-coefficient",
53
+ # velocity
54
+ _c.AXIAL_VELOCITY: "axial-velocity",
55
+ _c.CONVECTIVE_COURANT_NUMBER: "cell-convective-courant-number",
56
+ _c.CELL_REYNOLDS_NUMBER: "cell-reynolds-number",
57
+ _c.fluent.HELICITY: "helicity",
58
+ _c.fluent.LAMBDA_2_CRITERION: "raw-q-criterion", # ???
59
+ _c.MESH_VELOCITY: "mesh-velocity", # ?
60
+ _c.MESH_VELOCITY_X: "mesh-x-velocity", # TODO
61
+ _c.MESH_VELOCITY_Y: "mesh-y-velocity", # TODO
62
+ _c.MESH_VELOCITY_Z: "mesh-z-velocity", # TODO
63
+ _c.MESH_VELOCITY_MAGNITUDE: "MeshVelocityMagnitude", # TODO
64
+ _c.NORMALIZED_Q_CRITERION: "q-criterion",
65
+ _c.Q_CRITERION: "raw-q-criterion",
66
+ _c.RADIAL_VELOCITY: "radial-velocity",
67
+ _c.TANGENTIAL_VELOCITY: "tangential-velocity",
68
+ _c.VELOCITY: "velocity",
69
+ _c.VELOCITY_X: "x-velocity",
70
+ _c.VELOCITY_Y: "y-velocity",
71
+ _c.VELOCITY_Z: "z-velocity",
72
+ _c.VELOCITY_MAGNITUDE: "velocity-magnitude",
73
+ _c.fluent.VELOCITY_ANGLE: "xxx", # eliminate altogether
74
+ _c.VORTICITY: "vorticity",
75
+ _c.VORTICITY_X: "x-vorticity",
76
+ _c.VORTICITY_Y: "y-vorticity",
77
+ _c.VORTICITY_Z: "z-vorticity",
78
+ _c.VORTICITY_MAGNITUDE: "vorticity-mag",
79
+ # density
80
+ _c.DENSITY: "density",
81
+ _c.fluent.DENSITY_ALL: "density-all",
82
+ # "properties"
83
+ _c.DYNAMIC_VISCOSITY: "viscosity-lam",
84
+ _c.PRANDTL_NUMBER: "prandtl-number-lam",
85
+ _c.SPECIFIC_HEAT_CAPACITY: "specific-heat-cp",
86
+ _c.THERMAL_CONDUCTIVITY: "thermal-conductivity",
87
+ # turbulence
88
+ _c.EFFECTIVE_PRANDTL_NUMBER: "prandtl-number-eff",
89
+ _c.EFFECTIVE_THERMAL_CONDUCTIVITY: "thermal-conductivity-eff",
90
+ _c.EFFECTIVE_VISCOSITY: "viscosity-eff",
91
+ _c.PRODUCTION_OF_TURBULENT_KINETIC_ENERGY: "production-of-k",
92
+ _c.SPECIFIC_DISSIPATION_RATE: "specific-diss-rate",
93
+ _c.TURBULENT_DISSIPATION_RATE: "turb-diss-rate",
94
+ _c.TURBULENT_INTENSITY: "turb-intensity",
95
+ _c.TURBULENT_VISCOSITY: "viscosity-turb",
96
+ _c.TURBULENT_VISCOSITY_RATIO: "viscosity-ratio",
97
+ _c.TURBULENT_KINETIC_ENERGY: "turb-kinetic-energy",
98
+ _c.TURBULENT_REYNOLDS_NUMBER: "turb-reynolds-number-rey",
99
+ _c.WALL_Y_PLUS: "y-plus",
100
+ _c.WALL_Y_STAR: "y-star",
101
+ # wall fluxes
102
+ _c.SURFACE_HEAT_TRANSFER_COEFFICIENT: "heat-transfer-coef",
103
+ _c.SKIN_FRICTION_COEFFICIENT: "skin-friction-coef",
104
+ _c.SURFACE_HEAT_FLUX: "heat-flux",
105
+ _c.SURFACE_HEAT_TRANSFER_COEFFICIENT: "heat-transfer-coef-wall",
106
+ _c.SURFACE_NUSSELT_NUMBER: "nusselt-number",
107
+ _c.SURFACE_STANTON_NUMBER: "stanton-number",
108
+ _c.WALL_ADJACENT_HEAT_TRANSFER_COEFFICIENT: "heat-transfer-coef-wall-adj",
109
+ _c.WALL_SHEAR_STRESS: "wall-shear",
110
+ _c.WALL_SHEAR_STRESS_X: "x-wall-shear",
111
+ _c.WALL_SHEAR_STRESS_Y: "y-wall-shear",
112
+ _c.WALL_SHEAR_STRESS_Z: "z-wall-shear",
113
+ # _c.WALL_SHEAR_STRESS_MAGNITUDE: "WallShearStressVector.mag",
114
+ _c.fluent.Y_PLUS_BASED_HEAT_TRANSFER_COEFFICIENT: "heat-transfer-coef-yplus",
115
+ # residuals
116
+ _c.fluent.MASS_IMBALANCE: "mass-imbalance",
117
+ # derivatives
118
+ _c.fluent.PRESSURE_HESSIAN_INDICATOR: "pressure-hessian-indicator",
119
+ _c.STRAIN_RATE: "strain-rate-mag",
120
+ # _c.fluent.DVELOCITY_DX: "dVelocitydx",
121
+ _c.fluent.DVELOCITY_DX_X: "dx-velocity-dx",
122
+ _c.fluent.DVELOCITY_DX_Y: "dy-velocity-dx",
123
+ _c.fluent.DVELOCITY_DX_Z: "dz-velocity-dx",
124
+ # _c.fluent.DVELOCITY_DX_MAGNITUDE: "dVelocitydx.mag",
125
+ # _c.fluent.DVELOCITY_DY: "dVelocitydy",
126
+ _c.fluent.DVELOCITY_DY_X: "dx-velocity-dy",
127
+ _c.fluent.DVELOCITY_DY_Y: "dy-velocity-dy",
128
+ _c.fluent.DVELOCITY_DY_Z: "dz-velocity-dy",
129
+ # _c.fluent.DVELOCITY_DY_MAGNITUDE: "dVelocitydy.mag",
130
+ # _c.fluent.DVELOCITY_DZ: "dVelocitydz",
131
+ _c.fluent.DVELOCITY_DZ_X: "dx-velocity-dz",
132
+ _c.fluent.DVELOCITY_DZ_Y: "dy-velocity-dz",
133
+ _c.fluent.DVELOCITY_DZ_Z: "dz-velocity-dz",
134
+ # _c.fluent.DVELOCITY_DZ_MAGNITUDE: "dVelocitydz.mag",
135
+ # temperature
136
+ _c.SPECIFIC_ENTHALPY: "enthalpy",
137
+ _c.SPECIFIC_ENTROPY: "entropy",
138
+ _c.SPECIFIC_INTERNAL_ENERGY: "internal-energy",
139
+ _c.SPECIFIC_TOTAL_ENERGY: "total-energy",
140
+ _c.TEMPERATURE: "temperature",
141
+ _c.SPECIFIC_TOTAL_ENTHALPY: "total-enthalpy",
142
+ _c.fluent.TOTAL_ENTHALPY_DEVIATION: "total-enthalpy-deviation",
143
+ _c.TOTAL_TEMPERATURE: "total-temperature",
144
+ _c.WALL_ADJACENT_TEMPERATURE: "wall-adjacent-temperature",
145
+ _c.WALL_TEMPERATURE: "wall-temperature",
146
+ _c.WALL_TEMPERATURE_THIN: "wall-temp-thin",
147
+ _c.fluent.Y_PLUS_BASED_HEAT_TRANSFER_COEFFICIENT: "reference-temperature-at-y+",
148
+ # mesh
149
+ _c.mesh.ANISOTROPIC_ADAPTION_CELLS: "anisotropic-adaption-cells",
150
+ _c.mesh.BOUNDARY_CELL_DISTANCE: "boundary-cell-dist",
151
+ _c.mesh.BOUNDARY_LAYER_CELLS: "boundary-layer-cells",
152
+ _c.mesh.BOUNDARY_NORMAL_DISTANCE: "boundary-normal-dist",
153
+ _c.mesh.BOUNDARY_VOLUME_DISTANCE: "boundary-volume-dist",
154
+ _c.mesh.CELL_EQUIANGLE_SKEW: "cell-equiangle-skew",
155
+ _c.mesh.CELL_EQUIVOLUME_SKEW: "cell-equivolume-skew",
156
+ _c.mesh.CELL_PARENT_INDEX: "cell-parent-index",
157
+ _c.mesh.CELL_REFINE_LEVEL: "cell-refine-level",
158
+ _c.mesh.CELL_VOLUME: "cell-volume",
159
+ _c.mesh.CELL_VOLUME_CHANGE: "cell-volume-change",
160
+ _c.mesh.ELEMENT_ASPECT_RATIO: "aspect-ratio",
161
+ _c.mesh.ELEMENT_WALL_DISTANCE: "cell-wall-distance",
162
+ _c.mesh.FACE_AREA_MAGNITUDE: "face-area-magnitude",
163
+ _c.mesh.FACE_HANDEDNESS: "face-handedness",
164
+ _c.mesh.INTERFACE_OVERLAP_FRACTION: "interface-overlap-fraction",
165
+ _c.mesh.MARK_POOR_ELEMENTS: "mark-poor-elements",
166
+ # _c.POSITION: "Position", ???
167
+ _c.POSITION_X: "x-coordinate",
168
+ _c.POSITION_Y: "y-coordinate",
169
+ _c.POSITION_Z: "z-coordinate",
170
+ # _c.POSITION_MAGNITUDE: "Position.mag", ???
171
+ _c.mesh.SMOOTHED_CELL_REFINE_LEVEL: "smoothed-cell-refine-level",
172
+ _c.mesh.X_FACE_AREA: "x-face-area",
173
+ _c.mesh.Y_FACE_AREA: "y-face-area",
174
+ _c.mesh.Z_FACE_AREA: "z-face-area",
175
+ _c.mesh.ACTIVE_CELL_PARTITION: "cell-partition-active",
176
+ _c.mesh.CELL_ELEMENT_TYPE: "cell-element-type",
177
+ _c.mesh.CELL_ID: "cell-id",
178
+ _c.mesh.CELL_WEIGHT: "cell-weight",
179
+ _c.mesh.CELL_ZONE_INDEX: "cell-zone",
180
+ _c.mesh.CELL_ZONE_TYPE: "cell-type",
181
+ _c.mesh.PARTITION_NEIGHBOURS: "partition-neighbors",
182
+ _c.mesh.STORED_CELL_PARTITIION: "cell-partition-stored",
183
+ }
184
+
185
+ else:
186
+ FluentFieldDataNamingStrategy = None