Result
#
- class ansys.dpf.core.results.Result(connector, mesh_by_default, result_info, server)#
Helps with using DPF’s result providers.
This class helps to connect common inputs to the operator and recover its fields container output. ‘Result’ is created by the model.
Examples
Create a displacement result from the model and choose its time and mesh scopings
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_msup_transient()) >>> disp = model.results.displacement.on_last_time_freq.on_named_selection('_CONSTRAINEDNODES') >>> last_time_disp = disp.eval()
Create a stress result from the model and split the result by element shapes (solid, shell, and beam).
>>> model = dpf.Model(examples.download_all_kinds_of_complexity()) >>> stress = model.results.stress >>> stress_split = stress.split_by_shape.eval() >>> solid_stress = stress_split.solid_field()
Create a strain result from the model on all time sets and recover the operator to connect it to other operators.
>>> model = dpf.Model(examples.find_msup_transient()) >>> strain = model.results.elastic_strain.on_all_time_freqs() >>> eqv = dpf.operators.invariant.von_mises_eqv_fc(strain) >>> strain_eqv = eqv.outputs.fields_container()
Overview#
Evaluate the result provider with the previously specified inputs and return the result fields container. |
|
Set the time scoping to a given one. |
|
Set the mesh scoping to a given named selection. |
|
Set the mesh scoping to a given mesh scoping. |
|
Set the requested location of the provider. |
Sets the time scoping to all the time frequencies of the time frequency support. |
|
Sets the time scoping to the first time frequency of the time frequency support. |
|
Sets the time scoping to the last time frequency available in the time frequency support. |
|
Set the mesh scoping to a scopings container where each scoping is a body. |
|
Set the mesh scoping to a scopings container where each scoping is an element shape. |
Provide for Result instances to be callable for operator retrieval. |
Import detail#
from ansys.dpf.core.results import Result
Property detail#
- property Result.on_all_time_freqs#
Sets the time scoping to all the time frequencies of the time frequency support.
- Returns:
self
- Return type:
Examples
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_msup_transient()) >>> disp = model.results.displacement >>> disp.on_all_time_freqs.eval().get_label_scoping("time").ids ...1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]...
- property Result.on_first_time_freq#
Sets the time scoping to the first time frequency of the time frequency support.
- Returns:
self
- Return type:
Examples
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_msup_transient()) >>> disp = model.results.displacement >>> disp.on_first_time_freq.eval().get_label_scoping("time").ids ...[1]...
- property Result.on_last_time_freq#
Sets the time scoping to the last time frequency available in the time frequency support.
- Returns:
self
- Return type:
Examples
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_msup_transient()) >>> disp = model.results.displacement >>> disp.on_last_time_freq.eval().get_label_scoping("time").ids ...[20]...
- property Result.split_by_body#
Set the mesh scoping to a scopings container where each scoping is a body.
- Returns:
self
- Return type:
Examples
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.download_all_kinds_of_complexity()) >>> disp = model.results.displacement >>> fc_disp = disp.split_by_body.eval() >>> len(fc_disp) 13 >>> fc_disp.get_mat_scoping().ids ...1, 5, 6, 10, 2, 7, 8, 13, 4, 12, 15, 16, 17]... >>> disp_mat_10 = fc_disp.get_field_by_mat_id(10)
- property Result.split_by_shape#
Set the mesh scoping to a scopings container where each scoping is an element shape.
The evaluated fields container will have one field on ‘solid’, one on ‘shell’, one on ‘beam’ and one on ‘unknown_shape’.
- Returns:
self
- Return type:
Examples
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.download_all_kinds_of_complexity()) >>> disp = model.results.displacement >>> fc_disp = disp.split_by_shape.eval() >>> len(fc_disp) 4
>>> shell_disp = fc_disp.shell_field() >>> solid_disp = fc_disp.solid_field()
Method detail#
- Result.__call__(time_scoping=None, mesh_scoping=None)#
Provide for Result instances to be callable for operator retrieval.
- Result.eval()#
Evaluate the result provider with the previously specified inputs and return the result fields container.
- Returns:
fields_container – If
split_by_body
is used, aBodyFieldsContainer
is returned. ifsplit_by_shape
is used, anElShapeFieldsContainer
is returned.- Return type:
FieldsContainer, ElShapeFieldsContainer, BodyFieldsContainer
Examples
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_msup_transient()) >>> disp = model.results.displacement >>> fc = disp.on_all_time_freqs.eval()
- Result.on_time_scoping(time_scoping)#
Set the time scoping to a given one.
- Parameters:
time_scoping (float, list[float], int, list[int], Scoping) – One or more times or frequencies.
- Returns:
self
- Return type:
Examples
Choose time sets.
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_msup_transient()) >>> stress = model.results.stress >>> fc = stress.on_time_scoping([1,2,3,19]).eval() >>> len(fc) 4
Choose times. If the times chosen are not in the time frequency support, results are extrapolated.
>>> fc = stress.on_time_scoping([0.115,0.125]).eval() >>> len(fc) 2 >>> fc.time_freq_support.time_frequencies.data DPFArray([0.115, 0.125]...
- Result.on_named_selection(named_selection)#
Set the mesh scoping to a given named selection.
- Parameters:
named_selection (str) – Name of the named selection or component in upper case.
- Returns:
self
- Return type:
Examples
Add a requested location to the average result on the nodes.
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_msup_transient()) >>> stress = model.results.stress >>> fc = stress.on_first_time_freq.on_named_selection('_CONSTRAINEDNODES').eval() >>> len(fc[0].scoping) 40
- Result.on_mesh_scoping(mesh_scoping)#
Set the mesh scoping to a given mesh scoping.
Examples
Use a list of nodes.
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_complex_rst()) >>> disp = model.results.displacement >>> fc = disp.on_mesh_scoping([1,2,3]).eval() >>> len(fc[0].scoping) 3
Use a scoping to specify a list of entity IDs with their locations.
>>> stress = model.results.stress >>> scop = dpf.Scoping(ids=[3,4,5], location= dpf.locations.nodal) >>> fc = stress.on_mesh_scoping(scop).eval() >>> len(fc[0].scoping) 3 >>> fc[0].location 'Nodal'
- Result.on_location(location)#
Set the requested location of the provider.
Elemental nodal fields can be averaged to a nodal or elemental location.
- Parameters:
location (str, locations)
- Returns:
self
- Return type:
Examples
Add a requested location to the average result on the nodes.
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_complex_rst()) >>> stress = model.results.stress >>> fc = stress.eval() >>> fc[0].location 'ElementalNodal'
>>> fc = stress.on_location(dpf.locations.nodal).eval() >>> fc[0].location 'Nodal'