do particle tracking in paraview?
Dear OpenFOAMers,
I completed a transient interFoam case. I am wondering if it is possible to do lagrangian particle tracking in paraview/paraFoam? I do not really care about the forces/sizes of the particles. I just want to show, if massless/sizeless particles released from certain locations, their paths as function of time. Thanks! Pei |
Hi Pei-Ying,
To visualize Lagrangian particles i convert the case to VTK Code:
foamToVTK http://users.tkk.fi/%7Egwierink/exte...lyph-small.png |
Hi guys,
Or in case if you want to create particle tracking with pathlines that animates over time completely within ParaView from case without lagrangian data, yes you can, but with a bit complex visualization pipeline (see the Pipeline Browser in the screenshot attached below). The key is to apply Temporal Interpolator that allows you not only to interpolate saved time steps (that are typically too sparse to create a smooth particle tracking animation by themselves) but also to access temporal filters of ParticleTracer and Particle Pathlines. And note that you can create particle seeds from whatever source you like (Plane, Point Source Line, etc) in the Sources menu. There are lots of options across the filters and sources that affect the formation of the pathlines so you need to do some experiments. Also, in my experience ParticleTracer of ParaView 3.8.0 often crashes ParaView so you might need a git version of ParaView 3.9. Takuya http://dl.dropbox.com/u/7352393/Part...Screenshot.png |
Hi, 7islands,
Thanks! This is exactly what I am looking for. I did not include lagrangian particles when running the interFoam case. I am hoping to plot the particles in paraFoam/paraview. I did experiment particleTracer very briefly (before I saw your post) and could not quite figure out how to do it. Now, I will try to follow your steps to see if I can get it right this time. Pei |
Hi Pei,
Perhaps the Code:
particleTracks |
Dear Gijs,
Thanks! But, where can I find this particleTracks code? Pei-Ying |
Dear Pei-Ying,
particleTracks is a utility that is part of the OpenFOAM package (see here under "New utilities"). It lives in $FOAM_UTILITIES/postProcessing/lagrangian/particleTracks. In the case directory you need to copy a file called particleTrackProperties into the constant/ directory: Code:
cp $FOAM_UTILITIES/postProcessing/lagrangian/particleTracks/particleTrackProperties constant/ Code:
particleTracks |
Thanks a lot Gijs!
Pei-Ying |
Dear People
I tried to run FoamToVTK utility inside my case directory But it didnt run through properly, instead it gave me a message like : /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.7.1 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 1.7.1-03e7e056c215 Exec : foamToVTK Date : Mar 28 2011 Time : 17:43:35 Host : vlxhead2 PID : 16896 Case : /home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample nProcs : 1 SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 At time: 0.001 detected cloud directory : "defaultCloud" Time: 0 volScalarFields : alpha p k epsilon volVectorFields : Ua Ub Internal : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/mono1.5mmPeak-1.7.x-sample_0.vtk" Original cells:540 points:1184 Additional cells:0 additional points:0 Patch : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/inlet/inlet_0.vtk" Patch : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/outlet/outlet_0.vtk" Patch : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/walls/walls_0.vtk" Patch : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/defaultFaces/defaultFaces_0.vtk" Lagrangian: "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/lagrangian/defaultCloud/defaultCloud_0.vtk" Time: 0.001 volScalarFields : alpha p k nutb epsilon volVectorFields : Ur Ub U Ua Uc Internal : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/mono1.5mmPeak-1.7.x-sample_5.vtk" Patch : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/inlet/inlet_5.vtk" Patch : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/outlet/outlet_5.vtk" Patch : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/walls/walls_5.vtk" Patch : "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/defaultFaces/defaultFaces_5.vtk" Lagrangian: "/home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/VTK/lagrangian/defaultCloud/defaultCloud_5.vtk" labels : origId origProcId tag scalars : d vectors : U positions spherical tensors : symm tensors : tensors : --> FOAM FATAL IO ERROR: wrong token type - expected int found on line 22 the punctuation token '(' file: /home_g07/s1065046/OpenFOAM/s1065046-1.7.1/run/mono1.5mmPeak-1.7.x-sample/mono1.5mmPeak-1.7.x-sample/0.001/lagrangian/defaultCloud/positions at line 22. From function operator>>(Istream&, int&) in file primitives/ints/int/intIO.C at line 68. FOAM exiting Eventually a Folder named VTK was made in the case directory, but it didn work. Please help. I am not able to understand why it didnt work. Best Wishes Prashant |
Hi Prashant,
Quote:
|
Hey,
I checked in file, but there was not an instance of (( occuring . Anyways its a OpenFoam result file that it has indicated to a have a error in, I am not sure how to proceed, is there any other way to post process lagragian particles than using FoamToVTK. Best Wishes Prashant Quote:
|
Hi Prashant,
Perhaps it's possible to use foamToTecplot, but i don't know. I don't have Tecplot and always use ParaView with VTK files. Still, there must be something wrong with line 22 in some file in 0.001, whoever wrote that file :). What does Code:
awk 'FNR==22 {print FILENAME": "$0}' 0.001/* |
Hey ,
I found the file it mentions, it reads like /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.7.1 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class vectorField; location "0.001"; object positions; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 2160 ( (0.00101927 0.000749988 0.00222566) (0.00948121 0.000749997 0.000872757) (0.0132042 0.000749993 0.0036906) (0.0151473 0.00180264 0.00075) (0.0207055 0.000749997 0.000750031) (0.0215812 0.000749995 0.00196801) (0.0271111 0.000749991 0.00075002) (0.0310265 0.000749997 0.00252693) ........ ) Though it reads a punctuation mark at line 22 which is the fourth line after 2160 (0.00948121 0.000749997 0.000872757) This file is a result file generated by OpenFoam , even if I want I cant change its format. Can you copy paste a result file you get after you execute FoamToVTK. Please suggest how to go about this. Also I tried to run another code and tried using FoamToVTK , it still didnt work, but gave some other error. I am not sure what its upto :) Can you help ? Best Wishes Prashant Quote:
|
Hi Prashant,
Hmm, at first glance the file looks alright. Can you e-mail me the case with time steps 0 and 0.001? Then I can have a go ... My e-mail is gijsbert dot wierink at gmail dot com. PS Please send a tar file. In case you don't know how, do "tar -pczf case.tar.gz case" in the directory where you case directory lives (here, "case" is the name of your case). |
Hey Thanks very much,
I have sent you email with the whole folder I run FoamToVTK command. In it there are cases 0 and 0.001 please help Best Wishes Prashant Quote:
|
Hi!
I received your e-mail and fixed the case (or at least it converts to VTK without error). The trick was to change "vectorField" to "volVectorField" in <timeStep>/lagrangian/defaultCloud/positions. Also, you need to add a space and a zero at the end of every vector line in the same file. Since you have more than 2000 particles, you'll probably go nuts if you do this by hand. This should do the job in the case dir: Code:
sed -i '12s/vector/volVector/' 0.001/lagrangian/defaultCloud/positions |
Hey ,
It worked, thanks very much for your help :) Also if you could suggest how can I do these changes for more time steps like 0.001, 0.002.... 0.1 ( 100 directories ) all at once. Best Wishes Prashant Quote:
|
Hi,
Haha, our mails crossed again :). Just make a bash script something like this: Code:
#!/bin/bash Code:
chmod +x ~/bin/foo |
Hi friends,
I'm simulating a tube with water flow. The tube encounters boiling near the wall. I intend to calculate 'void fraction versus enthalpy' along the channel. Can you help me how to calculate void fraction? I'm in an emergency condition. Waiting for your comments!!! Thanks Everybody |
Quote:
If i understand truly this works when the simulation has been done with lagrangian solvers. I have simulated a hydrocyclone with pisoFoam solver for one phase. Now i want inject particles as second phase and do particle trajectory for them. I didn't find any suitable solver in lagrangian solvers. What is your suggestion for me? Regards. |
All times are GMT -4. The time now is 11:22. |