CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   What's wrong with my UDF? It worked in the past. (https://www.cfd-online.com/Forums/fluent/46145-whats-wrong-my-udf-worked-past.html)

 CF September 26, 2007 08:40

What's wrong with my UDF? It worked in the past.

Hi,

I've got a udf which my friend passed me. It's used to simulate a body moving up/down in a fluid. I've used it before and it worked.

However, now when I tried to use it, I've problems compiling. My sch now uses fluent 6.3 but I wonder if that's the problem. My UDF is

#include "udf.h" /* this function defines velocity of center of gravity for pure plunging motion*/ /* Plunging motion equation is z(t)=h*sin(2*pi*f*t) */ DEFINE_CG_MOTION(plungnew, dt, vel, omega, time, dtime) { thread *t; face_t *f; /*reset velocities */ NV_S(vel,=,0.0); NV_S(omega,=,0.0); if (!Data_Valid_P()) return; /* Get the thread pointer for which this motion is defined */ /* t=DT_THREAD(dt); */ /* vel[1] is the vertical plunging velocity */ /* These velocity below is for h=0.4c and f=0.993Hz */ vel[1] = 0.1910088333*cos(0.9550441667*time); }

The error message is:

# building library in lnia64/2ddp make[1]: Entering directory `/home/enduser/g0306332/fluent_intro/libudf/lnia64/2ddp' make[1]: *** Warning: File `makefile' has modification time in the future (2007-09-26 20:39:03 > 2007-09-26 20:37:44.628237) # Generating udf_names.c because of makefile plungnew.c make[2]: Entering directory `/home/enduser/g0306332/fluent_intro/libudf/lnia64/2ddp' make[2]: *** Warning: File `makefile' has modification time in the future (2007-09-26 20:39:03 > 2007-09-26 20:37:45.151532) make libudf.so "CFLAGS=-fpic -shared -ansi -Wall -O -DPTR_RESTRICT= " "LDFLAGS=-shared -lm" "LD=cc" make[3]: Entering directory `/home/enduser/g0306332/fluent_intro/libudf/lnia64/2ddp' make[3]: *** Warning: File `makefile' has modification time in the future (2007-09-26 20:39:03 > 2007-09-26 20:37:45.324747) # Compiling udf_names.o because of udf_names.c cc -fpic -shared -ansi -Wall -O -DPTR_RESTRICT= -I/app1/common/Fluent.Inc/fluent6.3.26/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/app1/common/Fluent.Inc/fluent6.3.26/src -I/app1/common/Fluent.Inc/fluent6.3.26/cortex/src -I/app1/common/Fluent.Inc/fluent6.3.26/client/src -I/app1/common/Fluent.Inc/fluent6.3.26/tgrid/src -I/app1/common/Fluent.Inc/fluent6.3.26/multiport/src -I. -c udf_names.c # Compiling plungnew.o because of plungnew.c cc -fpic -shared -ansi -Wall -O -DPTR_RESTRICT= -I/app1/common/Fluent.Inc/fluent6.3.26/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/app1/common/Fluent.Inc/fluent6.3.26/src -I/app1/common/Fluent.Inc/fluent6.3.26/cortex/src -I/app1/common/Fluent.Inc/fluent6.3.26/client/src -I/app1/common/Fluent.Inc/fluent6.3.26/tgrid/src -I/app1/common/Fluent.Inc/fluent6.3.26/multiport/src -I. -c plungnew.c plungnew.c: In function `plungnew': plungnew.c:6: `thread' undeclared (first use in this function) plungnew.c:6: (Each undeclared identifier is reported only once plungnew.c:6: for each function it appears in.) plungnew.c:6: `t' undeclared (first use in this function) plungnew.c:7: warning: unused variable `f' make[3]: *** [plungnew.o] Error 1 make[3]: Target `libudf.so' not remade because of errors. make[3]: warning: Clock skew detected. Your build may be incomplete.

Can anyone help?

Thanks

 CF September 26, 2007 09:54

Re: What's wrong with my UDF? It worked in the pas

I've rewritten the udf for easy viewing:

#include "udf.h"

/* this function defines velocity of center of gravity for pure plunging motion*/

/* Plunging motion equation is z(t)=h*sin(2*pi*f*t) */

DEFINE_CG_MOTION(plung185, dt, vel, omega, time, dtime)

{

face_t *f;

/*reset velocities */

NV_S(vel,=,0.0);

NV_S(omega,=,0.0);

if (!Data_Valid_P())

return;

/* Get the thread pointer for which this motion is defined */

/* vel[1] is the vertical plunging velocity */

/* These velocity below is for h=0.4c and f=0.993Hz */

vel[1] = 0.1910088333*cos(0.9550441667*time);

}

 jasond September 26, 2007 18:22

Re: What's wrong with my UDF? It worked in the pas