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

stream failure while reading header on line

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 23, 2017, 02:15
Default stream failure while reading header on line
  #1
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
alimea is on a distinguished road
Hi
I made some changes on "laplacian solver" and I wanted to solve a simple problem. but I saw this error:

stream failure while reading header on line 55 of file "/home/drnili/Desktop/laplacianFoam/example/laplacianFoam/test/0/sai" for essential objectsai

Of course the file "sai" in "0" folder doesn't have 55 lines!!
Could you please help me?
alimea is offline   Reply With Quote

Old   January 23, 2017, 03:51
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
floquation will become famous soon enough
If you open any of OpenFoam's case files (e.g. constant/transportProperties, but any file will do), you'll find a header that looks somewhat like:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
As you can see, there is information in this header. OpenFoam needs that information to read the file.

Therefore, you should include the above header (but then adapted for your file, of course). Also mind the OpenFoam version, so do not simply copy my header above, but rather take a header from one of your other case files.
floquation is offline   Reply With Quote

Old   January 23, 2017, 04:17
Default
  #3
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by floquation View Post
If you open any of OpenFoam's case files (e.g. constant/transportProperties, but any file will do), you'll find a header that looks somewhat like:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.0                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
As you can see, there is information in this header. OpenFoam needs that information to read the file.

Therefore, you should include the above header (but then adapted for your file, of course). Also mind the OpenFoam version, so do not simply copy my header above, but rather take a header from one of your other case files.

Dear Kevin
Thanks for your answer.
But I copy a similar header (e.g. the header of T in "0" folder) for the "sai" parameter. so what is the problem?
alimea is offline   Reply With Quote

Old   January 23, 2017, 04:31
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Surely game called "Guess what I have done wrong!" is fascinating and people here like to play it VERY much. Yet, it would be MUCH easier if:

1. You tell a little bit more about `some changes on "laplacian solver"`.
2. Post your sai file.
floquation likes this.
alexeym is offline   Reply With Quote

Old   January 23, 2017, 04:35
Default
  #5
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

Surely game called "Guess what I have done wrong!" is fascinating and people here like to play it VERY much. Yet, it would be MUCH easier if:

1. You tell a little bit more about `some changes on "laplacian solver"`.
2. Post your sai file.


I sent it to you on other question.
Regards
alimea is offline   Reply With Quote

Old   January 23, 2017, 04:43
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

In other question you have posted your modifications. This question is about problem with sai file. And there is no sai file in this thread.
alexeym is offline   Reply With Quote

Old   January 23, 2017, 05:20
Default
  #7
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

In other question you have posted your modifications. This question is about problem with sai file. And there is no sai file in this thread.
This is the file of mylaplacian.C :

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "simpleControl.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "setRootCase.H"

#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"

simpleControl simple(mesh);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nCalculating temperature distribution\n" << endl;

while (simple.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

while (simple.correctNonOrthogonal())
{
solve(fvm::laplacian(sai) == omega);

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return 0;
}


// ************************************************** *********************** //



This is the "createFields.H" :



Info<< "Reading field sai\n" << endl;

volScalarField sai
(
IOobject
(
"sai",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);


Info<< "Reading field omega\n" << endl;

volScalarField omega
(
IOobject
(
"omega",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info<< "Reading field gradU\n" << endl;

volTensorField gradU
(
IOobject
(
"gradU",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

forAll(omega, counter)
{
omega[counter] = gradU[counter].component(tensor::XY) - gradU[counter].component(tensor::YX);
}




Info<< "Reading transportProperties\n" << endl;

IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);


Info<< "Reading diffusivity DT\n" << endl;

dimensionedScalar DT
(
transportProperties.lookup("DT")
);
alimea is offline   Reply With Quote

Old   January 23, 2017, 06:57
Default
  #8
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

In other question you have posted your modifications. This question is about problem with sai file. And there is no sai file in this thread.
The last problem is solved.
Thank you.

I got the "gradU" file from the "100" folder of other solution (it means the results of that solution at 100 second) and paste it in the "0" folder of present problem as an initial condition. The problem was run but no result folder is written in the folder of problem!!
why?
Regards
alimea is offline   Reply With Quote

Old   January 23, 2017, 08:37
Default
  #9
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Cause you do not call runTime.write(). And it seems, you are playing another game called "Randomly put curly brackets and see if your code can be compiled".
alexeym is offline   Reply With Quote

Old   January 24, 2017, 07:50
Default
  #10
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Cause you do not call runTime.write(). And it seems, you are playing another game called "Randomly put curly brackets and see if your code can be compiled".
yes. Thank you
alimea is offline   Reply With Quote

Reply

Tags
header, stream failure


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
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23
OpenFOAM15 installables are incomplete problem with paraFoam tryingof OpenFOAM Bugs 17 December 7, 2008 04:41
Problem of compilation OF 14Allwmake command not found erik_d OpenFOAM Bugs 13 September 13, 2008 21:45
[blockMesh] BlockMeshmergePatchPairs polyTopoChanger benru OpenFOAM Meshing & Mesh Conversion 3 June 29, 2008 21:24
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 15:16


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