CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF for deleting particles in DPM

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By imanmirzaii

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 23, 2012, 19:49
Default UDF for deleting particles in DPM
  #1
New Member
 
iman
Join Date: Nov 2011
Posts: 5
Rep Power: 15
imanmirzaii is on a distinguished road
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.
imanmirzaii is offline   Reply With Quote

Old   October 8, 2012, 04:31
Default
  #2
New Member
 
JEEE
Join Date: Nov 2011
Posts: 7
Rep Power: 15
alexsatan is on a distinguished road
Quote:
Originally Posted by imanmirzaii View Post
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;
}
alexsatan is offline   Reply With Quote

Old   October 8, 2012, 13:05
Default
  #3
New Member
 
iman
Join Date: Nov 2011
Posts: 5
Rep Power: 15
imanmirzaii is on a distinguished road
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.
*/
imanmirzaii is offline   Reply With Quote

Old   November 20, 2012, 06:08
Default
  #4
New Member
 
Stephen Meng
Join Date: Nov 2012
Posts: 2
Rep Power: 0
fluentsimulation is on a distinguished road
hi, Iman

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

thanx a lot!
fluentsimulation is offline   Reply With Quote

Old   November 20, 2012, 21:31
Default
  #5
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by imanmirzaii View Post
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;
}
}
gearboy is offline   Reply With Quote

Old   January 29, 2013, 08:02
Default Storing the particles
  #6
New Member
 
Reza
Join Date: Jun 2009
Location: Sydney
Posts: 7
Rep Power: 17
rk_k67 is on a distinguished road
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,
rk_k67 is offline   Reply With Quote

Old   November 16, 2020, 03:19
Default I don't know what's wrong?
  #7
New Member
 
kanglele
Join Date: Nov 2020
Posts: 4
Rep Power: 6
kanglele is on a distinguished road
Quote:
Originally Posted by imanmirzaii View Post
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.
*/
I copy you code into fluent16.1,it shows“line 8: structure reference not implemented”,I don't know what's wrong?
kanglele is offline   Reply With Quote

Old   November 16, 2020, 05:43
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
compile code
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 17, 2020, 04:58
Default
  #9
New Member
 
kanglele
Join Date: Nov 2020
Posts: 4
Rep Power: 6
kanglele is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
compile code
Thank you very much for your answer.
Yes, I compile code,but I meet new difficulty,the fluent16.1 show “fluent16.1.0\win64\2d\fl1610.lib : fatal error LNK1113: invalid machine type”.
kanglele is offline   Reply With Quote

Old   November 19, 2020, 01:37
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
most likely, you've installed visual studio in wrong way

read this information
https://www.cfd-online.com/Wiki/Flue...UDF.29_Related
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 25, 2020, 06:38
Default
  #11
New Member
 
kanglele
Join Date: Nov 2020
Posts: 4
Rep Power: 6
kanglele is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
most likely, you've installed visual studio in wrong way

read this information
https://www.cfd-online.com/Wiki/Flue...UDF.29_Related
I installed visual studio 2019 ,and from visual studio 2019 enter into fluent 16.1,the code could be build and load . Thank you very much.
But I have new problem. After adding the UDF, and I want fluent16.1 to show the particle trajectories. the following error occurs :
Error: received a fatal signal (Segmentation fault).
Error Object: #f.
(If I didn't add the UDF, there's no problem)
kanglele is offline   Reply With Quote

Old   November 25, 2020, 15:23
Default
  #12
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
And you are really using the VOF model?
pakk is offline   Reply With Quote

Old   November 25, 2020, 20:27
Default
  #13
New Member
 
kanglele
Join Date: Nov 2020
Posts: 4
Rep Power: 6
kanglele is on a distinguished road
Quote:
Originally Posted by pakk View Post
And you are really using the VOF model?
Yes,For the bubble motion I used VOF and for the particle motion DPM model. I have to delete the particles in the bubble as soon as they impact the bubble surface.
kanglele is offline   Reply With Quote

Reply

Tags
delete, dpm, particles, udf, vof model


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DPM: UDF - loop over all particles chris Fluent UDF and Scheme Programming 31 June 17, 2020 06:52
DPM UDF Injection leads to 2 different particles sega Fluent UDF and Scheme Programming 4 December 28, 2017 23:57
DPM - do the particles affect the liquid? Nikhil Dani FLUENT 0 January 1, 2009 12:58
DPM: using UDF for creating and deleting Particles Markus Alzon FLUENT 0 July 4, 2007 02:18
DPM; particle seeded / deleted by UDF Laika FLUENT 6 January 23, 2006 00:40


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