Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

Conflicts:
	etc/settings.csh
	etc/settings.sh
	src/parallel/decompose/Allwmake
This commit is contained in:
mattijs
2010-03-22 15:44:34 +00:00
17 changed files with 487 additions and 362 deletions

27
README
View File

@ -2,7 +2,7 @@
# #
#+TITLE: OpenFOAM README for version 1.6 #+TITLE: OpenFOAM README for version 1.6
#+AUTHOR: OpenCFD Ltd. #+AUTHOR: OpenCFD Ltd.
#+DATE: November 2009 #+DATE: March 2010
#+LINK: http://www.opencfd.co.uk #+LINK: http://www.opencfd.co.uk
#+OPTIONS: author:nil ^:{} #+OPTIONS: author:nil ^:{}
@ -23,10 +23,10 @@
section "Running OpenFOAM in 32-bit mode". section "Running OpenFOAM in 32-bit mode".
*** Qt (from http://trolltech.com/products/qt) *** Qt (from http://trolltech.com/products/qt)
The ParaView 3.6.1 visualisation package requires Qt to be installed on the The ParaView 3.7.0 visualisation package requires Qt to be installed on the
system. ParaView's producers state that ParaView is only officially system. ParaView's producers state that ParaView is only officially
supported on Qt version 4.3.x. However, we have found in limited tests that supported on Qt version 4.6.x. However, we have found in limited tests that
ParaView works satisfactorily with newer versions of Qt than 4.3.x. To ParaView works satisfactorily with Qt than 4.5.x. To
check whether Qt4 is installed, and the version, type: check whether Qt4 is installed, and the version, type:
+ qmake --version + qmake --version
@ -44,13 +44,14 @@
+ openSUSE-10.3: Version 4.3.1 + openSUSE-10.3: Version 4.3.1
+ openSUSE-11.0: Version 4.4.0 + openSUSE-11.0: Version 4.4.0
+ openSUSE-11.1: Version 4.4.3 + openSUSE-11.1: Version 4.4.3
+ openSUSE-11.2: Version 4.5.3
Compilation and running of ParaView has been successful using the libraries Compilation and running of ParaView has been successful using the libraries
downloaded in the "libqt4-dev" package on ubuntu. downloaded in the "libqt4-dev" package on ubuntu.
If you don't have an appropriate version of Qt installed you can download If you don't have an appropriate version of Qt installed you can download
the sources from TrollTech e.g.: the sources e.g.:
ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.5.tar.bz2 http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz
and compile and install in /usr/local or some other location that does not and compile and install in /usr/local or some other location that does not
conflict with the pre-installed version. conflict with the pre-installed version.
@ -108,7 +109,7 @@
* Building from Sources (Optional) * Building from Sources (Optional)
If you cannot find an appropriate binary pack for your platform, you can build If you cannot find an appropriate binary pack for your platform, you can build
the complete OpenFOAM from the source-pack. You will first need to compile or the complete OpenFOAM from the source-pack. You will first need to compile or
obtain a recent version of gcc (we recomend gcc-4.3.?) for your platform, obtain a recent version of gcc (we recommend gcc-4.4.?) for your platform,
which may be obtained from http://gcc.gnu.org/. which may be obtained from http://gcc.gnu.org/.
Install the compiler in Install the compiler in
@ -157,16 +158,16 @@
Refer to the OpenFOAM User Guide at http://www.OpenFOAM.org/doc/user.html for Refer to the OpenFOAM User Guide at http://www.OpenFOAM.org/doc/user.html for
more information. more information.
* Compiling Paraview 3.6.1 and the PV3FoamReader module * Compiling Paraview 3.7.0 and the PV3FoamReader module
If there are problems encountered with ParaView, then it may be necessary to If there are problems encountered with ParaView, then it may be necessary to
compile ParaView from sources. The compilation compile ParaView from sources. The compilation
is a fairly simple process using the makeParaView script is a fairly simple process using the makeParaView script
(found in ThirdParty directory), which has worked in our tests with other (found in ThirdParty directory), which has worked in our tests with other
packages supplied in the ThirdParty directory, namely cmake-2.6.4 and packages supplied in the ThirdParty directory, namely cmake-2.8.0 and
gcc-4.3.3. Execute the following: gcc-4.4.3. Execute the following:
+ cd $WM_THIRD_PARTY_DIR + cd $WM_THIRD_PARTY_DIR
+ rm -rf paraview-3.6.1/platforms + rm -rf paraview-3.7.0/platforms
+ rm -rf platforms/*/paraview-3.6.1 + rm -rf platforms/*/paraview-3.7.0
+ ./makeParaView + ./makeParaView
The PV3blockMeshReader and the PV3FoamReader ParaView plugins are compiled The PV3blockMeshReader and the PV3FoamReader ParaView plugins are compiled
@ -178,7 +179,7 @@
*** Compiling Paraview with a local version of Qt *** Compiling Paraview with a local version of Qt
If the user still encounters problems with ParaView, it may relate to the If the user still encounters problems with ParaView, it may relate to the
version of Qt, in which case, it is recommended that the user first version of Qt, in which case, it is recommended that the user first
downloads a supported version of Qt /e.g./ 4.3.5 as described in the section downloads a supported version of Qt /e.g./ 4.5.3 as described in the section
on "Qt". The user should unpack the source pack in the $WM_THIRD_PARTY_DIR. on "Qt". The user should unpack the source pack in the $WM_THIRD_PARTY_DIR.
Then the user can build Qt by executing from within $WM_THIRD_PARTY_DIR: Then the user can build Qt by executing from within $WM_THIRD_PARTY_DIR:
+ ./makeQt + ./makeQt

View File

@ -356,8 +356,15 @@ class vtkPV3Foam
//- Zone info //- Zone info
void updateInfoZones(vtkDataArraySelection*); void updateInfoZones(vtkDataArraySelection*);
//- Read zone names for zoneType from file //- Get non-empty zone names for zoneType from file
wordList readZoneNames(const word& zoneType); wordList getZoneNames(const word& zoneType) const;
//- Get non-empty zone names from mesh info
template<class ZoneType>
wordList getZoneNames
(
const ZoneMesh<ZoneType, polyMesh>&
) const;
//- Add objects of Type to paraview array selection //- Add objects of Type to paraview array selection
template<class Type> template<class Type>

View File

@ -82,9 +82,31 @@ public:
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType) template<class ZoneType>
Foam::wordList Foam::vtkPV3Foam::getZoneNames
(
const ZoneMesh<ZoneType, polyMesh>& zmesh
) const
{ {
wordList zoneNames; wordList names(zmesh.size());
label nZone = 0;
forAll(zmesh, zoneI)
{
if (zmesh[zoneI].size())
{
names[nZone++] = zmesh[zoneI].name();
}
}
names.setSize(nZone);
return names;
}
Foam::wordList Foam::vtkPV3Foam::getZoneNames(const word& zoneType) const
{
wordList names;
// mesh not loaded - read from file // mesh not loaded - read from file
IOobject ioObj IOobject ioObj
@ -107,14 +129,14 @@ Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType)
{ {
zonesEntries zones(ioObj); zonesEntries zones(ioObj);
zoneNames.setSize(zones.size()); names.setSize(zones.size());
forAll(zones, zoneI) forAll(zones, zoneI)
{ {
zoneNames[zoneI] = zones[zoneI].keyword(); names[zoneI] = zones[zoneI].keyword();
} }
} }
return zoneNames; return names;
} }
@ -312,11 +334,11 @@ void Foam::vtkPV3Foam::updateInfoZones
// ~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~
if (meshPtr_) if (meshPtr_)
{ {
namesLst = meshPtr_->cellZones().names(); namesLst = getZoneNames(meshPtr_->cellZones());
} }
else else
{ {
namesLst = readZoneNames("cellZones"); namesLst = getZoneNames("cellZones");
} }
arrayRangeCellZones_.reset(arraySelection->GetNumberOfArrays()); arrayRangeCellZones_.reset(arraySelection->GetNumberOfArrays());
@ -335,11 +357,11 @@ void Foam::vtkPV3Foam::updateInfoZones
// ~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~
if (meshPtr_) if (meshPtr_)
{ {
namesLst = meshPtr_->faceZones().names(); namesLst = getZoneNames(meshPtr_->faceZones());
} }
else else
{ {
namesLst = readZoneNames("faceZones"); namesLst = getZoneNames("faceZones");
} }
arrayRangeFaceZones_.reset(arraySelection->GetNumberOfArrays()); arrayRangeFaceZones_.reset(arraySelection->GetNumberOfArrays());
@ -358,11 +380,11 @@ void Foam::vtkPV3Foam::updateInfoZones
// ~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~
if (meshPtr_) if (meshPtr_)
{ {
namesLst = meshPtr_->pointZones().names(); namesLst = getZoneNames(meshPtr_->pointZones());
} }
else else
{ {
namesLst = readZoneNames("pointZones"); namesLst = getZoneNames("pointZones");
} }
arrayRangePointZones_.reset(arraySelection->GetNumberOfArrays()); arrayRangePointZones_.reset(arraySelection->GetNumberOfArrays());

