Skip to content
Snippets Groups Projects
bashrc 5.83 KiB
Newer Older
  • Learn to ignore specific revisions
  • #----------------------------------*-sh-*--------------------------------------
    # =========                 |
    # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    #  \\    /   O peration     |
    
    #   \\  /    A nd           | Copyright (C) 2016-2019 OpenCFD Ltd.
    #    \\/     M anipulation  |
    #------------------------------------------------------------------------------
    #                           | Copyright (C) 2011-2016 OpenFOAM Foundation
    
    #------------------------------------------------------------------------------
    # License
    
    #     This file is part of OpenFOAM, licensed under GNU General Public License
    #     <http://www.gnu.org/licenses/>.
    
    #     etc/bashrc
    
    #     The OpenFOAM environment for POSIX shell (eg, bash,dash,zsh,...).
    #     Source manually or from the ~/.bashrc or ~/.profile files.
    
    #     Many settings can be overridden using a <prefs.sh> file:
    
    #       - Base values (eg, from system admin):
    #         -  $WM_PROJECT_DIR/etc/prefs.sh
    
    #       - User or group values (first file found):
    
    #         -  ~/.OpenFOAM/$FOAM_API/prefs.sh
    
    #         -  ~/.OpenFOAM/prefs.sh
    
    #         -  $WM_PROJECT_SITE/$FOAM_API/etc/prefs.sh
    
    #         -  $WM_PROJECT_SITE/etc/prefs.sh
    
    # Environment
    #     FOAM_VERBOSE (set/unset)
    #         - add extra verbosity when sourcing files
    #     FOAM_CONFIG_NOUSER (set/unset)
    #         - suppress use of user/group configuration files
    
    #     WM_PROJECT_SITE (optional directory)
    #         - local site-specific directory, uses WM_PROJECT_DIR/site if unset
    
    #
    # Note
    #     Changes made to this bashrc file may be lost with the next upgrade.
    #
    
    #------------------------------------------------------------------------------
    
    export WM_PROJECT=OpenFOAM
    
    export WM_PROJECT_VERSION=plus
    
    # [projectDir] - directory containing this OpenFOAM version.
    
    # \- When this file is located as $WM_PROJECT_DIR/etc/bashrc, the next lines
    
    #    should work when sourced by BASH or ZSH shells. If this however fails,
    #    set one of the fallback values to an appropriate path.
    
    #    This can be removed if an absolute path is provided for WM_PROJECT_DIR
    #    later on in this file
    # --
    projectDir="${BASH_SOURCE:-${ZSH_NAME:+$0}}";
    [ -n "$projectDir" ] && projectDir="$(\cd $(dirname $projectDir)/.. && \pwd -L)" ||\
    projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
    # projectDir="/opt/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
    # projectDir="/usr/local/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
    
    # END OF (NORMAL) USER EDITABLE PART
    ################################################################################
    
    : # Safety statement (if the user removed all fallback values)
    
    # Configuration environment variables.
    # Should override via <prefs.sh> file instead of editing this file.
    
    # [WM_COMPILER_TYPE] - Compiler location:
    # = system | ThirdParty
    
    export WM_COMPILER_TYPE=system
    
    # = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-5] | Gcc7[1-4] | Gcc8[12] |
    
    #   Clang | Clang3[7-9] | Clang[4-6]0 | Icc | Cray | Arm | Pgi
    
    # [WM_ARCH_OPTION] - Memory addressing:
    # = 32 | 64
    #   * on a 64-bit OS this can be 32 or 64
    #   * on a 32-bit OS, it is always 32-bit and this option is ignored
    
    # [WM_PRECISION_OPTION] - Floating-point precision:
    
    export WM_PRECISION_OPTION=DP
    
    
    # [WM_LABEL_SIZE] - Label size in bits:
    # = 32 | 64
    
    export WM_LABEL_SIZE=32
    
    
    # [WM_COMPILE_OPTION] - Optimised, debug, profiling, other:
    
    # Other is processor or packaging specific, for example
    # = OptKNL
    
    export WM_COMPILE_OPTION=Opt
    
    
    # [WM_MPLIB] - MPI implementation:
    # = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
    #   HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
    
    # Also possible to use INTELMPI-xyz etc and define your own wmake rule
    
    export WM_MPLIB=SYSTEMOPENMPI
    
    #------------------------------------------------------------------------------
    
    # (advanced / legacy)
    
    #
    # [FOAM_SIGFPE] - Trap floating-point exceptions.
    
    #               - overrides the 'trapFpe' controlDict entry
    # = true | false
    
    # [FOAM_SETNAN] - Initialize memory with NaN
    
    #               - overrides the 'setNaN' controlDict entry
    # = true | false
    
    # [FOAM_CODE_TEMPLATES] - dynamicCode templates
    # - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode'
    ##export FOAM_CODE_TEMPLATES="$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode"
    
    # [FOAM_JOB_DIR] - location of jobControl
    #                - unset: equivalent to ~/.OpenFOAM/jobControl
    # export FOAM_JOB_DIR="$HOME/.OpenFOAM/jobControl"
    
    
    # [WM_OSTYPE] - Operating System Type
    # = POSIX
    #export WM_OSTYPE=POSIX
    
    ################################################################################
    
    
    # Capture values of old directories to be cleaned from PATH, LD_LIBRARY_PATH
    
    foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
        $HOME/$WM_PROJECT/$USER $FOAM_USER_APPBIN $FOAM_USER_LIBBIN \
    
        $WM_PROJECT_SITE $FOAM_SITE_APPBIN $FOAM_SITE_LIBBIN"
    
    # [WM_PROJECT_DIR] - Location of this OpenFOAM version
    export WM_PROJECT_DIR="$projectDir"
    
    # [WM_PROJECT_USER_DIR] - Location of user files
    
    export WM_PROJECT_USER_DIR="$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION"
    
    # [WM_PROJECT_SITE] - Location of site-specific (group) files
    
    # Default (unset) implies WM_PROJECT_DIR/site
    # Normally defined in calling environment
    
    
    # Finalize setup of OpenFOAM environment for POSIX shell
    if [ -d "$WM_PROJECT_DIR" ]
    
        if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
        then
            echo "source $WM_PROJECT_DIR/etc/config.sh/setup" 1>&2
        fi
        . "$WM_PROJECT_DIR/etc/config.sh/setup" "$@"
    
        echo "Error: did not locate installation path for $WM_PROJECT-$WM_PROJECT_VERSION" 1>&2
        echo "No directory: $WM_PROJECT_DIR" 1>&2
    
    # Cleanup variables (done as final statement for a clean exit code)
    unset foamOldDirs projectDir
    
    #------------------------------------------------------------------------------