找回密码
 注册
查看: 4547|回复: 1

请问DEFINE_DPM_INJECTION_INIT例子中的几个问题

[复制链接]
发表于 2011-8-16 19:18:52 | 显示全部楼层 |阅读模式

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

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

x
麻烦各位能够解答一下udf中DEFINE_DPM_INJECTION_INIT的例子的几个问题,问题已用红色标出。敢情麻烦各位能帮着解答。非常感谢。。。
/**********************************************************************
   UDF that initializes particles on a surface injection due         
   to a surface reaction                                             
***********************************************************************/
#include "udf.h"
#include "surf.h"  /* RP_CELL and RP_THREAD are defined in surf.h */
#define REACTING_SURFACE_ID 2
#define MW_H2 2
#define STOIC_H2 1
/* ARRHENIUS CONSTANTS */
#define PRE_EXP 1e+15
#define ACTIVE 1e+08
#define BETA 0.0
real arrhenius_rate(real temp)
{
return
PRE_EXP*pow(temp,BETA)*exp(-ACTIVE/(UNIVERSAL_GAS_CONSTANT*temp));
}
/* Species numbers. Must match order in ANSYS FLUENT dialog box */
#define HF  0
/* Reaction Exponents */
#define HF_EXP  2.0
/* Reaction Rate Routine used in UDF */
real reaction_rate(cell_t c, Thread *cthread,real mw[],real yi[]) ?mw[]指的是什么?
/* Note that all arguments in the reaction_rate function
call in your .c source file MUST be on the same line or a
compilation error will occur */
{
real concenHF = C_R(c,cthread)*yi[HF]/mw[HF];
return arrhenius_rate(C_T(c,cthread))*pow(concenHF,HF_EXP);
}
real contact_area(cell_t c,Thread *t,int s_id,int *n);
DEFINE_DPM_INJECTION_INIT(init_bubbles,I)
{
int count,i;
real area, mw[MAX_SPE_EQNS], yi[MAX_SPE_EQNS];
   /*  MAX_SPE_EQNS is an ANSYS FLUENT constant in materials.h  */
Particle *p;
cell_t cell;
Thread *cthread;
Material *mix, *sp; ?Material定义的是材料的性质吗?
Message("Initializing Injection: %s\n",I->name);
loop(p,I->p)  /* Standard ANSYS FLUENT Looping Macro to get particle
                  streams in an Injection */?这个循环应该怎么理解?还有如果是瞬态的话,I->p变为I-p_int,这里的瞬态是什么意思? {
  cell = P_CELL(p);   /* Get the cell and thread that the particle
                        is currently in   */
  cthread = P_CELL_THREAD(p);
  /* Set up molecular weight & mass fraction arrays */
  mix = THREAD_MATERIAL(cthread);
  mixture_species_loop(mix,sp,i)
  {
   mw = MATERIAL_PROP(sp,PROP_mwi); ?这个是什么意思?
   yi = C_YI(cell,cthread,i);
  }
  area = contact_area(cell, cthread, REACTING_SURFACE_ID,&count);
   /* Function that gets total area of REACTING_SURFACE faces in
      contact with cell */
   /* count is the number of contacting faces, and is needed   
      to share the total bubble emission between the faces      */
  if (count > 0)  /* if cell is in contact with REACTING_SURFACE */
  {
   P_FLOW_RATE(p) = (area *MW_H2* STOIC_H2 *
                  reaction_rate(cell, cthread, mw, yi))/
                  (real)count;    /* to get correct total flow
                      rate when multiple faces contact the same cell */
   P_DIAM(p) = 1e-3;
   P_RHO(p) = 1.0;
   P_MASS(p) = P_RHO(p)*M_PI*pow(P_DIAM(p),3.0)/6.0;
  }
  else
   P_FLOW_RATE(p) = 0.0;
}
}
real contact_area(cell_t c, Thread *t, int s_id, int *n)
{
int i = 0;
real area = 0.0, A[ND_ND];
*n = 0;   ?这里为什么要用指针呢?
c_face_loop(c,t,i)
{
  if(THREAD_ID(C_FACE_THREAD(c,t,i)) == s_id)  ?这个判断的意思是什么?  {
  (*n)++;
   F_AREA(A,C_FACE(c,t,i), C_FACE_THREAD(c,t,i));
   area += NV_MAG(A);
  }
}
return area;
}
发表于 2011-8-18 09:21:47 | 显示全部楼层
mw是分子量,Material是表示材料的结构体类型。loop(p,I->p) 中I是指向喷口类型Injection的指针,l->p代表喷口的第一个颗粒,然后loop(p,I->p) 就是对I喷口中所有颗粒进行循环。mw = MATERIAL_PROP(sp,PROP_mwi); 就是取得物种sp的分子量,sp是混合物中第i个物种。*n = 0;中用指针应该是个人喜好问题。就是为了改变实参count的值而已。if(THREAD_ID(C_FACE_THREAD(c,t,i)) == s_id)就是判断网格c的第i个面的ID号是不是等于s_id。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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