I want to make a transient sim
I want to make a transient simulation of a pipe. on one end, I make the pressure as a function respect to time and write to a file as:
( t0 p0 t1 p1 ... tN pN ) but when I compute it, there is a error: Reading field p --> FOAM FATAL IO ERROR : IOstream::check(const char* operation) : error in IOstream "inletPressure.dat" for operation Istream::operator() file: inletPressure.dat at line 1. Function: IOstream::check(const char* operation) const in file: db/IOstreams/IOstreams/IOcheck.C at line: 54. FOAM exiting what about the error? How to correct? Thanks in advance. |
1. is the file present?
2.
1. is the file present?
2. what boundary condition are you using? timeVaryingUniformFixedValue? Does it work if you remove the bracket pair? I think this b.c. reads an unformatted 2 column file to make it easy to use externally generated data. |
Yes, I use the timeVaryingUnif
Yes, I use the timeVaryingUniformFixedValue.
I removed the bracket pair. there is the same problem. You mean the unformatted 2 column file as binary file? |
Sorry, never used it. I found
Sorry, never used it. I found the actual reading gets done in sampling/lnInclude/graph.C where it constructs the graph from an Istream.
Looks like the format is "title" "x" "y" 0.0 54 0.1 24 0.2 35 or something similar. |
The format of the file read by
The format of the file read by timeVaryingUniformFixedValue is
( t0 p0 t1 p1 ... tN pN ) but the error message you get suggests that the file cannot be found, i.e. is not in the location you specify in the boundary condition details. |
Thank u, H. Weller.
I find
Thank u, H. Weller.
I find the error that u pointed out. I located it in the 0/p fold. i copy it to the caseroot fold. Now It works well. |
Hi,
Foam don't accept this i
Hi,
Foam don't accept this instruction. How can I do this in Foam ------------------- FILE *fp; int i; fp=fopen("filePr","r+"); for(i=0;i<=size;i++) { fscanf(fp,"%f %f %f %f",&pr[5*i],&pr[5*i+1], &pr[5*i+2],&pr[5*i+3]); } fclose(fp); ----------------------------- thanks |
IFstream str("filePr");
sca
IFstream str("filePr");
scalar a,b,c,d; str>> a >> n >> c >> d; |
Hello
For postprocessing pu
Hello
For postprocessing purpose, I am using ifstream to read a file and calculate something called A, which is then wroten in an other file fileName fileV="v.dat"; OFstream VFile(fileV); fileName fileC= "c.dat"; IFstream CFile(fileC); char a;char b; double T1;double T2;scalar C1x;scalar C1y;scalar C1z;scalar C2x;scalar C2y;scalar C2z;scalar A; while(!CFile.eof() ) { CFile>>T1>>a>>C1x>>C1y>>C1z>>b>>T2>>a>>C2x>>C2y>>C 2z>>b; A= ...// Here it calculates A VFile<< T2 << " "<<A<< endl; } It works (read, calculate and write) for all the value in the read-file but then I get the following error: --> FOAM FATAL IO ERROR : Attempt to get back from bad stream file: c.dat at line 124. From function void Istream::getBack(token& t) in file db/IOstreams/IOstreams/Istream.C at line 44. I think that it doesn't understand that it is the end of the file, even with the .eof() Should I close the file (... how?) to avoid this error? Or should the read-file have something special at the end? Thanks Aurelia |
I have a file with the followi
I have a file with the following format.
y1 u1 v1 w1 y2 u2 v2 w2 ... yn un vn wn I know that one can read Field<t> from IStream but how can I read such mixed format to: scalarField y; vectorField u; Is there a way to do it in OpenFOAM or should I write another graph class that accepts such format? thanks. |
Hey Aurelia,
Did you manege to solve you problem? I have got the same error message, when trying to write my data into the file. Cheers |
Hey mattijs,
after using your code snippet Quote:
Code:
--> FOAM FATAL IO ERROR: |
Quote:
|
So, apparently, the problem is, the I am trying to read four values at once, like
Code:
file >> a >> b >> c >> d; My work-around is as follows Code:
file >> a; I don't like the 'niceness' of this solution, so I am open for suggestions. |
All times are GMT -4. The time now is 16:34. |