CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] Plot over line average magnitude of particle velocity in paraview

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

Like Tree3Likes
  • 3 Post By mneben

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 12, 2014, 04:41
Question Plot over line average magnitude of particle velocity in paraview
  #1
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 17
maysmech is on a distinguished road
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?
maysmech is offline   Reply With Quote

Old   June 13, 2014, 03:42
Question Plot over line average magnitude of particle velocity in paraview
  #2
New Member
 
Charlie
Join Date: May 2014
Posts: 9
Rep Power: 11
mechem is on a distinguished road
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
mechem is offline   Reply With Quote

Old   June 14, 2014, 09:40
Default
  #3
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
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
wyldckat is offline   Reply With Quote

Old   June 14, 2014, 11:24
Question
  #4
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 17
maysmech is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
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,
maysmech is offline   Reply With Quote

Old   June 15, 2014, 09:13
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
Greetings Charlie and Maysam,

Since both your questions are related, I've moved all posts into a single thread.

If I understand your questions correctly, you want to:
  1. First re-sample the velocity data that comes from the particles onto the mesh. Essentially, create the field "U.particles".
  2. Then do a time average of that field "U.particles".
  3. Then plot this field "U.particles.avg" over a line.
I've done some attempts just now on this topic and I have not managed to figure out the solution, if at all possible to be done directly in ParaView. The best I can figure out is that the "Programmable filter" would have to be used for this, because this kind of calculation isn't very usual.

It looks like that for this particular objective, you will have to create a dedicated OpenFOAM utility or Python filter for ParaView.


Problem is that the more I think about this, the less sense it makes to me. Because the problem is that this approach implies binning (placing in bins ) into each mesh cell the average speed of all particles inside that cell. In other words, the plot you'll get will be more of a spacial histogram of the particle velocity along a line.

Thinking even further, it seems that you want to calculate the average velocity of particles that are at a certain distance of a line, perhaps using a weighted distance average...


OK, the more I think about this, the more questions I end up with. So, what is the specific sampling criteria do you want to use?
I ask this because the particles are solved almost separately from the mesh, therefore it doesn't make much sense to plot particle speeds over a line, since very rarely will particles will cross over that line.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   June 15, 2014, 09:40
Smile
  #6
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 17
maysmech is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
If I understand your questions correctly, you want to:
  1. First re-sample the velocity data that comes from the particles onto the mesh. Essentially, create the field "U.particles".
  2. Then do a time average of that field "U.particles".
  3. 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.
maysmech is offline   Reply With Quote

Old   June 15, 2014, 12:30
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
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
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
__________________
wyldckat is offline   Reply With Quote

Old   June 15, 2014, 12:48
Lightbulb
  #8
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 17
maysmech is on a distinguished road
Thanks Bruno for your suggestions.
I will work on the source code and will return here.
Regards,
maysmech is offline   Reply With Quote

Old   July 24, 2014, 08:55
Default
  #9
New Member
 
Matthias Neben
Join Date: Oct 2011
Location: Cottbus (Germany)
Posts: 28
Rep Power: 14
mneben is on a distinguished road
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
Shuai_W, LiJG and wenxu like this.
mneben is offline   Reply With Quote

Old   July 24, 2014, 12:46
Default
  #10
Senior Member
 
maysmech's Avatar
 
Join Date: Jan 2010
Posts: 347
Blog Entries: 2
Rep Power: 17
maysmech is on a distinguished road
Quote:
Originally Posted by mneben View Post
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,
maysmech is offline   Reply With Quote

Old   October 31, 2014, 22:18
Default
  #11
Senior Member
 
Freedom
Join Date: May 2014
Posts: 209
Rep Power: 12
wenxu is on a distinguished road
Quote:
Originally Posted by mneben View Post
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 View Post
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
wenxu is offline   Reply With Quote

Old   June 28, 2017, 10:25
Default
  #12
New Member
 
SURAJ
Join Date: Jun 2017
Location: IIT KANPUR,India
Posts: 15
Rep Power: 8
surajkvs is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
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
hey,
I am able to plot data but how will I get the particle velocity over line.
I am new on openFoam and I am doing the fluidised bed case.name Goldscmidt.
so,is there anybody who was able to solve.than please suggest me the solution.
surajkvs is offline   Reply With Quote

Old   August 5, 2022, 22:42
Default
  #13
Member
 
chengan.wang
Join Date: Jan 2016
Location: china
Posts: 47
Rep Power: 10
wangchengan2003 is on a distinguished road
Send a message via Skype™ to wangchengan2003
Hello Maysam,
I have output the data of water spray. Such as



I want to plot a ling of variation of the average diameter along the axis of each spray. It means that I should calculate the average diameter at any plane perpendicular to the axis. Could you give me some suggestions?

Best regards,
Chengan
wangchengan2003 is offline   Reply With Quote

Old   August 12, 2022, 12:46
Default
  #14
New Member
 
Join Date: Feb 2022
Posts: 7
Rep Power: 4
Thiago800 is on a distinguished road
Hello wangchengan2003,

how did you output the data of this spray like that in paraview?
I am also doing a spray simulation, and I am searching a way to plot the particle like you did.
How did you do that?

Thank you
Thiago800 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
[OpenFOAM] Plot over line fails in ParaView mheinz ParaView 4 May 23, 2016 06:28
[General] 2 datas on one plot Akuji ParaView 46 December 1, 2013 15:06
Particle velocity - Injection With Line Weighting Danuta CFX 0 October 10, 2007 07:21
Problems of Duns Codes! Martin J Main CFD Forum 8 August 15, 2003 00:19
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 16:16


All times are GMT -4. The time now is 15:49.