CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

udf for heat generation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 21, 2013, 14:21
Default udf for heat generation
  #1
Member
 
sarah
Join Date: Aug 2010
Posts: 42
Rep Power: 16
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)
t_0=35424000
i try to write a udf
#include "udf.h"
#include "math.h"

DEFINE_SOURCE(energy_source,c,t,dS,eqn)
{
real x[ND_ND];
real source;
real t = CURRENT_TIME ;
real t_0;
cell_t c;
t_0=35424000;
begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
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;
}
end_c_loop(c,t)
}

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

Old   October 16, 2013, 18:48
Default
  #2
New Member
 
David Aliaga
Join Date: Oct 2013
Posts: 4
Rep Power: 13
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

Reply


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 Off
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 11: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 03: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 15:57.