CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Sampling lagrangian data

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree10Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 12, 2016, 22:48
Default
  #21
Member
 
Ping Chang
Join Date: Feb 2016
Location: Perth
Posts: 93
Rep Power: 10
chpjz0391 is on a distinguished road
Quote:
Originally Posted by Subhasree View Post
Hi Everyone!

I am using icoLagrangianFoam solver of foam extend 3.1 in which I have used patch injection method to insert particles over an object. I need to calculate the number of particles getting deposited on the object surface.

Can I use function lib in controlDict file for this?
have you found the solution for your question?

I need to count the particle numbers in a specified area?

Do you have any hints?
chpjz0391 is offline   Reply With Quote

Old   October 23, 2017, 08:49
Default
  #22
New Member
 
Sandip Wadekar
Join Date: Oct 2014
Posts: 17
Rep Power: 11
wadekar is on a distinguished road
Hello Foamer

I am struggling with lagrangian data sampling for sprayFoam, OF2.2.x version.
Basically, i want to evaluate size distribution. So want to calculate particle diameter and velocity during run time.

can someone guide me about the easiest way to do that....?

Thanks
wadekar is offline   Reply With Quote

Old   October 23, 2017, 10:40
Default
  #23
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 wadekar View Post
Hello Foamer

I am struggling with lagrangian data sampling for sprayFoam, OF2.2.x version.
Basically, i want to evaluate size distribution. So want to calculate particle diameter and velocity during run time.

can someone guide me about the easiest way to do that....?

Thanks
In my world (which, some people say, is a strange and rather self-centered world) the easiest and most flexible way would be swak4Foam. Look for instance at this file from the examples https://sourceforge.net/p/openfoam-e...em/controlDict (function object "coalDiameter"). With a "swakExpressionDistribution" you could even calculate proper distributions
__________________
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   January 11, 2018, 11:19
Default
  #24
Senior Member
 
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10
foamiste is on a distinguished road
Quote:
Originally Posted by Tariq Ahmed View Post
Hi,
I am experiencing the same kind of problem in sprayFOAM solver. I want to sample droplet velocity and droplet diameter so I can postprocess in Matlab but I cant seem to find how to sample the lagrangian data since sample cmd works only for eularian phase.

Also I cant seem to find 'kinematicCloud1.dumpParticlePositions()' in KinematicCloud.C file. Any help would be really appreciated

Tariq
Hello Tariq,

Did you solve this problem? because I have the same now and I don't know what to do.

Asmaa
foamiste is offline   Reply With Quote

Old   January 11, 2018, 16:03
Default
  #25
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 foamiste View Post
Hello Tariq,

Did you solve this problem? because I have the same now and I don't know what to do.

Asmaa
Format of the particle data is rather simple: in the lagrangian-folder each property has a file where the values for all particles are stored. Writing a script that strips away the start and the end should generate a file that is easily read by MATLAB

I did something like this in PyFoam. See slide 148ff in
https://openfoamwiki.net/images/0/05...ForTheLazy.pdf
(to fully appreciate it a little knowledge of Pandas would be good)
__________________
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   January 11, 2018, 16:23
Arrow
  #26
Senior Member
 
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10
foamiste is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Format of the particle data is rather simple: in the lagrangian-folder each property has a file where the values for all particles are stored. Writing a script that strips away the start and the end should generate a file that is easily read by MATLAB

I did something like this in PyFoam. See slide 148ff in
https://openfoamwiki.net/images/0/05...ForTheLazy.pdf
(to fully appreciate it a little knowledge of Pandas would be good)

Thank you very much for your quick reply, the presentation is very usefull and respond to a big part of what I need actually!!

But in the other hand I need to extract particles that coincide with a circular surface defined by vector axis and radius and then treat those clouds.

Do you have an idea how I can achieve this?

Regards,
Asmaa
foamiste is offline   Reply With Quote

Old   January 11, 2018, 18:45
Default
  #27
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 foamiste View Post
Thank you very much for your quick reply, the presentation is very usefull and respond to a big part of what I need actually!!

But in the other hand I need to extract particles that coincide with a circular surface defined by vector axis and radius and then treat those clouds.

Do you have an idea how I can achieve this?
That is in post-processing I assume? You want to look at the particles inside/outside/on a cylinder-surface. You've got the particle positions in the data. So a little calculation (distance of the particle from the axis) should give you a criterion to select the particles that you want and drop the rest
__________________
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   January 12, 2018, 06:13
Default
  #28
Senior Member
 
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10
foamiste is on a distinguished road
Quote:
Originally Posted by gschaider View Post
That is in post-processing I assume? You want to look at the particles inside/outside/on a cylinder-surface. You've got the particle positions in the data. So a little calculation (distance of the particle from the axis) should give you a criterion to select the particles that you want and drop the rest
Hello,

