How to monitor the number of particles in the domain

For steady flow simulations in which unsteady particle tracking is used, the total number of dpm parcels in the domain should be relatively constant when the solution is converged. Fluent does not provide a simple method of monitoring this quantity.
The UDF below writes the total number of particles (parcels) within the domain to a file every time the particle trajectories are updated. The number of parcels in the domain is a useful convergence monitor when unsteady particle tracking is used for steady flow simulations. The UDF is particularly useful when running Fluent in batch mode.

The UDF should be hooked to the Define Injection panel corresponding to the FIRST injection in the injection list (typically Injection-0).


#include <udf.h>

Injection *J;
real time = RP_Get_Real("flow-time");
int tot_particles = 0;
FILE *fd;

tot_particles += J->n_particles;

/* Message("nTotal number of particles is %d at time %e s.n",tot_particles,time); */

fd = fopen("num_parcels.dpm", "a");
fprintf(fd, "%e %d n", time, tot_particles);


Show Form
No comments yet. Be the first to add a comment!