|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
Hi! I want to model a filter (but not modeling it as a porous media), in a room I have SO2 and air mixture. First I want to get the SO2 mass flow rate at the inlet surface of the filter, then multiply it by 0.999989, and set the sink rate of the filter volume as -0.999989*(SO2 mass flow rate at the inlet surface)/(Volume of filter). For the outlet of the filter, I set it as "interior", and my simulation is always transient.
Below is my code, please advise.
#include "udf.h"
DEFINE_SOURCE(cell_SO2mass_source,cell,thread,dS,e qn)
{
real x[ND_ND];
real source, t, massflowrate, volume, vol_tot;
real ti = RP_Get_Real("flow-time");
real NV_VEC(flux), NV_VEC(A); /* declaring vectors flux and A */
face_t face, f
Cell_t cell
Thread *thread
C_CENTROID(x,cell,thread);
x=x[0]; /*****给出每个单元的x坐标*******/
y=x[1]; /*****给出每个单元的y坐标*******/
z=x[2]; /*****给出每个单元的z坐标*******/
d = Get_Domain(1);
t= Lookup_Thread(d, 12); /* defining the inlet surface thread by specifying the Zone_ID*/
begin_f_loop(f,t)
{
NV_D(flux, =, F_U(f,t), F_V(f,t), F_W(f,t)); /* defining flux in terms of velocity field */
NV_S(flux, *=, F_R(f,t)) /* multiplying density to get flux vector */
F_AREA(A,f,t) /* face normal vector returned from F_AREA */
massflowrate+= F_YI(f,t,i)*NV_DOT(flux,A); /* dot product of the inlet surface flux and area vector*/
/* multiplied by the mass fraction of species i */
}
end_f_loop(f,t)
begin_c_loop(cell,thread)
{
volume = C_VOLUME(cell,thread); /* get cell volume */
vol_tot += volume;
}
end_c_loop(cell,thread)
source=-0.999989* massflowrate/vol_tot;
dS[eqn]=0.0;
return source;
}
I actually have 2 question:
1. is "f" the inlet surface corresponding to the "t" that I set? "t" is the thread corresponding to inlet surface.
2. is C_CENTROID necessary in this case?
Thanks |
|