CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF for C.G.Motion in two direction (https://www.cfd-online.com/Forums/fluent/31441-udf-c-g-motion-two-direction.html)

ciprian May 9, 2003 07:16

UDF for C.G.Motion in two direction
 
i have a cylinder who has a two direction mouvement. i have this function and i really don't knew what is wrong because after i read it in fluent i receive a mesaje "segmentation violation". if somebody has a fonction for c.g.motion in more then one direction and he can send it to me or can fix this program it will be great. thank you.cip

#include "udf.h" #include "dynamesh_tools.h"

static real v_prev1_x = 0.0; static real v_prev1_y = 0.0; DEFINE_CG_MOTION(cylindre_CIP, dt, vel, omega, time, dtime)

{

Thread *t; face_t f; real NV_VEC (A); real b; real c; real force_ox, force_oy, dv_x, dv_y;

NV_S (vel, =, 0.0); NV_S (omega, =, 0.0);

if(!Data_Valid_P ())

return;

t=DT_THREAD((Dynamic_Thread *)dt);

force_ox = 0.0; force_oy = 0.0; begin_f_loop (f,t)

{

F_AREA (a,f,t);

b = a[0];

force_ox +=F_P (f,t) * b;

c = a[1];

force_oy +=F_P (f,t) * c;

}

end_f_loop (f,t) dv_x=dtime * force_ox /50.0; dv_y=dtime * force_oy /50.0;

v_prev1_x += dv_x; v_prev1_y += dv_y; Message ("time=%f,x_vel =%f,y_vel =%f,force_ox=%f\n,force_oy=%f\n",time,v_prev1_x,v_ prev1_y,force_ox,force_oy);

vel[0] = v_prev1_x; vel[1] = v_prev1_y;

}


Alexandre May 12, 2003 02:25

Re: UDF for C.G.Motion in two direction
 
did you use a compiled UDF (ie : not interepreted one )?

ciprian May 12, 2003 02:31

Re: UDF for C.G.Motion in two direction
 
yes, i've done the same procedure avec other udf's and works good. only in this case not

sunnysong1984 August 20, 2009 21:45

i have the same problem with u
how did u solve the problem?


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