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

[OpenFOAM] Extract data in paraview in one output file

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By AtoHM
  • 1 Post By AtoHM

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2024, 13:28
Default Extract data in paraview in one output file
  #1
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Hello Foamers,

I'm going to extract my data fields such as U and P via paraview. As far as I know, in paraview it is possible to extract data with Save data as I've attached in .csv format.

However, I have come across a questions;

How can I extract all of the data over time in one file, because when I choose Write Time Step option it gives me seperate files for each time step!!!

Thank you for your time.
Attached Images
File Type: jpg Screenshot (249).jpg (80.4 KB, 9 views)
File Type: jpg Screenshot (250).jpg (84.6 KB, 8 views)
saeed jamshidi is offline   Reply With Quote

Old   January 12, 2024, 09:37
Default
  #2
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
Grab ChatGPT and let it build you a helper script to merge these individual files together. Shouldn't take too long.
AtoHM is offline   Reply With Quote

Old   January 12, 2024, 10:40
Default
  #3
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Ohhh,
Chatgpt does not perform this action for large amounts of data, unless it suggests a way or method.
Isn't it?
saeed jamshidi is offline   Reply With Quote

Old   January 14, 2024, 11:08
Default
  #4
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
I too do not think gpt would process data directly, but it will help build you a script for a language like python which you can install in like 2 mins. Technically, you have Python already since you are using PV.

Two ways come to mind: [easy] tell GPT to write a script that loops over all the files that were exported. Then assuming you have a structure like this in there:
Code:
x, y, z, <your value>
You tell it to take column x, y, z from the first file & loop over all files and add the <your value> column, while adding the timestep which is given in the filename by "_%d" in the header. This should give you a big file with your variable to each spatial coordinate and timestep in a separate column.

[More advanced] dig into how to access the vtk objects of Paraview e.g. from the Python shell or within a Programmable Filter. Then you can easily loop over the timesteps and write the data out in whatever form you like.
saeed jamshidi likes this.
AtoHM is offline   Reply With Quote

Old   January 14, 2024, 11:12
Default
  #5
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Yeahh, sounds good
saeed jamshidi is offline   Reply With Quote

Old   January 22, 2024, 10:09
Default
  #6
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Hi again with another question,

I would like to extract my field data such as U and P for cell centers in the computational domain. Is there any way to do that?

As far as I'm concerned when I choose cell data it gives just valuse of the filed data without the coordinates!

This is a part of typical output for velocity with the following procedure: Screenshot (266).jpg
Code:
Cell Type	U:0	U:1	U:2
12	0.01	        -4.58E-07	0
12	0.01	        -4.58E-07	0
12	0.010001	-6.43E-07	0
12	0.010002	-9.69E-07	0
12	0.010002	-9.69E-07	0
12	0.010003	-1.07E-06	0
12	0.010004	-1.09E-06	0
12	0.010004	-1.10E-06	0
12	0.010006	-1.12E-06	0
12	0.010006	-1.12E-06	0
12	0.010008	-1.14E-06	0
12	0.010008	-1.14E-06	0
12	0.010009	-1.15E-06	0
12	 0.01001	  -1.16E-06 	0
12	0.010011	-1.16E-06	0
12	0.010012	-1.18E-06	0
12	0.010012	-1.18E-06	0
12	0.010014	-1.20E-06	0
12	0.010014	-1.20E-06	0
12	0.010016	-1.23E-06	0
12	0.010016	-1.23E-06	0
However I would like to have something like this:
Code:
x  y  z  Ux  Uy  Uz

. . . .........
So, to put it in a nutshell, data of the cell centers as well as their coordinates are welcome.

regards
saeed jamshidi is offline   Reply With Quote

Old   January 23, 2024, 01:43
Default
  #7
Senior Member
 
M
Join Date: Dec 2017
Posts: 642
Rep Power: 12
AtoHM is on a distinguished road
Yes, just create 3 calculators: here for X: expression will be coordsX, output will be "X". This way you get it as an actual coordinate (scalar value) to plot for each cell. Once you have done this for Y and Z similarly, you can use the Filter PointToCellData which gives them as Cell Data. Then you can include them in your output.
saeed jamshidi likes this.
AtoHM is offline   Reply With Quote

Old   January 23, 2024, 02:51
Default
  #8
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Dear AtoHM,

I really appreciate your help, that's what I need.

Best
saeed jamshidi is offline   Reply With Quote

Old   January 25, 2024, 04:05
Default
  #9
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Hello AtoHM,

Based on your advice I got my desired output results. However, there is an issue with them. Let me share some data and the procedures of extracting it:
Screenshot (281).jpg & Screenshot (280).jpg


