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)
工程師必備
- 項目客服
- 培訓客服
- 平臺客服
TOP




















