Skip to content

Commit cfae519

Browse files
build: Bump version to v0.34.1 (#4346)
Bump version to v0.34.1 --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 7de106f commit cfae519

File tree

5 files changed

+59
-12
lines changed

5 files changed

+59
-12
lines changed

doc/changelog.d/4345.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Unavailable field data for some surfaces.

doc/styles/config/vocabularies/ANSYS/accept.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,5 @@ create_workflow
8484
load_workflow
8585
codegen
8686
discoverability
87-
NGons
87+
NGons
88+
_user_guide_variables

src/ansys/fluent/core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
from ansys.fluent.core.utils.fluent_version import FluentVersion # noqa: F401
7878
from ansys.fluent.core.utils.setup_for_fluent import setup_for_fluent # noqa: F401
7979

80-
__version__ = "0.34.0"
80+
__version__ = "0.34.1"
8181

8282
_VERSION_INFO = None
8383
"""

src/ansys/fluent/core/file_session.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,20 @@ def get_field_data(
186186
| PathlinesFieldDataRequest
187187
),
188188
) -> Dict[int | str, Dict | np.array]:
189-
"""Get the surface, scalar, vector or path-lines field data on a surface."""
189+
"""Get the surface, scalar, vector or path-lines field data on a surface.
190+
191+
Returns
192+
-------
193+
Dict[int | str, Dict | np.array]
194+
Field data for the requested surface. If field data is unavailable for the surface,
195+
an empty array is returned and a warning is issued. Users should always check
196+
the array size before using the data.
197+
198+
Example:
199+
data = get_field_data(field_data_request)[surface_id]
200+
if data.size == 0:
201+
# Handle missing data
202+
"""
190203
if isinstance(obj, SurfaceFieldDataRequest):
191204
return self._get_surface_data(**obj._asdict())
192205
elif isinstance(obj, ScalarFieldDataRequest):
@@ -973,7 +986,20 @@ def get_field_data(
973986
| PathlinesFieldDataRequest
974987
),
975988
) -> Dict[int | str, Dict | np.array]:
976-
"""Get the surface, scalar, vector or path-lines field data on a surface."""
989+
"""Get the surface, scalar, vector or path-lines field data on a surface.
990+
991+
Returns
992+
-------
993+
Dict[int | str, Dict | np.array]
994+
Field data for the requested surface. If field data is unavailable for the surface,
995+
an empty array is returned and a warning is issued. Users should always check
996+
the array size before using the data.
997+
998+
Example:
999+
data = get_field_data(field_data_request)[surface_id]
1000+
if data.size == 0:
1001+
# Handle missing data
1002+
"""
9771003
if isinstance(obj, SurfaceFieldDataRequest):
9781004
return self._get_surface_data(**obj._asdict())
9791005
elif isinstance(obj, ScalarFieldDataRequest):

src/ansys/fluent/core/services/field_data.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,20 @@ def get_field_data(
577577
| PathlinesFieldDataRequest
578578
),
579579
) -> Dict[int | str, Dict | np.array]:
580-
"""Get the surface, scalar, vector or path-lines field data on a surface."""
580+
"""Get the surface, scalar, vector or path-lines field data on a surface.
581+
582+
Returns
583+
-------
584+
Dict[int | str, Dict | np.array]
585+
Field data for the requested surface. If field data is unavailable for the surface,
586+
an empty array is returned and a warning is issued. Users should always check
587+
the array size before using the data.
588+
589+
Example:
590+
data = get_field_data(field_data_request)[surface_id]
591+
if data.size == 0:
592+
# Handle missing data
593+
"""
581594
if isinstance(obj, SurfaceFieldDataRequest):
582595
return self._get_surface_data(**obj._asdict())
583596
elif isinstance(obj, ScalarFieldDataRequest):
@@ -1185,13 +1198,19 @@ def _extract_field(field_datatype, field_size, chunk_iterator):
11851198
payload_tag_id = None
11861199
field = None
11871200
if payload_tag_id is not None:
1188-
field = _extract_field(
1189-
_FieldDataConstants.proto_field_type_to_np_data_type[
1190-
payload_info.fieldType
1191-
],
1192-
payload_info.fieldSize,
1193-
chunk_iterator,
1194-
)
1201+
if payload_info.fieldSize > 0:
1202+
field = _extract_field(
1203+
_FieldDataConstants.proto_field_type_to_np_data_type[
1204+
payload_info.fieldType
1205+
],
1206+
payload_info.fieldSize,
1207+
chunk_iterator,
1208+
)
1209+
else:
1210+
warnings.warn(
1211+
f"Field data is not available for surface: {surface_id}"
1212+
)
1213+
field = np.array([])
11951214

11961215
if self._callbacks_provider is not None:
11971216
for callback_data in self._callbacks_provider.callbacks():

0 commit comments

Comments
 (0)