FISH function for elastic modulus increment with depth

Hi all,

I’d like to initialize a non linear distribution of elastic moduli in my FLAC slope model. In particular, I would like to vary the moduli according to the depth from the ground level considering a the top left-hand grid point (i.e., y(1,jgp)) as a reference point.
I’m therefore trying to write a fish function called “linear_mod” but I cannot understand why it’s not working. It seems that the script does not produce any variation of the modules within the group in which I would like this variation to take place.

Here is the script:

;---------------------------------------------------------------------
config creep thermal extra 5

;------------------------DOMAIN WITH UNIFORM MESH (5x5m)
; I'm generating a domain with negative coordinates because part of the slope
; is below sea level

grid 430 106
gen 0 -300 0 230 2150 230 2150 -300 
mod el

;------------TOPOGRAPHY
gen line 0 230 1330 102
gen line 1330 102 1335 65
gen line 1335 65 2150 0
gen line 0 190 1335 65
ini x 1329.7183 y 102.10892 i 267 j 81
model null region 399,90

;------------STRATIGRAPHY
group sands region 3,101 
group clays region 3,95
mod el group sands
prop den 2400 bulk = 1000 shear = 500 group sands
mod el group clays
prop den 2050 bulk = 2000 shear = 100 group clays

;----------------------------------------------------------

def linear_mod
	loop i (1,izones)
	  	loop j (1,jzones)
			if z_group(i,j) = 'clays'  then 
				yc = (y(i,j)+y(i+1,j)+y(i,j+1)+y(i+1,j+1))/4.0 ; Centroid of each zone
				zc = y(1,jgp) - yc ; Depth of any zone centroid below the surface
				xc = zc * Gn * K 
				bulk_mod(i,j) = Km * xc - Kq ; Bulk modulus
				shear_mod(i,j) = Gm * xc - Gq ; Shear modulus
			endif
		endloop
	endloop
end

set Gn = 2050 K = 0.5 Km = 30 Kq = 50 Gm = 20 Gq = 40

linear_mod

I’m using FLAC v.8.

Can anyone tell me where I am wrong?

Thanks a lot in advance.

Try using K0=0.5 instead of K=0.5. By default K takes integer number, if a float number is assigned, it will cause truncation of the result.(for example, K=0.5 produces the result K=0)

Thank you jwang!

I had already tried this way but nothing changes. Even if I assign a different name to the variable K (i.e., ‘K0’ or ‘Var’) or a different integer value (i.e., 1 or 2) I always get the same result.
What can it depend on?

There might be some other fish variables in your code that have conflict with other FLAC command/fish names, i suggest add underscore ‘_’ for each fish variable to avoid any conflict. See the updated code below:
;------------------------DOMAIN WITH UNIFORM MESH (5x5m)
; I’m generating a domain with negative coordinates because part of the slope
; is below sea level
config dynamic
grid 430 106
gen 0 -300 0 230 2150 230 2150 -300
mod el
;------------TOPOGRAPHY
gen line 0 230 1330 102
gen line 1330 102 1335 65
gen line 1335 65 2150 0
gen line 0 190 1335 65
ini x 1329.7183 y 102.10892 i 267 j 81
model null region 399,90
;------------STRATIGRAPHY
group sands region 3,101
group clays region 3,95
mod el group ‘sands’
prop den 2400 bulk = 1000 shear = 500 group ‘sands’
mod el group ‘clays’
prop den 2050 bulk = 2000 shear = 100 group ‘clays’
;----------------------------------------------------------
def linear_mod
loop i (1,izones)
loop j (1,jzones)
if z_group(i,j) = ‘clays’ then
_yc = (y(i,j)+y(i+1,j)+y(i,j+1)+y(i+1,j+1))/4.0 ; Centroid of each zone
_zc = 230 - _yc ; Depth of any zone centroid below the surface
_xc = _zc * _Gn * _K0
bulk_mod(i,j) = _Km * _xc - _Kq ; Bulk modulus
shear_mod(i,j) = _Gm * _xc - _Gq ; Shear modulus
endif
endloop
endloop
end
set _Gn = 2050 _K0 = 0.5 _Km = 30 _Kq = 50 _Gm = 20 _Gq = 40
linear_mod

Thank you so much jwang!!