# Plot over line average magnitude of particle velocity in paraview

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

 June 12, 2014, 03:41 Plot over line average magnitude of particle velocity in paraview #1 Senior Member     Join Date: Jan 2010 Posts: 347 Blog Entries: 2 Rep Power: 8 Hi all, How can I plot over line the particle velocity in a lagrangian solver? "plot over line" plots the continuous phase variables only and can not plot lagrangian variables. Any idea?

 June 13, 2014, 02:42 Plot over line average magnitude of particle velocity in paraview #2 New Member   Charlie Join Date: May 2014 Posts: 9 Rep Power: 3 Hello, How is possible to plot over line the velocity of particles in lagrangian solvers like MPPICFoam? How can we find the average magnitude of particle velocity in a two-horizontal lines? Thanks in advance

 June 14, 2014, 08:40 #3 Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 8,251 Blog Entries: 34 Rep Power: 84 Greetings to all! @Maysam: There is a filter named "Plot data" which will plot any dataset. So essentially it depends on whether you can prepare the Lagrangian data in a way that it's ready to be plotted. Best regards, Bruno

June 14, 2014, 10:24
#4
Senior Member

Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 8
Quote:
 Originally Posted by wyldckat Greetings to all! @Maysam: There is a filter named "Plot data" which will plot any dataset. So essentially it depends on whether you can prepare the Lagrangian data in a way that it's ready to be plotted. Best regards, Bruno
Thanks a lot Bruno,
I couldn't use this filter. What we need is plotting average of particle velocities in a line. Because the particles are not in a horizontal line and there is some vertical distances, I think we should use averaging in each cell (like calculation of betta in drag force source term) then possible to plot a discrete lagrangian variable over a line. Running tutorials in Lagrangian solvers like MPPICFoam creates Lagrangian velocities (U) in timeFolder/lagrangian/kinematicCloud directory. The problem is they are sorted by their particle ID, not mesh cell number. What do you think about plotting these discrete variables over line using "Plot Data" filter?
Regards,

June 15, 2014, 08:40
#6
Senior Member

Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 8
Quote:
 Originally Posted by wyldckat If I understand your questions correctly, you want to:First re-sample the velocity data that comes from the particles onto the mesh. Essentially, create the field "U.particles". Then do a time average of that field "U.particles". Then plot this field "U.particles.avg" over a line.
Thanks Bruno and Charlie!
Yes I meant these steps exactly. I need particle flux for each grid cell using this equation:
particle flux (kg/m2.s)=(1-alpha.air)*rho_p*U_p
This is the flux of particles in each time. Averaging this term leads to the flux of particles in a desired line.

 June 15, 2014, 11:30 #7 Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 8,251 Blog Entries: 34 Rep Power: 84 Hi Maysam, The most I can do is to suggest that you study the source code that is in the folders indicated by the following commands: Code: ```echo \$FOAM_UTILITIES/postProcessing/lagrangian/particleTracks echo \$FOAM_SOLVERS/lagrangian/DPMFoam``` and to try to develop your own utility for performing that calculation. In addition, have a look into this wiki page for more ideas: http://openfoamwiki.net/index.php/Ho..._based_methods Good luck! Best regards, Bruno __________________ OpenFOAM: Frequently Asked Questions | Useful links for building and using Forum: How to ask for help | Posting code and output with [CODE] When will I answer questions? Check this page for dates: http://wyldckat.github.io And please: Read this before sending private messages to me

 June 15, 2014, 11:48 #8 Senior Member     Join Date: Jan 2010 Posts: 347 Blog Entries: 2 Rep Power: 8 Thanks Bruno for your suggestions. I will work on the source code and will return here. Regards,

 July 24, 2014, 07:55 #9 New Member   Matthias Neben Join Date: Oct 2011 Posts: 21 Rep Power: 5 Hello Maysam, did you find a appropriate solution? I had the same problem and therefore I changed the DPMFoam source code: in createFields I wrote Code: ``` Info<< "Creating field particleFlux\n" << endl; // mass Flux of the lagrangian particle [kg/(m^2*s)] volVectorField particleFluxByA ( IOobject ( "particleFluxByA", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedVector("zero", dimVelocity*dimMass/dimVolume, vector::zero) );``` In DPFMFoam.C above main function Code: `typedef typename basicKinematicTypeCloud::particleType parcelType;` ...and before the evolving of the particles I added the following lines: Code: ``` forAll(particleFluxByA,i) { particleFluxByA[i] = vector(0.0,0.0,0.0); } forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter) { const parcelType& p = iter(); const label cellI = p.cell(); particleFluxByA[cellI]+=p.nParticle()*p.mass()*p.U(); } forAll(mesh.V(),i) { particleFluxByA[i]/=mesh.V()[i]; }``` The idea behind it is that the flux f = (1-alpha.air)*rho_p*U_p =rho_bulk*U_p whereas U_p is the mean value. The mass averaged mean value can be calculated with Up=sum(vi*mi*ni)/mtotal mtotal =(total) mass of all parcels in a cell; mi, ni and vi are the values of the individual parcels mtotal=rho_bulk*Vcell --> f=rho_bulk*sum(vi*mi*ni)/(rho_bulk*Vcell) =sum(vi*mi*ni)/Vcell Kind regards Matthias wenxu likes this.

