CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   help UDF (http://www.cfd-online.com/Forums/fluent/41347-help-udf.html)

zhangzhongbin June 10, 2006 21:49

help UDF
 
Hi. I'm using a DEFINE_INIT macro to define memories with (C_UDMI(cell,thread,0) for store the mass of particle. compiling my UDF is OK, But when I write UDMI0 , the value is 0, I dont' know where is the problem can somebody help me please? thanks my UDF is:

#include "udf.h" #define MIN_IMPACT_VELO 0.0001 Domain *domain; DEFINE_DPM_EROSION(dpm_accr, p, t, f, normal, alpha, Vmag, Mdot) { real A[ND_ND], area; int num_in_data; Thread *t0; cell_t c;

real radi_pos[2], radius, imp_vel[2], vel_ortho; radi_pos[0] = p->state.pos[1]; /* Radial location vector. */ radi_pos[1] = p->state.pos[2]; /* (Y and Z in 0 and 1...) */ radius = NV_MAG(radi_pos); NV_VS(radi_pos, =, radi_pos, /, radius);

/* Normalized radius direction vector.*/ imp_vel[0] = P_VEL(p)[0]; /* Axial particle velocity component. */ imp_vel[1] = NVD_DOT(radi_pos, P_VEL(p)[1], P_VEL(p)[2], 0.); vel_ortho = NV_DOT(imp_vel, normal); /*velocity orthogonal to wall */ if(fabs(vel_ortho)< MIN_IMPACT_VELO)

C_UDMI(c,t,0) = C_UDMI(c,t,0)+ P_MASS(p); return; }

DEFINE_INIT(my_init,domain) { Domain*Domain =Get_Domain(1); Thread *t; cell_t c;

thread_loop_c(t,domain) { begin_c_loop_all(c,t) { C_UDMI(c,t,0)=0.0; }end_c_loop_all(c,thread) } }


Aidan June 12, 2006 07:52

Re: help UDF
 
try changing the line C_UDMI(c,t,0) = C_UDMI(c,t,0)+ P_MASS(p);

to this C_UDMI(c,t,0) += P_MASS(p);

zhangzhongbin June 12, 2006 20:20

Re: help UDF
 
Hi thanks to your Re. i try changing that line,but it is no any change to UDMI. could you give me some other advise?


Markus June 13, 2006 02:07

Re: help UDF
 
Have you checked wether your conditional statement: if(fabs(vel_ortho)< MIN_IMPACT_VELO) ever becomes true? Markus

zhangzhongbin June 13, 2006 06:46

Re: help UDF
 
hi: thanks to your Re. I am a new FLUENT, i don't known how to checked the conditional statement:if(fabs(vel_ortho)< MIN_IMPACT_VELO). could you give me more help?

Aidan June 14, 2006 05:08

Re: help UDF
 
You can check it with a UDM. Before the conditional statement put: C_UDMI(c,t,1) = 0;

After the conditional "if" statement put: C_UDMI(c,t,1) = 1;

Then run the problem and if UDM 1 is equal to 1 in any cells then the conditional statment is true.

zhangzhongbin June 15, 2006 02:55

Re: help UDF
 
hi: thanks to your Re. By checking UDM,i know that the conditional "if" statemen is not use to judge. But why is it no use? how to revised the UDF i ought to ? i think that maybe other line is wrong in the UDF.



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