CFD Online Discussion Forums

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

rp.soni December 16, 2013 01:29

regarding UDF
 
i am using UDF for source term of volumetric heat generation for my 2D simulation of heat transfer. Since i am new user for UDF, so i am in doubt whether i have written a correct UDF or not. UDF is given below.

/* sinusoidal heat generation in heater*/
#include "udf.h"
#include "math.h"
DEFINE_SOURCE(heat_gen_1e5,cell,thread,dS,eqn)
{
double source;
double time,A,B,omega,pi,time_period ;
A = 1.0e2, B=1.0e5;
pi= 22.0/7.0;
time_period = 900.0; //time in seconds;
time = CURRENT_TIME; //taking time value;
omega = (2.0*pi)/time_period;
source = A+B*(1+sin(omega*time));
//dS[eqn]= B*omega*cos(omega*time);
dS[eqn]= 0.0;
return source;
}


Kindly go through this UDF and reply whether it is in correct format or not.

Thanking you


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