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

Sampling lagrangian data

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

Like Tree2Likes
  • 1 Post By gschaider
  • 1 Post By matejfor

Reply
 
LinkBack Thread Tools Display Modes
Old   March 30, 2009, 05:31
Default Sampling lagrangian data
  #1
Member
 
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 8
farbfilm is on a distinguished road
Hi,

I tried to sample lagrangian data from a simulation with dieselFoam with the sample utility (i.e. with a sampleDict-File). I defined a plane under the keyword 'surfaces' and wanted to sample the diameter of the particles, i.e. choose d under the keyword 'Fields to sample'! When I'm running the utility no date are written!!!

When I choose U instead of d everything works fine!! So, it seems that only the sampling of the lagrangian data doesn't work!!

Has anybody some hints???

Thanks, Michael
farbfilm is offline   Reply With Quote

Old   March 30, 2009, 08:34
Default
  #2
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 20
niklas will become famous soon enoughniklas will become famous soon enough
you have to write your own evaluation code if you want to do that kind of thing
niklas is offline   Reply With Quote

Old   March 31, 2009, 07:27
Default
  #3
Member
 
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 8
farbfilm is on a distinguished road
oh, well, I have no idea of doing something like that...

I'm wondering that nobody else has that problem! Or is there another/better way to sample the langrangian data like the droplet sizes??
farbfilm is offline   Reply With Quote

Old   April 7, 2009, 06:14
Default
  #4
Member
 
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 8
farbfilm is on a distinguished road
Doesn't anybody have a hint how to postprocess lagrangian data??
For example, one of my request is to get the data of the diameter of the droplets in a arbitrary plane! Then, I want this date to use in Matlab!!

I hope somebody can help me...

Thanks, Michael
farbfilm is offline   Reply With Quote

Old   April 7, 2009, 08:03
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Michael!

The "best" way to postprocess the raw lagrangian data WITHOUT PROGRAMMING is:

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

The CSV can be imported into most programs (OpenOffice-Calc, Origin and I guess also MATLAB)

Bernhard
mechem likes this.
gschaider is offline   Reply With Quote

Old   April 8, 2009, 09:48
Default
  #6
Member
 
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 8
farbfilm is on a distinguished road
Thank you, Bernhard!

That's definitely a way to do it!! For the moment that's fine! Thanks again!
But I think in the future, I'll don't get out of programming something when I'm dealing with lots of data!

So, if there is somebody who has a "more comfortable" solution (i.e. with programming) for that problem I would be still interested!!!

Michael
farbfilm is offline   Reply With Quote

Old   April 8, 2009, 17:53
Default
  #7
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by farbfilm View Post
But I think in the future, I'll don't get out of programming something when I'm dealing with lots of data!

So, if there is somebody who has a "more comfortable" solution (i.e. with programming) for that problem I would be still interested!!!
Best example how to read/filter/rewrite lagrangian data in C++ might still be mapLagrangianFields.C in the sources of the mapFields-utility.
For myself, if there is not too much data (some thousant particles without history data) I use the PyFoam-library to parse/process it. But I may be biased, because I'm on quite good speaking terms with the author so the lack of documentation for the programming interface isn't that big a problem for me

Bernhard
gschaider is offline   Reply With Quote

Old   April 9, 2009, 02:56
Default
  #8
Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 92
Rep Power: 8
matejfor is on a distinguished road
Hi,
I'm using KinematicParticle class for Lagrangian particles and there is even everything ready for you. The function is called dumpParticlePositions() and you may find it around line 500 in the file: src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C

Calling this function along with kinematicCloud1.evolve(); in your solver will give you
every time step one file with whatever you tell the function to print for all the particles in the coud.
I was actually post-processing these files in matlab 2 days ago...

good luck
matej
matejfor is offline   Reply With Quote

Old   April 9, 2009, 05:32
Default
  #9
