找回密码
 注册
Simdroid-非首页
查看: 554|回复: 6

[前后处理] Flac3D中隧道实体单元合成环向内力(弯矩、轴力)

[复制链接]
发表于 2015-12-16 15:01:12 | 显示全部楼层 |阅读模式 来自 云南昆明
本帖最后由 745257116 于 2015-12-29 10:52 编辑

声明:此命令流为米兰的小铁匠原创,也谢谢作者在QQ空间上的分享。
以下为原版内容:
; 存档
; Flac3D合成环向弯矩和轴力


demo.txt

call split_liner.fis
range name primary group 2
range name outer group 1
range name inner group 3
set @grname = 'primary'
set @outergr = 'outer'
set @innergr = 'inner'
@split_liner
call get_mn_annular.fis
set @mn_file = 'flac3d_mn_primary.csv'
set @sec_th = 0.28
set @elem_le= 1.0
set @xx_cen = 0.0
set @zz_cen = 0.0
set @ksi = 0.5
range name flac3dmn_range1 group primary_outer
range name flac3dmn_range2 group primary_inner
@get_mn_annular




split_liner.fis

def split_liner
;grname = 'primary'
;outergr = 'outer'
;innergr = 'inner'
p_z = zone_head
loop while p_z # null
flag1 = 0
flag2 = 0
if in_range(grname, p_z) = 1 then
gpcount = z_numgp(p_z)
zid = z_id(p_z)
loop i(1, gpcount)
p_gp = z_gp(p_z, i)
flag1 = flag1 + in_range(outergr, p_gp)
flag2 = flag2 + in_range(innergr, p_gp)
endloop
section
flag3 = flag1 * flag2
if flag3 # 0 then
exit section
endif
if flag1 > 0 then
newgrname = grname + '_' + outergr
z_group(p_z) = newgrname
exit section
endif
if flag2 > 0 then
newgrname = grname + '_' + innergr
z_group(p_z) = newgrname
endif
endsection
endif
p_z = z_next(p_z)
endloop
end


get_mn_annular.fis

