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

 Jason August 1, 2006 02:46

energy source UDF

Hi,

I have a trouble about UDF. The energy produced by the chip is varied with time. Anyone can help me modify the UDF? Thanks~~

/* Heat Generation Rate UDF */

#include "udf.h"

DEFINE_SOURCE(source, cell, thread) {

real T = CURRENT_TIME ; real source ; real s1, s2, s3, s4 ; s1=10E+5 ; s2=5*10E+5 ; s3=2*10E+6 ;

if (T <= 0.05)

source = s1;

else if (0.05< T <= 0.15)

source = s2;

else if (0.15 < T)

source = s3;

return source; }

 Anon August 1, 2006 04:43

Re: energy source UDF

A source term also needs its derivative. that is missing in all the conditions. Derivative term here is zero since your source is a constant. Units are: W/m3. Please check an example UDF in the manual.

 Jason August 2, 2006 02:35

Re: energy source UDF

Hi Anon,

I changed my UDF as following but the result is incorrect. Could you tell me where is the error? Thanks!

* Heat Generation Rate UDF */

#include "udf.h" DEFINE_SOURCE(heat_source, cell, thread, dS, eqn)

{

real T = CURRENT_TIME ; real source ; real s1, s2, s3, s4 ; s1=5*10E+7 ; s2=10E+5 ; s3=2*10E+7 ;

if (T <= 1.5)

source = s1;

else if (1.5 < T <= 2)

source = s2;

else if (2 < T)

source = s3;

return source; }

 summer August 2, 2006 14:30

Re: energy source UDF

You need add the derivative as ds[eqn]=0 since it seems that s1 et.al are constant. Hope it helps.

 All times are GMT -4. The time now is 21:03.