|
楼主 |
发表于 2011-11-17 08:47:37
|
显示全部楼层
回复 1# lgsh 的帖子
可有人做过附加体积力算例的?给点意见呗~~~~~~~
#include "udf.h"
#include "surf.h"
#define A 4.e-19
DEFINE_DPM_BODY_FORCE(Van_der_waals_force,p,i)
{
cell_t c = RP_CELL(&(p -> cCell));
Thread *t = RP_THREAD(&(p -> cCell));
Particle *pi;
float bforce=0, bforce_x=0, bforce_y=0, bforce_z=0, coo=0, s=0;
int j=0, num=0;
float pos[4]={0};
begin_particle_cell_loop(pi,c,t)
{
num++;
}
end_particle_cell_loop(pi,c,t)
if(num>0)
{
begin_particle_cell_loop(pi,c,t)
{
for(j=0; j<3; j++)
pos[j] = P_POS(pi)[j] - P_POS(p)[j];
coo = sqrt(pos[0]*pos[0] + pos[1]*pos[1] + pos[2]*pos[2]);
s = coo-0.5*(P_DIAM(p)+P_DIAM(pi));
if(s <= 2.e-6)
{
bforce = A*P_DIAM(p)/(24*s*s);
bforce_x += bforce*pos[0]/coo;
bforce_y += bforce*pos[1]/coo;
bforce_z += bforce*pos[2]/coo;
}
}
end_particle_cell_loop(pi,c,t)
}
if(i==0) bforce = bforce_x;
else if(i==1) bforce = bforce_y;
else
bforce = bforce_z;
/* an acceleration should be returned */
return (bforce/P_MASS(p));
}
这是我写的求单个网格内颗粒间相互作用力的UDF 不知道有没有问题 请高人看一下 帮帮小弟吧 |
|