Results#

This module contains the Results and Result classes that are created by the model to easily access results in result files.

class ansys.dpf.core.results.Results(connector, result_info, mesh_by_default=True, server=None, generate_ops=True)#

Organizes the results from DPF into accessible methods.

All the available results are dynamically created base on the model’s class:’ResultInfo’ class.

displacement#

Result provider helper wrapping the regular displacement operator. With this wrapper, time and mesh scopings can easily be customized.

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()
Type:

Result

stress#

Result provider helper wrapping the regular stress operator. With this wrapper, time and mesh scopings, location, and more can easily be customized.

Examples

Create a stress 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())
>>> stress = model.results.stress.on_last_time_freq.on_named_selection('_CONSTRAINEDNODES')
>>> last_time_stress = stress.eval()
Type:

Result

.... all other results

Result provider helper wrapping all types of providers available for a given result file.

Examples

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.find_electric_therm())
>>> v = model.results.electric_potential
>>> dissip = model.results.thermal_dissipation_energy
Type:

Result

Examples

Extract the result object from a model.

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.find_simple_bar())
>>> results = model.results # printable object

Access the displacement at all times.

>>> from ansys.dpf.core import Model
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = Model(transient)
>>> displacements = model.results.displacement.on_all_time_freqs.eval()
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()
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, a BodyFieldsContainer is returned. if split_by_shape is used, an ElShapeFieldsContainer 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()
property on_all_time_freqs#

Sets the time scoping to all the time frequencies of the time frequency support.

Returns:

self

Return type:

Result

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 on_first_time_freq#

Sets the time scoping to the first time frequency of the time frequency support.

Returns:

self

Return type:

Result

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 on_last_time_freq#

Sets the time scoping to the last time frequency available in the time frequency support.

Returns:

self

Return type:

Result

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]...
on_time_scoping(time_scoping)#

Sets 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:

Result

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]...
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:

Result

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
property split_by_body#

Set the mesh scoping to a scopings container where each scoping is a body.

Returns:

self

Return type:

Result

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 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:

Result

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()
on_mesh_scoping(mesh_scoping)#

Set the mesh scoping to a given mesh scoping.

Parameters:

mesh_scoping (Scoping, list[int]) –

Returns:

self

Return type:

Result

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'
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:

Result

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'
class ansys.dpf.core.results.CommonResults(connector, mesh_by_default, result_info, server)#

Default implementation of the class:’Results’. Is created by default by the ‘Model’ with the method:’results’. Create default result instances for common result types.

Notes

Used to allow type hints and auto completion for the method:’results’ of the class:’Results’.

property displacement#

Result provider helper wrapping the regular displacement operator. With this wrapper, time and mesh scopings can easily be customized.

Return type:

Result

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
>>> disp = disp.on_last_time_freq.on_named_selection("_CONSTRAINEDNODES")
>>> last_time_disp = disp.eval()
property elastic_strain#

Result provider helper wrapping the regular elastic strain operator. With this wrapper, time and mesh scopings can easily be customized.

Return type:

Result

Examples

Create an elastic strain 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())
>>> strain = model.results.elastic_strain
>>> strain = strain.on_last_time_freq.on_named_selection("_CONSTRAINEDNODES")
>>> last_time_disp = strain.eval()
property stress#

Result provider helper wrapping the regular stress operator. With this wrapper, time and mesh scopings can easily be customized.

Return type:

Result

Examples

Create a stress 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())
>>> stress = model.results.stress
>>> stress = stress.on_last_time_freq.on_named_selection("_CONSTRAINEDNODES")
>>> last_time_disp = stress.eval()
property structural_temperature#

Result provider helper wrapping the regular structural_temperature operator. With this wrapper, time and mesh scopings can easily be customized.

Return type:

Result

Examples

Create a structural_temperature 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_complex_rst())
>>> structural_temperature = model.results.structural_temperature
>>> structural_temperature = structural_temperature.on_last_time_freq()
>>> last_time_disp = structural_temperature.eval()
property temperature#

Result provider helper wrapping the regular temperature operator. With this wrapper, time and mesh scopings can easily be customized.

Return type:

Result

Examples

Create a temperature 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_steady_therm())
>>> temperature = model.results.temperature.on_last_time_freq()
>>> last_time_disp = temperature.eval()
property electric_potential#

Result provider helper wrapping the regular electric_potential operator. With this wrapper, time and mesh scopings can easily be customized.

Return type:

Result

Examples

Create a electric_potential 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_electric_therm())
>>> electric_potential = model.results.electric_potential.on_first_time_freq()
>>> last_time_disp = electric_potential.eval()