|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
massoud
Join Date: Nov 2011
Posts: 20
Rep Power: 15 ![]() |
Hi everybody,
is there anyone who knows that what the macro (bin_particles_in_cells) exactly does? Thank you so much, |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 12 ![]() |
hi
From 3 years ago u are still stuck in that ?! |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 ![]() |
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?
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 12 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#6 | |
Senior Member
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 12 ![]() |
Quote:
![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
massoud
Join Date: Nov 2011
Posts: 20
Rep Power: 15 ![]() |
[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 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 ![]() |
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 } } |
|
![]() |
![]() |
![]() |
![]() |
#9 |
Senior Member
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 12 ![]() |
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! |
|
![]() |
![]() |
![]() |
![]() |
#10 |
Senior Member
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 12 ![]() |
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 11:40. |
|
![]() |
![]() |
![]() |
![]() |
#11 | |
Senior Member
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 12 ![]() |
Quote:
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 , |
||
![]() |
![]() |
![]() |
![]() |
#12 |
New Member
massoud
Join Date: Nov 2011
Posts: 20
Rep Power: 15 ![]() |
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 06:37. |
|
![]() |
![]() |
![]() |
Tags |
bin_particles_in_cells, dpm, fluent, udf |
|
|