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

pimpleFoam compilation error

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

Like Tree1Likes
  • 1 Post By theDailyJones

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 1, 2022, 06:06
Default pimpleFoam compilation error
  #1
New Member
 
Marcin
Join Date: Jun 2022
Posts: 2
Rep Power: 0
marcinm is on a distinguished road
Dear All,

I'm using OF2112 installed on WSL2 version of Ubuntu. I want to create a custom solver based on pimpleFoam, but I have a problem with compilation. To test it, I've copied pimpleFoam directory to my local dir ($WM_PROJECT_USER_DIR/applications/solvers/incompressible), changed everything relevant (names, Make/files), but I did not make any changes in the code. And when I'm trying to wmake the following errors appear:
Code:
In file included from testPimpleFoam.C:82:
CorrectPhi.H:2:1: error: expected constructor, destructor, or type conversion before ‘(’ token
    2 | (
      | ^
In file included from CorrectPhi.H:11,
                 from testPimpleFoam.C:82:
/usr/lib/openfoam/openfoam2112/src/finiteVolume/lnInclude/continuityErrs.H:34:1: error: expected unqualified-id before
{’ token
   34 | {
      | ^
In file included from testPimpleFoam.C:158:
correctPhi.H: In function ‘int main(int, char**)’:
correctPhi.H:1:1: error: ‘CorrectPhi’ was not declared in this scope; did you mean ‘correctPhi’?
    1 | CorrectPhi
      | ^~~~~~~~~~
      | correctPhi

make: *** [/usr/lib/openfoam/openfoam2112/wmake/rules/General/transform:35: Make/linux64GccDPInt32Opt/testPimpleFoam.o] Error 1
I don't understand what's going on here.
From my investigation OF has a problem with similar names of two files: CorrectPhi.H (with capital "C", from $FOAM_SRC/finiteVolume/cfdTools/general/CorrectPhi/CorrectPhi.H) and correctPhi.H (lowercase "c", from pimpleFoam local dir). Both files are included in pimpleFoam (in my version CorrectPhi.H in line 82 and correctPhi.H in line 158).

I found two fixes of the issue:
  • provide full path when including CorrectPhi.H (in my case "/usr/lib/openfoam/openfoam2112/src/finiteVolume/cfdTools/general/CorrectPhi/CorrectPhi.H" or "/usr/lib/openfoam/openfoam2112/src/finiteVolume/lnInclude/CorrectPhi.H", both are working);
  • rename "correctPhi.H" inside pimpleFoam dir and change #include directive inside the PIMPLE algorithm.
After application of any of the fixes, the wmake finishes smoothly and solvers seems to work fine.

But I want to know the reason of this error. It looks strange for me.
marcinm is offline   Reply With Quote

Old   September 1, 2022, 11:12
Default
  #2
New Member
 
Join Date: Sep 2020
Posts: 2
Rep Power: 0
ltaddei is on a distinguished road
I have the same issue with OpenFOAM v9 (Foundation) and by using docker on my MacBook. I use the same solution as you do and I still don't have an explanation... Hope someone will help to understand that
ltaddei is offline   Reply With Quote

Old   February 10, 2023, 09:37
Default
  #3
New Member
 
Jones
Join Date: Sep 2019
Posts: 1
Rep Power: 0
theDailyJones is on a distinguished road
Late to the party but I came across this thread while running into the same issue (v2206, wsl2, ubuntu, win11)

In my case, I had copied the solver files to a working directory that was shared with Windows (somewhere in /mnt/) so Windows' lack of case-sensitivity in file naming was causing a conflict between correctPhi and CorrectPhi at some point either when copying the files or compiling.

Copying to and working from a directory on the wsl machine that wasn't shared with Windows fixed the issue for me.
COCOCO likes this.
theDailyJones 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
Pressure outlet boundary condition rolando OpenFOAM Running, Solving & CFD 62 September 18, 2017 06:45
DPM udf error haghshenasfard FLUENT 0 April 13, 2016 06:35
[OpenFOAM] Native ParaView Reader Bugs tj22 ParaView 270 January 4, 2016 11:39
Compiling problems with hello worldC fw407 OpenFOAM Installation 21 January 6, 2008 17:38
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


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