- **Fluent UDF and Scheme Programming**
(*http://www.cfd-online.com/Forums/fluent-udf/*)

- - **How can I get Help? Scalar transport_source term**
(*http://www.cfd-online.com/Forums/fluent-udf/75922-how-can-i-get-help-scalar-transport_source-term.html*)

How can I get Help? Scalar transport_source termHi,
I am using scalar transport equation to simulate the particle transport in a porous zone in 2D. The source term at each cell is U*A*CE*Cin/Vcontrol (The UDS equation has no density term), U is the cell velocity A is face area of velocity in, which is also the face normal vector of the face (dx for V, and dz for U) CE is the collection efficiency of porous zone at each cell, Cin is the UDS which is the number concentration of the particle Vcontrol is the control volume of the cell which is dx*dz in 2D. The following is the code I wrote. Please help me to find the error:), I am a starter and nobody near me can help me :-(. I have been working on that for a long time and can not find any clue to make it work,Wuuuuuu :-(. Oh, BTW, as for the boundary of the porous zone (rectangular W*H), I set "interface" for three sides of the zone where it stand in the air, and the bottom is set to wall. #include "udf.h" #include "stdio.h" #define dp 0.875e-6 /*particle diameter (um) */ #define Dcyl 0.006 /*cylinder diameter of tree stem&twig (m) */ #define Dleaf 0.001 /*leaf diameter of tree stem&twig (m) */ #define K 1.38e-23 /*Boltzmann constant (Nm/K)*/ #define T 293 /*Temperature at 20C (K)*/ #define mu 1.789e-5 /*viscosity (N s/m^2) */ #define rhoP 1050 /*density of particle (Kg/m^3)*/ #define rhoA 1.225 /*density of air (Kg/m^3)*/ #define pi 3.1415926 /*constant Pi */ #define lambda 0.066 /*mean free path (um) */ #define g 9.81 /*gravity acceleration m/s^2*/ #define Cpol 1.32 /*Polhausen coefficient*/ /*Calculated constant by giving a dp*/ #define Cc 1.177 /*Slip corrction factor*/ #define dm 3.22492e-11 /*laminar diffusion coefficient (m^2/s) */ #define Trel 2.49589e-6 /*relaxation time of the particle (s)*/ #define Usettle 0.00002882 /*settling speed of particle (m/s) */ #define B 8.55378e-7 #define D 68458.70124 /************************************************** ************************************************** ***************/ DEFINE_SOURCE(uds_source0,c,t,dS,eqn) { real source; face_t f; real x[ND_ND], z, Ucell, volume,NV_VEC(A), NV_VEC(Uface); z=x[1]; Ucell=C_U(c,t); volume=C_VOLUME(c,t); F_AREA(A,f,t); int i; /**********************For collection efficiency of leaves and cylinder of the tree (CEcell) ************************/ /*CE is the total collection efficiency =CEcyl+CEleaf (<=1)at each cell */ real CEcell,CEcell_c,CEcyl,CEleaf, SADcell; real Ec,Ec_c, El, El_c;/*collection efficiency of each cell due to all deposition mechanisms*/ real Edc, Edl; /*collection efficiency of cylinder&leaf due to DIFFUSION*/ real Eiic, Eiil; /*collection efficiency of cylinder&leaf due to INTERCEPTION+IMPACTION*/ real Eic, Eil; /*collection efficiency of cylinder&leaf due to IMPACTION*/ real Rec, Rel,Stkc, Stkl, Rc, Rl; Rec=D*Dcyl*Ucell; /*Reynolds number for flow around a cylinder*/ Rel=D*Dleaf*Ucell; /*Reynolds number for flow around a leaf*/ Stkc=Trel*Ucell/Dcyl;/*Stk number for flow around a cylinder*/ Stkl=Trel*Ucell/Dleaf; /*Stk number for flow around a leaf*/ Rc=dp/Dcyl; /*interception parameter for flow around a cylinder*/ Rl=dp/Dleaf; /*interception parameter for flow around a leaf*/ /************************************************** ************************************************** ********************/ begin_f_loop(f,t) { C_CENTROID(x,f,t); /*for cylinder collection efficiency at each cell due to all deposition mechanisms*/ Edc= B/pow((Dcyl*Ucell),0.5); Eiic = (Stkc/(Stkc+0.8)-(2.56-log10(Rec)-3.2*Rc)/(10*sqrt(Stkc)))*(1+Rc); Eic = Eiic; if (Eic >(1+Rc)){ Eiic = pow(Stkc/(Stkc+0.8),2); } else if (Eic< 0){ Eiic= pow(Stkc/(Stkc+0.8),2); } else{ Eiic= Eic; } /*cylinder*/Ec = (Edc + Eiic); Ec_c=Ec; if (Ec_c>=1){ Ec=1; } else if (z>((3/8)*x[0]+2.5)&&z>((-3/8)*x[0]+1.9)&&z<(-2.1*x[0]-1.46)&&z<(2.1*x[0]+1.9)){ Ec=0; } else { Ec=Ec_c; } /*Surface area density (SAD)of foliage */ if (z <= 2.07){ SADcell = -3.99043*pow(z,3)+12.8994*pow(z,2)-7.58257*z+1.89096; } else { SADcell = -224.925*pow(z,2)+912.217*z-918.31; } CEcyl = 1-exp(1-SADcell*Ec*dx); /*total collection efficiency at each cell */ CEcell=2*CEcyl; CEcell_c=CEcell; if (CEcell_c>=1){ CEcell=1; } else { CEcell=CEcell_c; } source = C_UDSI(f,t,0)*CEcell*Ucell*F_AREA(A,f,t)/volume; dS[eqn] = CEcell*Ucell*F_AREA(A,f,t)/volume; } end_f_loop(f,t) return source; } |

All times are GMT -4. The time now is 11:16. |