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

unable to source openFOAM under $HOME directory

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 6, 2012, 14:03
Default unable to source openFOAM under $HOME directory
  #1
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 5
lilinghan8 is on a distinguished road
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
lilinghan8 is offline   Reply With Quote

Old   November 7, 2012, 03:18
Default
  #2
Member
 
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 5
treima is on a distinguished road
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
treima is offline   Reply With Quote

Old   November 7, 2012, 18:51
Default
  #3
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 5
lilinghan8 is on a distinguished road
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
lilinghan8 is offline   Reply With Quote

Old   November 8, 2012, 03:52
Default
  #4
Member
 
Join Date: Jun 2011
Posts: 52
Rep Power: 6
blacksquirrel is on a distinguished road
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
blacksquirrel is offline   Reply With Quote

Old   November 8, 2012, 05:44
Default
  #5
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 5
lilinghan8 is on a distinguished road
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
lilinghan8 is offline   Reply With Quote

Old   November 8, 2012, 06:38
Default
  #6
Member
 
Join Date: Jun 2011
Posts: 52
Rep Power: 6
blacksquirrel is on a distinguished road
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

Last edited by blacksquirrel; November 8, 2012 at 07:19.
blacksquirrel is offline   Reply With Quote

Old   November 8, 2012, 08:38
Default
  #7
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 5
lilinghan8 is on a distinguished road
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
lilinghan8 is offline   Reply With Quote

Old   November 8, 2012, 08:57
Default
  #8
Member
 
Join Date: Jun 2011
Posts: 52
Rep Power: 6
blacksquirrel is on a distinguished road
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.
blacksquirrel is offline   Reply With Quote

Old   November 8, 2012, 09:09
Default
  #9
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 5
lilinghan8 is on a distinguished road
HI,

one is
/opt/OpenFOAM-2.1.1
and the second is
/opt
lilinghan8 is offline   Reply With Quote

Old   November 8, 2012, 09:19
Default
  #10
Member
 
Join Date: Jun 2011
Posts: 52
Rep Power: 6
blacksquirrel is on a distinguished road
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...
blacksquirrel is offline   Reply With Quote

Old   November 8, 2012, 09:56
Default
  #11
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 5
lilinghan8 is on a distinguished road
HI,
I close and open a new terminal window, and now it works!

Thanks very much for your replies!

Regards,
L
lilinghan8 is offline   Reply With Quote

Old   January 9, 2014, 09:12
Default
  #12
Member
 
Peter
Join Date: Nov 2011
Posts: 45
Rep Power: 5
palmerlee is on a distinguished road
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
palmerlee is offline   Reply With Quote

Old   January 10, 2014, 06:16
Default
  #13
Member
 
Join Date: Jun 2011
Posts: 52
Rep Power: 6
blacksquirrel is on a distinguished road
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
blacksquirrel is offline   Reply With Quote

Old   January 10, 2014, 06:28
Default
  #14
Member
 
Peter
Join Date: Nov 2011
Posts: 45
Rep Power: 5
palmerlee is on a distinguished road
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
palmerlee is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
wmake compiling new solver mksca OpenFOAM Programming & Development 13 August 18, 2014 22:26
install OpenFoam 1.6 by building source: how? niudie OpenFOAM Installation 13 April 26, 2011 00:48
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 18:18
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 03:01
Version 15 on Mac OS X gschaider OpenFOAM Installation 120 December 2, 2009 11:23


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