24小时热门版块排行榜    

查看: 3559  |  回复: 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的回帖

死天

专家顾问 (著名写手)

【答案】应助回帖

先face_t f;然后real

不提供热源就赋值为0
9楼2013-09-09 16:19:41
已阅   回复此楼   关注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的回帖

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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 0703化学调剂 ,六级已过,有科研经历 +8 曦熙兮 2026-03-15 8/400 2026-03-17 20:31 by xilongliang
[考研] 341求调剂 +5 捣蛋猪猪 2026-03-11 7/350 2026-03-17 19:09 by 捣蛋猪猪
[考研] 328求调剂,英语六级551,有科研经历 +3 生物工程调剂 2026-03-16 8/400 2026-03-17 19:03 by Wangjingyue
[考研] 274求调剂0856材料化工 +13 z2839474511 2026-03-11 14/700 2026-03-17 16:51 by share_joy
[考研] 工科材料085601 279求调剂 +3 困于星晨 2026-03-17 3/150 2026-03-17 14:08 by ms629
[考研] 285化工学硕求调剂(081700) +9 柴郡猫_ 2026-03-12 9/450 2026-03-17 10:18 by Sammy2
[基金申请] 今年的国基金是打分制吗? 50+3 zhanghaozhu 2026-03-14 3/150 2026-03-16 17:07 by 北京莱茵润色
[考研] 285求调剂 +6 ytter 2026-03-12 6/300 2026-03-16 15:05 by njzyff
[考研] 070305求调剂 +3 mlpqaz03 2026-03-14 4/200 2026-03-15 11:04 by peike
[考研] 复试调剂 +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
[考研] 材料与化工求调剂一志愿 985 总分 295 +8 dream…… 2026-03-12 8/400 2026-03-13 22:17 by 星空星月
[考研] 求材料调剂 +5 隔壁陈先生 2026-03-12 5/250 2026-03-13 22:03 by 星空星月
[考研] [0860]321分求调剂,ab区皆可 +4 宝贵热 2026-03-13 4/200 2026-03-13 22:01 by 星空星月
[考研] 304求调剂 +7 7712b 2026-03-13 7/350 2026-03-13 21:42 by peike
[考研] 【考研调剂求收留】 +3 Ceciilia 2026-03-11 3/150 2026-03-13 20:18 by JourneyLucky
[考研] 材料工程调剂 +4 咪咪空空 2026-03-11 4/200 2026-03-13 19:57 by JourneyLucky
[考研] 材料301分求调剂 +5 Liyouyumairs 2026-03-12 5/250 2026-03-13 14:42 by JourneyLucky
[考研] 308求调剂 +3 是Lupa啊 2026-03-12 3/150 2026-03-13 14:30 by 求调剂zz
[考研] 277求调剂 +4 anchor17 2026-03-12 4/200 2026-03-13 11:15 by 白夜悠长
信息提示
请填处理意见