CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   what's the problem with my udf (http://www.cfd-online.com/Forums/fluent/81703-whats-problem-my-udf.html)

zzyan November 4, 2010 04:56

what's the problem with my udf
 
hi all
i want to use udf in my fluent , but i donot know whatis problem with my udf :

udf 1
#include "udf.h"
DEFINE_DPM_DRAG(particle_drag_force,Re,p)
{
real w, drag_force;
if (Re < 0.01)
{
drag_force=18.0;
return (drag_force);
}
else if (Re < 20.0)
{
w = log10(Re);
drag_force = 18.0 + 2.367*pow(Re,0.82-0.05*w) ;
return (drag_force);
}
else
/* Note: suggested valid range 20 < Re < 260 */
{
drag_force = 18.0 + 3.483*pow(Re,0.6305) ;
return (drag_force);
}
}

that udf can be used in fluent in "define--user defined--function--interpreted" way,but it can not be used in "define--user defined --function--compiled" way, maybe i was a mistake in complied way, any one can you tell me ,how i do "compiled "way, tell me the detail.
thanks


specially this udf2

#include "udf.h"
#include "unsteady.h"
#include "stdio.h"
#include "stdlib.h"
#include "memory.h"
DEFINE_CG_MOTION(movewall,dt,vel,omega,time,dtime)
{
Thread *t;
cell_t c;
real cx,cy;
//CArray<real,real&> vx,vy;
int i;
int n=0;
//if(!Data_Valid_P())
//return;
t=DT_THREAD(dt);
cx=0;
cy=0;
begin_c_loop(c,t)
{
//vx.Add(C_U(c,t));
//vy.Add(C_U(c,t));
cx=cx+C_U(c,t);
cy=cy+C_V(c,t);
n++;
}
end_c_loop(c,t);
cx=cx/n;
cy=cy/n;
cx=0;
cy=0.05;
vel[0]=cx;
vel[1]=cy;
//Message("\n n=%d, vx=%f, vy=%f\n",n,vel[0],vel[1]);
}

i do have no idea to do it. it can be compiled in vc,but cannot be bulid.
it showed:
--------------------Configuration: dymanic mesh - Win32 Debug--------------------
Compiling...
dymanic mesh.c
C:\Documents and Settings\Urumqi primaryschool\桌面\动网\dynamic\dymanic mesh.c(34) : warning C4305: '=' : truncation from 'const double ' to 'float '
C:\Documents and Settings\Urumqi primaryschool\桌面\动网\dynamic\dymanic mesh.c(13) : warning C4101: 'i' : unreferenced local variable
dymanic mesh.obj - 0 error(s), 0 warning(s)
--------------------Configuration: dymanic mesh - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/dymanic mesh.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.
dymanic mesh.exe - 1 error(s), 0 warning(s)

and how can i use it in fluent , maybe in the some way .

all of that ,what i want to know is how i can use compiled way in fluent ,for i donot know how i can get the libudf file

can you help me?

thank you all!

:confused:


All times are GMT -4. The time now is 04:46.