24小时热门版块排行榜    

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

leixiaobo713

银虫 (正式写手)

[求助] fluent中UDF编译的问题!

本人想编的程序是这样的:
材料是有初始温度的,而且初始温度为X(X轴坐标)的函数;模拟开始后,在很短时间内材料的温度将发生变化,变化的温度为初始温度的函数,在一定时间后(上面提到的很短时间),材料的温度仅随流体的流动而自然发生变化,没有再生热源。我变得程序是这样的,虽然能编译,但是模拟一开始就出现错误,请高手指点,本人是小白,谢谢!

#include "udf.h"
DEFINE_PROFILE(unsteady_temperature,thread,position)
{
real t, temperature;
face_t f;
real x;
begin_f_loop(f,thread)
{
t=RP_Get_Real("flow-time";
if(t<=0.000000001)
{temperature=325.0-0.115*x;
F_PROFILE(f,thread,position) =temperature+(297.68625-7.37218/(1+exp((temperature-299.65187)/7.97379)));
}
else
F_PROFILE(f,thread,position) =temperature;
}
end_f_loop(f,thread);
}
模拟出现的错误提示:
Updating solution at time level N... done.
  iter continuity x-velocity y-velocity     energy     time/iter
chip-exec: unsteady_temperature: wrong return type: float udf function expectedchip-exec: unsteady_temperature: argument 1: incorrect type (36): int expectedchip-exec: unsteady_temperature: argument 2: incorrect type (5): pointer expected
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: ()
回复此楼

» 猜你喜欢

» 本主题相关商家推荐: (我也要在这里推广)

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

天道酬勤!
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

leixiaobo713

银虫 (正式写手)

#include "udf.h"
DEFINE_PROFILE(unsteady_temperature,thread,position)
{
real t, temperature=298.0;
face_t f;
real x[ND_ND];
F_CENTROID(x,f,thread);
begin_f_loop(f,thread)
  {
    t=RP_Get_Real("flow-time";
      if(t>0&&t<=0.1)
         F_PROFILE(f,thread,position)=temperature;
      else if(t>=0.1&&t<0.4)
         {
           temperature=298.0+5*x[1];
           F_PROFILE(f,thread,position) =temperature+(297.68625-7.37218/(1+exp((temperature-299.65187)/7.97379)));
         }
      else
         {
           temperature=F_PROFILE(f,thread,position);
           F_PROFILE(f,thread,position) =temperature;
         }
  }
end_f_loop(f,thread);
}
我改成这样,还是上面的问题啊,请指教!

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: ()
天道酬勤!
4楼2013-09-04 11:13:42
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 12 个回答

fangdian

木虫 (正式写手)

【答案】应助回帖

★ ★
感谢参与,应助指数 +1
xiegangmai: 金币+2, 谢谢参与! 2013-09-08 22:06:42
是不是温度没有赋初值?如果t<=0.000000001条件达不到temperature等于多少呢??还有,即使满足t<=0.000000001,那么x值为多少?x不知道的话,温度也确定不了了啊

» 本帖已获得的红花(最新10朵)

2楼2013-09-04 08:41:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

leixiaobo713

银虫 (正式写手)

送红花一朵
引用回帖:
2楼: Originally posted by fangdian at 2013-09-04 08:41:46
是不是温度没有赋初值?如果t<=0.000000001条件达不到temperature等于多少呢??还有,即使满足t<=0.000000001,那么x值为多少?x不知道的话,温度也确定不了了啊

对,你说的很对,这个赋初值以及对X的定义我的确不知道怎么办,希望你能给点指点,谢谢!
天道酬勤!
3楼2013-09-04 09:11:56
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

转石千仞

金虫 (正式写手)

击破长空

【答案】应助回帖

★ ★
感谢参与,应助指数 +1
xiegangmai: 金币+2, 鼓励讨论交流! 2013-09-08 22:06:50
将F_CENTROID(x,f,thread);放到begin_f_loop(f,thread)里面。
另外,你的这两句:
    temperature=F_PROFILE(f,thread,position);
           F_PROFILE(f,thread,position) =temperature;
其中第一句,是没有用的。应该去掉。
故善战人之势,如转圆石于千仞之山者,势也
5楼2013-09-04 12:40:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 268求调剂 +7 好运连绵不绝 2026-03-12 8/400 2026-03-17 20:28 by xilongliang
[考研] 材料专硕326求调剂 +6 墨煜姒莘 2026-03-15 7/350 2026-03-17 17:10 by ruiyingmiao
[考研] 293求调剂 +6 世界首富 2026-03-11 6/300 2026-03-17 17:04 by ruiyingmiao
[考研] 26考研求调剂 +6 丶宏Sir 2026-03-13 6/300 2026-03-17 16:13 by 醉在风里
[考研] 0854可跨调剂,一作一项核心论文五项专利,省、国级证书40+数一英一287 +3 小李0854 2026-03-16 3/150 2026-03-17 13:40 by 热情沙漠
[考研] 289求调剂 +6 步川酷紫123 2026-03-11 6/300 2026-03-17 10:23 by Sammy2
[考研] 278求调剂 +3 Yy7400 2026-03-13 3/150 2026-03-17 08:24 by laoshidan
[基金申请] 国自科面上基金字体 +6 iwuli 2026-03-12 7/350 2026-03-16 21:18 by sculhf
[考研] 333求调剂 +3 文思客 2026-03-16 7/350 2026-03-16 18:21 by 文思客
[考研] 327求调剂 +6 拾光任染 2026-03-15 11/550 2026-03-15 22:47 by 拾光任染
[考研] 材料工程327求调剂 +3 xiaohe12w 2026-03-11 3/150 2026-03-14 20:20 by ms629
[考研] 复试调剂 +3 呼呼?~+123456 2026-03-14 3/150 2026-03-14 16:53 by WTUChen
[考研] 材料与化工(0856)304求B区调剂 +6 邱gl 2026-03-12 7/350 2026-03-13 23:24 by 邱gl
[考研] 333求调剂 +3 球球古力 2026-03-11 3/150 2026-03-13 21:27 by JourneyLucky
[考研] 329求调剂 +3 miaodesi 2026-03-12 4/200 2026-03-13 20:53 by 18595523086
[考研] 307求调剂 +5 超级伊昂大王 2026-03-12 5/250 2026-03-13 15:56 by 棒棒球手
[考研] 工科材料085601 279求调剂 +8 困于星晨 2026-03-12 10/500 2026-03-13 15:42 by ms629
[考研] 277求调剂 +4 anchor17 2026-03-12 4/200 2026-03-13 11:15 by 白夜悠长
[考研] 化工学硕306求调剂 +9 42838695 2026-03-12 9/450 2026-03-13 10:16 by houyaoxu
[考研] 290求调剂 +3 柯淮然 2026-03-10 8/400 2026-03-11 13:48 by 柯淮然
信息提示
请填处理意见