FLUENT中udf的程序编译为什么总是出现parse error?

如题,我的代码如下,请高手指教。谢谢!我想输入一个二维边界条件x=0.001[0.9cos(0.3t)+0.006sin(0.3t)]y=0.001[0.8cos(0.3... 如题,我的代码如下,请高手指教。谢谢!我想输入一个二维边界条件
x=0.001[0.9cos(0.3t)+0.006sin(0.3t)]
y=0.001[0.8cos(0.3t)+0.003sin(0.3t)]

#include "udf.h"

/* profile for x-velocity */

DEFINE_PROFILE(inlet_x_velocity, thread, nv)
{
face_t f;
begin_f_loop(f, thread)
{
real t=RP_Get_Real("flow-time");
F_PROFILE(f, thread, nv)=.001*(.9*cos(.3*t)+.006sin(.3*t));
}
end_f_loop(f, thread)
}

/* profile for y-velocity */

DEFINE_PROFILE(inlet_y_velocity, thread, nv)
{
face_t f;
begin_f_loop(f, thread)
{
real t=RP_Get_Real("flow-time");
F_PROFILE(f, thread, nv)=.001*(.8*cos(.3*t)+.003sin(.3*t));
}
end_f_loop(f, thread)
}

编译时提示F_PROFILE(f, thread, nv)=.001*(.9*cos(.3*t)+.006sin(.3*t));这行parse error。我是第一编这个,请各位指教。
展开
 我来答
395678394
2012-04-06
知道答主
回答量:9
采纳率:0%
帮助的人:9.8万
展开全部
高手帮我也看一下,我抄的教程上的程序,编译也出现语法错误,求指教!
#include "udf.h"

static real viscosity_0;

DEFINE_INIT(melt_setup, domain)
{
/* if memory for the particle variable titles has not been
* allocated yet, do it now */

if (NULLP(user_particle_vars)) Init_User_Particle_Vars();

/* now set the name and label */

strcpy(user_particle_vars[0].name,"melting-index");
strcpy(user_particle_vars[0].label,"Melting Index");
}

/* update the user scalar variables */

DEFINE_DPM_SCALAR_UPDATE(melting_index, cell, thread, initialize, p)
{
cphase_state_t *c = &(p->cphase);
if (initialize)
{
/* this is the initialization call, set:
* p->user[0] contains the melting index, initialize to 0
* viscosity_0 contains the viscosity at the start of a time step*/

p->user[0] = 0.;
viscosity_0 = c->mu;
}

else
{
/* use a trapezoidal rule to integrate the melting index */
p->user[0] += P_DT(p) * .5 * (1/viscosity_0 + 1/c->mu);

/* save current fluid viscosity for start of next step */
viscosity_0 = c->mu;
}
}

/* write melting index when sorting particles at surfaces */
DEFINE_DPM_OUTPUT(melting_output, header, fp, p, thread, plane)
{
char name[100];

if (header)
{
if (NNULLP(thread))
cxprintf(fp,"(%s %d)\n",thread->head->dpm_summary.sort_file_name,11);
else
cxprintf(fp,"(%s %d)\n",plane->sort_file_name,11);
cxprintf(fp,"(%10s %10s %10s %10s %10s %10s %10s"
" %10s %10s %10s %10s %s)\n",
"X","Y","Z","U","V","W","diameter","T","mass-flow",
"time","melt-index","name");
}
else
{
sprintf(name,"%s:%d",p->injection->name,p->part_id);
cxprintf(fp,
"((%10.6g %10.6g %10.6g %10.6g %10.6g %10.6g "
"%10.6g %10.6g %10.6g %10.6g %10.6g) %s)\n",
p->state.pos[0], p->state.pos[1], p->state.pos[2],
p->state.V[0], p->state.V[1], p->state.V[2],
p->state.diam, p->state.temp, p->flow_rate, p->state.time,
p->user[0], name);
}
}
百度网友b332979
2010-04-02 · TA获得超过219个赞
知道答主
回答量:14
采纳率:0%
帮助的人:27.7万
展开全部
0.006sin(0.3*t),很明显的语法错误,应该是:0.006*sin(0.3*t)才对
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式