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

central installation and compiling own sources

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By wyldckat
  • 2 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 19, 2011, 07:32
Default central installation and compiling own sources
  #1
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 15
lindstroem is on a distinguished road
Hi everybody,

I read a lot of different ways of installing OpenFOAM in a central way. But anyhow, I still can't compile my own solvers on my local machine with OF installed centrally because I don't have write permission on the central installation. Do I really need it? Or do I have to change sth in the Make/options etc?

Another question I was thinking about is: I use a Desktop and a Laptop. Both have OF installed. If I now have a personal OF-directory on a network storage could I use them for both installtions? Of course I would run the simulations locally on the machine, but the compiled sources of my own implementations would be present for the connected Computer?

Thanks for your help!
Lindstroem
lindstroem is offline   Reply With Quote

Old   July 19, 2011, 18:19
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Lindstroem,

Quote:
Originally Posted by lindstroem View Post
But anyhow, I still can't compile my own solvers on my local machine with OF installed centrally because I don't have write permission on the central installation. Do I really need it? Or do I have to change sth in the Make/options etc?
Have you ever read the tutorial about adding temperature to icoFoam? Here's an excerpt of the detail you are looking for:
Quote:
Originally Posted by http://openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam
Now go into the Make subdirectory and open the 'files' file with your favorite editor. Change it to read:
Code:
my_icoFoam.C

EXE = $(FOAM_USER_APPBIN)/my_icoFoam
This is also explained here: http://www.openfoam.com/docs/user/co...0-740003.2.2.3

For libraries use $(FOAM_USER_LIBBIN)


________________________________

Quote:
Originally Posted by lindstroem View Post
Another question I was thinking about is: I use a Desktop and a Laptop. Both have OF installed. If I now have a personal OF-directory on a network storage could I use them for both installtions? Of course I would run the simulations locally on the machine, but the compiled sources of my own implementations would be present for the connected Computer?
Well... this is sort of a hidden feature of OpenFOAM... in other words, only those who look at the code and those who went to workshops will figure this one out:
  • You can create a file named prefs.sh where you set some of the environment variables you want to modify, such as where to look for the desired OpenFOAM.
  • This file can reside in one of the following places, with the following order of preference (copy-paste from bin/foamEtcFile):
  1. $HOME/.${WM_PROJECT:-OpenFOAM}/$version
  2. $HOME/.${WM_PROJECT:-OpenFOAM}
  3. $prefixDir/site/$version
  4. $prefixDir/site
  5. $prefixDir/openfoam$versionNum/etc <- for Debian/Ubuntu
    $prefixDir/${WM_PROJECT:-OpenFOAM}-$version/etc <- standard build
Lets see:
  • prefixDir - it's the parent folder of the bin folder where foamEtcFile resides.
  • WM_PROJECT - this variable is usually set to OpenFOAM.
Simply translating, e.g. 1.7.x it searches in these folders:
  1. ~/.OpenFOAM/1.7.x
  2. ~/.OpenFOAM/
  3. ~/OpenFOAM/OpenFOAM-1.7.x/site/1.7.x
  4. ~/OpenFOAM/OpenFOAM-1.7.x/site
  5. /opt/openfoam171/etc <- Debian/Ubuntu for 1.7.1
    ~/OpenFOAM/OpenFOAM-1.7.x/etc <- standard build
  • For more informations about prefs.sh, you can find examples here:
    • For OpenFOAM 1.6/7.x: etc/prefs.sh-EXAMPLE
    • For OpenFOAM 2.0.x: etc/config/example/prefs.sh

So, to sum up, you can create this file "~/.OpenFOAM/1.7.x/prefs.sh" and/or this one "~/.OpenFOAM/2.0.x/prefs.sh" with something like this:
Code:
export FOAM_INST_DIR=/mnt/OpenFOAM/OpenFOAM-version
export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
You can change where WM_PROJECT_USER_DIR points to...


Finally, add this to your "~/.bashrc" file (don't forget to remove/comment other lines in there related to OpenFOAM, if they aren't using alias):
Code:
alias of20x='source /mnt/OpenFOAM/OpenFOAM-2.0.x/etc/bashrc'
________________________________


OK, I probably lost you somewhere... this is an easier way to do the same thing and should be compatible with both versions so add this to your "~/.bashrc" file (don't forget to remove/comment other lines in there related to OpenFOAM, if they aren't using alias):
Code:
alias of20x='export FOAM_INST_DIR=/mnt/OpenFOAM/OpenFOAM-2.0.x; source $FOAM_INST_DIR/etc/bashrc WM_PROJECT_USER_DIR=$FOAM_INST_DIR/myarea'
Then whenever you want OpenFOAM ready at your finger tips, run of20x.

I'm sorry for making things look confusing... but I think it's all explained now

Best regards,
Bruno
songwukong likes this.
__________________

Last edited by wyldckat; July 19, 2011 at 18:20. Reason: found a typo...
wyldckat is offline   Reply With Quote

Old   July 20, 2011, 03:48
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by wyldckat View Post
...
  • This file can reside in one of the following places, with the following order of preference (copy-paste from bin/foamEtcFile):
  1. $HOME/.${WM_PROJECT:-OpenFOAM}/$version
  2. $HOME/.${WM_PROJECT:-OpenFOAM}
  3. $prefixDir/site/$version
  4. $prefixDir/site
  5. $prefixDir/openfoam$versionNum/etc <- for Debian/Ubuntu
    $prefixDir/${WM_PROJECT:-OpenFOAM}-$version/etc <- standard build
...
For those wishing to supply site-wide solvers/libraries, the suggested location would normally be the $FOAM_SITE_APPBIN and $FOAM_SITE_LIBBIN directories. We normally compile into $FOAM_USER_APPBIN, $FOAM_USER_LIBBIN, do some testing and then use rsync to sync to the corresponding $FOAM_SITE_APPBIN and $FOAM_SITE_LIBBIN directories.

Note that these site directories are normally located below $WM_PROJECT_INST_DIR/site, but as of OpenFOAM-2.0 the env variable $WM_PROJECT_SITE can be used to specify another location as desired.
bastil and wyldckat like this.
olesen is offline   Reply With Quote

Old   July 20, 2011, 04:35
Default
  #4
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 15
lindstroem is on a distinguished road
Dear Bruno,

thanks for the very detailed and well explained answer!

Concerning the first part: Yes I did change these paths but still I got some write-permission errors. I can't post them right now, as we now installed it locally, but at least I know it should actually work as I thought. I'll try it again, when the Admin is back. Thanks for the hint!

Quote:
OK, I probably lost you somewhere...
No I'm glad you didn't! As I also work with different OF versions and use several bash-scripts I totally understood what you mean but I did not know about the possibility to give an order of preferences where he should search.

You really helped me a lot!

And thank you as well olesen for your hint!

Best regards
Lindstroem
lindstroem 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
OpenFOAM Installation rclprice OpenFOAM Installation 1 July 21, 2011 16:31
[swak4Foam] compiling funkySetFields/wmake error isa_ OpenFOAM Community Contributions 7 July 8, 2011 04:26
[OpenFOAM] Installation problem with ParaView 3.8.0 on openSUSE 11.2 aero_ ParaView 14 August 2, 2010 18:13
Successful Installation My report quartzian OpenFOAM Installation 2 April 30, 2009 03:59
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07


All times are GMT -4. The time now is 17:01.