hi, i am working on a new c
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.
hi, maybe my question was n
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
Which pointer exactly would yo
Which pointer exactly would you like? A Cloud stores the particles in a doubly-linked list, so getting access of the sort:
will still cost you a sweep through the container.
I think you should re-consider your algorithm or implementation.
hi, thanks for your fast an
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
If your iterator is this sp
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())
parcel& p = pIter();
And the rest you can probably work out for yourself.
hi, thanks for the help! j
thanks for the help!
just in time i found pretty much the same as you mentioned:
but still:thanks for helping me!!
hi, I need a module for partic
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.
Yup, I've written a small exam
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.
Hi Nicoleta! I posted such
I posted such a thing some time ago to the Wiki:
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
Hi, How can I print out the
How can I print out the trajectory of a given
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??!
hi ville, try "parcelNN().p
try "parcelNN().position().x()" instead - this should work.
Hi, thanks for the answer! Th
thanks for the answer! The answer above works.
However, if I declare a reference to a parcel
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
hi, Q1: give the parcel
Q1: give the parcel a label and use an if-statement to checkout the right parcel.
p.s. there is already a lagrangian class which labels a particle - but it is easy to do ..
Hi, I've been doing a lot of
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
2) in the constructor in parcel.C
set m_nID = m_nNextID; and then
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 ?
Hi, good news since yesterday
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 http://www.cfd-online.com/OpenFOAM_D...part/happy.gif !
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;
//forAllIter(spray, dieselSpray, iter)
spray::iterator iter = (dieselSpray).begin();
iter != (dieselSpray).end();
vector vec=dieselSpray.UInterpolator().interpolate(p.posi tion(), p.cell())
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;
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 :
object is not allocated#0 Foam::error::printStack(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>::operator()() const
in file /home/john/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/autoPtrI.H at line 133.
I don't know where is my mistake.
I will be glad If someone help me.
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.
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.
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
|All times are GMT -4. The time now is 14:42.|