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

Looping over particles in transient mode

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 25, 2019, 03:03
Default Looping over particles in transient mode
  #1
New Member
 
Arsalan
Join Date: Aug 2019
Location: Belfast, UK
Posts: 5
Rep Power: 6
Arsal is on a distinguished road
Hi everyone,

I'm trying to obtain particle deposition in a cell zone. According to the manual, in transient mode, with 'loop(p,I->p_init)', it's possible to loop over the particles. The code below is based on suggestions in this forum. However, I couldn't make it work.

I tried simulating in steady mode as well, using 'loop(p,I->p)'. Only replacing it would result in an increase in particles deposited every iteration. If I remove '+' from the code, I see only one dot in the cell zone, but I expect more particles passing.

Can anyone tell what's wrong with this code?

Code:
DEFINE_EXECUTE_AT_END(execute_at_end)
{
     Domain *d = Get_Domain(1);
     Thread *t;
     Thread *t_fluid = Lookup_Thread(d,4);
     Injection *I;
     Particle *p;
     Injection *Ilist = Get_dpm_injections();
     cell_t c;
	
     loop(I, Ilist)
     {
        loop(p,I->p_init)
	{
	   c = TP_CELL(p);
	   t = TP_CELL_THREAD(p); 
	  if (t == t_fluid)
	  {
            C_UDMI(c, t, 0) += TP_MASS(p)/C_VOLUME(c, t);
	    MARK_TP(p, P_FL_REMOVED);
	   }
        } 
     }
}
Arsal is offline   Reply With Quote

Old   October 25, 2019, 03:46
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I don't have experience in DPM simulations, however
as far as I understand you have a loop over particles
it means, you fill UDMI with information, when you are in particular particle,

if there is no "+' then UDMI will contain information about last particle, which was in cell/thread
Ety and Arsal like this.
__________________
best regards


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

Old   October 25, 2019, 04:19
Default
  #3
New Member
 
Arsalan
Join Date: Aug 2019
Location: Belfast, UK
Posts: 5
Rep Power: 6
Arsal is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
I don't have experience in DPM simulations, however
as far as I understand you have a loop over particles
it means, you fill UDMI with information, when you are in particular particle,

if there is no "+' then UDMI will contain information about last particle, which was in cell/thread
Thank you for your reply. Ok, I understood the problem with the steady mode that only considers the last particle. But I can't get my head around why only one cell had a value. I guess it can only be solved in transient mode?

In transient, my expectation is that the code gets the list of 'Injections', which is only one in my case. It starts the loop and gets their current cell and thread. If they are located in the target thread (cell zone), it calculates the concentration (mas divided by volume) and stores it in the UDMI for that cell. And, with 'MARK_TP(p, P_FL_REMOVED)' ends the trajectory of that particle. Do you see some mistake with my logic?

I can see that 'loop(p,I->p_init)' is used in section 2.5.6.4 of the manual with 'DEFINE_DPM_INJECTION_INIT'. So, my guess was that I might need to add something to make it work in 'DEFINE_EXECUTE_AT_END'? Or is it about DPM iteration?
Arsal is offline   Reply With Quote

Old   October 28, 2019, 01:29
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
it should work in steady state as well.

you have a loop over particles, number of particles could be higher than number of cells in domain -> in one cell there could be several particles -> so you need + (C_UDMI(c, t, 0) += TP_MASS(p)/C_VOLUME(c, t); )

I think you need +
__________________
best regards


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

Old   October 28, 2019, 03:41
Default
  #5
New Member
 
Arsalan
Join Date: Aug 2019
Location: Belfast, UK
Posts: 5
Rep Power: 6
Arsal is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
it should work in steady state as well.

you have a loop over particles, number of particles could be higher than number of cells in domain -> in one cell there could be several particles -> so you need + (C_UDMI(c, t, 0) += TP_MASS(p)/C_VOLUME(c, t); )

I think you need +
Thanks. The solution in steady is to use TP_FLOW_RATE(p), which considers all the particles in that stream.

Something else that I haven't been able to find in this forum is how to do discrete steady simulations (instead of a long transient one) that each simulation depends on the previous one. The challenge is how to retain the values of the UDM so that it is used in the next run as an initial profile.

I have thought of using the DEFINE_RW_FILE (or DEFINE_ON_DEMAND?) to write to a file at the end of a simulation. But, I don't know the structure that data needs to be saved with fprintf() so that it can be stored in a UDM later. Any ideas?
Arsal is offline   Reply With Quote

Old   October 29, 2019, 00:05
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
I think, you may try to write to file your UDMs

it doesn't really metter, which macro you will use: define on demand, define adjust or any other
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ 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
Counting Particles in Transient Simulation Nuuu CFX 14 October 8, 2020 18:19
Transient simulations: how to tell its converged (I've read the FAQ & user guides!) JuPa CFX 12 March 27, 2020 17:24
Particles tracking and time-dependent bc in transient analisys Axseexcentrico CFX 2 April 19, 2018 15:46
Add lagrangian particles to OpenFoam solver luchen2408 OpenFOAM 0 June 2, 2015 03:10
particles, transient KtoTo Siemens 2 June 21, 2007 09:06


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