Module containing the ResultData class.

This module, which is used heavily in DPF-Post, is a fields container wrapper.

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, path=None, time_scoping=None)#

Provides the result data for a DPF Result object.

This class is created using the ansys.dpf.core.Result class.

Parameters:
operator_namestr
data_sources
model
elem_averagebool
locationstr, optional

The default is None.

element_scopingoptional

The default is None.

node_scopingoptional

The default is None.

named_selectionoptional

The default is None.

timeoptional

The default is None.

groupingoptional

The default is None.

phaseoptional

The default is None.

subresultoptional

The default is None.

mapdl_groupingoptional

The default is None.

setoptional

The default is None.

pathoptional

The default is None.

time_scopingoptional

The default is None.

To see all parameters, you can use the ``post.print_available_keywords()``
method.

Examples

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> solution = post.load_solution(examples.download_all_kinds_of_complexity())
>>> disp = solution.displacement()
>>> disp_on_nodes = solution.displacement(node_scoping = [1, 23])
>>> disp_on_named_selection = solution.displacement(named_selection="SELECTION")
get_all_label_spaces()#

Get all label spaces contained in a result.

You can use labels to select the fields to plot.

Returns:
list

List of dictionary (list of label spaces).

get_data_at_field(field_index: int = 0)#

Get the data for the field with the specified index.

Parameters:
field_indexint, optional

Field index. The default is 0.

get_max_data_at_field(field_index: int = 0)#

Get the maximum values field data for the field with the specified index.

Chains the result operator to the min_max_fc operator and returns the result (output from pin 1).

Parameters:
field_indexint, optional

Field index. The default is 0.

get_min_data_at_field(field_index: int = 0)#

Get the minimum values field data for the field with the specified index.

Chains the result operator to the min_max_fc operator and returns the result (output from pin 0).

Parameters:
field_indexint, optional

Field index. The default is 0.

get_scoping_at_field(field_index: int = 0)#

Get the scoping of the result for the field with the specified index.

Parameters:
field_indexint, optional

Field index. The default is 0.

property max#

Maximum value field.

Chains the result operator to the min_max_fc operator and returns the result (output from pin 1).

property max_data#

Maximum value field data.

Chains the result operator to the min_max_fc operator and returns the result (output from pin 1).

property min#

Minimum values field.

Chains the result operator to the min_max_fc operator and returns the result (output from pin 0).

property min_data#

Minimum values field data.

Chains the result operator to the min_max_fc operator and returns the result (output from pin 0).

property num_fields#

Number of fields contained in the result.

plot_contour(display_option: str = 'time', option_id=1, **kwargs)#

Plot the contour result on its mesh support.

The obtained figure depends on the support, which can be a meshed region or a time frequency support. For a transient analysis, this method plots the last result if no time scoping is specified. To return a string containing all label spaces, use the self.get_all_label_spaces() method.

Parameters:
display_optionstr, optional

Name of the label to display. The default is "time".

option_id: int, optional

Label ID to display. The default is 1.

**kwargsoptional

Additional keyword arguments for the plotter. For keyword arguments, see help(pyvista.plot).

Examples

Plot a result at time step number 1.

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> solution = post.load_solution(examples.download_all_kinds_of_complexity())
>>> stress = solution.stress(location=post.locations.nodal)
>>> sx = stress.xx
>>> pl = sx.plot_contour("time", [1], off_screen=True)  

Obtain labels.

>>> sx.get_all_label_spaces() 
[{'...': ..., '...': ...}, {'...': ..., '...': ...}]
property result_fields_container#

Result fields container.