Fish function on looping over all zones

What is the best way to define the below 2D fish function in FLAC 3D that loops over all zones calculates Vs based on the vertical effective stress?
loop i (1,izones)
loop j (1,jzones)
if model(i,j) # 1
$sigv = -syy(i,j) - pp(i,j)
Vs = Vs1 * sqrt($sigv/2116)^n
shear_mod(i,j) = Vs^2 * density(i,j)

Something like this:

[global Vs1 = 500]
[global n = 0.25]
fish operator input_shear(z)
local pp = zone.pp(z)
local sigv = - zone.stress(z)->zz - pp
local Vs = Vs1 * (sigv/2116)^n
zone.prop(z,“shear”) = Vs^2 * zone.density(z)

Please check and make necessary modification for your model.

1 Like

Thank you for your response, @cheng. The provided code worked perfectly and the shear modulus vary in z direction. I have a follow-up question: after assigning the shear modulus using the code you provided, I would like to create a function that allows me to vary the shear modulus in both the x and y directions across the model. This is to assess the differential settlement resulting from a reduction in stiffness. I would greatly appreciate any guidance on how to iterate through zones within a single layer and update the shear modulus. In FLAC2D I would probably use something like below if it works:
loop $i (1,izones)
loop $j (1,jzones)
IF z_group($i,$j) = ‘Sand’ THEN
ex_1 ($i,$j) = z_prop($i,$j, ‘shear’)
z_prop($i,$j, ‘shear’) = ex_1 ($i,$j) * (linear reduction function!)

Something like:

fish operator adj_shear(z)
if zone.isgroup(z,“Sand”)
zone.prop(z,“shear”) *= 0.5

1 Like