Note
Go to the end to download the full example code.
Introduction#
This example shows how to load a solution and access some basic help.
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 simple file supplied with
PyDPF-Post.
simple_bar = examples.simple_bar
solution = post.load_solution(simple_bar)
Use helpers#
Get solution information#
Get solution information.
print(solution)
Static Analysis Solution object.
Data Sources
------------------------------
DPF DataSources:
Result files:
result key: rst and path: /opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/ansys/dpf/core/examples/result_files/ASimpleBar.rst
Secondary files:
DPF Model
------------------------------
Static analysis
Unit system: MKS: m, kg, N, s, V, A, degC
Physics Type: Mechanical
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
- element_euler_angles: ElementalNodal Element Euler Angles
- structural_temperature: ElementalNodal Structural 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
Get locations information#
Get location information. Locations are used to defined where the result must be set.
help(post.locations)
Help on class locations in module ansys.dpf.gate.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
|
| faces = "Faces"
| one per face
|
| zone = "zone"
| one per zone
|
| elemental_and_faces = "ElementalAndFaces"
| data available in elements and faces of the model
|
| 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_and_faces = 'ElementalAndFaces'
|
| elemental_nodal = 'ElementalNodal'
|
| faces = 'Faces'
|
| nodal = 'Nodal'
|
| none = 'none'
|
| overall = 'overall'
|
| time_freq = 'TimeFreq_sets'
|
| time_freq_step = 'TimeFreq_steps'
|
| zone = 'zone'
Get available keywords#
Get the available keywords. Keywords can be used as attributes of a
Result
object.
post.print_available_keywords()
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
path: DpfPath object that
contains a list of coordinates,
e.g. [[0.1, 0.0, 0.0],
[0.0, 0.1, 0.0]].
set: int
time: float
time_scoping: list, int or dpf.core.Scoping
Total running time of the script: (0 minutes 0.118 seconds)