CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [blockMesh] error in using #codeStream for making blockMeshDict (https://www.cfd-online.com/Forums/openfoam-meshing/178499-error-using-codestream-making-blockmeshdict.html)

babakflame October 9, 2016 18:12

error in using #codeStream for making blockMeshDict
 
1 Attachment(s)
Dear Fellows
I am trying to use #codeStream in blockMeshDict file to create a simple grid. The following is my blockMeshDict file initial lines:

Code:

convertToMeters 1;

vertices  #codeStream
{
    codeInclude
    #{
        #include "pointField.H"
    #};
    code
    #{
        pointField points(8);
        points[0] = point(0 0 0);
        points[1] = point(2 0 0);
        points[2] = point(2 0.05 0);
        points[3] = point(0 0.05 0);
        points[4] = point(0 0 0.05);   
        points[5] = point(2 0 0.05);
        points[6] = point(2 0.05 0.05);
        points[7] = point(0 0.05 0.05);

        os << points;
    #};
};

blocks
(
    hex (0 1 2 3 4 5 6 7) (280 7 1) simpleGrading (1 1 1)

);

During compilation of grid, it returns the following error:

Code:

home/babak/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/Vector.H:58:7: note:  no known conversion for argument 1 from ‘int’ to ‘const Foam::Vector<double>&’
/home/babak/Desktop/second_version_simulations/Coarse_Grid/X_10/j0_1/constant/polyMesh/blockMeshDict::#codeStream:34:20: error: expected primary-expression before ‘(’ token
/home/babak/Desktop/second_version_simulations/Coarse_Grid/X_10/j0_1/constant/polyMesh/blockMeshDict::#codeStream:34:23: error: expected ‘)’ before numeric constant
make: *** [Make/linux64GccDPOpt/codeStreamTemplate.o] Error 1

Would some one please hint me where did I make mistake in writing #codeStream??

The full blockMeshDict file is attached as well.

The above grid compiles with removing code stream and defining vertices normally:confused::confused:

Regards

babakflame October 9, 2016 18:24

Oh Gosh. Problem Solved.:D:D
points Should be defined like this:

Code:


code
    #{
        pointField points(8);
        points[0] = point(0, 0,      0);
        points[1] = point(2, 0,      0);
        points[2] = point(2, 0.05,    0);
        points[3] = point(0, 0.05,    0);
        points[4] = point(0, 0,    0.05);   
        points[5] = point(2, 0,    0.05);
        points[6] = point(2, 0.05, 0.05);
        points[7] = point(0, 0.05, 0.05);

        os << points;
    #};

I had missed commas inside the parenthesis.


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