# Principal stress directions

**URL:** <https://forum.itascainternational.com/t/principal-stress-directions/1916>\
**Category:** FLAC3D\
**Tags:** tips\
**Created:** [January 27, 2025, 3:12pm UTC](https://forum.itascainternational.com/t/principal-stress-directions/1916 "2025-01-27T15:12:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhazzard](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@jhazzard](https://forum.itascainternational.com/u/jhazzard)\
**Post date:** [January 27, 2025, 3:12pm UTC](https://forum.itascainternational.com/t/principal-stress-directions/1916/1 "2025-01-27T15:12:36Z")

</div>

In FLAC3D 5, there was a function z\_pstress that returned principal stress magnitudes and directions. In FLAC3D 6 and above, this function no longer exists. Instead you can get the full stress tensor and do tensor operations to get what you need. Simple example below:

```
model new
zone create brick
zone cmodel assign el
zone prop dens 2500 bulk 1e9 shear 0.6e9
zone face apply vel 0 0 0 range pos-z 0
model grav 10
model large-strain off
model solve

fish def get_stress_dir
  zp = zone.near(5,5,5)

  ; get stress as a tensor
  stress_tensor = zone.stress(zp)

  ; return a list of 4 vectors (magnitudes and 3 directions)
  principal_stresses = tensor.prin.dir(stress_tensor)

  mag = principal_stresses(1) ; vector

  io.out('min stress (most compressive): '+string(mag(1)))
  io.out('intermediate stress: '+string(mag(2)))
  io.out('max stress (least compressive): '+string(mag(3)))

  io.out('min stress direction: '+string(principal_stresses(2)))
  io.out('intermediate stress direction: '+string(principal_stresses(3)))
  io.out('max stress direction: '+string(principal_stresses(4)))
end
[get_stress_dir]

```
