ANSYS DPF Basic Features of the POST APIΒΆ

This tutorial shows how to get a result object from ansys.dpf.post and its basic usage.

Get started

from ansys.dpf import post
from ansys.dpf.post import examples

Get the solution object: must be instantiated with the result filepath

example_path = examples.download_all_kinds_of_complexity()
solution = post.load_solution(example_path)

Get a displacement result from the result object First will be created a displacement result.

displacement_result = solution.displacement()
displacement = displacement_result.vector

Use the displacement result

displacement.num_fields
disp_data = displacement.get_data_at_field(0)
len(disp_data)

disp_data[1]

displacement.max_data
displacement.get_max_data_at_field(0)

displacement.min_data

Out:

array([[-1.82645944e-06, -1.04473039e+01, -2.94677257e-04]])

Get a stress result from the result object (nodal or elemental location)

el_stress_result = solution.stress(location=post.locations.elemental)
nod_stress_result = solution.stress(location=post.locations.nodal)  # note: the default location is nodal

el_stress = el_stress_result.tensor
nod_stress = nod_stress_result.tensor

el_field = el_stress[0]
el_field.location

nod_field = nod_stress[0]
nod_field.location

el_stress.get_max_data_at_field(0)

Out:

array([1.67799854e+10, 3.74234853e-08, 3.21780912e+09, 4.87186215e+07,
       7.36908062e+07, 1.88455508e+09])

Total running time of the script: ( 0 minutes 0.570 seconds)

Gallery generated by Sphinx-Gallery