|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
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;
} |
|