|
|

楼主 |
发表于 2003-4-23 14:36:13
|
显示全部楼层
UDF问题请教!!
这是udf文件的源程序,各位大侠看看有什么问题
#include "udf.h"
DEFINE_UDS_FLUX(my_uds_flux, f, t, i)
{ Thread *t0=NULL;
Thread *t1 = NULL; /*定义线*/
cell_t c0, c1 = -1; /*定义单元*/
real NV_VEC(psi_vec), NV_VEC(A); /*定义矢量*/
/* neighboring cells of face f, and their (corresponding) threads */
/*面f的邻近单元和相关的线*/
t0 = F_C0_THREAD(f,t0);
c0 = F_C0(f,t);
if (NULL != F_C1_THREAD(f,t))
/* Alternative: if (! BOUNDARY_FACE_THREAD_P(t)) */
{ t1 = F_C1_THREAD(f,t);
c1 = F_C1(f,t);
}
else
{ t1 = NULL;
c1 = -1;
}
/* If Face lies at domain boundary, use face values; 假如面在计算边界,用面值*/
/* If Face lies IN the domain, use average of adjacent cells. 假如面在计算区域内,用邻近单元的平均值*/
if (NULL == t1)
/* Alternative: if (BOUNDARY_FACE_THREAD_P(t)) */
{ NV_D(psi_vec, =, F_U(f,t), F_V(f,t), F_W(f,t));
NV_S(psi_vec, *=, F_R(f,t));
}
else
{ NV_D(psi_vec, =, C_U(c0,t0), C_V(c0,t0), C_W(c0,t0));
NV_D(psi_vec, +=, C_U(c1,t1), C_V(c1,t1), C_W(c1,t1));
NV_S(psi_vec, /=, 2.); /* averaging. */
NV_S(psi_vec, *=, (((C_R(c0,t0) + C_R(c1,t1)) / 2.)));
}
/* Now psi_vec contains our "psi" from above. 现在psi_vec包含了我们的"psi"*/
/* Next, get the face normal vector: 下一步,得到面的法向矢量*/
F_AREA(A, f, t);
/* Finally, return the dot product of both. 最后返回两者的点积 */
/* Fluent will multiply the returned value 将乘以返回值*/
/* by phi_f (the scalar's value at the face) 用phi_f*/
/* to get the "complete" advective term... 得到完全的对流项*/
return NV_DOT(psi_vec, A);
}
|
|