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

DPM UDF particle position

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 29, 2004, 11:25
Default DPM UDF particle position
  #1
Tom
Guest
 
Posts: n/a
Hello,

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, 14:18
Default Re: DPM UDF particle position
  #2
Umesh
Guest
 
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, 14:30
Default Re: DPM UDF particle position
  #3
Tom
Guest
 
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, 15:08
Default Re: DPM UDF particle position
  #4
Umesh
Guest
 
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
  #5
David
Guest
 
Posts: n/a
hello,

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:

C_FACE(cell,cthread)?

#include "udf.h"

#include "dpm.h"

#include "surf.h"

#define REMOVE_PARCELS FALSE

#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);

if(header)

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

if(NULLP(p))

return;

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",

r,p->state.V[0],p->state.V[1],p->state.V[2],P_DIAM(p),volume);

#endif

#if REMOVE_PARCELS

p->stream_index=-1;

#endif

}

Can anyone help?

thank you

David
  Reply With Quote

Old   November 5, 2004, 08:59
Default Re: DPM UDF particle position
  #6
annie
Guest
 
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
  #7
Tom
Guest
 
Posts: n/a
Hello, Annie, Thank you. It works. Tom
  Reply With Quote

Old   December 25, 2010, 03:39
Default
  #8
New Member
 
NH
Join Date: Jul 2009
Posts: 23
Rep Power: 17
NH_Aus is on a distinguished road
Send a message via Skype™ to NH_Aus
Hi,
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

Old   July 25, 2015, 13:30
Default
  #9
New Member
 
Parham Vatankhah
Join Date: May 2015
Posts: 4
Rep Power: 11
Parham Vatankhah is on a distinguished road
Hi all,

By interpreting UDFs you can not access particles position.
Generally, it's better to compile complex UDFs.

best regards,

Parham
Parham Vatankhah is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DPM particle time step amos FLUENT 1 January 4, 2020 09:46
Add Mass to a Particle with UDF (DPM) sega Fluent UDF and Scheme Programming 6 October 24, 2013 23:14
DPM particle tracking parisa- Main CFD Forum 2 June 15, 2011 06:12
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 03:34.