def get_mn_annular
; number of zones, address
n_zone1 = 0
n_zone2 = 0
m_pnt1 = null
m_pnt2 = null
z_pnts = z_list
loop foreach z_pnt z_pnts
if in_range('flac3dmn_range1', z_pnt) = 1 then
n_zone1 = n_zone1 + 1
m_pnt11 = get_mem(2)
mem(m_pnt11) = m_pnt1
mem(m_pnt11+1) = z_pnt
m_pnt1 = m_pnt11
endif
if in_range('flac3dmn_range2', z_pnt) = 1 then
n_zone2 = n_zone2 + 1
m_pnt21 = get_mem(2)
mem(m_pnt21) = m_pnt2
mem(m_pnt21+1) = z_pnt
m_pnt2 = m_pnt21
endif
endloop
; open
status = open(mn_file, 1, 1)
buf = get_array(1)
buf(1) = string(xx_cen)+','+string(zz_cen)
status = write(buf, 1)
buf(1) = 'x0,z0,x1,z1,x2,z2,m,n'
status = write(buf, 1)
; resultant moment and nforce
loop while m_pnt11 # null
p_z = mem(m_pnt11 + 1)
x_cor1 = z_xcen(p_z)
z_cor1 = z_zcen(p_z)
sgm_xx1= z_sxx(p_z)
sgm_xz1= z_sxz(p_z)
sgm_zz1= z_szz(p_z)
; mpnt21
m_pnt2 = m_pnt21
p_zz = mem(m_pnt2 + 1)
x_cor2 = z_xcen(p_zz)
z_cor2 = z_zcen(p_zz)
sgm_xx2= z_sxx(p_zz)
sgm_xz2= z_sxz(p_zz)
sgm_zz2= z_szz(p_zz)
sd_dist= sqrt((x_cor1-x_cor2)^2 + (z_cor1-z_cor2)^2)
p_z2 = p_zz
loop while m_pnt2 # null
p_zz = mem(m_pnt2 + 1)
x_cor3 = z_xcen(p_zz)
z_cor3 = z_zcen(p_zz)
sd_dist3= sqrt((x_cor1-x_cor3)^2 + (z_cor1-z_cor3)^2)
if sd_dist > sd_dist3 then
p_z2 = p_zz
sd_dist = sd_dist3
x_cor2 = x_cor3
z_cor2 = z_cor3
sgm_xx2 = z_sxx(p_zz)
sgm_xz2 = z_sxz(p_zz)
sgm_zz2 = z_szz(p_zz)
endif
m_pnt2 = mem(m_pnt2)
endloop
; get elem_length
gps = get_array(8, 3)
loop ii(1, 8)
gps(ii, 1) = z_gp(p_z, ii)
gps(ii, 2) = z_gp(p_z2,ii)
gps(ii, 3) = 0
endloop
loop ii(1, 8)
loop iii(1,8)
if gps(ii,1) = gps(iii,2) then
gps(ii, 3) = 1
endif
endloop
endloop
iii = 1
_gps = get_array(2)
loop ii(1, 8)
if gps(ii, 3) = 1 then
if gp_ypos(gps(ii,1)) < z_ycen(p_z) then
gps(ii, 3) = 2
_gps(iii) = gps(ii, 1)
iii = iii + 1
endif
endif
endloop
delta_x = gp_xpos(_gps(1))-gp_xpos(_gps(2))
delta_z = gp_zpos(_gps(1))-gp_zpos(_gps(2))
; elem_le = sqrt(delta_x ^ 2 + delta_z ^ 2)
ii = lose_array(gps)
ii = lose_array(_gps)
sec_th = 2 * sd_dist
; θ = arctan(dx/dy)
alpha=-atan((x_cor1-x_cor2)/(z_cor1-z_cor2))
; σn = σx*cos(θ)^2 + σy*cos(θ)^2 + σxy*sin(2θ)
sgm_n1=sgm_xx1*cos(alpha)^2 + sgm_zz1*sin(alpha)^2 + sgm_xz1*sin(2*alpha)
sgm_n2=sgm_xx2*cos(alpha)^2 + sgm_zz2*sin(alpha)^2 + sgm_xz2*sin(2*alpha)
; σ1 = (σn1 + σn2) / 2 + (σn1 + σn2) / 2τ
sgm_sg1=0.5*(sgm_n1+sgm_n2)+(sgm_n1-sgm_n2)/(2.0*ksi)
; σ2 = (σn1 + σn2) / 2 - (σn1 + σn2) / 2τ
sgm_sg2=0.5*(sgm_n1+sgm_n2)-(sgm_n1-sgm_n2)/(2.0*ksi)
; m = (σ1 - σ2) * bh^2 / 12
m_moment=elem_le*sec_th*sec_th*(sgm_sg1-sgm_sg2)/12
; n = (σ1 + σ2) * bh / 2
n_force =elem_le*sec_th*(sgm_sg1+sgm_sg2)/2
sec_xcor=(x_cor1+x_cor2)/2
sec_zcor=(z_cor1+z_cor2)/2
buf(1)=buf(1)+string(sec_xcor)+','
buf(1)=buf(1)+string(sec_zcor)+','
buf(1)=buf(1)+string(x_cor1)+','
buf(1)=buf(1)+string(z_cor1)+','
buf(1)=buf(1)+string(x_cor2)+','
buf(1)=buf(1)+string(z_cor2)+','
buf(1)=buf(1)+string(m_moment)+','
buf(1)=buf(1)+string(n_force)+','
status = write(buf, 1)
; release memory
m_pnt1 = m_pnt11
m_pnt11 = mem(m_pnt11)
ii = lose_mem(2, m_pnt1)
endloop
; release memory
loop while m_pnt21 # null
m_pnt2 = m_pnt21
m_pnt21 = mem(m_pnt21)
ii = lose_mem(2, m_pnt2)
endloop
; close
status = close
ii = out('Successfully Write ' + string(n_zone1) + ' Data Into File ' + mn_file)
ii = lose_array(buf)
end
; @get_mn_annular

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
 楼主| 发表于 2015-12-16 15:02:44 | 显示全部楼层 来自 云南昆明
Simdroid开发平台
本帖最后由 745257116 于 2015-12-28 13:26 编辑

