CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   DEFINE_SOURCE, injection in one Cell, mass balance (http://www.cfd-online.com/Forums/fluent/44543-define_source-injection-one-cell-mass-balance.html)

Vitali April 27, 2007 06:51

DEFINE_SOURCE, injection in one Cell, mass balance
 
Hi everybody! I do some injection of methane in one Cell in zone. But if I calculate mass balance after, I see, that it was more injected in Cell. Is somebody know, what I do wrong?

I use "boudary condition" and I activated "Source Terms" in GUI. Then I can see in the list all species that I use (CH4, O2, CO2 and H20), mass (kg/m3-s), axial momentum and more. After I set my DEFINE_SOURCE in UDF to the methane in the list. I use UDF, because my injected mass of methan must be change and so I can quick change the location of injection's point and I don't need create a new zone.

I inject only in one Cell, which I marked with UDM equal 1. Then I can proof in looping, is it my cell for injection or not. I tried it with steady and unsteady problem, and got the same result. It was injected to many methane.

source has units [kg/(m3*s)], so I use formel

source = mass flow of Methan that I inject [kg/s] / C_VOLUME(c,t)[ m3]

the part of my C-code:

DEFINE_SOURCE(injection_in_Cell, c, t, dS, eqn) { float source=0., mass_flow=0.001; /* kg/s */ if (C_UDMI(c,t,UDM_SOURCE) ==1.0) { Message("######## Injection in Cell ID=%i\n",c); source=mass_flow / C_VOLUME(c,t); dS[eqn]=0.0; } return source; }

for test mass balance I use: /report species-mass-flow

Vitali

Allan Walsh April 27, 2007 13:58

Re: DEFINE_SOURCE, injection in one Cell, mass bal
 
Lets try this again. If you just type in the mass source, i.e. 0.001 without using your UDF, does it work.

Now for your UDF, can you explain which variable passes the source term back, since you have set dS[eqn]=0.0 ?

Why do you use the type "float" rather than real?

Vitali April 27, 2007 16:39

Re: DEFINE_SOURCE, injection in one Cell, mass bal
 
Hi,

>> Lets try this again. If you just type in the mass source, i.e. 0.001 without using your UDF, does it work.

if I do it without UDF, then I cann't find my marked for injection Cell with UDM.

if (C_UDMI(c,t,UDM_SOURCE)==1.0)

I know, that I can create a new zone and then set source for this zone. And it works fine, mass balance is correctly

My UDF return variable source. If my cell for injection was fount, I set source equal mass_flow / C_VOLUME(c,t), if not then source remains zero.

> type "float" rather than real? I donn't know, I will change it and hope that is the problem., but I'm not sure.

I hope some day understand, how DEFINE_SOURCE work with separate cell :) Thank's for your support!


All times are GMT -4. The time now is 23:23.