CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Getting data of injected particles (

Lior August 12, 2004 04:17

Getting data of injected particles
Hi everyone,

Does anybody know which is the best UDF to use, for getting the data (e.g. position, velocity, temperature) of injected particles in the flow, in each and every time step. I tried DPM_SCALAR_UPDATE, and also DEFINE_RW, but both were problematic. I need this data in a .dat file, which i can later read using Matlab, for further analysis.



wxl August 12, 2004 13:44

Re: Getting data of injected particles
you don't need UDF at all for particle history data. Just turn on STEP BY STEP option in display trajectory, you can either display particle history on screen or write to a file.

Lior August 15, 2004 11:14

Re: Getting data of injected particles
I know that........ But there's a problem with it - The files generated from the 'Step-By-Step' option, are given with NO Particle ID, which means that if i look at different particle file for each time steps, i can't recognize what happened to a single particle, cause there are no IDs in these files......

DO you have an advice how i can get over this problem? Of course i'd rather to do it without using UDFs.... but without particle IDs , it's useles...

Thanks again,


wxl August 16, 2004 11:23

Re: Getting data of injected particles
I don't know how many particles you are tracking. If less than 10, then you can look at the history file. Each particle start with first column (time) = 0, which serves as kind of particle ID.

Lior August 16, 2004 16:14

Re: Getting data of injected particles
Hi wxl,

Thanks for you response, again. I am injecting one particle each time step, in an un-steady flow with an inlet-flow boundary condition... I have ~80 time steps in each cycle, which makes it 80 particles to be injected and tracked until they leave the vessel... Hence, particle ID is very important... What choice do i have then, of the particle number is higher than 10?



Angelo Sozzi August 18, 2004 15:53

Re: Getting data of injected particles
Hi Lior,

It really is the easiest way to track particles by writing out the step by step files into a *.part file

I am currently using the data of several hundred to thousand particles injected into a steady solution though (hope this works for unsteady too). The part files are just divided into columns and the first column is the time of the particle in the reactor. In my case I wrote a small data loader that reads the values line by line and assigns a new particle ID each time the first column value is smaller than on the last line. This works in my case since the particle values just continue until it exits the reactor before the next particle is started. I would wagger a guess that it is the same for unsteady flows.

You could also write an UDF to write the data of each particle in a separate file I guess.

Feel free to contact me if you need some help

Lior August 19, 2004 12:55

Re: Getting data of injected particles
Hi Angello,

First of all, thanks for your help. Now, about the "step by step"... in my fluent version (6.1.22) i think you mean the "current positions" option, which exists in the "display/particle tracks" panel... I generated files using this option, but as i mentioned before, they miss a particle ID, or a way in which i can understand to which particle this data refers, in case there are many particles...

About the "Write/Start Particle History" option - i used it, but got very weird files, in which i don't understand what the data means... I also think they do not include all the information i need (positions, velocities, temperature, time, and above all - particle identification.... In Fluent help they also don't explain about the format of the particle history file: "FLUENT will write the position, velocity, and other data for each particle at each iteration or time step."... This is not enough to understand this .phs format...

Anyway, if you have any advice i would be very thankful....

Thanks again,


Angelo Sozzi August 19, 2004 14:25

Re: Getting data of injected particles
Hi Lior,

Lets go step by step and eliminate the errors. My setup: Fluent 6.1.22 Solver: Implicit, steady, 3D single precison Fluid: Water, Turbulent, ke-Realizable Domain: 3D, Cooper, 0.2-1.5 Million Cells (in different models) Converged Solution.

Open Discrete Phase Panel. Set Injection to surface, inlet, innert, antracite (set to same density as water!). maximum steps 15000 (depends on your model) Step lenght 1-5 (model dep.)

Open Particle Tracking Panel report step-by-step, report to file, pulse mode single, WRITE --> gives "filename.part" file

Open filname.part in Text editor you will see something like: FILE TYPE: 1 COLUMNS: 11 TITLE: TRACK HISTORY

COLUMN TYPE VARIABLE (UNITS) ------ ---- -------- ------










10 10 DENSITY (KG/M3)

11 10 MASS (KG) ---------------------------------------------

0.00000e+00 -1.43826e-17 -2.34893e-01 -1.43167e-02 0.00000e+00 0.00000e+00 0.00000e+00 1.00000e-06 3.00000e+02 1.55000e+03 8.11578e-16 etc. The first column contains the timesteps for each particle, particles are saved below each other i.e. Particle 1: all time steps until it leaves RK followed by Particle 2 etc. There are NO gaps between particles, the only way you know a new particle starts is looking a the time column and watch for a new near 0 value

Solution: read filename.part line by line (easy to programm in c++ but should also work in Excel VB) and each time the new value in the first column is SMALLER than the last value a new particle has started. Increase Particle ID and continue.

I don't know how this looks in unsteady solutions but should be simillar

Hope I could be of assistance

Angelo Sozzi

Lior August 19, 2004 16:11

Re: Getting data of injected particles
OK thanks.... But I don't think this works for unsteady cases... Anyway, i will write you an email, and discuss it more thoroughly there...

Thanks again,


mohamadalimirzaei1994 April 9, 2020 13:31


Originally Posted by Lior
OK thanks.... But I don't think this works for unsteady cases... Anyway, i will write you an email, and discuss it more thoroughly there...

Thanks again,


Hi Lior. Could you solve the problem? I am having the same problem. I am running an unsteady simulation and I need position and velocity of each particle at each time step.

vinerm April 9, 2020 14:12

You may but I doubt that you will get a response since the post is quite old. I would recommend posting your own query.

All times are GMT -4. The time now is 15:19.