1

我正在为我的 ANSYS 项目编写 UDF 文件,它使用 c 文件

我试图将 c 文件解释到我的工作台中,但出现以下错误,

“第 6 行:解析错误。”

下面是我写的代码

#include "udf.h"

#define Cd 0.2 /* usually between 0.1 - 0.3 ; lambda = Cd * LAD */ 
#define LAD 2.0

real A1t = 1.0; /* Betap */
real A2t = 5.1; /* Betad */
real A3t = 0.9; /* closure constant cepsilon4 */ 
real A4t = 0.9; /* closure constant cepsilon5 */

DEFINE_SOURCE(xmom_source,c,t,dS,eqn)
{
real x[ND_ND]; 
real source;
real U = C_U(c,t);
real V = C_V(c,t);
real W = C_W(c,t);
real VEL = sqrt(C_U(c,t)*C_U(c,t)+C_V(c,t)*C_V(c,t)+C_W(c,t)*C_W(c,t)); 
real k = C_K(c,t);
real e = C_D(c,t);
real rho = C_R(c,t);
C_CENTROID(x,c,t);

source = -Cd*LAD*rho*VEL*U;
dS[eqn] = -Cd*LAD*rho*(U*U/VEL + VEL);
return source;
}

4

0 回答 0