CFD Online Logo CFD Online URL
Home > Forums > FLUENT

DPM UDF particle position

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

LinkBack Thread Tools Display Modes
Old   October 29, 2004, 10:25
Default DPM UDF particle position
Posts: n/a

I try to find the particle position using macro P_POS(p)[i]. But when Fluent interpret the source code, an error "undeclared variable" occurred.

Why? How to solve this problem?

Thank you in advance. Tom
  Reply With Quote

Old   October 29, 2004, 13:18
Default Re: DPM UDF particle position
Posts: n/a
It is hard to tell with the given details.

It could be because of any variable, which hasn't been declared before its use.

One other thing i get in mind is, does your UDF supplies the pointer p access? If not, you need to provide that with the argument ' Tracked_Particle *p '.
  Reply With Quote

Old   October 29, 2004, 13:30
Default Re: DPM UDF particle position
Posts: n/a
Hello, Umesh, Thank you. I found out it is not necessary to provide the argument ' Tracked_Particle *p '. The following is a very simple UDF. But the error still exists.

#include "udf.h"

DEFINE_DPM_BODY_FORCE(particle_body_force, p, i) {

real bforce = 0.0;

real x = P_POS(p)[1];

return (bforce/P_MASS(p)); }

Waiting for your reply. Thanks. Tom.
  Reply With Quote

Old   October 29, 2004, 14:08
Default Re: DPM UDF particle position
Posts: n/a
Hi Tom,

I think the problem is with the definition of x. I think, P_POS(p)[i] is a position vector and so you need to define x as a vector with syntax, 'real x[ND_ND]'. Then, you can access the x component of the position with, x[1] = P_POS(p)[1]. Try this out. It may solve yr problem.

  Reply With Quote

Old   November 1, 2004, 16:22
Default Re: DPM UDF particle position
Posts: n/a

I would like to get the face area the particle is crossing to get the volume flux.

But I'm not sure which variable I should use and how:


#include "udf.h"

#include "dpm.h"

#include "surf.h"


#define P_CELL(P) RP_CELL(&((P)->cCell)) /* Non-standard macros */

#define P_CELL_THREAD(P) RP_THREAD(&((P)->cCell))

real volume;

real face;

Particle *p;

cell_t cell;

face_t f;

Thread *cthread;

real r, x, y;

DEFINE_DPM_OUTPUT(Discrete_phase_sample,header,fp, p,t,plane)


#if RP_3D

real flow_time = solver_par.flow_time;

cell = P_CELL(p); /* Get the cell and thread that the particle

is currently in */

cthread = P_CELL_THREAD(p);

face = C_FACE(cell,cthread);


cxprintf(fp," #R [m] x-velocity[m/s] y-velocity[m/s] z-velocity[m/s] Drop Diameter[m] face \n");



x = p->state.pos[0];

y = p->state.pos[1];

r = sqrt(SQR(x) + SQR(y));

cxprintf(fp," %e %f %f %f %e %e \n",







Can anyone help?

thank you

  Reply With Quote

Old   November 5, 2004, 08:59
Default Re: DPM UDF particle position
Posts: n/a
i think, when you use UDF in DPM, you must compile the UDF, rather than interpret the file.

When you compile any udf, you muss install the VC++ in your computer, then all is ok.

  Reply With Quote

Old   November 5, 2004, 18:46
Default Re: DPM UDF particle position
Posts: n/a
Hello, Annie, Thank you. It works. Tom
  Reply With Quote

Old   December 25, 2010, 03:39
New Member
Join Date: Jul 2009
Posts: 20
Rep Power: 8
NH_Aus is on a distinguished road
Send a message via Skype™ to NH_Aus
I need to know the shortest distance of wall from the particle location. I know I can use C_WALL_DIST(c,t) this, but how do I connect from:
px=P_POS(p)[0] ;
py=P_POS(p)[1] ;
pz=P_POS(p)[2] ;
NH_Aus is offline   Reply With Quote


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
Add Mass to a Particle with UDF (DPM) sega Fluent UDF and Scheme Programming 6 October 24, 2013 22:14
DPM particle tracking parisa- Main CFD Forum 2 June 15, 2011 05:12
DPM particle time step amos FLUENT 0 December 1, 2009 04:31
help with DPM particle position Josh FLUENT 2 February 16, 2006 13:10
DPM; particle seeded / deleted by UDF Laika FLUENT 6 January 23, 2006 00:40

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