How to Export Particle History Data every Particle Time Step
I am simulating discrete particles and I am interested in the particle-particle collisions. Therefore, I am using the DEM collision model available in Fluent. This forces me to work with instationary particles (although I am looking for a steady solution, where the particle collisions dictate the spread).
My idea is to inject particles, until the fluid and the particles have achieved a steady state.
Due to the use of the DEM model, and the collisions between different sized particles, I am forced to use a very small particle time step size (10^-8) in order to get “physical” collisions/the right overlap.
Since I am continuously injecting particles, the simulation would be too slow if I had 1 particle time step for each fluid time step, so I increased the number of particle iterations per time step to speed the process up.
Desirable would be e.g. a number of Time Steps=1e6 for particle time step size 1e-8 so that I get 0,01sec simulation time with only one fluid iteration.
So far, I have worked out a solution that fits my needs:
Setup->Models->Discrete Phase (On)
Discrete Phase Model:
Interaction with Continuous Phase (On)
DPM Iteration Interval: 1
Unsteady Particle Tracking (On)
Particle Time Step Size: 1e-8
Number of Time Steps: 1e6
Physical Models->DEM Collision (On)
File Injection using a unsteady file.inj as described in the Manual
Start Time: 0
Stop Time: 5
Start Flow-time in File: 0
Repeat Interval in File: 1e-6 (so that a new particle is injected every particle time step)
Run Calculation -> Number of Iterations: 1
The simulation runs as desired and is obviously much faster than the setup (Particle Time Step Size:1e-8/No of Steps:1/DPM Iteration Interval:1/Number of (Fluid) Iterations:1e6).
However, I encounter problems when it comes to view the results:
I want to investigate the collisions etc. in CFD-Post and therefore I want to export the particle history data.
The way Solution->Calculation Activities->Automatic Export -> Create Particle History Data Export does not work for me, since it only is executed every fluid time step.
I do not need an export every fluid time step but every (nth) Particle Time Step, because I want to visualize the collisions and particle trajectories properly.
I could increase the number of fluid time steps and decrease number of particle time steps but this would slow down my simulation.
Furthermore, it seems possible with a transient simulation, but this is also not what I want.
I made two more ideas to approach a solution but was not successful with them:
I had the idea to use an UDF, more accurate the “DEFINE_DPM_SCALAR_UPDATE” and in this UDF execute the following scheme text command:
(format #f "file/export/particle-history-data cfdpost tracktest injection-0 , acc-total-mag force-coll-mag force-total-mag , ,"))
But I get a compiling error when trying it.
I read that it is eventually not possible to execute TI-commands by UDF.
It might be an option to export the data to a .txt file, e.g. like this:
n = N_TIME;
real current_time = CURRENT_TIME;
fid1 = fopen(filename,"a");
if (P_TIME(p) == CURRENT_TIME)
fprintf(fid1, "%f %f %f %f %f %f %f %"int64_fmt"\n",P_POS(p),P_POS(p),P_POS(p),P_VEL(p),P_VEL(p),P_VEL(p),P_TIME(p),p->part_id);
printf("time is not reached");
but then I cannot use it in CFD-Post. Maybe there would be a way if someone knows the structure of the .xml files - I could not find any documentation on that.
Inspired by this discussion: https://www.cfd-online.com/Forums/fluent/34386-getting-data-injected-particles.html
Print the data in a file/console using:
Solution -> Particle Tracks->Reporting->Report Type:Current Positions -> Report to: File/Console
Here, my problems were, that I only was able to print the data of the current time step in the console. Also, the possible file type is not .xml and not readable in cfdpost either.
Is there a possible solution to get the particle data exported for every particle time step or do you possibly have other suggestions without getting huge simulation times?
Thanks a lot in advance, any advice is highly appreciated!