' VBA调用Excel数据在AutoCAD中绘图
Sub draw_mn()
Dim xlsPath As String
Dim xlsApp As Excel.Application
Dim xlsBook As Excel.Workbook
Dim xlsSheet As Excel.Worksheet
Dim endCell As Range, endLine As Long
Dim lineObj As AcadLine, plineObj As AcadPolyline, textObj As AcadText
Dim points1() As Double, points2() As Double, pCount As Integer
Dim startPoint(0 To 2) As Double, endPoint(0 To 2) As Double
Dim txt() As String, isDraw() As Integer, tH As Double, xOff As Double
xlsPath = "D:\tunnel\flac3d\h347\result.xlsx"
tH = 0.8
xOff = 30
yOff = 30
Set xlsApp = New Excel.Application
Set xlsBook = xlsApp.Workbooks.Open(xlsPath)
Set xlsSheet = xlsBook.Worksheets("Sheet1")
Set endCell = xlsSheet.Range("A1").End(xlDown)
endLine = endCell.Row
pCount = (endLine - 1) * 3
ReDim points1(0 To pCount - 1)
ReDim points2(0 To pCount - 1)
ReDim txt(0 To endLine - 2)
ReDim isDraw(0 To endLine - 2)
k = 0
For i = 2 To endLine
points1(k) = xlsSheet.Cells(i, 1)
points1(k + 1) = xlsSheet.Cells(i, 2)
points1(k + 2) = 0
'
points2(k) = xlsSheet.Cells(i, 13)
points2(k + 1) = xlsSheet.Cells(i, 14)
points2(k + 2) = 0
txt(i - 2) = xlsSheet.Cells(i, 7) / 1000#
isDraw(i - 2) = xlsSheet.Cells(i, 17)
'
k = k + 3
Next i
Set plineObj = ThisDrawing.ModelSpace.AddPolyLine(points1)
plineObj.Closed = True
Set plineObj = ThisDrawing.ModelSpace.AddPolyLine(points2)
plineObj.Closed = True
For i = 0 To k / 3 - 1
startPoint(0) = points1(i * 3)
startPoint(1) = points1(i * 3 + 1)
startPoint(2) = points1(i * 3 + 2)
endPoint(0) = points2(i * 3)
endPoint(1) = points2(i * 3 + 1)
endPoint(2) = points2(i * 3 + 2)
Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
If isDraw(i) = 1 Then
Set textObj = ThisDrawing.ModelSpace.AddText(txt(i), endPoint, tH)
End If
Next i
'
'
'
'
'
'
xlsBook.Close SaveChanges:=False
xlsApp.Quit
Set xlsSheet = Nothing
Set xlsBook = Nothing
Set xlsApp = Nothing
End Sub
回复 不支持

使用道具 举报

 楼主| 发表于 2015-12-28 13:47:57 | 显示全部楼层 来自 北京
*** Fish: Bad conversion from integer to pointer  出现类似的错误该怎么调整fish。
回复 不支持

使用道具 举报

发表于 2017-2-20 15:34:49 | 显示全部楼层 来自 湖南长沙
loop while m_pnt11 # null

p_z = mem(m_pnt11 + 1)

x_cor1 = z_xcen(p_z)

z_cor1 = z_zcen(p_z)

sgm_xx1= z_sxx(p_z)

sgm_xz1= z_sxz(p_z)

sgm_zz1= z_szz(p_z)

; mpnt21

m_pnt2 = m_pnt21

p_zz = mem(m_pnt2 + 1)

x_cor2 = z_xcen(p_zz)

z_cor2 = z_zcen(p_zz)

sgm_xx2= z_sxx(p_zz)

sgm_xz2= z_sxz(p_zz)

sgm_zz2= z_szz(p_zz)

sd_dist= sqrt((x_cor1-x_cor2)^2 + (z_cor1-z_cor2)^2)

p_z2 = p_zz

loop while m_pnt2 # null

p_zz = mem(m_pnt2 + 1)

x_cor3 = z_xcen(p_zz)

z_cor3 = z_zcen(p_zz)

sd_dist3= sqrt((x_cor1-x_cor3)^2 + (z_cor1-z_cor3)^2)

if sd_dist > sd_dist3 then

p_z2 = p_zz

sd_dist = sd_dist3

x_cor2 = x_cor3

z_cor2 = z_cor3

sgm_xx2 = z_sxx(p_zz)

sgm_xz2 = z_sxz(p_zz)

sgm_zz2 = z_szz(p_zz)

endif

m_pnt2 = mem(m_pnt2)

endloop
回复 不支持

使用道具 举报

发表于 2017-2-20 15:36:01 | 显示全部楼层 来自 湖南长沙
请问楼主是否可以帮我注解一下,我没有明白为啥要进行if sd_dist > sd_dist3 then

回复 不支持

使用道具 举报

发表于 2019-11-9 00:19:02 | 显示全部楼层 来自 广东广州
衬砌径向划分成4层单元就不行了,似乎只能用在径向两层单元的衬砌上
回复 不支持

使用道具 举报

发表于 2020-7-21 14:18:06 | 显示全部楼层 来自 安徽合肥
pengzuzhao 发表于 2019-11-9 00:19
衬砌径向划分成4层单元就不行了,似乎只能用在径向两层单元的衬砌上

你没有理解楼主为什么用两层单元做,如果你理解了,四层单元也是可以做的。
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-5-18 20:37 , Processed in 0.036595 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表