PFC6.0 技巧——基于时间导出数据,以喷射混凝土为例
没人点赞这个博客就关啦!T_T
博客介绍
- 离散元计算结果以离散颗粒单元为主体,结果呈现方式与有限元、有限体积法等基于网格的分析方法相比略显落后。因此,对离散元计算数据导出、二次处理是广大离散元er普遍而迫切的需求。
- 软件自带的图像导出工具根据时间步导出图像,在时间步不固定的情况下导出的图片时间间距不一致,仅适用于简单固定时间步计算中。
- 此博客主要针对依泰斯卡旗下相关软件计算过程中以运行时间为基准的计算数据、图像及文件导出。可任意选择导出plot图像、运行数据、SAV文件,对数据后处理非常方便。
代码
[count=1]
[time_record=mech.time.total]
[time_next=time_record]
[baocunpinlv=0.00004]
设置计数基准,保存频率
def savefile
global time_next,baocunpinlv
local tcurrent=mech.time.total
if tcurrent<time_next then
exit
endif
设置判断条件,参考回调函数手册
filename=string.build("jieguo%1",count)
textname=string.build("jieguo%1_%2.txt",count,baocunpinlv)
ball_num=ball.num
file_infp=array.create(ball_num+2)
设置文档名称和文本文档名称
counting=1
file_infp(counting)="id xpos ypos zpos radius"
counting+=1
file_infp(counting)=string.build("%1 %2 %3 %4 %5",tcurrent,tcurrent,tcurrent,tcurrent,tcurrent)
counting+=1
导出表头和时间
loop foreach bp ball.list
file_infp(counting)=string.build("%1 %2 %3 %4 %5",ball.id(bp),ball.pos.x(bp),ball.pos.y(bp),ball.pos.z(bp),ball.radius(bp))
counting+=1
endloop
outflag=file.open(textname,1,1)
file.write(file_infp,ball_num+1)
file.close()
输出TXT文件
command
model save @filename
plot export bitmap filename @filename size 1920 1080
endcommand
time_next=tcurrent+baocunpinlv
count+=1
end
保存SAV文件和视图图像
fish callback add savefile -11.0
model solve
调用函数
结果
勉强能用,heihei
用Matlab对导出来的额数据二次处理了一下,效果还需要再调整一下,先放上来,有时间再调整吧。
==动感视频看这里==
https://www.bilibili.com/video/BV1hB4y1U7f8?spm_id_from=444.41.list.card_archive.click
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
最后贴上所有代码
[count=1]
[time_record=mech.time.total]
[time_next=time_record]
[baocunpinlv=0.00004]
def savefile
global time_next,baocunpinlv
local tcurrent=mech.time.total
if tcurrent<time_next then
exit
endif
filename=string.build("jieguo%1",count)
textname=string.build("jieguo%1_%2.txt",count,baocunpinlv)
ball_num=ball.num
file_infp=array.create(ball_num+2)
counting=1
file_infp(counting)="id xpos ypos zpos radius"
counting+=1
file_infp(counting)=string.build("%1 %2 %3 %4 %5",tcurrent,tcurrent,tcurrent,tcurrent,tcurrent)
counting+=1
loop foreach bp ball.list
file_infp(counting)=string.build("%1 %2 %3 %4 %5",ball.id(bp),ball.pos.x(bp),ball.pos.y(bp),ball.pos.z(bp),ball.radius(bp))
counting+=1
endloop
outflag=file.open(textname,1,1)
file.write(file_infp,ball_num+1)
file.close()
command
;model save @filename
plot export bitmap filename @filename size 1920 1080
endcommand
time_next=tcurrent+baocunpinlv
count+=1
end
fish callback add savefile -11.0
model solve
向各位大神、致敬!!!
整理不易,如果您觉得文章有用的话,别忘了动动小手点个赞哦!!!