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

Unable to compile solver

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 2 Post By Tobi
  • 2 Post By marupio

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 20, 2014, 07:07
Default Unable to compile solver
  #1
Member
 
Join Date: Nov 2014
Posts: 88
Rep Power: 12
hwsv07 is on a distinguished road
Hi Everyone,

So I am customising a solver adapted from simpleFoam and I am trying to compile it to see if it works.

I used wmake in the solver's root directory to attempt to compile it.

Question : Must my solver be placed in OpenFOAM\applications or it can be anywhere on my hdd?

I am receiving errors during compilation but I cannot figure where or what the problem is according to the error.

Code:
SOURCE=MySolver.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-100 -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/turbulenceModels -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/turbulenceModels/incompressible/RAS/RASModel -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/transportModels -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/transportModels/incompressible/singlePhaseTransportModel -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/meshTools/lnInclude -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/fvOptions/lnInclude -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/sampling/lnInclude -IlnInclude -I. -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linuxGccDPOpt/MySolver.o
MySolver.C:36:46: fatal error: incompressible/RASModel/RASModel.H: No such file or directory
 #include "incompressible/RASModel/RASModel.H"
                                              ^
compilation terminated.
make: *** [Make/linuxGccDPOpt/MySolver.o] Error 1
According to the error code, it says RASModel.H does not exist, but I did a search in OpenFoam/src/turbulenceModels/incompressible/RAS/RASModel/ , and RASModel.H is indeed sitting there. I am not sure why wmake is trying to find RASModel.H in .../incompressible/RASModel/, so I checked my Make/files and Make/options, but it seems to be correct?

Code:
MySolver.C

EXE = $(FOAM_APPBIN)/MySolver
Code:
EXE_INC = \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/turbulenceModels \
    -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/fvOptions/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude


EXE_LIBS = \
    -lincompressibleRASModels \
    -lincompressibleTurbulenceModel \
    -lincompressibleTransportModels \
    -lfiniteVolume \
    -lmeshTools \
    -lfvOptions \
    -llduSolvers \
    -lsampling

Could someone help out here please? Thanks.
hwsv07 is offline   Reply With Quote

Old   November 20, 2014, 07:49
Default
  #2
New Member
 
Marcel Vonlanthen
Join Date: Nov 2012
Location: Zurich, Switzerland
Posts: 28
Rep Power: 14
Sylv is on a distinguished road
Hello hwsv07,

Quote:
Question : Must my solver be placed in OpenFOAM\applications or it can be anywhere on my hdd?
No, you can put your solver anywhere on your HDD. To do so, just modify your MAKE/file as:

Code:
mySolver.C

EXE = $(FOAM_USER_APPBIN)/MySolver
Concerning you compiling error, have you tried to write simply
Code:
#include "RASModel.H"
instead of

Code:
#include "incompressible/RASModel/RASModel.H"
Not sure about the error, but it should work just with RASModel.H as include....


Cheers,
Marcel
Sylv is offline   Reply With Quote

Old   November 20, 2014, 08:33
Default
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Simple error,

as Sylv told you, you have to include the header files like that:
Code:
#include "FooBar.H"   // correct
#include "path/to/foobar.H" // wrong
Cheers
mizzou and Turin Turambar like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   November 30, 2014, 14:50
Default
  #4
Member
 
Join Date: Nov 2014
Posts: 88
Rep Power: 12
hwsv07 is on a distinguished road
Thanks Tobi and Syvl.


I tried to compile again. But I now receive these errors:


Code:
Making dependency list for source file mySolver.C
could not open file readSIMPLEControls.H for source file mySolver.C due to No such file or directory
could not open file initConvergenceCheck.H for source file mySolver.C due to No such file or directory
could not open file convergenceCheck.H for source file mySolver.C due to No such file or directory
SOURCE=mySolver.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-100 -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/turbulenceModels -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/turbulenceModels/incompressible/RAS/RASModel -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/transportModels -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/transportModels/incompressible/singlePhaseTransportModel -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/meshTools/lnInclude -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/fvOptions/lnInclude -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/sampling/lnInclude -IlnInclude -I. -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude -I/home/user/OpenFOAM/OpenFOAM-2.3.0/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linuxGccDPOpt/mySolver.o
mySolver.C:67:34: fatal error: readSIMPLEControls.H: No such file or directory
   #include "readSIMPLEControls.H"
                                  ^
compilation terminated.
it seems like it is looking for readSIMPLEControls.H , initConvergenceCheck.H and convergenceCheck.H.

I am creating this solver out of a paper i read somewhere. apparently they were created in OF 1.5, but Im using the latest 2.3.0 now.

are these 3 H files not standard of OpenFoam? where can I get them and where should i place them?
hwsv07 is offline   Reply With Quote

Old   June 16, 2016, 17:17
Default
  #5
New Member
 
mayank bhuwal
Join Date: Jun 2016
Posts: 3
Rep Power: 10
mayankbhuwal89 is on a distinguished road
Well exactly the same problem I am also facing

sclsVOFFoamsf.C:46:29: fatal error: turbulenceModel.H: No such file or directory
#include "turbulenceModel.H"
^
compilation terminated.
make: *** [/home/mayank/OpenFOAM/OpenFOAM-3.0.1/platforms/linux64GccDPInt32Opt/applications/solvers/multiphase/sclsVOFFoamsf/sclsVOFFoamsf.o] Error 1