View File

@ -43,7 +43,6 @@ usage() {
cat <<USAGE 1>&2 cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN] Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN]
options: options:
-space treat 'path' as space-delimited (eg, from C-Shell)
-strip remove inaccessible directories -strip remove inaccessible directories
-help print the usage -help print the usage
@ -57,7 +56,7 @@ USAGE
} }
unset space strip unset strip
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
@ -65,10 +64,6 @@ do
-h | -help) -h | -help)
usage usage
;; ;;
-space)
space=true
shift
;;
-strip) -strip)
strip=true strip=true
shift shift
@ -82,12 +77,7 @@ done
[ "$#" -ge 1 ] || usage [ "$#" -ge 1 ] || usage
if [ "$space" = true ] dirList="$1"
then
dirList=$(echo "$1" | sed -e 's/ /:/g')
else
dirList="$1"
fi
shift shift
##DEBUG echo "input>$dirList<" 1>&2 ##DEBUG echo "input>$dirList<" 1>&2
@ -140,11 +130,8 @@ done
IFS=' ' IFS=' '
set -- $dirList set -- $dirList
# join on ':', unless -space option was specified # rejoin on ':'
if [ "$space" != true ] IFS=':'
then
IFS=':'
fi
dirList="$*" dirList="$*"
# restore IFS # restore IFS

View File

