I need to write a UDF for a boundary condition of a gas flow rate. In my simulation using Fluent, I need to simulate a process lasts for ~ 5 hours. During the process a specific gas flow rate (1.6389 kg per hour) is injected through pipes to the fluid domain. The gas flow rate is injected when the process starts (i.e. when flow time is zero in the simulation) and repeats every one hour. The injection process lasts for few seconds.
So how can I write the suitable UDF for this flow rate?. I wrote a simple code and would be so much grateful if anyone has experience with UDF can give me a feedback. Any help is greatly appreciated.
#include "udf.h"
DEFINE_PROFILE(transient_mf, thread, position)
{
face_t f ;
real t = RP_Get_Real("flow-time"); /* to calculate the physical time step*/
begin_f_loop(f, thread)
{
if (t==0,3600, 2*3600, 3*3600, 4*3600, 5*3600)
{
F_PROFILE(f, thread, position) = 1.6389;
}
else
{
F_PROFILE(f, thread, position) = 0;
}
}
end_f_loop(f, thread)
}