CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Lagrangian particloe Tracking and getting values back (

Bruce Hartley December 2, 2011 00:41

Lagrangian particloe Tracking and getting values back
I am trying to trace particles with a modifed program which uses the standard particle Cloud definitions. In my program which is simply modified from the standard Lagrangian solvers I have the expression


I want to access the particle's 'position' following that move so that I can do some extra calculation involving it and to store a std::vector of these positions. I may later want to get other information such as velocity too.
I define the variable 'particles' as
passiveParticleCloud parrticles(mesh);
which conforms with hte satndard definitions fo particle clouds.

How can I access the position an other information from these Lagrangian solvers and particle clouds?

The next statement is particles.write(), which writes all the lagrangian defaulat cloud data so the information is there, but how to access it?

Bruce Hartley December 7, 2011 00:00

Lagrangian Tracking of particles
I found out how to do this. The passive particle Cloud is a C++ list of somne kind. You need to define an iterator to the list.

passiveParticleCloud particles(mesh);
passiveParticleCloud::iterator iter = particles.begin();


Foam::vector Possy = iter().position();
Foam::vector Velocy = iter().U();
Foam::vector Diam = iter().d();

step through by incrementing iter


easy once you have spent hours on it.

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