Flac3D重新链接结构单元
Flac3D5.0用到结构单元的时候,往往需要链接不同结构单元之间同一位置处的节点,这就需要将原有zone-node链接删除,新建立一个node-node链接,然后给这个链接赋属性,刚接或可屈服之类。若手动查找每个节点然后链接,量大时几乎是无法完成的,现提供自动链接函数。
使用示例:
@install_shell
sel node local xdir=(1,0,0) ydir=(0,1,0) range x 24 24.1
sel node fix lsys range x 24 24.1
sel node fix x yr zr range x 24 24.1
; 开挖西部第一层 z1=40.5, z2=42.5
@excav(40.5,42.5)
@install_cable_w(1)
@relink(10000)
solve
save quarter_excav_w1
自动链接函数:
; Flac3D 5.0
; w.gang.89@foxmail.com
def relink(begin_link_id)
dist_tol = 1e-2
link_id = begin_link_id
node_num = 0
node_pnt0 = nd_head
; m_pnt = null
loop while node_pnt0 # null
; node_num = node_num + 1
; m_pnt1 = get_mem(2)
; mem(m_pnt1) = m_pnt
; mem(m_pnt1+1) = node_pnt0
; m_pnt = m_pnt1
; node_pnt0 = nd_next(node_pnt0)
node_num = node_num + 1
node_pnt0 = nd_next(node_pnt0)
endloop
node_arr = get_array(node_num)
node_num = 0
node_pnt0 = nd_head
loop while node_pnt0 # null
node_num = node_num + 1
node_arr(node_num) = node_pnt0
node_pnt0 = nd_next(node_pnt0)
endloop
node_num_minus1 = node_num - 1
loop ii(1,node_num_minus1)
node_pnt1 = node_arr(ii)
node_id1 = nd_id(node_pnt1)
xxa = nd_pos(node_pnt1,2,1)
yya = nd_pos(node_pnt1,2,2)
zza = nd_pos(node_pnt1,2,3)
ii_plus1 = ii + 1
loop jj(ii_plus1,node_num)
node_pnt2 = node_arr(jj)
node_id2 = nd_id(node_pnt2)
xxb = nd_pos(node_pnt2,2,1)
yyb = nd_pos(node_pnt2,2,2)
zzb = nd_pos(node_pnt2,2,3)
node_dist = sqrt((xxa-xxb)^2+(yya-yyb)^2+(zza-zzb)^2)
if node_dist <= dist_tol then
link_pnt1 = nd_link(node_pnt1)
link_pnt2 = nd_link(node_pnt2)
if link_pnt1 = null then
link_id = link_id + 1
command
; sel set link node_tol=dist_tol
sel link id=@link_id @node_id1 target=node tgt_num=@node_id2
sel link attach xdir=rigid ydir=rigid zdir=rigid &
xrdir=rigid yrdir=rigid zrdir=rigid range id=@link_id
endcommand
else
if link_pnt2 = null then
link_id = link_id + 1
command
; sel set link node_tol=dist_tol
sel link id=@link_id @node_id2 target=node tgt_num=@node_id1
sel link attach xdir=rigid ydir=rigid zdir=rigid &
xrdir=rigid yrdir=rigid zrdir=rigid range id=@link_id
endcommand
else
if lk_type(link_pnt1) = lk_type(link_pnt2) then
; value {1,2} denotes node-to-node or node-to-zone link
temp = lk_delete(link_pnt2)
link_id = link_id + 1
command
sel link id=@link_id @node_id2 target = node tgt_num=@node_id1
sel link attach xdir=rigid ydir=rigid zdir=rigid &
xrdir=rigid yrdir=rigid zrdir=rigid range id=@link_id
endcommand
endif
endif
endif
endif
endloop
endloop
temp = lose_array(node_arr)
end
; @relink(10000)
查看更多评论 >