|
[Sponsors] |
March 1, 2021, 12:38 |
Looping Over Active Lagrangian Particles
|
#1 |
Member
Conor Crickmore
Join Date: Jan 2020
Location: Leicestershire, United Kingdom
Posts: 36
Rep Power: 6 |
Hey everyone,
I'm continue to work on my custom Lagrangian-Eulerian solver and am at the point where I am focusing more on efficiency than functionality. I'm currently recording information associated with particles that cross a pre-defined plane in space using the following loop at the end of the evolve function: Code:
forAllIter(typename KinematicCloud<CloudType>, *this, iter) { parcelType& p = iter(); if (p.position().x()>cloud.solution().extractionPlane()) { this->extractionData(p); } } I'm fairly confident that this loops over every particle in the domain, whereas in this case, I only need to test active particles, (those that are have not impinged on a surface). Towards the end of my simulation I have over 2,000,000 inactive particles so this should provide considerable savings. Now, it's easy to identify inactive particles, as p.active() is simply equal to zero, and I'm wondering whether change the loop to only pass over those particles with the active flag? Thanks as per usual!
__________________
Conor Crickmore PhD Researcher in Automotive Aerodynamics Aeronautical and Automotive Engineering Loughborough University LE11 3TU Last edited by cjc96; March 1, 2021 at 12:44. Reason: Formatting |
|
March 1, 2021, 14:40 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Beyond simply adding a test for p.active() into your if condition can't see how to make this any faster, unless the particles happened to already be presorted into active/inactive as some other part of your process.
|
|
March 1, 2021, 16:10 |
|
#3 | |
Member
Conor Crickmore
Join Date: Jan 2020
Location: Leicestershire, United Kingdom
Posts: 36
Rep Power: 6 |
Quote:
Thanks for your input! So, beyond doing something like an initial loop over all the particles to identify the active ones (which would of course make things even slower) there is no way to loop over only the active particles?
__________________
Conor Crickmore PhD Researcher in Automotive Aerodynamics Aeronautical and Automotive Engineering Loughborough University LE11 3TU Last edited by cjc96; March 1, 2021 at 16:11. Reason: Formatting |
||
March 2, 2021, 02:56 |
|
#4 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
If you check out src/lagrangian/basic/cloud you will see that it is implemented as a linked list, so not much to optimize there.
And having an iterator for active-only particles (doesn't exist) would add some syntax sugar but not add performance. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Radiation heating of lagrangian particles in reactingParcelFoam | CHUIKOV | OpenFOAM Running, Solving & CFD | 0 | February 28, 2021 15:53 |
Lagrangian particles injection with interFoam and swak4foam | Cluap | OpenFOAM Running, Solving & CFD | 0 | June 12, 2018 12:37 |
Corellation dimension of lagrangian particles | oswald | OpenFOAM Post-Processing | 0 | January 27, 2016 08:30 |
Add lagrangian particles to OpenFoam solver | luchen2408 | OpenFOAM | 0 | June 2, 2015 04:10 |
Question about openFOAM installation on Mac | MohandeseIrani | OpenFOAM Installation | 14 | October 28, 2014 10:28 |