CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Magnus lift force using UDF - urgent help please (http://www.cfd-online.com/Forums/fluent/49945-magnus-lift-force-using-udf-urgent-help-please.html)

Angela Wang December 2, 2008 02:50

Magnus lift force using UDF - urgent help please
 
Hi everybody,

My case is a particle-air two phase flow in pipeline. My model to simulate the particle motion is the Discrete Phase Model.I want to include Magnus lift force using UDF. The rotate w (r/s) is got from the experiments. And the calculation involve the relative velocity of the particles.

I use the macros -- P_CELL(p),P_CELL_THREAD(p)to get the cell information the particle are currently in. And then use the macro C_V(c,t)(here c=P_CELL(p) and t=P_CELL_THREAD(p))to get the air velocity of the cell in which particle is lying.

When I compiled the UDF, the error came up as follows: error C2223: left of '->storage'must point to struct/union

I don't know what's wrong.

Here is my udf:

DEFINE_DPM_BODY_FORCE(particle_body_force,p,i) { real bforce; int jd[1]; real omgx,omgy,omgz; int j;

srand((unsigned)time(NULL)); for(j=0; j<2;j++) { jd[j]=random(361); }

omgx=XZOMG*cos(jd[0]*3.14/180)*cos(jd[1]*3.14/180); omgy=XZOMG*sin(jd[0]*3.14/180); omgz=XZOMG*cos(jd[0]*3.14/180)*sin(jd[1]*3.14/180);

if(i==0) { bforce=1/8*3.14*pow(0.002,3.0)*1.68*(omgz*(C_V(P_CELL(p),P_ CELL_THREAD(p))-P_VEL(p)[1])+omgy*(C_W(P_CELL(p),P_CELL_THREAD(p))-P_VEL(p)[2])); }

if(i==1) { bforce=1/8*3.14*pow(0.002,3.0)*1.68*(omgz*(C_U(P_CELL(p),P_ CELL_THREAD(p))-P_VEL(p)[0])+omgx*(C_W(P_CELL(p),P_CELL_THREAD(p))-P_VEL(p)[2])); }

if(i==2) { bforce=1/8*3.14*pow(0.002,3.0)*1.68*(omgx*(C_V(P_CELL(p),P_ CELL_THREAD(p))-P_VEL(p)[1])+omgy*(C_U(P_CELL(p),P_CELL_THREAD(p))-P_VEL(p)[0])); }

return (bforce/P_MASS(p)); }


Angela Wang December 2, 2008 10:53

Re: Magnus lift force using UDF - urgent help plea
 
:( Nobody knows?


KJ Larsen December 17, 2008 07:03

Re: Magnus lift force using UDF - urgent help plea
 
Hello Angela

Don't know if this is any help:

I assume random(361) generates a random number is it returned as an integer as jd[j] expects? In your initialisation I think you need to specify int jd[3] so that it is a 3 row column vector as I don't think the second and third variables for jd[j] can be added.

Although it shouldn't cause a problem as you have it, it is easiest to put cell_t c = P_CELL(p); and Thread *t = P_CELL_THREAD(p); (where cell_t and Thread are data types for Fluent pointers) as initialised variables and then you can just type C_U(c,t) etc.

Cheers. Kris


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