1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 #------------------------------------------------------------------------------
9 # This file is part of OpenFOAM.
11 # OpenFOAM is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 # Startup file for OpenFOAM
29 # Sourced from OpenFOAM-??/etc/cshrc
31 #------------------------------------------------------------------------------
34 alias _foamAddPath 'setenv PATH \!*\:${PATH}'
35 # prefix to LD_LIBRARY_PATH
36 alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
38 alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
40 # location of the jobControl directory
41 setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl
44 setenv WM_DIR $WM_PROJECT_DIR/wmake
45 setenv WM_LINK_LANGUAGE c++
46 setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
49 setenv FOAM_APP $WM_PROJECT_DIR/applications
50 setenv FOAM_APPBIN $WM_PROJECT_DIR/applications/bin/$WM_OPTIONS
51 setenv FOAM_LIB $WM_PROJECT_DIR/lib
52 setenv FOAM_LIBBIN $WM_PROJECT_DIR/lib/$WM_OPTIONS
53 setenv FOAM_SRC $WM_PROJECT_DIR/src
55 # shared site configuration - similar naming convention as ~OpenFOAM expansion
56 setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/bin/$WM_OPTIONS
57 setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/lib/$WM_OPTIONS
60 setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
61 setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
64 setenv FOAM_TUTORIALS $WM_PROJECT_DIR/tutorials
65 setenv FOAM_UTILITIES $FOAM_APP/utilities
66 setenv FOAM_SOLVERS $FOAM_APP/solvers
67 setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
69 # add OpenFOAM scripts and wmake to the path
70 setenv PATH ${WM_DIR}:${WM_PROJECT_DIR}/bin:${PATH}
72 _foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
73 # Make sure to pick up dummy versions of external libraries last
74 _foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_LIBBIN}/dummy
78 unset gcc_version gmp_version mpfr_version mpc_version
79 unsetenv MPFR_ARCH_PATH
82 # Select compiler installation
83 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84 # compilerInstall = OpenFOAM | system
85 if ( ! $?compilerInstall ) set compilerInstall=system
87 switch ("$compilerInstall")
89 switch ("$WM_COMPILER")
91 set gcc_version=gcc-4.4.3
92 set gmp_version=gmp-5.0.1
93 set mpfr_version=mpfr-2.4.2
96 set gcc_version=gcc-4.5.0
97 set gmp_version=gmp-5.0.1
98 set mpfr_version=mpfr-2.4.2
99 set mpc_version=mpc-0.8.1
102 set gcc_version=gcc-4.4.3
103 set gmp_version=gmp-5.0.1
104 set mpfr_version=mpfr-2.4.2
107 set gcc_version=gcc-4.3.3
108 set gmp_version=gmp-4.2.4
109 set mpfr_version=mpfr-2.4.1
113 echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
114 echo " Unknown OpenFOAM compiler type '$WM_COMPILER'"
115 echo " Please check your settings"
120 if ( $?gcc_version ) then
121 set gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
122 set gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
123 set mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
124 if ( $?mpc_version ) then
125 set mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
128 # Check that the compiler directory can be found
129 if ( ! -d "$gccDir" ) then
131 echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
132 echo " Cannot find $gccDir installation."
133 echo " Please install this compiler version or if you wish to use the system compiler,"
134 echo " change the 'compilerInstall' setting to 'system' in this file"
138 _foamAddMan $gccDir/man
139 _foamAddPath $gccDir/bin
141 # 64-bit needs lib64, but 32-bit needs lib (not lib32)
142 if ($WM_ARCH_OPTION == 64) then
143 _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
145 _foamAddLib $gccDir/lib
148 # add in gmp/mpfr libraries
149 _foamAddLib $gmpDir/lib
150 _foamAddLib $mpfrDir/lib
152 # add in mpc libraries (not need for older gcc)
153 if ( $?mpc_version ) then
154 _foamAddLib $mpcDir/lib
157 # used by boost/CGAL:
158 setenv MPFR_ARCH_PATH $mpfrDir
160 unset gcc_version gccDir
161 unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
169 set boost_version=boost_1_42_0
170 set cgal_version=CGAL-3.5.1
172 setenv BOOST_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
173 setenv CGAL_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
175 # enabled if CGAL is available
176 if ( -d "$CGAL_ARCH_PATH" ) then
177 if ( -d "$BOOST_ARCH_PATH" ) then
178 _foamAddLib $BOOST_ARCH_PATH/lib
180 unsetenv BOOST_ARCH_PATH
182 _foamAddLib $CGAL_ARCH_PATH/lib
184 unsetenv BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH
187 unset boost_version cgal_version
190 # Communications library
191 # ~~~~~~~~~~~~~~~~~~~~~~
193 unsetenv MPI_ARCH_PATH MPI_HOME
197 set mpi_version=openmpi-1.4.1
198 setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version
200 # Tell OpenMPI where to find its install directory
201 setenv OPAL_PREFIX $MPI_ARCH_PATH
203 _foamAddPath $MPI_ARCH_PATH/bin
204 _foamAddLib $MPI_ARCH_PATH/lib
205 _foamAddMan $MPI_ARCH_PATH/man
207 setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
213 # This uses the installed openmpi. It needs mpicc installed!
215 set mpi_version=openmpi-system
217 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
218 setenv PINC "`mpicc --showme:compile`"
219 setenv PLIBS "`mpicc --showme:link`"
220 set libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
222 # Bit of a hack: strip off 'lib' and hope this is the path to openmpi
223 # include files and libraries.
224 setenv MPI_ARCH_PATH "${libDir:h}"
226 if ($?FOAM_VERBOSE && $?prompt) then
227 echo "Using system installed MPI:"
228 echo " compile flags : $PINC"
229 echo " link flags : $PLIBS"
230 echo " libmpi dir : $libDir"
235 setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
236 unset mpi_version libDir
240 set mpi_version=mpich2-1.1.1p1
241 setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version
242 setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version
244 _foamAddPath $MPI_ARCH_PATH/bin
245 _foamAddLib $MPI_ARCH_PATH/lib
246 _foamAddMan $MPI_ARCH_PATH/share/man
248 setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
253 setenv MPI_ARCH_PATH /opt/mpi
254 setenv MPICH_PATH $MPI_ARCH_PATH
255 setenv GM_LIB_PATH /opt/gm/lib64
257 _foamAddPath $MPI_ARCH_PATH/bin
258 _foamAddLib $MPI_ARCH_PATH/lib
259 _foamAddLib $GM_LIB_PATH
261 setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-gm
265 setenv MPI_HOME /opt/hpmpi
266 setenv MPI_ARCH_PATH $MPI_HOME
268 _foamAddPath $MPI_ARCH_PATH/bin
272 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
275 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
278 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
281 echo Unknown processor type `uname -m` for Linux
285 setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/hpmpi
289 setenv MPI_ARCH_PATH /opt/mpi
290 setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpi
294 setenv MPI_ARCH_PATH /opt/FJSVmpi2
295 setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpi
296 _foamAddPath $MPI_ARCH_PATH/bin
297 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
298 _foamAddLib /opt/FSUNf90/lib/sparcv9
299 _foamAddLib /opt/FJSVpnidt/lib
303 setenv MPI_ARCH_PATH /usr/lib/mpi
304 setenv FOAM_MPI_LIBBIN FOAM_LIBBIN/qsmpi
306 _foamAddPath $MPI_ARCH_PATH/bin
307 _foamAddLib $MPI_ARCH_PATH/lib
312 setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/dummy
316 _foamAddLib $FOAM_MPI_LIBBIN
319 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
320 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
321 if ( ! $?minBufferSize ) set minBufferSize=20000000
323 if ( $?MPI_BUFFER_SIZE ) then
324 if ( $MPI_BUFFER_SIZE < $minBufferSize ) then
325 setenv MPI_BUFFER_SIZE $minBufferSize
328 setenv MPI_BUFFER_SIZE $minBufferSize
332 # Enable the hoard memory allocator if available
333 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
334 #if ( -f $FOAM_LIBBIN/libhoard.so ) then
335 # setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
339 # cleanup environment:
340 # ~~~~~~~~~~~~~~~~~~~~
341 unalias _foamAddPath _foamAddLib _foamAddMan
342 unset compilerInstall minBufferSize
344 # ----------------------------------------------------------------- end-of-file