|
[Sponsors] |
April 12, 2011, 23:45 |
how to add OpenFoam in module environment
|
#1 |
New Member
Sangmin Park
Join Date: Apr 2011
Posts: 3
Rep Power: 15 |
Hello,
I installed OpenFOAM 1.7.1 in /opt directory on linux cluster and for users, I want to add OpenFOAM in module environment but I don't know how to do it. Module environment has already installed on our system. and I tried to add OpenFOAM by inseting /etc/modulefiles/OpenFOAM/OpenFOAM-1.7.1 file. But, It did not work at all. Here is file I put into. #%Module1.0 ################################################## ################### ## ## Modulefile for OpenFOAM 1.7.1 ## ################################################## ################### proc ModulesHelp { } { puts stderr "OpenFOAM-1.7.1" } module-whatis "sets the environment for OpenFOAM 1.7.1" # for Tcl script use only set topdir /opt/OpenFOAM/OpenFOAM-1.7.1 set version 1.7.1 setenv OpenFOAM_HOME $topdir prepend-path PATH $topdir/bin prepend-path LD_LIBRARY_PATH $topdir/lib and I think I have to put some line about exporting path like source /opt/OpenFOAM/OpenFOAM/etc/bashrc does anyone have idea? thanks in advance. Sangmin |
|
April 26, 2011, 14:02 |
|
#2 |
Member
Niklas Wikstrom
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Hello,
I have the same problem. Have tried with Code:
system("source ..../bashrc") Code:
system "source ..../bashrc" Both gives me a Tcl error. /Niklas Last edited by wikstrom; April 27, 2011 at 02:12. |
|
April 27, 2011, 06:14 |
|
#3 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
You only need a very small number of environmental variables to run OPENFOAM (to compile it you need a whole lot more).
With modules it is easier to simply set the exact environmental variables needed to run and do the compiling in a non-modules environment. I can't recall all the variables needed, but there is no more than 10. The ones I remember: - PATH and LD_LIBRARY_PATH - MPI_BUFFER_SIZE - WM_PROJECT_INST_DIR - WM_PROJECT_DIR - FOAM_SIGFPE & FOAM_SETNAN (optional) Some might be superfluous and there might be one or two missing, but as far as I recall, that's the gist of it. |
|
April 27, 2011, 16:46 |
|
#4 |
Member
Niklas Wikstrom
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Thank's a lot Eugene,
I will sort it out that way. You just saved me from wasting time on tedious scripting... -Niklas |
|
May 12, 2011, 15:00 |
|
#5 |
Member
Niklas Wikstrom
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Might as well post the simplest 'obvious' solution. To prepare the contents of a module file, I just run printenv before and after sourcing OpenFOAM, piping output to two different files. A diff on these combined with sed gives a 90% working OpenFOAM-module file. Then clean up the remaining 10% by hand.
Without fancyness: Code:
printenv > /tmp/env_0 export FOAM_INST_DIR=/opt/OpenFOAM . /opt/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc printenv > /tmp/env_1 diff /tmp/env_?|sed -ne 's/> \(.*\)=\(.*\)/setenv \1\t"\2"/gp' >> moduleFile /N |
|
Tags |
module load, openfoam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CFX11 + Fortran compiler ? | Mohan | CFX | 20 | March 30, 2011 19:56 |
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 | wyldckat | OpenFOAM Announcements from Other Sources | 3 | September 8, 2010 07:25 |
Cross-compiling OpenFOAM 1.6 on Linux for Windows 32 and 64bits with Mingw-w64 | wyldckat | OpenFOAM Announcements from Other Sources | 7 | January 19, 2010 16:39 |
Can someone PLEASE document the development version installation | bernd | OpenFOAM Installation | 76 | November 14, 2008 22:51 |
Getting OpenFOAM to coexist with an existing JAVA VM | nik777 | OpenFOAM Installation | 5 | February 22, 2007 08:21 |