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

Lagrangian Particle Tracking

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 7, 2006, 08:15
Default hi, i am working on a new c
  #1
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17
stephan is on a distinguished road
hi,

i am working on a new collisionmodel for the euler/lagrangian model.
the class spray works like a container-class for the particles but is there a way to get real pointers instead of iterators to get access to special particles in the class spray?
til now i am skipping through the field like that:
spray::iterator iteratorname = spray.begin() ...
but i need pointers for the particles which are already included in the container.it would be very nice if somebody could help me with that problem.
stephan
stephan is offline   Reply With Quote

Old   January 7, 2006, 10:44
Default hi, maybe my question was n
  #2
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17
stephan is on a distinguished road
hi,

maybe my question was not clearly formulated:
what i am looking for is a opportunity to access a
particle with an index like spray[number] or direct with a pointer.
thanks in advance
stephan
stephan is offline   Reply With Quote

Old   January 7, 2006, 17:22
Default Which pointer exactly would yo
  #3
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Which pointer exactly would you like? A Cloud stores the particles in a doubly-linked list, so getting access of the sort:

spray[number]

will still cost you a sweep through the container.

I think you should re-consider your algorithm or implementation.

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   January 8, 2006, 08:34
Default hi, thanks for your fast an
  #4
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17
stephan is on a distinguished road
hi,

thanks for your fast answer. actually i wasnt sure what kind of list it is...
i will have to sweep through the container anyway once per timestep to create my own list. i created a kind of "local search area" for the collision-detection and therefore i need pointers to the particles, since the order in the original list has nothing to do with the place where the partice really is. so i want to avoid sweeping through the whole list more than once and searching instead in a smaller "local list" - which needs therefore some kind of index,pointer or reference to the "local particles".
so sweeping once per timestep the whole list from start to end is necessary to findout where the particles are but while checking this, i want to take a pointer to the particle and put into my own "local list".
so i think a pointer to a particle (particle*) would be the right one. but i just dont know how to get this from the iterator.
thanks in advance
stephan
stephan is offline   Reply With Quote

Old   January 9, 2006, 03:39
Default If your iterator is this sp
  #5
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29
niklas will become famous soon enoughniklas will become famous soon enough
If your iterator is this

spray::iterator pIter = spray.begin();

you access the element by ()
and since they are parcels pIter() will be a parcel.
To get a 'pointer' or a reference to the parcel is done like this
parcel *p = &(pIter())
or
parcel& p = pIter();

And the rest you can probably work out for yourself.

N
niklas is offline   Reply With Quote

Old   January 9, 2006, 09:29
Default hi, thanks for the help! j
  #6
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17
stephan is on a distinguished road
hi,

thanks for the help!
just in time i found pretty much the same as you mentioned:
parcel* p=&(*pIter);
but still:thanks for helping me!!
stephan
stephan is offline   Reply With Quote

Old   March 17, 2006, 09:10
Default hi, I need a module for partic
  #7
scurtu
Guest
 
Posts: n/a
hi, I need a module for particle tracking in an isothermal turbulent fluid flow. Is somebody who developed an OpenFOAM module for such a problem?
I would be thankfully if somebody can help me.

DNS
  Reply With Quote

Old   March 18, 2006, 06:52
Default Yup, I've written a small exam
  #8
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Yup, I've written a small example a while back, doing the tracking of massless particles in an incompressible flow. It was hooked up on icoFoam, but moving it to a turbulent solver would be very easy.

Give me a shout if you want a look and I'll try to revive it.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   March 20, 2006, 05:21
Default Hi Nicoleta! I posted such
  #9
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Nicoleta!

I posted such a thing some time ago to the Wiki:

http://openfoamwiki.net/index.php/Contrib_icoLagr angianFoam

It's not a "addWaterAndStirr" kind of thing but it can serve as an example how to add Lagrange particles (using the facilities that are already present in OF) to a solver of your choice (the physics (drag term, particle mass, injection etc) should be adapted to your problem).

PS: But if you can get a solver from Hrv: take it
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   September 24, 2008, 13:43
Default Hi, How can I print out the
  #10
Member
 
ville vuorinen
Join Date: Mar 2009
Posts: 67
Rep Power: 17
ville is on a distinguished road
Hi,

How can I print out the trajectory of a given
parcel?

