CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Promlems with compilation of new solver (

Galchenko April 26, 2013 02:38

Promlems with compilation of new solver

I installed OpenFoam on my computer and everything worked fine. Now I want to implement new solver and when I try to compile it(I use Allwmake in OpenFoam/application directory) I get such an error:

tesla0@tesla0-desktop:/opt/openfoam210$ sudo ./Allwmake
./Allwmake: 9: wmakeCheckPwd: not found
Error: Current directory is not $WM_PROJECT_DIR
The environment variables are inconsistent with the installation.
Check the OpenFOAM entries in your dot-files and source them.

Though my wmakeCheckPwd file is located in make directory, as it should be, I suppose.
My enviroment variables for OpenFoam are set(including WM_PROJECT_DIR).
if I try to run Allwmake in main OpenFoam installation directory I get the same error.
So I am really puzzled what to do with this.
Do I have to set any extra enviroment variables? Or maybe there is something else?

My version of OpenFoam is 2.1.0, gcc 4.4.3, ubuntu 10.04

Best regards, Olga

akidess April 26, 2013 03:19

I'm guessing WM_PROJECT_DIR is set to something in your home folder (check with "echo $WM_PROJECT_DIR"). Instead of compiling using sudo, better just compile as a regular user in WM_PROJECT_DIR.

- Anton

Lieven April 26, 2013 03:44

Hi Galchenko,

You shouldn't have copied the Allwmake file from the main installation dir (based on the error you get, I'm pretty sure this is what you did.

But if it is only one solver you are compiling, there is no need for a Allwmake script. Instead, just make sure you have a Make-folder with the proper 'files' and 'options' in the same directory as the source files of the new solver and simply type



Galchenko April 26, 2013 04:22

Thanks a lot for your quick replies)

Anton, I've checked this and this variable is set as opt/openfoam210, do I understant right that it is not user's directory?

And I have to use sudo, because if not I get an error
mkdir: cannot create folder "linux64GccDPOpt": permission denied
So I have problems with user's rights

L, But I didn't copy allwmake, I tried to run it from main directory..
When I try to run wmake in the directory of the solver I get an error:

sudo: wmake: command not found
Though I have Make-folder with proper files..

Best regards, Olga

akidess April 26, 2013 07:24

Right, that's ok. WM_PROJECT_USER_DIR is where you should put your cases and self-made applications. And if OpenFOAM is properly configured you should just have to type wmake as Lieven mentioned, no need for Allwmake. Did you source etc/bashrc before trying to compile?

Galchenko April 26, 2013 08:11

Yes, I did everything about setting variables again as it is mentioned in the instruction:

I'm not sure my OpenFoam is configured properly. When I run foamInstallationTest, I get

FATAL ERROR: OpenFOAM environment not configured

But I can't catch what I'm missing, as I followed the instructions..
And I checked enviromental variables - all of them were set well.
Should I configure smth else?

akidess April 26, 2013 08:19

Are you aware that you have to source the configurations file every time you want to use OpenFOAM in a new shell? Do this by executing "source /opt/openfoam210/etc/bashrc", and then check if foamInstallationTest still reports an error.

Lieven April 26, 2013 08:22

Ok, open a terminal, go to the installation folder and type

pwd && grep foamInstall bashrc
and copy the output here.

Also try

source etc/bashrc



Galchenko April 26, 2013 08:24

I did as you said, but nothing changed and I got the same error..

Lieven April 26, 2013 08:28

Could you first please copy the output from

pwd && grep foamInstall OpenFOAMdir/etc/bashrc

Galchenko April 26, 2013 08:32

L, after running this commands I get:
grep: opt/openfoam210/etc/bashrc: no such file or directory

though this file exists in this directory..

Lieven April 26, 2013 08:42

You forgot the first '/':

grep foamInstall /opt/openfoam210/etc/bashrc

Lieven April 26, 2013 08:46

Also see what the output is of

echo $FOAM_SRC
If the environment variables are really loaded correctly, this should give

Galchenko April 26, 2013 09:36

Really thanks for your recomendations. I'll try them next week and write what I get.

Regards, Olga

Galchenko April 30, 2013 02:12



Originally Posted by Lieven (Post 423340)
Also see what the output is of

echo $FOAM_SRC

I get the right directory here.

And after runnint pwd && grep :

# 'foamInstall' below to where OpenFOAM is installed
# foamInstall=~$WM_PROJECT
# foamInstall=/opt/$WM_PROJECT
# foamInstall=/usr/local/$WM_PROJECT
: ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
unset cleaned foamClean foamInstall foamOldDirs

Lieven April 30, 2013 03:11

It just occurred to me that the environment variables probably get lost when you use 'sudo'.


$ sudo su -
$ cd /opt/openfoam210/
$ source etc/bashrc
$ Allwmake

will probably work.

However, if it goal is to compile a custom solver, I would strongly recommend you to put it somewhere in the home-directory and not in the /opt/openfoam210 - folder so you can compile it without the sudo-command. This will cause problems at a later stage (check out )



Galchenko April 30, 2013 07:17

It workes!!!!!

Thanks a lot) Your help was really irreplaceable!

Regards, Olga

All times are GMT -4. The time now is 00:58.