@ -85,7 +85,8 @@ setRawEntry() {
oldLine=`echo "$oldNumLine" | sed -e 's/^[^:]*://'` oldLine=`echo "$oldNumLine" | sed -e 's/^[^:]*://'`
oldKey=`getKey "$oldLine"` oldKey=`getKey "$oldLine"`
oldVal=`getRawEntry $1 "$2"` oldVal=`getRawEntry $1 "$2"`
if [ ! "$oldKey" -o ! "$oldVal" -o ! "$oldLine" ]; then if [ ! "$oldKey" -o ! "$oldVal" -o ! "$oldLine" ]
then
echo "setRawStringEntry: entry $2 not found in $1" echo "setRawStringEntry: entry $2 not found in $1"
echo "oldKey=$oldKey" echo "oldKey=$oldKey"
echo "lineNo=$lineNo" echo "lineNo=$lineNo"
@ -134,9 +135,12 @@ getBoolEntry()
} }
# newerFile file1 file2 # newerFile file1 file2
newerFile() { # ... could also use if [ $file1 -nt $file2 ] ...
newerFile()
{
latest=`ls -1 -t $1 $2 2> /dev/null | head -1` latest=`ls -1 -t $1 $2 2> /dev/null | head -1`
if [ "$latest" = $1 ]; then if [ "$latest" = $1 ]
then
return 0 return 0
else else
return 1 return 1
@ -149,8 +153,8 @@ processExists() {
ps -u $LOGNAME -o 'pid' | fgrep $1 >/dev/null ps -u $LOGNAME -o 'pid' | fgrep $1 >/dev/null
} }
printUsage() { usage() {
cat << USAGELABEL cat << USAGE
Usage: $PROGNAME [-n] <root> <case> <pid> Usage: $PROGNAME [-n] <root> <case> <pid>
or or
$PROGNAME -c <root> <case> $PROGNAME -c <root> <case>
@ -165,7 +169,8 @@ finish. Restores original controlDict if
The -c option clears any outstanding $PROGNAME for the case. The -c option clears any outstanding $PROGNAME for the case.
USAGELABEL USAGE
exit 1
} }
@ -174,7 +179,8 @@ restoreDict() {
trap 2 3 15 trap 2 3 15
echo "$PROGNAME : Restoring controlDict from controlDict_bak." echo "$PROGNAME : Restoring controlDict from controlDict_bak."
if [ -r ${controlDict}_bak ]; then if [ -r ${controlDict}_bak ]
then
cp ${controlDict}_bak $controlDict cp ${controlDict}_bak $controlDict
fi fi
@ -208,61 +214,69 @@ esac
# #
# Initial checks # Initial checks
# #
if [ $# -lt 3 ]; then if [ $# -lt 3 ]
printUsage then
exit 1 usage
fi fi
STOPNOW='' STOPNOW=''
if [ $1 = '-n' ]; then if [ $1 = '-n' ]
then
STOPNOW='yes' STOPNOW='yes'
shift shift
fi fi
CLEAR='' CLEAR=''
if [ $1 = '-c' ]; then if [ $1 = '-c' ]
then
CLEAR='yes' CLEAR='yes'
shift shift
if [ $# -ne 2 ]; then if [ $# -ne 2 ]
printUsage then
exit 1 usage
fi fi
ROOT=$1 ROOT=$1
CASE=$2 CASE=$2
else else
if [ $# -ne 3 ]; then if [ $# -ne 3 ]
printUsage then
exit 1 usage
fi fi
ROOT=$1 ROOT=$1
CASE=$2 CASE=$2
PID=$3 PID=$3
fi fi
CASE=`echo $CASE | sed -e 's!/.*!!'` #strip of processorXXX ending CASE=`echo $CASE | sed -e 's!/.*!!'` # strip of processorXXX ending
#- Pid actually running #- Pid actually running
if [ ! "$CLEAR" ]; then if [ ! "$CLEAR" ]
then
processExists $PID processExists $PID
if [ $? -ne 0 ] ;then if [ $? -ne 0 ]
then
echo "$PROGNAME : process $PID not running." echo "$PROGNAME : process $PID not running."
exit 1 exit 1
fi fi
fi fi
#- case directory writeable #- case directory writeable
if [ ! -w $ROOT/$CASE ]; then if [ ! -w $ROOT/$CASE ]
then
echo "$PROGNAME : $ROOT/$CASE is not writeable." echo "$PROGNAME : $ROOT/$CASE is not writeable."
exit 1 exit 1
fi fi
#- Controldict writeable #- Controldict writeable
controlDict=$ROOT/$CASE/system/controlDict controlDict=$ROOT/$CASE/system/controlDict
if [ ! -w $controlDict ]; then if [ ! -w $controlDict ]
then
echo "$PROGNAME : $controlDict is not writeable." echo "$PROGNAME : $controlDict is not writeable."
exit 1 exit 1
fi fi
#- runTimeModifiable #- runTimeModifiable
getBoolEntry $controlDict 'runTimeModifiable' getBoolEntry $controlDict 'runTimeModifiable'
if [ $? -ne 0 ]; then if [ $? -ne 0 ]
then
echo "$PROGNAME : runTimeModifiable not true in dictionary $controlDict." echo "$PROGNAME : runTimeModifiable not true in dictionary $controlDict."
exit 1 exit 1
fi fi
@ -270,12 +284,14 @@ fi
# #
#- Check if another foamEndJob running #- Check if another foamEndJob running
# #
if [ "$CLEAR" ]; then if [ "$CLEAR" ]
then
pidFiles=`ls $ROOT/$CASE/.foamEndJob* 2>/dev/null` pidFiles=`ls $ROOT/$CASE/.foamEndJob* 2>/dev/null`
for pidFile in $pidFiles for pidFile in $pidFiles
do do
pid=`cat $pidFile` pid=`cat $pidFile`
if [ "$pid" ]; then if [ "$pid" ]
then
echo "$PROGNAME : found $PROGNAME (pid $pid) for Foam process" echo "$PROGNAME : found $PROGNAME (pid $pid) for Foam process"
echo " root: $ROOT" echo " root: $ROOT"
echo " case: $CASE" echo " case: $CASE"
@ -288,11 +304,14 @@ if [ "$CLEAR" ]; then
fi fi
pidFile=$ROOT/$CASE/.foamEndJob${PID} pidFile=$ROOT/$CASE/.foamEndJob${PID}
if [ -f $pidFile ]; then if [ -f $pidFile ]
then
pid=`cat $pidFile` pid=`cat $pidFile`
if [ "$pid" ]; then if [ "$pid" ]
then
processExists $pid processExists $pid
if [ $? -eq 0 ] ;then if [ $? -eq 0 ]
then
echo "$PROGNAME : found running $PROGNAME (pid $pid) for Foam process" echo "$PROGNAME : found running $PROGNAME (pid $pid) for Foam process"
echo " root: $ROOT" echo " root: $ROOT"
echo " case: $CASE" echo " case: $CASE"
@ -314,28 +333,32 @@ echo $$ > $pidFile
#- startTime #- startTime
startTime=`getEntry $controlDict 'startTime'` startTime=`getEntry $controlDict 'startTime'`
if [ ! "$startTime" ]; then if [ ! "$startTime" ]
then
echo "$PROGNAME : startTime not set in dictionary $controlDict." echo "$PROGNAME : startTime not set in dictionary $controlDict."
exit 1 exit 1
fi fi
#- Write interval #- Write interval
writeInterval=`getEntry $controlDict 'writeInterval'` writeInterval=`getEntry $controlDict 'writeInterval'`
if [ ! "$writeInterval" ]; then if [ ! "$writeInterval" ]
then
echo "$PROGNAME : writeInterval not set in dictionary $controlDict." echo "$PROGNAME : writeInterval not set in dictionary $controlDict."
exit 1 exit 1
fi fi
#- stopAt #- stopAt
stopAt=`getEntry $controlDict 'stopAt'` stopAt=`getEntry $controlDict 'stopAt'`
if [ ! "$stopAt" ]; then if [ ! "$stopAt" ]
then
echo "$PROGNAME : stopAt not set in dictionary $controlDict." echo "$PROGNAME : stopAt not set in dictionary $controlDict."
exit 1 exit 1
fi fi
#- endTime #- endTime
endTime=`getEntry $controlDict 'endTime'` endTime=`getEntry $controlDict 'endTime'`
if [ ! "$endTime" ]; then if [ ! "$endTime" ]
then
echo "$PROGNAME : endTime not set in dictionary $controlDict." echo "$PROGNAME : endTime not set in dictionary $controlDict."
exit 1 exit 1
fi fi
@ -353,7 +376,8 @@ cp $controlDict ${controlDict}_bak
#- Set up handler to restore controlDict #- Set up handler to restore controlDict
trap restoreDict 2 3 15 trap restoreDict 2 3 15
if [ "$STOPNOW" ]; then if [ "$STOPNOW" ]
then
setRawEntry $controlDict 'stopAt' 'nextWrite' setRawEntry $controlDict 'stopAt' 'nextWrite'
setRawEntry $controlDict 'writeInterval' '1' setRawEntry $controlDict 'writeInterval' '1'
@ -385,7 +409,8 @@ if newerFile ${controlDict} ${controlDict}_bak; then
iter=0 iter=0
while newerFile ${controlDict} ${controlDict}_bak while newerFile ${controlDict} ${controlDict}_bak
do do
if [ $iter -ge 120 ]; then if [ $iter -ge 120 ]
then
#- 120*5 sec = 10 mins passed. Give up #- 120*5 sec = 10 mins passed. Give up
echo "$PROGNAME : File date not yet ok after 10 mins. Giving up." echo "$PROGNAME : File date not yet ok after 10 mins. Giving up."
break break
@ -412,22 +437,25 @@ while true
do do
sleep 5 sleep 5
if [ ! -r ${controlDict}_bak ]; then if [ ! -r ${controlDict}_bak ]
then
echo "$PROGNAME : ${controlDict}_bak dissappeared. Exiting without restore." echo "$PROGNAME : ${controlDict}_bak dissappeared. Exiting without restore."
exit 1 exit 1
fi fi
if newerFile ${controlDict} ${controlDict}_bak; then if newerFile ${controlDict} ${controlDict}_bak
then
echo "$PROGNAME : ${controlDict} modified externally. Exiting without restore." echo "$PROGNAME : ${controlDict} modified externally. Exiting without restore."
exit 0 exit 0
fi fi
processExists $PID processExists $PID
if [ $? -ne 0 ] ;then if [ $? -ne 0 ]
then
#- Job finished #- Job finished
break break
fi fi
#echo "Foam job $PID still running ..." # echo "Foam job $PID still running ..."
done done
#- Dictionary restore #- Dictionary restore

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) 1991-2010 OpenCFD Ltd. # \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -27,8 +27,17 @@
# foamEtcFile # foamEtcFile
# #
# Description # Description
# Locate user/site/shipped file with the semantics used in the # Locate user/group/shipped file with semantics similar to the
# ~OpenFOAM/fileName expansion # ~OpenFOAM/fileName expansion.
#
# The -mode option can be used to allow chaining from
# personal settings to site-wide settings.
#
# For example, within the user ~/.OpenFOAM/<VER>/prefs.sh:
# @verbatim
# foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile -m go prefs.sh` \
# && _foamSource $foamPrefs
# @endverbatim
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
unset listOpt quietOpt unset listOpt quietOpt
@ -41,24 +50,32 @@ usage() {
cat<<USAGE cat<<USAGE
Usage: ${0##*/} [OPTION] fileName Usage: ${0##*/} [OPTION] fileName
${0##*/} -list ${0##*/} [OPTION] -list
options: options:
-l | -list list the directories to be searched -list list the directories to be searched
-q | -quiet suppress all normal output -mode <mode> any combination of u(user), g(group), o(other)
-quiet suppress all normal output
-help print the usage
Locate user/site/shipped file with the semantics used in the Locate user/group/shipped file with semantics similar to the
~OpenFOAM/fileName expansion ~OpenFOAM/fileName expansion.
Exit status 0 when the file is found and output resolved path to stdout. The options can also be specified as a single character
Exit status 1 for miscellaneous errors. (eg, '-q' instead of '-quiet'), but must not be grouped.
Exit status 2 when the file is not found.
Exit status
0 when the file is found. Print resolved path to stdout.
1 for miscellaneous errors.
2 when the file is not found.
USAGE USAGE
exit 1 exit 1
} }
# default mode is 'ugo'
mode=ugo
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
@ -70,6 +87,20 @@ do
listOpt=true listOpt=true
shift shift
;; ;;
-m | -mode)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
mode="$2"
# sanity check:
case "$mode" in
*u* | *g* | *o* )
;;
*)
usage "'$1' option with invalid mode '$mode'"
;;
esac
shift 2
;;
-q | -quiet) -q | -quiet)
quietOpt=true quietOpt=true
shift shift
@ -83,18 +114,32 @@ do
esac esac
done done
# Save the essential bits of information: # Save the essential bits of information:
nArgs=$# nArgs=$#
fileName="$1" fileName="$1"
# The various places to be searched: # Define the various places to be searched:
set -- \ set -- $(
$HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION \ case "$mode" in
$HOME/.${WM_PROJECT:-OpenFOAM} \ *u*) # user
$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION \ echo $HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION
$WM_PROJECT_INST_DIR/site \ echo $HOME/.${WM_PROJECT:-OpenFOAM}
$WM_PROJECT_DIR/etc ;;
esac
case "$mode" in
*g*) # group
echo $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION
echo $WM_PROJECT_INST_DIR/site
;;
esac
case "$mode" in
*o*) # other
echo $WM_PROJECT_DIR/etc
;;
esac
)
# #

