|
[Sponsors] |
February 17, 2023, 07:48 |
access parcels in cloud object
|
#1 |
New Member
Martin
Join Date: Jul 2022
Posts: 16
Rep Power: 4 |
I want to collect collision statistics from a lagrangian cloud. For that purpose I need to access the individual parcels in that cloud.
In OpenFOAM-8 I would just create the cloud object and iterate over the parcels: Code:
// openFOAM-8 basicReactingMultiphaseCloud parcels("cloudName", rho, U, g, slgThermo); forAllIter(basicReactingMultiphaseCloud, parcels, iter) { ... } Since, in OF-10, the cloud object is created by the corresponding fvModel, I do not need create it in the solver myself but can look it up from the object registry. As a side note: I want to do this because the cloud constructor otherwise tries to read the corresponting properties dict from constant -- and all entries must be defined in there, there is no longer an active flag to just switch the cloud off. Code:
// OpenFOAM-10 reactingMultiphaseCloud& parcels = mesh.template lookupObjectRef<reactingMultiphaseCloud>("cloudName"); forAllIter(typename reactingMultiphaseCloud, parcels, iter) { ... } This fails to compile with the error message: Code:
/home/user/OpenFOAM/OpenFOAM-10/src/OpenFOAM/lnInclude/objectRegistryTemplates.C:182:61:error: reference to ‘Foam::ParcelCloud<Foam::ReactingMultiphaseClou d<Foam::ReactingCloud<Foam::ThermoCloud<Foam::MomentumCloud<Foam::ParcelCloudBase<Foam::ReactingMultiphaseParcel<Foam::ReactingParcel<Foam::ThermoParcel<Foa m::MomentumParcel<Foam::particle> > > > > > > > > >::typeName’ is ambiguous 182 | << " successful\n but it is not a " << Type::typeName I dug around a bit and found a code snipped in Code:
src/lagrangian/parcel/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/Suppression Collision.C Code:
// OpenFOAM-10 parcelCloud& parcels = mesh.template lookupObjectRef<parcelCloud>("cloudName"); forAllIter(typename reactingMultiphaseCloud, parcels, iter) { ... } I do not have access to various member functions, e.g.: Code:
error: ‘class Foam::parcelCloud’ has no member named ‘composition’ 151 | label idSolid = parcels.composition().idSolid(); I found this post using the object registry to access a particle cloud with a very similar issue in an old(er) OpenFOAM version. However, I have no idea how to adapt the solution in my case. Since reactingMultiphaseCloud is just a typedef, inserting the full template does not make a difference. Does anyone have an idea on how to solve this? |
|
February 27, 2023, 10:10 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
I did not check with any of the .org versions, but in the openfoam.com versions I know that it is no problem to just use the forAllIters and forAllConstIters macros (note the additional trailing 's' ) and traverse the cloud parcels.
You could try just using the equivalent of what the forAllConstIters does and simply use a range-for. Eg, Code:
for (const auto& p : parcels) { // do something } |
|
March 1, 2023, 06:55 |
|
#3 |
New Member
Martin
Join Date: Jul 2022
Posts: 16
Rep Power: 4 |
Thanks for the ideas but sadly neither of your suggestions solves the issue:
|
|
March 1, 2023, 10:16 |
|
#4 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
which error messages exactly?
|
|
March 10, 2023, 09:09 |
|
#5 |
New Member
Martin
Join Date: Jul 2022
Posts: 16
Rep Power: 4 |
Hi Mark, sorry for the late reply.
To summarize things more thoroughly:
|
|
April 3, 2023, 12:05 |
|
#6 |
New Member
Martin
Join Date: Jul 2022
Posts: 16
Rep Power: 4 |
Just for reference: I solved this issue now by wrapping the collision statistics in an extra model which reads the cloudProperties file only when it is present.
Internally that model wraps the reactingMultiphaseCloud in an autoPtr and exposes functions for the source terms to be called when assembling the equations. In the end, this approach is similar to what the fvModels do. I did not find a solution that creates less overhead. |
|
Tags |
openfoam-10 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
can I access to the "dict" object from codeWrite in a coded function object? | NotOverUnderated | OpenFOAM Programming & Development | 2 | October 28, 2021 19:46 |
Access the Time object in sixDoFRigidBodyMotionRestraints | SailorLiu | OpenFOAM Programming & Development | 14 | March 3, 2019 04:17 |
problem with solving lagrange reaction cloud | Polli | OpenFOAM Running, Solving & CFD | 0 | April 30, 2014 08:53 |
[General] 2 datas on one plot | Akuji | ParaView | 46 | December 1, 2013 15:06 |
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 | keepfit | ParaView | 60 | September 18, 2013 04:23 |