CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Looping Over Active Lagrangian Particles

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By olesen
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 1, 2021, 12:38
Default Looping Over Active Lagrangian Particles
  #1
Member
 
Conor Crickmore
Join Date: Jan 2020
Location: Leicestershire, United Kingdom
Posts: 36
Rep Power: 6
cjc96 is on a distinguished road
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);
        }
    }
With extractionPlane and extractionData being my own custom cloud property and function respectively.

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
cjc96 is offline   Reply With Quote

Old   March 1, 2021, 14:40
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
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.
cjc96 likes this.
olesen is offline   Reply With Quote

Old   March 1, 2021, 16:10
Default
  #3
Member
 
Conor Crickmore
Join Date: Jan 2020
Location: Leicestershire, United Kingdom
Posts: 36
Rep Power: 6
cjc96 is on a distinguished road
Quote:
Originally Posted by olesen View Post
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.
Hey Mark,

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
cjc96 is offline   Reply With Quote

Old   March 2, 2021, 02:56
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
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.
cjc96 likes this.
olesen 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
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


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