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

--> FOAM FATAL IO ERROR: problem while reading header for object U

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 8, 2019, 19:40
Cool --> FOAM FATAL IO ERROR: problem while reading header for object U
  #1
Senior Member
 
Brett
Join Date: May 2013
Posts: 212
Rep Power: 13
Bdew8556 is on a distinguished road
Hi fellow Foamers.

This one's a real head scratcher.

So I wrote a batch script in sublime text editor with settings:

view > syntax > batch
view > line endings > Unix

The script is meant to change the volumetric flow rate of a base project that it's copied. See script:



rem #!/bin/bash
@echo off
for /l %%x in (5, 5, 15) do (
echo Starting simulation %%x


cp -rf att_test att_test_%%x

powershell -Command "(gc att_test_%%x/0/U) -replace 'volumetricFlowRate 25;', 'volumetricFlowRate %%x;' | Out-File att_test_%%x/0/U"


cd att_test_%%x

echo pwd

simpleFoam


cd ..

)
echo All done




It copies the base project, changes the volumetric flow rate value and executes simpleFoam.

However it comes back with this error:



Reading field U

--> FOAM Warning :
From function bool Foam::IOobject::readHeader(Foam::Istream&)
in file db/IOobject/IOobjectReadHeader.C at line 88
Reading "C:/OpenFOAM/18.10/AUBD501827-dev/run/att_test_5/0/U" at line 1
First token could not be read or is not the keyword 'FoamFile'

Check header is of the form:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
|*---------------------------------------------------------------------------*|
|* OpenFOAM for Windows 18.10 (v1) *|
|* Built by CFD Support, www.cfdsupport.com (based on Symscape). *|
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //



--> FOAM FATAL IO ERROR:
problem while reading header for object U

file: C:/OpenFOAM/18.10/AUBD501827-dev/run/att_test_5/0/U at line 1.

From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::rea dStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 540.

FOAM exiting



So I copied the suggested header format into one of the copied projects and tried to run it by itself. Same error.
I noticed that the suggested header file is different from header files I've used on other projects, so I tried that header file, again no luck.
I've also tried closing the OpenFoam shell and re loading it, no luck.

Any thoughts????
Bdew8556 is offline   Reply With Quote

Old   November 25, 2021, 08:44
Default
  #2
Member
 
David GISEN
Join Date: Jul 2009
Location: Germany
Posts: 68
Rep Power: 16
David* is on a distinguished road
Make sure the encoding of the faulty file "att_test_5/0/U" is UTF-8 and not UTF-8-BOM [1]. Notepad++ displays encoding in the bottom right corner. This change solved for me the same problem with another dict in OpenFOAM v2012.

Maybe too late for you, but hopefully useful for future readers!

[1]: https://en.wikipedia.org/wiki/Byte_order_mark
David* is offline   Reply With Quote

Reply

Tags
openfoam 1806, shell command, syntax error, unix


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 during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 3 August 27, 2018 04:18
Incompatible dimensions for operation ruben23 OpenFOAM Running, Solving & CFD 2 June 12, 2015 04:14
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 14:11
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 06:51
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 14:00


All times are GMT -4. The time now is 06:40.