找回密码
 注册
查看: 2383|回复: 3

DEFINE_DPM_BODY_FORCE ( name, p, i) 中i是什么意思?

[复制链接]
发表于 2012-10-15 14:20:41 | 显示全部楼层 |阅读模式

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

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

x
/* UDF for computing the ic force on a charged particle */

#include "udf.h"

#define Q 1.0         /* particle electric charge      */
#define BZ 3.0        /* z component of ic field */
#define TSTART 18.0   /* field applied at t = tstart   */

/* Calculate ic force on charged particle.  ic   */
/* force is particle charge times cross product of particle  */
/* velocity with ic field: Fx= q*bz*Vy,  Fy= -q*bz*Vx  */

DEFINE_DPM_BODY_FORCE(particle_body_force,p,i)
{
        real bforce;
        if(P_TIME(p)>=TSTART)
          {
           if(i==0) bforce=Q*BZ*P_VEL(p)[1];      

           else if(i==1) bforce=-Q*BZ*P_VEL(p)[0];

          }
        else
           bforce=0.0;
        /* an acceleration should be returned */
        return (bforce/P_MASS(p));
}

麻烦各位大侠看看。这是从fluent中的help文件中的, if(i==0) 这个命令是什么意思?i指的是什么?
发表于 2012-10-15 15:09:15 | 显示全部楼层
帮助中说的明明白白,An index (0, 1, or 2) that identifies the Cartesian component of the body force that is to be returned by the function.

原帖由 passflame 于 2012-10-15 06:20 发表
/* UDF for computing the ic force on a charged particle */

#include "udf.h"

#define Q 1.0         /* particle electric charge      */
#define BZ 3.0        /* z component of ic field */
#defin ...
 楼主| 发表于 2012-10-15 15:40:59 | 显示全部楼层

回复 2# gearboy78 的帖子

An index (0, 1, or 2) that identifies the Cartesian component of the body force that is to be returned by the function这句话是什么意思?麻烦楼主再帮忙看看!谢谢了!
发表于 2012-10-15 20:58:34 | 显示全部楼层

回复 3# passflame 的帖子

i=0,1,2指的是x,y,z三个不同的方向
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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