ResultData object

The ResultData object is obtained from a Result. It provides access to the result values contained within, as shown in the following example:

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> solution = post.load_solution(examples.multishells_rst)
>>> displacement = solution.displacement()
>>> result = displacement.vector
>>> # access the data
>>> vector.get_data_at_field(0)
class ansys.dpf.post.result_data.ResultData(operator_name: str, data_sources, model, elem_average: bool, location: Optional[str] = None, element_scoping=None, node_scoping=None, named_selection=None, time=None, grouping=None, phase=None, subresult=None, mapdl_grouping=None, set=None, time_scoping=None)

Instance of the result of a dpf result object. Created thanks to the dpf result object.

Parameters
  • keywords (Following list of) –

    • location

    • node_scoping

    • element_scoping

    • time

    • grouping

  • using (The entire list of parameters can be found) – post.print_available_keywords().

Examples

>>> from ansys.dpf import post
>>> solution = post.solution("file.rst")
>>> disp = solution.nodal_displacement()
>>> disp_on_nodes = solution.nodal_displacement(node_scoping = [1, 23])
>>> disp_on_named_selection = solution.nodal_displacement(named_selection="SELECTION")
get_all_label_spaces()

Returns all the label spaces contained in a result as a string. Labels can be used to select fields to plot.

Returns

List of dictionary (list of label space)

Return type

list

get_data_at_field(field_index: int = 0)

Returns the data at the field with the specified index.

get_max_data_at_field(field_index: int = 0)

Returns the maximum values field data at field_index. Chains the result operator to the “min_max_fc” operator, returns its result (output from pin 1).

get_min_data_at_field(field_index: int = 0)

Returns the minimum values field data at field_index. Chains the result operator to the “min_max_fc” operator, returns its result (output from pin 0).

get_scoping_at_field(field_index: int = 0)

Returns the scoping of the result.

property max

Returns the maximum values field. Chains the result operator to the “min_max_fc” operator, returns its result (output from pin 1).

property max_data

Returns the maximum values field data. Chains the result operator to the “min_max_fc” operator, returns its result (output from pin 1).

property min

Returns the minimum values field. Chains the result operator to the “min_max_fc” operator, returns its result (output from pin 0).

property min_data

Returns the minimum values field data. Chains the result operator to the “min_max_fc” operator, returns its result (output from pin 0).

property num_fields

Returns the number of fields contained in the result.

plot_contour(display_option: str = 'time', option_id=1, off_screen=None, notebook=None, **kwargs)

Plot the contour result on its mesh support.

The obtained figure depends on the support (can be a meshed_region or a time_freq_support). If transient analysis, plot the last result if no time_scoping has been specified. The self.get_all_label_spaces() will return a string containing all the label spaces.

Parameters
  • display_option (str, optional) – The name of the label you want to display. Default is "time".

  • option_id (int, optional) – The list of label ids you want to display. Default is [1].

  • off_screen (bool, optional) – Renders off screen when True. Useful for automated screenshots.

  • notebook (bool, optional) – Option to force plotting within a jupyter notebook or external to the notebook as an interactive figure.

  • **kwargs (optional) – Additional keyword arguments for the plotter. See help(pyvista.plot) for additional keyword arguments.

Examples

Plot a result at the time_step number 1

>>> from ansys.dpf import post
>>> solution = post.load_solution('file.rst')
>>> stress = solution.stress(location=post.locations.nodal)
>>> sx = stress.xx
>>> sx.plot_contour("time", [1])

The labels can be obtained using:

>>> sx.get_all_label_spaces()

[{‘elshape’: 1, ‘time’: 1}, {‘elshape’: 0, ‘time’: 1}]