24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 6545  |  回复: 16

stanstanne

银虫 (正式写手)

[求助] 【已完结】FLUENT 换热系数UDF的编写求助

希望学习FLUENT UDF的虫友帮帮忙,关于施加换热系数边界条件的UDF。

问题描述:一根有厚度圆管,内部有导热油流过,外部有带速度的空气流过,如下图。
【已完结】FLUENT 换热系数UDF的编写求助
但是不知道定义换热系数边界条件用什么宏。

看help文件,发现DEFINE_PROFILE和DEFINE_HEAT_FLUX好像都可以,但是没有例子

自己不会编,希望虫友们给点建议

[ Last edited by 1592203609 on 2017-3-6 at 16:04 ]
回复此楼

» 猜你喜欢

我是一个粉刷匠
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
回帖支持 ( 显示支持度最高的前 50 名 )

stanstanne

银虫 (正式写手)

刚才成功编译换热系数的UDF,感谢http://muchong.com/html/201304/5739908.html上附的代码。

现在把自己写的代码放在下面,很长,希望对感兴趣的虫友有所帮助

/* UDF used to calculate the forced convection between the bare absorber tube and the air around it.*/

#include "udf.h"

#define D_outer 0.07
#define temp_air 293.15
#define speed_air 3

/**************declaration of the functions***************************/
real dry_air_density(real temp);
real dry_air_specific_heat(real temp);
real dry_air_thermal_conductivity(real temp);
real dry_air_dynamic_viscosity(real temp);

/*thread is a pointer to the face's thread, and position is a numerical lbael for the variable
  being set within each loop*/
