How can I generate a plot of the maximum shear stress using plot blocks in 3DEC v5.2, similar to the way displacement contours or maximum principal stress plots are created?

Max. shear stress = Max of (|sig1 - sig2|, |sig2 - sig3|, |sig3 - sig1|) / 2

Hi @jhazzard and 3DEC Team,
I would like to follow up on my previous message and share the code I have written to store the maximum shear stress values in the vertex extra. Unfortunately, the calculated values do not match the expected results. I kindly request your assistance in verifying the code for any potential issues.
Many thanks,
Vijay Kiran Kota

Here is the code:

Function to extrapolate zone stresses to gridpoint extra variable Vertex extra 1: Maximum principal stress, s1 (positive compression) Vertex extra 2: Intermediate principal stress, s2 (positive compression) Vertex extra 3: Minimum principal stress, s3 (positive compression) Vertex extra 4: Maximum Shear Stress, Max. SS (positive compression)

def plot_stress *; first initialize to 0*
local bi = block_head
loop while bi # 0
local gpi = b_gp(bi)
loop while gpi # 0
gp_extra(gpi,1) = 0.0 ; s1
gp_extra(gpi,2) = 0.0 ; s2
gp_extra(gpi,3) = 0.0 ; s3
gp_extra(gpi,4) = 0.0 ; MaxSS
gpi = gp_next(gpi)
end_loop
bi = b_next(bi)
end_loop
; Calculation of Max. shear stress
local Max_SS = zdiff1
if zdiff2 > Max_SS then
Max_SS = zdiff2
end_if
if zdiff3 > Max_SS then
Max_SS = zdiff3
end_if
loop local zgp (1,4)
gpi = z_gp(zi,zgp)
gp_extra(gpi,1) = gp_extra(gpi,1) + zs1
gp_extra(gpi,2) = gp_extra(gpi,2) + zs2
gp_extra(gpi,3) = gp_extra(gpi,3) + zs3
gp_extra(gpi,4) = gp_extra(gpi,4) + Max_SS
end_loop
zi = z_next(zi)
end_loop
bi = b_next(bi)
end_loop
end
@plot_stress

i can see in your code that you did a loop through blocks and gps to set gp_extra to zero and you closed that loop after thatâ€¦
Then you define some variable to store de stress differences but you never did the operation to give those variables a numeric valueâ€¦ also you are doing a loop throug a zone gridpoint, but you never define the zone pointer â€śZiâ€ť, i suggest you to check those things.
Regards