CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

udf for heat generation

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   September 21, 2013, 13:21
Default udf for heat generation
Join Date: Aug 2010
Posts: 41
Rep Power: 9
sarah l is on a distinguished road
hi ,
I am supposed to write a udf for a heat generation that depends on time and space . here its formula:

Q(t0,ts)=Q_0(X)*A*(ts^ (ľa)-( t_0 + ts)^(-a))

Q_0(X)=(5000*sin(0.285*x[0])+ 1800)
i try to write a udf
#include "udf.h"
#include "math.h"

real x[ND_ND];
real source;
real t = CURRENT_TIME ;
real t_0;
cell_t c;
if((t>0.1) && (t<10))
source = (4958000*sin(0.285*x[0])+ 1866900)*0.0603*
(pow(t,-0.0639)-pow(t+t_0, -0.0639) ;
dS[eqn] = 1416001.489*cos(0.285*x[0])*0.0603*(pow(t,-0.0639)-pow(t+t_0, -0.0639) ;
return source;
if((t>10) && (t<150))
source = (4958000*sin(0.285*x[0])+ 1866900)*0.0766*(pow(t,-0.181)-pow(t+t_0, -0.181) ;
dS[eqn] = 1416001.489*cos(0.285*x[0])* 0.0766*(pow(t,-0.181)-pow(t+t_0, -0.181) ;
return source;
if((t>150) && (t<4000000))
source = (4958000*sin(0.285*x[0])+ 1866900)*0.13*(pow(t,-0.283)-pow(t+t_0, -0. 283) ;
dS[eqn] = 1416001.489*cos(0.285*x[0])* 0.13*(pow(t,-0.283)-pow(t+t_0, -0. 283);
return source;
if((t>4000000) && (t<200000000))
source = (4958000*sin(0.285*x[0])+ 1866900)*0.266*(pow(t,-0.335)-pow(t+t_0, -0. 335) ;
dS[eqn] = 1416001.489*cos(0.285*x[0])* 0.266*(pow(t,-0.335)-pow(t+t_0, -0. 335);
return source;

but there are some errors !
is there any nice person who help me to correct it?
sarah l is offline   Reply With Quote

Old   October 16, 2013, 17:48
New Member
David Aliaga
Join Date: Oct 2013
Posts: 4
Rep Power: 6
David UTFSM MEC is on a distinguished road
Hey! its an old post but anyway,.. im working too with source terms .

i think you dont need the cell loop in the define_source macro, cause this is already looping on the cell thread zone.

another thing, the variable t that you are using could be a problem, cause its been used for time and threat pointer at the same time. i hope it helps
David UTFSM MEC is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF using c_face_loop(c,t,i) frederic FLUENT 3 January 17, 2017 00:17
Help me to check my UDF Liufeng_ustb Fluent UDF and Scheme Programming 2 May 7, 2013 10:25
Simulation with UDF for species mass fraction and velocity profile virgy Fluent UDF and Scheme Programming 8 February 7, 2012 05:30
UDF programming fullmonty FLUENT 5 June 30, 2011 02:40
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01

All times are GMT -4. The time now is 00:38.