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

Problem with DPM simulation with particles injection and EXECUTE_AT_THE_END UDF.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 12, 2015, 15:00
Default Problem with DPM simulation with particles injection and EXECUTE_AT_THE_END UDF.
  #1
Ari
New Member
 
Arianna
Join Date: Sep 2015
Posts: 9
Rep Power: 11
Ari is on a distinguished road
Hi everyone!
I set a particles injection and I'm using an UDF in order to track the particles and export some particles related quantities at the end of each time step.The UDF simply executes a loop on the particles. The UDF used to work on a previuos version of fluent (6.3 if i can remember). The problem appears when the particles are released and tracked for the first time. The UDF saves the particles related data but at the next time step the particles suddenly disappear from the domain and fluent gives me number tracked=0. The problem seems to come from the UDF line "bin_particles_in_cells(d,TRUE);" when I remove that line the simulation works with the particle injection and the particles are tracked but the UDF doesn't save the files with particles information that it is supposed to save. This is my general UDF with the x position as quantity to be saved just as example for you.

#include "udf.h"
#include "surf.h"
DEFINE_EXECUTE_AT_END(execute_at_end)
{
FILE *fp=NULL;
char str[40];
Domain *d=Get_Domain(1);
cell_t c;
int ID=9;
Tracked_Particle *p;
Thread *t;
real id;
real my_time_p;
double posx
Alloc_Storage_Vars(d,SV_DPM_PARTICLE_BIN,SV_NULL);
bin_particles_in_cells(d,TRUE);
Thread *t=Lookup_Thread(d,ID);
begin_c_loop(c,t)
{
begin_particle_cell_loop(p,c,t)
{
id=p->part_id;
my_time_p=P_TIME(p);
posx=P_POS(p)[0];

sprintf(str,"./PATH/path%.0f.txt",id);
fp=fopen(str,"a");
fprintf(fp,"%-5.5e \n",posx);
fclose(fp);
}
end_particle_cell_loop(p,c,t)
}
end_c_loop(c,c_thread)
Free_Storage_Vars(d,SV_DPM_PARTICLE_BIN,SV_NULL);
Message("\nParticle Writing Done\n");
#endif
}

Anyone has any idea about what's going on with my simulation or had a similar problem?
Ari is offline   Reply With Quote

Old   October 12, 2015, 19:05
Default Problem solved
  #2
Ari
New Member
 
Arianna
Join Date: Sep 2015
Posts: 9
Rep Power: 11
Ari is on a distinguished road
I finally solved my problem if anyone is interested I can share the solution!
Ari is offline   Reply With Quote

Old   October 13, 2015, 04:53
Default
  #3
Member
 
S. Morichika
Join Date: Aug 2014
Posts: 62
Rep Power: 12
Saidul is on a distinguished road
Could you please share your solution?

Thanks in advance.
S.I.
Saidul is offline   Reply With Quote

Old   October 13, 2015, 14:44
Default
  #4
Ari
New Member
 
Arianna
Join Date: Sep 2015
Posts: 9
Rep Power: 11
Ari is on a distinguished road
Basically I changed my code in order to loop over the particles of the injection and not over the cells. It works pretty well. I don't know what they changed from the previous versions because my old code used to work on Fluent 6.3.
#include "udf.h"
#include "dpm.h"
#include "surf.h"

DEFINE_EXECUTE_AT_END(execute_at_end)
{
FILE *fp=0;
char str[40];
Domain *d=Get_Domain(1);
Particle *p;
Injection *I;
Injection *dpm_injections = Get_dpm_injections();
real id;
real my_time_p;
double posx,posy,posz;

loop(I,dpm_injections)
{
loop(p,I->p)
{
cell_t c;
Thread *c_thread;
c=P_CELL(p);
c_thread=P_CELL_THREAD(p);
posx=P_POS(p)[0];
posy=P_POS(p)[1];
posz=P_POS(p)[2];

sprintf(str,"H:/PATH/path%.0f.txt",id);
fp=fopen(str,"a");
fprintf(fp,"%-5.5e %-5.5e %-5.5e f\n",posx,posy,posz);
fclose(fp);
}
}
Message("\nParticle Writing Done\n");
}
Ari is offline   Reply With Quote

Old   May 31, 2016, 09:51
Smile
  #5
New Member
 
Join Date: Apr 2016
Posts: 11
Rep Power: 10
Narita is on a distinguished road
Hello Ari. I have exactly the same problem in Ansys Fluent 14+ and 16.
(My thread on this problem: http://www.cfd-online.com/Forums/flu...tml#post602635)

Thank you so much for posting the solution, yet I'm still very interested in how to deal with bin_particles_in_cells(domain,TRUE).

I'll try my best and then come back to share the solution!
Narita is offline   Reply With Quote

Reply


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
Particle Injection induced from a UDF Peter023 Fluent UDF and Scheme Programming 3 November 26, 2018 04:55
DPM UDF Injection leads to 2 different particles sega Fluent UDF and Scheme Programming 4 December 28, 2017 23:57
Conditional Release of DPM Particles in Fluent - UDF nvschandra Fluent UDF and Scheme Programming 0 December 16, 2013 21:32
Conditional Release of DPM particles - UDF nvschandra Fluent UDF and Scheme Programming 0 December 10, 2013 12:02
injection problem Mark New FLUENT 0 August 4, 2013 02:30


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