24小时热门版块排行榜    

Znn3bq.jpeg
查看: 1748  |  回复: 16
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

xiaoguai3

新虫 (初入文坛)

[求助] 新手求教UDF问题~

能解释,但一添加到边界或初始化就报错。
Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: ()

我的UDF如下,二维模型,简单的固体传热问题,想在模拟过程的同时累加整个固体区域的所有得热量,达到一定值后改变热流边界值。由于刚接触UDF不久,不知道问题出在何处。请指教!d= Get_Domain(1);这个语句有问题吗?
#include "udf.h"
real Q_tot=0;
DEFINE_PROFILE (unsteady_heatflux, thread, position)
{
Domain *d;
real cp=880;
real density=2180;
real tempn, templ, volume, Q;
Thread *t;
cell_t c;
d= Get_Domain(1); /*Get the domain using Fluent utility *//*Loop over all cell threads in the domain*/
thread_loop_c(t,d) /*Compute Q */ /*Loop over all cells */
begin_c_loop(c,t)
{
real time= RP_Get_Real("flow-time";
real b=(int)(time/3600)+1;
int i=(int)((b-1)/24);
real Heat[3]={278.5, 280.7, 278.5};
volume=C_VOLUME(c,t); /* get cell volume */
templ=C_T_M1(c,t); /*Get cell tempertuare of previous step*/
tempn=C_T(c,t); /*Get cell tempertuare*/
Q=cp*density*volume*(tempn-templ);
Q_tot +=Q;
if (Q_tot<= Heat )
F_PROFILE(c,t,position)=60;
else F_PROFILE(c,t,position)=0;
}
end_c_loop(c,t)
}
回复此楼

» 本帖@通知

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xiaoguai3

新虫 (初入文坛)

引用回帖:
3楼: Originally posted by kylafree at 2012-01-04 22:06:24:
real Q_tot=0;
real Heat[3]={278.5, 280.7, 278.5};

if (Q_tot<= Heat )
这里是一个数组和一个数在比大小吗?

不好意思,是这样的
CODE:
#include "udf.h"
real Q_tot=0;
DEFINE_PROFILE (unsteady_heatflux, thread, position)
{
Domain *d;
real cp=880;
real density=2180;
real tempn, templ, volume, Q;
Thread *t;
cell_t c;
d= Get_Domain(1); /*Get the domain using Fluent utility *//*Loop over all cell threads in the domain*/
thread_loop_c(t,d) /*Compute Q */ /*Loop over all cells */
begin_c_loop(c,t)
{
real time= RP_Get_Real("flow-time";
real b=(int)(time/3600)+1;
int i=(int)((b-1)/24);
real Heat[3]={278.5, 280.7, 278.5};
volume=C_VOLUME(c,t); /* get cell volume */
templ=C_T_M1(c,t); /*Get cell tempertuare of previous step*/
tempn=C_T(c,t); /*Get cell tempertuare*/
Q=cp*density*volume*(tempn-templ);
Q_tot +=Q;
if (Q_tot<= Heat[i] )
F_PROFILE(c,t,position)=60;
else F_PROFILE(c,t,position)=0;
}
end_c_loop(c,t)
}

7楼2012-01-04 22:52:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 17 个回答

wuming524

专家顾问 (著名写手)

石化蛀虫

【答案】应助回帖


感谢参与,应助指数 +1
xiegangmai(金币+1): 谢谢参与! 2012-01-04 22:45:44
楼主太抬举俺了,出现这种问题你需要检查你的语句,大多出现调用无效语句出现的错误。本人也不是太懂。待高人解答吧~好运。
2楼2012-01-04 22:06:19
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

kylafree

至尊木虫 (知名作家)

【答案】应助回帖


感谢参与,应助指数 +1
xiegangmai(金币+1): 鼓励讨论交流! 2012-01-04 22:45:54
real Q_tot=0;
real Heat[3]={278.5, 280.7, 278.5};

if (Q_tot<= Heat )
这里是一个数组和一个数在比大小吗?
3楼2012-01-04 22:06:24
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xiaoguai3

新虫 (初入文坛)

引用回帖:
3楼: Originally posted by kylafree at 2012-01-04 22:06:24:
real Q_tot=0;
real Heat[3]={278.5, 280.7, 278.5};

if (Q_tot<= Heat )
这里是一个数组和一个数在比大小吗?

不好意思打错了,是if (Q_tot <= Heat )
Q_tot是得热之和,由下求得
Q=cp*density*volume*(tempn-templ);
Q_tot +=Q;
4楼2012-01-04 22:15:32
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 22408 312求调剂 +21 门路摸摸 2026-04-14 22/1100 2026-04-16 10:51 by 阿文超
[考研] 化学070300 求调剂 +25 哈哈哈^_^ 2026-04-12 25/1250 2026-04-16 10:47 by Espannnnnol
[考研] 294求调剂 +11 淡然654321 2026-04-15 11/550 2026-04-16 10:23 by beilsong20
[考研] 297,工科调剂? +3 河南农业大学-能 2026-04-14 3/150 2026-04-15 22:02 by noqvsozv
[考研] 求助调剂,跨调 +19 X十甫寸Y 2026-04-11 20/1000 2026-04-15 21:18 by cuisz
[考研] 一志愿西交机械专硕求调剂 +9 求上岸的小王 2026-04-10 9/450 2026-04-13 16:08 by jiangguiquan11
[考研] 297工科,求调剂? +13 河南农业大学-能 2026-04-12 13/650 2026-04-13 14:12 by dingyanbo1
[考研] 求调剂288 +7 ioodiiij 2026-04-10 9/450 2026-04-13 08:33 by Hayaay
[考研] 求调剂 +16 张番茄不炒蛋 2026-04-10 17/850 2026-04-12 13:58 by 熬夜成!
[考研] 一志愿西北工业大学289 085602 +33 yang婷 2026-04-10 34/1700 2026-04-12 08:11 by Art1977
[考研] 303求调剂 +14 SereinQ 2026-04-10 15/750 2026-04-11 20:43 by 蓝云思雨
[考研] 调剂 +6 青灯不负 2026-04-09 6/300 2026-04-11 20:35 by dongdian1
[考研] 283求调剂 086004考英二数二 +17 那个噜子 2026-04-10 18/900 2026-04-11 16:27 by 明月此时有
[考研] 085501机械专硕 302分 不挑专业求调剂 +7 汪某. 2026-04-09 7/350 2026-04-11 14:37 by luhong1990
[考研] 085600材料与化工329分求调剂 +16 叶zilin 2026-04-10 16/800 2026-04-11 11:04 by may_新宇
[考研] 085410-273求调剂 +6 X1999 2026-04-10 6/300 2026-04-11 10:32 by Delta2012
[考研] 346,工科求调剂 +3 moser233 2026-04-09 3/150 2026-04-11 10:04 by zhq0425
[考研] 342电子信息专硕求调剂 +9 你让我怎么荔枝 2026-04-10 10/500 2026-04-11 08:33 by zhq0425
[考研] 化学工程与技术324调剂 +23 孙常华 2026-04-09 25/1250 2026-04-11 00:07 by 骑牛渡寒江
[考研] 263能源动力专硕求调剂 +3 加大号饭盒袋 2026-04-10 3/150 2026-04-10 22:23 by 286640313
信息提示
请填处理意见