Post reply

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

Name:
Email:
Subject:
Message icon:

Verification:
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: piso
« on: April 25, 2012, 10:04:15 AM »

Thank you.
Posted by: william
« on: April 25, 2012, 10:01:09 AM »

The following sample code shows how to calculate volume of particles in each cell and store result in user defined memory.

#include "udf.h"

/* Define user defined memory location index (i.e. first user defined memory location) */
#define P_TOTAL_VOLUME 0 /* Total particle volume in each cell (m^3) */

DEFINE_EXECUTE_AT_END(test)
{
Domain *domain = Get_Domain(1);
Injection *I, *Ilist = Get_dpm_injections();
Particle *p;
Thread *tc;
cell_t c;
real cell_particle_volume = 0.0;

/* Reset UDM to zero */
thread_loop_c(tc, domain)
{
begin_c_loop(c, tc)
{
C_UDMI(c, tc, P_TOTAL_VOLUME)= 0.0;
}
end_c_loop(c, tc);
}

/* Loop through all injections */
loop(I, Ilist)
{
/* Loop through all particles */
loop(p, I->p)
{
Thread *t0 = P_CELL_THREAD(p);
cell_t c = P_CELL(p);
cell_particle_volume = M_PI * (P_DIAM(p) * P_DIAM(p) * P_DIAM(p)) * p->number_in_parcel / 6.0;
C_UDMI(c, t0, P_TOTAL_VOLUME) += cell_particle_volume;
}
}
}
Posted by: piso
« on: April 25, 2012, 09:59:26 AM »

I want to calculate the volume occupied by particles in each cell. I know it can be done using UDF, but I can not figure out how to do it. Can any one guide me?

Thanks.