Ansys Learning Forum Forums Discuss Simulation Fluids UDF for reinjecting particles Reply To: UDF for reinjecting particles

dseong
Subscriber

From my understanding, 'return PATH_END' means that particles escaped from the domain. So, I thought my code said that the particle count of less than 95 escaped. Could you please correct my code? 

if (particle_count <= 95)
{
/* Mark as escaped */
escaped_count++;

return PATH_END;

}

if (particle_count > 95)
{
/* Mark as reinjected */
reinjected_count++;

/* Move particle to specific point */
P_POS(tp)[0] = REINJECT_POSITION_X; // Specific X position
P_POS(tp)[1] = REINJECT_POSITION_Y; // Specific Y position
P_POS(tp)[2] = REINJECT_POSITION_Z; // Specific Z position

return PATH_ACTIVE;
}