Member
 
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 8
farbfilm is on a distinguished road
Hi,

using KinematicParticle sounds quite good!
Could you please give me some details of how to build this function in my solver and how to tell the function what quantities it should write??

Sorry for so many questions!

Thanks, Michael
farbfilm is offline   Reply With Quote

Old   April 9, 2009, 05:59
Default
  #10
Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 92
Rep Power: 8
matejfor is on a distinguished road
it's quite simple, but not for 5 lines.
you may have a look at rhoTurbTwinParcelFoam tutorial which comes with 1.5.x installation for your inpiration. there is a solver calling intermediate clases like kinematicCloud and thermoCloud for solving Lagrangian phase.

if you want to print out the data, you can add as I've written previously kinematicCloud1.dumpParticlePositions(); to the main solver where you call kinematicCloud1.evolve();

To specify what to print, you look for that function in src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C file.
For example my line n this function looks like:
pObj<< "v " << p.d() <<" "<< p.nParticle() <<" "<< p.stk()<<" "<< p.Ur() <<" "<< p.position().x() << " " << p.position().y() << " "

where for example p.stk is particle Stokes number, which I defined as an inline function in: parcels/Templates/KinematicParcel/KinematicParcel.H
and specified in:
parcels/Templates/KinematicParcel/KinematicParcelI.H

there you will find other variables which you may be interested in.

hope it helps you.
good luck
matej
matejfor is offline   Reply With Quote

Old   August 18, 2009, 10:29
Question Viewing Re number and relative velocity
  #11
Member
 
amin
Join Date: May 2009
Posts: 59
Rep Power: 8
az1362f is on a distinguished road
Hi,

I want to write relative velocity and Reynolds number of each particle and then plot them,Is there any way?

please help me

regard
az1362f is offline   Reply With Quote

Old   August 19, 2009, 05:28
Default
  #12
Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 92
Rep Power: 8
matejfor is on a distinguished road
if you want to plot it in the paraview, the simple way is to calculate it in paraview by constructing your own filter. you can use the available variables in a calculator to construct your own new variable and plot it the paraview.

if you want it to be calculated during the run and written to the field for postprocessing, you have to inicialise the variable and write it at the end of the lagrangian calculation. How to do it would mean to trace in for variable like diameter and do the same for the relative Re.

good luck

matej
mechem likes this.
matejfor is offline   Reply With Quote

Old   August 21, 2009, 04:23
Default sampling lagrangian data
  #13
Member
 
amin
Join Date: May 2009
Posts: 59
Rep Power: 8
az1362f is on a distinguished road
Hello Dear matej;

Thank you for your suggestion.I used calculator filter to made a new variable by name of Urel=U(droplet)-U(gas) but just exist U(droplet) in the vector variables and U(gas) is not active and does not exist in the vector variables.

For your second suggestion I traced in for variable like diameter and
I saw these lines in the parcelIO.C and I think that these lines write output files of particles properties,could you say me how can I add Urel and Re to these properties(d,T,m,y,.....)?
I want to write Urel and Re in addition to these values.


void Foam:: parcel::writeFields
(
const Cloud<parcel>& c
)
{
Particle<parcel>::writeFields(c);

label np = c.size();

IOField<scalar> d(c.fieldIOobject("d"), np);
IOField<scalar> T(c.fieldIOobject("T"), np);
IOField<scalar> m(c.fieldIOobject("m"), np);
IOField<scalar> y(c.fieldIOobject("y"), np);
IOField<scalar> yDot(c.fieldIOobject("yDot"), np);
IOField<scalar> ct(c.fieldIOobject("ct"), np);
IOField<scalar> ms(c.fieldIOobject("ms"), np);
IOField<scalar> tTurb(c.fieldIOobject("tTurb"), np);
IOField<scalar> liquidCore(c.fieldIOobject("liquidCore"), np);
IOField<scalar> injector(c.fieldIOobject("injector"), np);

IOField<vector> U(c.fieldIOobject("U"), np);
IOField<vector> Uturb(c.fieldIOobject("Uturb"), np);
IOField<vector> n(c.fieldIOobject("n"), np);

label i = 0;
forAllConstIter(Cloud<parcel>, c, iter)
{
const parcel& p = iter();

d[i] = p.d_;
T[i] = p.T_;
m[i] = p.m_;
y[i] = p.y_;
yDot[i] = p.yDot_;
ct[i] = p.ct_;
ms[i] = p.ms_;
tTurb[i] = p.tTurb_;
liquidCore[i] = p.liquidCore_;
injector[i] = p.injector_;

U[i] = p.U_;
Uturb[i] = p.Uturb_;
n[i] = p.n_;

i++;
}

d.write();
T.write();
m.write();
y.write();
yDot.write();
ct.write();
ms.write();
tTurb.write();
liquidCore.write();
injector.write();

U.write();
Uturb.write();
n.write();

// write the liquid molar fractions
if (np > 0)
{
Cloud<parcel>::const_iterator iter = c.begin();
const parcel& p0 = iter();

label nX = p0.X().size();
const List<word>& names = p0.liquidNames();

for (label j=0; j<nX; j++)
{
IOField<scalar> X(c.fieldIOobject(names[j]), np);

label i = 0;
forAllConstIter(Cloud<parcel>, c, iter)
{
const parcel& p = iter();
X[i++] = p.X()[j];
}

X.write();
}
}
}
az1362f is offline   Reply With Quote

Old   August 22, 2009, 15:14
Question sampling lagrangian data
  #14
Member
 
amin
Join Date: May 2009
Posts: 59
Rep Power: 8
az1362f is on a distinguished road
Hello Dear matej;

Thank you for your suggestion.I used calculator filter to made a new variable by name of Urel=U(droplet)-U(gas) but just exist U(droplet) in the vector variables and U(gas) is not active and does not exist in the vector variables.

For your second suggestion I traced in for variable like diameter and
I saw these lines in the parcelIO.C and I think that these lines write output files of particles properties,could you say me how can I add Urel and Re to these properties(d,T,m,y,.....)?
I want to write Urel and Re in addition to these values.


void Foam:: parcel::writeFields
(
const Cloud<parcel>& c
)
{
Particle<parcel>::writeFields(c);

label np = c.size();

IOField<scalar> d(c.fieldIOobject("d"), np);
IOField<scalar> T(c.fieldIOobject("T"), np);
IOField<scalar> m(c.fieldIOobject("m"), np);
IOField<scalar> y(c.fieldIOobject("y"), np);
IOField<scalar> yDot(c.fieldIOobject("yDot"), np);
IOField<scalar> ct(c.fieldIOobject("ct"), np);
IOField<scalar> ms(c.fieldIOobject("ms"), np);
IOField<scalar> tTurb(c.fieldIOobject("tTurb"), np);
IOField<scalar> liquidCore(c.fieldIOobject("liquidCore"), np);
IOField<scalar> injector(c.fieldIOobject("injector"), np);

IOField<vector> U(c.fieldIOobject("U"), np);
IOField<vector> Uturb(c.fieldIOobject("Uturb"), np);
IOField<vector> n(c.fieldIOobject("n"), np);

label i = 0;
forAllConstIter(Cloud<parcel>, c, iter)
{
const parcel& p = iter();

d[i] = p.d_;
T[i] = p.T_;
m[i] = p.m_;
y[i] = p.y_;
yDot[i] = p.yDot_;
ct[i] = p.ct_;
ms[i] = p.ms_;
tTurb[i] = p.tTurb_;
liquidCore[i] = p.liquidCore_;
injector[i] = p.injector_;

U[i] = p.U_;
Uturb[i] = p.Uturb_;
n[i] = p.n_;

i++;
}

d.write();
T.write();
m.write();
y.write();
yDot.write();
ct.write();
ms.write();
tTurb.write();
liquidCore.write();
injector.write();

U.write();
Uturb.write();
n.write();

// write the liquid molar fractions
if (np > 0)
{
Cloud<parcel>::const_iterator iter = c.begin();
const parcel& p0 = iter();

label nX = p0.X().size();
const List<word>& names = p0.liquidNames();

for (label j=0; j<nX; j++)
{
IOField<scalar> X(c.fieldIOobject(names[j]), np);

label i = 0;
forAllConstIter(Cloud<parcel>, c, iter)
{
const parcel& p = iter();
X[i++] = p.X()[j];
}

X.write();
}
}
}
az1362f is offline   Reply With Quote

Old   August 24, 2009, 07:47
Default sampling lagrangian
  #15
Member
 
amin
Join Date: May 2009
Posts: 59
Rep Power: 8
az1362f is on a distinguished road
any body can help me.
I am still waiting for a response.
az1362f is offline   Reply With Quote

Old   August 28, 2009, 11:41
Default
  #16
Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 92
Rep Power: 8
matejfor is on a distinguished road
OK if we stick to kinematicCloud class you need to do few thinkg there.

I've played around a bit and here is what you should do:
(I'm using 1.5-dev Foam version)

In parcels/Templates/KinematicParcel/KinematicParcelI.H :

define inline function for your relative Reynolds number,
In KinematicParcel.H add this function to a member function list.

now you need to tell the code to write this Re number out, so you need to edit KinematicParcelIO.C where you will find two member function - one is for reading the fields and the other is for writting. All you have to do now is to add IOField specification (around line 158) and then add {ReynoldsNumber function name}.write(); line compile and enjoy.

I guess about the same you can do also with other particle classes, not only with kinematic one.
If I do miss something here, hopefully someone more skilled will correct me.

I should add do not do all of this in the main src code. You will make some errors for sure and you want at least something to work. For example I have my local intermediateWORK library which I play around with.


good luck

matej
matejfor is offline   Reply With Quote

Old   August 28, 2009, 17:45
Default sampling lagrangian
  #17
Member
 
amin
Join Date: May 2009
Posts: 59
Rep Power: 8
az1362f is on a distinguished road
Hello Dear

I try to do your suggustion.
There is an inline function to describe Urel like this in parcelI.H:

inline vector parcel::Urel(const vector& U) const
{
return U_ - U;
}

the problem is to define vector U(gas velocity) in every iteration to inline function for returning Ugas.

I add this line from parcel.C :

vector Up = sDB.UInterpolator().interpolate(position(), cell())
+ Uturb();

after these lines in parcelIO.C file:

forAllConstIter(Cloud<parcel>, c, iter)
{
const parcel& p = iter();

and add these lines to write function of parcelIO.C:

IOField<vector> Urel(c.fieldIOobject("Urel"), np);
Urel[i] = p.Urel(Up)
Urel.write();

exactly like parcelIO.C method, But because I did not declare Up and Uturb() I face errors when I try to compile it.

how can I add U (gas velocity) to Urel function[Urel(const vector& U)] when I call it for every iteration?
az1362f is offline   Reply With Quote

Old   May 8, 2015, 11:11
Default Lagrangian particle velocity
  #18
New Member
 
Tariq Ahmed
Join Date: Jan 2015
Posts: 12
Rep Power: 2
Tariq Ahmed is on a distinguished road
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
Tariq Ahmed is offline   Reply With Quote

Old   May 11, 2015, 05:55
Default
  #19
New Member
 
Tariq Ahmed
Join Date: Jan 2015
Posts: 12
Rep Power: 2
Tariq Ahmed is on a distinguished road
Hope somebody is able to help me in the topic
Tariq Ahmed is offline   Reply With Quote

Reply

Thread Tools
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 On
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 18: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 00:38.