We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

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;
}