Ansys Learning Forum Forums Discuss Simulation Fluids Loop over all the DPM injections (and particles) using UDF Reply To: Loop over all the DPM injections (and particles) using UDF

cbhavsar
Ansys Employee

To loop over all the injections, you first need to get a list of all the injections you have defined. This can be done using the following command Injection Ilist = Get_dpm_injections(); You will also have to define a generic injection pointer Injection *I; Now, looping over all the injections can be done using the following command loop(I, Ilist){ / Add user specific code here / } You can loop over all the particles from a given injection. To do that, you first need to define a particle pointer Particle *p; Looping over all the particles can be done using loop(p, I->p){ / Add user specific code here / } Note that in a transient simulation to compute transient particles, you will need to replace loop(p, I->p)with loop(p, I->p_init). Transient particle initialization cannot be performed with a loop over I->p. loop(p, I->p_init){ / Add user specific code here */ } You can use these loops to fetch particle data using particle specific macros like PDIAM(p) for particle diameter PT(p) for particle temperature etc.