# DEFINE_SOURCE : Urgent PLZ

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 13, 2006, 10:01 DEFINE_SOURCE : Urgent PLZ #1 PK Guest   Posts: n/a Hi , I have a 2D simulation (flow with 2 species S1 and S2 in a channel) I have an amount of specie S1 at inlet and I want to have a certain amount of the same specie S1 at the outlet : So I manage to get D1 a "density" of specie S1 to be removed (Unit : Kg/m3) for all the domain . If I use source = - D1 x C_VOLUME for each cell I would get the mass (kg) of specie S1 to be removed per cell . But how to have it in Kg/m3/s (which the unit of source)?. I have a steady simulation. Thanks any kind of help. PK

 December 13, 2006, 16:11 Re: DEFINE_SOURCE : Urgent PLZ #2 Allan Walsh Guest   Posts: n/a Are you using a UDF? Could you not just use the source option in the base version of Fluent? That is boundary condition (of fluid)->source->set source.

 December 14, 2006, 04:40 Re: DEFINE_SOURCE : Urgent PLZ #3 PK Guest   Posts: n/a Hi Yes I am using a UDF, but I have the same problem by using this boundary conditions features through the GUI . with the UDF I do this : To be more precise in my question : -1 : I know the mass fraction of Si at the inlet : MF_S1_inlet -2 : I know the mass fraction of Si at the outlet : MF_S1_oulet . So I can get the mass (Kg )which should removed all over the Domain and so have this removal "density" of S1 (D1) all over the Domain (Kg/m3). So when I am using DEFINE_SOURCE : DEFINE_SOURCE(remove_S1,cell,thread,dS,eqn) { removal_density_S1 = D1; source = -removal_density_S1 *C_VOLUME(cell,thread); dS[eqn] = 0; return source; /*(so it is a mass)*/ } By doing this I am not able to get the MF_S1_oulet : it seems that not enough S1 is removed. I am running a steady state simulation Thanks a lot for your help

 December 14, 2006, 16:06 Re: DEFINE_SOURCE : Urgent PLZ #4 Allan Walsh Guest   Posts: n/a I didn't see any obvious problems in your code. It looks like you just want to have constant removal rate - why don't you just use the built in boundary condition source? Does it not work to deplete a species? I know it works fine to add a species source in 2D. There are lots of ways to go wrong in UDFs. I am using a UDF to add a source term for a species evolved from a particle. Fluent gives the macro DEFINE_DPM_SOURCE which I was going to use, but I started just directly changing the species storage variable. It has not caused any problems, so I have not bothered with the source macro. Good Luck.