|
[Sponsors] |
October 25, 2019, 03:03 |
Looping over particles in transient mode
|
#1 |
New Member
Arsalan
Join Date: Aug 2019
Location: Belfast, UK
Posts: 5
Rep Power: 6 |
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); } } } } |
|
October 25, 2019, 03:46 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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
__________________
best regards ****************************** press LIKE if this message was helpful |
|
October 25, 2019, 04:19 |
|
#3 | |
New Member
Arsalan
Join Date: Aug 2019
Location: Belfast, UK
Posts: 5
Rep Power: 6 |
Quote:
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? |
||
October 28, 2019, 01:29 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
October 28, 2019, 03:41 |
|
#5 | |
New Member
Arsalan
Join Date: Aug 2019
Location: Belfast, UK
Posts: 5
Rep Power: 6 |
Quote:
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? |
||
October 29, 2019, 00:05 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
|
|
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 |