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

Lagrangian particle position data at runtime

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 22, 2017, 03:37
Question Lagrangian particle position data at runtime
  #1
Member
 
Vishwesh Ravi Shrimali
Join Date: Aug 2017
Posts: 43
Rep Power: 9
vishwesh is on a distinguished road
Hi!

I am making a solver which has a section where the following process needs to be carried out:
  • An earlier recognized Lagrangian particle's position is written to kinematic cloud positions file
  • A new Lagrangian particle, if any, is added to the kinematicCloud positions file

Now, I can carry out the second part of it. I know from some research that it is possible to obtain the particles' information (positions in my case). I am trying out the following code:

Code:
            const kinematicCloud & a = obr_.lookupObject<kinematicCloud> ("kinematicCloud");
            basicKinematicCloud * q = (basicKinematicCloud*) &a;
            forAllIter(basicKinematicCloud, *q, pIter)
            {

                Pout<<"particle position: "<<pIter.positions()<<endl;
            }
I am using kinematicCloud for the cloud. My cloud's name is kinematicCloud. The above snippet of code is not even compiling and is giving the following error:

Quote:
/bin/sh: /share/OpenFOAM/OpenFOAM-3.0.x/wmake/platforms/linux64Gcc/wmkdep: No such file or directory
g++ -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=64 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I/share/OpenFOAM/OpenFOAM-3.0.x/src/transportModels/twoPhaseMixture/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/transportModels -I/share/OpenFOAM/OpenFOAM-3.0.x/src/transportModels/incompressible/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/transportModels/interfaceProperties/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/TurbulenceModels/turbulenceModels/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/TurbulenceModels/incompressible/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/finiteVolume/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/fvOptions/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/meshTools/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/sampling/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude -I../../lagrangian/basic/lnInclude -I../../lagrangian/intermediate/lnInclude -I../../lagrangian/distributionModels/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/regionModels/regionModel/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/regionModels/surfaceFilmModels/lnInclude -IlnInclude -I. -I/share/OpenFOAM/OpenFOAM-3.0.x/src/OpenFOAM/lnInclude -I/share/OpenFOAM/OpenFOAM-3.0.x/src/OSspecific/POSIX/lnInclude -fPIC -c myInterFoam_noSOI_testREV.C -o Make/linux64GccDPInt64Opt/myInterFoam_noSOI_testREV.o
myInterFoam_noSOI_testREV.C:60:31: error: kinematicParticle.H: No such file or directory
myInterFoam_noSOI_testREV.C: In function ‘int main(int, char**)’:
myInterFoam_noSOI_testREV.C:438: error: expected initializer before ‘&’ token
myInterFoam_noSOI_testREV.C:439: error: ‘a’ was not declared in this scope
myInterFoam_noSOI_testREV.C:439: warning: use of old-style cast
myInterFoam_noSOI_testREV.C:443: error: ‘class Foam::UILList<Foam::DLListBase, Foam::KinematicParcel<Foam::particle> >::iterator’ has no member named ‘positions’
make: *** [Make/linux64GccDPInt64Opt/myInterFoam_noSOI_testREV.o] Error 1
I have included the following header files for cloud:

Code:
#include "basicKinematicCloud.H"
#include "particle.H" // for tracking particle position
I will be very grateful if someone could help me out with this.

Thanks

Vishwesh
vishwesh is offline   Reply With Quote

Old   September 22, 2017, 10:41
Default
  #2
New Member
 
Join Date: Aug 2017
Posts: 10
Rep Power: 9
schf is on a distinguished road
Hello Vishwesh,
did you found a solution?

I'm stuck with the same problem here...

for this code
Code:
const  kinematicCloud& a = obr_.lookupObject<kinematicCloud> ("kinematicCloud");
basicKinematicCloud * q = (basicKinematicCloud*) &a;
forAllIter(basicKinematicCloud, *q, pIter)
{
   Info << pIter().position() << endl;
}
I get this error:
Code:
myInterFoam.C: In Funktion »int main(int, char**)«:
myInterFoam.C:117:19: Fehler: »kinematicCloud« bezeichnet keinen Typ
             const kinematicCloud & a = obr_.lookupObject<kinematicCloud> ("kinematicCloud");
                   ^
myInterFoam.C:118:63: Fehler: »a« wurde in diesem Gültigkeitsbereich nicht definiert
             basicKinematicCloud * q = (basicKinematicCloud*) &a;
                                                               ^
myInterFoam.C:118:63: Warnung: Verwendung einer Typumwandlung im alten Stil [-Wold-style-cast]
myInterFoam.C:122:52: Fehler: »Foam::Cloud<Foam::KinematicParcel<Foam::particle> >::iterator« hat kein Element namens »positions«
                 Pout<<"particle position: "<<pIter.positions()<<endl;
so the problem seems to be with the 'kinematicCloud'. But do you have an idea what's wrong here?

Maybe it's due to the upper code because it's from openfoam 1.7. So maybe something changed in the syntax...
schf is offline   Reply With Quote

Old   September 22, 2017, 10:43
Default
  #3
Member
 
Vishwesh Ravi Shrimali
Join Date: Aug 2017
Posts: 43
Rep Power: 9
vishwesh is on a distinguished road
Hi

I am yet to find a solution for this. Let's see if someone else can help us out.
vishwesh is offline   Reply With Quote

Old   July 11, 2018, 10:48
Default
  #4
New Member
 
Stanislav Knotek
Join Date: Nov 2013
Location: Brno
Posts: 3
Rep Power: 13
Stanislav is on a distinguished road
Hi,

What about pIter.positions() vs pIter().position() ?
pIter().position() works to me.

Last edited by Stanislav; July 12, 2018 at 04:41.
Stanislav is offline   Reply With Quote

Reply

Tags
kinematiccloud, lagrangian particles, openfoam 3.0.x


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
particles leave domain Steffen595 CFX 9 March 7, 2016 17:19
Uniform inlet particle distribution without position file mayank.dce2k7 OpenFOAM Running, Solving & CFD 0 December 5, 2013 18:24
Particle Reynolds number calculation in Lagrangian tracking? jiejie OpenFOAM Running, Solving & CFD 5 July 6, 2012 05:47
how to know position of particle in PTK areriko CFX 0 November 19, 2007 22:19
how to output particle trajectory coordinate data steven CFX 0 July 13, 2006 18:49


All times are GMT -4. The time now is 13:29.