July 24, 2014, 11:46
#10
Senior Member

Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 8
Quote:
 Originally Posted by mneben Hello Maysam, did you find a appropriate solution? I had the same problem and therefore I changed the DPMFoam source code: in createFields I wrote Code: ``` Info<< "Creating field particleFlux\n" << endl; // mass Flux of the lagrangian particle [kg/(m^2*s)] volVectorField particleFluxByA ( IOobject ( "particleFluxByA", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedVector("zero", dimVelocity*dimMass/dimVolume, vector::zero) );``` In DPFMFoam.C above main function Code: `typedef typename basicKinematicTypeCloud::particleType parcelType;` ...and before the evolving of the particles I added the following lines: Code: ``` forAll(particleFluxByA,i) { particleFluxByA[i] = vector(0.0,0.0,0.0); } forAllConstIter(typename basicKinematicTypeCloud, kinematicCloud, iter) { const parcelType& p = iter(); const label cellI = p.cell(); particleFluxByA[cellI]+=p.nParticle()*p.mass()*p.U(); } forAll(mesh.V(),i) { particleFluxByA[i]/=mesh.V()[i]; }``` The idea behind it is that the flux f = (1-alpha.air)*rho_p*U_p =rho_bulk*U_p whereas U_p is the mean value. The mass averaged mean value can be calculated with Up=sum(vi*mi*ni)/mtotal mtotal =(total) mass of all parcels in a cell; mi, ni and vi are the values of the individual parcels mtotal=rho_bulk*Vcell --> f=rho_bulk*sum(vi*mi*ni)/(rho_bulk*Vcell) =sum(vi*mi*ni)/Vcell Kind regards Matthias
Hi Matthias
I wrote a Fortran code to do postprocessing the results. Your work in changing the source code seems nice. I try yours too and compare it with mine. Regards,

October 31, 2014, 22:18
#11
Senior Member

Wen Xu
Join Date: May 2014
Posts: 115
Rep Power: 3
Quote:
 Originally Posted by mneben Hello Maysam, did you find a appropriate solution? I had the same problem and therefore I changed the DPMFoam source code: [...] Kind regards Matthias

hello,Matthias Neben,

how can i get the particle's mean velocity and RMS along a line (a distance tolerance ), i'm really new to OF, any suggestion will be helpful!!

regards,
wen

Quote:
 Originally Posted by mechem Hello, How is possible to plot over line the velocity of particles in lagrangian solvers like MPPICFoam? How can we find the average magnitude of particle velocity in a two-horizontal lines? Thanks in advance

HI,Charlie.
Have you solved your problem? please give me some suggestion, thank you !

regards
wen

Last edited by wyldckat; November 1, 2014 at 08:34. Reason: merged posts, since they were posted an hour apart... and trimmed down the first quote for easier reading

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Akuji ParaView 46 December 1, 2013 15:06 kmooney OpenFOAM Running, Solving & CFD 42 November 6, 2012 12:37 Danuta CFX 0 October 10, 2007 06:21 Martin J Main CFD Forum 8 August 14, 2003 23:19 CFD user CFX 3 November 25, 2002 16:16

All times are GMT -4. The time now is 19:45.