ANSYS DPF Introduction to POST API

This tutorial shows the first step to load the post module and to access some basic help.

Get started

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

Load a solution: this must be instantiated with the result filepath. Load a simple example file included with DPF-Post

simple_bar = examples.simple_bar
solution = post.load_solution(simple_bar)

Use the helpers

Solution information

print(solution)

Out:

Static 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/ASimpleBar.rst
  Secondary files:


DPF Model
------------------------------
Static analysis
Unit system: Metric (m, kg, N, s, V, A)
Physics Type: Mecanic
Available results:
     -  displacement: Nodal Displacement
     -  element_nodal_forces: ElementalNodal Element nodal Forces
     -  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
     -  structural_temperature: ElementalNodal Temperature
------------------------------
DPF  Meshed Region:
  3751 nodes
  3000 elements
  Unit: m
  With solid (3D) elements
------------------------------
DPF  Time/Freq Support:
  Number of sets: 1
Cumulative     Time (s)       LoadStep       Substep
1              1.000000       1              1

Locations information: the locations are used to defined where the result must be set.

help(post.locations)

Out:

Help on class locations in module ansys.dpf.core.common:

class locations(builtins.object)
 |  Contains strings for scoping and field locations.
 |
 |  Attributes
 |  -----------
 |  none = "none"
 |
 |  elemental = "Elemental"
 |      data is one per element
 |
 |  elemental_nodal = "ElementalNodal"
 |      one per node per element
 |
 |  nodal = "Nodal"
 |      one per node
 |
 |  time_freq = "TimeFreq_sets"
 |      one per time set
 |
 |  overall = "overall"
 |      applies everywhere
 |
 |  time_freq_step = "TimeFreq_steps"
 |      one per time step
 |
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables (if defined)
 |
 |  __weakref__
 |      list of weak references to the object (if defined)
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  elemental = 'Elemental'
 |
 |  elemental_nodal = 'ElementalNodal'
 |
 |  nodal = 'Nodal'
 |
 |  none = 'none'
 |
 |  overall = 'overall'
 |
 |  time_freq = 'TimeFreq_sets'
 |
 |  time_freq_step = 'TimeFreq_steps'

Get the available keywords that can be used as attribute of a result object.

post.print_available_keywords()

Out:

element_scoping: list, int or dpf.core.Scoping
grouping: str. Use post.grouping.(...) as helper.
location: str. Use post.locations.(...) as helper.
mapdl_grouping: int. Write 186 to get mapdl_elements solid_186.
named_selection: str. Name of named_selection.
node_scoping: list, int or dpf.core.Scoping
set: int
time: float
time_scoping: list, int or dpf.core.Scoping

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

Gallery generated by Sphinx-Gallery