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

bin_particles_in_cells

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 21, 2014, 02:20
Default bin_particles_in_cells
  #1
New Member
 
massoud
Join Date: Nov 2011
Posts: 20
Rep Power: 14
massoudepsilon is on a distinguished road
Hi everybody,

is there anyone who knows that what the macro (bin_particles_in_cells) exactly does?

Thank you so much,
massoudepsilon is offline   Reply With Quote

Old   April 10, 2015, 13:15
Default
  #2
Senior Member
 
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 11
HyperNova is on a distinguished road
hi
From 3 years ago u are still stuck in that ?!
HyperNova is offline   Reply With Quote

Old   April 10, 2015, 19:40
Default
  #3
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Wow, you're not wrong, he's asked the same question on 11th of November 2011.

It appears this macro loops over all the particles in a domain on a cell-by-cell basis according to this page.
`e` is offline   Reply With Quote

Old   April 10, 2015, 19:41
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
If this macro has been removed (or altered) between versions of Fluent, you may require some code adjustments. What are you trying to achieve overall?
`e` is offline   Reply With Quote

Old   April 11, 2015, 00:58
Default
  #5
Senior Member
 
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 11
HyperNova is on a distinguished road
hi 'e'
i wrote my code and i used

bin_particles_in_cells(d); /* particles are bined in each cell of the fluid domain */

but this works ok in fluent 6.3.26 but in v15.0 no, in v15.0 it changed , in cl_dpm.h it wrote :

FLUENT_EXPORT void bin_particles_in_cells(Domain *domain, cxboolean init_cells);

there is another argument and i dont know what to write there .

i am working with dpm and i want to add source terms to k and epsilon.

any idea ?
thanks for your reply
HyperNova is offline   Reply With Quote

Old   April 11, 2015, 01:00
Default
  #6
Senior Member
 
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 11
HyperNova is on a distinguished road
Quote:
Originally Posted by `e` View Post
Wow, you're not wrong, he's asked the same question on 11th of November 2011.

It appears this macro loops over all the particles in a domain on a cell-by-cell basis according to this page.
i found him in another thread in 2011 as you mentioned
HyperNova is offline   Reply With Quote

Old   April 11, 2015, 02:37
Default
  #7
New Member
 
massoud
Join Date: Nov 2011
Posts: 20
Rep Power: 14
massoudepsilon is on a distinguished road
[QUOTE=HyperNova;541073]hi
From 3 years ago u are still stuck in that ?!

4 years ago I needed this macro for a project. but I solved the problem with another method.
last year for another project I needed it again. but no one could answer my question. but I solved the problem on my own.

it seems that you feel high self confidence and make fun on the others. I am waiting to see how long it takes you to solve the problem.

good luck
massoudepsilon is offline   Reply With Quote

Old   April 11, 2015, 02:53
Default
  #8
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
If you want to add source terms to k and e of the turbulence model of the continuous phase then use the DEFINE_SOURCE macro.

As for looping through all particles, try this code (source):

Code:
Injection *I, *Ilist = Get_dpm_injections();
Particle *p;

...

loop(I, Ilist) // loop through all injections
{
    loop(p, I->p) // loop through all particles
    {
        // all particles execute this code
    }
}
`e` is offline   Reply With Quote

Old   April 11, 2015, 05:07
Default
  #9
Senior Member
 
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 11
HyperNova is on a distinguished road
masoud come on , i need it quick
i used

bin_particles_in_cells(d); /* particles are bined in each cell of the fluid domain */

but it just works in fluent 6.3.26 , in v15.0 it doeant work and it says it needs another argument! id cl_dpm it wrote

FLUENT_EXPORT void bin_particles_in_cells(Domain *domain, cxboolean init_cells);

i dont know what is cxboolean init_cells and what should i put there , masoud please help!
HyperNova is offline   Reply With Quote

Old   April 11, 2015, 05:08
Default
  #10
Senior Member
 
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 11
HyperNova is on a distinguished road
this is my UDF

DEFINE_SOURCE(k_new_model_all_terms,c,t,dS,eqn) /* source term for the k equation */

