CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Define_dpm_body_force (https://www.cfd-online.com/Forums/fluent/85265-define_dpm_body_force.html)

AAAA February 21, 2011 12:19

Define_dpm_body_force
 
I'm planning on running some DPM simulations. The particles follow some behavioral rules based on some flow field variables values. I also want to create a customized txt output file with the particles information for each time step.

- Are there previous time step macros for the particle information like there are for some flow field variables (e.g. C_U_M1(c,t))? I couldn't find information on that in the Fluent UDF manual. I need to know the velocity of the particle in the previous time step.


- As a test for the output file I ran a short DPM simulation with the BODY FORCE shown below. For each particle and time step a bunch of lines are printed. I assume those are the internal iterations the DPM model uses to move the particles. Under that logic the last line should be the final position for a particle for each time step. To verify that I saved a data file and opened it in Tecplot including the particle data. the coordinates of the particles shown in Tecplot is pretty close to the last line written by the DEFINE_DPM_BODY_FORCE but no the same.

Does anyone know why they are not the same?

DEFINE_DPM_BODY_FORCE(particle_body_force,p,i)
{
FILE *file2;
real bforce = 0.0;
int n,n0;
cell_t c = P_CELL(p); /* cell and thread */
Thread *t = P_CELL_THREAD(p); /* where the particle is in */
cell_t adj_c;
face_t f,f0;
Thread *tf,*tf0,*adj_thread;

file2 = fopen ("BODY_FORCE.txt","a");
if (file2 != NULL)
{
fprintf (file2, "%f %d %f %f %f %f %f %f \n",CURRENT_TIME,p->part_id, P_POS(p)[0], P_POS(p)[1], P_POS(p)[2], P_USER_REAL(p,0), P_USER_REAL(p,1), P_USER_REAL(p,2));
}
fclose (file2);
}


All times are GMT -4. The time now is 08:37.