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

Accessing the position and diameter of lagrangian particles

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2014, 09:35
Default Accessing the position and diameter of lagrangian particles
  #1
New Member
 
Ah Cai
Join Date: Dec 2010
Location: Malaysia
Posts: 16
Rep Power: 15
ahcai007 is on a distinguished road
Hi all,

I am working on a code to track lagrangian particles by refering to Jelena Andric's work:
http://www.tfd.chalmers.se/~hani/kur...dric_Final.pdf

I successfully replicated the work in OF20x.

My problem now is that I am unable to access the position and diameter of the particles. I know that there is a function in particle.H to access position but I don't know how to tap into it and get access it.

I tried
Code:
    const particle& par = particle.Foam::particle::position();
but it didn't work.

Anyone have any idea how to output the diameter and positions of all the particles inside the domain??

Thanks.

Regards,
Ahcai
ahcai007 is offline   Reply With Quote

Old   March 25, 2014, 17:42
Default
  #2
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
Quote:
Originally Posted by ahcai007 View Post
Hi all,

I am working on a code to track lagrangian particles by refering to Jelena Andric's work:
http://www.tfd.chalmers.se/~hani/kur...dric_Final.pdf

I successfully replicated the work in OF20x.

My problem now is that I am unable to access the position and diameter of the particles. I know that there is a function in particle.H to access position but I don't know how to tap into it and get access it.

I tried
Code:
    const particle& par = particle.Foam::particle::position();
but it didn't work.

Anyone have any idea how to output the diameter and positions of all the particles inside the domain??

Thanks.

Regards,
Ahcai
No offence Ahcai, but it seems that you're currently in the CargoCultProgramming-phase. I won't comment on the details of your code. I'd strongly suggest that you get an introductory C++-text and figure out why this doesn't work on so many level. Also familiarize yourself with Doxygen to find yourself with OF-classes

Concerning output of diameters and positions: these are usually written at every regular output in a folder lagrangian inside the timestep. So no need to reinvent the wheel there.
__________________
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   March 26, 2014, 08:35
Default
  #3
New Member
 
Ah Cai
Join Date: Dec 2010
Location: Malaysia
Posts: 16
Rep Power: 15
ahcai007 is on a distinguished road
Quote:
Originally Posted by gschaider View Post
No offence Ahcai, but it seems that you're currently in the CargoCultProgramming-phase. I won't comment on the details of your code. I'd strongly suggest that you get an introductory C++-text and figure out why this doesn't work on so many level. Also familiarize yourself with Doxygen to find yourself with OF-classes

Concerning output of diameters and positions: these are usually written at every regular output in a folder lagrangian inside the timestep. So no need to reinvent the wheel there.
Hi Bernhard,

Thanks for your advice. Frankly speaking, indeed I am in this phase and struggling to get out of it. I only started using OpenFOAM for a year and have been self-studying it up till now. Same goes for C++. I have an overall picture of the working of C++ (although still not an expert), I have understood the working of class, how to access them and so on... However, I am still unable to link the knowledge of C++ to OpenFOAM. To me, they are similar yet different at the same time. Any advice on how to link them to a novice in OpenFOAM?

As for the diameter and position, I am aware that the they are output (including the velocity of particles) in the lagrangian folder at each timestep. However, I still can't find a way to access them. The reason for accessing them is so that I can do some additional calculation on them before they are output.

Any advice on how to get them out?

Thanks~
ahcai007 is offline   Reply With Quote

Old   March 31, 2014, 19:22
Default
  #4
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
Quote:
Originally Posted by ahcai007 View Post
Hi Bernhard,

Thanks for your advice. Frankly speaking, indeed I am in this phase and struggling to get out of it. I only started using OpenFOAM for a year and have been self-studying it up till now. Same goes for C++. I have an overall picture of the working of C++ (although still not an expert), I have understood the working of class, how to access them and so on... However, I am still unable to link the knowledge of C++ to OpenFOAM. To me, they are similar yet different at the same time. Any advice on how to link them to a novice in OpenFOAM?
Not really. Most of the time I think "which utility does something similar". Then I check the sources of that utility. Check the Doxygen. And then a picture starts to emerge.

Quote:
Originally Posted by ahcai007 View Post
As for the diameter and position, I am aware that the they are output (including the velocity of particles) in the lagrangian folder at each timestep. However, I still can't find a way to access them. The reason for accessing them is so that I can do some additional calculation on them before they are output.

Any advice on how to get them out?
If the info that is written to disk is sufficient for your calculation then it might be easier to write a script that reads those text files from disk and does the calculation.

Another possibility might be the new particle-parser in swak4Foam (shown in this presentation http://openfoamwiki.net/staticPages/...tml#/sec-2-1-4 ) but its hard to tell if that might work without knowing what you want to calculate

Other than that the codes in $FOAM_SRC/lagrangian/intermediate/submodels/CloudFunctionObjects/ might give you an idea how to get particle info out of a cloud
__________________
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

Reply

Tags
diameter, lagrangian particle, position


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 material particles bramv101 STAR-CCM+ 5 October 23, 2017 05:27
foamToVTK not working on lagrangian particles BigBlueDart OpenFOAM Post-Processing 1 July 25, 2013 03:26
Histogram on a selected volume, Droplet diameter profile crevoise STAR-CCM+ 0 May 17, 2013 06:12
Straight through cyclone with particles rogerhoffmann CFX 1 May 21, 2012 18:42
Lagrangian particles (change density and diameter) kel85uk OpenFOAM 1 July 22, 2011 04:01


All times are GMT -4. The time now is 06:32.