|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
UDF帮助文件4.3.19小节中 DEFINE_UDS_FLUX 的例子编译有错,请问
为什么会有这样的错误?
/**********************************************************************
UDF that implements a simplified advective term in the
scalar transport equation
***********************************************************************/
#include "udf.h"
DEFINE_UDS_FLUX(my_uds_flux, f, t, i)
{
Thread *t0, *t1 = NULL;
cell_t c0, c1 = -1;
real NV_VEC(psi_vec), NV_VEC(A);
/* neighboring cells of face f, and their (corresponding) threads */
t0 = THREAD_T0(f,t);
c0 = F_C0(f,t);
if (NULL != THREAD_T1(f,t))
/* Alternative: if (! BOUNDARY_FACE_THREAD_P(t)) */
{
t1 = THREAD_T1(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. */
/* 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) */
/* to get the "complete" advective term... */
return NV_DOT(psi_vec, A);
}
[DISABLELBCODE] |
|