# UDF for 2D gaussian distribution

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

 June 29, 2010, 15:07 UDF for 2D gaussian distribution #1 New Member   sunitha Join Date: Jun 2010 Posts: 17 Rep Power: 7 Hai, I have written a code but im having problems with how to assign the absolute value.Can anyone tell me whats de mistake in my code? thank you # include "udf.h" # define v 10 # define delt .05 # define delx .5 # define I0 2*10000000 # define n 39 DEFINE_PROFILE(g_profile,t,i) { int x[ND_ND]; int j,k; double xreg; double xl[39],I[39],y[39]; face_t f; /*xl= (v*delt)+(delx/2);*/ begin_f_loop(f,t) { F_CENTROID(x,f,t); y[0]=x[1]; for(j=1;j<=n;j++) { y[j]=(j-1)*delt; /*k=j;*/ xl[j]=(j-1)*v*delt; printf("%f\n",&xl[j]); /*xreg=(y[j]-xl[j]);*/ double fabs(double (y[j]-xl[j])); { if ((y[j]-xl[j]) < 0) xreg = -1*(y[j]-xl[j]); else xreg = (y[j]-xl[j]); } if(xreg

 June 29, 2010, 15:12 #2 Senior Member   Join Date: Nov 2009 Posts: 411 Rep Power: 10 You've missed an : #include

 June 29, 2010, 15:16 #3 New Member   sunitha Join Date: Jun 2010 Posts: 17 Rep Power: 7 Hai, I have included #include "math.h" but this is still showing parse error at line 27..what should i change?

 June 29, 2010, 16:52 please solve my problem in udf #4 New Member   sunitha Join Date: Jun 2010 Posts: 17 Rep Power: 7 when i am tring to compile i am getting this error.... Deleted old libudf\ntx86\2ddp\libudf.dll 1 file(s) copied. 1 file(s) copied. (system "copy \speedy\sdsmtshare\NetApps\FLUENT.INC\fluent6.3.26 \src\makefile_nt.udf libudf\ntx86\2ddp\makefile") 1 file(s) copied. (chdir "libudf")() (chdir "ntx86\2ddp")() 'nmake' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file. what could be the mistake? please let me know

 June 29, 2010, 19:43 #5 Senior Member   Join Date: Nov 2009 Posts: 411 Rep Power: 10 NOT #include "math.h" BUT #include Also you should first try to interpret the UDF in order to be sure the C code is fine and after that you can try to compile the code . Again use <> and not "" for math.h. Do

 June 29, 2010, 21:13 #6 Senior Member   Join Date: Nov 2009 Posts: 411 Rep Power: 10 Anyway it seems that you have a logical error in your code the line that gives you an error the one with fabs has no role in this code . If you erase (or comment) this line and leave the code as it is it will work. Do =============================== # include "udf.h" # define v 10 # define delt .05 # define delx .5 # define I0 2*10000000 # define n 39 DEFINE_PROFILE(g_profile,t,i) { int x[ND_ND]; int j,k; double xreg; double xl[39],I[39],y[39]; face_t f; /*xl= (v*delt)+(delx/2);*/ begin_f_loop(f,t) { F_CENTROID(x,f,t); y[0]=x[1]; for(j=1;j<=n;j++) { y[j]=(j-1)*delt; /*k=j;*/ xl[j]=(j-1)*v*delt; printf("%f\n",&xl[j]); /*xreg=(y[j]-xl[j]);*/ /*double fabs(double (y[j]-xl[j]));*/ { if ((y[j]-xl[j]) < 0) xreg = -1*(y[j]-xl[j]); else xreg = (y[j]-xl[j]); } if(xreg

 June 30, 2010, 14:17 #7 New Member   sunitha Join Date: Jun 2010 Posts: 17 Rep Power: 7 Thank you. I have tried like that and its getting interpreted its not showing any errors but when im trying to compile i am getting error like 1 file(s) copied. 1 file(s) copied. (system "copy \speedy\sdsmtshare\NetApps\FLUENT.INC\fluent6.3.26 \src\makefile_nt.udf libudf\ntx86\2ddp\makefile") 1 file(s) copied. (chdir "libudf")() (chdir "ntx86\2ddp")() 'nmake' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file. Done. "f:/projects/cml/lekkala_sunitha/project spring10/newmodelapril2010" Opening library "libudf"... Error: open_udf_library: The system cannot find the file specified. Can you tell me why is this coming and could you plss suggest something about it?? Thank you

 June 30, 2010, 15:54 #8 New Member   Luk Join Date: Jun 2009 Posts: 24 Rep Power: 8 Do you have external compiler e.g. Microsoft Visual? __________________ *******************************

 June 30, 2010, 16:28 #9 New Member   sunitha Join Date: Jun 2010 Posts: 17 Rep Power: 7 yes i do have microsoft visual studio.NET and im trying to open fluent through the command prompt..but still same error is coming up..

 June 30, 2010, 17:30 #10 New Member   Luk Join Date: Jun 2009 Posts: 24 Rep Power: 8 It compiles on my system, in both interpreted and compiled way. But after compiled could not find libudf library. Try to reinstal visual studio, on wikicfd is a nice description how to do it. http://www.cfd-online.com/Wiki/Fluen...Fload_a_UDF.3F __________________ *******************************

June 30, 2010, 18:56
#11
New Member

sunitha
Join Date: Jun 2010
Posts: 17
Rep Power: 7
Quote:
 Originally Posted by Geisel It compiles on my system, in both interpreted and compiled way. But after compiled could not find libudf library. Try to reinstal visual studio, on wikicfd is a nice description how to do it. http://www.cfd-online.com/Wiki/Fluen...Fload_a_UDF.3F
its working for me... i opened fluent through visual studio command prompt.. thank you so much for your help

July 7, 2010, 16:43
regarding results need help
#12
New Member

sunitha
Join Date: Jun 2010
Posts: 17
Rep Power: 7
Quote:
 Originally Posted by slek its working for me... i opened fluent through visual studio command prompt.. thank you so much for your help

Hai,

i have run de code but not getting de output correctly as i have written in code.donno y?? below is my code
# include "udf.h"
# define v 10 /* constants */
# define delt .1
# define delx .5
# define I0 2*10000000
# define n 10
DEFINE_PROFILE(g_profile,t,i)
{
int x[ND_ND];
int j;
double xreg;
double xl[1],I[1],y[1];
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
xl[1]=x[0];
y[1]=x[0];
for(j=1;j<=n;j++)
{
y[j]=(j-1)*delt;
xl[j]=(j-1)*v*delt;
{
if ((y[j]-xl[j]) < 0)
xreg = -1*(y[j]-xl[j]);
else
xreg = (y[j]-xl[j]);
}
if(xreg<=delx)
I[j]=I0*exp((-2*((xreg)*(xreg)))/(delx*delx));
else
I[j]=0;
/*F_PROFILE(f,t,i)= I[j];*/
printf( "%i\n", j);
printf( "%f\n", I[j]);
}
}
end_f_loop(f,t)
}

thanks

please suggest me what could be wrong??

 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 shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14 Ken Adams FLUENT 0 May 25, 2007 15:25 Rashmi FLUENT 6 December 12, 2005 00:09 as FLUENT 7 April 3, 2005 17:36 fpingqian FLUENT 0 February 25, 2005 02:48

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