CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Help: UDF of "particle body force" !!! (

zhaoh January 6, 2007 10:50

Help: UDF of "particle body force" !!!
Happy new year, everyone I hope get help from you. I have compiled a UDF about particle body force, but it doesn't work. The physic model is this: the particle is injecting into enclosure. The body force forces on particles according to different positions of particles. My UDF is:

#include "udf.h" #include "dpm.h" #include "surf.h" #define C1 2.2 #define C2 1.5 DEFINE_DPM_BODY_FORCE(p_b_force,p,i) { cell_t c=RP_CELL(&(p->cCell)); Thread *t = RP_THREAD(&(p->cCell)); Particle *p; real bforce; if(i==1) bforce=0; else if(i==0) { bforce=C1*P_POS(p)[0]+C2*P_POS(p)[1]; } return (bforce/P_MASS(p)); } but it has some problem as follows: (system "move user_nt.udf libudf\ntx86\2d")0 (system "copy C:\Fluent.Inc\fluent6.1.22\src\makefile_nt.udf libudf\ntx86\2d\makefile") (chdir "libudf")() (chdir "ntx86\2d")() 004.c ..\..\src\004.c(10) : error C2082: redefinition of formal parameter 'p' Done. Opening library "libudf"... Error: open_udf_library: the system can not find the library。 Error Object: () If I delete the code "Particle *p", it will be still have a error as follows: Error: get_udf_function: function p_b_force has wrong type: 27 != 17 Error Object: () Hope your reply. Thanks a lot!

sujith January 8, 2007 12:29

Re: Help: UDF of "particle body force" !!!
It is not required to define Particle *p, This will be passed as an argument buy fluent itself (p_b_force,p,i).

Error: get_udf_function: function p_b_force has wrong type: 27 != 17 Error Object: ()

This error usually occurs when you are hooking the udf at wrong position.

Regards, Sujith S Nair

zhaoh January 9, 2007 08:45

Re: Help: UDF of "particle body force" !!!

Thank you very much.Maybe you are right.I have been chosen "Initialization--p_b_force"in "User-Defined Fuctions" panel when i set injection properies of particles. I have do it according to your advice. It remain have some problems. i haven`t see any particles in the region after computing. Maybe,My programs have some problems. I have to check it. Thank you again!!!

OC January 16, 2007 21:17

Re: Help: UDF of "particle body force" !!!
What are you trying to get out of your udf?


All times are GMT -4. The time now is 22:56.