24小时热门版块排行榜    

查看: 1379  |  回复: 2

akqinmian

金虫 (小有名气)

[求助] fluent单机多核并行版本变化物性参数UDF求助

求教各位大侠,小弟写的随温度变化的材料参数和发热源项的UDF ,由于远程使用别人的工作站(没有装VC),单机单核用解释的方式导入没有问题,单机多核情况下总是报错,要不就是迭代开始就卡死,没反应。

求教各位,如果如何改写为并行版本? 小弟计算机底子不行,用户说明关于这部分的内容反复读也不太理解,帮助里也没有这样的例子。

#include "udf.h"
DEFINE_PROPERTY(vis, cell, thread)
{
real temperature, nd;
temperature = C_T(cell, thread);
{
if (temperature >=553.15 && temperature<=618.15)
nd=-0.0000000000116472*pow(temperature,3)+0.0000000203453*pow(temperature,2)-0.0000122063*temperature+0.00259719;
else if (temperature >618.15 && temperature<=632.15)
nd=-0.000000000069519*pow(temperature,3)+0.000000127294*pow(temperature,2)-0.0000780956*temperature+0.0161298;
else if (temperature >632.15 && temperature<=648.15)
nd=-0.000000000454378*pow(temperature,3)+0.000000861208*pow(temperature,2)-0.00054462*temperature+0.114982;
else if (temperature>648.15 && temperature<=656.55)
nd=-0.0000000130651*pow(temperature,3)+0.0000254502*pow(temperature,2)-0.0165263*temperature+3.57745;
else if (temperature>656.55 && temperature<=662.55)
nd=-0.0000000110287*pow(temperature,3)+0.0000221444*pow(temperature,2)-0.01482*temperature+3.30587;
else if (temperature>662.55 && temperature<=667.95)
nd=-0.0000000039237*pow(temperature,3)+0.00000786908*pow(temperature,2)-0.00526079*temperature+1.17243;
else if (temperature>667.95 && temperature<=674.35)
nd=-0.000000000571417*pow(temperature,3)+0.00000116031*pow(temperature,2)-0.000785453*temperature+0.177281;
else if (temperature>674.35 && temperature<=683.15)
nd=-0.000000000132212*pow(temperature,3)+0.0000002727*pow(temperature,2)-0.000187513*temperature+0.0430127;
else if (temperature>683.15 && temperature<=693.15)
nd=-0.0000000000362821*pow(temperature,3)+0.0000000763507*pow(temperature,2)-0.0000535492*temperature+0.0125458;
else if (temperature>693.15 && temperature<=765.15)
nd=-0.00000000000256198*pow(temperature,3)+0.00000000579822*pow(temperature,2)-0.00000433921*temperature+0.00110355;
else if (temperature>765.15 && temperature<=823.15)
nd=-0.000000000000214632*pow(temperature,3)+0.000000000530378*pow(temperature,2)-0.000000398162*temperature+0.000120633;
else
nd=0.0;
}
return nd;
#include "udf.h"
DEFINE_SOURCE(cell_y_source1,c, t, dS, eqn)
{
real source;
real x[ND_ND];
real z;
C_CENTROID(x, c, t);
z=x[2];
if(z>=0 && z<0.08)
source = 1.96617E+08;
else if(z>=0.08 && z<0.24)
source = 1.94500E+08;
else if(z>=0.24 && z<0.40)
source = 1.89151E+08;
else if(z>=0.40 && z<0.56)
source = 2.10398E+08;
else if(z>=0.56 && z<0.72)
source = 2.43178E+08;
else if(z>=0.72 && z<0.88)
source = 3.19465E+08;
else if(z>=0.88 && z<1.04)
source = 3.93218E+08;
else if(z>=1.04 && z<1.20)
source = 4.65868E+08;
else if(z>=1.20 && z<1.36)
source = 5.30883E+08;
else if(z>=1.36 && z<1.52)
source = 5.63514E+08;
else if(z>=1.52 && z<1.68)
source = 5.75473E+08;
else if(z>=1.68 && z<1.84)
source = 5.54165E+08;
else if(z>=1.84 && z<2.00)
source = 5.08562E+08;
else if(z>=2.00 && z<2.16)
source = 4.70529E+08;
else if(z>=2.16 && z<2.32)
source = 4.20242E+08;
else if(z>=2.32 && z<2.48)
source = 3.56882E+08;
else if(z>=2.48 && z<2.64)
source = 3.11648E+08;
else if(z>=2.64 && z<2.80)
source = 2.77573E+08;
else if(z>=2.80 && z<2.96)
source = 2.51141E+08;
else if(z>=2.96 && z<3.12)
source = 2.29009E+08;
else if(z>=3.12 && z<3.28)
source = 2.16346E+08;
else if(z>=3.28 && z<3.44)
source = 2.07810E+08;
else if(z>=3.44 && z<3.60)
source = 2.13757E+08;
else if(z>=3.60 && z<3.68)
source = 2.23299E+08;
else source =0.0;
dS[eqn] = 0.0;
return source;
}
回复此楼

» 猜你喜欢

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

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

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

kylafree

至尊木虫 (知名作家)

【答案】应助回帖

★ ★
感谢参与,应助指数 +1
xiegangmai: 金币+2, 谢谢应助! 2012-05-23 22:57:05
}
return nd;
#include "udf.h"
这三行,第二行应该写在第二行前面吧。第三行不需要吧。
2楼2012-05-23 22:28:54
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

