# Urgent! UDF error "implicit declaration of function"

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 June 17, 2010, 17:21 Urgent! UDF error "implicit declaration of function" #1 Member   Ivan Join Date: May 2009 Posts: 85 Rep Power: 9 Urgent, will wait online for answers! After compiling the following UDF, I see the error message "inlet_u.c:39: warning: implicit declaration of function erf". And the simulation crash if I continue using this UDF. The only problem is the function erf. But I have included math.h, anything else needs to be done? Or math.h is NOT the right header file to include if I want to use function erf? erf is error function. What is the reason? and How can I solve it? Thanks! /* UDF for specifying a transient inlet velocity profile boundary condition */ #include "udf.h" #include "math.h" #define PI 4.*atan(1.) #define RT 0.00183 real VM=21.911; real VNin=0.01; /**************** x velocity ****************/ DEFINE_PROFILE(v_x, thread, index) { face_t f; real t,dt,u; real D1,D2,D3,D4,D5,D6,D7; real G1,G2,G3; /* wind gust model parameters */ D1=VM*700; D2=7/(3*RT); D3=1; D4=3/(3*RT); D5=0.15; D6=7/(10*RT); D7=2*PI/(RT/10); /* get flow time */ t = CURRENT_TIME; /* u = X Velocity */ if (t<=VNin*RT) { u = VM;} else { /* get dt */ dt = t-VNin*RT; /* wind gust model */ G1=D1*dt*exp(-D2*dt); G2=D3*erf(D4*dt); G3=D5*exp(-D6*dt)*sin(D7*dt); /* get u */ u = VM+G1+G2+G3;} /* assign X velocity */ begin_f_loop(f, thread) { F_PROFILE(f, thread, index) = u; } end_f_loop(f, thread) }

 June 17, 2010, 17:28 #2 Senior Member   Join Date: Nov 2009 Posts: 411 Rep Power: 11 I suppose you are on a Windows system ? If yes the erf function is not implemented in math.h . So basically you will need to implement a custom version of erf in your UDF function. If you are on Linux erf should be already defined in math.h so you need to search for the error in a different place. Do

 June 17, 2010, 17:35 #3 Member   Ivan Join Date: May 2009 Posts: 85 Rep Power: 9 (post here again to make sure you can see my response) Thank you so much for replying. I run Fluent on Linux. I searched the src folder (it contains the udf.h file) for the file math.h and did NOT find it. If I have to implement a custom version of erf, how to do it? I checked the UDF manual, it says "C compilers include a library of standard mathematical and I/O functions", but it does not say what if I want to use a function like erf.

June 18, 2010, 05:46
#4
New Member

Join Date: Mar 2009
Posts: 9
Rep Power: 9
Quote:
 Originally Posted by ivanbuz (post here again to make sure you can see my response) Thank you so much for replying. I run Fluent on Linux. I searched the src folder (it contains the udf.h file) for the file math.h and did NOT find it. If I have to implement a custom version of erf, how to do it? I checked the UDF manual, it says "C compilers include a library of standard mathematical and I/O functions", but it does not say what if I want to use a function like erf.
If it will be a help for you I can show you the erf I use in a UDF. I converted a Fortran version found on the internet into C.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post gschaider OpenFOAM 300 October 29, 2014 19:00 Max FLUENT 1 September 24, 2010 20:30 ivanbuz FLUENT 13 June 17, 2010 18:11 jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51 Prateep Chatterjee FLUENT 6 October 16, 2001 19:20

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

 Contact Us - CFD Online - Top