CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   the problem regarding boundarydata importing (https://www.cfd-online.com/Forums/openfoam-solving/237726-problem-regarding-boundarydata-importing.html)

qi.yang@polimi.it August 1, 2021 09:41

the problem regarding boundarydata importing
 
Hi guys, I am using OPENFOAM-Extend4.1 and I need to import boundarydata. As shown below, the pressure file is included by using #include command. However, when I run the simulation, the error appearred. Do you have any idea?
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | foam-extend: Open Source CFD                    |
|  \\    /  O peration    | Version:    4.1                                |
|  \\  /    A nd          | Web:        http://www.foam-extend.org        |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      scalarAverageField;
    object      values;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Average
0

// Data on points
#include "p.data"

Code:

--> FOAM FATAL IO ERROR:
incorrect first token, expected <int> or '(', found on line 21 the word '#include'

and the p.data is as following,
Code:

400
(
97692.8
97769.8
97847.8
97926.4
98005.3
98084.3
98162.8
.....
)

In fact, the simulation can be run successfully if the pressure file reads below.
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | foam-extend: Open Source CFD                    |
|  \\    /  O peration    | Version:    4.1                                |
|  \\  /    A nd          | Web:        http://www.foam-extend.org        |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      scalarAverageField;
    object      values;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Average
0

// Data on points
400
(
-233.563
-156.563
-78.563
0.037
78.937
157.937
...
)


petros August 1, 2021 10:25

Hi,

I have experienced this in the past and I don't know why this error occurs. But the question is: why don't you just use the second format, which actually works? At least, this is what I did in the end.

Best,
Petros

qi.yang@polimi.it August 1, 2021 11:01

Quote:

Originally Posted by petros (Post 809477)
Hi,

I have experienced this in the past and I don't know why this error occurs. But the question is: why don't you just use the second format, which actually works? At least, this is what I did in the end.

Best,
Petros

Hi Petros,

Yes, the second format definitely works but I need to arrange a lot of files manually, which takes a long time since I don't know if it is possible to use Matlab for writing a script of allowing writing pressure data append a basic empty file with a header.

qi.yang@polimi.it August 4, 2021 04:47

Does anyone have ideas?


All times are GMT -4. The time now is 18:21.