From 48fcb7f6d1502956c8412dc12f19d6240d30aa71 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 17 May 2024 10:13:27 +0100 Subject: [PATCH] etc: Explicit control of decomposition and ParaView installation type *** Note that this commit depends on a corresponding change in ThirdParty-dev. Ensure that both repositories are up to date before re-building OpenFOAM. New environment variables have been added to explicitly control the installation type of the thirdparty decomposition libraries and of the ParaView visualiation software. These are set in the etc/bashrc and can be overridden in a ~/.OpenFOAM//prefs.sh file or similar. The variables relating to the decomposition libraries are SCOTCH_TYPE, METIS_TYPE, PARMETIS_TYPE and ZOLTAN_TYPE, and they can take values of none, system, or ThirdParty. In the case of ThirdParty, a _VERSION variable can also be specified. If the version is not specified then the configuration will search for a source directory, and if multiple such directories are found then the one with the highest version number will be used. The variable relating to ParaView is ParaView_TYPE, and this can be similarly be set to none, system, or ThirdParty, and ParaView_VERSION can also be specified when the type is ThirdParty. If the version is not specified then the installation with the highest version number will be used. An example ~/.OpenFOAM/dev/prefs.sh file, in which all decomposition libraries are enabled, and the Scotch and ParaView versions are explicitly set, is as follows: export SCOTCH_TYPE=ThirdParty export SCOTCH_VERSION=7.0.3 export METIS_TYPE=ThirdParty export PARMETIS_TYPE=ThirdParty export ZOLTAN_TYPE=ThirdParty export ParaView_TYPE=ThirdParty export ParaView_VERSION=5.11.2 *** Note that if version numbers are not set then the configuration will search for a decomposition source directory, but it will search for a ParaView installation directory. This is because decomposition libraries are built as part of OpenFOAM's ./Allwmake, but ParaView is not. This distinction remains. If a local compilation of ParaView is needed, then './makeParaView -version X.XX.X' should be called explicitly in the third party directory prior to building OpenFOAM. The name of the third party directory can now also be independently set. This simplifies some packaging processes in that it permits third party to be located within the OpenFOAM installation directory and therefore bundled into the same binary package. --- .../graphics/PVReaders/Allwmake | 6 - bin/foamEtcFile | 76 ++---- bin/paraFoam | 214 +++++++++-------- bin/tools/foamConfigurePaths | 195 +++++++-------- bin/tools/foamListBinDirs | 16 +- bin/tools/foamListThirdPartyBinDirs | 16 +- bin/tools/foamVersionCompare | 14 +- etc/bashrc | 67 ++++-- etc/config.csh/aliases | 4 +- etc/config.csh/compiler | 83 +++++++ etc/config.csh/ensight | 4 +- etc/config.csh/example/paraview | 46 ---- etc/config.csh/example/prefs.csh | 16 +- etc/config.csh/functions | 103 ++++++++ etc/config.csh/mpi | 13 +- etc/config.csh/paraview | 210 +++++++++-------- etc/config.csh/settings | 136 +++++------ etc/config.csh/unset | 22 +- etc/config.sh/aliases | 4 +- etc/config.sh/compiler | 16 +- etc/config.sh/example/paraview | 46 ---- etc/config.sh/example/prefs.sh | 14 +- etc/config.sh/functions | 38 ++- etc/config.sh/metis | 36 ++- etc/config.sh/mpi | 3 +- etc/config.sh/parMetis | 35 ++- etc/config.sh/paraview | 223 +++++++++--------- etc/config.sh/scotch | 39 ++- etc/config.sh/settings | 92 +++++--- etc/config.sh/unset | 21 +- etc/config.sh/zoltan | 37 ++- etc/cshrc | 97 ++++---- src/parallel/decompose/metis/Allwmake | 23 +- src/parallel/decompose/parMetis/Allwmake | 27 +-- src/parallel/decompose/ptscotch/Allwmake | 30 +-- src/parallel/decompose/scotch/Allwmake | 22 +- src/parallel/decompose/zoltan/Allwmake | 32 +-- 37 files changed, 1186 insertions(+), 890 deletions(-) create mode 100644 etc/config.csh/compiler delete mode 100644 etc/config.csh/example/paraview create mode 100644 etc/config.csh/functions delete mode 100644 etc/config.sh/example/paraview diff --git a/applications/utilities/postProcessing/graphics/PVReaders/Allwmake b/applications/utilities/postProcessing/graphics/PVReaders/Allwmake index f270c064b0..6f6d9e70df 100755 --- a/applications/utilities/postProcessing/graphics/PVReaders/Allwmake +++ b/applications/utilities/postProcessing/graphics/PVReaders/Allwmake @@ -10,12 +10,6 @@ then exit 0 fi -if [ -z "$PV_PLUGIN_PATH" ] -then - echo " Error: \$PV_PLUGIN_PATH is unset." - exit 1 -fi - # Ensure CMake gets the correct C/C++ compilers [ -n "$WM_CC" ] && export CC="$WM_CC" [ -n "$WM_CXX" ] && export CXX="$WM_CXX" diff --git a/bin/foamEtcFile b/bin/foamEtcFile index 37c1464c2e..4b7bb6ff9f 100755 --- a/bin/foamEtcFile +++ b/bin/foamEtcFile @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -99,44 +99,33 @@ prefixDir="${projectDir%/*}" # the name used for the project directory projectDirName="${projectDir##*/}" -# version number used for debian packaging -unset versionNum - -# -# handle standard and debian naming convention -# +# handle standard and packaged naming conventions case "$projectDirName" in - OpenFOAM-*) # standard naming convention OpenFOAM- - version="${projectDirName##OpenFOAM-}" - ;; - openfoam[0-9]*) # debian naming convention - versionNum="${projectDirName##openfoam}" - case "$versionNum" in - [4-9]) # v4-9 - version="$versionNum" + OpenFOAM-*) # standard naming convention OpenFOAM- + version="${projectDirName##OpenFOAM-}" ;; - [1-2][0-9]) # v10 onwards - version="$versionNum" + openfoam-dev) # debian naming convention for dev + version="${projectDirName##openfoam-}" ;; - 3[0-9]) # e.g. v3.0 - version=$(echo "$versionNum" | sed -e 's@\(.\)\(.\)@\1.\2@') + openfoam[1-2][0-9]) # debian naming convention for v10 onwards + version="${projectDirName##openfoam}" ;; - [1-2][0-9][0-9]) # e.g. v1.7.0 - version=$(echo "$versionNum" | sed -e 's@\(.\)\(.\)\(.\)@\1.\2.\3@') + openfoam[4-9]) # debian naming convention for v4-9 + version="${projectDirName##openfoam}" + ;; + openfoam3[0-9]) # debian naming convention for v3.? + version=$(echo "${projectDirName##openfoam}" | sed -e 's@\(.\)\(.\)@\1.\2@') + ;; + openfoam[1-2][0-9][0-9]) # debian naming convention for v1.?.? and v2.?.? + version=$(echo "${projectDirName##openfoam}" | sed -e 's@\(.\)\(.\)\(.\)@\1.\2.\3@') + ;; + app) # flatpak naming convention + version="${FLATPAK_ID##OpenFOAM-}" ;; *) - version="$WM_PROJECT_VERSION" + echo "Error : unknown/unsupported naming convention" + exit 1 ;; - esac - ;; - openfoam-dev) # debian naming convention - versionNum="${projectDirName##openfoam}" - version="${versionNum##-}" - ;; - *) - echo "Error : unknown/unsupported naming convention" - exit 1 - ;; esac # default mode is 'ugo' @@ -184,11 +173,6 @@ do -v | -version) [ "$#" -ge 2 ] || error "'$1' option requires an argument" version="$2" - # convert x.y.z -> xyz version (if installation looked like debian) - if [ -n "$versionNum" ] - then - versionNum=$(echo "$version" | sed -e 's@\.@@g') - fi shift ;; --) @@ -205,15 +189,6 @@ do shift done - -# debugging: -# echo "Installed locations:" -# for i in projectDir prefixDir projectDirName version versionNum -# do -# eval echo "$i=\$$i" -# done - - # Save the essential bits of information # silently remove leading ~OpenFOAM/ (used in Foam::findEtcFile) nArgs=$# @@ -237,14 +212,7 @@ esac case "$mode" in *o*) # other (shipped) - if [ -n "$versionNum" ] - then - # debian packaging - dirList="$dirList $prefixDir/openfoam$versionNum/etc" - else - # standard packaging - dirList="$dirList $prefixDir/${WM_PROJECT:-OpenFOAM}-$version/etc" - fi + dirList="$dirList $prefixDir/$projectDirName/etc" ;; esac set -- $dirList diff --git a/bin/paraFoam b/bin/paraFoam index aab19870ba..22c5e2d44e 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -28,9 +28,6 @@ # Description # start paraview with the OpenFOAM libraries # -# Note -# combining -block or -builtin options with the -region option yields -# undefined behaviour #------------------------------------------------------------------------------ usage() { cat<&1 | grep -v -F 'Inconsistency detected by ld.so' } -noPVReader () { +noPV() { cat< /dev/null 2>&1 && \ + noPVExe && exit 1 +[ $requirePVReader -eq 1 ] && \ ! [ -f "$PV_PLUGIN_PATH/libPVFoamReader_SM.so" ] && \ noPVReader && exit 1 @@ -174,14 +205,11 @@ hasDataArg() shift done } - hasDataArg "$@" -# Get a sensible caseName from the directory name +# Construct a case name from the directory name caseName=${PWD##*/} caseFile="$caseName.$extension" -fvControls="system" - if [ -n "$regionName" ] then if [ ! -d constant/"$regionName" ] @@ -190,110 +218,106 @@ then exit 1 else caseFile="$caseName{$regionName}.$extension" - fvControls="$fvControls/$regionName" fi fi +# If the touch option is set, then create files and exit case "${optTouch:-false}" in all) - extension=OpenFOAM + # Block mesh if [ -f system/blockMeshDict ] || [ -f constant/polyMesh/blockMeshDict ] then touch "$caseName.blockMesh" echo "Created '$caseName.blockMesh'" fi - touch "$caseName.$extension" - echo "Created '$caseName.$extension'" - # Discover probable regions + + # Default region + touch "$caseName.OpenFOAM" + echo "Created '$caseName.OpenFOAM'" + + # Find other probable regions for region in constant/* do - [ -d "$region" ] && [ -d "${region}/polyMesh" ] && \ + [ -d "$region/polyMesh" ] && \ regionName=${region##*/} && \ - touch "$caseName{$regionName}.$extension" && \ - echo "Created '$caseName{$regionName}.$extension'" + touch "$caseName{$regionName}.OpenFOAM" && \ + echo "Created '$caseName{$regionName}.OpenFOAM'" done exit 0 ;; + true) + # Default region touch "$caseFile" echo "Created '$caseFile'" exit 0 ;; esac - # Parent directory for normal or parallel results case "$caseName" in processor*) parentDir=".." ;; *) parentDir="." ;; esac - +# If we have a --data=... argument, then send this directly to paraview if [ "${hasData:-false}" = true ] then - - # Has --data=.., send directly to paraview pvExec "$@" - -else - - # Check existence of essential files - warn="WARN file does not exist:" - case $extension in - blockMesh) - blockMeshDictDir=system/blockMeshDict - if [ -f constant/polyMesh/blockMeshDict ] - then - blockMeshDictDir=constant/polyMesh/blockMeshDict - fi - for check in \ - system/controlDict \ - $blockMeshDictDir \ - ; - do - [ -s "$parentDir/$check" ] || [ -s "$parentDir/$check.orig" ] || - { - [ -n "$warn" ] && echo "$warn" 1>&2 - echo " $parentDir/$check" 1>&2 - unset warn - } - done - ;; - - builtin | OpenFOAM) - for check in \ - system/controlDict \ - ; - do - [ -s "$parentDir/$check" ] || [ -s "$parentDir/$check.orig" ] || - { - [ -n "$warn" ] && echo "$warn" 1>&2 - echo " $parentDir/$check" 1>&2 - unset warn - } - done - ;; - esac - - [ -n "$warn" ] || { - echo "Cannot locate OpenFOAM-format case files" - printf "Would you like to open ParaView anyway :" - read open - [ "$open" = "" ] || echo "$open" | grep -iqE "^y" && pvExec - exit - } - - # Only create/remove caseFile if it didn't already exist - [ -e "$caseFile" ] || { - trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT - touch "$caseFile" - echo "Created temporary '$caseFile'" - } - - # For now filter out any ld.so errors. Caused by non-system compiler? - pvExec --data="$caseFile" "$@" 2>&1 \ - | grep -v -F 'Inconsistency detected by ld.so' + exit 0 fi +# Check existence of essential files +warn="WARN file does not exist:" +case $extension in + blockMesh) + blockMeshDictDir=system/blockMeshDict + if [ -f constant/polyMesh/blockMeshDict ] + then + blockMeshDictDir=constant/polyMesh/blockMeshDict + fi + + for check in system/controlDict $blockMeshDictDir + do + [ -s "$parentDir/$check" ] || [ -s "$parentDir/$check.orig" ] || + { + [ -n "$warn" ] && echo "$warn" 1>&2 + echo " $parentDir/$check" 1>&2 + unset warn + } + done + ;; + + OpenFOAM | foam) + for check in system/controlDict + do + [ -s "$parentDir/$check" ] || [ -s "$parentDir/$check.orig" ] || + { + [ -n "$warn" ] && echo "$warn" 1>&2 + echo " $parentDir/$check" 1>&2 + unset warn + } + done + ;; +esac + +# Warn if essential files do not exist +[ -n "$warn" ] || { + echo "Cannot locate OpenFOAM-format case files" + printf "Would you like to open ParaView anyway :" + read open + [ "$open" = "" ] || echo "$open" | grep -iqE "^y" && pvExec + exit +} + +# Only create/remove the caseFile if it didn't already exist +[ -e "$caseFile" ] || { + trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch "$caseFile" + echo "Created temporary '$caseFile'" +} + +# Run paraview +pvExec --data="$caseFile" "$@" #------------------------------------------------------------------------------ diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index 3f4ef332ec..85e8223506 100755 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -26,7 +26,7 @@ # foamConfigurePaths # # Description -# hardcode installation directory +# Hard-code installation directories # #------------------------------------------------------------------------------ usage() { @@ -35,16 +35,12 @@ usage() { cat<&2 Usage : ${0##*/} [archOptions] @@ -57,9 +55,11 @@ archOptions="${2:-$WM_OPTIONS}" exit 1 } -# base arch (w/o precision, optimisation, etc) +# same as "$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION" +archOSCompilerTypes=$(echo "$archOptions" | sed -e 's@\(Int[0-9]\+\).*$@\1@') + # same as "$WM_ARCH$WM_COMPILER" -archCompiler=$(echo "$archOptions" | sed -e 's@[DS]P.*$@@') +archOSCompiler=$(echo "$archOptions" | sed -e 's@[DSL]P.*$@@') # same as $WM_ARCH - eg, 'linux64' # TODO: only works for Gcc, Icc, Clang @@ -89,10 +89,10 @@ dirList=$( for dir in \ $packDir/platforms/$archOptions/bin \ $packDir/platforms/$archOptions/lib \ - $packDir/wmake/platforms/$archCompiler \ + $packDir/wmake/platforms/$archOSCompiler \ $packDir/wmake/platforms/$archOS \ $packDir/wmake/rules/General \ - $packDir/wmake/rules/$archCompiler \ + $packDir/wmake/rules/$archOSCompiler \ $packDir/wmake/rules/$archOS \ ; do @@ -103,7 +103,7 @@ dirList=$( cat <&2 ------------------------------------------------------------------------------- -Packing $archOptions ($archCompiler) port of $packDir +Packing $archOptions port of $packDir archOS = $archOS 32bit archOS = $arch3264 diff --git a/bin/tools/foamListThirdPartyBinDirs b/bin/tools/foamListThirdPartyBinDirs index 09b3a94060..537b683121 100755 --- a/bin/tools/foamListThirdPartyBinDirs +++ b/bin/tools/foamListThirdPartyBinDirs @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -31,8 +31,6 @@ # Note # Not normally called directly by the user. #------------------------------------------------------------------------------ -toolsDir="${0%/*}" # this script is already located in the tools/ directory - [ $# -eq 1 -o $# -eq 2 ] || { cat <&2 Usage : ${0##*/} [archOptions] @@ -57,9 +55,11 @@ archOptions="${2:-$WM_OPTIONS}" exit 1 } -# base arch (w/o precision, optimisation, etc) +# same as "$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION" +archOSCompilerTypes=$(echo "$archOptions" | sed -e 's@\(Int[0-9]\+\).*$@\1@') + # same as "$WM_ARCH$WM_COMPILER" -archCompiler=$(echo "$archOptions" | sed -e 's@[DS]P.*$@@') +archOSCompiler=$(echo "$archOptions" | sed -e 's@[DSL]P.*$@@') # same as $WM_ARCH - eg, 'linux64' # TODO: only works for Gcc, Icc, Clang @@ -73,7 +73,6 @@ arch3264=$(echo "$archOS" | sed -e 's@64@-64@') # check for essential directories for dir in \ $packDir \ - $packDir/platforms/$archOptions/lib \ ; do [ -d $dir ] || { @@ -87,7 +86,8 @@ done dirList=$( for dir in \ $packDir/platforms/$archOptions \ - $packDir/platforms/$archCompiler \ + $packDir/platforms/$archOSCompilerTypes \ + $packDir/platforms/$archOSCompiler \ $packDir/platforms/$archOS \ ; do @@ -109,7 +109,7 @@ dirList=$( cat <&2 ------------------------------------------------------------------------------- -Packing $archOptions ($archCompiler) port of $packDir +Packing $archOptions port of $packDir archOS = $archOS 32bit archOS = $arch3264 diff --git a/bin/tools/foamVersionCompare b/bin/tools/foamVersionCompare index 99647fbe24..fa8dd96323 100755 --- a/bin/tools/foamVersionCompare +++ b/bin/tools/foamVersionCompare @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2020-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -59,7 +59,7 @@ error() { exit 1 } -# Comparison functions +# Define comparison functions _foamVersionCompare_eq=0 _foamVersionCompare_lt=1 _foamVersionCompare_gt=2 @@ -121,9 +121,14 @@ _foamVersionGe() # Parse arguments [ $# -eq 3 ] || error "Incorrect arguments specified" -v1=${1##*-} +# Extraction pattern +extract='s/^.*\([^0-9]\.\|[_-]\)[vV]\?\([0-9][0-9.]*[0-9]\)\(\|[._-].*\)$/\2/g' + +# Get the first version number +v1=$(echo $1 | sed $extract) shift 1 +# Get the comparison operator case $1 in -h | -help) usage && exit 0 @@ -149,7 +154,8 @@ case $1 in esac shift 1 -v2=${1##*-} +# Get the second version number +v2=$(echo $1 | sed $extract) shift 1 # Perform comparison and return diff --git a/etc/bashrc b/etc/bashrc index 99aa258f56..caaadf0c62 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -32,19 +32,28 @@ #------------------------------------------------------------------------------ export WM_PROJECT=OpenFOAM +export WM_THIRD_PARTY=ThirdParty export WM_PROJECT_VERSION=dev ################################################################################ # USER EDITABLE PART: Changes made here may be lost with the next upgrade # # FOAM_INST_DIR is the location of the OpenFOAM installation which defaults to -# the directory containing this file if sourced by a bash shell. +# the directory two levels below this file, or $HOME/$WM_PROJECT if that +# directory cannot be determined. # -# Please set to the appropriate path if the default is not correct. +[ "$BASH" ] && bashrcFile=${BASH_SOURCE} +[ "$ZSH_NAME" ] && bashrcFile=$0 +if [ -n "$bashrcFile" ] +then + export FOAM_INST_DIR=$(cd $(dirname $bashrcFile)/../.. && pwd -P) +else + export FOAM_INST_DIR=$HOME/$WM_PROJECT +fi +unset bashrcFile +# +# Please set to the appropriate path if the above default is not correct. E.g., # -[ "$BASH" -o "$ZSH_NAME" ] && \ -export FOAM_INST_DIR=$(cd $(dirname ${BASH_SOURCE:-$0})/../.. && pwd -P) || \ -export FOAM_INST_DIR=$HOME/$WM_PROJECT # export FOAM_INST_DIR=~$WM_PROJECT # export FOAM_INST_DIR=/opt/$WM_PROJECT # export FOAM_INST_DIR=/usr/local/$WM_PROJECT @@ -57,7 +66,7 @@ export FOAM_INST_DIR=$HOME/$WM_PROJECT # $FOAM_INST_DIR/site/$WM_PROJECT_VERSION or $FOAM_INST_DIR/site #- Compiler location: -# WM_COMPILER_TYPE= system | ThirdParty (OpenFOAM) +# WM_COMPILER_TYPE = system | ThirdParty (OpenFOAM) export WM_COMPILER_TYPE=system #- Compiler: @@ -92,11 +101,21 @@ export WM_MPLIB=SYSTEMOPENMPI # WM_OSTYPE = POSIX | ??? export WM_OSTYPE=POSIX +#- Decomposition libraries: +# _TYPE = none | system | ThirdParty (OpenFOAM) +export SCOTCH_TYPE=ThirdParty +export METIS_TYPE=none +export PARMETIS_TYPE=none +export ZOLTAN_TYPE=none + +# ParaView_TYPE = none | system | paraviewopenfoam | ThirdParty (OpenFOAM) +export ParaView_TYPE=ThirdParty + #- Floating-point signal handling: # set or unset export FOAM_SIGFPE= -#- memory initialisation: +#- Memory initialisation: # set or unset #export FOAM_SETNAN= @@ -123,9 +142,26 @@ then unset WM_PROJECT_DIR_REAL fi +# Source initialisation functions +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +. $WM_PROJECT_DIR/etc/config.sh/functions + +# Add in preset user or site preferences: +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` + +# Evaluate command-line parameters of the form "param=keyword" or unset +# parameters with "param=" +export FOAM_SETTINGS="$@" +_foamParams $@ + # Location of third-party software # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION +if [ ${WM_THIRD_PARTY%%/*} = ${WM_PROJECT_DIR##*/} ] +then + export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/$WM_THIRD_PARTY +else + export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/$WM_THIRD_PARTY-$WM_PROJECT_VERSION +fi if [ -d "$WM_THIRD_PARTY_DIR" ] then @@ -151,18 +187,6 @@ fi # ~~~~~~~~~~~~~~~~~~~~~~ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION -# Source initialisation functions -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -. $WM_PROJECT_DIR/etc/config.sh/functions - -# Add in preset user or site preferences: -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` - -# Evaluate command-line parameters of the form "param=keyword" or unset -# parameters with "param=" -export FOAM_SETTINGS="$@" -_foamParams $@ - # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ foamClean=$WM_PROJECT_DIR/bin/foamCleanPath @@ -219,7 +243,6 @@ fi # ~~~~~~~~~~~~~~~~~~~~ unset cleaned foamClean foamOldDirs - # Unload initialisation functions: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ . $WM_PROJECT_DIR/etc/config.sh/functions diff --git a/etc/config.csh/aliases b/etc/config.csh/aliases index d9927fda40..3e7178b979 100644 --- a/etc/config.csh/aliases +++ b/etc/config.csh/aliases @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -84,7 +84,7 @@ alias foamVersion \ # Change ParaView version # ~~~~~~~~~~~~~~~~~~~~~~~ alias foamPV \ - 'source $WM_PROJECT_DIR/etc/config.csh/paraview ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION' + 'source $WM_PROJECT_DIR/etc/config.csh/functions source $WM_PROJECT_DIR/etc/config.csh/paraview ParaView_VERSION=\!*; source $WM_PROJECT_DIR/etc/config.csh/functions; echo paraview-$ParaView_VERSION' #------------------------------------------------------------------------------ diff --git a/etc/config.csh/compiler b/etc/config.csh/compiler new file mode 100644 index 0000000000..5a1dd2bd3b --- /dev/null +++ b/etc/config.csh/compiler @@ -0,0 +1,83 @@ +#----------------------------------*-sh-*-------------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | Website: https://openfoam.org +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation +# \\/ 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 3 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, see . +# +# File +# etc/config.csh/settings +# +# Description +# Startup file for OpenFOAM +# Sourced from OpenFOAM-/etc/cshrc +# +#------------------------------------------------------------------------------ + +switch ("$WM_COMPILER_TYPE") +case OpenFOAM: +case ThirdParty: + + # Default versions of GMP, MPFR and MPC, override as necessary + set gmp_version=gmp-5.1.2 + set mpfr_version=mpfr-3.1.2 + set mpc_version=mpc-1.0.1 + + switch ("$WM_COMPILER") + case Gcc55: + set gcc_version=gcc-5.5.0 + breaksw + case Gcc65: + set gcc_version=gcc-6.5.0 + breaksw + case Gcc74: + set gcc_version=gcc-7.4.0 + breaksw + case Gcc82: + set gcc_version=gcc-8.2.0 + breaksw + case Gcc95: + set gcc_version=gcc-9.5.0 + breaksw + case Gcc111: + set gcc_version=gcc-11.1.0 + breaksw + case Gcc121: + set gcc_version=gcc-12.1.0 + breaksw + case Clang: + # Using clang - not gcc + setenv WM_CC 'clang' + setenv WM_CXX 'clang++' + set clang_version=llvm-3.7.0 + breaksw + default: + /bin/cat <. -# -# File -# config.csh/example/paraview -# -# Description -# Example of chaining to the standard config.csh/paraview with a -# different ParaView_VERSION -# -# Note -# This file could be copied to a user or site location, but should never -# replace the default shipped version as this will cause an infinite loop -# -#------------------------------------------------------------------------------ - -# -# Use other (shipped) paraview.csh with a different ParaView_VERSION -# - -set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o config.csh/paraview` -if ( $status == 0 ) source $foamFile ParaView_VERSION=3.12.0 - -unset foamFile - -#------------------------------------------------------------------------------ diff --git a/etc/config.csh/example/prefs.csh b/etc/config.csh/example/prefs.csh index 2ec7701a1f..74cb565f24 100644 --- a/etc/config.csh/example/prefs.csh +++ b/etc/config.csh/example/prefs.csh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -38,7 +38,7 @@ ## Specify OpenFOAM ThirdParty compiler ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# set WM_COMPILER_TYPE=ThirdParty +#setenv WM_COMPILER_TYPE ThirdParty ## Specify compiler type ## ~~~~~~~~~~~~~~~~~~~~~ @@ -46,7 +46,17 @@ ## Specify system openmpi ## ~~~~~~~~~~~~~~~~~~~~~~ -# setenv WM_MPLIB SYSTEMOPENMPI +#setenv WM_MPLIB SYSTEMOPENMPI +## Specify options for decomposition libraries +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#setenv SCOTCH_TYPE system +#setenv METIS_TYPE ThirdParty +#setenv METIS_VERSION 5.1.0 +#setenv PARMETIS_TYPE ThirdParty +#setenv ZOLTAN_TYPE ThirdParty + +## Specify system ParaView +#setenv ParaView_TYPE system #------------------------------------------------------------------------------ diff --git a/etc/config.csh/functions b/etc/config.csh/functions new file mode 100644 index 0000000000..f10f7c5272 --- /dev/null +++ b/etc/config.csh/functions @@ -0,0 +1,103 @@ +#----------------------------------*-sh-*-------------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | Website: https://openfoam.org +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation +# \\/ 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 3 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, see . +# +# File +# etc/config.csh/functions +# +# Description +# Initialisation script functions for the cshrc environment +# Sourced from OpenFOAM-/etc/cshrc +# +#------------------------------------------------------------------------------ + +if ( ! $?WM_CSH_FUNCTIONS ) then + + # Temporary environment variable for automatically (un)loading functions + set WM_CSH_FUNCTIONS loaded + + # Source files, possibly with some verbosity + alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* != "") source \!*' + + # Evaluate command-line parameters + alias _foamParams 'foreach arg (\!*)\ + switch ($arg)\ + case -*:\ + # stray option (not meant for us here) -> get out\ + break\ + breaksw\ + case *=:\ + # name= -> unsetenv name\ + if ($?FOAM_VERBOSE && $?prompt) echo "unsetenv $arg:s/=//"\ + eval "unsetenv $arg:s/=//"\ + breaksw\ + case *=*:\ + # name=value -> setenv name value\ + if ($?FOAM_VERBOSE && $?prompt) echo "setenv $arg:s/=/ /"\ + eval "setenv $arg:s/=/ /"\ + breaksw\ + default:\ + # ignore non-parameter arguments, e.g. filenames\ + break\ + breaksw\ + endsw\ + end' + + # Prefix to PATH + alias _foamAddPath 'setenv PATH \!*\:${PATH}' + + # Prefix to LD_LIBRARY_PATH + alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}' + + # Prefix to MANPATH + alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}' + + # Find the most recent of a list of versioned directories + alias _foamMostRecentDir 'foreach dir (\!* /dev/nul[l])\ + if ( -d "$dir" ) then\ + if ( $?_mostRecentDir ) then\ + $WM_PROJECT_DIR/bin/tools/foamVersionCompare $_mostRecentDir lt $dir\ + if ( $status == 0 ) then\ + set _mostRecentDir=$dir\ + endif\ + else\ + set _mostRecentDir=$dir\ + endif\ + endif\ + end\ + if ( $?_mostRecentDir ) then\ + echo $_mostRecentDir\ + endif\ + unset _mostRecentDir' + +else + + # Cleanup environment: + # ~~~~~~~~~~~~~~~~~~~~ + unset WM_CSH_FUNCTIONS + unset _foamSource + unset _foamAddPath _foamAddLib _foamAddMan + +endif + + +#------------------------------------------------------------------------------ diff --git a/etc/config.csh/mpi b/etc/config.csh/mpi index 78b14e4742..1964101b58 100644 --- a/etc/config.csh/mpi +++ b/etc/config.csh/mpi @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -30,9 +30,6 @@ # #------------------------------------------------------------------------------ -# Communications library -# ~~~~~~~~~~~~~~~~~~~~~~ - unsetenv MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN switch ("$WM_MPLIB") @@ -43,7 +40,7 @@ case SYSTEMOPENMPI: set libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'` # Bit of a hack: strip off 'lib' and hope this is the path to openmpi - # Include files and libraries. + # include files and libraries. setenv MPI_ARCH_PATH "${libDir:h}" _foamAddLib $libDir @@ -266,7 +263,6 @@ if ( "$FOAM_MPI" != dummy ) then endif - # Set the minimum MPI buffer size (used by all platforms except SGI MPI) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ( ! $?minBufferSize ) set minBufferSize=20000000 @@ -279,4 +275,9 @@ else setenv MPI_BUFFER_SIZE $minBufferSize endif + +# Cleanup environment: +# ~~~~~~~~~~~~~~~~~~~~ +unset minBufferSize + #------------------------------------------------------------------------------ diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview index 7db0f79028..8fa7eae157 100644 --- a/etc/config.csh/paraview +++ b/etc/config.csh/paraview @@ -28,14 +28,8 @@ # Setup file for paraview-[4-5].x # Sourced from OpenFOAM-/etc/cshrc or from foamPV alias # -# Note -# The env. variables 'ParaView_DIR' and 'ParaView_MAJOR' -# are required for building plugins -# #------------------------------------------------------------------------------ -if ( ! $?ParaView_DIR ) setenv ParaView_DIR - # Clean the PATH set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" \ "/opt/paraviewopenfoam \ @@ -44,106 +38,128 @@ set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" \ ` if ( $status == 0 ) setenv PATH $cleaned -# Determine the cmake to be used. Take the most recent. -unsetenv CMAKE_HOME CMAKE_ROOT -set nonomatch -foreach cmake ( $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake-* ) - if ( -d $cmake ) then - if ( $?CMAKE_HOME ) then - $WM_PROJECT_DIR/bin/tools/foamVersionCompare $CMAKE_HOME lt $cmake - endif - if ( ! $?CMAKE_HOME || $status == 0 ) then - setenv CMAKE_HOME $cmake - setenv CMAKE_ROOT $cmake - endif - endif -end -if ( $?CMAKE_HOME ) then - setenv PATH $cmake/bin:${PATH} +# Detect the most recent version of cmake available and add to the PATH +set cmakeDir=`eval _foamMostRecentDir "$WM_THIRD_PARTY_DIR"/platforms/$WM_ARCH$WM_COMPILER/cmake-*` +if ( "$cmakeDir" != "" ) then + setenv PATH $cmakeDir/bin:$PATH endif +unset cmakeDir -#- ParaView version, automatically determine major version: -#setenv ParaView_VERSION 5.6.3 -setenv ParaView_VERSION 5.10.1 -setenv ParaView_MAJOR detect +# Set up the paraview environment +switch ("$ParaView_TYPE") +case none: -#setenv ParaView_GL system -setenv ParaView_GL mesa - -# Evaluate command-line parameters for ParaView -while ( $#argv > 0 ) - switch ($argv[1]) - case ParaView*=*: - # name=value -> setenv name value - eval "setenv $argv[1]:s/=/ /" - breaksw - endsw - shift -end - -# Set MAJOR version to correspond to VERSION -# ParaView_MAJOR is "." from ParaView_VERSION -switch ("$ParaView_VERSION") -case "$ParaView_MAJOR".*: - # Version and major appear to correspond + unset PV_PLUGIN_PATH breaksw -case [0-9]*: - # Extract major from the version - setenv ParaView_MAJOR `echo ${ParaView_VERSION} | \ - sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'` +case system: + + # Look for a paraview installation + set pvserverExe=`which pvserver 2> /dev/null` + if ( $status == 0 ) then + set pvserverBinDir=`dirname $pvserverExe` + set paraviewBinDir=`cd $pvserverBinDir && pwd -P` + endif + + # Set the environment + if ( $?paraviewBinDir ) then + if ( -d "$paraviewBinDir" ) then + setenv ParaView_DIR `dirname paraviewBinDir` + export ParaView_LIB_DIR `unset LD_LIBRARY_PATH && \ + ldd $paraviewBinDir/paraview | \ + grep -o "/.*/libpqCore-pv.*.so" | \ + xargs dirname` + setenv ParaView_VERSION `unset LD_LIBRARY_PATH && \ + pvserver --version 2> /dev/null | \ + awk '{print $NF}'` + setenv ParaView_MAJOR `echo $ParaView_VERSION | sed 's/\.[^\.]\+$//g'` + setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-$ParaView_MAJOR + setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-$ParaView_MAJOR + + # Add to the library path + setenv LD_LIBRARY_PATH ${ParaView_LIB_DIR}:${PV_PLUGIN_PATH}:${LD_LIBRARY_PATH} + endif + endif + + unset pvserverExe paraviewBinDir breaksw + +case paraviewopenfoam: + + # Look for a paraview installation. The version should be set externally. + if ( $?ParaView_VERSION ) then + setenv ParaView_MAJOR `echo $ParaView_VERSION | sed 's/\.[^\.]\+$//g'` + set paraviewDir=/opt/paraviewopenfoam`echo $ParaView_MAJOR | tr -d '.'` + endif + + # Set the environment + if ( $?paraviewDir ) then + if ( -d "$paraviewDir" ) then + setenv ParaView_DIR $paraviewDir + setenv ParaView_LIB_DIR `echo "$ParaView_DIR"/lib* | tr ' ' ':'` + setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-$ParaView_MAJOR + setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-$ParaView_MAJOR + + # Add to the path and the library path + setenv PATH $ParaView_DIR/bin:${PATH} + setenv LD_LIBRARY_PATH ${ParaView_LIB_DIR}:${PV_PLUGIN_PATH}:${LD_LIBRARY_PATH} + endif + endif + + unset paraviewDir + breaksw + +case OpenFOAM: +case ThirdParty: + + # Look for a paraview installation + if ( ! $?ParaView_VERSION ) then + set paraviewDir=`eval _foamMostRecentDir "$WM_THIRD_PARTY_DIR"/platforms/$WM_ARCH$WM_COMPILER/ParaView-*` + else + set paraviewDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-$ParaView_VERSION + endif + + # Set the environment + if ( -d "$paraviewDir" ) then + setenv ParaView_DIR $paraviewDir + setenv ParaView_LIB_DIR `echo "$ParaView_DIR"/lib* | tr ' ' ':'` + setenv ParaView_VERSION `echo $ParaView_DIR | sed 's/.*ParaView-//g'` + setenv ParaView_MAJOR `echo $ParaView_VERSION | sed 's/\.[^\.]\+$//g'` + setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-$ParaView_MAJOR + setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-$ParaView_MAJOR + + # Add to the path and the library path + setenv PATH $ParaView_DIR/bin:${PATH} + setenv LD_LIBRARY_PATH ${ParaView_LIB_DIR}:${PV_PLUGIN_PATH}:${LD_LIBRARY_PATH} + + # Add in python libraries if required + set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping + if ( -r $paraviewPython ) then + if ( $?PYTHONPATH ) then + setenv PYTHONPATH $PYTHONPATH:$paraviewPython:$ParaView_LIB_DIR + else + setenv PYTHONPATH $paraviewPython:$ParaView_LIB_DIR + endif + endif + unset paraviewPython + endif + + unset paraviewDir + breaksw + endsw -# Set the binary and source directories -setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-$ParaView_VERSION -set paraviewSrcDir=$WM_THIRD_PARTY_DIR/ParaView-${ParaView_VERSION} - -# Set paths if binaries or source are present -if ( -d $ParaView_DIR || -d $paraviewSrcDir ) then - setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-${ParaView_MAJOR} - - set paraviewArch= - if ( -d $ParaView_DIR/lib64 ) then - set paraviewArch=64 - endif - set paraviewLibSubDir= - $WM_PROJECT_DIR/bin/tools/foamVersionCompare $ParaView_VERSION lt 5.5.0 - if ( $status == 0 ) then - set paraviewLibSubDir=/paraview-$ParaView_MAJOR - endif - setenv ParaView_LIB_DIR $ParaView_DIR/lib$paraviewArch$paraviewLibSubDir - - setenv PATH ${ParaView_DIR}/bin:${PATH} - setenv LD_LIBRARY_PATH "${ParaView_LIB_DIR}:${LD_LIBRARY_PATH}" - setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-${ParaView_MAJOR} - - if ($?FOAM_VERBOSE && $?prompt) then - echo "Using paraview" - echo " ParaView_DIR : $ParaView_DIR" - echo " ParaView_LIB_DIR : $ParaView_LIB_DIR" - echo " ParaView_INCLUDE_DIR : $ParaView_INCLUDE_DIR" - echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" - endif - - # Add in python libraries if required - set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping - if ( -r $paraviewPython ) then - if ($?PYTHONPATH) then - setenv PYTHONPATH ${PYTHONPATH}:${paraviewPython}:$ParaView_LIB_DIR - else - setenv PYTHONPATH ${paraviewPython}:$ParaView_LIB_DIR - endif - endif - - # Alias paraview to launch with mesa if necessary - if ("$ParaView_GL" == mesa) then - alias paraview 'env LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ParaView_LIB_DIR}/mesa paraview' - endif -else - unsetenv PV_PLUGIN_PATH +# Report +if ( $?ParaView_DIR ) then +if ( -d "$ParaView_DIR" && $?FOAM_VERBOSE && $?prompt ) then + echo "Using paraview" + echo " ParaView_DIR : $ParaView_DIR" + echo " ParaView_LIB_DIR : $ParaView_LIB_DIR" + echo " ParaView_INCLUDE_DIR : $ParaView_INCLUDE_DIR" + echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" +endif endif -unset cleaned cmake paraviewInstDir paraviewPython +unset cleaned #------------------------------------------------------------------------------ diff --git a/etc/config.csh/settings b/etc/config.csh/settings index 15bb9b725b..6bd7c7db3b 100644 --- a/etc/config.csh/settings +++ b/etc/config.csh/settings @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -30,27 +30,26 @@ # #------------------------------------------------------------------------------ -# Prefix to PATH -alias _foamAddPath 'setenv PATH \!*\:${PATH}' -# Prefix to LD_LIBRARY_PATH -alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}' -# Prefix to MANPATH -alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}' - -#------------------------------------------------------------------------------ # Set environment variables according to system type setenv WM_ARCH `uname -s` # Default WM_COMPILER_LIB_ARCH for 32bit setenv WM_COMPILER_LIB_ARCH +# Define compilation flags for the given system type switch ($WM_ARCH) case Linux: setenv WM_ARCH linux + # Compiler specifics switch (`uname -m`) case i686: setenv WM_ARCH_OPTION 32 + setenv WM_CC 'gcc' + setenv WM_CXX 'g++' + setenv WM_CFLAGS '-fPIC' + setenv WM_CXXFLAGS '-fPIC -std=c++0x' + setenv WM_LDFLAGS breaksw case x86_64: @@ -91,6 +90,17 @@ case Linux: setenv WM_LDFLAGS '' breaksw + case armv7l: + setenv WM_ARCH linuxARM7 + setenv WM_ARCH_OPTION 32 + setenv WM_COMPILER_LIB_ARCH 32 + setenv WM_CC 'gcc' + setenv WM_CXX 'g++' + setenv WM_CFLAGS '-fPIC' + setenv WM_CXXFLAGS '-fPIC -std=c++0x' + setenv WM_LDFLAGS + breaksw + case ppc64: setenv WM_ARCH linuxPPC64 setenv WM_COMPILER_LIB_ARCH 64 @@ -129,13 +139,14 @@ case SunOS: setenv WM_LDFLAGS '-mabi=64 -G0' breaksw -default: - echo - echo "Your '$WM_ARCH' operating system is not supported by this release" - echo "of OpenFOAM. For further assistance, please contact https://openfoam.org" - echo - breaksw +default: # An unsupported operating system + /bin/cat <&2 } diff --git a/etc/config.sh/compiler b/etc/config.sh/compiler index 7f2626636f..fd25d200e2 100644 --- a/etc/config.sh/compiler +++ b/etc/config.sh/compiler @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -67,12 +67,16 @@ OpenFOAM | ThirdParty) clang_version=llvm-3.7.0 ;; *) - echo 1>&2 - echo "Warning in $WM_PROJECT_DIR/etc/config.sh/compiler:" 1>&2 - echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" 1>&2 - echo " Please check your settings" 1>&2 - echo 1>&2 + /bin/cat <&2 + +Warning in $WM_PROJECT_DIR/etc/config.sh/compiler: + Unknown OpenFOAM compiler type '$WM_COMPILER' + Please check your settings + +USAGE ;; esac ;; esac + +#------------------------------------------------------------------------------ diff --git a/etc/config.sh/example/paraview b/etc/config.sh/example/paraview deleted file mode 100644 index e57cba359a..0000000000 --- a/etc/config.sh/example/paraview +++ /dev/null @@ -1,46 +0,0 @@ -#----------------------------------*-sh-*-------------------------------------- -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation -# \\/ 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 3 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, see . -# -# File -# config.sh/example/paraview -# -# Description -# Example of chaining to the standard config.sh/paraview with a -# different ParaView_VERSION -# -# Note -# This file could be copied to a user or site location, but should never -# replace the default shipped version as this will cause an infinite loop. -# -#------------------------------------------------------------------------------ - -# -# Use other (shipped) paraview with a different ParaView_VERSION -# - -foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config.sh/paraview 2>/dev/null) -[ $? -eq 0 ] && . $foamFile ParaView_VERSION=3.12.0 - -unset foamFile - -#------------------------------------------------------------------------------ diff --git a/etc/config.sh/example/prefs.sh b/etc/config.sh/example/prefs.sh index 0e1cf24bb8..b8ffe0d3c0 100644 --- a/etc/config.sh/example/prefs.sh +++ b/etc/config.sh/example/prefs.sh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -38,7 +38,7 @@ ## Specify OpenFOAM ThirdParty compiler ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#WM_COMPILER_TYPE=ThirdParty +#export WM_COMPILER_TYPE=ThirdParty ## Specify compiler type ## ~~~~~~~~~~~~~~~~~~~~~ @@ -48,5 +48,15 @@ ## ~~~~~~~~~~~~~~~~~~~~~~ #export WM_MPLIB=SYSTEMOPENMPI +## Specify options for decomposition libraries +## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#export SCOTCH_TYPE=system +#export METIS_TYPE=ThirdParty +#export METIS_VERSION=5.1.0 +#export PARMETIS_TYPE=ThirdParty +#export ZOLTAN_TYPE=ThirdParty + +## Specify system ParaView +#export ParaView_TYPE=system #------------------------------------------------------------------------------ diff --git a/etc/config.sh/functions b/etc/config.sh/functions index 8a7ef9d720..9c3a4d99ce 100644 --- a/etc/config.sh/functions +++ b/etc/config.sh/functions @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -26,7 +26,7 @@ # # Description # Initialisation script functions for the bashrc environment -# Sourced from OpenFOAM-/etc/config.sh/bashrc +# Sourced from OpenFOAM-/etc/bashrc # #------------------------------------------------------------------------------ @@ -102,12 +102,44 @@ then done } + # Find the most recent of a list of versioned directories + _foamMostRecentDir() + { + _mostRecentDir= + + while [ $# -gt 0 ] + do + if [ -d "$1" ] + then + if [ -z "$_mostRecentDir" ] || + "$WM_PROJECT_DIR"/bin/tools/foamVersionCompare \ + "$_mostRecentDir" lt $1 + then + _mostRecentDir=$1 + fi + fi + shift + done + + if [ -n "$_mostRecentDir" ] + then + echo "$_mostRecentDir" + fi + + unset _mostRecentDir + } + else # Cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ unset WM_BASH_FUNCTIONS + unset _foamSource + unset _foamParams unset _foamAddPath _foamAddLib _foamAddMan - unset _foamSource _foamParams + unset _foamMostRecentDir fi + + +#------------------------------------------------------------------------------ diff --git a/etc/config.sh/metis b/etc/config.sh/metis index 40ef6aa0f9..a40707ac55 100644 --- a/etc/config.sh/metis +++ b/etc/config.sh/metis @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -34,7 +34,37 @@ # #------------------------------------------------------------------------------ -export METIS_VERSION=metis-5.1.0 -export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION +# Load functions +. $WM_PROJECT_DIR/etc/config.sh/functions + +# Find the path to the metis installation +case "$METIS_TYPE" in +none) + ;; +system) + export METIS_VERSION=system + export METIS_ARCH_PATH=/usr + ;; +OpenFOAM | ThirdParty) + # Look for the source directory + if [ -z "$METIS_VERSION" ] + then + metisSrcDir=$(_foamMostRecentDir "$WM_THIRD_PARTY_DIR"/metis-*) + else + metisSrcDir=$WM_THIRD_PARTY_DIR/metis-$METIS_VERSION + fi + # Set the version and the installation path + if [ -d "$metisSrcDir" ] + then + export METIS_VERSION=${metisSrcDir##*metis-} + export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/metis-$METIS_VERSION + fi + # Clean up + unset metisSrcDir + ;; +esac + +# Unload functions +. $WM_PROJECT_DIR/etc/config.sh/functions #------------------------------------------------------------------------------ diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi index b368cc51ad..8981d68592 100644 --- a/etc/config.sh/mpi +++ b/etc/config.sh/mpi @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -267,7 +267,6 @@ then fi - # Set the minimum MPI buffer size (used by all platforms except SGI MPI) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ : ${minBufferSize:=20000000} diff --git a/etc/config.sh/parMetis b/etc/config.sh/parMetis index 000835f947..a32dcf2b5c 100644 --- a/etc/config.sh/parMetis +++ b/etc/config.sh/parMetis @@ -34,7 +34,38 @@ # #------------------------------------------------------------------------------ -export PARMETIS_VERSION=parmetis-4.0.3 -export PARMETIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$PARMETIS_VERSION +# Load functions +. $WM_PROJECT_DIR/etc/config.sh/functions + +# Find the path to the parMetis installation +case "$PARMETIS_TYPE" in +none) + ;; +system) + export PARMETIS_VERSION=system + export PARMETIS_ARCH_PATH=/usr + ;; +OpenFOAM | ThirdParty) + # Look for the source directory + if [ -z "$PARMETIS_VERSION" ] + then + parMetisSrcDir=$(_foamMostRecentDir "$WM_THIRD_PARTY_DIR"/parmetis-*) + else + parMetisSrcDir=$WM_THIRD_PARTY_DIR/parmetis-$PARMETIS_VERSION + fi + # Set the version and the installation path + if [ -d "$parMetisSrcDir" ] + then + export PARMETIS_VERSION=${parMetisSrcDir##*parmetis-} + export PARMETIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/parmetis-$PARMETIS_VERSION + fi + # Clean up + unset parMetisSrcDir + ;; +esac + +# Unload functions +. $WM_PROJECT_DIR/etc/config.sh/functions + #------------------------------------------------------------------------------ diff --git a/etc/config.sh/paraview b/etc/config.sh/paraview index 2c73bfde78..5cac9f8b4e 100644 --- a/etc/config.sh/paraview +++ b/etc/config.sh/paraview @@ -28,135 +28,138 @@ # Setup file for paraview-[4-5].x # Sourced from OpenFOAM-/etc/bashrc or from foamPV alias # -# Note -# The env. variables 'ParaView_DIR' and 'ParaView_MAJOR' -# are required for building plugins #------------------------------------------------------------------------------ # Clean the PATH -cleaned=$($WM_PROJECT_DIR/bin/foamCleanPath "$PATH" \ +cleaned=$("$WM_PROJECT_DIR"/bin/foamCleanPath "$PATH" \ "/opt/paraviewopenfoam \ $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- \ $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-" \ ) \ && PATH="$cleaned" -# Determine the cmake to be used. Take the most recent. -unset CMAKE_HOME CMAKE_ROOT -for cmake in $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake-* -do - if [ -d $cmake ] - then - if [ -z $CMAKE_HOME ] || \ - $WM_PROJECT_DIR/bin/tools/foamVersionCompare $CMAKE_HOME lt $cmake - then - export CMAKE_HOME=$cmake - export CMAKE_ROOT=$cmake - fi - fi -done -if [ -n $CMAKE_HOME ] +# Detect the most recent version of cmake available and add to the PATH +cmakeDir=$(_foamMostRecentDir "$WM_THIRD_PARTY_DIR"/platforms/$WM_ARCH$WM_COMPILER/cmake-*) +if [ -n "$cmakeDir" ] then - export PATH=$cmake/bin:$PATH + export PATH=$cmakeDir/bin:$PATH fi +unset cmakeDir -#- ParaView version, automatically determine major version -#export ParaView_VERSION=5.6.3 -export ParaView_VERSION=5.10.1 -export ParaView_MAJOR=detect - -#export ParaView_GL=system -export ParaView_GL=mesa - -# Evaluate command-line parameters for ParaView -_foamParaviewEval() -{ - while [ $# -gt 0 ] - do - case "$1" in - ParaView*=*) - # name=value -> export name=value - eval "export $1" - ;; - esac - shift - done -} - -# Evaluate command-line parameters -_foamParaviewEval $@ - -# Set MAJOR version to correspond to VERSION -# ParaView_MAJOR is "." from ParaView_VERSION -case "$ParaView_VERSION" in -"$ParaView_MAJOR".* ) - # Version and major appear to correspond +# Set up the paraview environment +case "$ParaView_TYPE" in +none) ;; -[0-9]*) - # Extract major from the version - ParaView_MAJOR=$(echo $ParaView_VERSION | \ - sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/') +system) + + # Look for a paraview installation + if pvserverExe=$(which pvserver 2> /dev/null) + then + paraviewBinDir=$(dirname $pvserverExe) + paraviewBinDir=$(cd $paraviewBinDir && pwd -P) + fi + + # Set the environment + if [ -d "$paraviewBinDir" ] + then + export ParaView_DIR=$(dirname $paraviewBinDir) + export ParaView_LIB_DIR=$(unset LD_LIBRARY_PATH && \ + ldd $paraviewBinDir/paraview | \ + grep -o "/.*/libpqCore-pv.*.so" | \ + xargs dirname) + export ParaView_VERSION=$(unset LD_LIBRARY_PATH && \ + pvserver --version 2> /dev/null | \ + awk '{print $NF}') + export ParaView_MAJOR=${ParaView_VERSION%.*} + export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-$ParaView_MAJOR + export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR + + # Add to the library path + export LD_LIBRARY_PATH=$ParaView_LIB_DIR:$PV_PLUGIN_PATH:$LD_LIBRARY_PATH + fi + + unset pvserverExe paraviewBinDir ;; + +paraviewopenfoam) + + # Look for a paraview installation. The version should be set externally. + if [ -n "$ParaView_VERSION" ] + then + export ParaView_MAJOR=${ParaView_VERSION%.*} + paraviewDir=/opt/paraviewopenfoam$(echo "$ParaView_MAJOR" | tr -d '.') + fi + + # Set the environment + if [ -d "$paraviewDir" ] + then + export ParaView_DIR=$paraviewDir + export ParaView_LIB_DIR=$(echo "$ParaView_DIR"/lib* | tr ' ' ':') + export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-$ParaView_MAJOR + export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR + + # Add to the path and the library path + export PATH=$ParaView_DIR/bin:$PATH + export LD_LIBRARY_PATH=$ParaView_LIB_DIR:$PV_PLUGIN_PATH:$LD_LIBRARY_PATH + fi + + unset paraviewDir + ;; + +OpenFOAM | ThirdParty) + + # Look for a paraview installation + if [ -z "$ParaView_VERSION" ] + then + paraviewDir=$(_foamMostRecentDir "$WM_THIRD_PARTY_DIR"/platforms/$WM_ARCH$WM_COMPILER/ParaView-*) + else + paraviewDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-$ParaView_VERSION + fi + + # Set the environment + if [ -d "$paraviewDir" ] + then + export ParaView_DIR=$paraviewDir + export ParaView_LIB_DIR=$(echo "$ParaView_DIR"/lib* | tr ' ' ':') + export ParaView_VERSION=${paraviewDir##*ParaView-} + export ParaView_MAJOR=${ParaView_VERSION%.*} + export ParaView_INCLUDE_DIR=$paraviewDir/include/paraview-$ParaView_MAJOR + export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR + + # Add to the path and the library path + export PATH=$ParaView_DIR/bin:$PATH + export LD_LIBRARY_PATH=$ParaView_LIB_DIR:$PV_PLUGIN_PATH:$LD_LIBRARY_PATH + + # Add in python libraries if required + paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping + if [ -r "$paraviewPython" ] + then + if [ "$PYTHONPATH" ] + then + export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_LIB_DIR + else + export PYTHONPATH=$paraviewPython:$ParaView_LIB_DIR + fi + fi + unset paraviewPython + fi + + unset paraviewDir + ;; + esac -export ParaView_VERSION ParaView_MAJOR -# Set the binary and source directories -export ParaView_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-$ParaView_VERSION -paraviewSrcDir=$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION - -# Set paths if binaries or source are present -if [ -d $ParaView_DIR -o -d $paraviewSrcDir ] +# Report +if [ "$FOAM_VERBOSE" ] && [ "$PS1" ] && [ -d "$ParaView_DIR" ] then - export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-$ParaView_MAJOR - - paraviewArch= - if [ -d $ParaView_DIR/lib64 ] - then - paraviewArch=64 - fi - paraviewLibSubDir= - if $WM_PROJECT_DIR/bin/tools/foamVersionCompare $ParaView_VERSION lt 5.5.0 - then - paraviewLibSubDir=/paraview-$ParaView_MAJOR - fi - export ParaView_LIB_DIR=$ParaView_DIR/lib$paraviewArch$paraviewLibSubDir - - export PATH=$ParaView_DIR/bin:$PATH - export LD_LIBRARY_PATH=$ParaView_LIB_DIR:$LD_LIBRARY_PATH - export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR - - if [ "$FOAM_VERBOSE" -a "$PS1" ] - then - echo "Using paraview" - echo " ParaView_DIR : $ParaView_DIR" - echo " ParaView_LIB_DIR : $ParaView_LIB_DIR" - echo " ParaView_INCLUDE_DIR : $ParaView_INCLUDE_DIR" - echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" - fi - - # Add in python libraries if required - paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping - if [ -r $paraviewPython ] - then - if [ "$PYTHONPATH" ] - then - export PYTHONPATH=$PYTHONPATH:$paraviewPython:$ParaView_LIB_DIR - else - export PYTHONPATH=$paraviewPython:$ParaView_LIB_DIR - fi - fi - - # Alias paraview to launch with mesa if necessary - if [ "$ParaView_GL" = mesa ] - then - alias paraview='LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ParaView_LIB_DIR/mesa paraview' - fi -else - unset PV_PLUGIN_PATH + echo "Using paraview" + echo " ParaView_DIR : $ParaView_DIR" + echo " ParaView_LIB_DIR : $ParaView_LIB_DIR" + echo " ParaView_INCLUDE_DIR : $ParaView_INCLUDE_DIR" + echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" fi -unset _foamParaviewEval -unset cleaned cmake paraviewInstDir paraviewPython +unset cleaned #------------------------------------------------------------------------------ diff --git a/etc/config.sh/scotch b/etc/config.sh/scotch index a345a2d00c..7693417ed4 100644 --- a/etc/config.sh/scotch +++ b/etc/config.sh/scotch @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -32,12 +32,39 @@ # A csh version is not needed, since the values here are only sourced # during the wmake process # -# If Scotch is to be entirely disabled, either rename this file or create -# an empty one with the same name at a user or site location. -# #------------------------------------------------------------------------------ -export SCOTCH_VERSION=scotch_6.0.9 -export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION +# Load functions +. $WM_PROJECT_DIR/etc/config.sh/functions + +# Find the path to the scotch installation +case "$SCOTCH_TYPE" in +none) + ;; +system) + export SCOTCH_VERSION=system + export SCOTCH_ARCH_PATH=/usr + ;; +OpenFOAM | ThirdParty) + # Look for the source directory + if [ -z "$SCOTCH_VERSION" ] + then + scotchSrcDir=$(_foamMostRecentDir "$WM_THIRD_PARTY_DIR"/scotch_*) + else + scotchSrcDir=$WM_THIRD_PARTY_DIR/scotch_$SCOTCH_VERSION + fi + # Set the version and the installation path + if [ -d "$scotchSrcDir" ] + then + export SCOTCH_VERSION=${scotchSrcDir##*scotch_} + export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/scotch_$SCOTCH_VERSION + fi + # Clean up + unset scotchSrcDir + ;; +esac + +# Unload functions +. $WM_PROJECT_DIR/etc/config.sh/functions #------------------------------------------------------------------------------ diff --git a/etc/config.sh/settings b/etc/config.sh/settings index b7540d195f..0a69a70190 100644 --- a/etc/config.sh/settings +++ b/etc/config.sh/settings @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -33,20 +33,21 @@ # Set environment variables according to system type export WM_ARCH=`uname -s` +# Define compilation flags for the system type case "$WM_ARCH" in Linux) WM_ARCH=linux # Compiler specifics case `uname -m` in - i686) - export WM_ARCH_OPTION=32 - export WM_CC='gcc' - export WM_CXX='g++' - export WM_CFLAGS='-fPIC' - export WM_CXXFLAGS='-fPIC -std=c++0x' - export WM_LDFLAGS= - ;; + i686) + export WM_ARCH_OPTION=32 + export WM_CC='gcc' + export WM_CXX='g++' + export WM_CFLAGS='-fPIC' + export WM_CXXFLAGS='-fPIC -std=c++0x' + export WM_LDFLAGS= + ;; x86_64) case "$WM_ARCH_OPTION" in @@ -58,6 +59,7 @@ Linux) export WM_CXXFLAGS='-m32 -fPIC -std=c++0x' export WM_LDFLAGS='-m32' ;; + 64) WM_ARCH=linux64 export WM_COMPILER_LIB_ARCH=64 @@ -67,10 +69,11 @@ Linux) export WM_CXXFLAGS='-m64 -fPIC -std=c++0x' export WM_LDFLAGS='-m64' ;; + *) - echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"\ - 1>&2 + echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64" 1>&2 ;; + esac ;; @@ -132,7 +135,7 @@ SunOS) export WM_LDFLAGS='-mabi=64 -G0' ;; -*) # An unsupported operating system +*) # An unsupported operating system /bin/cat <&2 Your "$WM_ARCH" operating system is not supported by this release @@ -220,8 +223,10 @@ unset MPFR_ARCH_PATH GMP_ARCH_PATH if [ -z "$WM_COMPILER_TYPE" ] then WM_COMPILER_TYPE=system - echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2 - echo " WM_COMPILER_TYPE not set, using '$WM_COMPILER_TYPE'" 1>&2 + /bin/cat <&2 +Warning in $WM_PROJECT_DIR/etc/config.sh/settings: + WM_COMPILER_TYPE not set, using '$WM_COMPILER_TYPE' +USAGE fi # Load configured compiler versions, regardless of the compiler type @@ -236,18 +241,23 @@ OpenFOAM | ThirdParty) gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version - mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version + if [ -n "$mpc_version" ] + then + mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version + fi # Check that the compiler directory can be found - [ -d "$gccDir" ] || { - echo 1>&2 - echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2 - echo " Cannot find $gccDir installation." 1>&2 - echo " Please install this compiler version or if you wish to" \ - " use the system compiler," 1>&2 - echo " change the 'WM_COMPILER_TYPE' setting to 'system'" 1>&2 - echo - } + if [ ! -d "$gccDir" ] + then + /bin/cat <&2 + +Warning in $WM_PROJECT_DIR/etc/config.sh/settings: + Cannot find $gccDir installation. + Please install this compiler version or if you wish to use the system compiler, + change the 'WM_COMPILER_TYPE' setting to 'system' + +USAGE + fi _foamAddMan $gccDir/man _foamAddPath $gccDir/bin @@ -266,35 +276,45 @@ OpenFOAM | ThirdParty) fi fi unset gcc_version gccDir - unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir + unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir if [ -n "$clang_version" ] then clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version # Check that the compiler directory can be found - [ -d "$clangDir" ] || { - echo 1>&2 - echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2 - echo " Cannot find $clangDir installation." 1>&2 - echo " Please install this compiler version or if you wish to" \ - " use the system compiler," 1>&2 - echo " change the 'WM_COMPILER_TYPE' setting to 'system'" 1>&2 - echo 1>&2 - } + if [ ! -d "$clangDir" ] + then + /bin/cat <&2 + +Warning in $WM_PROJECT_DIR/etc/config.sh/settings: + Cannot find $clangDir installation. + Please install this compiler version or if you wish to use the system compiler, + change the 'WM_COMPILER_TYPE' setting to 'system' + +USAGE + fi _foamAddMan $clangDir/share/man _foamAddPath $clangDir/bin fi unset clang_version clangDir ;; + system) # Use system compiler ;; + *) - echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2 - echo " treating as 'system' instead" 1>&2 + /bin/cat <&2 +Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported + treating as 'system' instead +USAGE ;; esac +# Cleanup environment: +# ~~~~~~~~~~~~~~~~~~~~ +unset WM_COMPILER_TYPE + #------------------------------------------------------------------------------ diff --git a/etc/config.sh/unset b/etc/config.sh/unset index 9daa01a9fd..11efd98903 100644 --- a/etc/config.sh/unset +++ b/etc/config.sh/unset @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -69,6 +69,7 @@ unset WM_PROJECT_SITE unset WM_PROJECT_USER_DIR unset WM_PROJECT_VERSION unset WM_SCHEDULER +unset WM_THIRD_PARTY unset WM_THIRD_PARTY_DIR @@ -97,6 +98,9 @@ unset FOAM_TUTORIALS unset FOAM_USER_APPBIN unset FOAM_USER_LIBBIN unset FOAM_UTILITIES +unset FOAM_SETNAN +unset FOAM_VERBOSE +unset FOAM_ABORT #------------------------------------------------------------------------------ @@ -113,16 +117,23 @@ fi #------------------------------------------------------------------------------ -# Unset Ensight/ParaView-related environment variables +# Unset Ensight/Decomposition/ParaView-related environment variables unset ENSIGHT9_READER -unset CMAKE_HOME +unset SCOTCH_TYPE +unset SCOTCH_VERSION +unset METIS_TYPE +unset METIS_VERSION +unset PARMETIS_TYPE +unset PARMETIS_VERSION +unset ZOLTAN_TYPE +unset ZOLTAN_VERSION +unset ParaView_TYPE unset ParaView_DIR unset ParaView_INCLUDE_DIR unset ParaView_LIB_DIR unset ParaView_MAJOR unset ParaView_VERSION -unset ParaView_GL unset PV_PLUGIN_PATH @@ -155,6 +166,7 @@ unalias wm32 unalias wmSP unalias wmDP +unset wmRefresh unalias wmUnset unalias wmSchedOn @@ -171,7 +183,6 @@ unalias util unalias tut unalias run -unset wmRefresh unset foamVersion unset foamPV diff --git a/etc/config.sh/zoltan b/etc/config.sh/zoltan index d5264f41c6..6103cb5762 100644 --- a/etc/config.sh/zoltan +++ b/etc/config.sh/zoltan @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -34,7 +34,38 @@ # #------------------------------------------------------------------------------ -export ZOLTAN_VERSION=Zoltan-3.90 -export ZOLTAN_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$ZOLTAN_VERSION +# Load functions +. $WM_PROJECT_DIR/etc/config.sh/functions + +# Find the path to the zoltan installation +case "$ZOLTAN_TYPE" in +none) + ;; +system) + export ZOLTAN_VERSION=system + export ZOLTAN_ARCH_PATH=/usr + ;; +OpenFOAM | ThirdParty) + # Look for the source directory + if [ -z "$ZOLTAN_VERSION" ] + then + zoltanSrcDir=$(_foamMostRecentDir "$WM_THIRD_PARTY_DIR"/Zoltan-*) + else + zoltanSrcDir=$WM_THIRD_PARTY_DIR/Zoltan-$ZOLTAN_VERSION + fi + # Set the version and the installation path + if [ -d "$zoltanSrcDir" ] + then + export ZOLTAN_VERSION=${zoltanSrcDir##*Zoltan-} + export ZOLTAN_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/Zoltan-$ZOLTAN_VERSION + fi + # Clean up + unset zoltanSrcDir + ;; +esac + +# Unload functions +. $WM_PROJECT_DIR/etc/config.sh/functions + #------------------------------------------------------------------------------ diff --git a/etc/cshrc b/etc/cshrc index d2c5194f8d..2806ebad0c 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -31,19 +31,26 @@ #------------------------------------------------------------------------------ setenv WM_PROJECT OpenFOAM +setenv WM_THIRD_PARTY ThirdParty setenv WM_PROJECT_VERSION dev ################################################################################ # USER EDITABLE PART: Changes made here may be lost with the next upgrade # # FOAM_INST_DIR is the location of the OpenFOAM installation which defaults to -# the directory containing this file. +# the directory two levels below this file, or $HOME/$WM_PROJECT if that +# directory cannot be determined. # -# Please set to the appropriate path if the default is not correct. +set foamInstDir=`lsof +p $$ |& sed -n 's%.* \(/.*\)/[^/]\+/etc/cshrc$%\1%p'` +if ( -d "$foamInstDir" ) then + setenv FOAM_INST_DIR $foamInstDir +else + setenv FOAM_INST_DIR $HOME/$WM_PROJECT +endif +unset foamInstDir +# +# Please set to the appropriate path if the above default is not correct. E.g., # -setenv FOAM_INST_DIR `lsof +p $$ |& grep -oE '/.*'$WM_PROJECT'[^/]*/etc/cshrc' | \ - sed 's%/'$WM_PROJECT'[^/]*/etc/cshrc%%'` -# setenv FOAM_INST_DIR $HOME/$WM_PROJECT # setenv FOAM_INST_DIR ~$WM_PROJECT # setenv FOAM_INST_DIR /opt/$WM_PROJECT # setenv FOAM_INST_DIR /usr/local/$WM_PROJECT @@ -51,7 +58,7 @@ setenv FOAM_INST_DIR `lsof +p $$ |& grep -oE '/.*'$WM_PROJECT'[^/]*/etc/cshrc' | # END OF (NORMAL) USER EDITABLE PART ################################################################################ -# The default environment variables below can be overridden in a prefs.sh file +# The default environment variables below can be overridden in a prefs.csh file # located in ~/.OpenFOAM/$WM_PROJECT_VERSION, ~/.OpenFOAM, # $FOAM_INST_DIR/site/$WM_PROJECT_VERSION or $FOAM_INST_DIR/site @@ -91,11 +98,22 @@ setenv WM_MPLIB SYSTEMOPENMPI # WM_OSTYPE = POSIX | ??? setenv WM_OSTYPE POSIX +#- Decomposition libraries: +# _TYPE = none | system | ThirdParty (OpenFOAM) +setenv SCOTCH_TYPE ThirdParty +setenv METIS_TYPE none +setenv PARMETIS_TYPE none +setenv ZOLTAN_TYPE none + +#- ParaView installation: +# ParaView_TYPE = none | system | paraviewopenfoam | ThirdParty (OpenFOAM) +setenv ParaView_TYPE ThirdParty + #- Floating-point signal handling: # set or unset setenv FOAM_SIGFPE -#- memory initialisation: +#- Memory initialisation: # set or unset #setenv FOAM_SETNAN @@ -125,9 +143,25 @@ endif setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION +# Source initialisation functions +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +source $WM_PROJECT_DIR/etc/config.csh/functions + +# Add in preset user or site preferences: +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh` + +# Evaluate command-line parameters of the form "param=keyword" or unset +# parameters with "param=" +setenv FOAM_SETTINGS "${*}" +_foamParams ${*} + # Location of third-party software # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION +if ( `echo $WM_PROJECT_DIR | sed 's/.*\///g'` == `echo $WM_THIRD_PARTY | sed 's/\/.*//g'` ) then + setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/$WM_THIRD_PARTY +else + setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/$WM_THIRD_PARTY-$WM_PROJECT_VERSION +endif # Location of site-specific templates etc # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -143,43 +177,7 @@ endif # ~~~~~~~~~~~~~~~~~~~~~~ setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION - -# Source files, possibly with some verbosity -alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* != "") source \!*' - -# Add in preset user or site preferences: -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh` - -# Evaluate command-line parameters of the form "param=keyword" or unset -# parameters with "param=" -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: - # ignore non-parameter arguments, e.g. filenames - break - breaksw - endsw - shift -end - - -# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath #- prevent local variables from shadowing setenv variables @@ -234,9 +232,12 @@ if ( $?LD_PRELOAD ) then endif -# cleanup environment: +# Cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ unset cleaned foamClean foamOldDirs -unalias _foamSource + +# Unload initialisation functions: +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +source $WM_PROJECT_DIR/etc/config.csh/functions #------------------------------------------------------------------------------ diff --git a/src/parallel/decompose/metis/Allwmake b/src/parallel/decompose/metis/Allwmake index b0579c5f78..9215107a0b 100755 --- a/src/parallel/decompose/metis/Allwmake +++ b/src/parallel/decompose/metis/Allwmake @@ -4,20 +4,15 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -# get METIS_VERSION, METIS_ARCH_PATH -if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis` -then - . $settings +# Build if Metis is enabled +case $METIS_TYPE in +none) + ;; +*) + . $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis) echo " using METIS_ARCH_PATH=$METIS_ARCH_PATH" - if [ -r "$METIS_ARCH_PATH/lib/libmetis.so" ] - then - wmake $targetType - fi -else - echo - echo " Error: no config.sh/metis settings" - echo -fi - + wmake $targetType + ;; +esac #------------------------------------------------------------------------------ diff --git a/src/parallel/decompose/parMetis/Allwmake b/src/parallel/decompose/parMetis/Allwmake index a1e6327adf..5be6f60fa9 100755 --- a/src/parallel/decompose/parMetis/Allwmake +++ b/src/parallel/decompose/parMetis/Allwmake @@ -4,23 +4,16 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeMpiLib - -# get PARMETIS_VERSION, PARMETIS_ARCH_PATH -if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config.sh/parMetis` -then - . $settings +# Build if ParMetis is enabled +case $PARMETIS_TYPE in +none) + ;; +*) + . $WM_PROJECT_DIR/wmake/scripts/AllwmakeMpiLib + . $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/parMetis) echo " using PARMETIS_ARCH_PATH=$PARMETIS_ARCH_PATH" - if [ -r "$PARMETIS_ARCH_PATH/lib/libparmetis.so" ] - then - wmakeMpiLib $PARMETIS_VERSION parMetis - else - echo " skipping parMetis" - fi -else - echo - echo " Error: no config.sh/parMetis settings" - echo -fi + wmakeMpiLib parmetis-$PARMETIS_VERSION parMetis + ;; +esac #------------------------------------------------------------------------------ diff --git a/src/parallel/decompose/ptscotch/Allwmake b/src/parallel/decompose/ptscotch/Allwmake index 4d316e4edb..8fbf4ae38c 100755 --- a/src/parallel/decompose/ptscotch/Allwmake +++ b/src/parallel/decompose/ptscotch/Allwmake @@ -4,25 +4,21 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeMpiLib - -# Get SCOTCH_VERSION, SCOTCH_ARCH_PATH -if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch` +# Build if Scotch is enabled and MPI is available +if [ -n "$WM_MPLIB" ] && [ -d "$FOAM_LIBBIN/$FOAM_MPI" ] then - . $settings - echo " using SCOTCH_ARCH_PATH=$SCOTCH_ARCH_PATH" - if [ -n "$SCOTCH_ARCH_PATH" ] \ - && [ -n "$WM_MPLIB" ] \ - && [ -d "$FOAM_LIBBIN/$FOAM_MPI" ] - then - wmakeMpiLib $SCOTCH_VERSION ptscotch - else - echo " skipping ptscotch" - fi + case $SCOTCH_TYPE in + none) + ;; + *) + . $WM_PROJECT_DIR/wmake/scripts/AllwmakeMpiLib + . $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch) + echo " using SCOTCH_ARCH_PATH=$SCOTCH_ARCH_PATH" + wmakeMpiLib scotch_$SCOTCH_VERSION ptscotch + ;; + esac else - echo - echo " Error: no config.sh/scotch settings" - echo + echo " skipping ptscotch" fi #------------------------------------------------------------------------------ diff --git a/src/parallel/decompose/scotch/Allwmake b/src/parallel/decompose/scotch/Allwmake index 96c9bd68ae..1b7e2e5c10 100755 --- a/src/parallel/decompose/scotch/Allwmake +++ b/src/parallel/decompose/scotch/Allwmake @@ -4,19 +4,15 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -# Get SCOTCH_VERSION, SCOTCH_ARCH_PATH -if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch` -then - . $settings +# Build if Scotch is enabled +case $SCOTCH_TYPE in +none) + ;; +*) + . $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch) echo " using SCOTCH_ARCH_PATH=$SCOTCH_ARCH_PATH" - if [ -n "$SCOTCH_ARCH_PATH" ] - then - wmake $targetType - fi -else - echo - echo " Error: no config.sh/scotch settings" - echo -fi + wmake $targetType + ;; +esac #------------------------------------------------------------------------------ diff --git a/src/parallel/decompose/zoltan/Allwmake b/src/parallel/decompose/zoltan/Allwmake index 3b03cc3885..6b2e4dac8e 100755 --- a/src/parallel/decompose/zoltan/Allwmake +++ b/src/parallel/decompose/zoltan/Allwmake @@ -4,28 +4,16 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeMpiLib - -# Get ZOLTAN_VERSION, ZOLTAN_ARCH_PATH -if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan` -then - . $settings +# Build if Zoltan is enabled +case $ZOLTAN_TYPE in +none) + ;; +*) + . $WM_PROJECT_DIR/wmake/scripts/AllwmakeMpiLib + . $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan) echo " using ZOLTAN_ARCH_PATH=$ZOLTAN_ARCH_PATH" - if [ -n "$ZOLTAN_ARCH_PATH" ] \ - && [ -r "$ZOLTAN_ARCH_PATH/include/zoltan.h" ] \ - && { \ - [ -r "$FOAM_EXT_LIBBIN/$FOAM_MPI/libzoltan.a" ] \ - || [ -r "$ZOLTAN_ARCH_PATH/lib/libzoltan.a" ]; \ - } - then - wmakeMpiLib $ZOLTAN_VERSION zoltan - else - echo " skipping zoltan" - fi -else - echo - echo " Error: no config.sh/zoltan settings" - echo -fi + wmakeMpiLib Zoltan-$ZOLTAN_VERSION zoltan + ;; +esac #------------------------------------------------------------------------------