View File

@ -30,14 +30,14 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
Usage: ${0##*/} [OPTION] <application> ... Usage: ${0##*/} [OPTION] <application> ...
options: options:
-case <dir> specify alternative case directory, default is the cwd -case <dir> specify alternative case directory, default is the cwd
-s also sends output to screen
-p parallel run of processors -p parallel run of processors
-s also sends output to screen
-v <ver> specify OpenFOAM version -v <ver> specify OpenFOAM version
-help print the usage -help print the usage
@ -45,56 +45,46 @@ options:
Redirects the output to 'log' in the case directory Redirects the output to 'log' in the case directory
USAGE USAGE
exit 1 exit 1
} }
unset version unset version
# replacement for possibly buggy 'which' # replacement for possibly buggy 'which'
findExec() { findExec() {
case "$1" in case "$1" in
*/*) */*)
if [ -x "$1" ] ; then if [ -x "$1" ]
echo "$1" then
return 0 echo "$1"
fi return 0
;; fi
esac ;;
esac
oldIFS=$IFS oldIFS=$IFS
IFS=':' IFS=':'
for d in $PATH for d in $PATH
do do
# echo "testing: $d/$1" 1>&2 # echo "testing: $d/$1" 1>&2
if [ -x "$d/$1" -a ! -d "$d/$1" ] ; then if [ -x "$d/$1" -a ! -d "$d/$1" ]
# echo "Found exec: $d/$1" 1>&2 then
IFS=$oldIFS # echo "Found exec: $d/$1" 1>&2
echo "$d/$1" IFS=$oldIFS
return 0 echo "$d/$1"
fi return 0
done fi
IFS=$oldIFS done
echo "" IFS=$oldIFS
return 1 echo ""
} return 1
# grep for $1
getPID() {
ps -u $LOGNAME -o 'pid,args' | fgrep "$1 " | fgrep -v grep | head -1 | awk '{ print $1 }'
} }
consultGuide() {
cat<<EOF
Please consult the User Guide for details of parallel running
EOF
}
# MAIN SCRIPT # MAIN SCRIPT
#~~~~~~~~~~~~ #~~~~~~~~~~~~
SCREEN=no unset parallelOpt screenOpt
PARALLEL=no
# parse options # parse options
@ -110,12 +100,12 @@ do
shift 2 shift 2
cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'" cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'"
;; ;;
-s) -p)
SCREEN=yes parallelOpt=true
shift shift
;; ;;
-p) -s)
PARALLEL=yes screenOpt=true
shift shift
;; ;;
-v) -v)
@ -136,100 +126,119 @@ do
esac esac
done done
if [ "$#" -lt 1 ]; then if [ "$#" -lt 1 ]
usage "No application specified" then
usage "No application specified"
fi fi
# use foamExec for a specified version and for remote (parallel) runs # use foamExec for a specified version and for remote (parallel) runs
if [ -n "$version" -o "$PARALLEL" = yes ]; then if [ -n "$version" -o "$parallelOpt" = true ]
APPLICATION=`findExec foamExec` then
if [ $? -ne 0 ]; then APPLICATION=`findExec foamExec`
usage "'foamExec' not found" if [ $? -ne 0 ]
fi then
if [ -n "$version" ]; then usage "'foamExec' not found"
APPLICATION="$APPLICATION -v $version" fi
fi if [ -n "$version" ]
then
APPLICATION="$APPLICATION -v $version"
fi
else else
APPLICATION=`findExec $1` APPLICATION=`findExec $1`
if [ $? -ne 0 ]; then if [ $? -ne 0 ]
usage "Application '$1' executable not found" then
fi usage "Application '$1' executable not found"
echo "Application : $1" fi
shift echo "Application : $1"
shift
fi fi
if [ "$PARALLEL" = no ]; then
# if [ "$parallelOpt" = true ]
# RUN ON SINGLE PROCESSOR then
# # parallel
if [ "$SCREEN" = no ]; then # ~~~~~~~~
echo "Executing: $APPLICATION $@ > log 2>&1 &"
$APPLICATION $@ > log 2>&1 & #
# is the case decomposed?
#
if [ -r "processor0" ]
then
NPROCS="`/bin/ls -1d processor* | wc -l`"
else else
echo "Executing: $APPLICATION $@ | tee log &" echo "Case is not currently decomposed"
$APPLICATION $@ | tee log & if [ -r system/decomposeParDict ]
wait $! then
echo "system/decomposeParDict exists"
echo "Try decomposing with \"foamJob decomposePar\""
exit 1
else
echo "Cannot find system/decomposeParDict file required to decompose the case for parallel running."
echo "Please consult the User Guide for details of parallel running"
exit 1
fi
fi
#
# locate mpirun
#
mpirun=`findExec mpirun`
if [ $? -ne 0 ]
then
usage "'mpirun' not found"
fi
mpiopts="-np $NPROCS"
#
# is the machine ready to run parallel?
#
echo "Parallel processing using $WM_MPLIB with $NPROCS processors"
case "$WM_MPLIB" in
OPENMPI)
# add hostfile info
for hostfile in \
hostfile \
machines \
system/hostfile \
system/machines \
;
do
if [ -r $hostfile ]
then
mpiopts="$mpiopts -hostfile $hostfile"
break
fi
done
;;
esac
#
# run (in parallel)
#
if [ "$screenOpt" = true ]
then
echo "Executing: mpirun $mpiopts $APPLICATION $@ -parallel | tee log"
$mpirun $mpiopts $APPLICATION $@ -parallel | tee log
else
echo "Executing: mpirun $mpiopts $APPLICATION $@ -parallel > log 2>&1"
$mpirun $mpiopts $APPLICATION $@ -parallel > log 2>&1 &
fi
else
#
# run (on single processor)
#
if [ "$screenOpt" = true ]
then
echo "Executing: $APPLICATION $@ | tee log &"
$APPLICATION $@ | tee log &
wait $!
else
echo "Executing: $APPLICATION $@ > log 2>&1 &"
$APPLICATION $@ > log 2>&1 &
fi fi
else else
#
# IS THE CASE DECOMPOSED?
#
if [ -r "processor0" ] ; then
NPROCS="`/bin/ls -1d processor* | wc -l`"
else
echo "Case is not currently decomposed"
if [ -r system/decomposeParDict ] ; then
echo "system/decomposeParDict exists"
echo "Try decomposing with \"foamJob decomposePar\""
exit 1
else
echo "Cannot find system/decomposeParDict file required to decompose the case for parallel running."
consultGuide
exit 1
fi
fi
#
# LOCATE MPIRUN
#
mpirun=`findExec mpirun`
if [ $? -ne 0 ]; then
usage "'mpirun' not found"
fi
mpiopts="-np $NPROCS"
#
# IS THE MACHINE READY TO RUN PARALLEL?
#
echo "Parallel processing using $WM_MPLIB with $NPROCS processors"
case "$WM_MPLIB" in
OPENMPI)
# add hostfile info
for hostfile in \
hostfile \
machines \
system/hostfile \
system/machines \
;
do
if [ -r $hostfile ]; then
mpiopts="$mpiopts -hostfile $hostfile"
break
fi
done
;;
esac
#
# RUN IN PARALLEL
#
if [ "$SCREEN" = no ] ; then
echo "Executing: mpirun $mpiopts $APPLICATION $@ -parallel > log 2>&1"
$mpirun $mpiopts $APPLICATION $@ -parallel > log 2>&1 &
else
echo "Executing: mpirun $mpiopts $APPLICATION $@ -parallel | tee log"
$mpirun $mpiopts $APPLICATION $@ -parallel | tee log
fi
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -40,34 +40,39 @@ else
fi fi
printUsage() { usage()
echo "" {
echo "Usage: ${0##*/} -np <dd> <executable> <args>" cat<<USAGE
echo ""
echo "This will run like mpirun but with each process in an xterm" Usage: ${0##*/} -np <dd> <executable> <args>
* This will run like mpirun but with each process in an XTerm
USAGE
exit 1
} }
nProcs='' unset nProcs exec args
exec=''
args=''
while [ "$1" != "" ]; do while [ "$1" != "" ]
do
echo "$1" echo "$1"
case $1 in case $1 in
-np) -np)
nProcs=$2 nProcs=$2
shift shift
;; ;;
*) *)
if [ ! "$exec" ]; then if [ ! "$exec" ]
then
exec=$1 exec=$1
elif [ ! "$args" ]; then elif [ ! "$args" ]
then
args="\"$1\"" args="\"$1\""
else else
args="$args \"$1\"" args="$args \"$1\""
fi fi
;; ;;
esac esac
shift shift
done done
@ -76,27 +81,19 @@ echo "nProcs=$nProcs"
echo "exec=$exec" echo "exec=$exec"
echo "args=$args" echo "args=$args"
if [ ! "$nProcs" ]; then [ "$nProcs" ] || usage
printUsage [ "$args" ] || usage
exit 1 [ "$exec" ] || usage
fi
if [ ! "$args" ]; then
printUsage
exit 1
fi
if [ ! "$exec" ]; then
printUsage
exit 1
fi
exec=`which $exec` exec=`which $exec`
if [ ! -x "$exec" ]; then if [ ! -x "$exec" ]
then
echo "Cannot find executable $exec or is not executable" echo "Cannot find executable $exec or is not executable"
printUsage usage
exit 1
fi fi
if [ ! "$PWD" ]; then if [ ! "$PWD" ]
then
PWD=`pwd` PWD=`pwd`
fi fi
@ -106,43 +103,51 @@ echo "Constructed gdb initialization file $PWD/gdbCommands"
$ECHO "Choose running method: 0)normal 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind: \c" $ECHO "Choose running method: 0)normal 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind: \c"
read method read method
if [ "$method" -ne 0 -a "$method" -ne 1 -a "$method" -ne 2 -a "$method" -ne 3 -a "$method" -ne 4 -a "$method" -ne 5 ]; then case "$method" in
printUsage 0 | 1 | 2 | 3 | 4 | 5 )
exit 1 # okay
fi ;;
*)
usage
;;
esac
$ECHO "Run all processes local or distributed? 1)local 2)remote: \c" $ECHO "Run all processes local or distributed? 1)local 2)remote: \c"
read spawn read spawn
if [ "$spawn" -ne 1 -a "$spawn" -ne 2 ]; then if [ "$spawn" -ne 1 -a "$spawn" -ne 2 ]
printUsage then
exit 1 usage
fi fi
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ # check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/ # check ~/.$WM_PROJECT/
# check <installedProject>/etc/ # check <installedProject>/etc/
if [ "$WM_PROJECT" ]; then if [ "$WM_PROJECT" ]
then
for i in \ for i in \
$HOME/.WM_PROJECT/$WM_PROJECT_VERSION \ $HOME/.WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.WM_PROJECT \ $HOME/.WM_PROJECT \
$WM_PROJECT_DIR/etc \ $WM_PROJECT_DIR/etc \
; ;
do do
if [ -f "$i/bashrc" ]; then if [ -f "$i/bashrc" ]
sourceFoam="$i/bashrc" then
break sourceFoam="$i/bashrc"
fi break
done fi
done
fi fi
# Construct test string for remote execution. # Construct test string for remote execution.
# Source OpenFOAM settings if OpenFOAM environment not set. # Source OpenFOAM settings if OpenFOAM environment not set.
# attempt to preserve the installation directory 'FOAM_INST_DIR' # attempt to preserve the installation directory 'FOAM_INST_DIR'
if [ "$FOAM_INST_DIR" ]; then if [ "$FOAM_INST_DIR" ]
sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam" then
sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam"
else else
sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam" sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam"
fi fi
echo "**sourceFoam:$sourceFoam" echo "**sourceFoam:$sourceFoam"
@ -160,36 +165,45 @@ do
geom="-geometry 120x20+$xpos+$ypos" geom="-geometry 120x20+$xpos+$ypos"
node="" node=""
if [ .$WM_MPLIB = .OPENMPI ]; then if [ "$WM_MPLIB" = OPENMPI ]
then
node="-np 1 " node="-np 1 "
fi fi
echo "#!/bin/sh" > $procCmdFile echo "#!/bin/sh" > $procCmdFile
if [ "$method" -eq 0 ]; then case "$method" in
0)
echo "$sourceFoam; cd $PWD; $exec $args | tee $procLog" >> $procCmdFile echo "$sourceFoam; cd $PWD; $exec $args | tee $procLog" >> $procCmdFile
echo "${node}$procCmdFile" >> $PWD/mpirun.schema echo "${node}$procCmdFile" >> $PWD/mpirun.schema
elif [ "$method" -eq 1 ]; then ;;
1)
echo "$sourceFoam; cd $PWD; gdb -command $PWD/gdbCommands $exec 2>&1 | tee $procLog; read dummy" >> $procCmdFile echo "$sourceFoam; cd $PWD; gdb -command $PWD/gdbCommands $exec 2>&1 | tee $procLog; read dummy" >> $procCmdFile
#echo "$sourceFoam; cd $PWD; $exec $args; read dummy" >> $procCmdFile #echo "$sourceFoam; cd $PWD; $exec $args; read dummy" >> $procCmdFile
echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema
elif [ "$method" -eq 2 ]; then ;;
2)
echo "$sourceFoam; cd $PWD; gdb -command $PWD/gdbCommands >& $procLog" >> $procCmdFile echo "$sourceFoam; cd $PWD; gdb -command $PWD/gdbCommands >& $procLog" >> $procCmdFile
echo "${node}$procCmdFile" >> $PWD/mpirun.schema echo "${node}$procCmdFile" >> $PWD/mpirun.schema
elif [ "$method" -eq 3 ]; then ;;
3)
echo "$sourceFoam; cd $PWD; $exec $args >& $procLog" >> $procCmdFile echo "$sourceFoam; cd $PWD; $exec $args >& $procLog" >> $procCmdFile
echo "${node}$procCmdFile" >> $PWD/mpirun.schema echo "${node}$procCmdFile" >> $PWD/mpirun.schema
elif [ "$method" -eq 4 ]; then ;;
4)
echo "$sourceFoam; cd $PWD; $exec $args 2>&1 | tee $procLog; read dummy" >> $procCmdFile echo "$sourceFoam; cd $PWD; $exec $args 2>&1 | tee $procLog; read dummy" >> $procCmdFile
echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema
elif [ "$method" -eq 5 ]; then ;;
5)
echo "$sourceFoam; cd $PWD; valgrind $exec $args; read dummy" >> $procCmdFile echo "$sourceFoam; cd $PWD; valgrind $exec $args; read dummy" >> $procCmdFile
echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema
fi ;;
esac
chmod +x $procCmdFile chmod +x $procCmdFile
let column=proc%6 let column=proc%6
if [ $proc -ne 0 -a $column -eq 0 ]; then if [ $proc -ne 0 -a $column -eq 0 ]
then
((xpos+=600)) ((xpos+=600))
((ypos=0)) ((ypos=0))
else else
@ -203,10 +217,13 @@ do
echo " tail -f $procLog" echo " tail -f $procLog"
done done
cmd="" unset cmd
if [ .$WM_MPLIB = .OPENMPI ]; then
case "$WM_MPLIB" in
OPENMPI)
cmd="mpirun -app $PWD/mpirun.schema </dev/null" cmd="mpirun -app $PWD/mpirun.schema </dev/null"
elif [ .$WM_MPLIB = .MPICH ]; then ;;
MPICH)
cmd="mpiexec" cmd="mpiexec"
for ((proc=0; proc<$nProcs; proc++)) for ((proc=0; proc<$nProcs; proc++))
do do
@ -216,12 +233,14 @@ elif [ .$WM_MPLIB = .MPICH ]; then
echo "#!/bin/sh" > $procXtermCmdFile echo "#!/bin/sh" > $procXtermCmdFile
echo "$procCmd" >> $procXtermCmdFile echo "$procCmd" >> $procXtermCmdFile
chmod +x $procXtermCmdFile chmod +x $procXtermCmdFile
if [ $proc -ne 0 ]; then if [ $proc -ne 0 ]
then
cmd="${cmd} :" cmd="${cmd} :"
fi fi
cmd="${cmd} -n 1 ${procXtermCmdFile}" cmd="${cmd} -n 1 ${procXtermCmdFile}"
done < $PWD/mpirun.schema done < $PWD/mpirun.schema
fi ;;
esac
echo "Constructed $PWD/mpirun.schema file." echo "Constructed $PWD/mpirun.schema file."
echo "" echo ""

