|
[Sponsors] |
September 8, 2021, 09:32 |
How to loop over parcels in OpenFOAM 9
|
#1 |
New Member
Anders Simonsen
Join Date: Sep 2013
Posts: 18
Rep Power: 13 |
Hi
I'm in the process of switching from OF8 to OF9, where I'm currently updating my main solver. It is a lagrangian solver, where I in OF8 looped over all parcels by: Code:
forAllIter(decltype(parcels),parcels,p) { vector position = p().position(); } Code:
basicSprayCloud parcels ( "sprayCloud", rho, U, g, slgThermo ); I am able to loop over all the models in my simulation by: Code:
PtrListDictionary<fvModel>& modelList(fvModels); forAll(modelList, i) { Info << "Name: " << modelList[i].name() << endl; } Code:
autoPtr<???>& parcels = modelList[1]; Kind regards Anders |
|
September 20, 2021, 09:21 |
|
#2 |
New Member
Anders Simonsen
Join Date: Sep 2013
Posts: 18
Rep Power: 13 |
Hi again
I still haven't succeeded in looping over the parcels in OF9. However, I've made some progress, which I'll share here: Via the object registry, I was able to get a pointer to the parcelCloud object: Code:
Foam::parcelCloud& Obj_ParcelCloud = mesh.lookupObjectRef<Foam::parcelCloud>("cloud"); Code:
runTime++; Info << "Time = " << runTime.timeName() << nl << endl; Obj_ParcelCloud.evolve(); The iterator methods are defined in "Cloud.H": Code:
// Member Functions // Access //- Return the polyMesh reference const polyMesh& pMesh() const { return polyMesh_; } //- Return the number of particles in the cloud label size() const { return IDLList<ParticleType>::size(); }; // Iterators const const_iterator begin() const { return IDLList<ParticleType>::begin(); }; const const_iterator cbegin() const { return IDLList<ParticleType>::cbegin(); }; const const_iterator end() const { return IDLList<ParticleType>::end(); }; const const_iterator cend() const { return IDLList<ParticleType>::cend(); }; iterator begin() { return IDLList<ParticleType>::begin(); }; iterator end() { return IDLList<ParticleType>::end(); }; Can someone help me further, such that I can loop over all parcels? Or give me a hint/tip, as I seem to be stuck! Kind regards Anders |
|
October 4, 2021, 03:42 |
|
#3 |
New Member
Anders Simonsen
Join Date: Sep 2013
Posts: 18
Rep Power: 13 |
Hi again
I still haven't figured it out - can anyone give a hint or a suggestion? Kind regards Anders |
|
November 1, 2021, 18:38 |
|
#4 |
New Member
Yves Robert
Join Date: May 2019
Posts: 4
Rep Power: 7 |
I am actually wondering the same, if anybody has a suggestion.
|
|
November 10, 2021, 02:30 |
|
#5 |
Member
David GISEN
Join Date: Jul 2009
Location: Germany
Posts: 70
Rep Power: 17 |
just a wild guess, if you are using a pointer to object, do you have to access the member functions with a dereference operator like "->" ?
https://www.decodejava.com/cpp-point...-functions.htm |
|
March 9, 2022, 15:38 |
|
#6 |
Member
Rishikesh
Join Date: Apr 2016
Posts: 63
Rep Power: 10 |
Hi,
I am having the same issue with OF9 (To be honest, I have been feeling quite frustrated with the recent Foundation releases). Did you manage to fix the issue? I too am trying to loop over parcels from the main solver. Thanks, mrishi |
|
March 10, 2022, 04:50 |
|
#7 | |
New Member
Anders Simonsen
Join Date: Sep 2013
Posts: 18
Rep Power: 13 |
Quote:
No, I haven't found a solution to this, and I haven't been looking more into it recently. Kind regards Anders |
||
Tags |
fvmodel, loop, of9, parcels |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM Training Jan-Jul 2017, Virtual, London, Houston, Berlin | CFDFoundation | OpenFOAM Announcements from Other Sources | 0 | January 4, 2017 07:15 |
UNIGE February 13th-17th - 2107. OpenFOAM advaced training days | joegi.geo | OpenFOAM Announcements from Other Sources | 0 | October 1, 2016 20:20 |
New OpenFOAM Forum Structure | jola | OpenFOAM | 2 | October 19, 2011 07:55 |
[CAD formats] my stl surface is seen as just a line | rcastilla | OpenFOAM Meshing & Mesh Conversion | 2 | January 6, 2010 02:30 |
NACA0012 geometry/design software needed | Franny | Main CFD Forum | 13 | July 7, 2007 16:57 |