高级UDF示例
更新时间:2024-03-28 02:03:01 阅读量: 综合文库 文档下载
- 高级有质感的句子推荐度:
- 相关推荐
高级UDF示例
#include\
/* Constant Parameters */
#define N_WALLS 15 /* Total number of walls to consider */ #define RR 6 #define VP 3.5
#define TW 25.0 /* Water temperature*/ #define SMALL_T 1.0
/* Wall Parameter Lists */
/* wall name must coorespond to its ID,sied type,roler number,roler diameter,etc */
char *w_name[]={\
\int w_ID[]={24,26,25,21,23,22,18,20,19,15,17,16,12,14,13}; int w_side[]={0,1,2,0,1,2,0,1,2,0,1,2,0,1,2}; int w_n_roler[]={0,1,1,0,6,6,0,7,7,0,5,5,0,5,5};
real w_d_roler[]={0.,0.08,0.08,0.,0.13,0.13,0.,0.13,0.13,0.,0.13,0.13,0.,0.13,0.13};
real w_W[N_WALLS]={270.,270.,270.,364.,364.,364.,240.,240.,240.,128.,128.,128.,0.,0.,0.}; real w_L[N_WALLS]={0.}; real w_A[N_WALLS]={0.}; real w_T[N_WALLS]={0.}; real w_Q[N_WALLS]={0.};
/* Get index of the specified wall thread in the wall list */
int get_wall_index(int t_id) { int w_idx=-1,i; for(i=0;i /* Calculate Averaged Wall Parameters:Area,Mean Temperature,Mean Distance to Entry Point */ int calc_wall_para(Thread *t) { #if !RP_HOST int t_id,w_idx,i; real sum,sum_a,sum_f,sum_l; real y,z,l,T_avg; face_t f; real A[ND_ND],x[ND_ND],area,T; /* locate the thread in the wall thread ID list */ t_id=THREAD_ID(t); if(w_idx!=-1) { /* found the thread ID in the list. calculate the area weighted mean temperature */ sum=sum_a=sum_f=sum_l=0; begin_f_loop(f,t) { F_CENTROID(x,f,t); F_AREA(A,f,t); area=NV_MAG(A); T=F_T(f,t)-273; sum_a+=area; sum+=(area*T); sum_f+=1.; /* calc distance to level */ y=x[1]; z=x[2]; l=RR*asin(fabs(z)/RR); sum_l+=l; } end_f_loop(f,t); #if RP_NODE PRF_GRSUM4(sum,sum_a,sum_l,sum_f); #endif/* RP_NODE*/ T_avg=sum/sum_a; w_T[w_idx]=T_avg; w_A[w_idx]=sum_a; w_L[w_idx]=sum_l/sum_f+0.4; } return w_idx; #endif /*!RP_HOST*/ } /* Calculate Total Heat Transfer on each Wall */ real calc_wall_heat(int w_idx) { int i=w_idx; real two_a=0.,r,alpha,h,w_q; real Q1=0.,Q2=0.,Q3=0.,Q4=0.; /* 1:Roler heat transfer */ if(w_n_roler[i]!=0) { if(w_L[i]<4.) { two_a=-0.3116+4.6105*w_L[i]; } else two_a=-0.3116+4.6105*4.; Q1=w_n_roler[i]*(two_a*w_d_roler[i]*0.5/360.*11513.7*pow(w_T[i],0.7556)* pow(VP,-0.2010)*pow(two_a,-0.1639)); } else { two_a=0.; Q1=0.; } /* 2:Water cooling */ if(w_side[i]!=0) { w_q=w_W[i]/60./2./w_A[i]; if(w_T[i]>900.) { h=1.095e15*pow(w_T[i],-4.15)*pow(w_q,0.75); } else if(w_T[i]>500.&&w_T[i]<=900.) { h=3.78e6*pow(w_T[i],-1.34)*pow(w_q,0.785); } else h=3.78e6*pow(500.,-1.34)*pow(w_q,0.785); Q2=w_A[i]*h*(w_T[i]-TW); } else Q2=0.; } /* 3: Air cool and radiation */ Q3=w_A[i]*0.8*5.67e-8*(pow(w_T[i]+273,4.)-pow(TW+273,4.)); /* 4: Water evaporation */ if(w_side[i]==0||w_side[i]==1) alpha=0.39; else alpha=0.; Q4=alpha/(1.-alpha)*(Q1+Q2+Q3); /* Total heat (excluding radiation) */ w_Q[i]=Q1+Q2+Q4; return two_a; } /* Calculate and Display Total Heat Transfer,Heat Transfer Coefficient for each Wall*/ DEFINE_ON_DEMAND(cc_calc_heat) { #if !RP_HOST Domain *domain=Get_Domain(1); Thread *t; #endif /*!RP_HOST*/ int i; real two_a; if(!Data_Valid_P()) return; #if !RP_HOST /*Calculate mean wall parameters*/ thread_loop_f(t,domain) { if(BOUNDARY_FACE_THREAD_P(t)) i=calc_wall_para(t); } #endif /*!RP_HOST*/ /*Calculate and display total heat transfer for each zone surface*/ Message0(\ for (i=0;i DEFINE_PROFILE(cc_heat_tran,t,pos) { #if !RP_HOST Thread *t0=THREAD_T0(t); cell_t c0; face_t f; int w_idx; real two_a,h,q,T_w; /*Calculate averaged wall parameters and get wall index*/ w_idx=calc_wall_para(t); if(w_idx!=-1) /*Check wall index*/ { /*Calculate wall total heat transfer*/ two_a=calc_wall_heat(w_idx); /*Calculate wall heat flux*/ q=w_Q[w_idx]/w_A[w_idx]; /*Calculate effective wall heat transfer coefficient*/ /*method 1:use this for all faces on the thread*/ h=w_Q[w_idx]/(w_A[w_idx]*(w_T[w_idx]-TW)); /*Loop over all face on wall thread*/ begin_f_loop(f,t) { T_w=F_T(f,t)-273.; /*method 2:calculate h for each face*/ // h=q/MAX(SMALL_T,(T_w-TW)); /*Assign heat transfer coefficient to F_PROFILE*/ F_PROFILE(f,t,pos)=h; /*Store heat transfer coefficient on a User Defined Memory*/ if(NNULLP(THREAD_STORAGE(t0,SV_UDM_I))&&sg_udm!=0) { c0=F_C0(f,t); C_UDMI(c0,t0,0)=-h; } } end_f_loop(f,t); } #endif /*!RP_HOST*/ }
正在阅读:
高级UDF示例03-28
2013年最新教师招聘考试题库(精心整理!!!看过必过!!!)05-17
新余市人民政府关于印发新余市城镇居民基本医疗保险暂行办法的通知01-29
雅行教育09-16
BA系统作用01-24
一条鱼儿的自述作文400字06-29
日语外贸业务员实习报告(强力推荐)02-25
水井打捞水泵施工合同12-16
18套试卷合集辽宁省丹东市名校2019年中考物理一模试卷及答案01-07
红河谷03-17
- 多层物业服务方案
- (审判实务)习惯法与少数民族地区民间纠纷解决问题(孙 潋)
- 人教版新课标六年级下册语文全册教案
- 词语打卡
- photoshop实习报告
- 钢结构设计原理综合测试2
- 2014年期末练习题
- 高中数学中的逆向思维解题方法探讨
- 名师原创 全国通用2014-2015学年高二寒假作业 政治(一)Word版
- 北航《建筑结构检测鉴定与加固》在线作业三
- XX县卫生监督所工程建设项目可行性研究报告
- 小学四年级观察作文经典评语
- 浅谈110KV变电站电气一次设计-程泉焱(1)
- 安全员考试题库
- 国家电网公司变电运维管理规定(试行)
- 义务教育课程标准稿征求意见提纲
- 教学秘书面试技巧
- 钢结构工程施工组织设计
- 水利工程概论论文
- 09届九年级数学第四次模拟试卷
- 示例
- 高级
- UDF
- 武昌区白沙洲都市工业园十二五规划 - 图文
- 中国涤纶长丝行业发展现状及投资预测调研报告-灵核网 - 图文
- 2017-2022年中国烘焙食品行业品牌竞争与消费需求投资潜力分析预
- 关于染料敏化太阳能电池 - 一篇本科毕业论文
- 库车重点项目
- 数模论文 - 北京水资源短缺风险综合评价 - (3)(1)
- ANSYS资料整理 - 图文
- 水煤浆气化技术的发展及应用选择
- 华东《高级财务会计》2018年春学期在线作业(三)
- AutoCAD笔试考题
- 老年患者口服营养补充疗法应用
- 杂志社汇总
- 《关于领导干部报告个人有关事项的规定》知识试题及答案
- 金融工程学作业完成2
- 铁路工程试验检测技术习题
- 北京市朝阳区2012届高三第一次统一练习语文试题(2012朝阳一模)
- sap 表修改记录查询
- 如何申请进出口经营权
- 机械工程导论结课论文
- 比较文学题库及答案