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/)
-   -   udf : velocity profile in DPM (and mass) (https://www.cfd-online.com/Forums/fluent-udf/121545-udf-velocity-profile-dpm-mass.html)

cdiako July 31, 2013 05:17

udf : velocity profile in DPM (and mass)
 
Hello,

I am an user of FINE/Open. I would like to make a comparison with Fluent. Therefore, I need a little help in Fluent. I would like to insert a radial velocity profile for the DPM module. I saw that it had to use P_VEL. The code is correct? My injection point is located at (0,0,0.059) in my domain and I choose a solid cone (radius = 0.025 m) for the injection.

#include "udf.h"

real some_func(real r)
{
real vel;
real r0[] = {0.0, 0.02, 0.022, 0.025};
real v0[] = {25.0, 20.0, 10.0, 0.00};
int i=0;

if ( r >= r0[3] ) return 0.0;
while( r >= r0[++i]) ;

return v0[i-1]+((v0[i] - v0[i-1])/(r0[i] - r0[i-1]))*(r-r0[i-1]);

}

DEFINE_DPM_INJECTION_INIT(DPM_VELOCITY,I)
{

static const real orig[3]={0.0, 0.0, 0.059};
real x[ND_ND];
real r;
Particle *p;

loop(p,I->p)
{
NV_VV(x,=,x,-,orig);
r = sqrt(x[0]*x[0]+x[1]*x[1]);
P_VEL(p)[2] = some_func(r);
P_VEL(p)[1]=0;
P_VEL(p)[0]=0;
}
}


All times are GMT -4. The time now is 07:37.