CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF for deleting particles in DPM (http://www.cfd-online.com/Forums/fluent-udf/107304-udf-deleting-particles-dpm.html)

imanmirzaii September 23, 2012 18:49

UDF for deleting particles in DPM
 
Hi all,

I am trying to solve the motion of particles in bubbles. The particles along with air are injected from an inlet into water. Therefore the air, which includes the particles, generates the bubble and the particles are trapped in the bubble. For the bubble motion I used VOF and for the particle motion DPM model. Now for the last step of my project I have to delete the particles in the bubble as soon as they impact the bubble surface... I wanna do this with UDF... The idea for this UDF is that I want to delete the particles as soon as the particles are in a cell with f>=0.5 This is the UDF I am using:

#include "udf.h"
#define REMOVE_PARTICLES TRUE
DEFINE_DPM_OUTPUT(discrete_phase_counter,header,fp ,p,t,plane)
{
cell_t c;
Thread *t;
#if REMOVE_PARTICLES /*This if loop removes the particles*/
if(C_VOF(c,t)<=0.5)
p->stream_index=-1;
#endif
#endif
}

I can compile this UDF in Fluent, however, it does not remove the particles... Since I have been working with self developed codes in FORTRAN and I am not an expert in writing UDFs, would you please let me know how I should change this UDF to delete the particles in cells with VOF fractions greater than 0.5. It should be mentioned that in VOF model in liquid f=1 and in air f=0.

With Regards,
Iman.

alexsatan October 8, 2012 03:31

Quote:

Originally Posted by imanmirzaii (Post 383238)
Hi all,

I am trying to solve the motion of particles in bubbles. The particles along with air are injected from an inlet into water. Therefore the air, which includes the particles, generates the bubble and the particles are trapped in the bubble. For the bubble motion I used VOF and for the particle motion DPM model. Now for the last step of my project I have to delete the particles in the bubble as soon as they impact the bubble surface... I wanna do this with UDF... The idea for this UDF is that I want to delete the particles as soon as the particles are in a cell with f>=0.5 This is the UDF I am using:

#include "udf.h"
#define REMOVE_PARTICLES TRUE
DEFINE_DPM_OUTPUT(discrete_phase_counter,header,fp ,p,t,plane)
{
cell_t c;
Thread *t;
#if REMOVE_PARTICLES /*This if loop removes the particles*/
if(C_VOF(c,t)<=0.5)
p->stream_index=-1;
#endif
#endif
}

I can compile this UDF in Fluent, however, it does not remove the particles... Since I have been working with self developed codes in FORTRAN and I am not an expert in writing UDFs, would you please let me know how I should change this UDF to delete the particles in cells with VOF fractions greater than 0.5. It should be mentioned that in VOF model in liquid f=1 and in air f=0.

With Regards,
Iman.

HI:

Did you solve your problem? I have the same problem with you .In my oponion, "#include `dpm.h`" shuold be included in the head file, but my UDF like this and it does not work:

# include "udf.h"
# include "dpm.h"
DEFINE_DPM_SCALAR_UPDATE (reDPM,c,t,in,p)
{
Thread **pt;
real vof_g = C_VOF (c,pt[0]);

if (vof_g>=0.1)
p-> reDPM = -1;
else
return vof_g;
}

imanmirzaii October 8, 2012 12:05

Hi alexsantan,

Yeah I solved the problem, this is the UDF I used and it works perfect:


#include "udf.h"

DEFINE_DPM_SCALAR_UPDATE(charge,c,t,initialize,p)
{
Thread *phase_t = THREAD_SUB_THREAD(t,1);

if(C_VOF(c,phase_t)>=0.5)
p->stream_index = -1;
}

/*
0 in phase_t represents primary phase. If you want to find VOF for
secondary phase, you will have to change 0 to 1.
*/

fluentsimulation November 20, 2012 06:08

hi, Iman

do you know how to use this code in a parallel server ?

thanx a lot!

gearboy November 20, 2012 21:31

Quote:

Originally Posted by imanmirzaii (Post 383238)
Hi all,

I am trying to solve the motion of particles in bubbles. The particles along with air are injected from an inlet into water. Therefore the air, which includes the particles, generates the bubble and the particles are trapped in the bubble. For the bubble motion I used VOF and for the particle motion DPM model. Now for the last step of my project I have to delete the particles in the bubble as soon as they impact the bubble surface... I wanna do this with UDF... The idea for this UDF is that I want to delete the particles as soon as the particles are in a cell with f>=0.5 This is the UDF I am using:

#include "udf.h"
#define REMOVE_PARTICLES TRUE
DEFINE_DPM_OUTPUT(discrete_phase_counter,header,fp ,p,t,plane)
{
cell_t c;
Thread *t;
#if REMOVE_PARTICLES /*This if loop removes the particles*/
if(C_VOF(c,t)<=0.5)
p->stream_index=-1;
#endif
#endif
}

I can compile this UDF in Fluent, however, it does not remove the particles... Since I have been working with self developed codes in FORTRAN and I am not an expert in writing UDFs, would you please let me know how I should change this UDF to delete the particles in cells with VOF fractions greater than 0.5. It should be mentioned that in VOF model in liquid f=1 and in air f=0.

With Regards,
Iman.

DEFINE_DPM_SCALAR_UPDATE(remove_particle,c,mix_t,i nitialize,p)
{
cell_t c;
int water_index = 0; /* primary phase index is 0 */
Thread *water_t = THREAD_SUB_THREAD(mix_t,water_index);
if(REMOVE_PARTICLES) /*This if loop removes the particles*/
{
if(C_VOF(c,water_t)>=0.5) p->stream_index=-1;
}
}

rk_k67 January 29, 2013 08:02

Storing the particles
 
Hi everyone,

stream_index gets rid of the particles from the domain. Does anyone know if there is there a way to get the properties and number of the removed particles removed from the flow ? Do we need to store them in an array or sth ? Thanks!

Cheers,


All times are GMT -4. The time now is 13:55.