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

[OpenFOAM.org] unable to source openFOAM under $HOME directory

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By palmerlee

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 6, 2012, 13:03
Default unable to source openFOAM under $HOME directory
  #1
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 14
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, 02:18
Default
  #2
Member
 
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 14
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, 17:51
Default
  #3
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 14
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, 02:52
Default
  #4
Member
 
Join Date: Jun 2011
Posts: 53
Rep Power: 14
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, 04:44
Default
  #5
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 14
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, 05:38
Default
  #6
Member
 
Join Date: Jun 2011
Posts: 53
Rep Power: 14
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 06:19.
blacksquirrel is offline   Reply With Quote

Old   November 8, 2012, 07:38
Default
  #7
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 14
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, 07:57
Default
  #8
Member
 
Join Date: Jun 2011
Posts: 53
Rep Power: 14
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, 08:09
Default
  #9
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 14
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, 08:19
Default
  #10
Member
 
Join Date: Jun 2011
Posts: 53
Rep Power: 14
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, 08:56
Default
  #11
New Member
 
llh
Join Date: Jan 2012
Posts: 22
Rep Power: 14
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, 08:12
Default
  #12
Member
 
Peter
Join Date: Nov 2011
Posts: 46
Rep Power: 14
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
elvis likes this.
palmerlee is offline   Reply With Quote

Old   January 10, 2014, 05:16
Default
  #13
Member
 
Join Date: Jun 2011
Posts: 53
Rep Power: 14
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, 05:28
Default
  #14
Member
 
Peter
Join Date: Nov 2011
Posts: 46
Rep Power: 14
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

Old   November 16, 2016, 22:09
Default
  #15
New Member
 
QuocThien
Join Date: Apr 2013
Posts: 16
Rep Power: 13
neiht is on a distinguished road
All you need is just
0. make sure in etc/bashrc file : foamInstall=$HOME/$WM_PROJECT (no # before)
1. go straight to the .../etc/ directory
2. open the terminal in directory above then type: source bashrc
3. echo $WM_PROJECT_DIR to check
4. Install OpenFoam in the main OpenFOAM directory by ./Allwamke
5. F*** someone to enjoy
neiht is offline   Reply With Quote

Old   October 15, 2019, 02:53
Default OpenFOAM sourcing
  #16
New Member
 
Usama Niaz
Join Date: Oct 2019
Location: Pakistan
Posts: 7
Rep Power: 6
Niazi is on a distinguished road
Hi,
I am installing OpenFOAM 1906 version. right now i am sourcing the OpenFOAM environment through the following command;
source ~/OpenFOAM/OpenFOAM-v1906/etc/bashrc
but i am getting the following error message

No completion added for /home/anonymous/OpenFOAM/OpenFOAM-v1906/platforms/linux64GccDPInt32Opt/bin
... incorrect platform, or not yet compiled?
can any one help? i am not getting it.
Niazi 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
[waves2Foam] Tripping over several build issues with OpenFOAM 2.1.1 Yage OpenFOAM Community Contributions 18 February 15, 2016 02:02
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 11:32
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 05:18


All times are GMT -4. The time now is 04:15.