View File

@ -40,11 +40,11 @@ if ( -r $CEI_HOME ) then
# special treatment for 32bit OpenFOAM and 64bit Ensight # special treatment for 32bit OpenFOAM and 64bit Ensight
if ($WM_ARCH == linux && `uname -m` == x86_64) then if ($WM_ARCH == linux && `uname -m` == x86_64) then
setenv CEI_ARCH linux_2.6_32 setenv CEI_ARCH linux_2.6_32
endif endif
# add to path # add to path
set path=($CEI_HOME/bin $path) setenv PATH ${CEI_HOME}/bin:${PATH}
setenv ENSIGHT9_INPUT dummy setenv ENSIGHT9_INPUT dummy
setenv ENSIGHT9_READER $FOAM_LIBBIN setenv ENSIGHT9_READER $FOAM_LIBBIN

View File

@ -35,8 +35,8 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# clean the PATH # clean the PATH
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath -space "$path" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"` set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`
if ( $status == 0 ) set path=($cleaned) if ( $status == 0 ) setenv PATH $cleaned
# determine the cmake to be used # determine the cmake to be used
unsetenv CMAKE_HOME unsetenv CMAKE_HOME
@ -44,7 +44,7 @@ foreach cmake ( cmake-2.8.1 cmake-2.8.0 cmake-2.6.4 )
set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake
if ( -r $cmake ) then if ( -r $cmake ) then
setenv CMAKE_HOME $cmake setenv CMAKE_HOME $cmake
set path=($CMAKE_HOME/bin $path) setenv PATH ${CMAKE_HOME}/bin:${PATH}
break break
endif endif
end end
@ -73,7 +73,7 @@ setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-
# set paths if binaries or source are present # set paths if binaries or source are present
if ( -r $ParaView_DIR || -r $paraviewInstDir ) then if ( -r $ParaView_DIR || -r $paraviewInstDir ) then
set path=($ParaView_DIR/bin $path) setenv PATH ${ParaView_DIR}/bin:${PATH}
setenv PV_PLUGIN_PATH $FOAM_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

