CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Urgent: Looping over all particles in unsteady flow (

orland April 4, 2011 20:59

Urgent: Looping over all particles in unsteady flow
I have an unsteady flow with one single injection that produces only 1 particle.
I want to know its position at every fluid time step.
is there a udf that can loop over all particles (or two separate udf's, one for looping over all injection threads, and the other over all particles in each injection thread)?

johnwinter May 19, 2011 07:46

DEFINE_DPM_SCALAR_UPDATE(track_dpm_particles,c,t,i nitialize,p)
if (RP_Get_Boolean("dpm/unsteady-tracking?"))
float time = RP_Get_Real("flow-time");
float x = p->state.pos[0];
float y = p->state.pos[1];
float u = p->state.V[0];
float v = p->state.V[1];
#if RP_3D
float z = p->state.pos[2];
float w = p->state.V[2];
FILE *fd;
int id = p->part_id;
char whoru[80];
fd = fopen(whoru, "a");
#if RP_3D
fprintf(fd, "%i %f %e %e %e %e %e %e %e %e %e \n", id, time, x, y, z, u, v, w, P_T(p), P_MASS(p), P_RHO(p));
fprintf(fd, "%i %f %e %e %e %e %e %e %e \n", id, time, x, y, u, v, P_T(p), P_MASS(p), P_RHO(p));

orland May 23, 2011 07:33

I'll get right on it

All times are GMT -4. The time now is 23:07.