CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Read sample tool data (foamfile)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Arnoldinho

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 18, 2012, 11:18
Default Read sample tool data (foamfile)
  #1
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 18
Arnoldinho is on a distinguished road
Hi foamers,

I used the sample tool to sample data on a cuttingPlane for several time steps and variables. To use these ones as boundary conditions I'd now like to save the single variable values from every time step in one big file as a vectorListIOList and scalarListIOList.

Problem: Although I chose "foamfile" as surfaceFormat in sampleDict, only vectorFields and scalarFiels are written out. So the headers are missing. I therefore cannot read them as an e.g. IOField<scalar>:
Quote:
Create mesh for time = 0

timeI: 0 Time = 0
directory: "surfaces/0/cuttingPlane1/scalarField"
--> FOAM Serious Error :
From function IOobject::readHeader(Istream&)
in file db/IOobject/IOobjectReadHeader.C at line 90
Reading "/home/stahlmann/OpenFOAM/stahlmann-1.6-ext/run/scour/cylinder/p_04_cylinder2_vanDriest_delta2.2_step1/surfaces/0/cuttingPlane1/scalarField/k" at line 2
First token could not be read or is not the keyword 'FoamFile'
So how can I read these fields and convert them into scalarFields and vectorFields, to then store them as vectorListIOList and scalarListIOList? By using fstream?

Thanks,
Arne
Arnoldinho is offline   Reply With Quote

Old   March 18, 2012, 16:12
Default
  #2
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 18
Arnoldinho is on a distinguished road
Ok, I think I already got it. Using an IOobject does not seem to be a good idea for reading the files because of the missing header. These files can simply be read using the IFstream which I have not known before, like
Quote:
scalarField readScalar;
IFstream dataStream(directory/scalarList[scalarI]);
dataStream >> readScalar;
with directory and scalarList being the variable folder and variable (file name) in this case (declared beforehand). An IOobject could then be constructed out of these fields.

Arne
mgg likes this.

Last edited by Arnoldinho; March 18, 2012 at 16:33.
Arnoldinho is offline   Reply With Quote

Old   May 14, 2013, 08:04
Default
  #3
Member
 
Dogan
Join Date: Nov 2012
Location: Bochum/Germany
Posts: 42
Rep Power: 14
dogan is on a distinguished road
Hi Arne,

i am receiving the same error message, and because of my so limited programming knowledge, i didn't understand what you meant. Could you please tell me how did you menage to solve this problem? Did you use IFstream instead of IOobject? is it is so, how did you set this in the case directory?

thanks

Dogan
dogan 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
Mesh data to be read by Fortan code seckin Main CFD Forum 8 December 7, 2022 01:58
How to read the data from the graph Kottam Main CFD Forum 2 June 14, 2008 17:46
heat conducting in a solid domain Rogerio Fernandes Brito Siemens 0 March 18, 2008 18:23
How to read a file with inlet velocity data? dorin CFX 13 July 20, 2007 03:16
Read the Mesh data from Gambit David Main CFD Forum 7 September 5, 2000 20:56


All times are GMT -4. The time now is 00:33.