CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   uds flux - drift velocity - udf (http://www.cfd-online.com/Forums/fluent-udf/91445-uds-flux-drift-velocity-udf.html)

johnwinter August 11, 2011 04:51

uds flux - drift velocity - udf
 
Hi All,

I am calculation ion density using UDS udf, i have a flux term in transport equation as (u+mu.E). My udf is given below. I could see nothing wrong with my udf but ion density is rising gradually beyond input value with every iteration due to this term

DEFINE_UDS_FLUX(ion_flux,f,t,i)
{
#if !RP_HOST
double NV_VEC(A), NV_VEC(E_vec), F_Evec[ND_ND] = {0.}, E_flux = 0.;
cell_t c0, c1 = -1;
Thread *t0, *t1 = NULL;
c0 = F_C0(f,t);
t0 = F_C0_THREAD(f,t);
F_AREA(A,f,t);
if (BOUNDARY_FACE_THREAD_P(t))
{
E_flux = 0.0;
}
else
{
c1 = F_C1(f,t);
t1 = F_C1_THREAD(f,t);
NV_DS(E_vec, =, E_X(c0,t0), E_Y(c0,t0), E_Z(c0,t0), *, ionmob);
NV_DS(E_vec, +=, E_X(c1,t1), E_Y(c1,t1), E_Z(c1,t1), *, ionmob);
E_flux = NV_DOT(E_vec,A)/2.0;
}

if (i==0)
{
return (F_FLUX(f,t)/rho+E_flux);

}

else return (0.);

#endif
#if RP_HOST
return 0.0;
#endif
}

After 3 iterations i could see that the iondensity value at the node near electorde is rising beyond my input value.

Any suggestion are welcome.

PS: I am stroing E_X, E_Y and E_Z values using memory option.

Thanks
John

johnwinter August 12, 2011 05:29

i need results badly. please somebody help!


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