{

Domain *d=Get_Domain(1); /* domain used in the particle loop. this should be the fluid domain , change index if necessary*/

Particle *p; /* particle index to be used in particle loop */

double umean[3], vmean[3], mass_mean, diamp, V_relative; /* declaration of variables */

double Skp, Sep, Rep, aaa, Mu, rho, TKEDR, TKE, v_mean[3];

int i; /* index used in for loops */

real g = 9.81; /* gravity constant */

real ce3 = 1.0; /* proportionality constant */

real x[ND_ND]; /* this will hold the position vector */

real depth = 0.42;
real injection_height = 0.01;
real Temp = 25.0;
real Pressure_REF = 101325.0;
real MolarWeight = 28.97; /* air */
real ST = 0.072;

real Ck1 = 6.0;
real Ck2 = 0.75;
real Ce1 = 4.0;
real Ce2 = 0.6;

real gas_density, P, Eo, Cd, Cd_sphere, Re, Cf, dpm_frac;
real a11, a22, a33, a12, a13, a21, a23, a31, a32, sen, Production_K;

Alloc_Storage_Vars(d, SV_DPM_PARTICLE_BIN, SV_NULL); /* memory is allocated for the particles which are to be bined in each cell */

bin_particles_in_cells(d); /* particles are bined in each cell of the fluid domain */

begin_particle_cell_loop(p, c, t) /* loops over all particle p which are contained in each cell c */

{

}

Last edited by HyperNova; April 11, 2015 at 10:40.
HyperNova is offline   Reply With Quote

Old   April 11, 2015, 07:59
Default
  #11
Senior Member
 
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 11
HyperNova is on a distinguished road
Quote:
Originally Posted by `e` View Post
If you want to add source terms to k and e of the turbulence model of the continuous phase then use the DEFINE_SOURCE macro.

As for looping through all particles, try this code (source):

Code:
Injection *I, *Ilist = Get_dpm_injections();
Particle *p;

...

loop(I, Ilist) // loop through all injections
{
    loop(p, I->p) // loop through all particles
    {
        // all particles execute this code
    }
}
i put my code here , upper of this message, would you mind taking a look of that, that sentence in red color id making problem, i don't know why particles deleted from domain automaticly ,
with bin_particles_in_cells(d); Fluent says another argument is needed, in another thread (http://www.cfd-online.com/Forums/flu...s-command.html) LICH tried to put 0 1 true false as another argument but i did not work for him and me either, if you have any idea i will be thankful if you share it ,
HyperNova is offline   Reply With Quote

Old   August 28, 2017, 03:36
Default UDF for looping on all particles in each cell.
  #12
New Member
 
massoud
Join Date: Nov 2011
Posts: 20
Rep Power: 14
massoudepsilon is on a distinguished road
Since Fluent 12, the implementation of bin_particles_in_cells(domain, count) has changed and you need additional macro (unthread_particles_to_all_inj(domain, check)). Please be aware that this additional macro had only one argument at least until Fluent version 14. Since Fluent 17 it needs 2 arguments (domain and check (which is a boolean variable)).

Here is a simple UDF for looping on all particles in each cell.

DEFINE_ADJUST(Looping, domain)
{
cxboolean count;
cxboolean check;
Thread *t;
cell_t c;
Particle *p;

Alloc_Storage_Vars(domain, SV_DPM_PARTICLE_BIN, SV_NULL);

bin_particles_in_cells(domain, count);
thread_loop_c (t,domain)
{
begin_c_loop(c, t)

{

begin_particle_cell_loop(p,c,t)
{
/* you can do your calculation on particles in one cell here*/
}
end_particle_cell_loop(p, c, t)
}
end_c_loop(c, t)
unthread_particles_to_all_inj(domain, check);
Free_Storage_Vars(domain, SV_DPM_PARTICLE_BIN, SV_NULL); /* release allocated memory*/
}
}

Last edited by massoudepsilon; August 28, 2017 at 05:37.
massoudepsilon is offline   Reply With Quote

Reply

Tags
bin_particles_in_cells, dpm, fluent, udf


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



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