DEFINE_PROFILE(forced_convection_air_abs, thread, position)
{
    real mu_outer, lambda_outer, Cp_outer, rho_outer, mu_air, lambda_air, Cp_air, rho_air, v_air;
    /*transitional parameters*/
    real nu_outer, nu_air, alpha_outer, alpha_air, Re_outer, Pr_outer, Pr_air;
    /*coefficients of Zhukausas's correlation*/
    real m, n, C;
    real temp_outer;/*temperature of the outerer absorber tube*/
    real Nu_outer_air, h_outer_air;    /*Nusselt number to calculate forced heat transfer coefficient*/
    face_t f;
    begin_f_loop(f,thread)
    {
        temp_outer=F_T(f,thread);
        /*the process to obtain the property value of the air*/
        /*Via the linear fitting method, we can obtain the expression of the properties of the air
        varying with the temperature, temperature ranges from 20 Celsius to 400 Celsius*/
        mu_outer=dry_air_dynamic_viscosity(temp_outer);
        mu_air=dry_air_dynamic_viscosity(temp_air);
        lambda_outer=dry_air_thermal_conductivity(temp_outer);
        lambda_air=dry_air_thermal_conductivity(temp_air);
        Cp_outer=dry_air_specific_heat(temp_outer);
        Cp_air=dry_air_specific_heat(temp_air);
        rho_outer=dry_air_density(temp_outer);
        rho_air=dry_air_density(temp_air);

        nu_air=mu_air/rho_air;
        nu_outer=mu_outer/rho_outer;
        alpha_air=lambda_air/(Cp_air*rho_air);/* make sure that the unit of the parameters is international*/
        alpha_outer=lambda_outer/(Cp_outer*rho_outer);
        Re_outer=speed_air*D_outer/alpha_air;   /*the Reynold number of flowing air*/
        Pr_outer=nu_outer/alpha_outer;
        Pr_air=nu_air/alpha_air;

        /*if Re_outer is used outer of range, print warning information on the screen*/
        /**********waiting to complete********************/
            /*if Pr_air is used outer of range, print warning information on the screen*/
        /**********waiting to complete********************/
        /*coefficients for external forced convection Nusselt Number correlation(Zhukausas's correlation)*/
        if(Pr_air<=10)
            n=0.37;
        else
            n=0.36;

        if(Re_outer<40)
        {
            C=0.75;
            m=0.4;
        }
        else if(Re_outer>=40 && Re_outer<1000)
        {
            C=0.51;
            m=0.5;
        }
        else if(Re_outer>=1000 && Re_outer<2e5)
        {
            C=0.26;
            m=0.6;
        }
        else if(Re_outer>=2e5 && Re_outer<1e6)
        {
            C=0.076;
            m=0.7;
        }
        else
            printf("the Reynold number is out of the suitable range, the result may not be accurate!!\n";

        /*Zhukauskas's correlation for external forced convection flow normal to an isothermal cylinder */
        Nu_outer_air=C*pow(Re_outer,m)*pow(Pr_air,n)*pow(Pr_air/Pr_outer,1/4);
        F_PROFILE(f,thread,position)=Nu_outer_air*lambda_air/D_outer;
    }
    end_f_loop(f,thread)
}

/*declaration of the function calculating the dry air density*/
real dry_air_density(real temp)
{
    real rho;
    if(temp>=273.15 && temp<=673.15)
        rho=3.60759e-6*temp*temp-0.00532*temp+2.44735;
    else
        printf("the temperature is out of range, the result may not be accurate!!\n";
    return rho;
}

/*declaration of the function calculating the dry air specific heat*/
real dry_air_specific_heat(real temp)
{
    real Cp;
    if(temp>=273.15 && temp<=673.15)
        Cp=-8.23356e-10*pow(temp,3)+1.51078e-6*temp*temp-6.80959e-4*temp+1.09594;
    else
        printf("the temperature is out of range, the result may not be accurate!!\n";
    return Cp;
}

/*declaration of the function calculating the dry air thermal conductivity*/
real dry_air_thermal_conductivity(real temp)
{
    real lambda;
    if(temp>=273.15 && temp<=673.15)
        lambda=-2.74554e-6*temp*temp-0.00952*temp+0.03672;
    else
        printf("the temperature is out of range, the result may not be accurate!!\n";
    return lambda;
}

/*declaration of the function calculating the dry air dynamic viscosity*/
real dry_air_dynamic_viscosity(real temp)
{
    real mu;
    if(temp>=273.15 && temp<=673.15)
        mu=-2.0294e-5*temp*temp+0.05877*temp+2.72007;
    else
        printf("the temperature is out of range, the result may not be accurate!!\n";
    return mu;
}
我是一个粉刷匠
3楼2017-03-06 15:56:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通回帖

stanstanne

银虫 (正式写手)

没人回吗,好吧,自己顶,希望会UDF的大神可以给点建议

昨天找到一个相关话题,感兴趣的虫友可以看一下。

链接:http://muchong.com/html/201304/5739908.html
我是一个粉刷匠
2楼2017-03-06 14:58:02
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

461256004

新虫 (初入文坛)

4楼2017-03-09 11:11:53
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

第五茂芊

新虫 (初入文坛)

好东西,楼主只用一个钟头就解决了,我才初学fluent,感觉还是任重道远啊
5楼2017-03-14 15:52:19
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

MoonLee777

新虫 (正式写手)

6楼2017-04-17 02:56:04
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
7楼2017-05-19 15:03:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dxh_hnhy

新虫 (初入文坛)

引用回帖:
3楼: Originally posted by stanstanne at 2017-03-06 15:56:38
刚才成功编译换热系数的UDF,感谢http://muchong.com/html/201304/5739908.html上附的代码。

现在把自己写的代码放在下面,很长,希望对感兴趣的虫友有所帮助

/* UDF used to calculate the forced convectio ...

楼主,我是udf新手,想问一下你上面的函数声明这一块,声明完函数后,可以直接用,但是udf怎么识别这些函数的作用呢,为啥能得到这些值呢,还是说这几个函数udf头文件中本身就存在???谢谢楼主
8楼2017-10-27 09:05:43
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dxh_hnhy

新虫 (初入文坛)

/**************declaration of the functions***************************/
real dry_air_density(real temp);
real dry_air_specific_heat(real temp);
real dry_air_thermal_conductivity(real temp);
real dry_air_dynamic_viscosity(real temp);
…………………………
…………………………
mu_outer=dry_air_dynamic_viscosity(temp_outer);
        mu_air=dry_air_dynamic_viscosity(temp_air);
        lambda_outer=dry_air_thermal_conductivity(temp_outer);
这些声明的函数可以直接用来取值吗,udf内部有这些函数吗,udf是怎么识别这些函数的?????求问
9楼2017-10-27 09:09:05
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dxh_hnhy

新虫 (初入文坛)

引用回帖:
6楼: Originally posted by MoonLee777 at 2017-04-17 02:56:04
楼主写得好

/**************declaration of the functions***************************/
real dry_air_density(real temp);
real dry_air_specific_heat(real temp);
real dry_air_thermal_conductivity(real temp);
real dry_air_dynamic_viscosity(real temp);
…………………………
…………………………
mu_outer=dry_air_dynamic_viscosity(temp_outer);
        mu_air=dry_air_dynamic_viscosity(temp_air);
        lambda_outer=dry_air_thermal_conductivity(temp_outer);
这些声明的函数可以直接用来取值吗,udf内部有这些函数吗,udf是怎么识别这些函数的?????求问
10楼2017-10-27 09:10:23
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 stanstanne 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 省双一流重点一本大学招收调剂 +3 wwwwffffff 2026-03-31 5/250 2026-03-31 19:49 by 曾曾曾!
[考研] 一志愿华东师范大学有机化学专业,初试351分,复试被刷求调剂! +9 真名有冰 2026-03-29 10/500 2026-03-31 18:01 by xhai2011
[考研] 生医工0831调剂求推荐 +4 小熊睿睿_s 2026-03-27 6/300 2026-03-31 17:12 by 记事本2026
[考研] 物理学调剂 +4 小羊36 2026-03-30 4/200 2026-03-31 16:16 by lishahe
[考研] 化学工程085602 305分求调剂 +28 RichLi_ 2026-03-25 36/1800 2026-03-31 14:56 by JourneyLucky
[考研] 289求调剂 +6 BrightLL 2026-03-29 6/300 2026-03-31 11:22 by oooqiao
[考研] 313求调剂 +6 卖个关子吧 2026-03-31 6/300 2026-03-31 10:58 by Jaylen.
[考研] 085601一志愿中山大学深圳材料工程330求调剂 +5 pipiver 2026-03-30 5/250 2026-03-31 07:37 by JourneyLucky
[考研] 303求调剂 +7 DLkz1314. 2026-03-30 7/350 2026-03-30 21:07 by peike
[考研] 26考研-291分-厦门大学(085601)-柔性电子学院材料工程专业求调剂 +5 min3 2026-03-24 6/300 2026-03-30 18:42 by 544594351
[考研] 297求调剂 +17 田洪有 2026-03-26 18/900 2026-03-30 18:32 by nothing投稿中
[考研] 085701求调剂初试286分 +5 secret0328 2026-03-28 5/250 2026-03-30 12:54 by fangnagu
[考研] 081200-11408-276学硕求调剂 +6 崔wj 2026-03-26 6/300 2026-03-29 01:11 by hanserlol
[考研] 356求调剂 +3 gysy?s?a 2026-03-28 3/150 2026-03-29 00:33 by 544594351
[考研] 0856,材料与化工321分求调剂 +12 大馋小子 2026-03-27 13/650 2026-03-28 10:56 by self2008
[考研] 330一志愿中国海洋大学 化学工程 085602 有读博意愿 求调剂 +3 wywy.. 2026-03-27 4/200 2026-03-28 03:32 by fmesaito
[考研] 08开头275求调剂 +4 拉谁不重要 2026-03-26 4/200 2026-03-27 14:12 by Delta2012
[论文投稿] Journal of Mechanical Science and Technology +3 Russ_ss 2026-03-25 5/250 2026-03-27 10:49 by 陆小果画大饼
[考研] 081200-11408-276学硕求调剂 +3 崔wj 2026-03-26 3/150 2026-03-26 19:57 by nihaoar
[考研] 各位老师您好:本人初试372分 +5 jj涌77 2026-03-25 6/300 2026-03-25 14:15 by mapenggao
信息提示
请填处理意见