研发埠
标题:
为什么udf的计算结果只有入口边界第一列网格有变化?
[打印本页]
作者:
王维莉
时间:
2014-2-25 19:33
标题:
为什么udf的计算结果只有入口边界第一列网格有变化?
[img][/img]如图所示,不知道问题出在哪里?是不是程序缺少某个控制语句?还是边界设置问题?我调试了很久,还是没有解决,麻烦大家帮忙看看~#include"udf.h"#define kb 1.38e-23#define rho_p 3800.#define ARFA 2.652e-10#define t0 8.75e+19#define t1 3.1032e+04#define T_1 500.#define n0 4.07e+20#define v0 2.12997e-07#define a0 1277.98enum{ TN, TV, TA, N_REQUIRED_UDS};enum{ VV, AA, DP, VP, NP, RC, LAMDA, KN, DA, DB, DC, DD, DE, DF, DIFF, CA, CB, CC, LL, GA, GB, GC, GD, GE, GG, BA, BB, BC, BD, BE, BF, BETA, TK, TAO, AS, STN, DSN, STA, DSA, SRTN, SRTA, N_REQUIRED_UDM};void update_parameter(Domain *d){ Thread *t; cell_t c; double N,V,A,v,a; double dp,vp,np,rc; double lamda,Kn,da,db,dc,dd,de,df,diff; double ca,cb,cc,ll,ga,gb,gc,gd,ge,gg; double ba,bb,bc,bd,be,bf,beta; double tk,tao,As; double stn,dsn,sta,dsa; thread_loop_c(t,d) { if (FLUID_THREAD_P(t) &&NNULLP(THREAD_STORAGE(t,SV_UDS_I(TV))) &&NNULLP(THREAD_STORAGE(t, SV_UDS_I(TA))) &&NNULLP(THREAD_STORAGE(t, SV_UDM_I))){ begin_c_loop(c,t) { N=C_UDSI(c,t,TN); V=C_UDSI(c,t,TV); A=C_UDSI(c,t,TA); if(N != 0. && V != 0. && A != 0.) { v=V/N; C_UDMI(c,t,VV)=v; a=A/N; C_UDMI(c,t,AA)=a; dp=6.*v/a; C_UDMI(c,t,DP)=dp; vp=M_PI*pow(dp,3.)/6.; C_UDMI(c,t,VP)=vp; np=v/vp; C_UDMI(c,t,NP)=np; rc=0.5*dp*pow(np,1./1.8); C_UDMI(c,t,RC)=rc; lamda=ARFA*C_T(c,t); C_UDMI(c,t,LAMDA)=lamda; Kn=lamda/rc; C_UDMI(c,t,KN)=Kn; da=kb*C_T(c,t); C_UDMI(c,t,DA)=da; db=6.*M_PI*C_MU_T(c,t)*rc; C_UDMI(c,t,DB)=db; dc=da/db; C_UDMI(c,t,DC)=dc; dd=5.+4.*Kn+6.*Kn*Kn+18.*Kn*Kn*Kn; C_UDMI(c,t,DD)=dd; de=5.-Kn+(8.+M_PI)*Kn*Kn; C_UDMI(c,t,DE)=de; df=dd/de; C_UDMI(c,t,DF)=df; diff=dc*df; C_UDMI(c,t,DIFF)=diff; ca=M_PI*rho_p*v; C_UDMI(c,t,CA)=ca; cb=8.*kb*C_T(c,t); C_UDMI(c,t,CB)=cb; cc=sqrt(cb/ca); C_UDMI(c,t,CC)=cc; ll=8.*diff/(M_PI*cc); C_UDMI(c,t,LL)=ll; ga=1./(6.*rc*ll); C_UDMI(c,t,GA)=ga; gb=2.*rc+ll; C_UDMI(c,t,GB)=gb; gc=pow(gb,3.); C_UDMI(c,t,GC)=gc; gd=4.*rc*rc+ll*ll; C_UDMI(c,t,GD)=gd; ge=pow(gd,1.5); C_UDMI(c,t,GE)=ge; gg=ga*(gc-ge)-2.*rc; C_UDMI(c,t,GG)=gg; ba=8.*M_PI*diff*rc; C_UDMI(c,t,BA)=ba; bb=2.*rc+sqrt(2.)*gg; C_UDMI(c,t,BB)=bb; bc=rc/bb; C_UDMI(c,t,BC)=bc; bd=cc*rc; C_UDMI(c,t,BD)=bd; be=sqrt(2.)*diff/bd; C_UDMI(c,t,BE)=be; bf=bc+be; C_UDMI(c,t,BF)=bf; beta=ba/bf; C_UDMI(c,t,BETA)=beta; tk=pow(dp,4.); C_UDMI(c,t,TK)=tk; tao=t0*tk*exp(t1/C_T(c,t)); C_UDMI(c,t,TAO)=tao; As=pow(M_PI,1./3.)*pow(6.*v,2./3.)*N; C_UDMI(c,t,AS)=As; stn=-0.5*C_R(c,t)*C_R(c,t)*beta*N*N; C_UDMI(c,t,STN)=stn; dsn=-C_R(c,t)*C_R(c,t)*beta*N; C_UDMI(c,t,DSN)=dsn; sta=-(A-As)/tao; C_UDMI(c,t,STA)=sta; dsa=-1./tao; C_UDMI(c,t,DSA)=dsa; } } end_c_loop(c,t) } }}DEFINE_ADJUST(get_parameter,domain){ if (n_uds < N_REQUIRED_UDS) { Error("Not enough user defined scalars!\n"); } if (n_udm < N_REQUIRED_UDM) { Error("Not enough user defined memories!\n"); } update_parameter(domain);}DEFINE_SOURCE(tn_source,c,t,dS,eqn){ real source; real T; T=C_T(c,t); if (T >= T_1) { source=C_UDMI(c,t,STN); dS[eqn]=C_UDMI(c,t,DSN); } else { source=0.0; dS[eqn]=0.0; } C_UDMI(c,t,SRTN)=source; return source;}DEFINE_SOURCE(ta_source,c,t,dS,eqn){ real source; real T; T=C_T(c,t); if (T >= T_1) { source=C_UDMI(c,t,STA); dS[eqn]=C_UDMI(c,t,DSA); } else { source=0.0; dS[eqn]=0.0; } C_UDMI(c,t,SRTA)=source; return source;}DEFINE_DIFFUSIVITY(diffu_coeff,c,t,i){ return C_R(c,t)*C_UDMI(c,t,DIFF);}DEFINE_PROFILE(inlet_tn,thread,position){ real x[ND_ND]; /*this will hold the position vector*/ real y; face_t f; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); y=x[1]; F_PROFILE(f,thread,position)=(0.003-y)/0.003*n0; } end_f_loop(f,thread)}DEFINE_PROFILE(inlet_tv,thread,position){ real x[ND_ND]; /*this will hold the position vector*/ real y; face_t f; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); F_PROFILE(f,thread,position)=v0; } end_f_loop(f,thread)}DEFINE_PROFILE(inlet_ta,thread,position){ real x[ND_ND]; /*this will hold the position vector*/ real y; face_t f; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); F_PROFILE(f,thread,position)=a0; } end_f_loop(f,thread)}
欢迎光临 研发埠 (http://bbs.yanfabu.com/)
Powered by Discuz! X3.2