(最全面-和网上流传的都不一样)fluent空气蒸汽冷凝UDF.docx_第1页
(最全面-和网上流传的都不一样)fluent空气蒸汽冷凝UDF.docx_第2页
(最全面-和网上流传的都不一样)fluent空气蒸汽冷凝UDF.docx_第3页
(最全面-和网上流传的都不一样)fluent空气蒸汽冷凝UDF.docx_第4页
(最全面-和网上流传的都不一样)fluent空气蒸汽冷凝UDF.docx_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

#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)&(t=20.0)&(t=30.0)&(t=40.0)&(t=50.0)&(t=60.0)&(t=70.0)&(t=80.0)&(t=90.0)&(t=100.0)&(t=110.0)&(t=120.0)&(t=130.0)&(t=140.0)&(t=150.0)&(t=160.0)&(t=170.0)&(t=180.0)&(t=190.0)&(t=200.0)&(t=210.0)&(t=220.0)&(t=230.0)&(t=240.0)&(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)&(t=20.0)&(t=30.0)&(t=40.0)&(t=50.0)&(t=60.0)&(t=70.0)&(t=80.0)&(t=90.0)&(t=100.0)&(t=110.0)&(t=120.0)&(t=130.0)&(t=140.0)&(t=150.0)&(t=160.0)&(t=170.0)&(t=180.0)&(t=190.0)&(t=200.0)&(t=210.0)&(t=220.0)H=2802000.0;return H;DEFINE_DELTAT(my_timestep,d)real time_step;real flow_time=RP_Get_Real(flow-time);if(flow_time4.0)time_step=0.01;elsetime_step=0.05;return time_step;DEFINE_PROFILE(cwalltemp,t,i)real xND_ND;real s,ma,mb,mc,md,me;face_t f;ma=8.284;mb=-25.585;mc=22.699;md=-5.3462;me=350.87;begin_f_loop(f,t)F_CENTROID(x,f,t);s=x1;F_PROFILE(f,t,i) = ma*s*s*s*s+mb*s*s*s+mc*s*s+md*s+me;end_f_loop(f,t)DEFINE_PROFILE(mass_flow,t,i)face_t f;begin_f_loop(f,t)F_PROFILE(f,t,i) =-s0;end_f_loop(f,t)DEFINE_ON_DEMAND(INIT)int thread_ID;Domain *domain;Thread *tt;int i;face_t f; /*face index on the wall*/cell_t c0;real AND_ND;i=0;thread_ID=6;domain=Get_Domain(1);tt=Lookup_Thread(domain,thread_ID);/*calculate the total number of faces on the wall*/begin_f_loop(f,tt)c0=F_C0(f,tt);counter+;end_f_loop(f,tt)a=(int*)malloc(counter*sizeof(int);b=(real*)malloc(counter*sizeof(real);d=(real*)malloc(counter*sizeof(real); /* temp info*/q=(real*)malloc(counter*sizeof(real); /* temp info at previous time*/g=(real*)malloc(counter*sizeof(real); /* mass fraction info at previous time*/l=(real*)malloc(counter*sizeof(real); /* pressure info at previous time*/begin_f_loop(f,tt)c0=F_C0(f,tt);ai=c0;F_AREA(A,f,tt);bi=NV_MAG(A);i+;end_f_loop(f,tt)DEFINE_ADJUST(k_init,domain)k=0;DEFINE_ADJUST(temp_at_interface,domain)Thread *f_thread;face_t face;int thread_ID;int i=0;thread_ID=6; /*ID of g_s_wall is 6*/f_thread=Lookup_Thread(domain,thread_ID);begin_f_loop(face,f_thread)di=F_T(face,f_thread);i+;end_f_loop(face,f_thread);DEFINE_ADJUST(avg,domain)int i=0;real tavg = 0;real wavg = 0;real Pavg = 0;real temp,volume,vol_tot=0,w_h2o,Pa,condmass;real sum=0;Domain *d;Thread *t;cell_t c;real xND_ND;d = Get_Domain(1);thread_loop_c(t,d)begin_c_loop(c,t)C_CENTROID(x,c,t);volume = C_VOLUME(c,t); /* get cell volume */temp = C_T(c,t); /* get cell temperature */w_h2o= C_YI(c,t,i); /* get cell mass fraction of h2o */Pa=C_P(c,t)+402145.725; /* get cell Absolute Pressure */condmass=C_UDMI(c,t,0);if (-0.001x1)&(x1=Ps)Hlg=latent_heat(Tw);source=-Cu*(10189.3+0.0904164*P-(4314.4+0.046537*P)*log10(100*(1-w)*area*pow(T-Tw),0.4)/(Hlg*V);/*source=-Cu*pow(x/(1-x),0.8)*area*(T-Tw)/(Hlg*V)*/ /*Uchida correlation*/dSeqn=0.;elsesource=0.;elsesource=0.0;C_UDMI(c,t,0)=source*V;C_UDMI(c,t,1)=source*(T*Cp_mix-Tref*Cp_air)*V; /*C_UDMI(c,t,1)=source*hv;*/C_UDMI(c,t,2)=source*Vx*V; /*moment source in axis direction*/C_UDMI(c,t,3)=source*Vy*V; /*moment source in xradius direction*/return source;DEFINE_SOURCE(vapor_species_source,c,t,dS,eqn)real source=0;real V;V=C_VOLUME(c,t);source=C_UDMI(c,t,0)/V;dSeqn=0.0;return source;DEFINE_SOURCE(vapor_h_source,c,t,dS,eqn)real source=0;real V;V=C_VOLUME(c,t);source=C_UDMI(c,t,1)/V;dSeqn=0.0;return source;DEFINE_SOURCE(Yaxi_mom_source,c,t,dS,eqn)real source=0;real V;V=C_VOLUME(c,t);source=C_UDMI(c,t,2);dSeqn=0.0;return source;DEFINE_SOURCE(Xrad_mom_source,c,t,dS,eqn)real source=0;real V;V=C_VOLUME(c,t);source=C_UDMI(c,t,3);dSeqn=0.0;return source;DEFINE_DIFFUSIVITY(vapor_diffusivity,c,t,i) /*vapor diffusivity in the air*/real diff=0;real T;real P;T=C_T(c,t);P=C_P(c,t)+402145.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论