about the macro P_USER_REAL(p,i)
I have written one udf programe about DPM,but when I hook them,it is giving me a error:P_USER_REAL(p,0): undeclared variable.Please help me!
my programe: #include "udf.h" #include "models.h" #include "dpm.h" #include "surf.h" #include "threads.h" #include "math.h" #include "mem.h" DEFINE_DPM_SCALAR_UPDATE(particle_depostion,c,t,in itialize,p) { int i = 0; face_t f; Thread *th; real A[ND_ND]; real area=0,vol=0; int wall_ID=4; if (initialize) P_USER_REAL(p, 0) = 0; c_face_loop(c,t,i) { if(THREAD_ID(C_FACE_THREAD(c,t,i)) == wall_ID) { f=C_FACE(c,t,i); th=C_FACE_THREAD(c,t,i); F_AREA(A,f, th); area = NV_MAG(A); vol=C_VOLUME(c,t); if(P_DIAM(p)<0.01) { C_UDMI(c, t, 0) +=P_DIAM(p); P_USER_REAL(p,0) = 1.; /* "Evaporate" */ } } } } DEFINE_DPM_LAW(stop_dpm_law,p,if_cpld) { if (0. < P_USER_REAL(p,0)) P_MASS(p) = 0.; /* "Evaporate" */ } DEFINE_INIT(my_init_func,d) { cell_t c; Thread *t; thread_loop_c(t,d) { begin_c_loop_all(c,t) { C_UDMI(c,t,0)=0; } end_c_loop_all(c,t) } } |
Try to access the user memory of the particle in this way:
Code:
p->user[0] = ... |
thank you
I have understood your mean.Tnanks.
Quote:
|
I am using macros DEFINE_DPM_SCALAR_UPDATE. Can any one tell the means of P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1.
P_USER_REAL(p,1) = 1.; :::::::::::: some part of my UDF is if (P_POS(p)[2]<0.03) //particle pos in z direction less then 3 cm { P_USER_REAL(p,1) = 0.; } if (P_POS(p)[2]>0.9 && P_USER_REAL(p,1) == 0.) //particle pos in z direction greater then 90 cm { P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1. P_USER_REAL(p,1) = 1.; etc |
Dear friend
can you tell the means of P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1. P_USER_REAL(p,1) = 1. in the macros DEFINE_DPM_SCALAR_UPDATE. |
Quote:
Your first example increments the array of the current particle by one: Code:
P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1.; Code:
P_USER_REAL(p,1) = 1.; |
All times are GMT -4. The time now is 20:15. |