高级UDF示例
更新时间:2024-01-11 06:37: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示例01-11
光化学烟雾04-02
极地地区太阳方位10-28
足球比赛写话二年级400字07-05
植物病理学12-04
2018版高考语文大一轮复习2现代文阅读09-19
大学生党校培训思想汇报2015年6月09-08
河北冀州中学2013-2014学年高一上学期期中考试 数学A卷试题 Word版含答案05-13
年度工作计划【优秀7篇】03-26
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 示例
- 高级
- UDF
- 如何申请进出口经营权
- 2015年度河北瑞丰木业有限公司销售收入与资产数据报告 - 图文
- 泉州市中学教师高级职务评审通过名单
- 2017-2022年中国烘焙食品行业品牌竞争与消费需求投资潜力分析预测报告(目录)
- 献给祖国母亲的诗
- 《中国政府与政治》复习题
- 2016年北大金融硕士备考二十一
- 制造工厂管理状况诊断报告及整改思路纲要
- 2019届九年级语文上学期第一次月考试题新人教版(含答案解析)
- 山东青年政治学院工商管理学专业实习总结报告范文模板
- sap 表修改记录查询
- 金融工程学作业完成2
- 2010届高三语文上册第二次联考测试题1 - 图文
- 比较文学题库及答案
- 黑龙江依兰县动物卫生监督体系建设项目可行性报告
- 萨维尼法律关系本座说
- 《内燃机学》习题集
- 科技创新对现代化企业管理的现实作用
- 结构化学期末试题1
- 2013年中考语文试题分类汇编3:字形学生