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

How to read .txt data used by sampleDict?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 9, 2013, 14:53
Default How to read .txt data used by sampleDict?
  #1
Member
 
Ye Zhang
Join Date: Dec 2009
Location: Delft,Netherland
Posts: 92
Rep Power: 16
kiddmax is on a distinguished road
Dear Foamers.

I want to use sampleDict to get the velocity on a line. Since there are too many lines I need to plot, therefore it is challenging to input the start point and end point by hands. I got the coordinates of all the points in .txt file (x,y,z). Do you know how to read these data in sampleDict? I think we need a loop to use all these points, right? I really appreciate someone can give some hints!

Thank you!

Best regards,
Ye
kiddmax is offline   Reply With Quote

Old   October 11, 2013, 02:46
Default
  #2
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
i have two ideas for doing this:

1- OpenFOAM features called as code stream
2- write a bash-script to import such data using sed
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   October 11, 2013, 11:26
Default
  #3
Member
 
Ye Zhang
Join Date: Dec 2009
Location: Delft,Netherland
Posts: 92
Rep Power: 16
kiddmax is on a distinguished road
Thank you, Nima!

I will try that later!

Ye
kiddmax is offline   Reply With Quote

Old   October 11, 2013, 18:14
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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!

@Ye: If you don't manage to figure this out by yourself, please share an example of 2-3 lines in the TXT form, as well as the resulting "sampleDict" script you expect to get from said TXT file. I ask this because it'll be a lot easier to make any script once the materials are available.

As for scripting, it could be done with any number of possible tools, such as:
  • Creating an OpenFOAM utility that would read the TXT file and output the "sampleDict" file.
  • Using sed, grep, awk and any additional set of shell applications, which can be used for parsing the TXT file and outputting the ready-to-be-used "sampleDict".
  • Or even... one simple language, that can do it all and more: Python
Best regards,
Bruno
__________________
wyldckat 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
problem when converting mesh (made by ICEM) using fluentMeshToFoam Forrest_Lei OpenFOAM 11 October 16, 2009 06:28
Could CFX5.7 read CFX11.0's data? Andy Chen CFX 4 September 1, 2009 22:56
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 17:27
Tecplot can't read data file from Fluent. stephen FLUENT 8 November 21, 2001 20:27
Read the Mesh data from Gambit David Main CFD Forum 7 September 5, 2000 19:56


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