#!/bin/bash -f #------------------------------------------------------------------------------ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License # This file is part of OpenFOAM. # # OpenFOAM is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with OpenFOAM; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script # bashrc # # Description # Startup File for OpenFoam. # Sourced from ~/.bashrc # #------------------------------------------------------------------------------ export WM_PROJECT=OpenFOAM export WM_PROJECT_VERSION=1.4 export WM_PROJECT_LANGUAGE=c++ #!!User: uncomment one of the lines below to set the WM_PROJECT_INST_DIR to # point to where you installed Foam. # # Location of FOAM installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export WM_PROJECT_INST_DIR=/c3se/apps/$WM_PROJECT #export WM_PROJECT_INST_DIR=$HOME/$WM_PROJECT #export WM_PROJECT_INST_DIR=~$WM_PROJECT #export WM_PROJECT_INST_DIR=$HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION #export WM_PROJECT_INST_DIR=/usr/local/$WM_PROJECT # Check that the installation directory has been set and exists if [ "$WM_PROJECT_INST_DIR" -a -d $WM_PROJECT_INST_DIR ]; then export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION # Location of users FOAM files # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION # Compiler (if set to "" use the system compiler) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export WM_COMPILER=Gcc4 export WM_COMPILER_ARCH= export WM_COMPILER_LIB_ARCH= # Compilation options (default precision, optimised, debug or profiling) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #export WM_PRECISION_OPTION=SP export WM_PRECISION_OPTION=DP export WM_COMPILE_OPTION=Opt #export WM_COMPILE_OPTION=Debug #export WM_COMPILE_OPTION=Prof export WM_JAVAC_OPTION=Opt #export WM_JAVAC_OPTION=Debug # Running options (floating-point signal handling and memory initialisation) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ export FOAM_SIGFPE= #export FOAM_SETNAN= # Detect system type and set environment variables # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ machineTest=`uname -s` # Linux workstation # ~~~~~~~~~~~~~~~~~ if [ "$machineTest" = "Linux" ]; then processor=`uname -m` if [ "$processor" = "i686" ]; then export WM_ARCH=linux #export WM_COMPILER=I32 elif [ "$processor" = "x86_64" ]; then if [ "$WM_64" ]; then export WM_ARCH=linux64 #export WM_ARCH=linux #export WM_COMPILER=I64 export WM_COMPILER_LIB_ARCH=64 export CC='gcc' export CXX='g++' export CFLAGS='-m64 -fPIC' export CXXFLAGS='-m64 -fPIC' export LDFLAGS='-m64' else export WM_ARCH=linux #export WM_COMPILER=I64 export WM_COMPILER_ARCH='-64' export CC='gcc' export CXX='g++' export CFLAGS='-m32' export CXXFLAGS='-m32' export LDFLAGS='-m32' fi elif [ "$processor" = "ia64" ]; then export WM_ARCH=linuxIA64 export WM_COMPILER=I64 else echo Unknown processor type $processor for Linux fi #export WM_MPLIB= #export WM_MPLIB=OPENMPI #export WM_MPLIB=LAM export WM_MPLIB=MPICH #export WM_MPLIB=MPICH-GM #export WM_MPLIB=GAMMA #export WM_MPLIB=MPI # SUN workstation # ~~~~~~~~~~~~~~~ elif [ "$machineTest" = "SunOS" ]; then export WM_ARCH=solaris #export WM_MPLIB= #export WM_MPLIB=OPENMPI export WM_MPLIB=LAM #export WM_MPLIB=MPICH #export WM_MPLIB=MPICH-GM # Silicon Graphics workstation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ elif [ "$machineTest" = "IRIX" -o "$machineTest" = "IRIX64" ]; then export WM_ARCH=sgiN32 #export WM_ARCH=sgi64 #export WM_COMPILER_LIB_ARCH=/mabi=64 #export WM_MPLIB= export WM_MPLIB=MPI #export WM_MPLIB=OPENMPI #export WM_MPLIB=LAM #export WM_MPLIB=MPICH #export WM_MPLIB=MPICH-GM # An unsupported operating system # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else echo \ Your $machineTest operating system is not supported\ by this release of OpenFOAM. For further assistance,\ please contact www.openfoam.org. echo fi # Clean standard environment variables (path, PATH, MANPATH, LD_LIBRARY_PATH) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath #- Clean path/PATH. Remove anything under top-level foam directory. cleanPath=`$cleanProg "$PATH" "$WM_PROJECT_INST_DIR"` if [ $? -eq 0 ]; then PATH="$cleanPath" fi #- Clean LD_LIBRARY_PATH export LD_LIBRARY_PATH=`$cleanProg "$LD_LIBRARY_PATH" "$WM_PROJECT_INST_DIR"` #- Clean MANPATH export MANPATH=`$cleanProg "$MANPATH" "$WM_PROJECT_INST_DIR"` # FOAM: set-up FOAM release-specific environment # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SOURCE(){ foamDotFile=$1 . $1 foamDotFile= } SOURCE $WM_PROJECT_DIR/.bashrc # Alias Declarations # ~~~~~~~~~~~~~~~~~~ alias src='cd $FOAM_SRC' alias lib='cd $FOAM_LIB' alias run='cd $FOAM_RUN' alias foam='cd $WM_PROJECT_DIR' alias foamsrc='cd $FOAM_SRC/$WM_PROJECT' alias foamfv='cd $FOAM_SRC/finiteVolume' alias app='cd $FOAM_APP' alias util='cd $FOAM_UTILITIES' alias sol='cd $FOAM_SOLVERS' alias tut='cd $FOAM_TUTORIALS' # Source user setup files for optional packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SOURCE $WM_PROJECT_DIR/$FOAM_DOT_DIR/apps/ensightFoam/bashrc SOURCE $WM_PROJECT_DIR/$FOAM_DOT_DIR/apps/paraview/bashrc # Again clean environment (path, PATH, MANPATH, LD_LIBRARY_PATH) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #- Clean path/PATH. Only remove duplicates cleanPath=`$cleanProg "$PATH"` if [ $? -eq 0 ]; then PATH="$cleanPath" fi #- Clean LD_LIBRARY_PATH export LD_LIBRARY_PATH=`$cleanProg "$LD_LIBRARY_PATH"` #- Clean MANPATH export MANPATH=`$cleanProg "$MANPATH"` else if [ ! "$WM_PROJECT_INST_DIR" ]; then echo echo '$HOME/.$WM_PROJECT-$WM_PROJECT_VERSION/bashrc: $WM_PROJECT_INST_DIR not set' echo elif [ ! -d $WM_PROJECT_INST_DIR ]; then echo echo $HOME/.$WM_PROJECT-$WM_PROJECT_VERSION/bashrc: cannot find FOAM installation echo fi fi # -----------------------------------------------------------------------------