Originally Posted by Bernhard
(Post 256511)
I once obtained this from Fluent support desk. Good luck :)
Code:
/********************************************************************/
/* */
/* Hook on the DPM panel under DPM Scalar Update */
/* */
/********************************************************************/
#include "udf.h"
#include "dpm.h"
DEFINE_DPM_SCALAR_UPDATE(track_dpm_particles,c,t,initialize,p)
{
if (RP_Get_Boolean("dpm/unsteady-tracking?"))
{
if (initialize)
{
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];
#endif
FILE *fd;
int id = p->part_id;
char whoru[80];
sprintf(whoru,"dpm_positions%f.out",time);
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));
#else
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));
#endif
fclose(fd);
}
}
else
{
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];
#endif
FILE *fd;
int id = p->part_id;
char whoru[80];
sprintf(whoru,"dpm_positions%f.out",time);
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));
#else
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));
#endif
fclose(fd);
}
}
|