CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

about the macro P_USER_REAL(p,i)

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 10, 2009, 21:05
Default about the macro P_USER_REAL(p,i)
  #1
New Member
 
haigang wang
Join Date: Apr 2009
Posts: 2
Rep Power: 0
haigangwang is on a distinguished road
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)
}
}


haigangwang is offline   Reply With Quote

Old   October 12, 2009, 04:00
Default
  #2
New Member
 
Join Date: Apr 2009
Location: KA, Germany
Posts: 20
Rep Power: 9
Häwimeddel is on a distinguished road
Try to access the user memory of the particle in this way:

Code:
p->user[0] = ...
Do´t forget to enable as many user variables as you need (in your case it would be only one so far) in the UDF panel of the discrete phase model menu!
Häwimeddel is offline   Reply With Quote

Old   October 22, 2009, 21:50
Default thank you
  #3
New Member
 
haigang wang
Join Date: Apr 2009
Posts: 2
Rep Power: 0
haigangwang is on a distinguished road
I have understood your mean.Tnanks.
Quote:
Originally Posted by Häwimeddel View Post
Try to access the user memory of the particle in this way:

Code:
p->user[0] = ...
Do´t forget to enable as many user variables as you need (in your case it would be only one so far) in the UDF panel of the discrete phase model menu!
haigangwang is offline   Reply With Quote

Old   April 4, 2016, 00:52
Default
  #4
Member
 
Rupesh Verma
Join Date: Jun 2013
Posts: 43
Rep Power: 4
roopesh99 is on a distinguished road
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
roopesh99 is offline   Reply With Quote

Old   April 4, 2016, 00:59
Default
  #5
Member
 
Rupesh Verma
Join Date: Jun 2013
Posts: 43
Rep Power: 4
roopesh99 is on a distinguished road
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.
roopesh99 is offline   Reply With Quote

Old   April 4, 2016, 17:14
Default
  #6
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 716
Rep Power: 9
`e` is on a distinguished road
Quote:
Originally Posted by roopesh99 View Post
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.
P_USER_REAL(p,i) is used for storing real data type values for each particle, where i is an integer for identifying each array.

Your first example increments the array of the current particle by one:

Code:
P_USER_REAL(p,0) = P_USER_REAL(p,0) + 1.;
The second example sets the second array to one:

Code:
P_USER_REAL(p,1) = 1.;
I've noticed these snippets are from my code in this thread and I've explained these macros here.
`e` is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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 CD-adapco 1 April 9, 2007 12:37
macro not function! guang ai CD-adapco 0 July 25, 2004 18:53
Call a macro from a macro Flav CD-adapco 2 July 1, 2004 05:42
Bug in the DEFINE_ADJUST macro? Senthil FLUENT 5 September 3, 2002 22:26


All times are GMT -4. The time now is 04:39.