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

[blockMesh] Compilation error in OpenFOAM in WSL when using #calc

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2019, 05:58
Default Compilation error in OpenFOAM in WSL when using #calc
  #1
Member
 
Pablo Alarcón
Join Date: Mar 2018
Location: Liège
Posts: 59
Rep Power: 8
palarcon is on a distinguished road
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
(
);

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

Last edited by palarcon; July 19, 2019 at 10:29. Reason: Addition of supplementary information
palarcon is offline   Reply With Quote

Old   November 9, 2019, 18:07
Default
  #2
New Member
 
Ali Amarloo
Join Date: Aug 2018
Posts: 9
Rep Power: 7
Ali Amarloo is on a distinguished road
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 is offline   Reply With Quote

Old   November 9, 2019, 18:19
Default Update
  #3
New Member
 
Ali Amarloo
Join Date: Aug 2018
Posts: 9
Rep Power: 7
Ali Amarloo is on a distinguished road
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
Ali Amarloo is offline   Reply With Quote

Old   November 12, 2019, 05:35
Default
  #4
Member
 
Pablo Alarcón
Join Date: Mar 2018
Location: Liège
Posts: 59
Rep Power: 8
palarcon is on a distinguished road
Quote:
Originally Posted by Ali Amarloo View Post
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.
palarcon is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[blockMesh] blockMesh with parametric mesh. Unusual and unseen problem 13msmemusman OpenFOAM Meshing & Mesh Conversion 1 June 13, 2016 03:25
Drag force coefficient too high for a flow past a cylinder using komega sst Scabbard OpenFOAM Running, Solving & CFD 37 March 21, 2016 17:16
cannot converge a pimpleFoam simulation iper88 OpenFOAM Running, Solving & CFD 1 November 26, 2015 09:04
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 10:04
using #calc in parallel with openFOAM 2.2.2 Pascal_doran OpenFOAM Bugs 5 April 8, 2014 13:44


All times are GMT -4. The time now is 03:53.