CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for external force related to particle position (https://www.cfd-online.com/Forums/fluent-udf/123165-udf-external-force-related-particle-position.html)

czhao86 September 5, 2013 17:03

UDF for external force related to particle position
 
Hi,

i wanna exert an external force on particles, and below is my draft. But it is not working, anyone have some idea? Thank you very much.

Code:

#include "udf.h"
 
DEFINE_DPM_BODY_FORCE(particle_body_force,p,i)
{
real bforce=0;

Domain *domain;
domain = Get_Domain(1);

Thread *t;
cell_t c;
real xc[ND_ND];

thread_loop_c(t,domain)
{
begin_c_loop_all(c, t)   
  {       
      C_CENTROID(xc,c,t);
      bforce = xc[0];
             
  }                       
end_c_loop_all(c, t)
}

return (bforce);
}


czhao86 September 6, 2013 10:48

Code:

Thread *t=P_CELL_THREAD(p);
cell_t c=P_CELL(p);
C_CENTROID(xc,c,t);

The code above seems to work.


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