|
[Sponsors] |
October 29, 2004, 11:25 |
DPM UDF particle position
|
#1 |
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 |
|
October 29, 2004, 14:18 |
Re: DPM UDF particle position
|
#2 |
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 '. |
|
October 29, 2004, 14:30 |
Re: DPM UDF particle position
|
#3 |
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. |
|
October 29, 2004, 15:08 |
Re: DPM UDF particle position
|
#4 |
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. |
|
November 1, 2004, 16:22 |
Re: DPM UDF particle position
|
#5 |
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 |
|
November 5, 2004, 08:59 |
Re: DPM UDF particle position
|
#6 |
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. |
|
November 5, 2004, 18:46 |
Re: DPM UDF particle position
|
#7 |
Guest
Posts: n/a
|
Hello, Annie, Thank you. It works. Tom
|
|
December 25, 2010, 03:39 |
|
#8 |
New Member
|
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] ; ?? |
|
July 25, 2015, 13:30 |
|
#9 |
New Member
Parham Vatankhah
Join Date: May 2015
Posts: 4
Rep Power: 11 |
Hi all,
By interpreting UDFs you can not access particles position. Generally, it's better to compile complex UDFs. best regards, Parham |
|
|
|
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 |