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/35488-define_dpm_body_force.html)

Sinan January 17, 2005 23:24

DEFINE_DPM_BODY_FORCE
 
Hi,

I am trying to write a UDF to include the particle-particle interaction forces. I know that P_POS(p)[i] gives me the particle's positions in each time step but I am not clear how to include P_POS(p)[i] in my loop within the program.As a simple example in the udf I wrote below I tried to calculate the force as a function of interparticular distance, Is the way I used P_POS(p)[i] ok or wrong?

I really appreciate any help THANKS!!!!!!!

Is there a way to reach more UDF example on the subject I deal other than Manual?

#include "udf.h"

#define n 60 /* Number of particles in the Tube*/

DEFINE_DPM_BODY_FORCE(particle_body_force, p, i) { Particle *k,*j real D,distance,bodyforce,acceleration;

for(k=1;k<=n;k++){ D[i]=0; for(j=1;j<=n;j++){ distance(k,j)[i]=P_POS(j)[i]-P_POS(k)[i]; bodyforce(k)[i]=D[i]+Function(distance(k,j))[i]; acceleration(k)[i]=bodyforce(k)[i]/P_MASS(k); } } return(acceleration); }


All times are GMT -4. The time now is 23:52.