| 查看: 2140 | 回复: 5 | ||
[求助]
DPM宏命令Begin_particle_cell_loop(p,c,t)的使用问题 已有1人参与
|
|
各位同学 有没有使用Fluent中 这个 begin_particle_cell_loop(p,c,t)宏呢,该宏出现在DEFINE_DPM_SPRAY_COLLIDE中,看帮助上的解释,该宏应该是遍历单元中所有的颗粒。我想用该宏求出单元中 颗粒的体积分数,命令如下。 该命令在编译中没问题,计算时崩溃。我调试过多次,最后发现 begin_particle_cell_loop(pi,c,t)不能再DEFINE_DPM_DRAG中使用,一旦使用,求解就没办法进行,我也尝试在其他宏 如DEFINE_DPM_SCALE_UPDATA 和DEFINE_DPM_BODY_FORCE中调用均失败。有没有大牛使用过该宏,求指点迷津,被折磨了好久了。 DEFINE_DPM_DRAG(particle_drag_force,Re,p) { real dd,Vsum=0.0; cell_t c=P_CELL(p); Thread *t =P_CELL_THREAD(p); Particle *pi; begin_particle_cell_loop(pi,c,t) { Vsum+=M_PI*pow(P_DIAM(pi),3.0)/6.0; }end_particle_cell_loop(pi,c,t) C_UDMI(c,t,0)=Vsum/C_VOLUME(c,t); //求体相积分数;// if(C_UDMI(c,t,0)>1) C_UDMI(c,t,0)=1.0; if(Dragsign==1) dd=Cdrag_force1(p,Re); else if(Dragsign==2) dd=Cdrag_force2(p,Re); else if(Dragsign==3) dd=Cdrag_force3(p,Re); else if(Dragsign==4) dd=Cdrag_force4(p,Re); else dd=Cdrag_force5(p,Re); return dd*pow(1-C_UDMI(c,t,0),5.0/3.0)/pow(1-C_UDMI(c,t,0),2.0); } |
» 猜你喜欢
职称评审没过,求安慰
已经有48人回复
26申博自荐
已经有3人回复
A期刊撤稿
已经有4人回复
垃圾破二本职称评审标准
已经有17人回复
投稿Elsevier的Neoplasia杂志,到最后选publishing options时页面空白,不能完成投稿
已经有22人回复
EST投稿状态问题
已经有7人回复
毕业后当辅导员了,天天各种学生超烦
已经有4人回复
三无产品还有机会吗
已经有6人回复


2楼2019-06-15 14:43:25
膜拜大神。请问大神,你所说的particle bin如何创建,或者如何得到?在fluent UDF 手册中关于这个宏我只发现在DEFINE_DPM_SPRAY_COLLIDE中存在,关于这个宏的介绍也是一笔带过。大神,你能详细说下,或则推荐个资料吗,udf手册中的介绍很不详细,有很多都需要自己结合程序推出是什么意思 。。大神,我udf的目的是想遍历每个流体单元中所有的气泡,通过累加其体积然后求得气相的体积分数。大神,你能推荐下简单的方法吗?不胜感激。。还有金币奉上发自小木虫Android客户端 |

3楼2019-06-16 00:11:52
送红花一朵 |
膜拜大神。请问大神,你所说的particle bin如何创建,或者如何得到?在fluent UDF 手册中关于这个宏我只发现在DEFINE_DPM_SPRAY_COLLIDE中存在,关于这个宏的介绍也是一笔带过。大神,你能详细说下,或则推荐个资料吗,udf手册中的介绍很不详细,有很多都需要自己结合程序推出是什么意思。。我udf的目的是想遍历每个流体单元中所有的气泡,通过累加其体积然后求得气相的体积分数。大神,你能推荐下简单的方法吗?不胜感激。。还有金币奉上 发自小木虫Android客户端 |

4楼2019-06-16 00:15:38
5楼2020-05-19 16:44:38
【答案】应助回帖
|
There is a loop available for looping over all the particles in a cell. But it does not work if used directly. Actually the array to bin the particles in the cell is not allocated by default. It has to be done before using this loop and then it will run ok. So, at the top of the routine, please put, Alloc_Storage_Vars(domain, SV_DPM_PARTICLE_BIN, SV_NULL); bin_particles_in_cells(domain); and at the botton, free up the memory with, Free_Storage_Vars(domain, SV_DPM_PARTICLE_BIN, SV_NULL); I am attaching my test UDF. It worked nicely for a simple 2d case in Linux. #include "udf.h" #include "surf.h" DEFINE_ON_DEMAND(cell) { Domain *d=Get_Domain(1); cell_t c; int id; Particle *p; Thread *c_thread=Lookup_Thread(d,2); /*In my case 2 was the id of the fluid thread. Please change this number accordingly */ Alloc_Storage_Vars(d, SV_DPM_PARTICLE_BIN, SV_NULL); bin_particles_in_cells(d); begin_c_loop(c, c_thread) { /* Message("Cell_index=%dn",c);*/ begin_particle_cell_loop(p,c,c_thread) { id=p->part_id; Message(" cell index=%d part_id=%d ",c,id); } end_particle_cell_loop(p,c,c_thread) } end_c_loop(c, c_thread) Free_Storage_Vars(d, SV_DPM_PARTICLE_BIN, SV_NULL); } |
6楼2020-05-19 18:00:43













回复此楼
。。大神,我udf的目的是想遍历每个流体单元中所有的气泡,通过累加其体积然后求得气相的体积分数。大神,你能推荐下简单的方法吗?不胜感激。。还有金币奉上