|
[Sponsors] |
June 29, 2010, 16:07 |
UDF for 2D gaussian distribution
|
#1 |
New Member
sunitha
Join Date: Jun 2010
Posts: 17
Rep Power: 16 |
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<delx) { I[j]=I0*exp((-2*((xreg)*(xreg)))/(delx*delx)); } else { I[j]=0; } printf( "%f\n", &I[j]); } } end_f_loop(f,t) } when i try to interpret fluent is showing parse error at line where the fabs function is there... |
|
June 29, 2010, 16:12 |
|
#2 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 20 |
You've missed an :
#include <math.h> |
|
June 29, 2010, 16:16 |
|
#3 |
New Member
sunitha
Join Date: Jun 2010
Posts: 17
Rep Power: 16 |
Hai,
I have included #include "math.h" but this is still showing parse error at line 27..what should i change? |
|
June 29, 2010, 17:52 |
please solve my problem in udf
|
#4 |
New Member
sunitha
Join Date: Jun 2010
Posts: 17
Rep Power: 16 |
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, 20:43 |
|
#5 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 20 |
NOT #include "math.h" BUT
#include <math.h> 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, 22:13 |
|
#6 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 20 |
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<delx) { I[j]=I0*exp((-2*((xreg)*(xreg)))/(delx*delx)); } else { I[j]=0; } printf( "%f\n", &I[j]); } } end_f_loop(f,t) } |
|
June 30, 2010, 15:17 |
|
#7 |
New Member
sunitha
Join Date: Jun 2010
Posts: 17
Rep Power: 16 |
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, 16:54 |
|
#8 |
New Member
Luk
Join Date: Jun 2009
Posts: 24
Rep Power: 17 |
Do you have external compiler e.g. Microsoft Visual?
__________________
******************************* |
|
June 30, 2010, 17:28 |
|
#9 |
New Member
sunitha
Join Date: Jun 2010
Posts: 17
Rep Power: 16 |
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, 18:30 |
|
#10 |
New Member
Luk
Join Date: Jun 2009
Posts: 24
Rep Power: 17 |
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, 19:56 |
|
#11 | |
New Member
sunitha
Join Date: Jun 2010
Posts: 17
Rep Power: 16 |
Quote:
|
||
July 7, 2010, 17:43 |
regarding results need help
|
#12 | |
New Member
sunitha
Join Date: Jun 2010
Posts: 17
Rep Power: 16 |
Quote:
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?? |
||
January 14, 2020, 16:33 |
|
#13 |
New Member
Join Date: Jan 2020
Posts: 6
Rep Power: 6 |
Did you find out what's wrong with it? I'm having the same problem now
|
|
January 14, 2020, 22:52 |
|
#14 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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[n],I[n],y[n]; face_t f; begin_f_loop(f,t) { F_CENTROID(x,f,t); xl[0]=x[0]; y[0]=x[0]; for(j=0;j<n;j++) { y[j]=(j)*delt; xl[j]=(j)*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];*/ Message0( "%i\n", j); Message0( "%f\n", I[j]); } } end_f_loop(f,t) }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
Customize Heat Flux Distribution Using UDF | Ken Adams | FLUENT | 0 | May 25, 2007 16:25 |
udf for drop size distribution | Rashmi | FLUENT | 6 | December 12, 2005 00:09 |
Udf about the distribution of the diameter | as | FLUENT | 7 | April 3, 2005 18:36 |
Problem in UDF about particle size distribution | fpingqian | FLUENT | 0 | February 25, 2005 02:48 |