|
[Sponsors] |
October 10, 2009, 21:05 |
about the macro P_USER_REAL(p,i)
|
#1 |
New Member
haigang wang
Join Date: Apr 2009
Posts: 2
Rep Power: 0 |
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) } } |
|
October 12, 2009, 04:00 |
|
#2 |
New Member
Join Date: Apr 2009
Location: KA, Germany
Posts: 20
Rep Power: 17 |
Try to access the user memory of the particle in this way:
Code:
p->user[0] = ... |
|
October 22, 2009, 21:50 |
thank you
|
#3 |
New Member
haigang wang
Join Date: Apr 2009
Posts: 2
Rep Power: 0 |
I have understood your mean.Tnanks.
|
|
April 4, 2016, 00:52 |
|
#4 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 12 |
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 |
|
April 4, 2016, 00:59 |
|
#5 |
Member
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 12 |
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. |
|
April 4, 2016, 17:14 |
|
#6 | |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
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.; |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro Trouble -Winows Explorer Crashes with Macro | Martin Castillo | FLUENT | 1 | July 25, 2007 04:18 |
Macro problem | cfddummy | Siemens | 1 | April 9, 2007 12:37 |
macro not function! | guang ai | Siemens | 0 | July 25, 2004 18:53 |
Call a macro from a macro | Flav | Siemens | 2 | July 1, 2004 05:42 |
Bug in the DEFINE_ADJUST macro? | Senthil | FLUENT | 5 | September 3, 2002 22:26 |