命令流的一道例题 关于字符串的
new
def in_def
xx = in(msg+’(’+’default:’+string(default)+’):’)
if type(xx) = 3
in_def = default
else
in_def = xx
endif
end
;
def moduli_data
default = 1.0e9
msg=’Input Young‘s modulus ’
Y_mod = in_def
default = 0.25
msg=’Input Poisson‘s ratio ’
p_ratio = in_def
if p_ratio = 0.5 then
ii = out(’ Bulk mod is undefined at Poisson‘s ratio = 0.5’)
ii = out(’ Select a different value --’)
p_ratio = in_def
endif
s_mod = y_mod / (2.0 * (1.0 + p_ratio))
b_mod = y_mod / (3.0 * (1.0 - 2.0 * p_ratio))
end
;
moduli_data
gen zone brick size 2,2,2
model elastic
prop bulk = b_mod shear = s_mod
print p_ratio y_mod b_mod s_mod
pause
print zone prop bulk
pause
print zone prop shear