To be more precise: I know how to print to a file
in parallel but I would need to define a reference
to K parcels and on every time step I would like to sweep those parcels and print their coordinates to the processor directories. I tried defining references to two parcels, p1 and p2 and then to print the parcels that are 'between' those two in the spray cloud. However, there was a problem even doing the following at top-level:

spray::const_iterator parcelNN = dieselSpray.begin();

const parcel *p = &(parcelNN());

Info << p.position().x() << "\n" << endl;

What goes wrong here??!

Thanks!

-Ville
ville is offline   Reply With Quote

Old   September 24, 2008, 14:35
Default hi ville, try "parcelNN().p
  #11
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17
stephan is on a distinguished road
hi ville,

try "parcelNN().position().x()" instead - this should work.

regards
stephan
stephan is offline   Reply With Quote

Old   September 25, 2008, 06:00
Default Hi, thanks for the answer! Th
  #12
Member
 
ville vuorinen
Join Date: Mar 2009
Posts: 67
Rep Power: 17
ville is on a distinguished road
Hi,
thanks for the answer! The answer above works.
However, if I declare a reference to a parcel
such as

spray::const_iterator parcelNN = dieselSpray.begin();

const parcel* p1;

p1 = &(parcelNN());

the . referencing wont work but
one has to state e.g. p1->position().z()
to refer to the z coordinate.

Q1: There comes a problem in parallel if
a certain parcel is to be tracked since it
seems that e.g. dieselSpray.begin() refers to the
"first" parcel on a certain processor. Thus if
I initially decide I want to follow a parcel
that is the 'first' on processor0
and it goes to processor1 then I loose the parcel.
Is there a way to keep a reference globally to a certain
parcel (keeping in mind that I'd like to print
out the trajectory of a certain droplet)?

Q2: Or is it maybe the simplest to just tag
the parcels according to the order they are injected and then just print the coordinates
for parcels that have a label, say, in between
1000...1020 ?

Thanks!
-Ville
ville is offline   Reply With Quote

Old   September 25, 2008, 07:29
Default hi, Q1: give the parcel
  #13
Senior Member
 
Stephan Gerber
Join Date: Mar 2009
Location: Germany
Posts: 118
Rep Power: 17
stephan is on a distinguished road
hi,



Q1: give the parcel a label and use an if-statement to checkout the right parcel.

regards
stephan
p.s. there is already a lagrangian class which labels a particle - but it is easy to do ..
stephan is offline   Reply With Quote

Old   October 20, 2008, 11:36
Default Hi, I've been doing a lot of
  #14
Member
 
ville vuorinen
Join Date: Mar 2009
Posts: 67
Rep Power: 17
ville is on a distinguished road
Hi,
I've been doing a lot of other stuff lately but now back to finding out how would I print the particle trajectories in a parallel simulation..

In single proc run labeling the parcels works as follows:

1) in parcel.H declare two variables:

static label m_nNextID
label m_nID;

2) in the constructor in parcel.C
set m_nID = m_nNextID; and then

increment
m_nNextID by 1 this labels parcels
from 0 ... X in the order they are introduced
(if mnNextID is initialized to zero)

3) defining a function GetID in parcel.C
to return m_nID; completes the labeling
and now we can be happy and print the
parcel coordinates and labels to see the
paths of the particles



4) but how sad! in parallel this doesn not
work anymore! Or it works as long as the
particles stay on proc0 but when they go to
proc1 the parcel label is lost and it
turns to something irrelevant !! Could anyone
give me any hint
why this is so and what should be done differently
or what changes should be done in order to
make the parcel label to be copied
to the new processor ?

Regards,
-Ville
ville is offline   Reply With Quote

Old   October 21, 2008, 11:17
Default Hi, good news since yesterday
  #15
Member
 
ville vuorinen
Join Date: Mar 2009
Posts: 67
Rep Power: 17
ville is on a distinguished road
Hi,
good news since yesterday. The parallel problems
probably arised (regarding labeling of the parcels)
because the parcelIO-files were not modified.
That's why the parcel label did not get copied
from proc0 to proc1 etc.

I suppose a fast way to go around this problem
is to simply create a copy of the dieselSpray class
for personal use and then to start modifying the class. Then, as I am interested in non evaporating
sprays without parcel deformation it's possible
to borrow e.g. the variable ddev from the parcel class and to update ddev to get the label of the parcel in the constructor with the running number using the variable m_nID (as described above).

