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 solution object.


Data Sources
------------------------------
DPF  DataSources:
  Result files:
     result key: rst and path: c:\hostedtoolcache\windows\python\3.8.10\x64\lib\site-packages\ansys\dpf\core\examples\ASimpleBar.rst
  Secondary files:


DPF Model
------------------------------
DPF Result Info
  Analysis: static
  Physics Type: mecanic
  Unit system: MKS: m, kg, N, s, V, A, degC
  Available results:
    U Displacement :nodal displacements
    ENF Element nodal Forces :element nodal forces
    ENG_VOL Volume :element volume
    ENG_SE Energy-stiffness matrix :element energy associated with the stiffness matrix
    ENG_AHO Hourglass Energy :artificial hourglass energy
    ENG_TH thermal dissipation energy :thermal dissipation energy
    ENG_KE Kinetic Energy :kinetic energy
    ENG_CO co-energy :co-energy (magnetics)
    ENG_INC incremental energy :incremental energy (magnetics)
    BFE Temperature :element structural nodal temperatures
------------------------------
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 locations str 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.246 seconds)

Gallery generated by Sphinx-Gallery