CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Promlems with compilation of new solver (https://www.cfd-online.com/Forums/openfoam-programming-development/116834-promlems-compilation-new-solver.html)

Galchenko April 26, 2013 02:38

Promlems with compilation of new solver
 
Hello!

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
Code:

wmake
Cheers,

L

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: http://www.openfoam.org/download/git.php

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
Code:

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

Also try
Code:

source etc/bashrc
foamInstallationTest

Cheers,

L

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
Code:

pwd && grep foamInstall OpenFOAMdir/etc/bashrc

Galchenko April 26, 2013 08:32

L, after running this commands I get:
/opt/openfoam210
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
Code:

echo $FOAM_SRC
If the environment variables are really loaded correctly, this should give
/opt/openfoam210/src

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

Hello!

Quote:

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

echo $FOAM_SRC

I get the right directory here.

And after runnint pwd && grep :

# 'foamInstall' below to where OpenFOAM is installed
foamInstall=/opt
# 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'.

So
Code:

$ 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 http://www.cfd-online.com/Forums/ope...und-error.html )

Cheers,

L

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 12:32.