24小时热门版块排行榜    

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

for_the_king

新虫 (小有名气)


【答案】应助回帖

网上有个现成的 你先参考下
11楼2013-09-10 09:42:39
已阅   回复此楼   关注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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 今天系统多次维护,明天很可能放榜! +5 zju2000 2026-08-16 5/250 2026-08-16 23:23 by Haru815
[论文投稿] 岩土工程学报什么时候才能终审完呐 25+3 yeager111 2026-08-10 4/200 2026-08-16 20:42 by tfang
[基金申请] 快农历七夕节了,轻松一下,男人悄悄话,女施主请不要进来。 +3 Tide man 2026-08-14 3/150 2026-08-16 17:47 by jurkat.1640
[基金申请] 哪位老哥知道今年的国自然具体哪一天放榜? +9 Ldrop2023 2026-08-13 9/450 2026-08-16 13:24 by wukun_007
[基金申请] 咱们一起用铁证分析2026国家社科基金中标与否 +7 启萌科技 2026-08-12 26/1300 2026-08-16 12:35 by 启萌科技
[基金申请] 我的国基提前知道中了,可是同事的操作让我实在接受不了,怎么会有这样的人 +11 家与远方 2026-08-10 16/800 2026-08-16 10:28 by ray43
[基金申请] 有时候,自然基金真的不能太认真 (我的申报经验) +10 majunge000 2026-08-11 12/600 2026-08-16 08:18 by xli1984
[精细化工] 招聘 金属平磨液,抛光液研发工程师 +3 小天0311 2026-08-14 3/150 2026-08-16 07:31 by H9PLUS
[基金申请] filecode +8 cratir 2026-08-14 12/600 2026-08-15 18:08 by zyfgau
[基金申请] 小木虫上这么多卖论文的,真有人买论文么?感觉没必要啊 +12 Tide man 2026-08-10 13/650 2026-08-15 16:34 by 氺木
[基金申请] 关于Filecode分析方法 +10 majunge000 2026-08-10 13/650 2026-08-15 12:26 by hanpeng972
[基金申请] 各位道友,我要去昆明玩几天,回来见。 +7 Tide man 2026-08-14 8/400 2026-08-15 01:11 by arzu_hma
[基金申请] filecode +15 documentary 2026-08-10 17/850 2026-08-14 10:08 by kissu88
[基金申请] FileCode能看出啥? +10 要乐观耀哥 2026-08-10 32/1600 2026-08-14 09:37 by 要乐观耀哥
[基金申请] 静等基金结果 +8 gjjjzhong 2026-08-10 21/1050 2026-08-13 17:56 by 且听虎啸
[基金申请] 重要来源:本周末出结果 +10 瞬息宇宙 2026-08-12 10/500 2026-08-13 15:46 by likettle
[基金申请] 不应该看fileCode +7 且听虎啸 2026-08-12 9/450 2026-08-13 14:27 by flydreamws
[基金申请] 结合人工智能,周易传统文化,filecode打分制来了,3分以上希望很大。 +3 Tide man 2026-08-12 4/200 2026-08-13 08:35 by ZJTJZ
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +11 Tide man 2026-08-11 11/550 2026-08-13 07:35 by 撸猫猫
[基金申请] 什么时候出结果,有咨询渠道??? +3 Tide man 2026-08-11 3/150 2026-08-11 17:54 by kudofaye
信息提示
请填处理意见