Transient analysis#

This example shows how you can postprocess a result file for a transient analysis using DPF-Post.

Perform required imports#

Perform required imports.

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

Get Solution object#

Get the Solution object. This example loads a result file for a transient analysis computed in Ansys Mechanical.

solution = post.load_solution(examples.msup_transient)
print(solution)
Transient Analysis Solution object.


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


DPF Model
------------------------------
Transient analysis
Unit system: MKS: m, kg, N, s, V, A, degC
Physics Type: Mechanical
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 displacement result#

Get the displacement Result object.

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

Check number of fields#

Check the number of fields.

disp.num_fields
1

Get data from field#

Get data from a field.

disp.get_data_at_field(0)
DPFArray([[ 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#

Get the maximum data value over all fields.

disp.max_data
DPFArray([[4.67558731e-310, 1.07453069e-002, 7.28477714e-005]])

Get minimum data value over all fields#

Get the minimum data value over all fields.

disp.min_data
DPFArray([[ 4.67558725e-310,  0.00000000e+000, -7.28477714e-005]])

Get maximum data value over targeted field#

Get the maximum data value over a targeted field.

disp.get_max_data_at_field(0)
DPFArray([4.67558729e-310, 1.07453069e-002, 7.28477714e-005])

Get minimum data value over all fields#

Get the minimum data value over all fields.

disp.get_min_data_at_field(0)
DPFArray([ 4.67558692e-310,  0.00000000e+000, -7.28477714e-005])

Get stress result#

Get the stress Result object for a tensor.

stress_result = solution.stress()
stress = stress_result.tensor

Check number of fields#

Check the number of shell and solid elements in distinct fields.

stress.num_fields
1

Get shell field#

Get the shell field.

shell_field = stress[0]
shell_field.shell_layers
<shell_layers.nonelayer: 5>

Get solid field#

Get the solid field.

solid_field = stress[0]

Plot contour#

Plot the contour.

stress.plot_contour()
04 transient analysis

Get elastic strain result#

Get an elastic strain 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
1

If the result file contains results, you can use this method to get the elastic strain result.

print(solution.elastic_strain())
Tensor object.

Object properties:
 - location   : Nodal

Elastic strain object.

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

Gallery generated by Sphinx-Gallery