CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

how to extract foamCalc data to Excel ?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 26, 2015, 14:17
Default how to extract foamCalc data to Excel ?
  #1
New Member
 
Join Date: Apr 2015
Posts: 9
Rep Power: 2
khalifa is on a distinguished road
Hi . I am using the function FoamCal to measure the temperature for all time steps, However, this function present the results on the terminal, and I would appreciate if someone tell me how to extract these data to Csv file or so.

another related question, how can I plot the temperature over time directly from paraView ?

Thanks.
khalifa is offline   Reply With Quote

Old   June 26, 2015, 18:04
Default
  #2
New Member
 
Cory
Join Date: Jun 2015
Posts: 5
Rep Power: 2
cgerrity is on a distinguished road
From paraView, you can just select "file" and save data. It gives the option to save as csv files, which Excel should be able to parse.
cgerrity is offline   Reply With Quote

Old   June 26, 2015, 18:11
Default
  #3
New Member
 
Join Date: Apr 2015
Posts: 9
Rep Power: 2
khalifa is on a distinguished road
Quote:
Originally Posted by cgerrity View Post
From paraView, you can just select "file" and save data. It gives the option to save as csv files, which Excel should be able to parse.
Thank you for your reply.

I did that and selected " Write all time steps ", However, an independent csv file for each time was created which is not practical for me as I want to plot the temperature against time.

any other suggestion about how can I have all data for different time steps saved in the same file ?
khalifa is offline   Reply With Quote

Old   June 26, 2015, 18:45
Default
  #4
New Member
 
Cory
Join Date: Jun 2015
Posts: 5
Rep Power: 2
cgerrity is on a distinguished road
Quote:
Originally Posted by khalifa View Post
Thank you for your reply.

I did that and selected " Write all time steps ", However, an independent csv file for each time was created which is not practical for me as I want to plot the temperature against time.

any other suggestion about how can I have all data for different time steps saved in the same file ?
You could concatenate the files together if you want them in one file. The linux terminal syntax is

Code:
cat foo1.csv foo2.csv foo3.csv > newfoo.csv
cgerrity is offline   Reply With Quote

Old   June 26, 2015, 19:36
Default
  #5
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Magdeburg/Geneva
Posts: 176
Blog Entries: 1
Rep Power: 7
Linse is on a distinguished road
I do not know the foamCalc output. But if it prints the information to the screen, it also can be printed into a file. Probably your shell has all the needed tools already installed:

If you want the output of foamCalc into a file instead of the screen:
"foamCalc someoptionsorparameters > outputfile"

If you want only lines with a certain content of the foamCalc output to be printed into a file:
"foamCalc someoptionsorparameters | grep selectioncontent > outputfile"

Of course there might be better solutions for your case! But these probably would be my first attempts.
Linse is offline   Reply With Quote

Old   June 27, 2015, 02:53
Default
  #6
New Member
 
Join Date: Apr 2015
Posts: 9
Rep Power: 2
khalifa is on a distinguished road
Quote:
Originally Posted by cgerrity View Post
You could concatenate the files together if you want them in one file. The linux terminal syntax is

Code:
cat foo1.csv foo2.csv foo3.csv > newfoo.csv
Thank you for your reply. this is actually helpful but unfortunately I have too many time steps and therefore files and its almost impossible to use this. Thanks anyways
khalifa is offline   Reply With Quote

Old   June 27, 2015, 02:54
Default
  #7
New Member
 
Join Date: Apr 2015
Posts: 9
Rep Power: 2
khalifa is on a distinguished road
Quote:
Originally Posted by Linse View Post
I do not know the foamCalc output. But if it prints the information to the screen, it also can be printed into a file. Probably your shell has all the needed tools already installed:

If you want the output of foamCalc into a file instead of the screen:
"foamCalc someoptionsorparameters > outputfile"

If you want only lines with a certain content of the foamCalc output to be printed into a file:
"foamCalc someoptionsorparameters | grep selectioncontent > outputfile"

Of course there might be better solutions for your case! But these probably would be my first attempts.

Thank you for your reply. this was actually really helpful. But I still need to have the output in csv format.
khalifa is offline   Reply With Quote

Old   June 29, 2015, 17:19
Default
  #8
New Member
 
Cory
Join Date: Jun 2015
Posts: 5
Rep Power: 2
cgerrity is on a distinguished road
Quote:
Originally Posted by khalifa View Post
Thank you for your reply. this is actually helpful but unfortunately I have too many time steps and therefore files and its almost impossible to use this. Thanks anyways
You could write a bash script to concatenate them all using a for loop. Or if you don't like bash, you (perhaps inelegantly) could print all of the "cat foo1 foo2.... > foofinished" using python and copy paste it into terminal.
cgerrity is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 17 February 11, 2015 10:47
extract the data subhas.hunasikatti@gmail. CFX 1 October 24, 2013 02:46
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) cfdonline2mohsen OpenFOAM 3 October 21, 2013 09:28
Extract Data from Polyline in a Macro (Tecplot) Joe Main CFD Forum 0 September 5, 2008 03:46
Extract Data from Polyline in a Macro Joe Main CFD Forum 0 September 5, 2008 03:45


All times are GMT -4. The time now is 13:23.