Code:
Cell Type	U:0	U:1	U:2	X	Y
12	0.0049559	-3.36E-05	-5.75E-33	-0.0985	-0.099
12	0.0049554	-3.54E-05	-7.71E-33	-0.0955	-0.099
12	0.0049548	-3.83E-05	-9.53E-33	-0.0925	-0.099
12	0.0049542	-4.13E-05	-1.89E-32	-0.0895	-0.099
12	0.0049538	-4.44E-05	-8.14E-32	-0.0865	-0.099
12	0.0049534	-4.78E-05	-1.76E-31	-0.0835	-0.099
12	0.0049532	-5.12E-05	-1.59E-31	-0.0805	-0.099
12	0.0049532	-5.49E-05	-5.21E-32	-0.0775	-0.099
12	0.0049533	-5.86E-05	-7.21E-33	-0.0745	-0.099
12	0.0049536	-6.25E-05	-1.43E-32	-0.0715	-0.099
12	0.0049541	-6.64E-05	-1.90E-33	-0.0685	-0.099
12	0.0049548	-7.05E-05	1.63E-32	-0.0655	-0.099
12	0.0049557	-7.46E-05	8.95E-33	-0.0625	-0.099
12	0.0049569	-7.87E-05	-2.26E-33	-0.0595	-0.099
12	0.0049584	-8.32E-05	5.87E-33	-0.0565	-0.099
12	0.00496	 -8.74E-05	1.06E-32	-0.0535	-0.099
12	0.0049621	-9.20E-05	3.85E-33	-0.0505	-0.099
12	0.0049644	-9.64E-05	0	-0.0475	-0.099
12	0.0049669	-0.0001005	0	-0.0445	-0.099
12	0.0049699	-0.00010513	0	-0.0415	-0.099
12	0.004973	-0.00010948	1.55E-25	-0.0385	-0.099
12	0.0049762	-0.00011348	5.22E-25	-0.0355	-0.099
12	0.0049799	-0.00011811	5.61E-25	-0.0325	-0.099
12	0.0049843	-0.00012234	2.04E-25	-0.0295	-0.099
12	0.0049892	-0.00012571	1.26E-25	-0.0265	-0.099
12	0.004994	-0.00012949	3.04E-25	-0.0235	-0.099
12	0.0049988	-0.00013327	2.62E-25	-0.0205	-0.099
12	0.0050044	-0.00013594	7.18E-26	-0.0175	-0.099
12	0.0050105	-0.00013789	5.60E-26	-0.0145	-0.099
12	0.0050165	-0.00013982	1.15E-25	-0.0115	-0.099
12	0.0050225	-0.00014188	8.37E-26	-0.0085	-0.099
12	0.0050287	-0.00014381	3.11E-26	-0.0055	-0.099
12	0.005035	-0.00014523	2.53E-27	-0.0025	-0.099
12	0.0050414	-0.00014604	-9.30E-27	0.0005	-0.099
12	0.005048	-0.00014621	-1.45E-26	0.0035	-0.099
12	0.0050545	-0.00014574	-1.32E-26	0.0065	-0.099
12	0.0050609	-0.00014485	-8.22E-27	0.0095	-0.099
12	0.0050674	-0.00014394	3.45E-26	0.0125	-0.099
12	0.0050738	-0.00014314	1.10E-25	0.0155	-0.099
12	0.0050801	-0.00014208	1.07E-25	0.0185	-0.099
12	0.0050861	-0.00013992	4.41E-26	0.0215	-0.099
12	0.0050916	-0.00013675	2.54E-26	0.0245	-0.099
12	0.0050972	-0.00013401	1.01E-26	0.0275	-0.099
12	0.0051027	-0.00013129	-5.77E-27	0.0305	-0.099
12	0.0051074	-0.00012744	-6.79E-27	0.0335	-0.099
12	0.0051118	-0.00012333	-6.92E-27	0.0365	-0.099
12	0.0051162	-0.00011947	-1.59E-27	0.0395	-0.099
12	0.0051202	-0.0001155	8.96E-35	0.0425	-0.099
12	0.0051238	-0.00011141	8.94E-35	0.0455	-0.099
12	0.0051271	-0.00010719	0	0.0485	-0.099
12	0.0051302	-0.00010282	0	0.0515	-0.099
12	0.0051328	-9.84E-05	0	0.0545	-0.099
12	0.0051352	-9.41E-05	0	0.0575	-0.099
12	0.0051372	-8.97E-05	0	0.0605	-0.099
12	0.0051389	-8.53E-05	0	0.0635	-0.099
12	0.0051403	-8.10E-05	0	0.0665	-0.099
12	0.0051414	-7.69E-05	0	0.0695	-0.099
12	0.0051423	-7.28E-05	0	0.0725	-0.099
12	0.0051429	-6.87E-05	0	0.0755	-0.099
12	0.0051433	-6.48E-05	0	0.0785	-0.099
12	0.0051435	-6.12E-05	0	0.0815	-0.099
12	0.0051435	-5.77E-05	0	0.0845	-0.099
12	0.0051433	-5.43E-05	0	0.0875	-0.099
12	0.005143	-5.11E-05	0	0.0905	-0.099
12	0.0051426	-4.80E-05	0	0.0935	-0.099
12	0.0051421	-4.51E-05	0	0.0965	-0.099
12	0.0051415	-4.24E-05	0	0.0995	-0.099
12	0.004954	-3.31E-05	-2.32E-32	-0.0985	-0.097
12	0.0049534	-3.49E-05	-2.32E-32	-0.0955	-0.097
12	0.0049527	-3.78E-05	2.21E-33	-0.0925	-0.097
12	0.004952	-4.09E-05	2.98E-32	-0.0895	-0.097
12	0.0049515	-4.41E-05	-2.67E-32	-0.0865	-0.097
12	0.004951	-4.76E-05	-1.37E-31	-0.0835	-0.097
12	0.0049507	-5.11E-05	-1.37E-31	-0.0805	-0.097
12	0.0049506	-5.49E-05	-4.34E-32	-0.0775	-0.097
12	0.0049506	-5.87E-05	7.03E-33	-0.0745	-0.097
12	0.0049509	-6.27E-05	1.66E-32	-0.0715	-0.097
12	0.0049513	-6.68E-05	1.73E-32	-0.0685	-0.097
12	0.0049519	-7.10E-05	1.07E-32	-0.0655	-0.097
12	0.0049527	-7.52E-05	5.21E-33	-0.0625	-0.097
12	0.0049539	-7.96E-05	4.01E-33	-0.0595	-0.097
12	0.0049553	-8.42E-05	6.80E-33	-0.0565	-0.097
12	0.0049569	-8.86E-05	6.58E-33	-0.0535	-0.097
12	0.004959	-9.34E-05	2.21E-33	-0.0505	-0.097
12	0.0049613	-9.80E-05	0	-0.0475	-0.097
12	0.0049638	-0.00010229	0	-0.0445	-0.097
12	0.0049668	-0.00010714	0	-0.0415	-0.097
12	0.00497	-0.00011176	-5.72E-26	-0.0385	-0.097
12	0.0049733	-0.00011586	2.44E-26	-0.0355	-0.097
12	0.0049777	-0.0001202	2.54E-25	-0.0325	-0.097
12	0.0049823	-0.00012448	2.91E-25	-0.0295	-0.097
12	0.004987	-0.00012841	3.18E-25	-0.0265	-0.097
12	0.0049921	-0.00013211	3.80E-25	-0.0235	-0.097
12	0.0049974	-0.00013547	2.33E-25	-0.0205	-0.097
12	0.005003	-0.00013851	2.01E-26	-0.0175	-0.097
12	0.0050089	-0.00014134	-5.19E-26	-0.0145	-0.097
12	0.0050149	-0.0001438	3.70E-26	-0.0115	-0.097
12	0.0050213	-0.00014576	9.53E-26	-0.0085	-0.097
12	0.0050277	-0.00014736	1.18E-26	-0.0055	-0.097
..................
................
.............
As you can see from the attached figure, I have rectangular domain of -0.1<X<0.5 & -0.1<Y<0.1 with a staggered mesh of 200*100.
You know data for cell centers shoud be sweept row by row (I don't know you got it what I'm saying!), but there isn't such a way here! So, data extracting starts with bottom left corner and ends to the bottom right corner and so on.

The problem line of data is highlited. By the way it gives me right total number of data, exactly 20000. Screenshot (284).jpg
Furthermore, because of this issue when I make a plt file for tecplot it shows weird contour!
Best
Attached Images
File Type: jpg Screenshot (282).jpg (65.4 KB, 4 views)
Attached Files
File Type: txt New Microsoft Excel Worksheet.txt (9.1 KB, 0 views)
saeed jamshidi is offline   Reply With Quote

Old   January 25, 2024, 06:58
Default
  #10
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Is it because of decomposition?!!!
saeed jamshidi is offline   Reply With Quote

Old   January 25, 2024, 07:04
Default
  #11
Senior Member
 
Saeed Jamshidi
Join Date: Aug 2019
Posts: 214
Rep Power: 7
saeed jamshidi is on a distinguished road
Yeahh it was. I should reconstruct the field.
Screenshot (286).jpg
saeed jamshidi is offline   Reply With Quote

Reply


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
Custom Thermophysical Properties wsmith02 OpenFOAM 4 June 1, 2023 14:30
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 18:13
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 06:42
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41


All times are GMT -4. The time now is 12:02.