CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Transient udf for limiting flux (solid fuel combustion) (https://www.cfd-online.com/Forums/fluent/148986-transient-udf-limiting-flux-solid-fuel-combustion.html)

Bharadwaj B S February 23, 2015 08:46

Transient udf for limiting flux (solid fuel combustion)
 
Hi everyone,

My name is Bharadwaj B S, I am currently doing a project on solid fuel combustion (Single particle). In this I have created a sphere inside a cylindrical fluid domain.

There will be velocity inlet from one side of cylinder and another inlet from the surface of the sphere as mass flux( kg/m^2 s) signifying volatile release.

I have written a simple code where the flux from the sphere is arbitrarily dependent on sphere face temperature (F_T(f, t)). Upto 20 seconds there should be mass flux from the surface of the sphere, when the time reaches 20 seconds the mass flux from surface should stop. For this I have used the if else condition.

From the logic side it seems to be fine. But when I hook and see the result. It is not showing the flux from the surface.

QUESTION:

1. Is there any mistake in UDF (macro used, logic or anything)?
2. Can I use CURRENT_TIME in DEFINE_PROFILE?
Because there is a separate macro for transient Profiles. (DEINE_TRANSIENT_PROFILE).
3. Is there any correction in condition (if (time <= 20))??

Please reply at your earliest convenience. Any help will be of great use for me. Thanks in Advance.:)

UDF:

#include "udf.h"
#include "math.h"

real time;
real tmp;
real flx;
real a;
real b;
int i;
int ID = 13;
Thread *t;
face_t f;
cell_t c;

DEFINE_PROFILE(flux, t, i)
{
Domain *d;

d = Get_Domain(1);
t = Lookup_Thread(d, ID);
flx = 0.0;
tmp = 0.0;
a = - 0.5;
b = 0.0;
time = CURRENT_TIME;

begin_f_loop(f, t)
{
if(time <= 20)
{
flx = - a * tmp;
tmp = F_T(f, t);
F_PROFILE(f, t, i) = flx;
}
else
{
F_PROFILE(f, t, i) = b;
}
end_f_loop(f,t)
}
}


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