CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF for inlet gas impulse (https://www.cfd-online.com/Forums/fluent/69754-udf-inlet-gas-impulse.html)

solefire November 3, 2009 07:53

UDF for inlet gas impulse
 
Here is a problem I have met recently and I hope I make it clear here.

There are mixed gases at the inlet, including air and NH3(ammonia). Air is supposed to be at stationary motion, while NH3 is injected only from the 2nd second to 2.5 second (lasting for 0.5 seconds) with mass fraction 0.01. Therefore, ammonia can be regarded as the tracer.
I tried to write the UDF shown below, while I still don't have a very clear clue how to set the ammonia as the tracer and air as the steady flow. Hopefully I can get some of advice!Thanks a lot!

#include "udf.h"
DEFINE_PROFILE(inlet_tracer,thread,nv)
{
face_t f;
real flow_time = RP_Get_Real("flow-time");
begin_f_loop (f,thread)
{
if(flow_time<2)
F_PROFILE(f,thread,nv)=0;
if(flow_time>=2&&flow_time<=2.5)
F_PROFILE(f,thread,nv)=0.01;
else if(flow_time>2.5)
F_PROFILE(f,thread,nv)=0;
}
end_f_loop (f,thread)
}


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