CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   time dependent energy source term (https://www.cfd-online.com/Forums/fluent/95292-time-dependent-energy-source-term.html)

kevinz December 12, 2011 16:45

time dependent energy source term
 
I need to add an energy source term in a flow region. The source term is time dependent. I tried the following UDF, but it's not working. Anyone kindly offer some help?

/************************************************** ***/
/*To be defined source term is S=A*sin(2*PI*F*t)*/

#include "udf.h"
#define A 11
#define F 1000
#define PI 3.1415926

DEFINE_SOURCE(energy_source,cell,thread,dS,eqn)
{
real source;
real current_time=CURRENT_TIME;

source=A*sin(2*PI*F*current_time);
dS[eqn]=A*2*PI*F*cos(2*PI*F*current_time);

return source;
}


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