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: str | None = 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_name (str)
data_sources
model
elem_average (bool)
location (str, optional) – The default is
None
.element_scoping (optional) – The default is
None
.node_scoping (optional) – The default is
None
.named_selection (optional) – The default is
None
.time (optional) – The default is
None
.grouping (optional) – The default is
None
.phase (optional) – The default is
None
.subresult (optional) – The default is
None
.mapdl_grouping (optional) – The default is
None
.set (optional) – The default is
None
.path (optional) – The default is
None
.time_scoping (optional) – The default is
None
.parameters (To see all)
post.print_available_keywords() (you can use the)
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 of dictionary (list of label spaces).
- Return type:
- property num_fields#
Number of fields contained in the result.
- get_data_at_field(field_index: int = 0)#
Get the data for the field with the specified index.
- Parameters:
field_index (int, 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_index (int, 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).
- 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_index (int, optional) – Field index. The default is
0
.
- 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).
- 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_index (int, optional) – Field index. The default is
0
.
- property result_fields_container#
Result fields container.
- plot_contour(display_option: str = 'time', option_id: int = 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:
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() [{'...': ..., '...': ...}, {'...': ..., '...': ...}]