24小时热门版块排行榜    

查看: 1396  |  回复: 0

pjhust

新虫 (初入文坛)

[求助] fluent中UDF设定边界条件,导入出错

最近在做一个fluent模拟,需要设定非稳态边界条件,写了一个UDF程序如下,导入fluent里面时,出现:
Error: C:\Users\\305\313\346\257\Desktop\pexit2.c.c: line 18: parse error.
Error: C:\Users\\305\313\346\257\Desktop\pexit2.c.c: line 19: invalid lvalue in assignment.
的错误,但是鄙人实在找不出错误之处,所以请教各位大神(由于是新虫,总共只有5个金币,对不起各位了!)

UDF程序:


#include"udf.h"
#define r_1 20
#define r_2 15.4
#define a 0.77
#define w 418.879
#define H 18
#define t 3.2
#define m 1.2
#define p_s 587050
#define p_d 1980000
#define V_r pi*(pow(r_1,2)-pow(r_2,2))*H

DEFINE_PROFILE(unsteady_pressure,thread,position)
{
face_t f;
begin_f_loop(f,thread)
{
real t=RP_Get_Real("flow-time";
t=t-0.015*floor(t/0.015);
if(t<0.002083 && t>0)
   F_PROFILE(f,thread,position)=587050;
else if(t<=0.00845256 && t>=0.002083)
   real f_beta,h_beta,V_cbeta;
   f_beta=(1-pow(a,2))*418.879*t-0.5*pow((1-a),2)*sin(2.0*418.879*t)-pow(a,2)*asin((1.0/a-1)*sin(418.879*t))-a*(1-a)*sin(418.879*t)*pow((1-pow((1.0/a-1),2)*pow(sin(418.879*t),2)),0.5);
   h_beta=r_1*(1-(1-a)*cos(418.879*t)-sqrt(pow((1-a),2)*pow(cos(418.879*t),2)+2*a-1));
   V_cbeta=V_r-0.5*H*(pow(r_1,2)*f_beta+h_beta*t);

   F_PROFILE(f,thread,position)=587050*pow((8932/V_cbeta),1.2);

else if(t<=0.01375 && t>0.00854256)
   F_PROFILE(f,thread,position)=2144045.39-45844.5044*418.879*t;
else if(t<=0.0141667 && t>0.01375)
   F_PROFILE(f,thread,position)=44548090.82-3103131857*t;
else if(t<=0.015 && t>0.0146667)
   F_PROFILE(f,thread,position)=587050;
}
end_f_loop(f,thread)
}
DEFINE_PROFILE(unsteady_temperature,thread,position)
{
face_t f;
begin_f_loop(f,thread)
{
real t=RP_Get_Real("flow-time";
t=t-0.015*floor(t/0.015);
if(t<0.002083 && t>0)
   F_PROFILE(f,thread,position)=308.15;
else if(t<=0.00854256 && t>=0.002083)
  
   F_PROFILE(f,thread,position)=308.15*pow(587050*pow((8932/V_cbeta),1.2)/587050,0.16667);

else if(t<=0.01375 && t>0.00854256)
   F_PROFILE(f,thread,position)=308.15*pow((2144045.39-45844.5044*418.879*t)/587050,0.16667);
else if(t<=0.0141667 && t>0.01375)
   F_PROFILE(f,thread,position)=308.15*pow((44548090.82-3103131857*t)/587050,0.16667);
else if(t<=0.015 && t>0.0141667)
   F_PROFILE(f,thread,position)=308.15;
}
end_f_loop(f,thread)
}
回复此楼
前进
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

找到一些相关的精华帖子,希望有用哦~

科研从小木虫开始,人人为我,我为人人
相关版块跳转 我要订阅楼主 pjhust 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 为什么资助数各大高校都创新高,自己申请怎么就这么难 +5 Kittylucky 2026-08-27 5/250 2026-08-27 12:10 by 姜太公烤鱼
[基金申请] 怎么看青基中了没有啊 +5 叶九微 2026-08-26 5/250 2026-08-27 10:35 by l_zh2008
[基金申请] 面上合作单位盖章 +3 ssyjh 2026-08-27 3/150 2026-08-27 09:59 by 阿拉贡aragon
[教师之家] 售SCI一区文章,我:8.O.551.O.5.4,科目全,可伽急 +3 LIbGuocjEEYw 2026-08-26 4/200 2026-08-27 04:33 by Ie9AyIAvGbvs
[硕博家园] 售SCI一区T0P文章,我:8.O.55.1.O.54,科目齐全,可+急 +3 LIbGuocjEEYw 2026-08-26 4/200 2026-08-27 02:01 by Ie9AyIAvGbvs
[基金申请] 我不理解! +15 Edward_pc 2026-08-26 23/1150 2026-08-26 20:34 by zzuzxg
[基金申请] 范进中举一文的中心思想 +9 炎黄贵胄 2026-08-22 10/500 2026-08-26 15:40 by semaglutide
[基金申请] 2026国自然函评费到账 +22 羊腰板 2026-08-21 25/1250 2026-08-26 15:00 by zuocuiping
[基金申请] 2026年8月25日国自然放榜前突然收到列入评审专家邮件,有关系吗? +25 木水思豆 2026-08-25 28/1400 2026-08-26 14:53 by draco1987
[基金申请] 为什么国自然不能直接公布 +4 bjdxyxy 2026-08-26 4/200 2026-08-26 13:12 by qingmu1201
[基金申请] 国合里面能看到了 +7 一怀馨秋 2026-08-26 7/350 2026-08-26 11:23 by zhaosm1982
[基金申请] 国际合作可查了,中了面上 +18 Ldrop2023 2026-08-26 18/900 2026-08-26 11:15 by cmrandy
[基金申请] 国合可查了 +3 paperzjh 2026-08-26 3/150 2026-08-26 10:41 by LemmonTr
[基金申请] 今天务委会开完了,明天出结果吗 +19 angus9576 2026-08-25 23/1150 2026-08-26 10:03 by zp519
[基金申请] 国合现在查不到了吗? +10 chengyan1220 2026-08-24 20/1000 2026-08-26 08:57 by peasantsprig
[基金申请] 明天应该可查了!? +6 chengyan1220 2026-08-23 6/300 2026-08-25 19:45 by zfd97
[基金申请] 如果此刻你正在为国基感到焦虑,不妨来听听这首《基金之外》 +8 scalable 2026-08-24 8/400 2026-08-25 12:52 by jnhyjjm
[基金申请] 人气不行了 +11 fansofjerry 2026-08-21 11/550 2026-08-25 11:04 by 孤独的英雄6
[基金申请] 时间戳又变了 +13 wuchongjun 2026-08-20 19/950 2026-08-21 17:21 by 紫杉醇
[基金申请] 应该是下周三26日公布了吧? +4 哈哈蛤? 2026-08-21 4/200 2026-08-21 10:58 by Vivilian
信息提示
请填处理意见