|
[Sponsors] |
April 27, 2010, 11:16 |
Help: the output of DPM
|
#1 |
New Member
xinyu zhao
Join Date: Sep 2009
Posts: 19
Rep Power: 17 |
Hi!
In unsteady DPM model, how to output the position and velocities of particles in a cell at a certain time using UDF? Last edited by zhaoxinyu; April 27, 2010 at 13:01. |
|
April 27, 2010, 13:08 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
I once obtained this from Fluent support desk. Good luck
Code:
/********************************************************************/ /* */ /* Hook on the DPM panel under DPM Scalar Update */ /* */ /********************************************************************/ #include "udf.h" #include "dpm.h" DEFINE_DPM_SCALAR_UPDATE(track_dpm_particles,c,t,initialize,p) { if (RP_Get_Boolean("dpm/unsteady-tracking?")) { if (initialize) { float time = RP_Get_Real("flow-time"); float x = p->state.pos[0]; float y = p->state.pos[1]; float u = p->state.V[0]; float v = p->state.V[1]; #if RP_3D float z = p->state.pos[2]; float w = p->state.V[2]; #endif FILE *fd; int id = p->part_id; char whoru[80]; sprintf(whoru,"dpm_positions%f.out",time); fd = fopen(whoru, "a"); #if RP_3D fprintf(fd, "%i %f %e %e %e %e %e %e %e %e %e \n", id, time, x, y, z, u, v, w, P_T(p), P_MASS(p), P_RHO(p)); #else fprintf(fd, "%i %f %e %e %e %e %e %e %e \n", id, time, x, y, u, v, P_T(p), P_MASS(p), P_RHO(p)); #endif fclose(fd); } } else { float time = RP_Get_Real("flow-time"); float x = p->state.pos[0]; float y = p->state.pos[1]; float u = p->state.V[0]; float v = p->state.V[1]; #if RP_3D float z = p->state.pos[2]; float w = p->state.V[2]; #endif FILE *fd; int id = p->part_id; char whoru[80]; sprintf(whoru,"dpm_positions%f.out",time); fd = fopen(whoru, "a"); #if RP_3D fprintf(fd, "%i %f %e %e %e %e %e %e %e %e %e \n", id, time, x, y, z, u, v, w, P_T(p), P_MASS(p), P_RHO(p)); #else fprintf(fd, "%i %f %e %e %e %e %e %e %e \n", id, time, x, y, u, v, P_T(p), P_MASS(p), P_RHO(p)); #endif fclose(fd); } } |
|
April 27, 2010, 20:07 |
|
#3 | |
New Member
xinyu zhao
Join Date: Sep 2009
Posts: 19
Rep Power: 17 |
Quote:
|
||
August 3, 2011, 08:40 |
|
#4 |
New Member
Ro'ee Orland
Join Date: Nov 2010
Posts: 18
Rep Power: 16 |
when I tried to use that code, all the particle id's get the value zero
has this also happened to you? |
|
April 25, 2016, 03:52 |
|
#5 |
New Member
Outside US and Canada
Join Date: Apr 2015
Location: Beijing
Posts: 9
Rep Power: 11 |
The code works fine except that it writes duplicated data for me, the positions and velocities are repeated 4 times in the .out file, why? and how to fix it?
|
|
April 25, 2016, 04:50 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Are you working in parallel mode with four processes? In that case, the reason that you get four lines is that this code is not meant for parallel computing.
This can be fixed by parallelizing the code (putting the correct macro's in the right position, see Fluent manual for more info). But if you are not familiar with this, it might be better to just ignore the extra output you get. |
|
April 25, 2016, 05:50 |
|
#7 |
New Member
Outside US and Canada
Join Date: Apr 2015
Location: Beijing
Posts: 9
Rep Power: 11 |
The thing is that I'm working in serial, so it's weird that I'm getting four lines. My computer has four cores though, I'm not sure if it has anything to do with four cores.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to name the DPM Output file | deepinheart | Main CFD Forum | 0 | April 14, 2009 13:19 |
DPM - do the particles affect the liquid? | Nikhil Dani | FLUENT | 0 | January 1, 2009 12:58 |
[Other] Output Format of MetaMesh | t42 | OpenFOAM Meshing & Mesh Conversion | 0 | August 3, 2007 05:28 |
Output for DPM macros | Js | FLUENT | 0 | February 7, 2005 18:23 |
Help with DPM UDF for OUTPUT needed | Zhengcai Ye | FLUENT | 0 | January 5, 2004 17:58 |