Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2011-01-17 16:00:20 +00:00
53 changed files with 554 additions and 351 deletions

View File

@ -1,6 +1,6 @@
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
OpenFOAM(R) is Copyright (C) 1991-2010 OpenCFD Ltd. OpenFOAM(R) is Copyright (C) 2004-2011 OpenCFD Ltd.
Contact: OpenCFD (enquiries@OpenCFD.co.uk) Contact: OpenCFD (enquiries@OpenCFD.co.uk)
You may use, distribute and copy the OpenFOAM CFD Toolbox under the terms You may use, distribute and copy the OpenFOAM CFD Toolbox under the terms

View File

@ -1,6 +1,6 @@
label nAlphaCorr(readLabel(piso.lookup("nAlphaCorr"))); label nAlphaCorr(readLabel(piso.lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(piso.lookup("nAlphaSubCycles")))); label nAlphaSubCycles(readLabel(piso.lookup("nAlphaSubCycles")));
if (nAlphaSubCycles > 1) if (nAlphaSubCycles > 1)
{ {

View File

@ -1 +1 @@
EXE_LIBS = $(LIB_WM_OPTIONS_DIR)/libfbsdmalloc.o EXE_LIBS = $(FOAM_EXT_LIBBIN)/libfbsdmalloc.o

View File

@ -9,4 +9,4 @@ vtkPV3FoamMeshZone.C
vtkPV3FoamUpdateInfo.C vtkPV3FoamUpdateInfo.C
vtkPV3FoamUtils.C vtkPV3FoamUtils.C
LIB = $(FOAM_EXT_LIBBIN)/libvtkPV3Foam LIB = $(FOAM_LIBBIN)/libvtkPV3Foam

View File

@ -19,5 +19,5 @@ LIB_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lgenericPatchFields \ -lgenericPatchFields \
-llagrangian \ -llagrangian \
-L$(FOAM_EXT_LIBBIN) -lvtkPV3Readers \ -L$(FOAM_LIBBIN) -lvtkPV3Readers \
$(GLIBS) $(GLIBS)

View File

@ -2,4 +2,4 @@ vtkPV3blockMesh.C
vtkPV3blockMeshConvert.C vtkPV3blockMeshConvert.C
vtkPV3blockMeshUtils.C vtkPV3blockMeshUtils.C
LIB = $(FOAM_EXT_LIBBIN)/libvtkPV3blockMesh LIB = $(FOAM_LIBBIN)/libvtkPV3blockMesh

View File

@ -10,5 +10,5 @@ EXE_INC = \
LIB_LIBS = \ LIB_LIBS = \
-lmeshTools \ -lmeshTools \
-lblockMesh \ -lblockMesh \
-L$(FOAM_EXT_LIBBIN) -lvtkPV3Readers \ -L$(FOAM_LIBBIN) -lvtkPV3Readers \
$(GLIBS) $(GLIBS)

View File

@ -1,3 +1,3 @@
vtkPV3Readers.C vtkPV3Readers.C
LIB = $(FOAM_EXT_LIBBIN)/libvtkPV3Readers LIB = $(FOAM_LIBBIN)/libvtkPV3Readers

View File

@ -73,13 +73,10 @@ do
done done
# check for essential directories # check for essential directories
for dir in $packDir [ -d $packDir ] || {
do echo "Error: directory $packDir does not exist" 1>&2
[ -d $dir ] || {
echo "Error: directory $dir does not exist" 1>&2
exit 1 exit 1
} }
done
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -57,10 +57,29 @@ esac
} }
# obtain archOptions types from lib/ if [ -d $packDir/lib ]
then
# obtain archOptions types from lib/<archOptions>
for archOptions in $packDir/lib/* for archOptions in $packDir/lib/*
do do
$binDir/$packBin $@ ${archOptions##*/} $binDir/$packBin $@ ${archOptions##*/}
done done
elif [ -d $packDir/platforms ]
# obtain archOptions types from platforms/<archOptions>/lib
for archOptions in $packDir/platforms/*/lib
do
archOptions=${archOptions%%/lib}
$binDir/$packBin $@ ${archOptions##*/}
done
else
echo "Error: directory $packDir does not appear packable" 1>&2
exit 1
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -72,13 +72,10 @@ do
done done
# check for essential directories # check for essential directories
for dir in $packDir [ -d $packDir ] || {
do echo "Error: directory $packDir does not exist" 1>&2
[ -d $dir ] || {
echo "Error: directory $dir does not exist" 1>&2
exit 1 exit 1
} }
done
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -67,19 +67,35 @@ arch3264=$(echo "$archOS" | sed -e 's@64@-64@')
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# check for essential directories # check for essential directories
for dir in $packDir $packDir/lib/$archOptions [ -d $packDir ] || {
do echo "Error: directory $packDir does not exist" 1>&2
[ -d $dir ] || {
echo "Error: directory $dir does not exist" 1>&2
exit 1 exit 1
} }
done
# check new/old places for executables - same as $FOAM_APPBIN
[ -d $packDir/bin/$archOptions -o -d $packDir/applications/bin/$archOptions ] || { #
# check places for libraries - same as $FOAM_LIBBIN
# this has moved around a bit in the recent past
#
[ -d $packDir/lib/$archOptions ] || \
[ -d $packDir/platforms/$archOptions/lib ] || {
cat <<LIB_CHECK 1>&2
Error: no directory for libraries exists:
$packDir/lib/$archOptions
$packDir/platforms/$archOptions/lib
LIB_CHECK
exit 1
}
#
# check places for executables - same as $FOAM_APPBIN
# this has moved around a bit in the recent past
#
[ -d $packDir/applications/bin/$archOptions ] || \
[ -d $packDir/platforms/$archOptions/bin ] || {
cat <<BIN_CHECK 1>&2 cat <<BIN_CHECK 1>&2
Error: no directory for executables exists: Error: no directory for executables exists:
$packDir/bin/$archOptions $packDir/platforms/$archOptions/bin
$packDir/applications/bin/$archOptions $packDir/applications/bin/$archOptions
BIN_CHECK BIN_CHECK
exit 1 exit 1
@ -90,14 +106,15 @@ BIN_CHECK
# list of directories # list of directories
dirList=$( dirList=$(
for dir in \ for dir in \
$packDir/bin/$archOptions \ $packDir/platforms/$archOptions/bin \
$packDir/lib/$archOptions \ $packDir/platforms/$archOptions/lib \
$packDir/applications/bin/$archOptions \
$packDir/wmake/bin/$archCompiler \ $packDir/wmake/bin/$archCompiler \
$packDir/wmake/bin/$archOS \ $packDir/wmake/bin/$archOS \
$packDir/wmake/rules/General \ $packDir/wmake/rules/General \
$packDir/wmake/rules/$archCompiler \ $packDir/wmake/rules/$archCompiler \
$packDir/wmake/rules/$archOS \ $packDir/wmake/rules/$archOS \
$packDir/applications/bin/$archOptions \
$packDir/lib/$archOptions \
; ;
do do
[ -d $dir ] && echo $dir [ -d $dir ] && echo $dir

View File

@ -66,7 +66,7 @@ arch3264=$(echo "$archOS" | sed -e 's@64@-64@')
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# check for essential directories # check for essential directories
for dir in $packDir $packDir/lib/$archOptions for dir in $packDir $packDir/platforms/$archOptions/lib
do do
[ -d $dir ] || { [ -d $dir ] || {
echo "Error: directory $dir does not exist" 1>&2 echo "Error: directory $dir does not exist" 1>&2
@ -78,12 +78,6 @@ done
# list of directories # list of directories
dirList=$( dirList=$(
for dir in \ for dir in \
$packDir/bin/$archOptions \
$packDir/bin/$archCompiler \
$packDir/bin/$archOS \
$packDir/lib/$archOptions \
$packDir/lib/$archCompiler \
$packDir/lib/$archOS \
$packDir/platforms/$archOptions \ $packDir/platforms/$archOptions \
$packDir/platforms/$archCompiler \ $packDir/platforms/$archCompiler \
$packDir/platforms/$archOS \ $packDir/platforms/$archOS \

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -53,7 +53,7 @@ hookName="pre-commit"
die() die()
{ {
echo "$hookName hook failure" 1>&2 echo "$hookName hook failure" 1>&2
echo '-----------------------' 1>&2 echo '-----------------------------------' 1>&2
echo '' 1>&2 echo '' 1>&2
echo "$@" 1>&2 echo "$@" 1>&2
echo '' 1>&2 echo '' 1>&2
@ -105,8 +105,8 @@ dieOnBadFiles()
{ {
if [ -n "$badFiles" ] if [ -n "$badFiles" ]
then then
echo '$hookName hook failure' 1>&2 echo "$hookName hook failure" 1>&2
echo '-----------------------' 1>&2 echo '-----------------------------------' 1>&2
echo "$@" 1>&2 echo "$@" 1>&2
echo '' 1>&2 echo '' 1>&2
echo "File(s):" 1>&2 echo "File(s):" 1>&2

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -47,7 +47,7 @@ hookName="pre-receive"
die() die()
{ {
echo "$hookName hook failure" 1>&2 echo "$hookName hook failure" 1>&2
echo '-----------------------' 1>&2 echo '-----------------------------------' 1>&2
echo '' 1>&2 echo '' 1>&2
echo "$@" 1>&2 echo "$@" 1>&2
echo '' 1>&2 echo '' 1>&2
@ -68,8 +68,8 @@ dieOnBadFiles()
{ {
if [ -n "$badFiles" ] if [ -n "$badFiles" ]
then then
echo '$hookName hook failure' 1>&2 echo "$hookName hook failure" 1>&2
echo '-----------------------' 1>&2 echo '-----------------------------------' 1>&2
echo "$@" 1>&2 echo "$@" 1>&2
echo '' 1>&2 echo '' 1>&2
echo "File(s):" 1>&2 echo "File(s):" 1>&2

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -44,9 +44,9 @@ alias wmDP 'wmSET WM_PRECISION_OPTION=DP'
alias wmSchedON 'setenv WM_SCHEDULER $WM_PROJECT_DIR/wmake/wmakeScheduler' alias wmSchedON 'setenv WM_SCHEDULER $WM_PROJECT_DIR/wmake/wmakeScheduler'
alias wmSchedOFF 'unsetenv WM_SCHEDULER' alias wmSchedOFF 'unsetenv WM_SCHEDULER'
# Change paraview version # Change ParaView version
# ~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~
alias foamPV 'setenv ParaView_VERSION \!*; source $WM_PROJECT_DIR/etc/apps/paraview3/cshrc; echo paraview-$ParaView_VERSION' alias foamPV 'source `$WM_PROJECT_DIR/etc/apps/paraview3/cshrc` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION'
# Change directory aliases # Change directory aliases

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -44,16 +44,13 @@ alias wmDP='wmSET WM_PRECISION_OPTION=DP'
alias wmSchedON='export WM_SCHEDULER=$WM_PROJECT_DIR/wmake/wmakeScheduler' alias wmSchedON='export WM_SCHEDULER=$WM_PROJECT_DIR/wmake/wmakeScheduler'
alias wmSchedOFF='unset WM_SCHEDULER' alias wmSchedOFF='unset WM_SCHEDULER'
# Change paraview version # Change ParaView version
# ~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~
unset foamPV unset foamPV
foamPV() foamPV()
{ {
export ParaView_VERSION=$1 . $WM_PROJECT_DIR/etc/apps/paraview3/bashrc ParaView_VERSION=$1
. $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
echo "paraview-$ParaView_VERSION (major: $ParaView_MAJOR)" echo "paraview-$ParaView_VERSION (major: $ParaView_MAJOR)"
echo "dir: $ParaView_DIR"
[ -d "$ParaView_DIR" ] || echo "WARNING: directory does not exist"
} }

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -50,17 +50,25 @@ do
done done
# set VERSION and MAJOR (version) variables #- ParaView version, automatically determine major version
if [ -z "$ParaView_VERSION" ] export ParaView_VERSION=3.8.0
then export ParaView_MAJOR=detect
ParaView_VERSION=3.8.0
ParaView_MAJOR=unknown
echo "Warning in app/paraview3/bashrc:" 1>&2
echo " ParaView_VERSION not set, using '$ParaView_VERSION'" 1>&2
fi
[ -n "$ParaView_MAJOR" ] || ParaView_MAJOR=unknown
# if needed, set MAJOR version to correspond to VERSION
# Evaluate command-line parameters for ParaView
while [ $# -gt 0 ]
do
case "$1" in
ParaView*=*)
# name=value -> export name=value
eval "export $1"
;;
esac
shift
done
# set MAJOR version to correspond to VERSION
# ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION # ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION
case "$ParaView_VERSION" in case "$ParaView_VERSION" in
"$ParaView_MAJOR".* ) "$ParaView_MAJOR".* )
@ -82,7 +90,7 @@ if [ -r $ParaView_DIR -o -r $paraviewInstDir ]
then then
export PATH=$ParaView_DIR/bin:$PATH export PATH=$ParaView_DIR/bin:$PATH
export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-$ParaView_MAJOR:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-$ParaView_MAJOR:$LD_LIBRARY_PATH
export PV_PLUGIN_PATH=$FOAM_EXT_LIBBIN/paraview-$ParaView_MAJOR export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR
# add in python libraries if required # add in python libraries if required
paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -48,17 +48,24 @@ foreach cmake ( cmake-2.8.3 cmake-2.8.1 )
endif endif
end end
# set VERSION and MAJOR (version) variables #- ParaView version, automatically determine major version:
if ( ! $?ParaView_VERSION )
then
setenv ParaView_VERSION 3.8.0 setenv ParaView_VERSION 3.8.0
setenv ParaView_MAJOR unknown setenv ParaView_MAJOR detect
echo "Warning in app/paraview3/cshrc:"
echo " ParaView_VERSION not set, using '$ParaView_VERSION'"
fi
if ( ! $?ParaView_MAJOR ) setenv ParaView_MAJOR unknown
# if needed, set MAJOR version to correspond to VERSION
# 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 "<digits>.<digits>" from ParaView_VERSION # ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION
switch ("$ParaView_VERSION") switch ("$ParaView_VERSION")
case "$ParaView_MAJOR".*: case "$ParaView_MAJOR".*:
@ -80,7 +87,7 @@ setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-
if ( -r $ParaView_DIR || -r $paraviewInstDir ) then if ( -r $ParaView_DIR || -r $paraviewInstDir ) then
setenv PATH ${ParaView_DIR}/bin:${PATH} setenv PATH ${ParaView_DIR}/bin:${PATH}
setenv LD_LIBRARY_PATH "${ParaView_DIR}/lib/paraview-${ParaView_MAJOR}:${LD_LIBRARY_PATH}" setenv LD_LIBRARY_PATH "${ParaView_DIR}/lib/paraview-${ParaView_MAJOR}:${LD_LIBRARY_PATH}"
setenv PV_PLUGIN_PATH $FOAM_EXT_LIBBIN/paraview-${ParaView_MAJOR} setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-${ParaView_MAJOR}
# add in python libraries if required # add in python libraries if required
set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping

View File

@ -36,10 +36,5 @@
export SCOTCH_VERSION=scotch_5.1.11 export SCOTCH_VERSION=scotch_5.1.11
export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$SCOTCH_VERSION export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$SCOTCH_VERSION
# mpi-qualified include directory
export SCOTCH_MPI_INCLUDE=$SCOTCH_ARCH_PATH/include/${FOAM_MPI_LIBBIN##*/}
# mpi-qualified lib directory
export SCOTCH_MPI_LIBBIN=$SCOTCH_ARCH_PATH/lib/${FOAM_MPI_LIBBIN##*/}
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -57,10 +57,6 @@ foamInstall=$HOME/$WM_PROJECT
#- note the location for later use (eg, in job scripts) #- note the location for later use (eg, in job scripts)
: ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
#- ParaView version, automatically determine major version:
export ParaView_VERSION=3.8.0
export ParaView_MAJOR=unknown
#- Compiler location: #- Compiler location:
# foamCompiler= system | ThirdParty (OpenFOAM) # foamCompiler= system | ThirdParty (OpenFOAM)
foamCompiler=system foamCompiler=system
@ -134,22 +130,20 @@ _foamSource()
done done
} }
# Evaluate command-line parameters
# Add in preset user or site preferences: _foamEval()
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` {
# Evaluate command-line parameters and record settings for later
# these can be used to set/unset values, or specify prefs files
export FOAM_SETTINGS="$@"
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case "$1" in case "$1" in
*=) *=)
# name= -> unset name # name= -> unset name
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "unset ${1%=}"
eval "unset ${1%=}" eval "unset ${1%=}"
;; ;;
*=*) *=*)
# name=value -> export name=value # name=value -> export name=value
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "export $1"
eval "export $1" eval "export $1"
;; ;;
*) *)
@ -164,6 +158,16 @@ do
esac esac
shift shift
done done
}
# Add in preset user or site preferences:
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
# Evaluate command-line parameters and record settings for later
# these can be used to set/unset values, or specify prefs files
export FOAM_SETTINGS="$@"
_foamEval $@
# Detect system type and set environment variables appropriately # Detect system type and set environment variables appropriately
@ -311,6 +315,6 @@ fi
# cleanup environment: # cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unset cleaned foamClean foamInstall foamOldDirs unset cleaned foamClean foamInstall foamOldDirs
unset _foamSource unset _foamSource _foamEval
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -56,10 +56,6 @@ set foamInstall = $HOME/$WM_PROJECT
#- note the location for later use (eg, in job scripts) #- note the location for later use (eg, in job scripts)
if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall
#- ParaView version, automatically determine major version:
setenv ParaView_VERSION 3.8.0
setenv ParaView_MAJOR unknown
#- Compiler location: #- Compiler location:
# foamCompiler= system | ThirdParty (OpenFOAM) # foamCompiler= system | ThirdParty (OpenFOAM)
set foamCompiler=system set foamCompiler=system
@ -256,9 +252,7 @@ if (! $?MANPATH) setenv MANPATH ''
#- Clean PATH (path) #- Clean PATH (path)
set cleaned=`$foamClean "$PATH" "$foamOldDirs"` set cleaned=`$foamClean "$PATH" "$foamOldDirs"`
if ( $status == 0 ) then if ( $status == 0 ) setenv PATH $cleaned
setenv PATH $cleaned
endif
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`

View File

@ -48,20 +48,20 @@ setenv WM_LINK_LANGUAGE c++
setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
# base executables/libraries # base executables/libraries
setenv FOAM_APPBIN $WM_PROJECT_DIR/bin/$WM_OPTIONS setenv FOAM_APPBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
setenv FOAM_LIBBIN $WM_PROJECT_DIR/lib/$WM_OPTIONS setenv FOAM_LIBBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# external (ThirdParty) libraries # external (ThirdParty) libraries
setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/lib/$WM_OPTIONS setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
# shared site executables/libraries # shared site executables/libraries
# similar naming convention as ~OpenFOAM expansion # similar naming convention as ~OpenFOAM expansion
setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/bin/$WM_OPTIONS setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/lib/$WM_OPTIONS setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
# user executables/libraries # user executables/libraries
setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/bin/$WM_OPTIONS setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/lib/$WM_OPTIONS setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
# convenience # convenience
setenv FOAM_APP $WM_PROJECT_DIR/applications setenv FOAM_APP $WM_PROJECT_DIR/applications
@ -90,7 +90,6 @@ unsetenv MPFR_ARCH_PATH
# Location of compiler installation # Location of compiler installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ( ! $?foamCompiler ) then if ( ! $?foamCompiler ) then
then
foamCompiler=system foamCompiler=system
echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
echo " foamCompiler not set, using '$foamCompiler'" echo " foamCompiler not set, using '$foamCompiler'"
@ -253,13 +252,13 @@ unset boost_version cgal_version
# Communications library # Communications library
# ~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~
unsetenv MPI_ARCH_PATH MPI_HOME unsetenv MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
switch ("$WM_MPLIB") switch ("$WM_MPLIB")
case OPENMPI: case OPENMPI:
#set mpi_version=openmpi-1.4.1 #setenv FOAM_MPI openmpi-1.4.1
set mpi_version=openmpi-1.5.1 setenv FOAM_MPI openmpi-1.5.1
setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
# Tell OpenMPI where to find its install directory # Tell OpenMPI where to find its install directory
setenv OPAL_PREFIX $MPI_ARCH_PATH setenv OPAL_PREFIX $MPI_ARCH_PATH
@ -267,14 +266,11 @@ case OPENMPI:
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddMan $MPI_ARCH_PATH/man _foamAddMan $MPI_ARCH_PATH/man
setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/$mpi_version
unset mpi_version
breaksw breaksw
case SYSTEMOPENMPI: case SYSTEMOPENMPI:
# Use the system installed openmpi, get library directory via mpicc # Use the system installed openmpi, get library directory via mpicc
set mpi_version=openmpi-system setenv FOAM_MPI openmpi-system
# Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
setenv PINC "`mpicc --showme:compile`" setenv PINC "`mpicc --showme:compile`"
@ -289,25 +285,21 @@ case SYSTEMOPENMPI:
endif endif
_foamAddLib $libDir _foamAddLib $libDir
unset libDir
setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/$mpi_version
unset mpi_version libDir
breaksw breaksw
case MPICH: case MPICH:
set mpi_version=mpich2-1.1.1p1 setenv FOAM_MPI mpich2-1.1.1p1
setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version setenv MPI_HOME $WM_THIRD_PARTY_DIR/$FOAM_MPI
setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddMan $MPI_ARCH_PATH/share/man _foamAddMan $MPI_ARCH_PATH/share/man
setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/$mpi_version
unset mpi_version
breaksw breaksw
case MPICH-GM: case MPICH-GM:
setenv FOAM_MPI mpich-gm
setenv MPI_ARCH_PATH /opt/mpi setenv MPI_ARCH_PATH /opt/mpi
setenv MPICH_PATH $MPI_ARCH_PATH setenv MPICH_PATH $MPI_ARCH_PATH
setenv GM_LIB_PATH /opt/gm/lib64 setenv GM_LIB_PATH /opt/gm/lib64
@ -315,11 +307,10 @@ case MPICH-GM:
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH _foamAddLib $GM_LIB_PATH
setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/mpich-gm
breaksw breaksw
case HPMPI: case HPMPI:
setenv FOAM_MPI hpmpi
setenv MPI_HOME /opt/hpmpi setenv MPI_HOME /opt/hpmpi
setenv MPI_ARCH_PATH $MPI_HOME setenv MPI_ARCH_PATH $MPI_HOME
@ -339,23 +330,22 @@ case HPMPI:
echo Unknown processor type `uname -m` for Linux echo Unknown processor type `uname -m` for Linux
breaksw breaksw
endsw endsw
setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/hpmpi
breaksw breaksw
case GAMMA: case GAMMA:
setenv FOAM_MPI gamma
setenv MPI_ARCH_PATH /usr setenv MPI_ARCH_PATH /usr
setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/gamma
breaksw breaksw
case MPI: case MPI:
setenv FOAM_MPI mpi
setenv MPI_ARCH_PATH /opt/mpi setenv MPI_ARCH_PATH /opt/mpi
setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/mpi
breaksw breaksw
case FJMPI: case FJMPI:
setenv FOAM_MPI fjmpi
setenv MPI_ARCH_PATH /opt/FJSVmpi2 setenv MPI_ARCH_PATH /opt/FJSVmpi2
setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/mpi
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib/sparcv9 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
_foamAddLib /opt/FSUNf90/lib/sparcv9 _foamAddLib /opt/FSUNf90/lib/sparcv9
@ -363,20 +353,25 @@ case FJMPI:
breaksw breaksw
case QSMPI: case QSMPI:
setenv FOAM_MPI qsmpi
setenv MPI_ARCH_PATH /usr/lib/mpi setenv MPI_ARCH_PATH /usr/lib/mpi
setenv FOAM_MPI_LIBBIN FOAM_LIBBIN/qsmpi
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
breaksw breaksw
default: default:
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/dummy setenv FOAM_MPI dummy
breaksw breaksw
endsw endsw
_foamAddLib $FOAM_MPI_LIBBIN
# add (non-dummy) MPI implementation
# dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
if ( "$FOAM_MPI" != dummy ) then
_foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}:${FOAM_EXT_LIBBIN}/${FOAM_MPI}
endif
# Set the minimum MPI buffer size (used by all platforms except SGI MPI) # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
@ -392,13 +387,6 @@ else
endif endif
# Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if ( -f $FOAM_EXT_LIBBIN/libhoard.so ) then
# setenv LD_PRELOAD $FOAM_EXT_LIBBIN/libhoard.so:$LD_PRELOAD
#endif
# cleanup environment: # cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unalias _foamAddPath _foamAddLib _foamAddMan unalias _foamAddPath _foamAddLib _foamAddMan

View File

@ -71,20 +71,20 @@ export WM_LINK_LANGUAGE=c++
export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
# base executables/libraries # base executables/libraries
export FOAM_APPBIN=$WM_PROJECT_DIR/bin/$WM_OPTIONS export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
export FOAM_LIBBIN=$WM_PROJECT_DIR/lib/$WM_OPTIONS export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# external (ThirdParty) libraries # external (ThirdParty) libraries
export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/lib/$WM_OPTIONS export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
# shared site executables/libraries # shared site executables/libraries
# similar naming convention as ~OpenFOAM expansion # similar naming convention as ~OpenFOAM expansion
export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/bin/$WM_OPTIONS export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/lib/$WM_OPTIONS export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
# user executables/libraries # user executables/libraries
export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/bin/$WM_OPTIONS export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
# convenience # convenience
export FOAM_APP=$WM_PROJECT_DIR/applications export FOAM_APP=$WM_PROJECT_DIR/applications
@ -273,13 +273,13 @@ unset boost_version cgal_version
# Communications library # Communications library
# ~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~
unset MPI_ARCH_PATH MPI_HOME unset MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
case "$WM_MPLIB" in case "$WM_MPLIB" in
OPENMPI) OPENMPI)
#mpi_version=openmpi-1.4.1 #export FOAM_MPI=openmpi-1.4.1
mpi_version=openmpi-1.5.1 export FOAM_MPI=openmpi-1.5.1
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
# Tell OpenMPI where to find its install directory # Tell OpenMPI where to find its install directory
export OPAL_PREFIX=$MPI_ARCH_PATH export OPAL_PREFIX=$MPI_ARCH_PATH
@ -287,14 +287,11 @@ OPENMPI)
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddMan $MPI_ARCH_PATH/man _foamAddMan $MPI_ARCH_PATH/man
export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/$mpi_version
unset mpi_version
;; ;;
SYSTEMOPENMPI) SYSTEMOPENMPI)
# Use the system installed openmpi, get library directory via mpicc # Use the system installed openmpi, get library directory via mpicc
mpi_version=openmpi-system export FOAM_MPI=openmpi-system
# Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
export PINC="`mpicc --showme:compile`" export PINC="`mpicc --showme:compile`"
@ -310,25 +307,21 @@ SYSTEMOPENMPI)
fi fi
_foamAddLib $libDir _foamAddLib $libDir
unset libDir
export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/$mpi_version
unset mpi_version libDir
;; ;;
MPICH) MPICH)
mpi_version=mpich2-1.1.1p1 export FOAM_MPI=mpich2-1.1.1p1
export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddMan $MPI_ARCH_PATH/share/man _foamAddMan $MPI_ARCH_PATH/share/man
export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/$mpi_version
unset mpi_version
;; ;;
MPICH-GM) MPICH-GM)
export FOAM_MPI=mpich-gm
export MPI_ARCH_PATH=/opt/mpi export MPI_ARCH_PATH=/opt/mpi
export MPICH_PATH=$MPI_ARCH_PATH export MPICH_PATH=$MPI_ARCH_PATH
export GM_LIB_PATH=/opt/gm/lib64 export GM_LIB_PATH=/opt/gm/lib64
@ -336,11 +329,10 @@ MPICH-GM)
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH _foamAddLib $GM_LIB_PATH
export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/mpich-gm
;; ;;
HPMPI) HPMPI)
export FOAM_MPI=hpmpi
export MPI_HOME=/opt/hpmpi export MPI_HOME=/opt/hpmpi
export MPI_ARCH_PATH=$MPI_HOME export MPI_ARCH_PATH=$MPI_HOME
@ -361,23 +353,21 @@ HPMPI)
echo Unknown processor type `uname -m` for Linux echo Unknown processor type `uname -m` for Linux
;; ;;
esac esac
export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/hpmpi
;; ;;
GAMMA) GAMMA)
export FOAM_MPI=gamma
export MPI_ARCH_PATH=/usr export MPI_ARCH_PATH=/usr
export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/gamma
;; ;;
MPI) MPI)
export FOAM_MPI=mpi
export MPI_ARCH_PATH=/opt/mpi export MPI_ARCH_PATH=/opt/mpi
export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/mpi
;; ;;
FJMPI) FJMPI)
export FOAM_MPI=fjmpi
export MPI_ARCH_PATH=/opt/FJSVmpi2 export MPI_ARCH_PATH=/opt/FJSVmpi2
export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/mpi
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib/sparcv9 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
@ -386,20 +376,25 @@ FJMPI)
;; ;;
QSMPI) QSMPI)
export FOAM_MPI=qsmpi
export MPI_ARCH_PATH=/usr/lib/mpi export MPI_ARCH_PATH=/usr/lib/mpi
export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/qsmpi
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
;; ;;
*) *)
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/dummy export FOAM_MPI=dummy
;; ;;
esac esac
_foamAddLib $FOAM_MPI_LIBBIN # add (non-dummy) MPI implementation
# dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
if [ "$FOAM_MPI" != dummy ]
then
_foamAddLib $FOAM_LIBBIN/$FOAM_MPI:$FOAM_EXT_LIBBIN/$FOAM_MPI
fi
# Set the minimum MPI buffer size (used by all platforms except SGI MPI) # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
@ -413,14 +408,6 @@ fi
export MPI_BUFFER_SIZE export MPI_BUFFER_SIZE
# Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if [ -f $FOAM_EXT_LIBBIN/libhoard.so ]
#then
# export LD_PRELOAD=$FOAM_EXT_LIBBIN/libhoard.so:$LD_PRELOAD
#fi
# cleanup environment: # cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unset _foamAddPath _foamAddLib _foamAddMan foamCompiler minBufferSize unset _foamAddPath _foamAddLib _foamAddMan foamCompiler minBufferSize

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,9 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H"
#include "sigFpe.H" #include "sigFpe.H"
#include "error.H"
#include "JobInfo.H" #include "JobInfo.H"
#include "OSspecific.H" #include "OSspecific.H"
#include "IOstreams.H" #include "IOstreams.H"
@ -52,51 +51,42 @@ License
struct sigaction Foam::sigFpe::oldAction_; struct sigaction Foam::sigFpe::oldAction_;
#if defined(LINUX) #ifdef LINUX
void *(*Foam::sigFpe::old_malloc_hook)(size_t, const void *) = NULL; void *(*Foam::sigFpe::oldMallocHook_)(size_t, const void *) = NULL;
void* Foam::sigFpe::my_malloc_hook(size_t size, const void *caller) void* Foam::sigFpe::nanMallocHook_(size_t size, const void *caller)
{ {
void *result; void *result;
// Restore all old hooks // Restore all old hooks
__malloc_hook = old_malloc_hook; __malloc_hook = oldMallocHook_;
// Call recursively // Call recursively
result = malloc(size); result = malloc(size);
// initialize to signalling nan // initialize to signalling NaN
# ifdef WM_SP # ifdef WM_SP
const uint32_t sNAN = 0x7ff7fffflu; const uint32_t sNAN = 0x7ff7fffflu;
int nScalars = size / sizeof(scalar);
uint32_t* dPtr = reinterpret_cast<uint32_t*>(result); uint32_t* dPtr = reinterpret_cast<uint32_t*>(result);
for (int i = 0; i < nScalars; i++)
{
*dPtr++ = sNAN;
}
# else # else
const uint64_t sNAN = 0x7ff7ffffffffffffllu; const uint64_t sNAN = 0x7ff7ffffffffffffllu;
int nScalars = size/sizeof(scalar);
uint64_t* dPtr = reinterpret_cast<uint64_t*>(result); uint64_t* dPtr = reinterpret_cast<uint64_t*>(result);
for (int i = 0; i < nScalars; i++) # endif
const size_t nScalars = size/sizeof(scalar);
for (size_t i = 0; i < nScalars; ++i)
{ {
*dPtr++ = sNAN; *dPtr++ = sNAN;
} }
# endif
// Restore our own hooks // Restore our own hooks
__malloc_hook = my_malloc_hook; __malloc_hook = nanMallocHook_;
return result; return result;
} }
@ -106,14 +96,14 @@ void* Foam::sigFpe::my_malloc_hook(size_t size, const void *caller)
#ifdef LINUX_GNUC #ifdef LINUX_GNUC
void Foam::sigFpe::sigFpeHandler(int) void Foam::sigFpe::sigHandler(int)
{ {
// Reset old handling // Reset old handling
if (sigaction(SIGFPE, &oldAction_, NULL) < 0) if (sigaction(SIGFPE, &oldAction_, NULL) < 0)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::sigSegv::sigFpeHandler()" "Foam::sigSegv::sigHandler()"
) << "Cannot reset SIGFPE trapping" ) << "Cannot reset SIGFPE trapping"
<< abort(FatalError); << abort(FatalError);
} }
@ -166,7 +156,7 @@ Foam::sigFpe::~sigFpe()
// Reset to standard malloc // Reset to standard malloc
if (oldAction_.sa_handler) if (oldAction_.sa_handler)
{ {
__malloc_hook = old_malloc_hook; __malloc_hook = oldMallocHook_;
} }
# endif # endif
@ -189,13 +179,10 @@ void Foam::sigFpe::set(const bool verbose)
if (env("FOAM_SIGFPE")) if (env("FOAM_SIGFPE"))
{ {
if (verbose) bool supported = false;
{
Info<< "SigFpe : Enabling floating point exception trapping"
<< " (FOAM_SIGFPE)." << endl;
}
# ifdef LINUX_GNUC # ifdef LINUX_GNUC
supported = true;
feenableexcept feenableexcept
( (
@ -205,7 +192,7 @@ void Foam::sigFpe::set(const bool verbose)
); );
struct sigaction newAction; struct sigaction newAction;
newAction.sa_handler = sigFpeHandler; newAction.sa_handler = sigHandler;
newAction.sa_flags = SA_NODEFER; newAction.sa_flags = SA_NODEFER;
sigemptyset(&newAction.sa_mask); sigemptyset(&newAction.sa_mask);
if (sigaction(SIGFPE, &newAction, &oldAction_) < 0) if (sigaction(SIGFPE, &newAction, &oldAction_) < 0)
@ -219,6 +206,7 @@ void Foam::sigFpe::set(const bool verbose)
# elif defined(sgiN32) || defined(sgiN32Gcc) # elif defined(sgiN32) || defined(sgiN32Gcc)
supported = true;
sigfpe_[_DIVZERO].abort=1; sigfpe_[_DIVZERO].abort=1;
sigfpe_[_OVERFL].abort=1; sigfpe_[_OVERFL].abort=1;
@ -240,23 +228,50 @@ void Foam::sigFpe::set(const bool verbose)
); );
# endif # endif
if (verbose)
{
if (supported)
{
Info<< "sigFpe : Enabling floating point exception trapping"
<< " (FOAM_SIGFPE)." << endl;
}
else
{
Info<< "sigFpe : Floating point exception trapping"
<< " - not supported on this platform" << endl;
}
}
} }
if (env("FOAM_SETNAN")) if (env("FOAM_SETNAN"))
{ {
bool supported = false;
# ifdef LINUX_GNUC
supported = true;
// Set our malloc
__malloc_hook = Foam::sigFpe::nanMallocHook_;
# endif
if (verbose) if (verbose)
{
if (supported)
{ {
Info<< "SetNaN : Initialising allocated memory to NaN" Info<< "SetNaN : Initialising allocated memory to NaN"
<< " (FOAM_SETNAN)." << endl; << " (FOAM_SETNAN)." << endl;
} }
else
# ifdef LINUX_GNUC {
Info<< "SetNaN : Initialise allocated memory to NaN"
// Set our malloc << " - not supported on this platform" << endl;
__malloc_hook = Foam::sigFpe::my_malloc_hook; }
}
# endif
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,6 @@ SourceFiles
#ifndef sigFpe_H #ifndef sigFpe_H
#define sigFpe_H #define sigFpe_H
#include "OSspecific.H"
#include <signal.h> #include <signal.h>
#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64) #if defined(linux) || defined(linuxAMD64) || defined(linuxIA64)
@ -73,10 +72,10 @@ class sigFpe
# ifdef LINUX # ifdef LINUX
//- Saved old malloc //- Saved old malloc
static void *(*old_malloc_hook)(size_t, const void *); static void *(*oldMallocHook_)(size_t, const void *);
//- nan malloc function. From malloc_hook manpage. //- NaN malloc function. From malloc_hook manpage.
static void* my_malloc_hook(size_t size, const void *caller); static void* nanMallocHook_(size_t size, const void *caller);
# endif # endif
@ -86,7 +85,7 @@ class sigFpe
# ifdef LINUX_GNUC # ifdef LINUX_GNUC
//- Handler for caught signals //- Handler for caught signals
static void sigFpeHandler(int); static void sigHandler(int);
# endif # endif
@ -96,6 +95,7 @@ public:
// Constructors // Constructors
//- Construct null
sigFpe(); sigFpe();
@ -105,6 +105,8 @@ public:
// Member functions // Member functions
//- Activate SIGFPE signal handler when FOAM_SIGFPE is %set
// Fill memory with NaN when FOAM_SETNAN is %set
void set(const bool verbose); void set(const bool verbose);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H"
#include "sigInt.H" #include "sigInt.H"
#include "error.H"
#include "JobInfo.H" #include "JobInfo.H"
#include "IOstreams.H" #include "IOstreams.H"
@ -32,16 +32,17 @@ License
struct sigaction Foam::sigInt::oldAction_; struct sigaction Foam::sigInt::oldAction_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::sigInt::sigIntHandler(int) void Foam::sigInt::sigHandler(int)
{ {
// Reset old handling // Reset old handling
if (sigaction(SIGINT, &oldAction_, NULL) < 0) if (sigaction(SIGINT, &oldAction_, NULL) < 0)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::sigInt::sigIntHandler()" "Foam::sigInt::sigHandler()"
) << "Cannot reset SIGINT trapping" ) << "Cannot reset SIGINT trapping"
<< abort(FatalError); << abort(FatalError);
} }
@ -80,7 +81,7 @@ Foam::sigInt::~sigInt()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigInt::set(const bool verbose) void Foam::sigInt::set(const bool)
{ {
if (oldAction_.sa_handler) if (oldAction_.sa_handler)
{ {
@ -92,7 +93,7 @@ void Foam::sigInt::set(const bool verbose)
} }
struct sigaction newAction; struct sigaction newAction;
newAction.sa_handler = sigIntHandler; newAction.sa_handler = sigHandler;
newAction.sa_flags = SA_NODEFER; newAction.sa_flags = SA_NODEFER;
sigemptyset(&newAction.sa_mask); sigemptyset(&newAction.sa_mask);
if (sigaction(SIGINT, &newAction, &oldAction_) < 0) if (sigaction(SIGINT, &newAction, &oldAction_) < 0)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,9 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "OSspecific.H" #ifndef sigInt_H
#define sigInt_H
#include <signal.h> #include <signal.h>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,13 +62,14 @@ class sigInt
// Private Member Functions // Private Member Functions
static void sigIntHandler(int); static void sigHandler(int);
public: public:
// Constructors // Constructors
//- Construct null
sigInt(); sigInt();
@ -76,6 +79,7 @@ public:
// Member functions // Member functions
//- Activate SIGINT signal handler
void set(const bool verbose); void set(const bool verbose);
}; };
@ -84,4 +88,8 @@ public:
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H"
#include "sigQuit.H" #include "sigQuit.H"
#include "error.H"
#include "JobInfo.H" #include "JobInfo.H"
#include "IOstreams.H" #include "IOstreams.H"
@ -32,16 +32,17 @@ License
struct sigaction Foam::sigQuit::oldAction_; struct sigaction Foam::sigQuit::oldAction_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::sigQuit::sigQuitHandler(int) void Foam::sigQuit::sigHandler(int)
{ {
// Reset old handling // Reset old handling
if (sigaction(SIGQUIT, &oldAction_, NULL) < 0) if (sigaction(SIGQUIT, &oldAction_, NULL) < 0)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::sigQuit::sigQuitHandler()" "Foam::sigQuit::sigHandler()"
) << "Cannot reset SIGQUIT trapping" ) << "Cannot reset SIGQUIT trapping"
<< abort(FatalError); << abort(FatalError);
} }
@ -94,7 +95,7 @@ void Foam::sigQuit::set(const bool verbose)
} }
struct sigaction newAction; struct sigaction newAction;
newAction.sa_handler = sigQuitHandler; newAction.sa_handler = sigHandler;
newAction.sa_flags = SA_NODEFER; newAction.sa_flags = SA_NODEFER;
sigemptyset(&newAction.sa_mask); sigemptyset(&newAction.sa_mask);
if (sigaction(SIGQUIT, &newAction, &oldAction_) < 0) if (sigaction(SIGQUIT, &newAction, &oldAction_) < 0)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,9 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "OSspecific.H" #ifndef sigQuit_H
#define sigQuit_H
#include <signal.h> #include <signal.h>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,13 +62,15 @@ class sigQuit
// Private Member Functions // Private Member Functions
static void sigQuitHandler(int); //- Handler for caught signals
static void sigHandler(int);
public: public:
// Constructors // Constructors
//- Construct null
sigQuit(); sigQuit();
@ -76,6 +80,7 @@ public:
// Member functions // Member functions
//- Activate SIGQUIT signal handler
void set(const bool verbose); void set(const bool verbose);
}; };
@ -84,4 +89,8 @@ public:
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,8 +23,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H"
#include "sigSegv.H" #include "sigSegv.H"
#include "error.H"
#include "JobInfo.H" #include "JobInfo.H"
#include "IOstreams.H" #include "IOstreams.H"
@ -32,16 +32,17 @@ License
struct sigaction Foam::sigSegv::oldAction_; struct sigaction Foam::sigSegv::oldAction_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::sigSegv::sigSegvHandler(int) void Foam::sigSegv::sigHandler(int)
{ {
// Reset old handling // Reset old handling
if (sigaction(SIGSEGV, &oldAction_, NULL) < 0) if (sigaction(SIGSEGV, &oldAction_, NULL) < 0)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::sigSegv::sigSegvHandler()" "Foam::sigSegv::sigHandler()"
) << "Cannot reset SIGSEGV trapping" ) << "Cannot reset SIGSEGV trapping"
<< abort(FatalError); << abort(FatalError);
} }
@ -82,7 +83,7 @@ Foam::sigSegv::~sigSegv()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::sigSegv::set(const bool verbose) void Foam::sigSegv::set(const bool)
{ {
if (oldAction_.sa_handler) if (oldAction_.sa_handler)
{ {
@ -94,7 +95,7 @@ void Foam::sigSegv::set(const bool verbose)
} }
struct sigaction newAction; struct sigaction newAction;
newAction.sa_handler = sigSegvHandler; newAction.sa_handler = sigHandler;
newAction.sa_flags = SA_NODEFER; newAction.sa_flags = SA_NODEFER;
sigemptyset(&newAction.sa_mask); sigemptyset(&newAction.sa_mask);
if (sigaction(SIGSEGV, &newAction, &oldAction_) < 0) if (sigaction(SIGSEGV, &newAction, &oldAction_) < 0)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,9 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "OSspecific.H" #ifndef sigSegv_H
#define sigSegv_H
#include <signal.h> #include <signal.h>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,13 +62,15 @@ class sigSegv
// Private Member Functions // Private Member Functions
static void sigSegvHandler(int); //- Handler for caught signals
static void sigHandler(int);
public: public:
// Constructors // Constructors
//- Construct null
sigSegv(); sigSegv();
@ -76,6 +80,7 @@ public:
// Member functions // Member functions
//- Activate SIGSEGV signal handler
void set(const bool verbose); void set(const bool verbose);
}; };
@ -84,4 +89,8 @@ public:
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -58,10 +58,10 @@ Foam::argList::initValidTables::initValidTables()
validParOptions.set("parallel", ""); validParOptions.set("parallel", "");
argList::addOption argList::addOption
( (
"roots", "(dir1 .. dirn)", "roots", "(dir1 .. dirN)",
"slave root directories for distributed running" "slave root directories for distributed running"
); );
validParOptions.set("roots", "(dir1 .. dirn)"); validParOptions.set("roots", "(dir1 .. dirN)");
Pstream::addValidParOptions(validParOptions); Pstream::addValidParOptions(validParOptions);
} }
@ -138,8 +138,8 @@ void Foam::argList::noBanner()
void Foam::argList::noParallel() void Foam::argList::noParallel()
{ {
optionUsage.erase("parallel"); removeOption("parallel");
validOptions.erase("parallel"); removeOption("roots");
validParOptions.clear(); validParOptions.clear();
} }
@ -537,10 +537,10 @@ Foam::argList::argList
if (options_.found("roots")) if (options_.found("roots"))
{ {
source = "'-roots' option";
IStringStream str(options_["roots"]); IStringStream str(options_["roots"]);
str >> roots; str >> roots;
dictNProcs = roots.size()+1; dictNProcs = roots.size()+1;
source = "roots-command-line";
} }
else else
{ {
@ -593,7 +593,7 @@ Foam::argList::argList
{ {
forAll(roots, i) forAll(roots, i)
{ {
roots[i] = roots[i].expand(); roots[i].expand();
} }
if (roots.size() != Pstream::nProcs()-1) if (roots.size() != Pstream::nProcs()-1)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -83,6 +83,7 @@ SourceFiles
#include "fileName.H" #include "fileName.H"
#include "parRun.H" #include "parRun.H"
#include "IStringStream.H" #include "IStringStream.H"
#include "OSspecific.H"
#include "sigFpe.H" #include "sigFpe.H"
#include "sigInt.H" #include "sigInt.H"
@ -94,7 +95,9 @@ SourceFiles
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // /*---------------------------------------------------------------------------*\
Class argList Declaration
\*---------------------------------------------------------------------------*/
class argList class argList
{ {
@ -165,7 +168,7 @@ public:
//- Max screen width for displaying usage (default: 80) //- Max screen width for displaying usage (default: 80)
static string::size_type usageMax; static string::size_type usageMax;
//! @cond ignoreDocumentation //! @cond internalClass
class initValidTables class initValidTables
{ {
public: public:

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -31,8 +31,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
//! @cond fileScope //! @cond fileScope
const char hexChars[] = "0123456789abcdef"; static const char hexChars[] = "0123456789abcdef";
//! @endcond fileScope //! @endcond
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -87,6 +87,20 @@ void Foam::SHA1Digest::clear()
} }
bool Foam::SHA1Digest::empty() const
{
for (unsigned i = 0; i < length; ++i)
{
if (v_[i])
{
return false;
}
}
return true;
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
bool Foam::SHA1Digest::operator==(const SHA1Digest& rhs) const bool Foam::SHA1Digest::operator==(const SHA1Digest& rhs) const
@ -103,9 +117,79 @@ bool Foam::SHA1Digest::operator==(const SHA1Digest& rhs) const
} }
bool Foam::SHA1Digest::operator==(const std::string& hexdigits) const
{
// null or empty string is not an error - interpret as '0000..'
if (hexdigits.empty())
{
return empty();
}
// incorrect length - can never match
if (hexdigits.size() != length*2)
{
return false;
}
for (unsigned i = 0, charI = 0; i < length; ++i, charI += 2)
{
const char c1 = hexChars[((v_[i] >> 4) & 0xF)];
const char c2 = hexChars[(v_[i] & 0xF)];
if (c1 != hexdigits[charI] || c2 != hexdigits[charI+1])
{
return false;
}
}
return true;
}
bool Foam::SHA1Digest::operator==(const char* hexdigits) const
{
// null or empty string is not an error - interpret as '0000..'
if (!hexdigits || !*hexdigits)
{
return empty();
}
// incorrect length - can never match
if (strlen(hexdigits) != length*2)
{
return false;
}
for (unsigned i = 0, charI = 0; i < length; ++i, charI += 2)
{
const char c1 = hexChars[((v_[i] >> 4) & 0xF)];
const char c2 = hexChars[(v_[i] & 0xF)];
if (c1 != hexdigits[charI] || c2 != hexdigits[charI+1])
{
return false;
}
}
return true;
}
bool Foam::SHA1Digest::operator!=(const SHA1Digest& rhs) const bool Foam::SHA1Digest::operator!=(const SHA1Digest& rhs) const
{ {
return !this->operator==(rhs); return !operator==(rhs);
}
bool Foam::SHA1Digest::operator!=(const std::string& rhs) const
{
return !operator==(rhs);
}
bool Foam::SHA1Digest::operator!=(const char* rhs) const
{
return !operator==(rhs);
} }

View File

@ -3,4 +3,4 @@ Pstream.C
OPwrite.C OPwrite.C
IPread.C IPread.C
LIB = $(FOAM_MPI_LIBBIN)/libPstream LIB = $(FOAM_LIBBIN)/$(FOAM_MPI)/libPstream

View File

@ -3,4 +3,4 @@ UIPread.C
UPstream.C UPstream.C
PstreamGlobals.C PstreamGlobals.C
LIB = $(FOAM_MPI_LIBBIN)/libPstream LIB = $(FOAM_LIBBIN)/$(FOAM_MPI)/libPstream

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -167,6 +167,14 @@ Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New
} }
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::coordinateRotation::clear()
{
this->tensor::operator=(sphericalTensor::I);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::coordinateRotation::operator=(const dictionary& rhs) void Foam::coordinateRotation::operator=(const dictionary& rhs)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -165,6 +165,9 @@ public:
// Member Functions // Member Functions
//- Reset rotation to an identity rotation
virtual void clear();
//- Return local-to-global transformation tensor //- Return local-to-global transformation tensor
const tensor& R() const const tensor& R() const
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -290,6 +290,15 @@ Foam::tmp<Foam::vectorField> Foam::coordinateSystem::globalToLocal
} }
void Foam::coordinateSystem::clear()
{
note_.clear();
origin_ = point::zero;
R_.clear();
Rtr_ = sphericalTensor::I;
}
void Foam::coordinateSystem::write(Ostream& os) const void Foam::coordinateSystem::write(Ostream& os) const
{ {
os << type() os << type()

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -397,6 +397,10 @@ public:
return origin_; return origin_;
} }
//- Reset origin and rotation to an identity coordinateSystem
// Also resets the note
virtual void clear();
// Write // Write

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
# get SCOTCH_VERSION, SCOTCH_ARCH_PATH, SCOTCH_MPI_INCLUDE # get SCOTCH_VERSION, SCOTCH_ARCH_PATH
settings=`$WM_PROJECT_DIR/bin/foamEtcFile apps/scotch/bashrc` settings=`$WM_PROJECT_DIR/bin/foamEtcFile apps/scotch/bashrc`
if [ -f "$settings" ] if [ -f "$settings" ]
then then
@ -19,7 +19,7 @@ wmakeLnInclude decompositionMethods
wmake libso scotchDecomp wmake libso scotchDecomp
wmake libso metisDecomp wmake libso metisDecomp
if [ -d "$FOAM_MPI_LIBBIN" ] if [ -d "$FOAM_LIBBIN/$FOAM_MPI" ]
then then
( (
WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB

View File

@ -1,3 +1,3 @@
metisDecomp.C metisDecomp.C
LIB = $(FOAM_EXT_LIBBIN)/libmetisDecomp LIB = $(FOAM_LIBBIN)/libmetisDecomp

View File

@ -1,3 +1,3 @@
ptscotchDecomp.C ptscotchDecomp.C
LIB = $(FOAM_MPI_LIBBIN)/libptscotchDecomp LIB = $(FOAM_LIBBIN)/$(FOAM_MPI)/libptscotchDecomp

View File

@ -3,9 +3,9 @@ sinclude $(RULES)/mplib$(WM_MPLIB)
EXE_INC = \ EXE_INC = \
$(PFLAGS) $(PINC) \ $(PFLAGS) $(PINC) \
-I$(SCOTCH_MPI_INCLUDE) \ -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
-I/usr/include/scotch \ -I/usr/include/scotch \
-I../decompositionMethods/lnInclude -I../decompositionMethods/lnInclude
LIB_LIBS = \ LIB_LIBS = \
-L$(FOAM_MPI_LIBBIN) -lptscotch -lptscotcherrexit -lrt -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lrt

View File

@ -1,3 +1,3 @@
scotchDecomp.C scotchDecomp.C
LIB = $(FOAM_EXT_LIBBIN)/libscotchDecomp LIB = $(FOAM_LIBBIN)/libscotchDecomp

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -188,7 +188,7 @@ Foam::forces::forces
fDName_(""), fDName_(""),
rhoRef_(VGREAT), rhoRef_(VGREAT),
pRef_(0), pRef_(0),
CofR_(vector::zero), coordSys_(),
forcesFilePtr_(NULL) forcesFilePtr_(NULL)
{ {
// Check if the available mesh is an fvMesh otherise deactivate // Check if the available mesh is an fvMesh otherise deactivate
@ -225,14 +225,13 @@ void Foam::forces::read(const dictionary& dict)
if (active_) if (active_)
{ {
log_ = dict.lookupOrDefault<Switch>("log", false); log_ = dict.lookupOrDefault<Switch>("log", false);
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
const fvMesh& mesh = refCast<const fvMesh>(obr_); const fvMesh& mesh = refCast<const fvMesh>(obr_);
patchSet_ = patchSet_ =
mesh.boundaryMesh().patchSet(wordList(dict.lookup("patches"))); mesh.boundaryMesh().patchSet(wordList(dict.lookup("patches")));
dict.readIfPresent("directForceDensity", directForceDensity_);
if (directForceDensity_) if (directForceDensity_)
{ {
// Optional entry for fDName // Optional entry for fDName
@ -245,7 +244,7 @@ void Foam::forces::read(const dictionary& dict)
) )
{ {
active_ = false; active_ = false;
WarningIn("void forces::read(const dictionary& dict)") WarningIn("void forces::read(const dictionary&)")
<< "Could not find " << fDName_ << " in database." << nl << "Could not find " << fDName_ << " in database." << nl
<< " De-activating forces." << " De-activating forces."
<< endl; << endl;
@ -272,7 +271,7 @@ void Foam::forces::read(const dictionary& dict)
{ {
active_ = false; active_ = false;
WarningIn("void forces::read(const dictionary& dict)") WarningIn("void forces::read(const dictionary&)")
<< "Could not find " << UName_ << ", " << pName_; << "Could not find " << UName_ << ", " << pName_;
if (rhoName_ != "rhoInf") if (rhoName_ != "rhoInf")
@ -280,8 +279,8 @@ void Foam::forces::read(const dictionary& dict)
Info<< " or " << rhoName_; Info<< " or " << rhoName_;
} }
Info<< " in database." << nl << " De-activating forces." Info<< " in database." << nl
<< endl; << " De-activating forces." << endl;
} }
// Reference density needed for incompressible calculations // Reference density needed for incompressible calculations
@ -291,8 +290,14 @@ void Foam::forces::read(const dictionary& dict)
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0); pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
} }
coordSys_.clear();
// Centre of rotation for moment calculations // Centre of rotation for moment calculations
CofR_ = dict.lookup("CofR"); // specified directly, from coordinate system, or implicitly (0 0 0)
if (!dict.readIfPresent<point>("CofR", coordSys_.origin()))
{
coordSys_ = coordinateSystem(dict, obr_);
}
} }
} }
@ -345,6 +350,8 @@ void Foam::forces::writeFileHeader()
forcesFilePtr_() forcesFilePtr_()
<< "# Time" << tab << "# Time" << tab
<< "forces(pressure, viscous) moment(pressure, viscous)" << "forces(pressure, viscous) moment(pressure, viscous)"
<< tab
<< "local forces(pressure, viscous) local moment(pressure, viscous)"
<< endl; << endl;
} }
} }
@ -373,13 +380,32 @@ void Foam::forces::write()
if (Pstream::master()) if (Pstream::master())
{ {
forcesFilePtr_() << obr_.time().value() << tab << fm << endl; forcesMoments fmLocal;
fmLocal.first().first() =
coordSys_.localVector(fm.first().first());
fmLocal.first().second() =
coordSys_.localVector(fm.first().second());
fmLocal.second().first() =
coordSys_.localVector(fm.second().first());
fmLocal.second().second() =
coordSys_.localVector(fm.second().second());
forcesFilePtr_() << obr_.time().value()
<< tab << fm
<< tab << fmLocal << endl;
if (log_) if (log_)
{ {
Info<< "forces output:" << nl Info<< "forces output:" << nl
<< " forces(pressure, viscous)" << fm.first() << nl << " forces(pressure, viscous)" << fm.first() << nl
<< " moment(pressure, viscous)" << fm.second() << nl << " moment(pressure, viscous)" << fm.second() << nl
<< " local:" << nl
<< " forces(pressure, viscous)" << fmLocal.first() << nl
<< " moment(pressure, viscous)" << fmLocal.second() << nl
<< endl; << endl;
} }
} }
@ -408,7 +434,10 @@ Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const
{ {
label patchi = iter.key(); label patchi = iter.key();
vectorField Md(mesh.C().boundaryField()[patchi] - CofR_); vectorField Md
(
mesh.C().boundaryField()[patchi] - coordSys_.origin()
);
scalarField sA(mag(Sfb[patchi])); scalarField sA(mag(Sfb[patchi]));
@ -452,7 +481,10 @@ Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const
{ {
label patchi = iter.key(); label patchi = iter.key();
vectorField Md(mesh.C().boundaryField()[patchi] - CofR_); vectorField Md
(
mesh.C().boundaryField()[patchi] - coordSys_.origin()
);
vectorField pf(Sfb[patchi]*(p.boundaryField()[patchi] - pRef)); vectorField pf(Sfb[patchi]*(p.boundaryField()[patchi] - pRef));

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,11 +28,25 @@ Description
Calculates the forces and moments by integrating the pressure and Calculates the forces and moments by integrating the pressure and
skin-friction forces over a given list of patches. skin-friction forces over a given list of patches.
Member function calcForcesMoment()calculates and returns the forces and Member function forces::write() calculates the forces/moments and
moments. writes the forces/moments into the file \<timeDir\>/forces.dat
Member function forces::write() calls calcForcesMoment() and writes the Note
forces and moments into the file \<timeDir\>/forces.dat The centre of rotation for moment calculations can either be specified
by an @c CofR entry, or be taken from origin of the local coordinateSystem.
For example,
@verbatim
CofR (0 0 0);
@endverbatim
or
@verbatim
coordinateSystem
{
origin (0 0 0);
e3 (0 0 1);
e1 (1 0 0);
}
@endverbatim
SourceFiles SourceFiles
forces.C forces.C
@ -43,6 +57,8 @@ SourceFiles
#ifndef forces_H #ifndef forces_H
#define forces_H #define forces_H
#include "coordinateSystem.H"
#include "coordinateSystems.H"
#include "primitiveFieldsFwd.H" #include "primitiveFieldsFwd.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "HashSet.H" #include "HashSet.H"
@ -69,15 +85,14 @@ class forces
{ {
public: public:
// Tuple which holds the pressure (.first()) and viscous (.second) forces // Tuple for pressure (.first()) and viscous (.second()) forces
typedef Tuple2<vector, vector> pressureViscous; typedef Tuple2<vector, vector> pressureViscous;
// Tuple which holds the forces (.first()) and moment (.second) // Tuple for forces (.first()) and moment (.second())
// pressure/viscous forces Tuples. // pressure/viscous forces Tuples.
typedef Tuple2<pressureViscous, pressureViscous> forcesMoments; typedef Tuple2<pressureViscous, pressureViscous> forcesMoments;
//- Sum operation class to accumulate the pressure, viscous forces //- Sum operation class to accumulate pressure/viscous forces and moments
// and moments
class sumOp class sumOp
{ {
public: public:
@ -147,8 +162,8 @@ protected:
//- Reference pressure //- Reference pressure
scalar pRef_; scalar pRef_;
//- Centre of rotation //- Coordinate system used when evaluting forces/moments
vector CofR_; coordinateSystem coordSys_;
//- Forces/moment file ptr //- Forces/moment file ptr

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -223,9 +223,6 @@ public:
// Public typedefs // Public typedefs
//- Face type used
typedef labelledTri FaceType;
//- Placeholder only, but do not remove - it is needed for GeoMesh //- Placeholder only, but do not remove - it is needed for GeoMesh
typedef bool BoundaryMesh; typedef bool BoundaryMesh;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -17,4 +17,3 @@ reactions
Ta 14906; Ta 14906;
} }
} }

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -56,8 +56,7 @@ WM_SCRIPTS = $(WM_DIR)/scripts
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
LIB_SRC = $(WM_PROJECT_DIR)/src LIB_SRC = $(WM_PROJECT_DIR)/src
LIB_DIR = $(WM_PROJECT_DIR)/lib LIB_PLATFORMS = $(WM_PROJECT_DIR)/platforms/$(WM_OPTIONS)/lib
LIB_WM_OPTIONS_DIR = $(LIB_DIR)/$(WM_OPTIONS)
OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS) OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS)
CLASSES_DIR = $(MAKE_DIR)/classes CLASSES_DIR = $(MAKE_DIR)/classes
@ -148,7 +147,7 @@ LIB_HEADER_DIRS = \
$(EXE): $(OBJECTS) $(EXE): $(OBJECTS)
@$(WM_SCRIPTS)/makeTargetDir $(EXE) @$(WM_SCRIPTS)/makeTargetDir $(EXE)
$(LINKEXE) $(OBJECTS) -L$(LIB_WM_OPTIONS_DIR) \ $(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
$(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE) $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE)
exe: $(SEXE) exe: $(SEXE)
@ -173,7 +172,7 @@ $(LIB).$(SO): $(OBJECTS)
@$(WM_SCRIPTS)/makeTargetDir $(LIB) @$(WM_SCRIPTS)/makeTargetDir $(LIB)
@rm -f so_locations @rm -f so_locations
@cd $(OBJECTS_DIR) ; \ @cd $(OBJECTS_DIR) ; \
$(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO) $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_PLATFORMS) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
lib: $(LIB).a lib: $(LIB).a
@echo \'$(LIB).a\' is up to date. @echo \'$(LIB).a\' is up to date.