HOWEVER, it's important to note that this does
not work if one uses e.g. the ETAB breakup
model. So the above way-around applies only if
ddev is not needed elsewhere.


If anyone has a better, more elegant way of doing
this please yell !

Regards,
Ville

parcel class.
ville is offline   Reply With Quote

Old   September 4, 2009, 11:31
Default droplet position
  #16
Member
 
amin
Join Date: May 2009
Posts: 62
Rep Power: 17
az1362f is on a distinguished road
Hi

I tried to write position and relative velocity of each parcel after evolving spray by adding these line to the main solver(dieselfoam.C)

Info << "Evolving Spray" << endl;

dieselSpray.evolve();
//forAllIter(spray, dieselSpray, iter)

for

(

spray::iterator iter = (dieselSpray).begin();

iter != (dieselSpray).end();

++iter

)

{

parcel& p=iter();


vector vec=dieselSpray.UInterpolator().interpolate(p.posi tion(), p.cell())

+ p.Uturb();

scalar x= p.position().x();

scalar y= p.position().y();

scalar z= p.position().z();

scalar vrelx= p.Urel(vec).x();

scalar vrely= p.Urel(vec).y();

scalar vrelz= p.Urel(vec).z();

rel<<x<<" "<<y<<" "<<z<<" "<<vrelx<<" "<<vrely<<" "<<vrelz<< nl;

rel.close();
}
/////////////////////////////////////////////////////////////////////////////////////////
Info << "Solving chemistry" << endl;


and I compiled solver without any errors but when I tried to run dieselfoam application I face an error like this :

Evolving Spray


object is not allocated#0 Foam::error:rintStack(Foam::Ostream&) in "/home/john/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/john/OpenFOAM/OpenFOAM-1.6/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 main in "/home/john /OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/dieselFoam"
#3 __libc_start_main in "/lib/libc.so.6"
#4 Foam::regIOobject::writeObject(Foam::IOstream::str eamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType) const in "/home/john/OpenFOAM/OpenFOAM-1.6/applications/bin/linuxGccDPOpt/dieselFoam"


From function const T& autoPtr<T>:perator()() const
in file /home/john/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/autoPtrI.H at line 133.

FOAM aborting

Aborted
john@spray:~/OpenFOAM/john-1.6/run/tutorials/combustion/dieselFoam/New>

I don't know where is my mistake.
I will be glad If someone help me.
az1362f is offline   Reply With Quote

Old   September 9, 2009, 19:28
Default
  #17
Senior Member
 
su_junwei's Avatar
 
su junwei
Join Date: Mar 2009
Location: Xi'an China
Posts: 151
Rep Power: 20
su_junwei is on a distinguished road
Send a message via MSN to su_junwei
It seems that you use a autoPtr object that was not allocated or it has been released.

For instance, you pass a autoPtr object to other object or use it as a parameter will cause such a problem.

Junwei
su_junwei is offline   Reply With Quote

Old   October 6, 2009, 06:00
Default
  #18
Senior Member
 
Prapanch Nair
Join Date: Mar 2009
Location: Bangalore, India
Posts: 105
Rep Power: 17
prapanj is on a distinguished road
Hi Hrv,

Could you send me the example for particle track post processing based on icoFoam that you have mentioned in this thread? It will be of great help to me.
Thank you

Prapanj
prapanj is offline   Reply With Quote

Old   March 6, 2010, 10:41
Default Multiphse flow
  #19
New Member
 
IZUNNA DAVID
Join Date: Mar 2010
Location: NEWCASTLE
Posts: 2
Rep Power: 0
Izunna is on a distinguished road
Can anyone tell me how to use langragian particle tracking algorithm in Matlab. I am working on particle deposition but can not continue because i do not know how to do particle tracking in multiphase flow
Izunna 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
Lagrangian Particle Tracking model In CFX Kushagra CFX 8 December 2, 2010 22:18
VOF Lagrangian Interface Tracking Kam CFX 3 November 5, 2008 19:08
Lagrangian Tracking niklas OpenFOAM Running, Solving & CFD 0 March 27, 2007 08:36
Lagrangian particle tracking worth Siemens 1 October 19, 2004 04:10
Convergence of Eulerian-Lagrangian part. tracking Sven FLUENT 4 July 30, 2004 06:34


All times are GMT -4. The time now is 09:40.