找回密码
 注册
查看: 2373|回复: 0

udf help的DEFINE_UDS_FLUX源代码,为何编译出错,请达人指教

[复制链接]
发表于 2009-5-12 16:28:52 | 显示全部楼层 |阅读模式

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

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

x
采用uds方程模拟单相流某标量输运,根据help说明单相流的Flux Function应采用自定义DEFINE_UDS_FLUX,复制了udf help的源代码,Interpreted UDFs的时候却出现
cpp -IE:\PROGRA~1\Fluent.Inc\fluent6.2.16/src -IE:\PROGRA~1\Fluent.Inc\fluent6.2.16/cortex/src -IE:\PROGRA~1\Fluent.Inc\fluent6.2.16/client/src -IE:\PROGRA~1\Fluent.Inc\fluent6.2.16/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" E:\ep\flux_func.c
E:\ep\flux_func.c:12: macro `THREAD_T0' used with too many (2) args

把THREAD_T0,THREAD_T1的参数由(f,t)改为(t)后,Interpreted可以通过,但是一计算就出错。

恳求达人指点迷津,最好能提供正确的DEFINE_UDS_FLUX代码,谢谢。

以下是复制的源代码:
#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);
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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