找回密码
 注册
查看: 3163|回复: 0

udf加载到fluent中不起作用

[复制链接]
发表于 2011-7-6 15:53:46 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

x
/**************************************************************/
/* Implementation of the P1 model using user-defined scalars  */
/**************************************************************/

#include "udf.h"
#include "sg.h"
#define  e1 8.854E-12
#define pi 3.141593
#define        phi              0     /*求解电势的UDS编号*/                           
#define        electron 1.602E-19/*元电荷*/
#define        qp 5000 /*粒子所带的元电荷数目*/
#define        a 0.5 /*公式中的a*/




DEFINE_ADJUST(adjust_fcn,d)
{
  Thread *t;
  cell_t c;

  if (! Data_Valid_P())
    return;

  thread_loop_c(t,d)
    {
    if (FLUID_THREAD_P(t))
       {
        begin_c_loop_all(c,t)
            {        
          C_UDMI(c,t,0)=NV_MAG(C_UDSI_G(c,t,0)); /*存贮电场强度大小*/
          C_UDMI(c,t,1)=-C_UDSI_G(c,t,0)[0];/*存贮x向电场强度大小*/
          C_UDMI(c,t,2)=-C_UDSI_G(c,t,0)[1]; /*存贮y向电场强度大小*/         
      
         
            }
        end_c_loop_all(c,t)
       }
    }
}


DEFINE_DPM_BODY_FORCE(particle_body_force,tp,i)
{
  real bforce=0.0;
  real xc[ND_ND];
  Particle *p;
  cell_t c;
  Thread *t;
  c = P_CELL(tp);   /* Get the cell and thread that the particle is currently in   (bforce/P_MASS(tp)); */
  t = P_CELL_THREAD(tp);
  C_CENTROID(xc,c,t);

  if(i==0)
          bforce=-C_UDSI_G(c,t,0)[0]*qp*electron+qp*electron*qp*electron/(16.0*pi*(0.08964-xc[0])*(0.08964-xc[0]));  
  else if(i==1)
    bforce=-C_UDSI_G(c,t,0)[1]*qp*electron+qp*electron*qp*electron/(16.0*pi*(0.08964-xc[0])*(0.08964-xc[0]));

    return (bforce/P_MASS(tp));

}
请大家指正此udf

[ 本帖最后由 yingkesong88 于 2011-7-6 16:03 编辑 ]
9.jpg
7.jpg
8.jpg
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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