Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/4478.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update Field data queries [skip tests]
45 changes: 33 additions & 12 deletions doc/source/user_guide/fields/field_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,17 @@ Retrieve data using ``get_field_data``, either by reusing or modifying request o
.. note::
``PathlinesFieldDataRequest`` allows only one unique ``field_name`` per batch.

Allowed values
--------------
Additionally there is an ``allowed_values`` method provided on all of
``field_name``, ``surface_name`` and ``surface_ids`` which tells you what object
names are accessible.
Queries
-------

Several query methods are available for exploring data, checking status,
and retrieving information.

Some sample use cases are demonstrated below:

Allowed values
~~~~~~~~~~~~~~
The ``allowed_values()`` method is provided on ``fields``, ``surface_name``,
and ``surface_ids``. It returns the set of accessible object names or IDs.

.. code-block:: python

Expand All @@ -249,21 +253,38 @@ Some sample use cases are demonstrated below:
>>> field_data.vector_fields.allowed_values()
['velocity', 'relative-velocity']

>>> field_data.surfaces.allowed_values()
['in1', 'in2', 'in3', 'inlet', 'inlet1', 'inlet2', 'out1', 'outlet', 'solid_up:1', 'solid_up:1:830', 'solid_up:1:830-shadow']

>>> field_data.surface_ids.allowed_values()
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]


Active status
~~~~~~~~~~~~~

The ``is_active()`` method checks whether a particular variable is available.

.. code-block:: python

>>> from ansys.units import VariableCatalog
>>> field_data.vector_fields.is_active(VariableCatalog.VELOCITY)
True
>>> field_data.vector_fields.is_active(VariableCatalog.VELOCITY_MAGNITUDE)
False
>>> field_data.scalar_fields.is_active(VariableCatalog.VELOCITY_MAGNITUDE)
True
>>> field_data.scalar_fields.range("cell-weight")
[8.0, 24.0]

>>> field_data.surfaces.allowed_values()
['in1', 'in2', 'in3', 'inlet', 'inlet1', 'inlet2', 'out1', 'outlet', 'solid_up:1', 'solid_up:1:830', 'solid_up:1:830-shadow']

>>> field_data.surface_ids.allowed_values()
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Value ranges
~~~~~~~~~~~~

The ``range()`` method returns the numeric range of values for a given variable.

.. code-block:: python

>>> field_data.scalar_fields.range("cell-weight")
[8.0, 24.0]


Field data streaming
Expand Down
Loading