第二章 命令流按照顺序进行
2-1定义一个FISH函数 New def abc
abc = 25 * 3 + 5 End print abc
2-2使用一个变量 new def abc hh = 25
abc = hh * 3 + 5 End Print hh Print abc
2-3对变量和函数的理解 new def abc hh = 25
abc = hh * 3 + 5 End
set abc=0 hh=0 print hh print abc print hh new def abc
abc = hh * 3 + 5 end
set hh=25 print abc
set abc=0 hh=0 print hh print abc print hh
2-4获取变量的历史记录 new
gen zone brick size 1 2 1 model mohr
prop shear=1e8 bulk=2e8 cohes=1e5 tens=1e10
fix x y z range y -0.1 0.1
apply yvel -1e-5 range y 1.9 2.1 plot set rotation 0 0 45 plot block group def get_ad
ad1 = gp_near(0,2,0) ad2 = gp_near(1,2,0) ad3 = gp_near(0,2,1) ad4 = gp_near(1,2,1) end get_ad def load
load=gp_yfunbal(ad1)+gp_yfunbal(ad2)+gp_yfunbal(ad3)+gp_yfunbal(ad4) end hist load
hist gp ydis 0,2,0 step 1000
plot his 1 vs -2
2-5用FISH函数计算体积模量和剪砌模量 new
def derive
s_mod = y_mod / (2.0 * (1.0 + p_ratio))
b_mod = y_mod / (3.0 * (1.0 - 2.0 * p_ratio)) end
set y_mod = 5e8 p_ratio = 0.25 derive
print b_mod print s_mod
2-6 在FLAC输入中使用符号变量 New
def derive
s_mod = y_mod / (2.0 * (1.0 + p_ratio))
b_mod = y_mod / (3.0 * (1.0 - 2.0 * p_ratio)) end
set y_mod = 5e8 p_ratio = 0.25 derive
gen zone brick size 2,2,2 model elastic
prop bulk=b_mod shear=s_mod print zone prop bulk print zone prop shear
2-7 控制循环 New def xxx
sum = 0 prod = 1
loop n (1,10) sum = sum + n prod = prod * n end_loop end xxx
print sum, prod new
gen zone brick p0 (0,0,0) p1 (-10,0,0) p2 (0,10,0) p3 (0,0,-10) model elas
plot set rotation 0 0 45 plot block group def install
pnt = zone_head
loop while pnt #null z_depth = -z_zcen(pnt)
y_mod = y_zero + cc * sqrt(z_depth)
z_prop(pnt, ’shear’) = y_mod / (2.0*(1.0+p_ratio)) z_prop(pnt, ’bulk’) = y_mod / (3.0*(1.0-2.0*p_ratio)) pnt = zone_next(pnt) end_loop end
set p_ratio=0.25 y_zero=1e7 cc=1e8 install
2-8 拆分命令行
new ;example of a sum of many things def long_sum
temp = v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10 long_sum = temp + v11 + v12 + v13 + v14 + v15 end
2-9 变量类型 new
def haveone
aa = 2 bb = 3.4
cc = ’Have a nice day’