Thanks for your reply! yes it is post processing. I want to calculate the sauter mean diameter of particles that coincide with the surface below.
Actually I am doing it manually using paraview, by clipping 2 cylinders then slice a plane and extract .csv file than calculate the SMD (SMD=sum(d^3)/sum(d^2)). And I have to vary the radius of cylinders at every sampling. So, I find it really painful that's why I am looking for an automatic way to do it.

Any hints will be appreciated!
Thanks
Asmaa
Attached Images
File Type: png surface.png (58.1 KB, 62 views)
foamiste is offline   Reply With Quote

Old   January 12, 2018, 08:34
Default
  #29
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 foamiste View Post
Hello,

Thanks for your reply! yes it is post processing. I want to calculate the sauter mean diameter of particles that coincide with the surface below.
Actually I am doing it manually using paraview, by clipping 2 cylinders then slice a plane and extract .csv file than calculate the SMD (SMD=sum(d^3)/sum(d^2)). And I have to vary the radius of cylinders at every sampling. So, I find it really painful that's why I am looking for an automatic way to do it.

Any hints will be appreciated!
Thanks
Asmaa
That shouldn't be to hard. You could add field dist to the dataframe similary to what I do in the presentation with distCenter. Then something like
Code:
(data["dist"] **3).sum()/(data["dist"]**2).sum()
would calculate that.

Reading the particle positions might be problematic with OF 5.0 and v1712 as in those versions the meaning of the positions-file changed.
__________________
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   January 12, 2018, 09:48
Default
  #30
Senior Member
 
Asmaa
Join Date: Mar 2016
Posts: 102
Rep Power: 10
foamiste is on a distinguished road
Thanks for your prompt responses,
[QUOTE=gschaider;677857]
Code:
(data["dist"] **3).sum()/(data["dist"]**2).sum()
Yes you're right it is just a command to execute but the problem is how to extract this surface.
Concerning the output of the cloud positions I don't know how it is built because it contains more than 3 components!!
For exemple: (0 0.02311223035 0.01947409306 0.9574136766) 638 96587 1

Actually I am looking in the samplingSurface and cutting plane to see if I can get something through it!

Asmaa
foamiste is offline   Reply With Quote

Old   April 15, 2018, 14:08
Default
  #31
New Member
 
Syed Ashruf
Join Date: Nov 2012
Location: Chennai, India
Posts: 11
Rep Power: 13
ashrufsyed is on a distinguished road
I too have similar issue! Below is a sample 'positions' output

(0.212065 0.0952962 0.536003 0.156636) 376063 1199337 1
(0.0683043 0.384839 0.287326 0.25953) 415092 1305086 2

Not able to understand what is the data (with four components + three numbers thereafter) that OF is trying to dump in the time directory.

In my case the file location is time_dir/lagrangian/reactingCloud1/positions

Other files like d, U, T etc in the same directory ( time_dir/lagrangian/reactingCloud1/ ) seems to be in typical format and understandable except the 'positions' file.
ashrufsyed is offline   Reply With Quote

Old   April 15, 2018, 17:27
Default
  #32
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,980
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick'ish question: I received a private message (PM) from ashrufsyed and I came to take a quick look into this... I've learned from the PM that OpenFOAM-dev is being used... But the problem here is that I'm not familiar with how exactly people are retrieving these position files. @ashrufsyed and/or @foamiste: Please provide instructions on which tutorial case I can look into, so that I can check what's going on here?

Because my guess is that the 1st value is a time value for the particle, but it's just a guess based on other cases. The problem is what time exactly is that.
ashrufsyed likes this.
__________________
wyldckat is offline   Reply With Quote

Old   April 17, 2018, 03:58
Default
  #33
New Member
 
Syed Ashruf
Join Date: Nov 2012
Location: Chennai, India
Posts: 11
Rep Power: 13
ashrufsyed is on a distinguished road
Thanks @wyldckat for taking time to have a look at the thread!

I am using fireFoam solver (Version 17.07.24) from the github with the OF-dev (commit 1ff578)
For a sample case, you can have a look at the detailedSprinklerInjection case from the github.

The 'positions' file is saved in the location time_dir/lagrangian/reactingCloud1/

Regarding the first value, I don't think it correspond to time, because the sample output I posted was for 30s. Also all the four components I get are positive ( at least in my case) whereas my droplet positions actually should have negative x and y values as well
ashrufsyed is offline   Reply With Quote

Old   April 17, 2018, 04:03
Default
  #34
New Member
 