i can see turbulenceModel.H header file present in the src
mayankbhuwal89 is offline   Reply With Quote

Old   June 17, 2016, 13:16
Default
  #6
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
You should also check the Make/options to see what lnInclude folders are included. I think the turbulenceModel.H has a name collision, so you might have to include "compressible/turbulenceModel.H" or "incompressible/turbulenceModel.H"
linyanx and saatt like this.
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   February 21, 2018, 06:32
Default Similar Problem
  #7
New Member
 
Riccardo
Join Date: Jan 2016
Posts: 16
Rep Power: 10
RANSES is on a distinguished road
Hello,
I've an analogous problem when I compile my code. In this regard, I don't face this problem if I source/use OpenFoam 2.3.0. While I get it if I refer to an older version (OpenFoam 4.x i.e.).
The error is the following one:

ABLkEpsilonMarker.H:70:22: fatal error: RASModel.H: No such file or directory
#include "RASModel.H"

Indeed I found the RASModel.H file in the directory "OpenFOAM-4.x/src/TurbulenceModels/turbulenceModels/RAS/RASModel/" . Do you have any idea on the reason of this error and any suggestion on how I could solve it?
RANSES is offline   Reply With Quote

Old   February 21, 2018, 06:34
Default
  #8
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
You have to tell the compile the path in which it should search for the file. The path is easy to figure out by using
Code:
find -iname "RASModel.H"
Tha appropriate location has to be added to the options file.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 21, 2018, 09:23
Default
  #9
Member
 
Anurag
Join Date: Aug 2014
Location: Germany
Posts: 57
Rep Power: 12
anuragm is on a distinguished road
Quote:
Originally Posted by RANSES View Post
Hello,
I've an analogous problem when I compile my code. In this regard, I don't face this problem if I source/use OpenFoam 2.3.0. While I get it if I refer to an older version (OpenFoam 4.x i.e.).
The error is the following one:

ABLkEpsilonMarker.H:70:22: fatal error: RASModel.H: No such file or directory
#include "RASModel.H"

Indeed I found the RASModel.H file in the directory "OpenFOAM-4.x/src/TurbulenceModels/turbulenceModels/RAS/RASModel/" . Do you have any idea on the reason of this error and any suggestion on how I could solve it?
I think the newer versions of OpenFOAM have done away with hard-coded RASModel.H/LESModel.H in lieu of "turbulentTransportModel.H"

As an example, compare line number 39 of multiphaseEulerFoam.C b/w OF2.3 and OF4

OF2.3:
Code:
 #include "LESModel.H"
OF4.x:
Code:
#include "turbulentTransportModel.H"
anuragm is offline   Reply With Quote

Old   February 21, 2018, 09:54
Default
  #10
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
How you will get your library ready is up to you and is related to the functionality you are going to build. However, I agree to use the appropriate format which is used in the current version one is using. As one can see with the turbulentTransportModel.H header, all the other classes are included; Doxygen is your friend (here Foam-dev). So by using the way Anurag is mentioning, you should solve your problem but you also can just include the RASModel.H. At the end it does not matter which way you go. The only important thing is, that you tell your compiler everything that it needs.


turbulentTransportModel_8H__incl.png
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 21, 2018, 10:41
Default
  #11
New Member
 
Riccardo
Join Date: Jan 2016
Posts: 16
Rep Power: 10
RANSES is on a distinguished road
Quote:
Originally Posted by Tobi View Post
How you will get your library ready is up to you and is related to the functionality you are going to build. However, I agree to use the appropriate format which is used in the current version one is using. As one can see with the turbulentTransportModel.H header, all the other classes are included; Doxygen is your friend (here Foam-dev). So by using the way Anurag is mentioning, you should solve your problem but you also can just include the RASModel.H. At the end it does not matter which way you go. The only important thing is, that you tell your compiler everything that it needs.
Quote:
Originally Posted by anuragm View Post
I think the newer versions of OpenFOAM have done away with hard-coded RASModel.H/LESModel.H in lieu of "turbulentTransportModel.H"
Thank you for your kind replies. They were extremely useful. I have to say I'm still struggling with the OpenFOAM learning process and there is a lot I don't know and I don't properly understand.
Giving a look to the different version OF folders, in 2.3.0 the RASModel.H file is located in "turbulenceModels/incompressible/RAS/RASModel". While in the most recent ones it's located in "TurbulenceModels/turbulenceModels/RAS/RASModel". Thus, I don't know how this could affect the overall code structure (considering it is quite complicated and it was written for 2.3.0 version and I would like to run it into 4.x) and how to account for incompressibility when dealing with more recent version of OpenFOAM.
RANSES is offline   Reply With Quote

Reply


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
How to compile a new solver in OpenFOAM-2.1.0? sandy OpenFOAM Programming & Development 24 July 27, 2016 05:10
Quarter Burner mesh with periosic condition SamCanuck FLUENT 2 August 31, 2011 12:34
Working directory via command line Luiz CFX 4 March 6, 2011 21:02
How to compile an unsteady solver based on solver of MRFSimpleFoam? renyun0511 OpenFOAM Running, Solving & CFD 0 April 27, 2010 12:16
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 15:08


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