Post reply

Note: this post will not display until it's been approved by a moderator.

Message icon:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: hit alt+s to submit/post or alt+p to preview

Topic Summary

Posted by: william
« on: June 19, 2012, 08:38:40 AM »

Here is an example of how you can implement begin_particle_cell_loop:

   DPM Spray Collide Example UDF
#include "udf.h"
#include "dpm.h"
#include "surf.h"
  /* non-physical collision UDF that relaxes the particle */
  /* velocity and diameter in a cell to the mean over the */
  /* specified time scale t_relax */

  const real t_relax = 0.001; /* seconds */

  /* get the cell and Thread that the particle is currently in */
  cell_t c  = RP_CELL(&(tp->cCell));
  Thread *t = RP_THREAD(&(tp->cCell));

  /* Particle index for looping over all particles in the cell */
  Particle *pi;

  /* loop over all particles in the cell to find their mass */
  /* weighted mean velocity and diameter */
  int i;
  real u_mean[3]={0.}, mass_mean=0.;
  real d_orig = tp->state.diam;
  real decay = 1. - exp(-t_relax);
      mass_mean += pi->state.mass;
        u_mean += pi->state.V*pi->state.mass;

  /* relax particle velocity to the mean and diameter to the */
  /* initial diameter over the relaxation time scale t_relax */
  if( mass_mean > 0. )
        u_mean /= mass_mean;
        tp->state.V += decay*( u_mean - tp->state.V );
      tp->state.diam += decay*( P_INIT_DIAM(tp) - tp->state.diam );
      /* adjust the number in the droplet parcel to conserve mass */
      tp->number_in_parcel *= CUB( d_orig/tp->state.diam );
Posted by: sfotovati
« on: June 17, 2012, 01:51:08 AM »

hi William,

I wrote the following UDF to add the effects of other particles on the tracked particles as a body force.

   double bforce=0., Bc=0.;
   Thread *t;
    cell_t c;
   Particle *pi;

   t = P_CELL_THREAD(p);
    c = P_CELL(p);

   if (Data_Valid_P())

    bforce=Bc/PMASS(p)+1.;         /*i component, x,y,or z component force*/ 
    return bforce;  /*return the acceleration*/

as I run it, it gives "FLUENT received fatal signal (ACCESS_VIOLATION)" error. I believe it is because of "begin_particle_cell_loop" macro. Do you have any idea why this happens? How can I use "begin_particle_cell_loop" macro properly?

Thank you very much for your help.

Posted by: moloy_kb
« on: June 08, 2012, 07:46:13 AM »

Thnks.. It works
Posted by: william
« on: May 30, 2012, 10:50:19 AM »

You can use following UDF to track unsteady particles using user-specified time-interval. At the time of the next injection, the accumulated particles mass will be injected
There will be fewer particles but the particle mass will be preserved.

#include "udf.h"
#define RELEASE_STEP 5e-3
static real sum_inj = 0.0;
DEFINE_ADJUST  (update,  domain)
real  pflow;
if ( first_iteration )
pflow        =  get_mdot_prt(tm);
sum_inj += mdot*tmspsz;
Particle *p;
real      tm, tmspsz, flowrate;
tm           =  RP_Get_Real("flow-time");
tmspsz   =  RP_Get_Real("physical-time-step");
flowrate  =  sum_inj/tmspsz;
p->flow_rate  = flowrate;
if ((tm+tmspsz) >= I->unsteady_start)
I->unsteady_start  +=  RELEASE_STEP;
sum_inj =  0.0;
Posted by: moloy_kb
« on: May 29, 2012, 07:32:48 AM »

Dear all,
I am doing the unsteady DPM calculation and there I want to inject particle in the domain at every alternate particle time step. How to do it??