View File

@ -272,4 +272,4 @@ fi
unset cleaned foamClean foamInstall foamOldDirs unset cleaned foamClean foamInstall foamOldDirs
unset _foamSource unset _foamSource
# ----------------------------------------------------------------------------- # ----------------------------------------------------------------- end-of-file

View File

@ -209,16 +209,16 @@ default:
endsw endsw
# Clean standard environment variables (path/PATH, LD_LIBRARY_PATH, MANPATH) # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH '' if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH ''
if (! $?MANPATH) setenv MANPATH '' if (! $?MANPATH) setenv MANPATH ''
#- Clean path/PATH #- Clean PATH (path)
set cleaned=`$foamClean -space "$path" "$foamOldDirs"` set cleaned=`$foamClean "$PATH" "$foamOldDirs"`
if ( $status == 0 ) set path=($cleaned) if ( $status == 0 ) setenv PATH $cleaned
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`
@ -242,9 +242,9 @@ _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
# Clean environment paths again. Only remove duplicates # Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Clean path/PATH #- Clean PATH (path)
set cleaned=`$foamClean -space "$path"` set cleaned=`$foamClean "$PATH"`
if ( $status == 0 ) set path=($cleaned) if ( $status == 0 ) setenv PATH $cleaned
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
set cleaned=`$foamClean "$LD_LIBRARY_PATH"` set cleaned=`$foamClean "$LD_LIBRARY_PATH"`
@ -265,4 +265,4 @@ endif
unset cleaned foamClean foamInstall foamOldDirs unset cleaned foamClean foamInstall foamOldDirs
unalias _foamSource unalias _foamSource
# ----------------------------------------------------------------------------- # ----------------------------------------------------------------- end-of-file

View File

@ -22,7 +22,7 @@
# along with OpenFOAM; if not, write to the Free Software Foundation, # along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Script # File
# etc/prefs.csh # etc/prefs.csh
# #
# Description # Description
@ -50,4 +50,4 @@
setenv ParaView_VERSION git # eg, cvs/git version setenv ParaView_VERSION git # eg, cvs/git version
setenv ParaView_MAJOR 3.7 setenv ParaView_MAJOR 3.7
# ----------------------------------------------------------------------------- # ----------------------------------------------------------------- end-of-file

View File

@ -22,7 +22,7 @@
# along with OpenFOAM; if not, write to the Free Software Foundation, # along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Script # File
# etc/prefs.sh # etc/prefs.sh
# #
# Description # Description
@ -49,4 +49,5 @@ export WM_MPLIB=SYSTEMOPENMPI
# ~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~
export ParaView_VERSION=git # eg, cvs/git version export ParaView_VERSION=git # eg, cvs/git version
export ParaView_MAJOR=3.7 export ParaView_MAJOR=3.7
# -----------------------------------------------------------------------------
# ----------------------------------------------------------------- end-of-file

View File

@ -32,7 +32,7 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# prefix to PATH # prefix to PATH
alias _foamAddPath 'set path=(\!* $path)' alias _foamAddPath 'setenv PATH \!*\:${PATH}'
# prefix to LD_LIBRARY_PATH # prefix to LD_LIBRARY_PATH
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}' alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
# prefix to MANPATH # prefix to MANPATH
@ -68,8 +68,9 @@ setenv FOAM_SOLVERS $FOAM_APP/solvers
setenv FOAM_RUN $WM_PROJECT_USER_DIR/run setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
# add OpenFOAM scripts and wmake to the path # add OpenFOAM scripts and wmake to the path
set path=($WM_DIR $WM_PROJECT_DIR/bin $path) setenv PATH ${WM_DIR}:${WM_PROJECT_DIR}/bin:${PATH}
<<<<<<< HEAD
_foamAddPath $FOAM_APPBIN _foamAddPath $FOAM_APPBIN
_foamAddPath $FOAM_SITE_APPBIN _foamAddPath $FOAM_SITE_APPBIN
_foamAddPath $FOAM_USER_APPBIN _foamAddPath $FOAM_USER_APPBIN
@ -78,6 +79,10 @@ _foamAddLib $FOAM_LIBBIN/dummy
_foamAddLib $FOAM_LIBBIN _foamAddLib $FOAM_LIBBIN
_foamAddLib $FOAM_SITE_LIBBIN _foamAddLib $FOAM_SITE_LIBBIN
_foamAddLib $FOAM_USER_LIBBIN _foamAddLib $FOAM_USER_LIBBIN
=======
_foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}
>>>>>>> 00e72ccabdc9912f14f889531e88f60a79c68dcb
# Select compiler installation # Select compiler installation
@ -103,9 +108,6 @@ case OpenFOAM:
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.1/lib _foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.1/lib
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-4.2.4/lib _foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-4.2.4/lib
breaksw breaksw
case Gcc42:
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.2.4
breaksw
endsw endsw
# Check that the compiler directory can be found # Check that the compiler directory can be found
@ -119,8 +121,7 @@ case OpenFOAM:
endif endif
_foamAddPath ${WM_COMPILER_DIR}/bin _foamAddPath ${WM_COMPILER_DIR}/bin
_foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH} _foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}:${WM_COMPILER_DIR}/lib
_foamAddLib ${WM_COMPILER_DIR}/lib
_foamAddMan ${WM_COMPILER_DIR}/man _foamAddMan ${WM_COMPILER_DIR}/man
breaksw breaksw
@ -130,12 +131,11 @@ endsw
# Communications library # Communications library
# ~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~
unset MPI_ARCH_PATH unsetenv MPI_ARCH_PATH MPI_HOME
switch ("$WM_MPLIB") switch ("$WM_MPLIB")
case OPENMPI: case OPENMPI:
set mpi_version=openmpi-1.4.1 set mpi_version=openmpi-1.4.1
setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version
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/$mpi_version
# Tell OpenMPI where to find its install directory # Tell OpenMPI where to find its install directory
@ -165,7 +165,7 @@ case SYSTEMOPENMPI:
echo " libmpi dir : $libDir" echo " libmpi dir : $libDir"
endif endif
_foamAddLib $libDir _foamAddLib $libDir
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version libDir unset mpi_version libDir
@ -189,9 +189,9 @@ case MPICH-GM:
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
_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_LIBBIN/mpich-gm setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-gm
breaksw breaksw
@ -233,18 +233,18 @@ case MPI:
case FJMPI: case FJMPI:
setenv MPI_ARCH_PATH /opt/FJSVmpi2 setenv MPI_ARCH_PATH /opt/FJSVmpi2
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpi setenv FOAM_MPI_LIBBIN $FOAM_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
_foamAddLib /opt/FJSVpnidt/lib _foamAddLib /opt/FJSVpnidt/lib
breaksw breaksw
case QSMPI: case QSMPI:
setenv MPI_ARCH_PATH /usr/lib/mpi setenv MPI_ARCH_PATH /usr/lib/mpi
setenv FOAM_MPI_LIBBIN FOAM_LIBBIN/qsmpi 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
@ -258,7 +258,7 @@ _foamAddLib $FOAM_MPI_LIBBIN
# 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)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set minBufferSize=20000000 if ( ! $?minBufferSize ) set minBufferSize=20000000
if ( $?MPI_BUFFER_SIZE ) then if ( $?MPI_BUFFER_SIZE ) then
if ( $MPI_BUFFER_SIZE < $minBufferSize ) then if ( $MPI_BUFFER_SIZE < $minBufferSize ) then
@ -276,8 +276,8 @@ if ( $?CGAL_LIB_DIR ) then
endif endif
# Switch on the hoard memory allocator if available # Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if ( -f $FOAM_LIBBIN/libhoard.so ) then #if ( -f $FOAM_LIBBIN/libhoard.so ) then
# setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:${LD_PRELOAD} # setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:${LD_PRELOAD}
#endif #endif
@ -285,9 +285,7 @@ endif
# cleanup environment: # cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unalias _foamAddPath unalias _foamAddPath _foamAddLib _foamAddMan
unalias _foamAddLib unset compilerInstall minBufferSize
unalias _foamAddMan
unset minBufferSize
# ----------------------------------------------------------------------------- # ----------------------------------------------------------------- end-of-file

View File

@ -94,10 +94,15 @@ export FOAM_RUN=$WM_PROJECT_USER_DIR/run
# add OpenFOAM scripts and wmake to the path # add OpenFOAM scripts and wmake to the path
export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH
<<<<<<< HEAD
_foamAddPath $FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN _foamAddPath $FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN
# Make sure to pick up dummy versions of external libraries last # Make sure to pick up dummy versions of external libraries last
_foamAddLib $FOAM_LIBBIN/dummy _foamAddLib $FOAM_LIBBIN/dummy
_foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN _foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
=======
_foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN
>>>>>>> 00e72ccabdc9912f14f889531e88f60a79c68dcb
# Compiler settings # Compiler settings
@ -132,9 +137,6 @@ OpenFOAM)
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.1/lib _foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.1/lib
_foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-4.2.4/lib _foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-4.2.4/lib
;; ;;
Gcc42)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.2.4
;;
esac esac
# Check that the compiler directory can be found # Check that the compiler directory can be found
@ -166,12 +168,11 @@ unset compilerBin compilerLib compilerMan compilerInstall
# Communications library # Communications library
# ~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~
unset MPI_ARCH_PATH unset MPI_ARCH_PATH MPI_HOME
case "$WM_MPLIB" in case "$WM_MPLIB" in
OPENMPI) OPENMPI)
mpi_version=openmpi-1.4.1 mpi_version=openmpi-1.4.1
export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version
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/$mpi_version
# Tell OpenMPI where to find its install directory # Tell OpenMPI where to find its install directory
@ -202,7 +203,7 @@ SYSTEMOPENMPI)
echo " libmpi dir : $libDir" echo " libmpi dir : $libDir"
fi fi
_foamAddLib $libDir _foamAddLib $libDir
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version libDir unset mpi_version libDir
@ -226,9 +227,9 @@ MPICH-GM)
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
_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_LIBBIN/mpich-gm export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-gm
;; ;;
@ -272,18 +273,18 @@ FJMPI)
export MPI_ARCH_PATH=/opt/FJSVmpi2 export MPI_ARCH_PATH=/opt/FJSVmpi2
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpi export FOAM_MPI_LIBBIN=$FOAM_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
_foamAddLib /opt/FJSVpnidt/lib _foamAddLib /opt/FJSVpnidt/lib
;; ;;
QSMPI) QSMPI)
export MPI_ARCH_PATH=/usr/lib/mpi export MPI_ARCH_PATH=/usr/lib/mpi
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/qsmpi export 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
;; ;;
@ -297,7 +298,7 @@ _foamAddLib $FOAM_MPI_LIBBIN
# 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)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
minBufferSize=20000000 : ${minBufferSize:=20000000}
if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ] if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
then then
@ -311,8 +312,8 @@ export MPI_BUFFER_SIZE
[ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR [ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR
# Switch on the hoard memory allocator if available # Enable the hoard memory allocator if available
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if [ -f $FOAM_LIBBIN/libhoard.so ] #if [ -f $FOAM_LIBBIN/libhoard.so ]
#then #then
# export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
@ -323,4 +324,4 @@ export MPI_BUFFER_SIZE
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unset _foamAddPath _foamAddLib _foamAddMan minBufferSize unset _foamAddPath _foamAddLib _foamAddMan minBufferSize
# ----------------------------------------------------------------------------- # ----------------------------------------------------------------- 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) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,6 +52,13 @@ inline Type operator/(const one&, const Type& t)
} }
template<class Type>
inline const Type& operator/(const Type& t, const one&)
{
return t;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam