|
[Sponsors] |
March 30, 2009, 06:31 |
Sampling lagrangian data
|
#1 |
Member
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 17 |
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 |
|
March 30, 2009, 09:34 |
|
#2 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
you have to write your own evaluation code if you want to do that kind of thing
|
|
March 31, 2009, 08:27 |
|
#3 |
Member
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 17 |
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?? |
|
April 7, 2009, 07:14 |
|
#4 |
Member
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 17 |
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 |
|
April 7, 2009, 09:03 |
|
#5 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
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 |
|
April 8, 2009, 10:48 |
|
#6 |
Member
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 17 |
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 |
|
April 8, 2009, 18:53 |
|
#7 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
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 |
||
April 9, 2009, 03:56 |
|
#8 |
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17 |
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 |
|
April 9, 2009, 06:32 |
|
#9 |
Member
Michael
Join Date: Mar 2009
Posts: 48
Rep Power: 17 |
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 |
|
April 9, 2009, 06:59 |
|
#10 |
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17 |
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 |
|
August 18, 2009, 11:29 |
Viewing Re number and relative velocity
|
#11 |
Member
amin
Join Date: May 2009
Posts: 62
Rep Power: 17 |
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 |
|
August 19, 2009, 06:28 |
|
#12 |
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17 |
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 |
|
August 21, 2009, 05:23 |
sampling lagrangian data
|
#13 |
Member
amin
Join Date: May 2009
Posts: 62
Rep Power: 17 |
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(); } } } |
|
August 22, 2009, 16:14 |
sampling lagrangian data
|
#14 |
Member
amin
Join Date: May 2009
Posts: 62
Rep Power: 17 |
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(); } } } |
|
August 24, 2009, 08:47 |
sampling lagrangian
|
#15 |
Member
amin
Join Date: May 2009
Posts: 62
Rep Power: 17 |
any body can help me.
I am still waiting for a response. |
|
August 28, 2009, 12:41 |
|
#16 |
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17 |
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 |
|
August 28, 2009, 18:45 |
sampling lagrangian
|
#17 |
Member
amin
Join Date: May 2009
Posts: 62
Rep Power: 17 |
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? |
|
May 8, 2015, 12:11 |
Lagrangian particle velocity
|
#18 |
New Member
Tariq Ahmed
Join Date: Jan 2015
Posts: 13
Rep Power: 11 |
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 |
|
May 11, 2015, 06:55 |
|
#19 |
New Member
Tariq Ahmed
Join Date: Jan 2015
Posts: 13
Rep Power: 11 |
Hope somebody is able to help me in the topic
|
|
February 11, 2016, 02:31 |
|
#20 |
New Member
Subhasree
Join Date: Mar 2014
Location: IIT Bombay, India
Posts: 25
Rep Power: 12 |
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? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Data sampling for Time Statistics" | Madhukar Rapaka | FLUENT | 2 | June 20, 2011 12:28 |
help reqd. :DATA SAMPLING FOR TIME STATISTIC | haris | FLUENT | 0 | April 16, 2008 08:57 |
Sampling of statistical data | Boerge | Main CFD Forum | 0 | July 25, 2006 05: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 05:32 |