|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
大家好,我的代码如下,出问题的是下面红色的五个地方,错误为:
..\..\src\udfsource1.c(28) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource1.c(28) : error C2059: syntax error : ')'
..\..\src\udfsource1.c(29) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource1.c(29) : error C2059: syntax error : ')'
..\..\src\udfsource1.c(90) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource1.c(90) : error C2059: syntax error : ')'
..\..\src\udfsource1.c(91) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource1.c(91) : error C2059: syntax error : ')'
..\..\src\udfsource1.c(110) : error C2143: syntax error : missing ')' before ';'
..\..\src\udfsource1.c(110) : error C2143: syntax error : missing ';' before ','
..\..\src\udfsource1.c(110) : error C2059: syntax error : ')'
其他没有报错。
我的机器是win7 64bit 系统,装的是ansys 12.1.4,用的方法是fluent技术支持提供的方法:
visual studio 2010 express edition+windows SDK 7.0+.net framwork 3.5 sp1,从SDK7.0里面打开命令,我确定那个dos界面显示的是x64,而不是ntx86,说明是64位的,之后打开fluent无误,可是compile udf就出现上面的问题。
请问我是否需要手动添加lib.libpath,path,include这四个环境变量?
有人说这类errors是因为在定义变量之前有其他非定义的语句,可是我已经排除了这个情况,不知道还有什么别的原因么?谢谢!
呼唤gearboy大牛解答下问题,谢谢!~~~
#include "udf.h"
#include "mem.h"
#include "unsteady.h"
#define inlet_ID 12;
#define filter_ID 2;
real source;
real tepflowrate;
real vol_tot;
face_t f;
cell_t c;
DEFINE_ADJUST(adjust, d)
{
#if !RP_HOST
int i=0;
/* real A[ND_ND]; */
/* real flux[ND_ND]; */
real NV_VEC(flux);
real NV_VEC(A); /* declaring vectors flux and A */
/* real source; */
real massflowrate=0.;
real vol=0.;
/* real ti = RP_Get_Real("flow-time"); */ /* ti = CURRENT_TIME;*/
Thread *t;
Thread *thread;
thread=Lookup_Thread(d,filter_ID); /* defining the filter volume thread by specifying the Zone_ID*/
t=Lookup_Thread(d,inlet_ID); /* defining the inlet surface thread by specifying the Zone_ID*/
/* Send the ID value to all the nodes */
/* host_to_node_real_4(f, t, c, thread);Does nothing in serial, t is the thread of inlet surface, thread is the thread of the filter volume */
/*Start to calculate the mass flow rate through the inlet surface and store it in UDM*/
/* begin_f_loop(f,t) */
if PRINCIPAL_FACE_P(f,t) /* tests if the face is the principle face FOR COMPILED UDFs ONLY */
{
NV_D(flux, =, F_U(f,t), F_V(f,t), F_W(f,t)); /* defining flux in terms of velocity field */
NV_S(flux, *=, F_R(f,t)); /* multiplying density to get flux vector */
F_AREA(A,f,t); /* face normal vector returned from F_AREA */
massflowrate = F_YI(f,t,i)*NV_DOT(flux,A); /* dot product of the inlet surface flux and area vector, multiplied by the mass fraction of species i */
}
/* end_f_loop(f,t) */
# if RP_NODE /* Perform node synchronized actions here, Does nothing in Serial */
massflowrate = PRF_GRSUM1(massflowrate);
# endif /* RP_NODE */
begin_f_loop(f,t)
if PRINCIPAL_FACE_P(f,t) /* tests if the face is the principle face FOR COMPILED UDFs ONLY */
{
F_UDMI(f, t, 0)= massflowrate; /* YOU MAY NEED TO CHECK THE NODE AS THE SUMMED UP VALUE OF massflowrate IS DONE AT node0. */
}
end_f_loop(f,t)
/*Start to calculate the total volume of filter volume and store it in UDM */
begin_c_loop(c,thread)
{
vol += C_VOLUME(c,thread); /* get cell volume */
}
end_c_loop(c,thread)
#if RP_NODE /* Perform node synchronized actions here, Does nothing in Serial */
vol= PRF_GRSUM1(vol);
# endif /* RP_NODE */
begin_c_loop(c,thread)
{
C_UDMI(c, thread, 1)= vol; /* YOU MAY NEED TO CHECK THE NODE AS THE SUMMED UP VALUE OF massflowrate IS DONE AT node0. */
}
end_c_loop(c,thread)
#endif /* !RP_HOST */
}
DEFINE_SOURCE(cell_SO2mass_source, c, thread, dS, eqn)
{
#if !RP_HOST
/* int i; */
/* real A[ND_ND]; */
/* real flux[ND_ND]; */
/* real NV_VEC(flux); */
/* real NV_VEC(A); */ /* declaring vectors flux and A */
real ti = RP_Get_Real("flow-time"); /* ti = CURRENT_TIME;*/
Domain *d = Get_Domain(1);
Thread *t;
/* Thread *thread; */
thread=Lookup_Thread(d,filter_ID); /* defining the filter volume thread by specifying the Zone_ID*/
t=Lookup_Thread(d,inlet_ID); /* defining the inlet surface thread by specifying the Zone_ID*/
/* face_t f; */
/* #endif */ /* !RP_HOST */
/* #if !RP_HOST */
tepflowrate= F_UDMI(f, t, 0);
vol_tot = C_UDMI(c, thread, 1);
#endif /* !RP_HOST */
/* Pass the node's SO2 mass flow rate and volume to the Host for calculating source */
node_to_host_real_2(tepflowrate, vol_tot); /* Does nothing in SERIAL */
#if !RP_NODE /* SERIAL or HOST */
source=-0.999989*tepflowrate/vol_tot;
dS[eqn]=0.0;
return source;
Message("Sink Rate in Filter %d is %f (kg/m^3/s)\n",filter_ID,source);
#endif /* !RP_NODE */
}
[ 本帖最后由 aleisia 于 2011-6-21 20:58 编辑 ] |
|