CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   CG_motion problem (https://www.cfd-online.com/Forums/fluent-udf/85762-cg_motion-problem.html)

Atze March 6, 2011 13:22

CG_motion problem
 
Hi,

I have to simulate a cylinder contrained with a spring and loaded only with its weight. I've written this UDF but monitoring the X-position of the center of the body it tends to 1mm and Cd tends to 0 .... where are the mistakes?

Thanks a lot for your help

#include "udf.h"


DEFINE_CG_MOTION(oscillazione,dt,vel,omega,time,dt ime)
{

real x[ND_ND];
Thread *t;
face_t f;
real A[ND_ND];
real Ft,F_el,F_pressure, dv, v_prev;
real Keq= 50.0;
real m = 0.25;

NV_S(vel, =, 0.0);

t = DT_THREAD(dt);

F_pressure = 0.0;
F_el=0;

begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
F_el += -Keq*x[0]; /* is this wrong? */
}
end_f_loop(f,t)
begin_f_loop(f,t)
{
F_AREA(A,f,t);
F_pressure += F_P(f,t) * A[0]; /* or F_P*NV_MAG(A) ? */
}
end_f_loop(f,t)

Ft=F_pressure+F_el+9.81*m;
dv = dtime * (Ft / m);

v_prev += dv;

vel[0] = v_prev;
}


All times are GMT -4. The time now is 21:39.