Syed Ashruf
Join Date: Nov 2012
Location: Chennai, India
Posts: 11
Rep Power: 13
ashrufsyed is on a distinguished road
Quote:
Reading the particle positions might be problematic with OF 5.0 and v1712 as in those versions the meaning of the positions-file changed
Does that mean the 'positions' output doesn't correspond to the droplet/particle coordinates? If so, what do those four components mean?
ashrufsyed is offline   Reply With Quote

Old   April 17, 2018, 05:11
Default
  #35
New Member
 
Syed Ashruf
Join Date: Nov 2012
Location: Chennai, India
Posts: 11
Rep Power: 13
ashrufsyed is on a distinguished road
Quote:
Originally Posted by gschaider View Post
That shouldn't be to hard. You could add field dist to the dataframe similary to what I do in the presentation with distCenter. Then something like
Code:
(data["dist"] **3).sum()/(data["dist"]**2).sum()
would calculate that.

Reading the particle positions might be problematic with OF 5.0 and v1712 as in those versions the meaning of the positions-file changed.
This reply from gschaider gave me a hint to explore the way particle tracking was changed starting from v5.0. From the release notes, it is clear that OF now uses a local barycentric coordinates for tracking particles (including lagrangian solver and for creating streamlines etc.,). Also this thread further suggests that the 'positions' file is indeed written in barycentric format.

So the question now will be how can we convert these local barycentric coordinates into the global cartesian system?

Since the thread suggests that position() variable during the Cloud calculation gives the actual global coordinates, is it possible to get it directly from the OF I/O file itself (in the form an output file) ?
__________________
Thanks

Ashruf
ashrufsyed is offline   Reply With Quote

Old   April 17, 2018, 19:35
Default
  #36
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,980
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer:
  1. It's not straight forward to get an IO file generated by OpenFOAM with the X,Y,Z coordinates of the particles. It's not impossible, but it is necessary to do some coding.
  2. In order to not have to code, then there are two possibilities:
    1. Use foamToVTK, for exporting the data to VTK format... then use ParaView to do the export to CSV or something else...
    2. Use the following block inside the case file "system/controlDict":
      Code:
      DebugSwitches
      {
          kinematicCloud 1;
      }
      Then run the case as you usually do. This was meant to create an OBJ (wavefront format) file inside each time folder, but for me it would only overwrite the file "kinematicCloud_positions.obj" inside the root folder of the case. I tested this with 5.x, but not with OpenFOAM-dev.
      • If you want to use this option, please open a report at https://bugs.openfoam.org with the instructions on how to reproduce this issue with one of OpenFOAM's tutorial cases... I can't do it myself now, because I don't have enough time to answer to you and report the bug
  3. If you don't mind coding, then look into calling the method 'writePositions()': https://github.com/OpenFOAM/OpenFOAM...d/Cloud.C#L429
wyldckat is offline   Reply With Quote

Old   June 7, 2020, 15:29
Default
  #37
Member
 
Jairo A. Gutiérrez S
Join Date: Nov 2014
Posts: 60
Rep Power: 11
jairoandres is on a distinguished road
I've just gotten through all the posts as I have to do something similar. I need to determine particle properties (mass, d, nParcels, velocity) in different positions inside the domain. Don't you think it might be easier to modify the particleCollector.C file to write other properties of the parcels being collected? I am not a very good programmer but if the parcels going through the polygon can be "collected" and removed from the simulation, you can also print to a file some properties of those parcels.
jairoandres is offline   Reply With Quote

Old   June 26, 2020, 10:09
Default
  #38
Senior Member
 
Join Date: Jun 2020
Posts: 100
Rep Power: 6
atul1018 is on a distinguished road
Hello Bernhard,


I am trying to plot Lagrangian data (particle velocity along a line at a particular time) and I came across your answer regarding sampling Lagrangian data. In your answer you mentioned the following:



1. start paraFoam
2. load the lagrangian data in addition to the "regular" data
3. "Split off" the lagrangian data using the "Extract Block"-filter
4. Open a new view on the result and make that view a "Spreadsheet view". In that view you will see the raw lagrangian data
5. File->Export that view to a CSV-file


I am able to extract kinematicloud but I am not able to open a new view over that and get the data (step 4). can you please explain a bit more step 4 (may be some screenshots from paraview)?


I will be grateful if you or someone can help me to get the particle velocity data along a line.


Best Regards
Atul Jaiswal
atul1018 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
"Data sampling for Time Statistics" Madhukar Rapaka FLUENT 2 June 20, 2011 11:28
help reqd. :DATA SAMPLING FOR TIME STATISTIC haris FLUENT 0 April 16, 2008 07:57
Sampling of statistical data Boerge Main CFD Forum 0 July 25, 2006 04:40
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 17:27
Data sampling for time statistics with RANS Flav FLUENT 0 June 6, 2001 04:32


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