资源简介
这个程序是用于fluent自定义函数,通过加载在fluent中,求解水的相变,得到水的蒸发冷凝情况,可以在后续的处理中看到温度场速度场云图,通过这个UDF可以自定义水的蒸发冷凝速率
代码片段和文件信息
#include “udf.h“ /*head files*/
#include “mem.h“
#include “flow.h“
#define PI 3.141592653 /*constant*/
#define Mv 18.01534 /*molecular weight of vapor(kg/kmol)*/
#define Ma 28.966 /*molecular weight of air(kg/kmol) */
int *a;
real *b;
real *d;
real *q;
real *g;
real *l;
real s1;
real s2;
real s3;
real s0;
int counter=0; /*counter*/
int j; /*index of interface wall cell*/
int k;
real latent_heat(real T)
{
real t;
real Hlg;
t=T-273.15;
if(t<10.0)
Hlg=2477208.8;
if((t>=10.0)&&(t<20.0))
Hlg=2477208.8+(t-10.0)*(2453549.6-2477208.8)/10.0;
if((t>=20.0)&&(t<30.0))
Hlg=2453549.6+(t-20.0)*(2429882.8-2453549.6)/10.0;
if((t>=30.0)&&(t<40.0))
Hlg=2429882.8+(t-30.0)*(2406058.7-2429882.8)/10.0;
if((t>=40.0)&&(t<50.0))
Hlg=2406058.7+(t-40.0)*(2382038.2-2406058.7)/10.0;
if((t>=50.0)&&(t<60.0))
Hlg=2382038.2+(t-50.0)*(2357691.0-2382038.2)/10.0;
if((t>=60.0)&&(t<70.0))
Hlg=2382038.2+(t-60.0)*(2333080.9-2382038.2)/10.0;
if((t>=70.0)&&(t<80.0))
Hlg=2333080.9+(t-70.0)*(2308065.7-2333080.9)/10.0;
if((t>=80.0)&&(t<90.0))
Hlg=2308065.7+(t-80.0)*(2282560.3-2308065.7)/10.0;
if((t>=90.0)&&(t<100.0))
Hlg=2282560.3+(t-90.0)*(2256472.9-2282560.3)/10.0;
if((t>=100.0)&&(t<110.0))
Hlg=2256472.9+(t-100.0)*(2229704.3-2256472.9)/10.0;
if((t>=110.0)&&(t<120.0))
Hlg=2229704.3+(t-110.0)*(2202149.7-2229704.3)/10.0;
if((t>=120.0)&&(t<130.0))
Hlg=2202149.7+(t-120.0)*(2173700.0-2202149.7)/10.0;
if((t>=130.0)&&(t<140.0))
Hlg=2173700.0+(t-130.0)*(2144243.7-2173700.0)/10.0;
if((t>=140.0)&&(t<150.0))
Hlg=2144243.7+(t-140.0)*(2113667.6-2144243.7)/10.0;
if((t>=150.0)&&(t<160.0))
Hlg=2113667.6+(t-150.0)*(2081855.9-2113667.6)/10.0;
if((t>=160.0)&&(t<170.0))
Hlg=2081855.9+(t-160.0)*(2048687.3-2081855.9)/10.0;
if((t>=170.0)&&(t<180.0))
Hlg=2048687.3+(t-170.0)*(2014031.4-2048687.3)/10.0;
if((t>=180.0)&&(t<190.0))
Hlg=2014031.4+(t-180.0)*(1977745.0-2014031.4)/10.0;
if((t>=190.0)&&(t<200.0))
Hlg=1977745.0+(t-190.0)*(1939668.5-1977745.0)/10.0;
if((t>=200.0)&&(t<210.0))
Hlg=1939668.0+(t-200.0)*(1899623.0-1939668.0)/10.0;
if((t>=210.0)&&(t<220.0))
Hlg=1899623.0+(t-210.0)*(1857409.0-1899623.0)/10.0;
if((t>=220.0)&&(t<230.0))
Hlg=1857409.0+(t-220.0)*(1812799.75-1857409.0)/10.0;
if((t>=230.0)&&(t<240.0))
Hlg=1812799.75+(t-230.0)*(1765537.21-1812799.75)/10.0;
if((t>=240.0)&&(t<250.0))
Hlg=1765537.21+(t-230.0)*(1715325.26-1765537.21)/10.0;
if(t>=250.0)
Hlg=1715325.26;
return Hlg;
}
real s_enthalpy(real T)
{
real t;
real H;
t=T-273.15;
if(t<10.0)
H=2519000.0;
if((t>=10.0)&&(t<20.0))
H=2519000.0+(t-10.0)*(2538000.0-2519000.0)/10.0;
if((t>=20.0)&&(t<30.0))
H=2538000.0+(t-20.0)*(2556000.0-2538000.0)/10.0;
if((t>=30.0)&&(t<40.0))
H=2556000.0+(t-30.0)*(2574000.0-2556000.0)/10.0;
if((t>=40.0)&&(t<50.0))
H=2574000.0+(t-40.0)*(2596000.0-2574000.0)/10.0;
if((t>=50.0)&&(t<60.0))
H=2596000.0+(t-50.0)*(2609000.0-2596000.0)/10.0;
if((t>=60.0)&&(t<70.0))
H=2609000.0+(t-60.0)*(2609000.0-2609000.0)/10.0;
if((t>=70.0)&&(t<80.0))
H=
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10484 2018-11-12 11:26 lengning.c
----------- --------- ---------- ----- ----
10484 1
评论
共有 条评论