CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   unable to source openFOAM under $HOME directory (http://www.cfd-online.com/Forums/openfoam-installation/108993-unable-source-openfoam-under-home-directory.html)

lilinghan8 November 6, 2012 14:03

unable to source openFOAM under $HOME directory
 
Dear all,

I would like to modify the solver in openfoam210 but it seems that I cannot make any changes to the files under /opt/
So I moved it to my home directory and add the following line into my $HOME/.bashrc file
source $HOME/openfoam210/etc/bashrc.

Then I run “source $HOME/.bashrc” in the terminal window and these were the information I got:
bash: /opt/openfoam210/bin/foamEtcFile: No such file or directory
bash: /opt/openfoam210/bin/foamCleanPath: No such file or directory
bash: /opt/openfoam210/bin/foamCleanPath: No such file or directory
bash: /opt/openfoam210/bin/foamCleanPath: No such file or directory
bash: /opt/openfoam210/etc/config/settings.sh: No such file or directory
bash: /opt/openfoam210/etc/config/aliases.sh: No such file or directory
bash: /opt/openfoam210/bin/foamEtcFile: No such file or directory
bash: /opt/openfoam210/bin/foamEtcFile: No such file or directory
bash: /opt/openfoam210/bin/foamCleanPath: No such file or directory
bash: /opt/openfoam210/bin/foamCleanPath: No such file or directory
bash: /opt/openfoam210/bin/foamCleanPath: No such file or directory


can anyone please tell to me is there any thing I miss?

Regards,
L

treima November 7, 2012 03:18

Hello,

did you move your hole OpenFOAM folder? In this case you have to compile again...

You can modify solvers in your home folder. You just have to copy the solver into your user directory of OpenFoam, normally
home/<user>/OpenFOAM/<user>-<version>/applications/...

In this case you can modify solvers without a sudo or moving the OpenFOAM installation. It´s like the run directory ;).


regards
treima

lilinghan8 November 7, 2012 18:51

Hi treima,

Thanks for your reply, I moved the whole OpenFOAM folder, How to compile it again?
I type wmake all or ./Allwmake under the new directory in terminal window but it doesnt work. It says that wmake commmand is not found

Regards,
L

blacksquirrel November 8, 2012 03:52

Hello lilinghan,

look into your bashrc.
(gedit $HOME/.bashrc)

there should be written something like:
source /opt/openfoam211/etc/bashrc

change this to your new location of the OpenFOAM folder, e.g.
source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc

source the bashrc again (. $HOME/bashrc) and try ./Allwmake in the OpenFOAM folder
regards,
squirrel

lilinghan8 November 8, 2012 05:44

Hi Squirrel,

Thanks for ur reply, I have done the step that changing the location in bashrc, and when and run "source $HOME/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc" I got the error messages as I mentioned in my post above.

Regards,
L

blacksquirrel November 8, 2012 06:38

Ok, sorry I didn't check the bash file of the OpenFOAM installation.
In /OpenFOAM/OpenFOAM-2.1.0/etc/bashrc file there is written

(line 43)
Code:

# Location of the OpenFOAM installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foamInstall=/opt
# foamInstall=~$WM_PROJECT
# foamInstall=/opt/$WM_PROJECT
# foamInstall=/usr/local/$WM_PROJECT
#

Which means, it still searches your OpenFOAM in the /opt/ directory
So you have two possibilities, I would suggest the first one, because it is less likely to accidentally overwrite a working solver:
1.) you move your whole OpenFOAM directory back to the /opt/ directory and test whether it works again.
Then you create a directory in your home $HOME/OpenFOAM/user-2.1.0
Then you COPY the solver you want to modify from the opt/openfoam into your user directory, but keep a similar directory tree
e.g. simpleFoam would be
copy from /opt/openfoam210/applications/solvers/incompressible/simpleFoam
to $HOME/OpenFOAM/user-2.1.0/applications/solvers/incompressible/simpleFoam

In the copied solver directory edit the Make/files

Code:

EXE = $(FOAM_USER_APPBIN)/mysimpleFoam
compile the solver with wmake,
modify to whatever you want and compile again.
You can use the modified solver with the new name mysimpleFoam (you can name it whatever you like in Make/files, but I would suggest not using the original name).

2. you change in
/OpenFOAM/OpenFOAM-2.1.0/etc/bashrc

to the correct foamInstall directory.
foamInstall = $HOME/$WM_PROJECT

regards
squirrel

lilinghan8 November 8, 2012 08:38

Hi again,

I need to modify the solver and I download a other people's work which is also needed to change the libraries in the original file so I prefer the 2rd method.

I changed the foamInstall directory to
foamInstall=$HOME/$WM_PROJECT

BUt I still got the error message, do i need also change the code:
Code:

#- note the location for later use (eg, in job scripts)
: ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR

Any idea?

Regards,
L

blacksquirrel November 8, 2012 08:57

Ok, this is curious. What do you get, if you type

echo $WM_PROJECT_DIR

and

echo $FOAM_INST_DIR
?

I don't think you need to change the code for FOAM_INST_DIR, because
Code:

#- note the location for later use (eg, in job scripts)
: ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR

sets the $FOAM_INST_DIR to the location of foamInstall.

And you can also compile new libraries with my first method. I'm doing the same, modifying solvers and libraries. It isn't more complicated.

lilinghan8 November 8, 2012 09:09

HI,

one is
/opt/OpenFOAM-2.1.1
and the second is
/opt

blacksquirrel November 8, 2012 09:19

Ok, so there is still the wrong directory.
Let's try the simplest thing: close the terminal and open another one. Try again.
Still the same?

I tried it with my installation and it doesn't change the directory despite sourcing the bash file, but it worked after closing and reopening the terminal.
I'm kinda out of ideas right now, sorry...

lilinghan8 November 8, 2012 09:56

HI,
I close and open a new terminal window, and now it works!

Thanks very much for your replies!

Regards,
L

palmerlee January 9, 2014 09:12

Hi, blacksquirrel!

Here is my situation:
Quote:

hpc@node23:/opt/openfoam201$ echo $WM_PROJECT_DIR
/home/hpc/OpenFOAM/openfoam201
hpc@node23:/opt/openfoam201$ echo $FOAM_INST_DIR
/home/hpc/OpenFOAM
Could you please tell me if there is something wrong and how to fix it?

Regards.
Peter

blacksquirrel January 10, 2014 06:16

Hi Peter,

Please specify your problem. What exactly do you want to do, and what is not working?

Your output means, that the installation directory of OpenFOAM is /home/hpc/OpenFOAM.

If you want to modify a solver and/or library and have the problem, that you don't have the permission to do it in the /opt directory, I strongly recommend possibility 1 of my post from November 8, 2012 11:38.

Regards
squirrel

palmerlee January 10, 2014 06:28

Hi, squirrel!

Thank you for your reply. I try to install OpenFOAM following this instruction: http://www.openfoam.org/archive/2.0....oad/ubuntu.php

I think I have already solved the problem by adding
Quote:

export FOAM_INST_DIR=/opt
into /opt/openfoam201/etc/bashrc file. Thank anyway!

Regards.
Peter


All times are GMT -4. The time now is 12:49.