ANSYS DPF-Post: Transient Anaysis

This tutorial shows how post-process a transient analysis result file using API of the POST module.

Get started

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

Get the solution object

The following file is the result of a transient analysis computed using Ansys Mechanical.

here we load the solution

solution = post.load_solution(examples.msup_transient)
print(solution)

Out:

Transient Analysis Solution object.


Data Sources
------------------------------
DPF  DataSources:
  Result files:
     result key: rst and path: /opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/ansys/dpf/core/examples/msup_transient_plate1.rst
  Secondary files:


DPF Model
------------------------------
Transient analysis
Unit system: Metric (m, kg, N, s, V, A)
Physics Type: Mecanic
Available results:
     -  displacement: Nodal Displacement
     -  velocity: Nodal Velocity
     -  acceleration: Nodal Acceleration
     -  reaction_force: Nodal Force
     -  stress: ElementalNodal Stress
     -  elemental_volume: Elemental Volume
     -  stiffness_matrix_energy: Elemental Energy-stiffness matrix
     -  artificial_hourglass_energy: Elemental Hourglass Energy
     -  thermal_dissipation_energy: Elemental thermal dissipation energy
     -  kinetic_energy: Elemental Kinetic Energy
     -  co_energy: Elemental co-energy
     -  incremental_energy: Elemental incremental energy
     -  elastic_strain: ElementalNodal Strain
------------------------------
DPF  Meshed Region:
  393 nodes
  40 elements
  Unit: m
  With solid (3D) elements
------------------------------
DPF  Time/Freq Support:
  Number of sets: 20
Cumulative     Time (s)       LoadStep       Substep
1              0.010000       1              1
2              0.020000       1              2
3              0.030000       1              3
4              0.040000       1              4
5              0.050000       1              5
6              0.060000       1              6
7              0.070000       1              7
8              0.080000       1              8
9              0.090000       1              9
10             0.100000       1              10
11             0.110000       1              11
12             0.120000       1              12
13             0.130000       1              13
14             0.140000       1              14
15             0.150000       1              15
16             0.160000       1              16
17             0.170000       1              17
18             0.180000       1              18
19             0.190000       1              19
20             0.200000       1              20

Get result objects

Get a displacement result and compute data

Get the result

disp_result = solution.displacement()
disp = disp_result.vector

Check the number of fields

disp.num_fields

Out:

1

Get data from a field

disp.get_data_at_field(0)

Out:

array([[ 5.61632273e-13,  3.10611157e-03,  5.94938168e-05],
       [-1.05541516e-06,  3.10082257e-03,  5.95757695e-05],
       [-8.84684396e-07,  3.71348576e-03,  6.27895677e-05],
       ...,
       [ 6.28518184e-13,  4.03518595e-03, -6.41156710e-05],
       [ 8.04525074e-07,  4.03115424e-03,  6.41884022e-05],
       [-8.04523717e-07,  4.03115424e-03, -6.41884020e-05]])

Get maximum data value over all fields

disp.max_data

Out:

array([[2.45659911e-06, 1.07453069e-02, 7.28477714e-05]])

Get minimum data value over all fields

disp.min_data

Out:

array([[-2.45659907e-06,  0.00000000e+00, -7.28477714e-05]])

Get maximum data value over a targeted field

disp.get_max_data_at_field(0)

Out:

array([2.45659911e-06, 1.07453069e-02, 7.28477714e-05])

Get minimum data value over all fields

disp.get_min_data_at_field(0)

Out:

array([-2.45659907e-06,  0.00000000e+00, -7.28477714e-05])

Get a stress result and plot a contour

Get the result

stress_result = solution.stress()
stress = stress_result.tensor
# shell and solid elements are in distinct fields.
stress.num_fields

Out:

1

Get the shell field

shell_field = stress[0]
shell_field.shell_layers

Out:

<shell_layers.nonelayer: 5>

Get the solid field field

solid_field = stress[0]

Plot the contour

stress.plot_contour()
04 transient analysis

Get an elastic_strain result and plot a chart

Get the result

elastic_strain_result = solution.elastic_strain()
elastic_strain = elastic_strain_result.tensor
# shell and solid elements are in distinct fields.
elastic_strain.num_fields

Out:

1

It is also possible to deal with plastic_strain and temperature this way. The result file must contain those results.

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

Gallery generated by Sphinx-Gallery