kylafree

至尊木虫 (知名作家)

引用回帖:
2楼: Originally posted by kylafree at 2012-05-23 22:28:54:
}
return nd;
#include "udf.h"
这三行,第二行应该写在第二行前面吧。第三行不需要吧。

}
return nd;
#include "udf.h"
这三行,第二行应该写在第一行前面吧。第三行不需要吧。
3楼2012-05-23 22:29:24
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 akqinmian 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考博] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 +4 uKOSCocCb6Fm 2026-11-12 8/400 2026-11-19 17:38 by Equinoxhua
[考博] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +4 SX5mJmPWDfOO 2026-11-13 4/200 2026-11-19 17:15 by Equinoxhua
[论文投稿] IVD领域内综述投稿推荐 100+3 小小筑梦 2026-11-16 5/250 2026-11-19 17:03 by hansi2025
[基金申请] 注意啦!用基金购买打印纸、硒鼓、优盘、移动硬盘、个人计算机属于违规了 +3 iaeyuan 2026-11-17 3/150 2026-11-19 08:45 by newfuzzy1
[教师之家] 征友后感触 +6 重新启 2026-11-17 7/350 2026-11-19 08:12 by m_zyj
[考博] 27博士申请(市政/环境) +4 ladf 2026-11-12 4/200 2026-11-18 20:18 by junqiang
[找工作] 售SCI一区T0P文章,我:8.O.55.1.O54,科目全,可伽急 +3 SX5mJmPWDfOO 2026-11-13 3/150 2026-11-18 14:51 by UPDUsNlULsJZ
[论文投稿] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +5 SX5mJmPWDfOO 2026-11-13 5/250 2026-11-18 13:44 by UPDUsNlULsJZ
[硕博家园] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 +5 SX5mJmPWDfOO 2026-11-13 6/300 2026-11-18 13:33 by UPDUsNlULsJZ
[硕博家园] 售SCI一区文章,我:8.O.551.O.5.4,科目全,可伽急 +5 XJXMuRjD7cK7 2026-11-13 5/250 2026-11-18 11:32 by Z1pODz48hoDV
[考博] 售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急 +4 uKOSCocCb6Fm 2026-11-13 4/200 2026-11-18 10:37 by Z1pODz48hoDV
[考研] 售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急 +5 uKOSCocCb6Fm 2026-11-13 5/250 2026-11-18 10:15 by Z1pODz48hoDV
[考研] 售SCI一区文章,我:8.O.551.O.5.4,科目全,可伽急 +4 uKOSCocCb6Fm 2026-11-12 6/300 2026-11-18 09:31 by Z1pODz48hoDV
[论文投稿] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +5 uKOSCocCb6Fm 2026-11-12 8/400 2026-11-18 09:20 by Z1pODz48hoDV
[硕博家园] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +4 uKOSCocCb6Fm 2026-11-12 7/350 2026-11-18 09:09 by Z1pODz48hoDV
[考研] 售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急 +4 uKOSCocCb6Fm 2026-11-12 9/450 2026-11-18 09:06 by Equinoxhua
[硕博家园] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +4 uKOSCocCb6Fm 2026-11-12 10/500 2026-11-16 22:49 by Equinoxhua
[考博] 27年药学 考博申请 +4 。12345 2026-11-14 5/250 2026-11-16 19:52 by 0611517sll
[硕博家园] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +4 uKOSCocCb6Fm 2026-11-13 4/200 2026-11-16 11:06 by K7HMGGdOpylw
[公派出国] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +3 SX5mJmPWDfOO 2026-11-13 3/150 2026-11-15 08:29 by xSrQNSSjcgoX
信息提示
请填处理意见