#----------------------------------*-sh-*-------------------------------------- # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, licensed under GNU General Public License # . # # File # etc/cshrc # # Description # The OpenFOAM environment for C-shell (csh, tcsh). # Source manually or from the ~/.cshrc or ~/.login files. # # Many settings can be overridden using a file: # # - Base values (eg, from system admin): # - $WM_PROJECT_DIR/etc/prefs.csh # # - User or group values (first file found): # - ~/.OpenFOAM/$WM_PROJECT_VERSION/prefs.csh # - ~/.OpenFOAM/prefs.csh # - $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION/prefs.csh # - $WM_PROJECT_SITE/site/prefs.csh # # Environment # FOAM_VERBOSE (set/unset) # - add extra verbosity when sourcing files # FOAM_CONFIG_NOUSER (set/unset) # - suppress use of user/group configuration files # # Note # Changes made to this cshrc file may be lost with the next upgrade. # #------------------------------------------------------------------------------ setenv WM_PROJECT OpenFOAM setenv WM_PROJECT_VERSION plus # [FOAM_INST_DIR] - parent directory containing the OpenFOAM installation. # \- When this file is located as $WM_PROJECT_DIR/etc/cshrc, the next lines # should work when sourced by CSH or TCSH shells. If this however fails, # set one of the fallback values to an appropriate path. # -- set FOAM_INST_DIR=`lsof +p $$ |& \ sed -n -e 's@[^/]*@@' -e 's@/'$WM_PROJECT'[^/]*/etc/cshrc.*@@p'` # set FOAM_INST_DIR=$HOME/$WM_PROJECT # set FOAM_INST_DIR=/opt/$WM_PROJECT # set FOAM_INST_DIR=/usr/local/$WM_PROJECT # # END OF (NORMAL) USER EDITABLE PART ################################################################################ # Configuration environment variables. # Should override via file instead of editing this file. # [WM_COMPILER_TYPE] - Compiler location: # = system | ThirdParty setenv WM_COMPILER_TYPE system # [WM_COMPILER] - Compiler: # = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-4] | Gcc7[1-3] | Gcc8[12] | GccKNL | # Clang | Clang3[7-9] | Clang[4-6]0 | Icc | IccKNL | Cray | Arm setenv WM_COMPILER Gcc # [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 setenv WM_ARCH_OPTION 64 # [WM_PRECISION_OPTION] - Floating-point precision: # = DP | SP setenv WM_PRECISION_OPTION DP # [WM_LABEL_SIZE] - Label size in bits: # = 32 | 64 setenv WM_LABEL_SIZE 32 # [WM_COMPILE_OPTION] - Optimised, debug, profiling: # = Opt | Debug | Prof setenv WM_COMPILE_OPTION Opt # [WM_MPLIB] - MPI implementation: # = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM | # HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI setenv WM_MPLIB SYSTEMOPENMPI #------------------------------------------------------------------------------ # (legacy / advanced) # # [FOAM_SIGFPE] - Trap floating-point exceptions. # - overrides the 'trapFpe' controlDict entry # = true | false #setenv FOAM_SIGFPE true # [FOAM_SETNAN] - Initialize memory with NaN # - overrides the 'setNaN' controlDict entry # = true | false #setenv FOAM_SETNAN false # [WM_OSTYPE] - Operating System Type: # = POSIX #setenv WM_OSTYPE POSIX ################################################################################ # Old directories to be cleaned from PATH, LD_LIBRARY_PATH set foamOldDirs= if ( $?WM_PROJECT_DIR ) then set foamOldDirs="$foamOldDirs $WM_PROJECT_DIR" endif if ( $?WM_THIRD_PARTY_DIR ) then set foamOldDirs="$foamOldDirs $WM_THIRD_PARTY_DIR" endif if ( $?WM_PROJECT ) then set foamOldDirs="$foamOldDirs $HOME/$WM_PROJECT/$LOGNAME" endif if ( $?FOAM_SITE_APPBIN ) then set foamOldDirs="$foamOldDirs $FOAM_SITE_APPBIN" endif if ( $?FOAM_SITE_LIBBIN ) then set foamOldDirs="$foamOldDirs $FOAM_SITE_LIBBIN" endif # Location of installation and third-party software setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION # [WM_PROJECT_SITE] - Location of site-specific (group) files # default (unset) implies WM_PROJECT_INST_DIR/site if ( $?WM_PROJECT_SITE ) then set foamOldDirs="$WM_PROJECT_SITE $foamOldDirs" if ( ! -d "$WM_PROJECT_SITE" ) unsetenv WM_PROJECT_SITE else unsetenv WM_PROJECT_SITE endif # [WM_PROJECT_USER_DIR] - Location of user files setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION # Load shell "functions" (actually aliases) source $WM_PROJECT_DIR/etc/config.csh/functions # Overrides via # 1. other (system) values _foamEtc -mode=o prefs.csh # 2. user or group values (unless disabled) if (! $?FOAM_CONFIG_NOUSER ) then _foamEtc -mode=ug prefs.csh endif # Evaluate command-line parameters and record settings for later. # These can be used to set/unset values, specify additional files etc. setenv FOAM_SETTINGS "${*}" while ( $#argv > 0 ) switch ($argv[1]) case -*: # Stray option (not meant for us here) -> get out break breaksw case *=: # name= -> unsetenv name if ($?FOAM_VERBOSE && $?prompt) echo "unsetenv $argv[1]:s/=//" eval "unsetenv $argv[1]:s/=//" breaksw case *=*: # name=value -> setenv name value if ($?FOAM_VERBOSE && $?prompt) echo "setenv $argv[1]:s/=/ /" eval "setenv $argv[1]:s/=/ /" breaksw default: # Filename: source it if ( -f "$argv[1]" ) then if ($?FOAM_VERBOSE && $?prompt) echo "Using: $argv[1]" source "$argv[1]" else _foamEtc -silent "$argv[1]" endif breaksw endsw shift end # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Prevent local variables from shadowing setenv variables unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH if (! $?MANPATH ) setenv MANPATH _foamClean PATH "$foamOldDirs" _foamClean MANPATH "$foamOldDirs" _foamClean LD_LIBRARY_PATH "$foamOldDirs" # Setup for OpenFOAM compilation etc # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _foamEtc -config settings # Setup for third-party packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _foamEtc -config mpi _foamEtc -config paraview -- "$FOAM_SETTINGS" # Pass through for evaluation _foamEtc -config vtk _foamEtc -config ensight ## _foamEtc -config ADIOS ## _foamEtc -config ADIOS2 _foamEtc -config CGAL _foamEtc -config FFTW # Interactive shell if ($?prompt) then _foamEtc -config aliases _foamEtc -config tcsh_completion endif # Clean environment paths again. Only remove duplicates # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _foamClean PATH _foamClean MANPATH _foamClean LD_LIBRARY_PATH # Add trailing ':' for system manpages if ( $?MANPATH ) then setenv MANPATH "${MANPATH}:" endif if ( $?LD_PRELOAD ) then _foamClean LD_PRELOAD endif # Cleanup temporary information # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Unload shell "functions" unalias _foamClean unalias _foamEtc unalias _foamAddPath unalias _foamAddMan unalias _foamAddLib unalias _foamAddLibAuto # Variables (done as the last statement for a clean exit code) unset FOAM_INST_DIR # Old variable name (OpenFOAM-v1606) - now unneeded unset cleaned foamOldDirs #------------------------------------------------------------------------------