CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Define_Source UDF (https://www.cfd-online.com/Forums/fluent/95429-define_source-udf.html)

Jim87 December 17, 2011 06:37

Define_Source UDF
 
Hi there,
I'm trying to write a UDF for an periodic heat source. The UDF should look like a saw tooth thread design.

I'm very new to UDF, but In my opinion the errors are in the first lines (in the "initialization")

- It should be a transient funcion (heat source depends on time)
- Heat is generated in an Interior (3D)

Maybe someone of you see the mistake(s) in this UDF

include "udf.h"

Define_Source(heat_function, c, t, dS, eqn)

{
real t = CURRENT_TIME;
{
if (CURRENT_TIME > 151.76)
heat_flux = 0.1;

else if (CURRENT_TIME >= 2.24 && CURRENT_TIME <= 2.96)
heat_flux = 200000;

else if (CURRENT_TIME >= 27.04 && CURRENT_TIME <= 27.76)
heat_flux = 200000;

else if CURRENT_TIME >= 51.84 && CURRENT_TIME <= 52.56)
heat_flux = 200000;

else if (CURRENT_TIME >= 76.64 && CURRENT_TIME <= 77.36)
heat_flux = 200000;

else if (current_time >= 101.44 && CURRENT_TIME <= 102.16)
heat_flux = 200000;

else if (CURRENT_TIME >= 126.24 && CURRENT_TIME <= 126.96)
heat_flux = 200000;

else if (CURRENT_TIME >= 151.04 && CURRENT_TIME <= 151.76)
heat_flux = 200000;

else
heat_flux = 0.0;
}
}
return heat_flux;


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