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] Compilation error in OpenFOAM in WSL when using #calc (https://www.cfd-online.com/Forums/openfoam-meshing/219176-compilation-error-openfoam-wsl-when-using-calc.html)

palarcon July 18, 2019 04:58

Compilation error in OpenFOAM in WSL when using #calc
 
Good afternoon everybody

Today something strange happened to me. I tried to launch blockMesh in a simple mesh that uses #calc to compute some coordinates and I got the error showed below. The strange part is that I was able to compile the exact same mesh until this morning, without any modifications. Also, I'm able to use blockMesh in a cluster, namely, the problem only arises in my personal laptop.
If any of you has a clue related to this problem I will be enormously grateful.

Thank you in advance

First error:
Code:

/opt/openfoam5/src/OpenFOAM/lnInclude/scalar.H:44:15: error: ‘Scalar’ was not declared in this scope
 class pTraits<Scalar>
              ^
/opt/openfoam5/src/OpenFOAM/lnInclude/scalar.H:44:21: error: template argument 1 is invalid

Last error:
Code:

--> FOAM FATAL IO ERROR:
Failed wmake "dynamicCode/_9432dc904ef3d3e0c82b64892ec6b07a02820e92/platforms/linux64GccDPInt32Opt/lib/libcodeStream_9432dc904ef3d3e0c82b64892ec6b07a02820e92.so"


file: /mnt/c/Users/pablo/OneDrive/Recherche/Code/OpenFOAM/pablo-5.0/run/plate/system/blockMeshDict from line 17 to line 23.

    From function static void (* Foam::functionEntries::codeStream::getFunction(const Foam::dictionary&, const Foam::dictionary&))(Foam::Ostream&, const Foam::dictionary&)
    in file db/dictionary/functionEntries/codeStream/codeStream.C at line 218.

The blockMeshDict file is the following

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  5                                    |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.001;

xmax 50;
ymax 50;
delta 5;        // elements per milimeter
e 2;                // channel thickness
y1 5;                // distance from the border
y2 #calc "$y1 + $e";
y3 #calc "$ymax - $y1 - $e";
y4 #calc "$ymax - $y1";

ycell1 #calc "$y1*$delta";
ycell2 #calc "$e*$delta";
ycell3 #calc "($ymax - 2*$y2)*$delta";
xcell #calc "$xmax*$delta";

vertices
(
        (0    0    0)        // P0
        ($xmax 0    0)        // P1
        ($xmax $y1  0)        // P2
        ($xmax $y2  0)        // P3
        ($xmax $y3  0)        // P4
        ($xmax $y4  0)        // P5
        ($xmax $ymax 0)        // P6
        (0    $ymax 0)        // P7
        (0    $y4  0)        // P8
        (0    $y3  0)        // P9
        (0    $y2  0)        // P10
        (0    $y1  0)        // P11
        (0    0    0.1)        // P12
        ($xmax 0    0.1)        // P13
        ($xmax $y1  0.1)        // P14
        ($xmax $y2  0.1)        // P15
        ($xmax $y3  0.1)        // P16
        ($xmax $y4  0.1)        // P17
        ($xmax $ymax 0.1)        // P18
        (0    $ymax 0.1)        // P19
        (0    $y4  0.1)        // P20
        (0    $y3  0.1)        // P21
        (0    $y2  0.1)        // P22
        (0    $y1  0.1)        // P23
);

blocks
(
        hex (0 1 2 11 12 13 14 23)  ($xcell $ycell1 1) simpleGrading (1 1 1)
        hex (11 2 3 10 23 14 15 22) ($xcell $ycell2 1) simpleGrading (1 1 1)
        hex (10 3 4 9 22 15 16 21)  ($xcell $ycell3 1) simpleGrading (1 1 1)
        hex (9 4 5 8 21 16 17 20)  ($xcell $ycell2 1) simpleGrading (1 1 1)
        hex (8 5 6 7 20 17 18 19)  ($xcell $ycell1 1) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (9 21 20 8)
        );
    }
       
        outlet
        {
        type patch;
        faces
        (
                        (2 3 15 14)
        );
        }
       
    otherWalls
    {
        type wall;
        faces
        (
            (8 20 19 7)
                        (10 22 21 9)
                        (11 23 22 10)
                        (0 12 23 11)
                        (0 1 13 12)
                        (1 2 14 13)
                        (3 4 16 15)
                        (4 5 17 16)
                        (5 6 18 17)
                        (6 7 19 18)
        );
        }
       
    frontAndBack
    {
        type empty;
        faces
        (
            (0 11 2 1)
                        (11 10 3 2)
                        (10 9 4 3)
                        (9 8 5 4)
                        (8 7 6 5)
                        (12 13 14 23)
                        (23 14 15 22)
                        (22 15 16 21)
                        (21 16 17 20)
                        (20 17 18 19)
        );
    }
);

mergePatchPairs
(
);

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


Ali Amarloo November 9, 2019 17:07

I have the same problem
I have a blockMesh which has "#calc" operator in it. I used it before without any problem. Even if I run the blockMesh with old made folder of dynamicCode, there is still no error.
If I remove the old folder of "dynamicCode" and try to run BlockMesh again. I confront to error that it cannot compile it:

Code:

--> FOAM FATAL IO ERROR:
Failed wmake "dynamicCode/_9dc7a3e8288492d7641ba6678db9c67e97ea139c/platforms/linux64GccDPInt32Opt/lib/libcodeStream_9dc7a3e8288492d7641ba6678db9c67e97ea139c.so"


file: /home/aligiw/Desktop/d/shockTube_mine/system/blockMeshDict from line 17 to line 32.

    From function static void (* Foam::functionEntries::codeStream::getFunction(const Foam::dictionary&, const Foam::dictionary&))(Foam::Ostream&, const Foam::dictionary&)
    in file db/dictionary/functionEntries/codeStream/codeStream.C at line 218.

FOAM exiting


it will be appreciated if anyone could help.

Ali Amarloo November 9, 2019 17:19

Update
 
Update:
After a little search reinstalling "make" worked for me:

Code:

sudo apt-get remove make
sudo apt-get install make

or:

sudo apt-get install --reinstall make


palarcon November 12, 2019 04:35

Quote:

Originally Posted by Ali Amarloo (Post 749347)
Update:
After a little search reinstalling "make" worked for me:

Code:

sudo apt-get remove make
sudo apt-get install make

or:

sudo apt-get install --reinstall make


In my case (and I don't know why) the problem was that OpenFOAM was bugged, namely a lot of files and symbolic links were not present or deleted (or in practice broken symbolics links), so the compiler couldn't find the appropriate files.
To fix it, I had to re-install OpenFOAM and after that everything worked perfectly without further changes on the code itself.


All times are GMT -4. The time now is 08:38.