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

[建模专区] 为何没有粒子产生

[复制链接]
发表于 2012-9-26 16:20:43 | 显示全部楼层 |阅读模式 来自 湖南长沙
DEF create_ball_0
    rmin=0.05
    rmax=0.09
  loop n(1,6)
    id2 = n * 1200
    id1 = id2 - 1199
    z0  = (7-n) * pz / 6
    z1  = (6-n) * pz / 6
    command
      gen  id=id1,id2  rad rmin  rmax  x  0 px  y  0 py  z   z0  z1   rad 0.05 0.09           ;这边的pz需要修改  构成一个循环
      prop ball_props                                             set grav 0 0 -9.81
      step 10000
    end_command
     end_loop
END
create_ball_0

没有粒子产生 这个fish语句  哪位大侠帮忙看看是哪边的问题。
发表于 2012-9-27 00:29:15 | 显示全部楼层 来自 美国
Simdroid开发平台
gen 命令一般在程序中只用一次,而且作用方式是尝试确定有足够空间在生成粒子,如果前面有粒子分布在模型空间,再用gen命令通常会遇到麻烦,建议用ball命令
回复 不支持

使用道具 举报

 楼主| 发表于 2012-9-27 08:14:10 | 显示全部楼层 来自 湖南长沙
好的。我的想法是用循环的方式,不断产生球体,填充空间。   大侠,有什么好的相关算例推荐吗?
回复 不支持

使用道具 举报

 楼主| 发表于 2012-9-28 09:20:46 | 显示全部楼层 来自 湖南长沙
非常谢谢
回复 不支持

使用道具 举报

发表于 2012-9-27 22:01:46 | 显示全部楼层 来自 美国
本帖最后由 rock_cumt 于 2012-9-27 22:02 编辑

没有算例,应该不难。我写段代码,没有测试,供参考
def pre_fill
;x0,x1,y0,y1,z0,z1, the coordinator of the container
;t_vol, total volume of the sample
;p_vol, pore volume of the sample;bnid is the new id ready for create new particle
   bnid = 1
   t_vol = (x1-x0)*(y1-y0)*(z1-z0)   p_vol = t_vol
   bp = ball_head
   loop while bp # null
      bnid = bnid +1
      bp = b_next(bp)
  endloop
end

;;=========
def _fill
;_n0 : desired porosity
;_n   :current porosity
;(_x, _y,_z) position for new particle; _r is the radius for new particle
;rlow, rhi : smallest and biggest radius or the particles
   _n = p_vol/t_vol
   loop while _n>_n0
      _r = rlow+urand*(rhi-rlow)
     _x = _x0+_r+urand*(x1-x0-2*_r)
     _y = _y0+_r+urand*(y1-y0-2*_r)
     _z = _z0+_r+urand*(z1-z0-2*_r)
     command
         ball id bnid rad _r x _x y _y z _z
     endcommand
      bnid = bnid +1
      p_vol = p_vol - 4*pi/3*(_r)^3
      _n = p_vol/t_vol
   endloop
end

Good Luck!


回复 不支持

使用道具 举报

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

本版积分规则

Simapps系列直播

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

GMT+8, 2024-9-29 09:38 , Processed in 0.029540 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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