CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

Can you be kind to check my UDFfile?

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

LinkBack Thread Tools Display Modes
Old   November 27, 2006, 01:18
Default Can you be kind to check my UDFfile?
david yang
Posts: n/a
When I load the heatsource UDF files to heat flux, the fluent display the following error.

chip-exec: heatsource: wrong return type: void udf function expected Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: ()

Does it means that the return valve type should be change?


My function is :Heat flux =0.64*[plaser*exp((-2*r*r)/(radius*radius))]/(pi*radius*radius),radius is the laser beam size. r=sqrt((x-xcenter)*(x-xcenter)+y*y)

#include "udf.h"

#define radius 8e-4 #define abs_coeff 0.4 #define plaser 1600 #define pi 3.14 #define vel 0.01 #define xbegin 0.006 #define xend 0.018

DEFINE_SOURCE(heatsource, c, th, dS, eqn) {

real x[ND_ND];

real r, z, first, xcenter, source;

real current_time;

real xc; /* xc - x coordinate */

real yc; /* yc - y coordinate */

cell_t c;

C_CENTROID(x,c,th); /* gets the cell centroid in the volume and puts it in vector x*/

xc=x[0]; /* the x coordinate of the cell - 0th component of vector x */

yc=x[1]; /* the y coordinate of the cell - 1st component of vector x */


xcenter = vel*current_time+xbegin; /* assumes that at t=0 the laser is at xbegin */


first= exp(-((2*r*r)/(radius*radius))); /* term that give the radial distribution of the laser intensity */

source = 0; /*source is zero unless otherwise specified */

if (r<=radius)


source=0.32*plaser*first/(pi*(radius*radius)); /* source non-zero and function of radius */




source = 0; /*source is 0 beyond the radius */


if (xend/vel<current_time)


source = 0; /* source is 0 if the time is larger than the time it takes to ge to the end position

this allows you to integrate and look at the solidification evenafter you stop the

laser source */


dS[eqn] = 0.0; /* the source does not depend on temperature so dS = 0 */

return source; }

if somebody know it, please help me. I am appreciated for your any suggestion.


  Reply With Quote

Old   November 27, 2006, 19:57
Default Re: Can you be kind to check my UDFfile?
Posts: n/a
1- What are these two lines above the #include directive

if they are a comment then follow the rules, 2- Each #define directive should be on a separate line
  Reply With Quote

Old   November 28, 2006, 18:24
Default Re: Can you be kind to check my UDFfile?
Venkatesh V
Posts: n/a
Hi, You cannot return the value. You have to just populate the dS array and return.

Thanks Venkatesh V
  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
grid check failed Steven FLUENT 7 April 6, 2011 12:00
please help me with this special kind of boundary condition. mactonald STAR-CD 4 May 2, 2009 07:07
grid check in FLUENT wan aizon FLUENT 4 January 20, 2006 05:33
3-D Mesh Check in Gambit..... SHR FLUENT 4 March 25, 2003 04:10
Grid Check error Taher FLUENT 3 August 30, 2002 09:55

All times are GMT -4. The time now is 19:57.