From 5dd19019e9d51f10f50bdf12107075e79a2f3237 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 18 Mar 2010 14:50:42 +0100 Subject: [PATCH 01/20] COMP: remove newline after backslash continuation --- src/dummyThirdParty/scotchDecomp/Make/options | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dummyThirdParty/scotchDecomp/Make/options b/src/dummyThirdParty/scotchDecomp/Make/options index 775799dce9..da7a7df7b6 100644 --- a/src/dummyThirdParty/scotchDecomp/Make/options +++ b/src/dummyThirdParty/scotchDecomp/Make/options @@ -1,4 +1,4 @@ -EXE_INC = \ +EXE_INC = \ -I$(FOAM_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(FOAM_SRC)/parallel/decompose/scotchDecomp/lnInclude From cfcea134502a3d9f3a3d923d7398c8b419ee813a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 Mar 2010 11:40:05 +0100 Subject: [PATCH 02/20] BUG: missed cleanup of env variables in etc/settings --- etc/bashrc | 2 +- etc/cshrc | 2 +- etc/prefs.csh-EXAMPLE | 2 +- etc/prefs.sh-EXAMPLE | 3 ++- etc/settings.csh | 14 ++++++-------- etc/settings.sh | 4 ++-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/etc/bashrc b/etc/bashrc index d15c5324d5..c3e7c82bb3 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -272,4 +272,4 @@ fi unset cleaned foamClean foamInstall foamOldDirs unset _foamSource -# ----------------------------------------------------------------------------- +# ----------------------------------------------------------------- end-of-file diff --git a/etc/cshrc b/etc/cshrc index 7b959e8c43..bc7a586882 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -265,4 +265,4 @@ endif unset cleaned foamClean foamInstall foamOldDirs unalias _foamSource -# ----------------------------------------------------------------------------- +# ----------------------------------------------------------------- end-of-file diff --git a/etc/prefs.csh-EXAMPLE b/etc/prefs.csh-EXAMPLE index 775747ea66..5484ee451b 100644 --- a/etc/prefs.csh-EXAMPLE +++ b/etc/prefs.csh-EXAMPLE @@ -50,4 +50,4 @@ setenv ParaView_VERSION git # eg, cvs/git version setenv ParaView_MAJOR 3.7 -# ----------------------------------------------------------------------------- +# ----------------------------------------------------------------- end-of-file diff --git a/etc/prefs.sh-EXAMPLE b/etc/prefs.sh-EXAMPLE index 5878e82dbc..0a0b25daae 100644 --- a/etc/prefs.sh-EXAMPLE +++ b/etc/prefs.sh-EXAMPLE @@ -49,4 +49,5 @@ export WM_MPLIB=SYSTEMOPENMPI # ~~~~~~~~~~~~~~~~~~~~~~~~ export ParaView_VERSION=git # eg, cvs/git version export ParaView_MAJOR=3.7 -# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------- end-of-file diff --git a/etc/settings.csh b/etc/settings.csh index 7a0d1f40c8..7364fc8a50 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -117,8 +117,8 @@ case OpenFOAM: endif _foamAddPath ${WM_COMPILER_DIR}/bin - _foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH} _foamAddLib ${WM_COMPILER_DIR}/lib + _foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH} _foamAddMan ${WM_COMPILER_DIR}/man breaksw @@ -128,7 +128,7 @@ endsw # Communications library # ~~~~~~~~~~~~~~~~~~~~~~ -unset MPI_ARCH_PATH +unsetenv MPI_ARCH_PATH switch ("$WM_MPLIB") case OPENMPI: @@ -256,7 +256,7 @@ _foamAddLib $FOAM_MPI_LIBBIN # 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 < $minBufferSize ) then @@ -283,9 +283,7 @@ endif # cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ -unalias _foamAddPath -unalias _foamAddLib -unalias _foamAddMan -unset minBufferSize +unalias _foamAddPath _foamAddLib _foamAddMan +unset compilerInstall minBufferSize -# ----------------------------------------------------------------------------- +# ----------------------------------------------------------------- end-of-file diff --git a/etc/settings.sh b/etc/settings.sh index ca3ab25c2c..247b3a54ff 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -295,7 +295,7 @@ _foamAddLib $FOAM_MPI_LIBBIN # Set the minimum MPI buffer size (used by all platforms except SGI MPI) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -minBufferSize=20000000 +: ${minBufferSize:=20000000} if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ] then @@ -321,4 +321,4 @@ export MPI_BUFFER_SIZE # ~~~~~~~~~~~~~~~~~~~~ unset _foamAddPath _foamAddLib _foamAddMan minBufferSize -# ----------------------------------------------------------------------------- +# ----------------------------------------------------------------- end-of-file From 3ee8595169b867fa15639d41b49868c1d8eccb5b Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 Mar 2010 13:06:49 +0100 Subject: [PATCH 03/20] ENH: add -m option to foamEtcFile to allow chaining. For example, within the user ~/.OpenFOAM//prefs.sh: foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile -m go prefs.sh` \ && _foamSource $foamPrefs could be used to write a personal adjustment that also includes the site-wide prefs. --- bin/foamEtcFile | 85 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 20 deletions(-) diff --git a/bin/foamEtcFile b/bin/foamEtcFile index 851ef739b4..e544bf8139 100755 --- a/bin/foamEtcFile +++ b/bin/foamEtcFile @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -27,8 +27,17 @@ # foamEtcFile # # Description -# Locate user/site/shipped file with the semantics used in the -# ~OpenFOAM/fileName expansion +# Locate user/group/shipped file with semantics similar to the +# ~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//prefs.sh: +# @verbatim +# foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile -m go prefs.sh` \ +# && _foamSource $foamPrefs +# @endverbatim # #------------------------------------------------------------------------------- unset listOpt quietOpt @@ -41,24 +50,32 @@ usage() { cat< 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 - ~OpenFOAM/fileName expansion + Locate user/group/shipped file with semantics similar to the + ~OpenFOAM/fileName expansion. - Exit status 0 when the file is found and output resolved path to stdout. - Exit status 1 for miscellaneous errors. - Exit status 2 when the file is not found. + The options can also be specified as a single character + (eg, '-q' instead of '-quiet'), but must not be grouped. + + 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 exit 1 } +# default mode is 'ugo' +mode=ugo + # parse options while [ "$#" -gt 0 ] do @@ -70,6 +87,20 @@ do listOpt=true 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) quietOpt=true shift @@ -83,18 +114,32 @@ do esac done - # Save the essential bits of information: nArgs=$# fileName="$1" -# The various places to be searched: -set -- \ - $HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION \ - $HOME/.${WM_PROJECT:-OpenFOAM} \ - $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION \ - $WM_PROJECT_INST_DIR/site \ - $WM_PROJECT_DIR/etc +# Define the various places to be searched: +set -- $( + case "$mode" in + *u*) # user + echo $HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION + echo $HOME/.${WM_PROJECT:-OpenFOAM} + ;; + 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 +) # From db34c43ab04931a1f0d8285bf3634df56f3438a2 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 Mar 2010 16:49:41 +0100 Subject: [PATCH 04/20] STYLE: use 'setenv PATH' instead of 'set path=' for c-shell scripts - the path is accesible either way, but use setenv for consistency with other environment variables. It also simplifies foamCleanPath again. --- bin/foamCleanPath | 21 ++++----------------- etc/apps/ensight/cshrc | 4 ++-- etc/apps/paraview3/cshrc | 8 ++++---- etc/cshrc | 14 +++++++------- etc/prefs.csh-EXAMPLE | 2 +- etc/prefs.sh-EXAMPLE | 2 +- etc/settings.csh | 39 +++++++++++++++++---------------------- etc/settings.sh | 28 ++++++++++++++-------------- 8 files changed, 50 insertions(+), 68 deletions(-) diff --git a/bin/foamCleanPath b/bin/foamCleanPath index 0ef171e455..8f98b06423 100755 --- a/bin/foamCleanPath +++ b/bin/foamCleanPath @@ -43,7 +43,6 @@ usage() { cat <&2 Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN] options: - -space treat 'path' as space-delimited (eg, from C-Shell) -strip remove inaccessible directories -help print the usage @@ -57,7 +56,7 @@ USAGE } -unset space strip +unset strip # parse options while [ "$#" -gt 0 ] do @@ -65,10 +64,6 @@ do -h | -help) usage ;; - -space) - space=true - shift - ;; -strip) strip=true shift @@ -82,12 +77,7 @@ done [ "$#" -ge 1 ] || usage -if [ "$space" = true ] -then - dirList=$(echo "$1" | sed -e 's/ /:/g') -else - dirList="$1" -fi +dirList="$1" shift ##DEBUG echo "input>$dirList<" 1>&2 @@ -140,11 +130,8 @@ done IFS=' ' set -- $dirList -# join on ':', unless -space option was specified -if [ "$space" != true ] -then - IFS=':' -fi +# rejoin on ':' +IFS=':' dirList="$*" # restore IFS diff --git a/etc/apps/ensight/cshrc b/etc/apps/ensight/cshrc index 7367af5083..36f4dac076 100644 --- a/etc/apps/ensight/cshrc +++ b/etc/apps/ensight/cshrc @@ -40,11 +40,11 @@ if ( -r $CEI_HOME ) then # special treatment for 32bit OpenFOAM and 64bit Ensight if ($WM_ARCH == linux && `uname -m` == x86_64) then - setenv CEI_ARCH linux_2.6_32 + setenv CEI_ARCH linux_2.6_32 endif # add to path - set path=($CEI_HOME/bin $path) + setenv PATH ${CEI_HOME}/bin:${PATH} setenv ENSIGHT9_INPUT dummy setenv ENSIGHT9_READER $FOAM_LIBBIN diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index 4b7f470028..61b446007d 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -35,8 +35,8 @@ #------------------------------------------------------------------------------ # 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-"` -if ( $status == 0 ) set path=($cleaned) +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 ) setenv PATH $cleaned # determine the cmake to be used 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 if ( -r $cmake ) then setenv CMAKE_HOME $cmake - set path=($CMAKE_HOME/bin $path) + setenv PATH ${CMAKE_HOME}/bin:${PATH} break endif 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 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} # add in python libraries if required diff --git a/etc/cshrc b/etc/cshrc index bc7a586882..1039445f24 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -209,16 +209,16 @@ default: 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 if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH '' if (! $?MANPATH) setenv MANPATH '' -#- Clean path/PATH -set cleaned=`$foamClean -space "$path" "$foamOldDirs"` -if ( $status == 0 ) set path=($cleaned) +#- Clean PATH (path) +set cleaned=`$foamClean "$PATH" "$foamOldDirs"` +if ( $status == 0 ) setenv PATH $cleaned #- Clean LD_LIBRARY_PATH 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 path/PATH -set cleaned=`$foamClean -space "$path"` -if ( $status == 0 ) set path=($cleaned) +#- Clean PATH (path) +set cleaned=`$foamClean "$PATH"` +if ( $status == 0 ) setenv PATH $cleaned #- Clean LD_LIBRARY_PATH set cleaned=`$foamClean "$LD_LIBRARY_PATH"` diff --git a/etc/prefs.csh-EXAMPLE b/etc/prefs.csh-EXAMPLE index 5484ee451b..66d4d5ae45 100644 --- a/etc/prefs.csh-EXAMPLE +++ b/etc/prefs.csh-EXAMPLE @@ -22,7 +22,7 @@ # along with OpenFOAM; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# Script +# File # etc/prefs.csh # # Description diff --git a/etc/prefs.sh-EXAMPLE b/etc/prefs.sh-EXAMPLE index 0a0b25daae..39a18660ce 100644 --- a/etc/prefs.sh-EXAMPLE +++ b/etc/prefs.sh-EXAMPLE @@ -22,7 +22,7 @@ # along with OpenFOAM; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -# Script +# File # etc/prefs.sh # # Description diff --git a/etc/settings.csh b/etc/settings.csh index 7364fc8a50..058e7860ee 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -32,7 +32,7 @@ #------------------------------------------------------------------------------ # prefix to PATH -alias _foamAddPath 'set path=(\!* $path)' +alias _foamAddPath 'setenv PATH \!*\:${PATH}' # prefix to LD_LIBRARY_PATH alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}' # prefix to MANPATH @@ -68,14 +68,10 @@ setenv FOAM_SOLVERS $FOAM_APP/solvers setenv FOAM_RUN $WM_PROJECT_USER_DIR/run # 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} -_foamAddPath $FOAM_APPBIN -_foamAddPath $FOAM_SITE_APPBIN -_foamAddPath $FOAM_USER_APPBIN -_foamAddLib $FOAM_LIBBIN -_foamAddLib $FOAM_SITE_LIBBIN -_foamAddLib $FOAM_USER_LIBBIN +_foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN} +_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN} # Select compiler installation @@ -117,8 +113,7 @@ case OpenFOAM: endif _foamAddPath ${WM_COMPILER_DIR}/bin - _foamAddLib ${WM_COMPILER_DIR}/lib - _foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH} + _foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}:${WM_COMPILER_DIR}/lib _foamAddMan ${WM_COMPILER_DIR}/man breaksw @@ -163,7 +158,7 @@ case SYSTEMOPENMPI: echo " libmpi dir : $libDir" endif - _foamAddLib $libDir + _foamAddLib $libDir setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version unset mpi_version libDir @@ -187,9 +182,9 @@ case MPICH-GM: setenv MPICH_PATH $MPI_ARCH_PATH setenv GM_LIB_PATH /opt/gm/lib64 - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib - _foamAddLib $GM_LIB_PATH + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib + _foamAddLib $GM_LIB_PATH setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-gm breaksw @@ -231,18 +226,18 @@ case MPI: case FJMPI: setenv MPI_ARCH_PATH /opt/FJSVmpi2 setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpi - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib/sparcv9 - _foamAddLib /opt/FSUNf90/lib/sparcv9 - _foamAddLib /opt/FJSVpnidt/lib + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib/sparcv9 + _foamAddLib /opt/FSUNf90/lib/sparcv9 + _foamAddLib /opt/FJSVpnidt/lib breaksw case QSMPI: setenv MPI_ARCH_PATH /usr/lib/mpi setenv FOAM_MPI_LIBBIN FOAM_LIBBIN/qsmpi - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib breaksw @@ -274,8 +269,8 @@ if ( $?CGAL_LIB_DIR ) then endif -# Switch on the hoard memory allocator if available -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Enable the hoard memory allocator if available +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #if ( -f $FOAM_LIBBIN/libhoard.so ) then # setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:${LD_PRELOAD} #endif diff --git a/etc/settings.sh b/etc/settings.sh index 247b3a54ff..085744fead 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -94,8 +94,8 @@ export FOAM_RUN=$WM_PROJECT_USER_DIR/run # add OpenFOAM scripts and wmake to the path export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH -_foamAddPath $FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN -_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 # Compiler settings @@ -200,7 +200,7 @@ SYSTEMOPENMPI) echo " libmpi dir : $libDir" fi - _foamAddLib $libDir + _foamAddLib $libDir export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version unset mpi_version libDir @@ -224,9 +224,9 @@ MPICH-GM) export MPICH_PATH=$MPI_ARCH_PATH export GM_LIB_PATH=/opt/gm/lib64 - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib - _foamAddLib $GM_LIB_PATH + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib + _foamAddLib $GM_LIB_PATH export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-gm ;; @@ -270,18 +270,18 @@ FJMPI) export MPI_ARCH_PATH=/opt/FJSVmpi2 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpi - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib/sparcv9 - _foamAddLib /opt/FSUNf90/lib/sparcv9 - _foamAddLib /opt/FJSVpnidt/lib + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib/sparcv9 + _foamAddLib /opt/FSUNf90/lib/sparcv9 + _foamAddLib /opt/FJSVpnidt/lib ;; QSMPI) export MPI_ARCH_PATH=/usr/lib/mpi export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/qsmpi - _foamAddPath $MPI_ARCH_PATH/bin - _foamAddLib $MPI_ARCH_PATH/lib + _foamAddPath $MPI_ARCH_PATH/bin + _foamAddLib $MPI_ARCH_PATH/lib ;; @@ -309,8 +309,8 @@ export MPI_BUFFER_SIZE [ -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 ] #then # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD From b3fd9c599f9b008db81dd1078bc21393cbd65ff6 Mon Sep 17 00:00:00 2001 From: henry Date: Fri, 19 Mar 2010 17:52:15 +0000 Subject: [PATCH 05/20] Removed unnecessary files. --- .../mixerVessel2D/system/cellSetDict | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/cellSetDict diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/cellSetDict b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/cellSetDict deleted file mode 100644 index ae58e6ff70..0000000000 --- a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/cellSetDict +++ /dev/null @@ -1,25 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object cellSetDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -name rotor; - -action new; - -topoSetSources ( zoneToCell { name rotor ; } ); - - -// ************************************************************************* // From 4f926a376fb0a0885c27360abb228828b0d27a47 Mon Sep 17 00:00:00 2001 From: henry Date: Fri, 19 Mar 2010 17:54:35 +0000 Subject: [PATCH 06/20] New solver: rhoPorousMRFPimpleFoam Added compressibility support to MRFZone. Required generalisation of the oneField concept. Also clean-up the use of one and zero for consistency. Simple mixerVessel2D tutorial case supplied. --- .../rhoPorousMRFPimpleFoam/Make/files | 4 + .../rhoPorousMRFPimpleFoam/Make/options | 15 + .../rhoPorousMRFPimpleFoam/UEqn.H | 39 + .../rhoPorousMRFPimpleFoam/createFields.H | 70 ++ .../rhoPorousMRFPimpleFoam/pEqn.H | 123 +++ .../rhoPorousMRFPimpleFoam.C | 105 +++ .../compressibleInterDyMFoam/alphaEqns.H | 12 +- .../compressibleInterFoam/alphaEqns.H | 2 +- .../multiphase/interMixingFoam/alphaEqns.H | 12 +- .../interPhaseChangeFoam/alphaEqn.H | 4 +- .../FieldFields/oneFieldField/oneFieldField.H | 84 ++ .../oneFieldField/oneFieldFieldI.H | 37 + .../zeroFieldField/zeroFieldField.H | 84 ++ .../zeroFieldField/zeroFieldFieldI.H | 37 + .../fields/Fields/oneField/oneField.H | 7 +- .../fields/Fields/oneField/oneFieldI.H | 12 +- .../fields/Fields/zeroField/zeroField.H | 8 +- .../fields/Fields/zeroField/zeroFieldI.H | 10 - .../geometricOneField/geometricOneField.H | 91 ++ .../geometricOneField/geometricOneFieldI.H | 52 ++ .../geometricZeroField/geometricZeroField.H | 91 ++ .../geometricZeroField/geometricZeroFieldI.H | 52 ++ .../cfdTools/general/MRF/MRFZone.C | 91 +- .../cfdTools/general/MRF/MRFZone.H | 38 +- .../cfdTools/general/MRF/MRFZoneTemplates.C | 130 +++ .../cfdTools/general/MRF/MRFZones.C | 28 +- .../cfdTools/general/MRF/MRFZones.H | 16 +- .../general/porousMedia/PorousZones.C | 2 +- .../general/porousMedia/PorousZones.H | 4 +- .../cfdTools/general/porousMedia/porousZone.C | 10 +- src/finiteVolume/finiteVolume/fvm/fvmDdt.C | 2 +- src/finiteVolume/finiteVolume/fvm/fvmDdt.H | 4 +- .../finiteVolume/fvm/fvmLaplacian.C | 8 +- .../finiteVolume/fvm/fvmLaplacian.H | 11 +- src/finiteVolume/finiteVolume/fvm/fvmSup.C | 6 +- src/finiteVolume/finiteVolume/fvm/fvmSup.H | 7 +- .../fvMatrices/fvMatrix/fvMatrix.C | 8 +- .../fvMatrices/fvMatrix/fvMatrix.H | 10 +- .../fvMatrices/solvers/MULES/MULES.C | 11 +- .../fvMatrices/solvers/MULES/MULES.H | 6 +- .../fvMatrices/solvers/MULES/MULESTemplates.C | 16 +- .../rhoPorousMRFPimpleFoam/mixerVessel2D/0/T | 44 + .../rhoPorousMRFPimpleFoam/mixerVessel2D/0/U | 46 + .../mixerVessel2D/0/alphat | 47 + .../mixerVessel2D/0/epsilon | 48 + .../rhoPorousMRFPimpleFoam/mixerVessel2D/0/k | 48 + .../mixerVessel2D/0/mut | 48 + .../rhoPorousMRFPimpleFoam/mixerVessel2D/0/p | 44 + .../mixerVessel2D/Allrun | 9 + .../mixerVessel2D/constant/MRFZones | 31 + .../mixerVessel2D/constant/RASProperties | 25 + .../mixerVessel2D/constant/dynamicMeshDict | 42 + .../constant/polyMesh/blockMeshDict | 834 ++++++++++++++++++ .../constant/polyMesh/blockMeshDict.m4 | 834 ++++++++++++++++++ .../mixerVessel2D/constant/polyMesh/boundary | 46 + .../mixerVessel2D/constant/porousZones | 36 + .../constant/thermophysicalProperties | 23 + .../constant/transportProperties | 39 + .../constant/turbulenceProperties | 21 + .../mixerVessel2D/makeMesh | 5 + .../mixerVessel2D/system/controlDict | 52 ++ .../mixerVessel2D/system/faceSetDict | 25 + .../system/faceSetDict_noBoundaryFaces | 25 + .../system/faceSetDict_rotorFaces | 25 + .../mixerVessel2D/system/fvSchemes | 67 ++ .../mixerVessel2D/system/fvSolution | 121 +++ 66 files changed, 3777 insertions(+), 167 deletions(-) create mode 100644 applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/files create mode 100644 applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/options create mode 100644 applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H create mode 100644 applications/solvers/compressible/rhoPorousMRFPimpleFoam/createFields.H create mode 100644 applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H create mode 100644 applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C create mode 100644 src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H create mode 100644 src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H create mode 100644 src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldField.H create mode 100644 src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldFieldI.H create mode 100644 src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H create mode 100644 src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H create mode 100644 src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H create mode 100644 src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H create mode 100644 src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/T create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/U create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/alphat create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/epsilon create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/k create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/mut create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/p create mode 100755 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/Allrun create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/RASProperties create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/dynamicMeshDict create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porousZones create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/thermophysicalProperties create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/transportProperties create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/turbulenceProperties create mode 100755 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/controlDict create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict_noBoundaryFaces create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict_rotorFaces create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes create mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/files b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/files new file mode 100644 index 0000000000..a798455eb7 --- /dev/null +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/files @@ -0,0 +1,4 @@ +rhoPorousMRFPimpleFoam.C + +EXE = $(FOAM_APPBIN)/rhoPorousMRFPimpleFoam + diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/options b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/options new file mode 100644 index 0000000000..61c1b6fe46 --- /dev/null +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/Make/options @@ -0,0 +1,15 @@ +EXE_INC = \ + -I../rhoPimpleFoam \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/finiteVolume/cfdTools \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lbasicThermophysicalModels \ + -lspecie \ + -lcompressibleRASModels \ + -lcompressibleLESModels \ + -lfiniteVolume \ + -lmeshTools diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H new file mode 100644 index 0000000000..3b4ead17e7 --- /dev/null +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/UEqn.H @@ -0,0 +1,39 @@ +// Solve the Momentum equation + +tmp UEqn +( + pZones.ddt(rho, U) + + fvm::div(phi, U) + + turbulence->divDevRhoReff(U) +); + +if (oCorr == nOuterCorr-1) +{ + UEqn().relax(1); +} +else +{ + UEqn().relax(); +} + +mrfZones.addCoriolis(rho, UEqn()); +pZones.addResistance(UEqn()); + +volScalarField rUA = 1.0/UEqn().A(); + +if (momentumPredictor) +{ + if (oCorr == nOuterCorr-1) + { + solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal")); + } + else + { + solve(UEqn() == -fvc::grad(p)); + } +} +else +{ + U = rUA*(UEqn().H() - fvc::grad(p)); + U.correctBoundaryConditions(); +} diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/createFields.H new file mode 100644 index 0000000000..b9a86ef995 --- /dev/null +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/createFields.H @@ -0,0 +1,70 @@ + Info<< "Reading thermophysical properties\n" << endl; + + autoPtr pThermo + ( + basicPsiThermo::New(mesh) + ); + basicPsiThermo& thermo = pThermo(); + + volScalarField& p = thermo.p(); + volScalarField& h = thermo.h(); + const volScalarField& psi = thermo.psi(); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + thermo.rho() + ); + + Info<< "Reading field U\n" << endl; + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + #include "compressibleCreatePhi.H" + + dimensionedScalar pMin + ( + mesh.solutionDict().subDict("PIMPLE").lookup("pMin") + ); + + Info<< "Creating turbulence model\n" << endl; + autoPtr turbulence + ( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) + ); + + //dimensionedScalar initialMass = fvc::domainIntegrate(rho); + + + Info<< "Creating field DpDt\n" << endl; + volScalarField DpDt = + fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); + + MRFZones mrfZones(mesh); + mrfZones.correctBoundaryVelocity(U); + + porousZones pZones(mesh); + Switch pressureImplicitPorosity(false); diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H new file mode 100644 index 0000000000..c74fb4d84b --- /dev/null +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/pEqn.H @@ -0,0 +1,123 @@ +rho = thermo.rho(); + +volScalarField rUA = 1.0/UEqn().A(); +U = rUA*UEqn().H(); + +if (nCorr <= 1) +{ + UEqn.clear(); +} + +if (transonic) +{ + surfaceScalarField phid + ( + "phid", + fvc::interpolate(psi) + *( + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, rho, U, phi) + ) + ); + mrfZones.relativeFlux(fvc::interpolate(psi), phid); + + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvm::div(phid, p) + - fvm::laplacian(rho*rUA, p) + ); + + if + ( + oCorr == nOuterCorr-1 + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + { + pEqn.solve(mesh.solver("pFinal")); + } + else + { + pEqn.solve(); + } + + if (nonOrth == nNonOrthCorr) + { + phi == pEqn.flux(); + } + } +} +else +{ + phi = + fvc::interpolate(rho)* + ( + (fvc::interpolate(U) & mesh.Sf()) + //+ fvc::ddtPhiCorr(rUA, rho, U, phi) + ); + mrfZones.relativeFlux(fvc::interpolate(rho), phi); + + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + // Pressure corrector + fvScalarMatrix pEqn + ( + fvm::ddt(psi, p) + + fvc::div(phi) + - fvm::laplacian(rho*rUA, p) + ); + + if + ( + oCorr == nOuterCorr-1 + && corr == nCorr-1 + && nonOrth == nNonOrthCorr + ) + { + pEqn.solve(mesh.solver("pFinal")); + } + else + { + pEqn.solve(); + } + + if (nonOrth == nNonOrthCorr) + { + phi += pEqn.flux(); + } + } +} + +#include "rhoEqn.H" +#include "compressibleContinuityErrs.H" + +//if (oCorr != nOuterCorr-1) +{ + // Explicitly relax pressure for momentum corrector + p.relax(); + + rho = thermo.rho(); + rho.relax(); + Info<< "rho max/min : " << max(rho).value() + << " " << min(rho).value() << endl; +} + +U -= rUA*fvc::grad(p); +U.correctBoundaryConditions(); + +DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); + +bound(p, pMin); + +// For closed-volume cases adjust the pressure and density levels +// to obey overall mass continuity +/* +if (closedVolume) +{ + p += (initialMass - fvc::domainIntegrate(psi*p)) + /fvc::domainIntegrate(psi); +} +*/ diff --git a/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C new file mode 100644 index 0000000000..45d7646d04 --- /dev/null +++ b/applications/solvers/compressible/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + rhoPorousMRFPimpleFoam + +Description + Transient solver for laminar or turbulent flow of compressible fluids + with support for porous media and MRF for HVAC and similar applications. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient simulations. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "basicPsiThermo.H" +#include "turbulenceModel.H" +#include "bound.H" +#include "MRFZones.H" +#include "porousZones.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "createFields.H" + #include "initContinuityErrs.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readTimeControls.H" + #include "readPIMPLEControls.H" + #include "compressibleCourantNo.H" + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + if (nOuterCorr != 1) + { + p.storePrevIter(); + rho.storePrevIter(); + } + + #include "rhoEqn.H" + + // --- Pressure-velocity PIMPLE corrector loop + for (int oCorr=0; oCorrcorrect(); + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqns.H b/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqns.H index 819cd0f538..f545262767 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqns.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/alphaEqns.H @@ -59,7 +59,17 @@ alpharScheme ); - MULES::explicitSolve(oneField(), alpha1, phi, phiAlpha1, Sp, Su, 1, 0); + MULES::explicitSolve + ( + geometricOneField(), + alpha1, + phi, + phiAlpha1, + Sp, + Su, + 1, + 0 + ); surfaceScalarField rho1f = fvc::interpolate(rho1); surfaceScalarField rho2f = fvc::interpolate(rho2); diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaEqns.H b/applications/solvers/multiphase/compressibleInterFoam/alphaEqns.H index 819cd0f538..dd704c0693 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqns.H +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaEqns.H @@ -59,7 +59,7 @@ alpharScheme ); - MULES::explicitSolve(oneField(), alpha1, phi, phiAlpha1, Sp, Su, 1, 0); + MULES::explicitSolve(geometricOneField(), alpha1, phi, phiAlpha1, Sp, Su, 1, 0); surfaceScalarField rho1f = fvc::interpolate(rho1); surfaceScalarField rho2f = fvc::interpolate(rho2); diff --git a/applications/solvers/multiphase/interMixingFoam/alphaEqns.H b/applications/solvers/multiphase/interMixingFoam/alphaEqns.H index f9bad0a705..972d1d7121 100644 --- a/applications/solvers/multiphase/interMixingFoam/alphaEqns.H +++ b/applications/solvers/multiphase/interMixingFoam/alphaEqns.H @@ -70,12 +70,12 @@ MULES::limiter ( allLambda, - oneField(), + geometricOneField(), alpha1, phiAlpha1BD, phiAlpha1, - zeroField(), - zeroField(), + zero(), + zero(), 1, 0, 3 @@ -107,12 +107,12 @@ MULES::limiter ( allLambda, - oneField(), + geometricOneField(), alpha2, phiAlpha2BD, phiAlpha2, - zeroField(), - zeroField(), + zero(), + zero(), 1, 0, 3 diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H index 15a5291ee6..a232056b8d 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H @@ -51,8 +51,8 @@ ); //MULES::explicitSolve(alpha1, phi, phiAlpha, 1, 0); - //MULES::explicitSolve(oneField(), alpha1, phi, phiAlpha, Sp, Su, 1, 0); - MULES::implicitSolve(oneField(), alpha1, phi, phiAlpha, Sp, Su, 1, 0); + //MULES::explicitSolve(geometricOneField(), alpha1, phi, phiAlpha, Sp, Su, 1, 0); + MULES::implicitSolve(geometricOneField(), alpha1, phi, phiAlpha, Sp, Su, 1, 0); rhoPhi += (runTime.deltaT()/totalDeltaT) diff --git a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H new file mode 100644 index 0000000000..3f9e2865a7 --- /dev/null +++ b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::oneFieldField + +Description + A class representing the concept of a field of oneFields used to + avoid unnecessary manipulations for objects which are known to be one at + compile-time. + + Used for example as the density argument to a function written for + compressible to be used for incompressible flow. + +\*---------------------------------------------------------------------------*/ + +#ifndef oneFieldField_H +#define oneFieldField_H + +#include "oneField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class oneField Declaration +\*---------------------------------------------------------------------------*/ + +class oneFieldField +: + public one +{ + +public: + + // Constructors + + //- Construct null + oneFieldField() + {} + + + // Member Operators + + inline oneField operator[](const label) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +# include "oneFieldFieldI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H new file mode 100644 index 0000000000..1fe0c66c4c --- /dev/null +++ b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "oneFieldField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline Foam::oneField Foam::oneFieldField::operator[](const label) const +{ + return oneField(); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldField.H b/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldField.H new file mode 100644 index 0000000000..c551d39bc2 --- /dev/null +++ b/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldField.H @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::zeroFieldField + +Description + A class representing the concept of a field of zeroFields used to + avoid unnecessary manipulations for objects which are known to be zero at + compile-time. + + Used for example as the density argument to a function written for + compressible to be used for incompressible flow. + +\*---------------------------------------------------------------------------*/ + +#ifndef zeroFieldField_H +#define zeroFieldField_H + +#include "zeroField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class zeroField Declaration +\*---------------------------------------------------------------------------*/ + +class zeroFieldField +: + public zero +{ + +public: + + // Constructors + + //- Construct null + zeroFieldField() + {} + + + // Member Operators + + inline zeroField operator[](const label) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +# include "zeroFieldFieldI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldFieldI.H b/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldFieldI.H new file mode 100644 index 0000000000..2eecfae7ad --- /dev/null +++ b/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldFieldI.H @@ -0,0 +1,37 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "zeroFieldField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline Foam::zeroField Foam::zeroFieldField::operator[](const label) const +{ + return zeroField(); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/Fields/oneField/oneField.H b/src/OpenFOAM/fields/Fields/oneField/oneField.H index 8a21131b26..c4869e5a16 100644 --- a/src/OpenFOAM/fields/Fields/oneField/oneField.H +++ b/src/OpenFOAM/fields/Fields/oneField/oneField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,6 +53,7 @@ class oneField : public one { + public: // Constructors @@ -65,10 +66,6 @@ public: // Member Operators inline scalar operator[](const label) const; - - inline oneField field() const; - - inline oneField oldTime() const; }; diff --git a/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H b/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H index 7809caa045..1c0526f370 100644 --- a/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H +++ b/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,15 +33,5 @@ inline Foam::scalar Foam::oneField::operator[](const label) const return scalar(1); } -inline Foam::oneField Foam::oneField::field() const -{ - return oneField(); -} - -inline Foam::oneField Foam::oneField::oldTime() const -{ - return oneField(); -} - // ************************************************************************* // diff --git a/src/OpenFOAM/fields/Fields/zeroField/zeroField.H b/src/OpenFOAM/fields/Fields/zeroField/zeroField.H index 97f090623c..0281c154b6 100644 --- a/src/OpenFOAM/fields/Fields/zeroField/zeroField.H +++ b/src/OpenFOAM/fields/Fields/zeroField/zeroField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,10 +65,6 @@ public: // Member Operators inline scalar operator[](const label) const; - - inline zeroField field() const; - - inline zeroField oldTime() const; }; @@ -78,7 +74,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -# include "zeroFieldI.H" +#include "zeroFieldI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/Fields/zeroField/zeroFieldI.H b/src/OpenFOAM/fields/Fields/zeroField/zeroFieldI.H index 67d1dd0e9e..38072ac2e2 100644 --- a/src/OpenFOAM/fields/Fields/zeroField/zeroFieldI.H +++ b/src/OpenFOAM/fields/Fields/zeroField/zeroFieldI.H @@ -33,14 +33,4 @@ inline Foam::scalar Foam::zeroField::operator[](const label) const return scalar(0); } -inline Foam::zeroField Foam::zeroField::field() const -{ - return zeroField(); -} - -inline Foam::zeroField Foam::zeroField::oldTime() const -{ - return zeroField(); -} - // ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H new file mode 100644 index 0000000000..51aa859b10 --- /dev/null +++ b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneField.H @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::GeometricField + +Description + A class representing the concept of a GeometricField of 1 used to avoid + unnecessary manipulations for objects which are known to be one at + compile-time. + + Used for example as the density argument to a function written for + compressible to be used for incompressible flow. + +\*---------------------------------------------------------------------------*/ + +#ifndef geometricOneField_H +#define geometricOneField_H + +#include "oneFieldField.H" +#include "scalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class geometricOneField Declaration +\*---------------------------------------------------------------------------*/ + +class geometricOneField +: + public one +{ + +public: + + // Constructors + + //- Construct null + geometricOneField() + {} + + + // Member Operators + + inline scalar operator[](const label) const; + + inline oneField field() const; + + inline oneField oldTime() const; + + inline oneFieldField boundaryField() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +# include "geometricOneFieldI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H new file mode 100644 index 0000000000..cd9a79e2c9 --- /dev/null +++ b/src/OpenFOAM/fields/GeometricFields/geometricOneField/geometricOneFieldI.H @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "geometricOneField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline Foam::scalar Foam::geometricOneField::operator[](const label) const +{ + return scalar(1); +} + +inline Foam::oneField Foam::geometricOneField::field() const +{ + return oneField(); +} + +inline Foam::oneField Foam::geometricOneField::oldTime() const +{ + return oneField(); +} + +inline Foam::oneFieldField Foam::geometricOneField::boundaryField() const +{ + return oneFieldField(); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H new file mode 100644 index 0000000000..1168d936ee --- /dev/null +++ b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroField.H @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::GeometricField + +Description + A class representing the concept of a GeometricField of 1 used to avoid + unnecessary manipulations for objects which are known to be zero at + compile-time. + + Used for example as the density argument to a function written for + compressible to be used for incompressible flow. + +\*---------------------------------------------------------------------------*/ + +#ifndef geometricZeroField_H +#define geometricZeroField_H + +#include "zeroFieldField.H" +#include "scalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class geometricZeroField Declaration +\*---------------------------------------------------------------------------*/ + +class geometricZeroField +: + public zero +{ + +public: + + // Constructors + + //- Construct null + geometricZeroField() + {} + + + // Member Operators + + inline scalar operator[](const label) const; + + inline zeroField field() const; + + inline zeroField oldTime() const; + + inline zeroFieldField boundaryField() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +# include "geometricZeroFieldI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H new file mode 100644 index 0000000000..027145167e --- /dev/null +++ b/src/OpenFOAM/fields/GeometricFields/geometricZeroField/geometricZeroFieldI.H @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "geometricZeroField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline Foam::scalar Foam::geometricZeroField::operator[](const label) const +{ + return scalar(0); +} + +inline Foam::zeroField Foam::geometricZeroField::field() const +{ + return zeroField(); +} + +inline Foam::zeroField Foam::geometricZeroField::oldTime() const +{ + return zeroField(); +} + +inline Foam::zeroFieldField Foam::geometricZeroField::boundaryField() const +{ + return zeroFieldField(); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index 3618d87ef5..3ed30360dc 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,7 @@ License #include "fvMatrices.H" #include "syncTools.H" #include "faceSet.H" +#include "geometricOneField.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -377,85 +378,33 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const void Foam::MRFZone::relativeFlux(surfaceScalarField& phi) const { - const surfaceVectorField& Cf = mesh_.Cf(); - const surfaceVectorField& Sf = mesh_.Sf(); + relativeRhoFlux(geometricOneField(), phi); +} - const vector& origin = origin_.value(); - const vector& Omega = Omega_.value(); - // Internal faces - forAll(internalFaces_, i) - { - label facei = internalFaces_[i]; - phi[facei] -= (Omega ^ (Cf[facei] - origin)) & Sf[facei]; - } - - // Included patches - forAll(includedFaces_, patchi) - { - forAll(includedFaces_[patchi], i) - { - label patchFacei = includedFaces_[patchi][i]; - - phi.boundaryField()[patchi][patchFacei] = 0.0; - } - } - - // Excluded patches - forAll(excludedFaces_, patchi) - { - forAll(excludedFaces_[patchi], i) - { - label patchFacei = excludedFaces_[patchi][i]; - - phi.boundaryField()[patchi][patchFacei] -= - (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) - & Sf.boundaryField()[patchi][patchFacei]; - } - } +void Foam::MRFZone::relativeFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + relativeRhoFlux(rho, phi); } void Foam::MRFZone::absoluteFlux(surfaceScalarField& phi) const { - const surfaceVectorField& Cf = mesh_.Cf(); - const surfaceVectorField& Sf = mesh_.Sf(); + absoluteRhoFlux(geometricOneField(), phi); +} - const vector& origin = origin_.value(); - const vector& Omega = Omega_.value(); - // Internal faces - forAll(internalFaces_, i) - { - label facei = internalFaces_[i]; - phi[facei] += (Omega ^ (Cf[facei] - origin)) & Sf[facei]; - } - - // Included patches - forAll(includedFaces_, patchi) - { - forAll(includedFaces_[patchi], i) - { - label patchFacei = includedFaces_[patchi][i]; - - phi.boundaryField()[patchi][patchFacei] += - (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) - & Sf.boundaryField()[patchi][patchFacei]; - } - } - - // Excluded patches - forAll(excludedFaces_, patchi) - { - forAll(excludedFaces_[patchi], i) - { - label patchFacei = excludedFaces_[patchi][i]; - - phi.boundaryField()[patchi][patchFacei] += - (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) - & Sf.boundaryField()[patchi][patchFacei]; - } - } +void Foam::MRFZone::absoluteFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + absoluteRhoFlux(rho, phi); } diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H index d5554a5b08..f36a8350e5 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -97,6 +97,22 @@ class MRFZone //- Divide faces in frame according to patch void setMRFFaces(); + //- Make the given absolute mass/vol flux relative within the MRF region + template + void relativeRhoFlux + ( + const RhoFieldType& rho, + surfaceScalarField& phi + ) const; + + //- Make the given relative mass/vol flux absolute within the MRF region + template + void absoluteRhoFlux + ( + const RhoFieldType& rho, + surfaceScalarField& phi + ) const; + //- Disallow default bitwise copy construct MRFZone(const MRFZone&); @@ -163,9 +179,23 @@ public: //- Make the given absolute flux relative within the MRF region void relativeFlux(surfaceScalarField& phi) const; + //- Make the given absolute mass-flux relative within the MRF region + void relativeFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + //- Make the given relative flux absolute within the MRF region void absoluteFlux(surfaceScalarField& phi) const; + //- Make the given relative mass-flux absolute within the MRF region + void absoluteFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + //- Correct the boundary velocity for the roation of the MRF region void correctBoundaryVelocity(volVectorField& U) const; @@ -186,6 +216,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "MRFZoneTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C new file mode 100644 index 0000000000..b195f111a4 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "MRFZone.H" +#include "fvMesh.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "geometricOneField.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::MRFZone::relativeRhoFlux +( + const RhoFieldType& rho, + surfaceScalarField& phi +) const +{ + const surfaceVectorField& Cf = mesh_.Cf(); + const surfaceVectorField& Sf = mesh_.Sf(); + + const vector& origin = origin_.value(); + const vector& Omega = Omega_.value(); + + // Internal faces + forAll(internalFaces_, i) + { + label facei = internalFaces_[i]; + phi[facei] -= rho[facei]*(Omega ^ (Cf[facei] - origin)) & Sf[facei]; + } + + // Included patches + forAll(includedFaces_, patchi) + { + forAll(includedFaces_[patchi], i) + { + label patchFacei = includedFaces_[patchi][i]; + + phi.boundaryField()[patchi][patchFacei] = 0.0; + } + } + + // Excluded patches + forAll(excludedFaces_, patchi) + { + forAll(excludedFaces_[patchi], i) + { + label patchFacei = excludedFaces_[patchi][i]; + + phi.boundaryField()[patchi][patchFacei] -= + rho.boundaryField()[patchi][patchFacei] + *(Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) + & Sf.boundaryField()[patchi][patchFacei]; + } + } +} + + +template +void Foam::MRFZone::absoluteRhoFlux +( + const RhoFieldType& rho, + surfaceScalarField& phi +) const +{ + const surfaceVectorField& Cf = mesh_.Cf(); + const surfaceVectorField& Sf = mesh_.Sf(); + + const vector& origin = origin_.value(); + const vector& Omega = Omega_.value(); + + // Internal faces + forAll(internalFaces_, i) + { + label facei = internalFaces_[i]; + phi[facei] += (Omega ^ (Cf[facei] - origin)) & Sf[facei]; + } + + // Included patches + forAll(includedFaces_, patchi) + { + forAll(includedFaces_[patchi], i) + { + label patchFacei = includedFaces_[patchi][i]; + + phi.boundaryField()[patchi][patchFacei] += + (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) + & Sf.boundaryField()[patchi][patchFacei]; + } + } + + // Excluded patches + forAll(excludedFaces_, patchi) + { + forAll(excludedFaces_[patchi], i) + { + label patchFacei = excludedFaces_[patchi][i]; + + phi.boundaryField()[patchi][patchFacei] += + (Omega ^ (Cf.boundaryField()[patchi][patchFacei] - origin)) + & Sf.boundaryField()[patchi][patchFacei]; + } + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C b/src/finiteVolume/cfdTools/general/MRF/MRFZones.C index 5ef8b3ee83..6bfafcca77 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZones.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,6 +96,19 @@ void Foam::MRFZones::relativeFlux(surfaceScalarField& phi) const } +void Foam::MRFZones::relativeFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + forAll(*this, i) + { + operator[](i).relativeFlux(rho, phi); + } +} + + void Foam::MRFZones::absoluteFlux(surfaceScalarField& phi) const { forAll(*this, i) @@ -105,6 +118,19 @@ void Foam::MRFZones::absoluteFlux(surfaceScalarField& phi) const } +void Foam::MRFZones::absoluteFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + forAll(*this, i) + { + operator[](i).absoluteFlux(rho, phi); + } +} + + void Foam::MRFZones::correctBoundaryVelocity(volVectorField& U) const { forAll(*this, i) diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H b/src/finiteVolume/cfdTools/general/MRF/MRFZones.H index 6e979903a9..b074cd5fd5 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZones.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,9 +85,23 @@ public: //- Make the given absolute flux relative within the MRF region void relativeFlux(surfaceScalarField& phi) const; + //- Make the given absolute mass-flux relative within the MRF region + void relativeFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + //- Make the given relative flux absolute within the MRF region void absoluteFlux(surfaceScalarField& phi) const; + //- Make the given relative mass-flux absolute within the MRF region + void absoluteFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + //- Correct the boundary velocity for the roation of the MRF region void correctBoundaryVelocity(volVectorField& U) const; }; diff --git a/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.C b/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.C index 444cd25131..92a5a822a0 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.C @@ -87,7 +87,7 @@ template Foam::tmp > Foam::PorousZones::ddt ( - const oneField&, + const geometricOneField&, GeometricField& vf ) { diff --git a/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.H b/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.H index cc55fc4264..b86bf6c573 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.H +++ b/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.H @@ -44,7 +44,7 @@ SourceFiles #include "volFieldsFwd.H" #include "fvMatricesFwd.H" #include "dimensionedScalarFwd.H" -#include "oneField.H" +#include "geometricOneField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -105,7 +105,7 @@ public: template tmp > ddt ( - const oneField&, + const geometricOneField&, GeometricField& ); diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C index 3251e2541e..1e334d0dfc 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C @@ -27,7 +27,7 @@ License #include "porousZone.H" #include "fvMesh.H" #include "fvMatrices.H" -#include "oneField.H" +#include "geometricOneField.H" // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // @@ -236,7 +236,7 @@ void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const Udiag, cells, V, - oneField(), + geometricOneField(), U ); } @@ -268,7 +268,7 @@ void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const Usource, cells, V, - oneField(), + geometricOneField(), mesh_.lookupObject("nu"), U ); @@ -316,7 +316,7 @@ void Foam::porousZone::addResistance ( AU, cells, - oneField(), + geometricOneField(), U ); } @@ -344,7 +344,7 @@ void Foam::porousZone::addResistance ( AU, cells, - oneField(), + geometricOneField(), mesh_.lookupObject("nu"), U ); diff --git a/src/finiteVolume/finiteVolume/fvm/fvmDdt.C b/src/finiteVolume/finiteVolume/fvm/fvmDdt.C index d7610206d0..b3ae5b8f37 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmDdt.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmDdt.C @@ -60,7 +60,7 @@ template tmp > ddt ( - const oneField&, + const one&, const GeometricField& vf ) { diff --git a/src/finiteVolume/finiteVolume/fvm/fvmDdt.H b/src/finiteVolume/finiteVolume/fvm/fvmDdt.H index 2b8124e559..31e0e18fab 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmDdt.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmDdt.H @@ -38,7 +38,7 @@ SourceFiles #include "volFieldsFwd.H" #include "fvMatrix.H" -#include "oneField.H" +#include "one.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,7 +60,7 @@ namespace fvm template tmp > ddt ( - const oneField&, + const one&, const GeometricField& ); diff --git a/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.C b/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.C index 501456da3c..24128f4c0d 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.C @@ -99,7 +99,7 @@ template tmp > laplacian ( - const zeroField&, + const zero&, const GeometricField& vf, const word& name ) @@ -115,7 +115,7 @@ template tmp > laplacian ( - const zeroField&, + const zero&, const GeometricField& vf ) { @@ -130,7 +130,7 @@ template tmp > laplacian ( - const oneField&, + const one&, const GeometricField& vf, const word& name ) @@ -143,7 +143,7 @@ template tmp > laplacian ( - const oneField&, + const one&, const GeometricField& vf ) { diff --git a/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.H b/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.H index c41774361f..4025505deb 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmLaplacian.H @@ -39,7 +39,8 @@ SourceFiles #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" #include "fvMatrix.H" -#include "oneField.H" +#include "zero.H" +#include "one.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -69,7 +70,7 @@ namespace fvm template tmp > laplacian ( - const zeroField&, + const zero&, const GeometricField&, const word& ); @@ -77,7 +78,7 @@ namespace fvm template tmp > laplacian ( - const zeroField&, + const zero&, const GeometricField& ); @@ -85,7 +86,7 @@ namespace fvm template tmp > laplacian ( - const oneField&, + const one&, const GeometricField&, const word& ); @@ -93,7 +94,7 @@ namespace fvm template tmp > laplacian ( - const oneField&, + const one&, const GeometricField& ); diff --git a/src/finiteVolume/finiteVolume/fvm/fvmSup.C b/src/finiteVolume/finiteVolume/fvm/fvmSup.C index 99e2d14746..28d592c571 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmSup.C +++ b/src/finiteVolume/finiteVolume/fvm/fvmSup.C @@ -85,7 +85,7 @@ template Foam::zeroField Foam::fvm::Su ( - const zeroField&, + const zero&, const GeometricField& vf ) { @@ -174,7 +174,7 @@ template Foam::zeroField Foam::fvm::Sp ( - const zeroField&, + const zero&, const GeometricField& ) { @@ -240,7 +240,7 @@ template Foam::zeroField Foam::fvm::SuSp ( - const zeroField&, + const zero&, const GeometricField& vf ) { diff --git a/src/finiteVolume/finiteVolume/fvm/fvmSup.H b/src/finiteVolume/finiteVolume/fvm/fvmSup.H index a5662c1733..56d3aa09e9 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvmSup.H +++ b/src/finiteVolume/finiteVolume/fvm/fvmSup.H @@ -38,6 +38,7 @@ SourceFiles #include "volFieldsFwd.H" #include "fvMatrix.H" +#include "zeroField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -76,7 +77,7 @@ namespace fvm template zeroField Su ( - const zeroField&, + const zero&, const GeometricField& ); @@ -116,7 +117,7 @@ namespace fvm template zeroField Sp ( - const zeroField&, + const zero&, const GeometricField& ); @@ -147,7 +148,7 @@ namespace fvm template zeroField SuSp ( - const zeroField&, + const zero&, const GeometricField& ); } diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 9ce8d888c4..f335eeab30 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -1088,7 +1088,7 @@ void Foam::fvMatrix::operator-= template void Foam::fvMatrix::operator+= ( - const zeroField& + const zero& ) {} @@ -1096,7 +1096,7 @@ void Foam::fvMatrix::operator+= template void Foam::fvMatrix::operator-= ( - const zeroField& + const zero& ) {} @@ -1507,7 +1507,7 @@ template Foam::tmp > Foam::operator== ( const fvMatrix& A, - const zeroField& + const zero& ) { return A; @@ -1518,7 +1518,7 @@ template Foam::tmp > Foam::operator== ( const tmp >& tA, - const zeroField& + const zero& ) { return tA; diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H index 8569862e13..fc3efa6261 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H @@ -44,7 +44,7 @@ SourceFiles #include "tmp.H" #include "autoPtr.H" #include "dimensionedTypes.H" -#include "zeroField.H" +#include "zero.H" #include "className.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -435,8 +435,8 @@ public: void operator+=(const dimensioned&); void operator-=(const dimensioned&); - void operator+=(const zeroField&); - void operator-=(const zeroField&); + void operator+=(const zero&); + void operator-=(const zero&); void operator*=(const DimensionedField&); void operator*=(const tmp >&); @@ -647,14 +647,14 @@ template tmp > operator== ( const fvMatrix&, - const zeroField& + const zero& ); template tmp > operator== ( const tmp >&, - const zeroField& + const zero& ); diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C index 9c055ca339..dd7c35ea6e 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,6 +34,7 @@ License #include "fvcSurfaceIntegrate.H" #include "slicedSurfaceFields.H" #include "syncTools.H" + #include "fvm.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,11 +50,11 @@ void Foam::MULES::explicitSolve { explicitSolve ( - oneField(), + geometricOneField(), psi, phi, phiPsi, - zeroField(), zeroField(), + zero(), zero(), psiMax, psiMin ); } @@ -70,11 +71,11 @@ void Foam::MULES::implicitSolve { implicitSolve ( - oneField(), + geometricOneField(), psi, phi, phiPsi, - zeroField(), zeroField(), + zero(), zero(), psiMax, psiMin ); } diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H index 59c4072fee..8db5bf347a 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,8 +46,8 @@ SourceFiles #include "volFields.H" #include "surfaceFieldsFwd.H" #include "primitiveFieldsFwd.H" -#include "zeroField.H" -#include "oneField.H" +#include "zero.H" +#include "geometricOneField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C index bf72983e4a..858ff4b150 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C @@ -88,8 +88,8 @@ void Foam::MULES::explicitSolve psi, phiBD, phiCorr, - Sp.field(), - Su.field(), + Sp, + Su, psiMax, psiMin, 3 @@ -109,18 +109,18 @@ void Foam::MULES::explicitSolve psiIf = ( mesh.Vsc0()*rho.oldTime()*psi0/(deltaT*mesh.Vsc()) - + Su.field() + + Su - psiIf - )/(rho/deltaT - Sp.field()); + )/(rho/deltaT - Sp); } else { psiIf = ( rho.oldTime()*psi0/deltaT - + Su.field() + + Su - psiIf - )/(rho/deltaT - Sp.field()); + )/(rho/deltaT - Sp); } psi.correctBoundaryConditions(); @@ -244,8 +244,8 @@ void Foam::MULES::implicitSolve psi, phiBD, phiCorr, - Sp.field(), - Su.field(), + Sp, + Su, psiMax, psiMin, nLimiterIter diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/T b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/T new file mode 100644 index 0000000000..c876007062 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/T @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 293; + +boundaryField +{ + rotor + { + type zeroGradient; + } + + stator + { + type zeroGradient; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/U b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/U new file mode 100644 index 0000000000..ee6588db42 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/U @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + rotor + { + type fixedValue; + value uniform (0 0 0); + } + + stator + { + type fixedValue; + value uniform (0 0 0); + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/alphat b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/alphat new file mode 100644 index 0000000000..764b2c5ca0 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/alphat @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6.x | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object alphat; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + rotor + { + type alphatWallFunction; + Prt 0.85; + value uniform 0; + } + stator + { + type alphatWallFunction; + Prt 0.85; + value uniform 0; + } + front + { + type empty; + } + back + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/epsilon b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/epsilon new file mode 100644 index 0000000000..4443c71b68 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/epsilon @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -3 0 0 0 0 ]; + +internalField uniform 20; + +boundaryField +{ + rotor + { + type compressible::epsilonWallFunction; + value uniform 20; + } + + stator + { + type compressible::epsilonWallFunction; + value uniform 20; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/k b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/k new file mode 100644 index 0000000000..f5ee44315f --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/k @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -2 0 0 0 0 ]; + +internalField uniform 1; + +boundaryField +{ + rotor + { + type compressible::kqRWallFunction; + value uniform 0; + } + + stator + { + type compressible::kqRWallFunction; + value uniform 0; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/mut b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/mut new file mode 100644 index 0000000000..4bdc2e1afd --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/mut @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object mut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + rotor + { + type mutkWallFunction; + value uniform 0; + } + + stator + { + type mutkWallFunction; + value uniform 0; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/p b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/p new file mode 100644 index 0000000000..de53bf93f6 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/p @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + rotor + { + type zeroGradient; + } + + stator + { + type zeroGradient; + } + + front + { + type empty; + } + + back + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/Allrun b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/Allrun new file mode 100755 index 0000000000..836276fe9c --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/Allrun @@ -0,0 +1,9 @@ +#!/bin/sh + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +application=`getApplication` + +./makeMesh +runApplication $application diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones new file mode 100644 index 0000000000..bff11fb77f --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones @@ -0,0 +1,31 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object MRFZones; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +1 +( + rotor + { + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin origin [0 1 0 0 0 0 0] (0 0 0); + axis axis [0 0 0 0 0 0 0] (0 0 1); + omega omega [0 0 -1 0 0 0 0] 1047.2; + } +) + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/RASProperties b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/RASProperties new file mode 100644 index 0000000000..81b1ec9115 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/dynamicMeshDict b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/dynamicMeshDict new file mode 100644 index 0000000000..10468d3ba0 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/dynamicMeshDict @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMeshLib "libtopoChangerFvMesh.so"; + +dynamicFvMesh mixerFvMesh; + +mixerFvMeshCoeffs +{ + coordinateSystem + { + type cylindrical; + origin ( 0 0 0 ); + axis ( 0 0 1 ); + direction ( 1 0 0 ); + } + + rpm 10; + + slider + { + inside insideSlider; + outside outsideSlider; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000..ef73b0c7b7 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict @@ -0,0 +1,834 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// General macros to create 2D/extruded-2D meshes + + + + + + + + + + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +// Hub radius + + +// Impeller-tip radius + + +// Baffle-tip radius + + +// Tank radius + + +// MRF region radius + + +// Thickness of 2D slab + + +// Base z + + +// Top z + + +// Number of cells radially between hub and impeller tip + + +// Number of cells radially in each of the two regions between +// impeller and baffle tips + + +// Number of cells radially between baffle tip and tank + + +// Number of cells azimuthally in each of the 8 blocks + + +// Number of cells in the thickness of the slab + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +vertices +( + (0.2 0 0) // Vertex r0b = 0 + (0.2 0 0) // Vertex r0sb = 1 + (0.141421356364228 -0.141421356110391 0) // Vertex r1b = 2 + (3.58979347393082e-10 -0.2 0) // Vertex r2b = 3 + (3.58979347393082e-10 -0.2 0) // Vertex r2sb = 4 + (-0.141421355856554 -0.141421356618065 0) // Vertex r3b = 5 + (-0.2 7.17958694786164e-10 0) // Vertex r4b = 6 + (-0.2 7.17958694786164e-10 0) // Vertex r4sb = 7 + (-0.141421355856554 0.141421356618065 0) // Vertex r5b = 8 + (3.58979347393082e-10 0.2 0) // Vertex r6b = 9 + (3.58979347393082e-10 0.2 0) // Vertex r6sb = 10 + (0.141421356364228 0.141421356110391 0) // Vertex r7b = 11 + + (0.5 0 0) // Vertex rb0b = 12 + (0.353553390910569 -0.353553390275978 0) // Vertex rb1b = 13 + (8.97448368482705e-10 -0.5 0) // Vertex rb2b = 14 + (-0.353553389641386 -0.353553391545162 0) // Vertex rb3b = 15 + (-0.5 1.79489673696541e-09 0) // Vertex rb4b = 16 + (-0.353553389641386 0.353553391545162 0) // Vertex rb5b = 17 + (8.97448368482705e-10 0.5 0) // Vertex rb6b = 18 + (0.353553390910569 0.353553390275978 0) // Vertex rb7b = 19 + + (0.6 0 0) // Vertex ri0b = 20 + (0.424264069092683 -0.424264068331174 0) // Vertex ri1b = 21 + (1.07693804217925e-09 -0.6 0) // Vertex ri2b = 22 + (-0.424264067569663 -0.424264069854194 0) // Vertex ri3b = 23 + (-0.6 2.15387608435849e-09 0) // Vertex ri4b = 24 + (-0.424264067569663 0.424264069854194 0) // Vertex ri5b = 25 + (1.07693804217925e-09 0.6 0) // Vertex ri6b = 26 + (0.424264069092683 0.424264068331174 0) // Vertex ri7b = 27 + + (0.7 0 0) // Vertex Rb0b = 28 + (0.494974747274797 -0.494974746386369 0) // Vertex Rb1b = 29 + (1.25642771587579e-09 -0.7 0) // Vertex Rb2b = 30 + (-0.49497474549794 -0.494974748163226 0) // Vertex Rb3b = 31 + (-0.7 2.51285543175157e-09 0) // Vertex Rb4b = 32 + (-0.49497474549794 0.494974748163226 0) // Vertex Rb5b = 33 + (1.25642771587579e-09 0.7 0) // Vertex Rb6b = 34 + (0.494974747274797 0.494974746386369 0) // Vertex Rb7b = 35 + + (1 0 0) // Vertex R0b = 36 + (0.707106781821139 -0.707106780551956 0) // Vertex R1b = 37 + (0.707106781821139 -0.707106780551956 0) // Vertex R1sb = 38 + (1.79489673696541e-09 -1 0) // Vertex R2b = 39 + (-0.707106779282772 -0.707106783090323 0) // Vertex R3b = 40 + (-0.707106779282772 -0.707106783090323 0) // Vertex R3sb = 41 + (-1 3.58979347393082e-09 0) // Vertex R4b = 42 + (-0.707106779282772 0.707106783090323 0) // Vertex R5b = 43 + (-0.707106779282772 0.707106783090323 0) // Vertex R5sb = 44 + (1.79489673696541e-09 1 0) // Vertex R6b = 45 + (0.707106781821139 0.707106780551956 0) // Vertex R7b = 46 + (0.707106781821139 0.707106780551956 0) // Vertex R7sb = 47 + + (0.2 0 0.1) // Vertex r0t = 48 + (0.2 0 0.1) // Vertex r0st = 49 + (0.141421356364228 -0.141421356110391 0.1) // Vertex r1t = 50 + (3.58979347393082e-10 -0.2 0.1) // Vertex r2t = 51 + (3.58979347393082e-10 -0.2 0.1) // Vertex r2st = 52 + (-0.141421355856554 -0.141421356618065 0.1) // Vertex r3t = 53 + (-0.2 7.17958694786164e-10 0.1) // Vertex r4t = 54 + (-0.2 7.17958694786164e-10 0.1) // Vertex r4st = 55 + (-0.141421355856554 0.141421356618065 0.1) // Vertex r5t = 56 + (3.58979347393082e-10 0.2 0.1) // Vertex r6t = 57 + (3.58979347393082e-10 0.2 0.1) // Vertex r6st = 58 + (0.141421356364228 0.141421356110391 0.1) // Vertex r7t = 59 + + (0.5 0 0.1) // Vertex rb0t = 60 + (0.353553390910569 -0.353553390275978 0.1) // Vertex rb1t = 61 + (8.97448368482705e-10 -0.5 0.1) // Vertex rb2t = 62 + (-0.353553389641386 -0.353553391545162 0.1) // Vertex rb3t = 63 + (-0.5 1.79489673696541e-09 0.1) // Vertex rb4t = 64 + (-0.353553389641386 0.353553391545162 0.1) // Vertex rb5t = 65 + (8.97448368482705e-10 0.5 0.1) // Vertex rb6t = 66 + (0.353553390910569 0.353553390275978 0.1) // Vertex rb7t = 67 + + (0.6 0 0.1) // Vertex ri0t = 68 + (0.424264069092683 -0.424264068331174 0.1) // Vertex ri1t = 69 + (1.07693804217925e-09 -0.6 0.1) // Vertex ri2t = 70 + (-0.424264067569663 -0.424264069854194 0.1) // Vertex ri3t = 71 + (-0.6 2.15387608435849e-09 0.1) // Vertex ri4t = 72 + (-0.424264067569663 0.424264069854194 0.1) // Vertex ri5t = 73 + (1.07693804217925e-09 0.6 0.1) // Vertex ri6t = 74 + (0.424264069092683 0.424264068331174 0.1) // Vertex ri7t = 75 + + (0.7 0 0.1) // Vertex Rb0t = 76 + (0.494974747274797 -0.494974746386369 0.1) // Vertex Rb1t = 77 + (1.25642771587579e-09 -0.7 0.1) // Vertex Rb2t = 78 + (-0.49497474549794 -0.494974748163226 0.1) // Vertex Rb3t = 79 + (-0.7 2.51285543175157e-09 0.1) // Vertex Rb4t = 80 + (-0.49497474549794 0.494974748163226 0.1) // Vertex Rb5t = 81 + (1.25642771587579e-09 0.7 0.1) // Vertex Rb6t = 82 + (0.494974747274797 0.494974746386369 0.1) // Vertex Rb7t = 83 + + (1 0 0.1) // Vertex R0t = 84 + (0.707106781821139 -0.707106780551956 0.1) // Vertex R1t = 85 + (0.707106781821139 -0.707106780551956 0.1) // Vertex R1st = 86 + (1.79489673696541e-09 -1 0.1) // Vertex R2t = 87 + (-0.707106779282772 -0.707106783090323 0.1) // Vertex R3t = 88 + (-0.707106779282772 -0.707106783090323 0.1) // Vertex R3st = 89 + (-1 3.58979347393082e-09 0.1) // Vertex R4t = 90 + (-0.707106779282772 0.707106783090323 0.1) // Vertex R5t = 91 + (-0.707106779282772 0.707106783090323 0.1) // Vertex R5st = 92 + (1.79489673696541e-09 1 0.1) // Vertex R6t = 93 + (0.707106781821139 0.707106780551956 0.1) // Vertex R7t = 94 + (0.707106781821139 0.707106780551956 0.1) // Vertex R7st = 95 +); + +blocks +( + // block0 + hex (0 2 13 12 48 50 61 60) + rotor + (12 12 1) + simpleGrading (1 1 1) + + // block1 + hex (2 4 14 13 50 52 62 61) + rotor + (12 12 1) + simpleGrading (1 1 1) + + // block2 + hex (3 5 15 14 51 53 63 62) + rotor + (12 12 1) + simpleGrading (1 1 1) + + // block3 + hex (5 7 16 15 53 55 64 63) + rotor + (12 12 1) + simpleGrading (1 1 1) + + // block4 + hex (6 8 17 16 54 56 65 64) + rotor + (12 12 1) + simpleGrading (1 1 1) + + // block5 + hex (8 10 18 17 56 58 66 65) + rotor + (12 12 1) + simpleGrading (1 1 1) + + // block6 + hex (9 11 19 18 57 59 67 66) + rotor + (12 12 1) + simpleGrading (1 1 1) + + // block7 + hex (11 1 12 19 59 49 60 67) + rotor + (12 12 1) + simpleGrading (1 1 1) + + // block0 + hex (12 13 21 20 60 61 69 68) + rotor + (12 4 1) + simpleGrading (1 1 1) + + // block1 + hex (13 14 22 21 61 62 70 69) + rotor + (12 4 1) + simpleGrading (1 1 1) + + // block2 + hex (14 15 23 22 62 63 71 70) + rotor + (12 4 1) + simpleGrading (1 1 1) + + // block3 + hex (15 16 24 23 63 64 72 71) + rotor + (12 4 1) + simpleGrading (1 1 1) + + // block4 + hex (16 17 25 24 64 65 73 72) + rotor + (12 4 1) + simpleGrading (1 1 1) + + // block5 + hex (17 18 26 25 65 66 74 73) + rotor + (12 4 1) + simpleGrading (1 1 1) + + // block6 + hex (18 19 27 26 66 67 75 74) + rotor + (12 4 1) + simpleGrading (1 1 1) + + // block7 + hex (19 12 20 27 67 60 68 75) + rotor + (12 4 1) + simpleGrading (1 1 1) + + // block0 + hex (20 21 29 28 68 69 77 76) + stator + (12 4 1) + simpleGrading (1 1 1) + + // block1 + hex (21 22 30 29 69 70 78 77) + stator + (12 4 1) + simpleGrading (1 1 1) + + // block2 + hex (22 23 31 30 70 71 79 78) + stator + (12 4 1) + simpleGrading (1 1 1) + + // block3 + hex (23 24 32 31 71 72 80 79) + stator + (12 4 1) + simpleGrading (1 1 1) + + // block4 + hex (24 25 33 32 72 73 81 80) + stator + (12 4 1) + simpleGrading (1 1 1) + + // block5 + hex (25 26 34 33 73 74 82 81) + stator + (12 4 1) + simpleGrading (1 1 1) + + // block6 + hex (26 27 35 34 74 75 83 82) + stator + (12 4 1) + simpleGrading (1 1 1) + + // block7 + hex (27 20 28 35 75 68 76 83) + stator + (12 4 1) + simpleGrading (1 1 1) + + // block0 + hex (28 29 38 36 76 77 86 84) + stator + (12 12 1) + simpleGrading (1 1 1) + + // block1 + hex (29 30 39 37 77 78 87 85) + stator + (12 12 1) + simpleGrading (1 1 1) + + // block2 + hex (30 31 41 39 78 79 89 87) + stator + (12 12 1) + simpleGrading (1 1 1) + + // block3 + hex (31 32 42 40 79 80 90 88) + stator + (12 12 1) + simpleGrading (1 1 1) + + // block4 + hex (32 33 44 42 80 81 92 90) + stator + (12 12 1) + simpleGrading (1 1 1) + + // block5 + hex (33 34 45 43 81 82 93 91) + stator + (12 12 1) + simpleGrading (1 1 1) + + // block6 + hex (34 35 47 45 82 83 95 93) + stator + (12 12 1) + simpleGrading (1 1 1) + + // block7 + hex (35 28 36 46 83 76 84 94) + stator + (12 12 1) + simpleGrading (1 1 1) +); + +edges +( + arc 0 2 (0.184775906536601 -0.0765366863901046 0) + arc 2 4 (0.0765366867217582 -0.184775906399226 0) + arc 3 5 (-0.0765366860584508 -0.184775906673977 0) + arc 5 7 (-0.18477590626185 -0.0765366870534118 0) + arc 6 8 (-0.18477590626185 0.0765366870534118 0) + arc 8 10 (-0.0765366860584508 0.184775906673977 0) + arc 9 11 (0.0765366867217582 0.184775906399226 0) + arc 11 1 (0.184775906536601 0.0765366863901046 0) + + arc 12 13 (0.461939766341503 -0.191341715975262 0) + arc 13 14 (0.191341716804395 -0.461939765998065 0) + arc 14 15 (-0.191341715146127 -0.461939766684942 0) + arc 15 16 (-0.461939765654626 -0.19134171763353 0) + arc 16 17 (-0.461939765654626 0.19134171763353 0) + arc 17 18 (-0.191341715146127 0.461939766684942 0) + arc 18 19 (0.191341716804395 0.461939765998065 0) + arc 19 12 (0.461939766341503 0.191341715975262 0) + + arc 20 21 (0.554327719609804 -0.229610059170314 0) + arc 21 22 (0.229610060165275 -0.554327719197677 0) + arc 22 23 (-0.229610058175352 -0.55432772002193 0) + arc 23 24 (-0.554327718785551 -0.229610061160235 0) + arc 24 25 (-0.554327718785551 0.229610061160235 0) + arc 25 26 (-0.229610058175352 0.55432772002193 0) + arc 26 27 (0.229610060165275 0.554327719197677 0) + arc 27 20 (0.554327719609804 0.229610059170314 0) + + arc 28 29 (0.646715672878104 -0.267878402365366 0) + arc 29 30 (0.267878403526154 -0.64671567239729 0) + arc 30 31 (-0.267878401204578 -0.646715673358918 0) + arc 31 32 (-0.646715671916476 -0.267878404686941 0) + arc 32 33 (-0.646715671916476 0.267878404686941 0) + arc 33 34 (-0.267878401204578 0.646715673358918 0) + arc 34 35 (0.267878403526154 0.64671567239729 0) + arc 35 28 (0.646715672878104 0.267878402365366 0) + + arc 36 38 (0.923879532683006 -0.382683431950523 0) + arc 37 39 (0.382683433608791 -0.923879531996129 0) + arc 39 41 (-0.382683430292254 -0.923879533369883 0) + arc 40 42 (-0.923879531309252 -0.382683435267059 0) + arc 42 44 (-0.923879531309252 0.382683435267059 0) + arc 43 45 (-0.382683430292254 0.923879533369883 0) + arc 45 47 (0.382683433608791 0.923879531996129 0) + arc 46 36 (0.923879532683006 0.382683431950523 0) + + arc 48 50 (0.184775906536601 -0.0765366863901046 0.1) + arc 50 52 (0.0765366867217582 -0.184775906399226 0.1) + arc 51 53 (-0.0765366860584508 -0.184775906673977 0.1) + arc 53 55 (-0.18477590626185 -0.0765366870534118 0.1) + arc 54 56 (-0.18477590626185 0.0765366870534118 0.1) + arc 56 58 (-0.0765366860584508 0.184775906673977 0.1) + arc 57 59 (0.0765366867217582 0.184775906399226 0.1) + arc 59 49 (0.184775906536601 0.0765366863901046 0.1) + + arc 60 61 (0.461939766341503 -0.191341715975262 0.1) + arc 61 62 (0.191341716804395 -0.461939765998065 0.1) + arc 62 63 (-0.191341715146127 -0.461939766684942 0.1) + arc 63 64 (-0.461939765654626 -0.19134171763353 0.1) + arc 64 65 (-0.461939765654626 0.19134171763353 0.1) + arc 65 66 (-0.191341715146127 0.461939766684942 0.1) + arc 66 67 (0.191341716804395 0.461939765998065 0.1) + arc 67 60 (0.461939766341503 0.191341715975262 0.1) + + arc 68 69 (0.554327719609804 -0.229610059170314 0.1) + arc 69 70 (0.229610060165275 -0.554327719197677 0.1) + arc 70 71 (-0.229610058175352 -0.55432772002193 0.1) + arc 71 72 (-0.554327718785551 -0.229610061160235 0.1) + arc 72 73 (-0.554327718785551 0.229610061160235 0.1) + arc 73 74 (-0.229610058175352 0.55432772002193 0.1) + arc 74 75 (0.229610060165275 0.554327719197677 0.1) + arc 75 68 (0.554327719609804 0.229610059170314 0.1) + + arc 76 77 (0.646715672878104 -0.267878402365366 0.1) + arc 77 78 (0.267878403526154 -0.64671567239729 0.1) + arc 78 79 (-0.267878401204578 -0.646715673358918 0.1) + arc 79 80 (-0.646715671916476 -0.267878404686941 0.1) + arc 80 81 (-0.646715671916476 0.267878404686941 0.1) + arc 81 82 (-0.267878401204578 0.646715673358918 0.1) + arc 82 83 (0.267878403526154 0.64671567239729 0.1) + arc 83 76 (0.646715672878104 0.267878402365366 0.1) + + arc 84 86 (0.923879532683006 -0.382683431950523 0.1) + arc 85 87 (0.382683433608791 -0.923879531996129 0.1) + arc 87 89 (-0.382683430292254 -0.923879533369883 0.1) + arc 88 90 (-0.923879531309252 -0.382683435267059 0.1) + arc 90 92 (-0.923879531309252 0.382683435267059 0.1) + arc 91 93 (-0.382683430292254 0.923879533369883 0.1) + arc 93 95 (0.382683433608791 0.923879531996129 0.1) + arc 94 84 (0.923879532683006 0.382683431950523 0.1) +); + +patches +( + wall rotor + ( + (0 2 50 48) + (2 4 52 50) + (3 5 53 51) + (5 7 55 53) + (6 8 56 54) + (8 10 58 56) + (9 11 59 57) + (11 1 49 59) + + (0 12 60 48) + (1 12 60 49) + + (3 14 62 51) + (4 14 62 52) + + (6 16 64 54) + (7 16 64 55) + + (9 18 66 57) + (10 18 66 58) + ) + + wall stator + ( + (36 38 86 84) + (37 39 87 85) + (39 41 89 87) + (40 42 90 88) + (42 44 92 90) + (43 45 93 91) + (45 47 95 93) + (46 36 84 94) + + (37 29 77 85) + (38 29 77 86) + + (40 31 79 88) + (41 31 79 89) + + (43 33 81 91) + (44 33 81 92) + + (46 35 83 94) + (47 35 83 95) + ) + + empty front + ( + (48 50 61 60) + (50 52 62 61) + (51 53 63 62) + (53 55 64 63) + (54 56 65 64) + (56 58 66 65) + (57 59 67 66) + (59 49 60 67) + (60 61 69 68) + (61 62 70 69) + (62 63 71 70) + (63 64 72 71) + (64 65 73 72) + (65 66 74 73) + (66 67 75 74) + (67 60 68 75) + (68 69 77 76) + (69 70 78 77) + (70 71 79 78) + (71 72 80 79) + (72 73 81 80) + (73 74 82 81) + (74 75 83 82) + (75 68 76 83) + (76 77 86 84) + (77 78 87 85) + (78 79 89 87) + (79 80 90 88) + (80 81 92 90) + (81 82 93 91) + (82 83 95 93) + (83 76 84 94) + ) + + empty back + ( + (0 12 13 2) + (2 13 14 4) + (3 14 15 5) + (5 15 16 7) + (6 16 17 8) + (8 17 18 10) + (9 18 19 11) + (11 19 12 1) + (12 20 21 13) + (13 21 22 14) + (14 22 23 15) + (15 23 24 16) + (16 24 25 17) + (17 25 26 18) + (18 26 27 19) + (19 27 20 12) + (20 28 29 21) + (21 29 30 22) + (22 30 31 23) + (23 31 32 24) + (24 32 33 25) + (25 33 34 26) + (26 34 35 27) + (27 35 28 20) + (28 36 38 29) + (29 37 39 30) + (30 39 41 31) + (31 40 42 32) + (32 42 44 33) + (33 43 45 34) + (34 45 47 35) + (35 46 36 28) + ) +); + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 new file mode 100644 index 0000000000..dccc042d22 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 @@ -0,0 +1,834 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + `format' ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// General macros to create 2D/extruded-2D meshes + +changecom(//)changequote([,]) +define(calc, [esyscmd(perl -e 'print ($1)')]) +define(VCOUNT, 0) +define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) +define(pi, 3.14159265) + +define(hex2D, hex ($1b $2b $3b $4b $1t $2t $3t $4t)) +define(quad2D, ($1b $2b $2t $1t)) +define(frontQuad, ($1t $2t $3t $4t)) +define(backQuad, ($1b $4b $3b $2b)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +// Hub radius +define(r, 0.2) + +// Impeller-tip radius +define(rb, 0.5) + +// Baffle-tip radius +define(Rb, 0.7) + +// Tank radius +define(R, 1) + +// MRF region radius +define(ri, calc(0.5*(rb + Rb))) + +// Thickness of 2D slab +define(z, 0.1) + +// Base z +define(Zb, 0) + +// Top z +define(Zt, calc(Zb + z)) + +// Number of cells radially between hub and impeller tip +define(Nr, 12) + +// Number of cells radially in each of the two regions between +// impeller and baffle tips +define(Ni, 4) + +// Number of cells radially between baffle tip and tank +define(NR, 12) + +// Number of cells azimuthally in each of the 8 blocks +define(Na, 12) + +// Number of cells in the thickness of the slab +define(Nz, 1) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +define(vert, (x$1$2 y$1$2 $3)) +define(evert, (ex$1$2 ey$1$2 $3)) + +define(a0, 0) +define(a1, -45) +define(a2, -90) +define(a3, -135) +define(a4, 180) +define(a5, 135) +define(a6, 90) +define(a7, 45) + +define(ea0, -22.5) +define(ea1, -67.5) +define(ea2, -112.5) +define(ea3, -157.5) +define(ea4, 157.5) +define(ea5, 112.5) +define(ea6, 67.5) +define(ea7, 22.5) + +define(ca0, calc(cos((pi/180)*a0))) +define(ca1, calc(cos((pi/180)*a1))) +define(ca2, calc(cos((pi/180)*a2))) +define(ca3, calc(cos((pi/180)*a3))) +define(ca4, calc(cos((pi/180)*a4))) +define(ca5, calc(cos((pi/180)*a5))) +define(ca6, calc(cos((pi/180)*a6))) +define(ca7, calc(cos((pi/180)*a7))) + +define(sa0, calc(sin((pi/180)*a0))) +define(sa1, calc(sin((pi/180)*a1))) +define(sa2, calc(sin((pi/180)*a2))) +define(sa3, calc(sin((pi/180)*a3))) +define(sa4, calc(sin((pi/180)*a4))) +define(sa5, calc(sin((pi/180)*a5))) +define(sa6, calc(sin((pi/180)*a6))) +define(sa7, calc(sin((pi/180)*a7))) + +define(cea0, calc(cos((pi/180)*ea0))) +define(cea1, calc(cos((pi/180)*ea1))) +define(cea2, calc(cos((pi/180)*ea2))) +define(cea3, calc(cos((pi/180)*ea3))) +define(cea4, calc(cos((pi/180)*ea4))) +define(cea5, calc(cos((pi/180)*ea5))) +define(cea6, calc(cos((pi/180)*ea6))) +define(cea7, calc(cos((pi/180)*ea7))) + +define(sea0, calc(sin((pi/180)*ea0))) +define(sea1, calc(sin((pi/180)*ea1))) +define(sea2, calc(sin((pi/180)*ea2))) +define(sea3, calc(sin((pi/180)*ea3))) +define(sea4, calc(sin((pi/180)*ea4))) +define(sea5, calc(sin((pi/180)*ea5))) +define(sea6, calc(sin((pi/180)*ea6))) +define(sea7, calc(sin((pi/180)*ea7))) + +define(x00, calc(r*ca0)) +define(x01, calc(r*ca1)) +define(x02, calc(r*ca2)) +define(x03, calc(r*ca3)) +define(x04, calc(r*ca4)) +define(x05, calc(r*ca5)) +define(x06, calc(r*ca6)) +define(x07, calc(r*ca7)) + +define(x10, calc(rb*ca0)) +define(x11, calc(rb*ca1)) +define(x12, calc(rb*ca2)) +define(x13, calc(rb*ca3)) +define(x14, calc(rb*ca4)) +define(x15, calc(rb*ca5)) +define(x16, calc(rb*ca6)) +define(x17, calc(rb*ca7)) + +define(x20, calc(ri*ca0)) +define(x21, calc(ri*ca1)) +define(x22, calc(ri*ca2)) +define(x23, calc(ri*ca3)) +define(x24, calc(ri*ca4)) +define(x25, calc(ri*ca5)) +define(x26, calc(ri*ca6)) +define(x27, calc(ri*ca7)) + +define(x30, calc(Rb*ca0)) +define(x31, calc(Rb*ca1)) +define(x32, calc(Rb*ca2)) +define(x33, calc(Rb*ca3)) +define(x34, calc(Rb*ca4)) +define(x35, calc(Rb*ca5)) +define(x36, calc(Rb*ca6)) +define(x37, calc(Rb*ca7)) + +define(x40, calc(R*ca0)) +define(x41, calc(R*ca1)) +define(x42, calc(R*ca2)) +define(x43, calc(R*ca3)) +define(x44, calc(R*ca4)) +define(x45, calc(R*ca5)) +define(x46, calc(R*ca6)) +define(x47, calc(R*ca7)) + +define(y00, calc(r*sa0)) +define(y01, calc(r*sa1)) +define(y02, calc(r*sa2)) +define(y03, calc(r*sa3)) +define(y04, calc(r*sa4)) +define(y05, calc(r*sa5)) +define(y06, calc(r*sa6)) +define(y07, calc(r*sa7)) + +define(y10, calc(rb*sa0)) +define(y11, calc(rb*sa1)) +define(y12, calc(rb*sa2)) +define(y13, calc(rb*sa3)) +define(y14, calc(rb*sa4)) +define(y15, calc(rb*sa5)) +define(y16, calc(rb*sa6)) +define(y17, calc(rb*sa7)) + +define(y20, calc(ri*sa0)) +define(y21, calc(ri*sa1)) +define(y22, calc(ri*sa2)) +define(y23, calc(ri*sa3)) +define(y24, calc(ri*sa4)) +define(y25, calc(ri*sa5)) +define(y26, calc(ri*sa6)) +define(y27, calc(ri*sa7)) + +define(y30, calc(Rb*sa0)) +define(y31, calc(Rb*sa1)) +define(y32, calc(Rb*sa2)) +define(y33, calc(Rb*sa3)) +define(y34, calc(Rb*sa4)) +define(y35, calc(Rb*sa5)) +define(y36, calc(Rb*sa6)) +define(y37, calc(Rb*sa7)) + +define(y40, calc(R*sa0)) +define(y41, calc(R*sa1)) +define(y42, calc(R*sa2)) +define(y43, calc(R*sa3)) +define(y44, calc(R*sa4)) +define(y45, calc(R*sa5)) +define(y46, calc(R*sa6)) +define(y47, calc(R*sa7)) + +define(ex00, calc(r*cea0)) +define(ex01, calc(r*cea1)) +define(ex02, calc(r*cea2)) +define(ex03, calc(r*cea3)) +define(ex04, calc(r*cea4)) +define(ex05, calc(r*cea5)) +define(ex06, calc(r*cea6)) +define(ex07, calc(r*cea7)) + +define(ex10, calc(rb*cea0)) +define(ex11, calc(rb*cea1)) +define(ex12, calc(rb*cea2)) +define(ex13, calc(rb*cea3)) +define(ex14, calc(rb*cea4)) +define(ex15, calc(rb*cea5)) +define(ex16, calc(rb*cea6)) +define(ex17, calc(rb*cea7)) + +define(ex20, calc(ri*cea0)) +define(ex21, calc(ri*cea1)) +define(ex22, calc(ri*cea2)) +define(ex23, calc(ri*cea3)) +define(ex24, calc(ri*cea4)) +define(ex25, calc(ri*cea5)) +define(ex26, calc(ri*cea6)) +define(ex27, calc(ri*cea7)) + +define(ex30, calc(Rb*cea0)) +define(ex31, calc(Rb*cea1)) +define(ex32, calc(Rb*cea2)) +define(ex33, calc(Rb*cea3)) +define(ex34, calc(Rb*cea4)) +define(ex35, calc(Rb*cea5)) +define(ex36, calc(Rb*cea6)) +define(ex37, calc(Rb*cea7)) + +define(ex40, calc(R*cea0)) +define(ex41, calc(R*cea1)) +define(ex42, calc(R*cea2)) +define(ex43, calc(R*cea3)) +define(ex44, calc(R*cea4)) +define(ex45, calc(R*cea5)) +define(ex46, calc(R*cea6)) +define(ex47, calc(R*cea7)) + +define(ey00, calc(r*sea0)) +define(ey01, calc(r*sea1)) +define(ey02, calc(r*sea2)) +define(ey03, calc(r*sea3)) +define(ey04, calc(r*sea4)) +define(ey05, calc(r*sea5)) +define(ey06, calc(r*sea6)) +define(ey07, calc(r*sea7)) + +define(ey10, calc(rb*sea0)) +define(ey11, calc(rb*sea1)) +define(ey12, calc(rb*sea2)) +define(ey13, calc(rb*sea3)) +define(ey14, calc(rb*sea4)) +define(ey15, calc(rb*sea5)) +define(ey16, calc(rb*sea6)) +define(ey17, calc(rb*sea7)) + +define(ey20, calc(ri*sea0)) +define(ey21, calc(ri*sea1)) +define(ey22, calc(ri*sea2)) +define(ey23, calc(ri*sea3)) +define(ey24, calc(ri*sea4)) +define(ey25, calc(ri*sea5)) +define(ey26, calc(ri*sea6)) +define(ey27, calc(ri*sea7)) + +define(ey30, calc(Rb*sea0)) +define(ey31, calc(Rb*sea1)) +define(ey32, calc(Rb*sea2)) +define(ey33, calc(Rb*sea3)) +define(ey34, calc(Rb*sea4)) +define(ey35, calc(Rb*sea5)) +define(ey36, calc(Rb*sea6)) +define(ey37, calc(Rb*sea7)) + +define(ey40, calc(R*sea0)) +define(ey41, calc(R*sea1)) +define(ey42, calc(R*sea2)) +define(ey43, calc(R*sea3)) +define(ey44, calc(R*sea4)) +define(ey45, calc(R*sea5)) +define(ey46, calc(R*sea6)) +define(ey47, calc(R*sea7)) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +vertices +( + vert(0, 0, Zb) vlabel(r0b) + vert(0, 0, Zb) vlabel(r0sb) + vert(0, 1, Zb) vlabel(r1b) + vert(0, 2, Zb) vlabel(r2b) + vert(0, 2, Zb) vlabel(r2sb) + vert(0, 3, Zb) vlabel(r3b) + vert(0, 4, Zb) vlabel(r4b) + vert(0, 4, Zb) vlabel(r4sb) + vert(0, 5, Zb) vlabel(r5b) + vert(0, 6, Zb) vlabel(r6b) + vert(0, 6, Zb) vlabel(r6sb) + vert(0, 7, Zb) vlabel(r7b) + + vert(1, 0, Zb) vlabel(rb0b) + vert(1, 1, Zb) vlabel(rb1b) + vert(1, 2, Zb) vlabel(rb2b) + vert(1, 3, Zb) vlabel(rb3b) + vert(1, 4, Zb) vlabel(rb4b) + vert(1, 5, Zb) vlabel(rb5b) + vert(1, 6, Zb) vlabel(rb6b) + vert(1, 7, Zb) vlabel(rb7b) + + vert(2, 0, Zb) vlabel(ri0b) + vert(2, 1, Zb) vlabel(ri1b) + vert(2, 2, Zb) vlabel(ri2b) + vert(2, 3, Zb) vlabel(ri3b) + vert(2, 4, Zb) vlabel(ri4b) + vert(2, 5, Zb) vlabel(ri5b) + vert(2, 6, Zb) vlabel(ri6b) + vert(2, 7, Zb) vlabel(ri7b) + + vert(3, 0, Zb) vlabel(Rb0b) + vert(3, 1, Zb) vlabel(Rb1b) + vert(3, 2, Zb) vlabel(Rb2b) + vert(3, 3, Zb) vlabel(Rb3b) + vert(3, 4, Zb) vlabel(Rb4b) + vert(3, 5, Zb) vlabel(Rb5b) + vert(3, 6, Zb) vlabel(Rb6b) + vert(3, 7, Zb) vlabel(Rb7b) + + vert(4, 0, Zb) vlabel(R0b) + vert(4, 1, Zb) vlabel(R1b) + vert(4, 1, Zb) vlabel(R1sb) + vert(4, 2, Zb) vlabel(R2b) + vert(4, 3, Zb) vlabel(R3b) + vert(4, 3, Zb) vlabel(R3sb) + vert(4, 4, Zb) vlabel(R4b) + vert(4, 5, Zb) vlabel(R5b) + vert(4, 5, Zb) vlabel(R5sb) + vert(4, 6, Zb) vlabel(R6b) + vert(4, 7, Zb) vlabel(R7b) + vert(4, 7, Zb) vlabel(R7sb) + + vert(0, 0, Zt) vlabel(r0t) + vert(0, 0, Zt) vlabel(r0st) + vert(0, 1, Zt) vlabel(r1t) + vert(0, 2, Zt) vlabel(r2t) + vert(0, 2, Zt) vlabel(r2st) + vert(0, 3, Zt) vlabel(r3t) + vert(0, 4, Zt) vlabel(r4t) + vert(0, 4, Zt) vlabel(r4st) + vert(0, 5, Zt) vlabel(r5t) + vert(0, 6, Zt) vlabel(r6t) + vert(0, 6, Zt) vlabel(r6st) + vert(0, 7, Zt) vlabel(r7t) + + vert(1, 0, Zt) vlabel(rb0t) + vert(1, 1, Zt) vlabel(rb1t) + vert(1, 2, Zt) vlabel(rb2t) + vert(1, 3, Zt) vlabel(rb3t) + vert(1, 4, Zt) vlabel(rb4t) + vert(1, 5, Zt) vlabel(rb5t) + vert(1, 6, Zt) vlabel(rb6t) + vert(1, 7, Zt) vlabel(rb7t) + + vert(2, 0, Zt) vlabel(ri0t) + vert(2, 1, Zt) vlabel(ri1t) + vert(2, 2, Zt) vlabel(ri2t) + vert(2, 3, Zt) vlabel(ri3t) + vert(2, 4, Zt) vlabel(ri4t) + vert(2, 5, Zt) vlabel(ri5t) + vert(2, 6, Zt) vlabel(ri6t) + vert(2, 7, Zt) vlabel(ri7t) + + vert(3, 0, Zt) vlabel(Rb0t) + vert(3, 1, Zt) vlabel(Rb1t) + vert(3, 2, Zt) vlabel(Rb2t) + vert(3, 3, Zt) vlabel(Rb3t) + vert(3, 4, Zt) vlabel(Rb4t) + vert(3, 5, Zt) vlabel(Rb5t) + vert(3, 6, Zt) vlabel(Rb6t) + vert(3, 7, Zt) vlabel(Rb7t) + + vert(4, 0, Zt) vlabel(R0t) + vert(4, 1, Zt) vlabel(R1t) + vert(4, 1, Zt) vlabel(R1st) + vert(4, 2, Zt) vlabel(R2t) + vert(4, 3, Zt) vlabel(R3t) + vert(4, 3, Zt) vlabel(R3st) + vert(4, 4, Zt) vlabel(R4t) + vert(4, 5, Zt) vlabel(R5t) + vert(4, 5, Zt) vlabel(R5st) + vert(4, 6, Zt) vlabel(R6t) + vert(4, 7, Zt) vlabel(R7t) + vert(4, 7, Zt) vlabel(R7st) +); + +blocks +( + // block0 + hex2D(r0, r1, rb1, rb0) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(r1, r2s, rb2, rb1) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(r2, r3, rb3, rb2) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(r3, r4s, rb4, rb3) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(r4, r5, rb5, rb4) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(r5, r6s, rb6, rb5) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(r6, r7, rb7, rb6) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(r7, r0s, rb0, rb7) + rotor + (Na Nr Nz) + simpleGrading (1 1 1) + + // block0 + hex2D(rb0, rb1, ri1, ri0) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(rb1, rb2, ri2, ri1) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(rb2, rb3, ri3, ri2) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(rb3, rb4, ri4, ri3) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(rb4, rb5, ri5, ri4) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(rb5, rb6, ri6, ri5) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(rb6, rb7, ri7, ri6) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(rb7, rb0, ri0, ri7) + rotor + (Na Ni Nz) + simpleGrading (1 1 1) + + // block0 + hex2D(ri0, ri1, Rb1, Rb0) + stator + (Na Ni Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(ri1, ri2, Rb2, Rb1) + stator + (Na Ni Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(ri2, ri3, Rb3, Rb2) + stator + (Na Ni Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(ri3, ri4, Rb4, Rb3) + stator + (Na Ni Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(ri4, ri5, Rb5, Rb4) + stator + (Na Ni Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(ri5, ri6, Rb6, Rb5) + stator + (Na Ni Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(ri6, ri7, Rb7, Rb6) + stator + (Na Ni Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(ri7, ri0, Rb0, Rb7) + stator + (Na Ni Nz) + simpleGrading (1 1 1) + + // block0 + hex2D(Rb0, Rb1, R1s, R0) + stator + (Na NR Nz) + simpleGrading (1 1 1) + + // block1 + hex2D(Rb1, Rb2, R2, R1) + stator + (Na NR Nz) + simpleGrading (1 1 1) + + // block2 + hex2D(Rb2, Rb3, R3s, R2) + stator + (Na NR Nz) + simpleGrading (1 1 1) + + // block3 + hex2D(Rb3, Rb4, R4, R3) + stator + (Na NR Nz) + simpleGrading (1 1 1) + + // block4 + hex2D(Rb4, Rb5, R5s, R4) + stator + (Na NR Nz) + simpleGrading (1 1 1) + + // block5 + hex2D(Rb5, Rb6, R6, R5) + stator + (Na NR Nz) + simpleGrading (1 1 1) + + // block6 + hex2D(Rb6, Rb7, R7s, R6) + stator + (Na NR Nz) + simpleGrading (1 1 1) + + // block7 + hex2D(Rb7, Rb0, R0, R7) + stator + (Na NR Nz) + simpleGrading (1 1 1) +); + +edges +( + arc r0b r1b evert(0, 0, Zb) + arc r1b r2sb evert(0, 1, Zb) + arc r2b r3b evert(0, 2, Zb) + arc r3b r4sb evert(0, 3, Zb) + arc r4b r5b evert(0, 4, Zb) + arc r5b r6sb evert(0, 5, Zb) + arc r6b r7b evert(0, 6, Zb) + arc r7b r0sb evert(0, 7, Zb) + + arc rb0b rb1b evert(1, 0, Zb) + arc rb1b rb2b evert(1, 1, Zb) + arc rb2b rb3b evert(1, 2, Zb) + arc rb3b rb4b evert(1, 3, Zb) + arc rb4b rb5b evert(1, 4, Zb) + arc rb5b rb6b evert(1, 5, Zb) + arc rb6b rb7b evert(1, 6, Zb) + arc rb7b rb0b evert(1, 7, Zb) + + arc ri0b ri1b evert(2, 0, Zb) + arc ri1b ri2b evert(2, 1, Zb) + arc ri2b ri3b evert(2, 2, Zb) + arc ri3b ri4b evert(2, 3, Zb) + arc ri4b ri5b evert(2, 4, Zb) + arc ri5b ri6b evert(2, 5, Zb) + arc ri6b ri7b evert(2, 6, Zb) + arc ri7b ri0b evert(2, 7, Zb) + + arc Rb0b Rb1b evert(3, 0, Zb) + arc Rb1b Rb2b evert(3, 1, Zb) + arc Rb2b Rb3b evert(3, 2, Zb) + arc Rb3b Rb4b evert(3, 3, Zb) + arc Rb4b Rb5b evert(3, 4, Zb) + arc Rb5b Rb6b evert(3, 5, Zb) + arc Rb6b Rb7b evert(3, 6, Zb) + arc Rb7b Rb0b evert(3, 7, Zb) + + arc R0b R1sb evert(4, 0, Zb) + arc R1b R2b evert(4, 1, Zb) + arc R2b R3sb evert(4, 2, Zb) + arc R3b R4b evert(4, 3, Zb) + arc R4b R5sb evert(4, 4, Zb) + arc R5b R6b evert(4, 5, Zb) + arc R6b R7sb evert(4, 6, Zb) + arc R7b R0b evert(4, 7, Zb) + + arc r0t r1t evert(0, 0, Zt) + arc r1t r2st evert(0, 1, Zt) + arc r2t r3t evert(0, 2, Zt) + arc r3t r4st evert(0, 3, Zt) + arc r4t r5t evert(0, 4, Zt) + arc r5t r6st evert(0, 5, Zt) + arc r6t r7t evert(0, 6, Zt) + arc r7t r0st evert(0, 7, Zt) + + arc rb0t rb1t evert(1, 0, Zt) + arc rb1t rb2t evert(1, 1, Zt) + arc rb2t rb3t evert(1, 2, Zt) + arc rb3t rb4t evert(1, 3, Zt) + arc rb4t rb5t evert(1, 4, Zt) + arc rb5t rb6t evert(1, 5, Zt) + arc rb6t rb7t evert(1, 6, Zt) + arc rb7t rb0t evert(1, 7, Zt) + + arc ri0t ri1t evert(2, 0, Zt) + arc ri1t ri2t evert(2, 1, Zt) + arc ri2t ri3t evert(2, 2, Zt) + arc ri3t ri4t evert(2, 3, Zt) + arc ri4t ri5t evert(2, 4, Zt) + arc ri5t ri6t evert(2, 5, Zt) + arc ri6t ri7t evert(2, 6, Zt) + arc ri7t ri0t evert(2, 7, Zt) + + arc Rb0t Rb1t evert(3, 0, Zt) + arc Rb1t Rb2t evert(3, 1, Zt) + arc Rb2t Rb3t evert(3, 2, Zt) + arc Rb3t Rb4t evert(3, 3, Zt) + arc Rb4t Rb5t evert(3, 4, Zt) + arc Rb5t Rb6t evert(3, 5, Zt) + arc Rb6t Rb7t evert(3, 6, Zt) + arc Rb7t Rb0t evert(3, 7, Zt) + + arc R0t R1st evert(4, 0, Zt) + arc R1t R2t evert(4, 1, Zt) + arc R2t R3st evert(4, 2, Zt) + arc R3t R4t evert(4, 3, Zt) + arc R4t R5st evert(4, 4, Zt) + arc R5t R6t evert(4, 5, Zt) + arc R6t R7st evert(4, 6, Zt) + arc R7t R0t evert(4, 7, Zt) +); + +patches +( + wall rotor + ( + quad2D(r0, r1) + quad2D(r1, r2s) + quad2D(r2, r3) + quad2D(r3, r4s) + quad2D(r4, r5) + quad2D(r5, r6s) + quad2D(r6, r7) + quad2D(r7, r0s) + + quad2D(r0, rb0) + quad2D(r0s, rb0) + + quad2D(r2, rb2) + quad2D(r2s, rb2) + + quad2D(r4, rb4) + quad2D(r4s, rb4) + + quad2D(r6, rb6) + quad2D(r6s, rb6) + ) + + wall stator + ( + quad2D(R0, R1s) + quad2D(R1, R2) + quad2D(R2, R3s) + quad2D(R3, R4) + quad2D(R4, R5s) + quad2D(R5, R6) + quad2D(R6, R7s) + quad2D(R7, R0) + + quad2D(R1, Rb1) + quad2D(R1s, Rb1) + + quad2D(R3, Rb3) + quad2D(R3s, Rb3) + + quad2D(R5, Rb5) + quad2D(R5s, Rb5) + + quad2D(R7, Rb7) + quad2D(R7s, Rb7) + ) + + empty front + ( + frontQuad(r0, r1, rb1, rb0) + frontQuad(r1, r2s, rb2, rb1) + frontQuad(r2, r3, rb3, rb2) + frontQuad(r3, r4s, rb4, rb3) + frontQuad(r4, r5, rb5, rb4) + frontQuad(r5, r6s, rb6, rb5) + frontQuad(r6, r7, rb7, rb6) + frontQuad(r7, r0s, rb0, rb7) + frontQuad(rb0, rb1, ri1, ri0) + frontQuad(rb1, rb2, ri2, ri1) + frontQuad(rb2, rb3, ri3, ri2) + frontQuad(rb3, rb4, ri4, ri3) + frontQuad(rb4, rb5, ri5, ri4) + frontQuad(rb5, rb6, ri6, ri5) + frontQuad(rb6, rb7, ri7, ri6) + frontQuad(rb7, rb0, ri0, ri7) + frontQuad(ri0, ri1, Rb1, Rb0) + frontQuad(ri1, ri2, Rb2, Rb1) + frontQuad(ri2, ri3, Rb3, Rb2) + frontQuad(ri3, ri4, Rb4, Rb3) + frontQuad(ri4, ri5, Rb5, Rb4) + frontQuad(ri5, ri6, Rb6, Rb5) + frontQuad(ri6, ri7, Rb7, Rb6) + frontQuad(ri7, ri0, Rb0, Rb7) + frontQuad(Rb0, Rb1, R1s, R0) + frontQuad(Rb1, Rb2, R2, R1) + frontQuad(Rb2, Rb3, R3s, R2) + frontQuad(Rb3, Rb4, R4, R3) + frontQuad(Rb4, Rb5, R5s, R4) + frontQuad(Rb5, Rb6, R6, R5) + frontQuad(Rb6, Rb7, R7s, R6) + frontQuad(Rb7, Rb0, R0, R7) + ) + + empty back + ( + backQuad(r0, r1, rb1, rb0) + backQuad(r1, r2s, rb2, rb1) + backQuad(r2, r3, rb3, rb2) + backQuad(r3, r4s, rb4, rb3) + backQuad(r4, r5, rb5, rb4) + backQuad(r5, r6s, rb6, rb5) + backQuad(r6, r7, rb7, rb6) + backQuad(r7, r0s, rb0, rb7) + backQuad(rb0, rb1, ri1, ri0) + backQuad(rb1, rb2, ri2, ri1) + backQuad(rb2, rb3, ri3, ri2) + backQuad(rb3, rb4, ri4, ri3) + backQuad(rb4, rb5, ri5, ri4) + backQuad(rb5, rb6, ri6, ri5) + backQuad(rb6, rb7, ri7, ri6) + backQuad(rb7, rb0, ri0, ri7) + backQuad(ri0, ri1, Rb1, Rb0) + backQuad(ri1, ri2, Rb2, Rb1) + backQuad(ri2, ri3, Rb3, Rb2) + backQuad(ri3, ri4, Rb4, Rb3) + backQuad(ri4, ri5, Rb5, Rb4) + backQuad(ri5, ri6, Rb6, Rb5) + backQuad(ri6, ri7, Rb7, Rb6) + backQuad(ri7, ri0, Rb0, Rb7) + backQuad(Rb0, Rb1, R1s, R0) + backQuad(Rb1, Rb2, R2, R1) + backQuad(Rb2, Rb3, R3s, R2) + backQuad(Rb3, Rb4, R4, R3) + backQuad(Rb4, Rb5, R5s, R4) + backQuad(Rb5, Rb6, R6, R5) + backQuad(Rb6, Rb7, R7s, R6) + backQuad(Rb7, Rb0, R0, R7) + ) +); + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary new file mode 100644 index 0000000000..292f25b806 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +4 +( + rotor + { + type wall; + nFaces 192; + startFace 5952; + } + stator + { + type wall; + nFaces 192; + startFace 6144; + } + front + { + type empty; + nFaces 3072; + startFace 6336; + } + back + { + type empty; + nFaces 3072; + startFace 9408; + } +) + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porousZones b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porousZones new file mode 100644 index 0000000000..e7986b4d34 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porousZones @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object porousZones; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +1 +( + stator + { + coordinateSystem + { + e1 (1 0 0); + e2 (0 1 0); + } + + Darcy + { + d d [0 -2 0 0 0 0 0] (1e5 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + } + } +) + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/thermophysicalProperties b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/thermophysicalProperties new file mode 100644 index 0000000000..a2c84a89d3 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/thermophysicalProperties @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType hPsiThermo>>>>; + +mixture air 1 28.9 1007 0 1.4792e-06 116; + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/transportProperties b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/transportProperties new file mode 100644 index 0000000000..36e9669391 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/transportProperties @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu nu [ 0 2 -1 0 0 0 0 ] 1e-05; + +CrossPowerLawCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 1; +} + +BirdCarreauCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 0; + n n [ 0 0 0 0 0 0 0 ] 1; +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/turbulenceProperties b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/turbulenceProperties new file mode 100644 index 0000000000..f6753662e2 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh new file mode 100755 index 0000000000..91a75f1c48 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh @@ -0,0 +1,5 @@ +#!/bin/sh +set -x + +m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict +blockMesh >& log.blockMesh diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/controlDict b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/controlDict new file mode 100644 index 0000000000..b79e14b234 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/controlDict @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application rhoPorousMRFPimpleFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.1; + +deltaT 1e-5; + +writeControl adjustableRunTime; + +writeInterval 1e-2; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 1; + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict new file mode 100644 index 0000000000..d4c9e00065 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object faceSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +name rotor; + +action delete; + +topoSetSources ( boundaryToFace { } ); + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict_noBoundaryFaces b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict_noBoundaryFaces new file mode 100644 index 0000000000..38fa0208ed --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict_noBoundaryFaces @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object faceSetDict_noBoundaryFaces; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +name rotor; + +action delete; + +topoSetSources ( boundaryToFace { } ); + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict_rotorFaces b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict_rotorFaces new file mode 100644 index 0000000000..3ccb7ad761 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/faceSetDict_rotorFaces @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object faceSetDict_rotorFaces; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +name rotor; + +action new; + +topoSetSources ( cellToFace { set rotor ; option all ; } ); + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes new file mode 100644 index 0000000000..2d1d7ea99d --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss limitedLinearV 1; + div(phi,h) Gauss limitedLinear 1; + div(phi,k) Gauss limitedLinear 1; + div(phi,epsilon) Gauss limitedLinear 1; + div((muEff*dev2(grad(U).T()))) Gauss linear; + div(phiU,p) Gauss linear; +} + +laplacianSchemes +{ + default none; + laplacian(muEff,U) Gauss linear corrected; + laplacian((rho*(1|A(U))),p) Gauss linear corrected; + laplacian(alphaEff,h) Gauss linear corrected; + laplacian(DkEff,k) Gauss linear corrected; + laplacian(DepsilonEff,epsilon) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(U) linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p ; +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution new file mode 100644 index 0000000000..70ef25731d --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution @@ -0,0 +1,121 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + rho + { + solver PCG; + preconditioner DIC; + tolerance 1e-5; + relTol 0; + } + + U + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-5; + relTol 0.1; + } + + UFinal + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-5; + relTol 0; + } + + p + { + solver GAMG; + tolerance 1e-6; + relTol 0.05; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } + + pFinal + { + solver GAMG; + tolerance 1e-6; + relTol 0; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 20; + agglomerator faceAreaPair; + mergeLevels 1; + } + + h + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-5; + relTol 0.1; + } + + hFinal + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-5; + relTol 0; + } + + k + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-5; + relTol 0; + } + + epsilon + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-5; + relTol 0; + } +} + +PIMPLE +{ + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + momentumPredictor yes; + pMin pMin [ 1 -1 -2 0 0 0 0 ] 1000; + pRefCell 0; + pRefValue 1e5; +} + +relaxationFactors +{ + U 1; + h 1; + k 1; + epsilon 1; +} + + +// ************************************************************************* // From d1dada5dfdfdb8d667900495977f073736fec7b9 Mon Sep 17 00:00:00 2001 From: henry Date: Fri, 19 Mar 2010 17:56:11 +0000 Subject: [PATCH 07/20] Removed unnecessary operations. --- .../incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh index b4fc1a22ef..91a75f1c48 100755 --- a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh +++ b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh @@ -3,11 +3,3 @@ set -x m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict blockMesh >& log.blockMesh -cellSet >& log.cellSet - -#- MRF determines its own faceZone if not supplied -#cp system/faceSetDict_rotorFaces system/faceSetDict -#faceSet -#cp system/faceSetDict_noBoundaryFaces system/faceSetDict -#faceSet -setsToZones -noFlipMap >& log.setsToZones From 01f8538e27ecf18ff80c0030f62bcdebe765d7d0 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 Mar 2010 18:57:09 +0100 Subject: [PATCH 08/20] ENH: ignore empty zones in paraview reader --- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H | 11 ++++- .../vtkPV3Foam/vtkPV3FoamUpdateInfo.C | 44 ++++++++++++++----- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 577edfc310..9febbad6f8 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -356,8 +356,15 @@ class vtkPV3Foam //- Zone info void updateInfoZones(vtkDataArraySelection*); - //- Read zone names for zoneType from file - wordList readZoneNames(const word& zoneType); + //- Get non-empty zone names for zoneType from file + wordList getZoneNames(const word& zoneType) const; + + //- Get non-empty zone names from mesh info + template + wordList getZoneNames + ( + const ZoneMesh& + ) const; //- Add objects of Type to paraview array selection template diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C index f83be3ee15..bdac311fcd 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C @@ -82,9 +82,31 @@ public: // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType) +template +Foam::wordList Foam::vtkPV3Foam::getZoneNames +( + const ZoneMesh& 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 IOobject ioObj @@ -107,14 +129,14 @@ Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType) { zonesEntries zones(ioObj); - zoneNames.setSize(zones.size()); + names.setSize(zones.size()); 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_) { - namesLst = meshPtr_->cellZones().names(); + namesLst = getZoneNames(meshPtr_->cellZones()); } else { - namesLst = readZoneNames("cellZones"); + namesLst = getZoneNames("cellZones"); } arrayRangeCellZones_.reset(arraySelection->GetNumberOfArrays()); @@ -335,11 +357,11 @@ void Foam::vtkPV3Foam::updateInfoZones // ~~~~~~~~~~~~~~~~~~~~~ if (meshPtr_) { - namesLst = meshPtr_->faceZones().names(); + namesLst = getZoneNames(meshPtr_->faceZones()); } else { - namesLst = readZoneNames("faceZones"); + namesLst = getZoneNames("faceZones"); } arrayRangeFaceZones_.reset(arraySelection->GetNumberOfArrays()); @@ -358,11 +380,11 @@ void Foam::vtkPV3Foam::updateInfoZones // ~~~~~~~~~~~~~~~~~~~~~~ if (meshPtr_) { - namesLst = meshPtr_->pointZones().names(); + namesLst = getZoneNames(meshPtr_->pointZones()); } else { - namesLst = readZoneNames("pointZones"); + namesLst = getZoneNames("pointZones"); } arrayRangePointZones_.reset(arraySelection->GetNumberOfArrays()); From d978c79e7091e64977bc77bcc6bd760ed82e44cd Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 Mar 2010 19:29:19 +0100 Subject: [PATCH 09/20] STYLE: drop unneeded MPI_HOME for openmpi (uses OPAL_PREFIX) COMP: drop gcc-4.2 settings --- etc/settings.csh | 6 +----- etc/settings.sh | 6 +----- src/parallel/decompose/Allwmake | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/etc/settings.csh b/etc/settings.csh index 058e7860ee..4c62006177 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -97,9 +97,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/gmp-4.2.4/lib breaksw - case Gcc42: - setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.2.4 - breaksw endsw # Check that the compiler directory can be found @@ -123,12 +120,11 @@ endsw # Communications library # ~~~~~~~~~~~~~~~~~~~~~~ -unsetenv MPI_ARCH_PATH +unsetenv MPI_ARCH_PATH MPI_HOME switch ("$WM_MPLIB") case OPENMPI: 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 # Tell OpenMPI where to find its install directory diff --git a/etc/settings.sh b/etc/settings.sh index 085744fead..73145ca507 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -130,9 +130,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/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 # Check that the compiler directory can be found @@ -164,12 +161,11 @@ unset compilerBin compilerLib compilerMan compilerInstall # Communications library # ~~~~~~~~~~~~~~~~~~~~~~ -unset MPI_ARCH_PATH +unset MPI_ARCH_PATH MPI_HOME case "$WM_MPLIB" in OPENMPI) 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 # Tell OpenMPI where to find its install directory diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index 2adc739cf1..69a8fff0ee 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -9,7 +9,7 @@ wmake libso metisDecomp if [ -d "$FOAM_MPI_LIBBIN" ] then - ( WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB; wmake libso parMetisDecomp ) + WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB wmake libso parMetisDecomp fi wmake libso decompositionMethods From 4326096153d51a1a162873843f0a20b050242353 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 Mar 2010 20:02:05 +0100 Subject: [PATCH 10/20] STYLE: cleanup some shell script syntax --- bin/foamEndJob | 106 ++++++++++++------- bin/foamJob | 265 +++++++++++++++++++++++++----------------------- bin/mpirunDebug | 151 +++++++++++++++------------ 3 files changed, 289 insertions(+), 233 deletions(-) diff --git a/bin/foamEndJob b/bin/foamEndJob index f82f7409ce..ba213c86aa 100755 --- a/bin/foamEndJob +++ b/bin/foamEndJob @@ -85,7 +85,8 @@ setRawEntry() { oldLine=`echo "$oldNumLine" | sed -e 's/^[^:]*://'` oldKey=`getKey "$oldLine"` 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 "oldKey=$oldKey" echo "lineNo=$lineNo" @@ -134,9 +135,12 @@ getBoolEntry() } # newerFile file1 file2 -newerFile() { +# ... could also use if [ $file1 -nt $file2 ] ... +newerFile() +{ latest=`ls -1 -t $1 $2 2> /dev/null | head -1` - if [ "$latest" = $1 ]; then + if [ "$latest" = $1 ] + then return 0 else return 1 @@ -149,8 +153,8 @@ processExists() { ps -u $LOGNAME -o 'pid' | fgrep $1 >/dev/null } -printUsage() { -cat << USAGELABEL +usage() { +cat << USAGE Usage: $PROGNAME [-n] or $PROGNAME -c @@ -165,7 +169,8 @@ finish. Restores original controlDict if The -c option clears any outstanding $PROGNAME for the case. -USAGELABEL +USAGE + exit 1 } @@ -174,7 +179,8 @@ restoreDict() { trap 2 3 15 echo "$PROGNAME : Restoring controlDict from controlDict_bak." - if [ -r ${controlDict}_bak ]; then + if [ -r ${controlDict}_bak ] + then cp ${controlDict}_bak $controlDict fi @@ -208,61 +214,69 @@ esac # # Initial checks # -if [ $# -lt 3 ]; then - printUsage - exit 1 +if [ $# -lt 3 ] +then + usage fi + STOPNOW='' -if [ $1 = '-n' ]; then +if [ $1 = '-n' ] +then STOPNOW='yes' shift fi CLEAR='' -if [ $1 = '-c' ]; then +if [ $1 = '-c' ] +then CLEAR='yes' shift - if [ $# -ne 2 ]; then - printUsage - exit 1 + if [ $# -ne 2 ] + then + usage fi ROOT=$1 CASE=$2 else - if [ $# -ne 3 ]; then - printUsage - exit 1 + if [ $# -ne 3 ] + then + usage fi ROOT=$1 CASE=$2 PID=$3 fi -CASE=`echo $CASE | sed -e 's!/.*!!'` #strip of processorXXX ending +CASE=`echo $CASE | sed -e 's!/.*!!'` # strip of processorXXX ending #- Pid actually running -if [ ! "$CLEAR" ]; then +if [ ! "$CLEAR" ] +then processExists $PID - if [ $? -ne 0 ] ;then + if [ $? -ne 0 ] + then echo "$PROGNAME : process $PID not running." exit 1 fi fi #- case directory writeable -if [ ! -w $ROOT/$CASE ]; then +if [ ! -w $ROOT/$CASE ] +then echo "$PROGNAME : $ROOT/$CASE is not writeable." exit 1 fi #- Controldict writeable controlDict=$ROOT/$CASE/system/controlDict -if [ ! -w $controlDict ]; then +if [ ! -w $controlDict ] +then echo "$PROGNAME : $controlDict is not writeable." exit 1 fi #- runTimeModifiable getBoolEntry $controlDict 'runTimeModifiable' -if [ $? -ne 0 ]; then +if [ $? -ne 0 ] +then echo "$PROGNAME : runTimeModifiable not true in dictionary $controlDict." exit 1 fi @@ -270,12 +284,14 @@ fi # #- Check if another foamEndJob running # -if [ "$CLEAR" ]; then +if [ "$CLEAR" ] +then pidFiles=`ls $ROOT/$CASE/.foamEndJob* 2>/dev/null` for pidFile in $pidFiles do pid=`cat $pidFile` - if [ "$pid" ]; then + if [ "$pid" ] + then echo "$PROGNAME : found $PROGNAME (pid $pid) for Foam process" echo " root: $ROOT" echo " case: $CASE" @@ -288,11 +304,14 @@ if [ "$CLEAR" ]; then fi pidFile=$ROOT/$CASE/.foamEndJob${PID} -if [ -f $pidFile ]; then +if [ -f $pidFile ] +then pid=`cat $pidFile` - if [ "$pid" ]; then + if [ "$pid" ] + then processExists $pid - if [ $? -eq 0 ] ;then + if [ $? -eq 0 ] + then echo "$PROGNAME : found running $PROGNAME (pid $pid) for Foam process" echo " root: $ROOT" echo " case: $CASE" @@ -314,28 +333,32 @@ echo $$ > $pidFile #- startTime startTime=`getEntry $controlDict 'startTime'` -if [ ! "$startTime" ]; then +if [ ! "$startTime" ] +then echo "$PROGNAME : startTime not set in dictionary $controlDict." exit 1 fi #- Write interval writeInterval=`getEntry $controlDict 'writeInterval'` -if [ ! "$writeInterval" ]; then +if [ ! "$writeInterval" ] +then echo "$PROGNAME : writeInterval not set in dictionary $controlDict." exit 1 fi #- stopAt stopAt=`getEntry $controlDict 'stopAt'` -if [ ! "$stopAt" ]; then +if [ ! "$stopAt" ] +then echo "$PROGNAME : stopAt not set in dictionary $controlDict." exit 1 fi #- endTime endTime=`getEntry $controlDict 'endTime'` -if [ ! "$endTime" ]; then +if [ ! "$endTime" ] +then echo "$PROGNAME : endTime not set in dictionary $controlDict." exit 1 fi @@ -353,7 +376,8 @@ cp $controlDict ${controlDict}_bak #- Set up handler to restore controlDict trap restoreDict 2 3 15 -if [ "$STOPNOW" ]; then +if [ "$STOPNOW" ] +then setRawEntry $controlDict 'stopAt' 'nextWrite' setRawEntry $controlDict 'writeInterval' '1' @@ -385,7 +409,8 @@ if newerFile ${controlDict} ${controlDict}_bak; then iter=0 while newerFile ${controlDict} ${controlDict}_bak do - if [ $iter -ge 120 ]; then + if [ $iter -ge 120 ] + then #- 120*5 sec = 10 mins passed. Give up echo "$PROGNAME : File date not yet ok after 10 mins. Giving up." break @@ -412,22 +437,25 @@ while true do sleep 5 - if [ ! -r ${controlDict}_bak ]; then + if [ ! -r ${controlDict}_bak ] + then echo "$PROGNAME : ${controlDict}_bak dissappeared. Exiting without restore." exit 1 fi - if newerFile ${controlDict} ${controlDict}_bak; then + if newerFile ${controlDict} ${controlDict}_bak + then echo "$PROGNAME : ${controlDict} modified externally. Exiting without restore." exit 0 fi processExists $PID - if [ $? -ne 0 ] ;then + if [ $? -ne 0 ] + then #- Job finished break fi - #echo "Foam job $PID still running ..." + # echo "Foam job $PID still running ..." done #- Dictionary restore diff --git a/bin/foamJob b/bin/foamJob index ca51fb6074..612d003fbe 100755 --- a/bin/foamJob +++ b/bin/foamJob @@ -30,14 +30,14 @@ # #------------------------------------------------------------------------------ usage() { - while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat< ... options: -case specify alternative case directory, default is the cwd - -s also sends output to screen -p parallel run of processors + -s also sends output to screen -v specify OpenFOAM version -help print the usage @@ -45,56 +45,46 @@ options: Redirects the output to 'log' in the case directory USAGE - exit 1 + exit 1 } unset version # replacement for possibly buggy 'which' findExec() { - case "$1" in - */*) - if [ -x "$1" ] ; then - echo "$1" - return 0 - fi - ;; - esac + case "$1" in + */*) + if [ -x "$1" ] + then + echo "$1" + return 0 + fi + ;; + esac - oldIFS=$IFS - IFS=':' - for d in $PATH - do - # echo "testing: $d/$1" 1>&2 - if [ -x "$d/$1" -a ! -d "$d/$1" ] ; then - # echo "Found exec: $d/$1" 1>&2 - IFS=$oldIFS - echo "$d/$1" - return 0 - fi - done - IFS=$oldIFS - echo "" - return 1 -} - -# grep for $1 -getPID() { - ps -u $LOGNAME -o 'pid,args' | fgrep "$1 " | fgrep -v grep | head -1 | awk '{ print $1 }' + oldIFS=$IFS + IFS=':' + for d in $PATH + do + # echo "testing: $d/$1" 1>&2 + if [ -x "$d/$1" -a ! -d "$d/$1" ] + then + # echo "Found exec: $d/$1" 1>&2 + IFS=$oldIFS + echo "$d/$1" + return 0 + fi + done + IFS=$oldIFS + echo "" + return 1 } -consultGuide() { -cat</dev/null || usage "directory does not exist: '$caseDir'" ;; - -s) - SCREEN=yes + -p) + parallelOpt=true shift ;; - -p) - PARALLEL=yes + -s) + screenOpt=true shift ;; -v) @@ -136,100 +126,119 @@ do esac done -if [ "$#" -lt 1 ]; then - usage "No application specified" +if [ "$#" -lt 1 ] +then + usage "No application specified" fi # use foamExec for a specified version and for remote (parallel) runs -if [ -n "$version" -o "$PARALLEL" = yes ]; then - APPLICATION=`findExec foamExec` - if [ $? -ne 0 ]; then - usage "'foamExec' not found" - fi - if [ -n "$version" ]; then - APPLICATION="$APPLICATION -v $version" - fi +if [ -n "$version" -o "$parallelOpt" = true ] +then + APPLICATION=`findExec foamExec` + if [ $? -ne 0 ] + then + usage "'foamExec' not found" + fi + if [ -n "$version" ] + then + APPLICATION="$APPLICATION -v $version" + fi else - APPLICATION=`findExec $1` - if [ $? -ne 0 ]; then - usage "Application '$1' executable not found" - fi - echo "Application : $1" - shift + APPLICATION=`findExec $1` + if [ $? -ne 0 ] + then + usage "Application '$1' executable not found" + fi + echo "Application : $1" + shift fi -if [ "$PARALLEL" = no ]; then -# -# RUN ON SINGLE PROCESSOR -# - if [ "$SCREEN" = no ]; then - echo "Executing: $APPLICATION $@ > log 2>&1 &" - $APPLICATION $@ > log 2>&1 & + +if [ "$parallelOpt" = true ] +then + # parallel + # ~~~~~~~~ + + # + # is the case decomposed? + # + if [ -r "processor0" ] + then + NPROCS="`/bin/ls -1d processor* | wc -l`" else - echo "Executing: $APPLICATION $@ | tee log &" - $APPLICATION $@ | tee log & - wait $! + 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." + 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 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 #------------------------------------------------------------------------------ diff --git a/bin/mpirunDebug b/bin/mpirunDebug index 6869e64e30..1588265866 100755 --- a/bin/mpirunDebug +++ b/bin/mpirunDebug @@ -40,34 +40,39 @@ else fi -printUsage() { - echo "" - echo "Usage: ${0##*/} -np
" - echo "" - echo "This will run like mpirun but with each process in an xterm" +usage() +{ + cat< + +* This will run like mpirun but with each process in an XTerm + +USAGE + exit 1 } -nProcs='' -exec='' -args='' +unset nProcs exec args -while [ "$1" != "" ]; do +while [ "$1" != "" ] +do echo "$1" case $1 in - -np) + -np) nProcs=$2 shift ;; - *) - if [ ! "$exec" ]; then + *) + if [ ! "$exec" ] + then exec=$1 - elif [ ! "$args" ]; then + elif [ ! "$args" ] + then args="\"$1\"" else args="$args \"$1\"" fi ;; - esac shift done @@ -76,27 +81,19 @@ echo "nProcs=$nProcs" echo "exec=$exec" echo "args=$args" -if [ ! "$nProcs" ]; then - printUsage - exit 1 -fi -if [ ! "$args" ]; then - printUsage - exit 1 -fi -if [ ! "$exec" ]; then - printUsage - exit 1 -fi +[ "$nProcs" ] || usage +[ "$args" ] || usage +[ "$exec" ] || usage exec=`which $exec` -if [ ! -x "$exec" ]; then +if [ ! -x "$exec" ] +then echo "Cannot find executable $exec or is not executable" - printUsage - exit 1 + usage fi -if [ ! "$PWD" ]; then +if [ ! "$PWD" ] +then PWD=`pwd` 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" 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 - printUsage - exit 1 -fi +case "$method" in +0 | 1 | 2 | 3 | 4 | 5 ) + # okay + ;; +*) + usage + ;; +esac $ECHO "Run all processes local or distributed? 1)local 2)remote: \c" read spawn -if [ "$spawn" -ne 1 -a "$spawn" -ne 2 ]; then - printUsage - exit 1 +if [ "$spawn" -ne 1 -a "$spawn" -ne 2 ] +then + usage fi + # check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ # check ~/.$WM_PROJECT/ # check /etc/ -if [ "$WM_PROJECT" ]; then +if [ "$WM_PROJECT" ] +then - for i in \ - $HOME/.WM_PROJECT/$WM_PROJECT_VERSION \ - $HOME/.WM_PROJECT \ - $WM_PROJECT_DIR/etc \ - ; - do - if [ -f "$i/bashrc" ]; then - sourceFoam="$i/bashrc" - break - fi - done + for i in \ + $HOME/.WM_PROJECT/$WM_PROJECT_VERSION \ + $HOME/.WM_PROJECT \ + $WM_PROJECT_DIR/etc \ + ; + do + if [ -f "$i/bashrc" ] + then + sourceFoam="$i/bashrc" + break + fi + done fi # Construct test string for remote execution. # Source OpenFOAM settings if OpenFOAM environment not set. # attempt to preserve the installation directory 'FOAM_INST_DIR' -if [ "$FOAM_INST_DIR" ]; then - sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam" +if [ "$FOAM_INST_DIR" ] +then + sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam" else - sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam" + sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam" fi echo "**sourceFoam:$sourceFoam" @@ -160,36 +165,45 @@ do geom="-geometry 120x20+$xpos+$ypos" node="" - if [ .$WM_MPLIB = .OPENMPI ]; then + if [ "$WM_MPLIB" = OPENMPI ] + then node="-np 1 " fi echo "#!/bin/sh" > $procCmdFile - if [ "$method" -eq 0 ]; then + case "$method" in + 0) echo "$sourceFoam; cd $PWD; $exec $args | tee $procLog" >> $procCmdFile 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; $exec $args; read dummy" >> $procCmdFile 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 "${node}$procCmdFile" >> $PWD/mpirun.schema - elif [ "$method" -eq 3 ]; then + ;; + 3) echo "$sourceFoam; cd $PWD; $exec $args >& $procLog" >> $procCmdFile 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 "${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 "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema - fi + ;; + esac chmod +x $procCmdFile let column=proc%6 - if [ $proc -ne 0 -a $column -eq 0 ]; then + if [ $proc -ne 0 -a $column -eq 0 ] + then ((xpos+=600)) ((ypos=0)) else @@ -203,10 +217,13 @@ do echo " tail -f $procLog" done -cmd="" -if [ .$WM_MPLIB = .OPENMPI ]; then +unset cmd + +case "$WM_MPLIB" in +OPENMPI) cmd="mpirun -app $PWD/mpirun.schema $procXtermCmdFile echo "$procCmd" >> $procXtermCmdFile chmod +x $procXtermCmdFile - if [ $proc -ne 0 ]; then + if [ $proc -ne 0 ] + then cmd="${cmd} :" fi cmd="${cmd} -n 1 ${procXtermCmdFile}" done < $PWD/mpirun.schema -fi + ;; +esac echo "Constructed $PWD/mpirun.schema file." echo "" From 6680ddcfee989961dcecb3101c2dc5c32b3648bb Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 22 Mar 2010 10:31:37 +0000 Subject: [PATCH 11/20] ENH: Reuse existing zones. --- .../mesh/manipulation/stitchMesh/stitchMesh.C | 184 ++++++++++++------ 1 file changed, 123 insertions(+), 61 deletions(-) diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C index b382a79d0d..8034fe5b9b 100644 --- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C +++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C @@ -68,6 +68,104 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +label addPointZone(const polyMesh& mesh, const word& name) +{ + label zoneID = mesh.pointZones().findZoneID(name); + + if (zoneID != -1) + { + Info<< "Reusing existing pointZone " + << mesh.pointZones()[zoneID].name() + << " at index " << zoneID << endl; + } + else + { + pointZoneMesh& pointZones = const_cast(mesh).pointZones(); + zoneID = pointZones.size(); + Info<< "Adding pointZone " << name << " at index " << zoneID << endl; + + pointZones.setSize(zoneID+1); + pointZones.set + ( + zoneID, + new pointZone + ( + name, + labelList(0), + zoneID, + pointZones + ) + ); + } + return zoneID; +} + + +label addFaceZone(const polyMesh& mesh, const word& name) +{ + label zoneID = mesh.faceZones().findZoneID(name); + + if (zoneID != -1) + { + Info<< "Reusing existing faceZone " << mesh.faceZones()[zoneID].name() + << " at index " << zoneID << endl; + } + else + { + faceZoneMesh& faceZones = const_cast(mesh).faceZones(); + zoneID = faceZones.size(); + Info<< "Adding faceZone " << name << " at index " << zoneID << endl; + + faceZones.setSize(zoneID+1); + faceZones.set + ( + zoneID, + new faceZone + ( + name, + labelList(0), + boolList(), + zoneID, + faceZones + ) + ); + } + return zoneID; +} + + +label addCellZone(const polyMesh& mesh, const word& name) +{ + label zoneID = mesh.cellZones().findZoneID(name); + + if (zoneID != -1) + { + Info<< "Reusing existing cellZone " << mesh.cellZones()[zoneID].name() + << " at index " << zoneID << endl; + } + else + { + cellZoneMesh& cellZones = const_cast(mesh).cellZones(); + zoneID = cellZones.size(); + Info<< "Adding cellZone " << name << " at index " << zoneID << endl; + + cellZones.setSize(zoneID+1); + cellZones.set + ( + zoneID, + new cellZone + ( + name, + labelList(0), + zoneID, + cellZones + ) + ); + } + return zoneID; +} + + // Checks whether patch present void checkPatch(const polyBoundaryMesh& bMesh, const word& name) { @@ -211,29 +309,20 @@ int main(int argc, char *argv[]) polyTopoChanger stitcher(mesh); stitcher.setSize(1); - DynamicList pz; - DynamicList fz; - DynamicList cz; + mesh.pointZones().clearAddressing(); + mesh.faceZones().clearAddressing(); + mesh.cellZones().clearAddressing(); if (perfectCover) { // Add empty zone for resulting internal faces - fz.append - ( - new faceZone - ( - cutZoneName, - isf, - boolList(masterPatch.size(), false), - 0, - mesh.faceZones() - ) - ); + label cutZoneID = addFaceZone(mesh, cutZoneName); - // Note: make sure to add the zones BEFORE constructing polyMeshModifier - // (since looks up various zones at construction time) - Info<< "Adding point and face zones" << endl; - mesh.addZones(pz.shrink(), fz.shrink(), cz.shrink()); + mesh.faceZones()[cutZoneID].resetAddressing + ( + isf, + boolList(masterPatch.size(), false) + ); // Add the perfect interface mesh modifier stitcher.set @@ -252,27 +341,15 @@ int main(int argc, char *argv[]) } else { - pz.append - ( - new pointZone - ( - mergePatchName + "CutPointZone", - labelList(0), - 0, - mesh.pointZones() - ) - ); + label pointZoneID = addPointZone(mesh, mergePatchName + "CutPointZone"); + mesh.pointZones()[pointZoneID] = labelList(0); - fz.append + label masterZoneID = addFaceZone(mesh, mergePatchName + "MasterZone"); + + mesh.faceZones()[masterZoneID].resetAddressing ( - new faceZone - ( - mergePatchName + "MasterZone", - isf, - boolList(masterPatch.size(), false), - 0, - mesh.faceZones() - ) + isf, + boolList(masterPatch.size(), false) ); // Slave patch @@ -284,42 +361,27 @@ int main(int argc, char *argv[]) labelList osf(slavePatch.size()); - forAll(osf, i) + forAll (osf, i) { osf[i] = slavePatch.start() + i; } - fz.append + label slaveZoneID = addFaceZone(mesh, mergePatchName + "SlaveZone"); + mesh.faceZones()[slaveZoneID].resetAddressing ( - new faceZone - ( - mergePatchName + "SlaveZone", - osf, - boolList(slavePatch.size(), false), - 1, - mesh.faceZones() - ) + osf, + boolList(slavePatch.size(), false) ); // Add empty zone for cut faces - fz.append + label cutZoneID = addFaceZone(mesh, cutZoneName); + mesh.faceZones()[cutZoneID].resetAddressing ( - new faceZone - ( - cutZoneName, - labelList(0), - boolList(0, false), - 2, - mesh.faceZones() - ) + labelList(0), + boolList(0, false) ); - // Note: make sure to add the zones BEFORE constructing polyMeshModifier - // (since looks up various zones at construction time) - Info<< "Adding point and face zones" << endl; - mesh.addZones(pz.shrink(), fz.shrink(), cz.shrink()); - // Add the sliding interface mesh modifier stitcher.set ( From 09a986a89aca513182b66cd900fd0bf72839a135 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 22 Mar 2010 10:32:13 +0000 Subject: [PATCH 12/20] STYLE: Remove unused static variable --- .../mesh/manipulation/mirrorMesh/mirrorFvMesh.C | 14 -------------- .../mesh/manipulation/mirrorMesh/mirrorFvMesh.H | 6 ------ 2 files changed, 20 deletions(-) diff --git a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C index 52735eb41a..fa8d5c780e 100644 --- a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C +++ b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C @@ -28,20 +28,6 @@ License #include "Time.H" #include "plane.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -const Foam::label Foam::mirrorFvMesh::cellRenumber[8][8] = -{ - {-1, -1, -1, -1, -1, -1, -1, -1}, // unknown - {-1, -1, -1, -1, -1, -1, -1, -1}, // - {-1, -1, -1, -1, -1, -1, -1, -1}, // - { 0, 3, 2, 1, 4, 7, 6, 5}, // hex - { 2, 1, 0, 5, 4, 3, 6, -1}, // wedge - { 0, 2, 1, 3, 5, 4, -1, -1}, // prism - { 0, 3, 2, 1, 4, -1, -1, -1}, // pyramid - { 2, 1, 0, 3, -1, -1, -1, -1}, // tet -}; - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io) diff --git a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.H b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.H index fd3903d6ad..01033c963c 100644 --- a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.H +++ b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.H @@ -71,12 +71,6 @@ class mirrorFvMesh public: - // Static data - - //- Cell renumnering table - static const label cellRenumber[8][8]; - - // Constructors //- Construct from IOobject From 9d42286a22eef5f39d911d78188ad72791690379 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 22 Mar 2010 15:04:06 +0100 Subject: [PATCH 13/20] ENH: add missing operator/ for 'one' class --- src/OpenFOAM/primitives/one/oneI.H | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/primitives/one/oneI.H b/src/OpenFOAM/primitives/one/oneI.H index 2d0a006be9..8393af5ff2 100644 --- a/src/OpenFOAM/primitives/one/oneI.H +++ b/src/OpenFOAM/primitives/one/oneI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,6 +52,13 @@ inline Type operator/(const one&, const Type& t) } +template +inline const Type& operator/(const Type& t, const one&) +{ + return t; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam From fe083ad9f14f3100a46409cd117695a2bac05c14 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 22 Mar 2010 15:04:29 +0100 Subject: [PATCH 14/20] ENH: Update qt information in README --- README | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/README b/README index 52fba8b216..dbb820aad3 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ # #+TITLE: OpenFOAM README for version 1.6 #+AUTHOR: OpenCFD Ltd. -#+DATE: November 2009 +#+DATE: March 2010 #+LINK: http://www.opencfd.co.uk #+OPTIONS: author:nil ^:{} @@ -23,10 +23,10 @@ section "Running OpenFOAM in 32-bit mode". *** 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 - supported on Qt version 4.3.x. However, we have found in limited tests that - ParaView works satisfactorily with newer versions of Qt than 4.3.x. To + supported on Qt version 4.6.x. However, we have found in limited tests that + ParaView works satisfactorily with Qt than 4.5.x. To check whether Qt4 is installed, and the version, type: + qmake --version @@ -44,13 +44,14 @@ + openSUSE-10.3: Version 4.3.1 + openSUSE-11.0: Version 4.4.0 + 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 downloaded in the "libqt4-dev" package on ubuntu. If you don't have an appropriate version of Qt installed you can download - the sources from TrollTech e.g.: - ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.5.tar.bz2 + the sources e.g.: + 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 conflict with the pre-installed version. @@ -108,7 +109,7 @@ * Building from Sources (Optional) 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 - 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/. Install the compiler in @@ -157,16 +158,16 @@ Refer to the OpenFOAM User Guide at http://www.OpenFOAM.org/doc/user.html for 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 compile ParaView from sources. The compilation is a fairly simple process using the makeParaView script (found in ThirdParty directory), which has worked in our tests with other - packages supplied in the ThirdParty directory, namely cmake-2.6.4 and - gcc-4.3.3. Execute the following: + packages supplied in the ThirdParty directory, namely cmake-2.8.0 and + gcc-4.4.3. Execute the following: + cd $WM_THIRD_PARTY_DIR - + rm -rf paraview-3.6.1/platforms - + rm -rf platforms/*/paraview-3.6.1 + + rm -rf paraview-3.7.0/platforms + + rm -rf platforms/*/paraview-3.7.0 + ./makeParaView The PV3blockMeshReader and the PV3FoamReader ParaView plugins are compiled @@ -178,7 +179,7 @@ *** Compiling Paraview with a local version of Qt 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 - 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. Then the user can build Qt by executing from within $WM_THIRD_PARTY_DIR: + ./makeQt From 536087b59fb43cd3f5603b00a91452c7cd005e4b Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 22 Mar 2010 15:36:50 +0000 Subject: [PATCH 15/20] ENH: Have dummy directory on LD_LIBRARY_PATH --- etc/settings.csh | 2 ++ etc/settings.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/etc/settings.csh b/etc/settings.csh index 7a0d1f40c8..ba37b85e14 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -73,6 +73,8 @@ set path=($WM_DIR $WM_PROJECT_DIR/bin $path) _foamAddPath $FOAM_APPBIN _foamAddPath $FOAM_SITE_APPBIN _foamAddPath $FOAM_USER_APPBIN + # Make sure to pick up dummy versions of external libraries last +_foamAddLib $FOAM_LIBBIN/dummy _foamAddLib $FOAM_LIBBIN _foamAddLib $FOAM_SITE_LIBBIN _foamAddLib $FOAM_USER_LIBBIN diff --git a/etc/settings.sh b/etc/settings.sh index ca3ab25c2c..9dc3bae6f0 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -95,6 +95,8 @@ export FOAM_RUN=$WM_PROJECT_USER_DIR/run export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH _foamAddPath $FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN + # Make sure to pick up dummy versions of external libraries last +_foamAddLib $FOAM_LIBBIN/dummy _foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN From 9f5c39af5335062ea64686f428fadbd370689215 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 22 Mar 2010 15:38:35 +0000 Subject: [PATCH 16/20] ENH: have ptscotch ptscotch - compiles into ptscotchDecomp. All thirdparty decompositionMethods now moved out of decompositionMethods so add them explicitly to link line for programs that need them (decomposePar, snappyHexMesh etc.) --- .../generation/snappyHexMesh/Make/options | 1 + .../generation/snappyHexMesh/snappyHexMesh.C | 2 +- .../decomposePar/Make/options | 2 +- .../redistributeMeshPar/Make/options | 1 + src/dummyThirdParty/Allwmake | 1 + .../parMetisDecomp/dummyParMetisDecomp.C | 19 - src/dummyThirdParty/ptscotchDecomp/Make/files | 3 + .../ptscotchDecomp/Make/options | 5 + .../ptscotchDecomp/dummyPtscotchDecomp.C | 161 +++++ .../scotchDecomp/dummyScotchDecomp.C | 119 ---- src/parallel/decompose/Allwmake | 2 +- src/parallel/decompose/AllwmakeLnInclude | 1 + .../decompositionMethods/Make/options | 10 +- .../decompositionMethod/decompositionMethod.C | 294 ++++++++- .../decompositionMethod/decompositionMethod.H | 25 + .../decompose/metisDecomp/Make/options | 3 +- .../decompose/metisDecomp/metisDecomp.C | 7 +- .../decompose/parMetisDecomp/parMetisDecomp.C | 147 +---- .../decompose/ptscotchDecomp/Make/files | 3 + .../decompose/ptscotchDecomp/Make/options | 12 + .../decompose/ptscotchDecomp/ptscotchDecomp.C | 592 ++++++++++++++++++ .../decompose/ptscotchDecomp/ptscotchDecomp.H | 149 +++++ .../decompose/scotchDecomp/scotchDecomp.C | 140 ----- .../decompose/scotchDecomp/scotchDecomp.H | 20 - 24 files changed, 1257 insertions(+), 462 deletions(-) create mode 100644 src/dummyThirdParty/ptscotchDecomp/Make/files create mode 100644 src/dummyThirdParty/ptscotchDecomp/Make/options create mode 100644 src/dummyThirdParty/ptscotchDecomp/dummyPtscotchDecomp.C create mode 100644 src/parallel/decompose/ptscotchDecomp/Make/files create mode 100644 src/parallel/decompose/ptscotchDecomp/Make/options create mode 100644 src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C create mode 100644 src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.H diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index 77932a8cdc..02177455ed 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -11,6 +11,7 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ -ldecompositionMethods \ + -L$(FOAM_MPI_LIBBIN) -lptscotchDecomp -lparMetisDecomp -lmetisDecomp \ -lmeshTools \ -ldynamicMesh \ -lautoMesh diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 4ab7a771be..78f6947090 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -347,7 +347,7 @@ int main(int argc, char *argv[]) << "You have selected decomposition method " << decomposer.typeName << " which is not parallel aware." << endl - << "Please select one that is (hierarchical, parMetis)" + << "Please select one that is (hierarchical, ptscotch, parMetis)" << exit(FatalError); } diff --git a/applications/utilities/parallelProcessing/decomposePar/Make/options b/applications/utilities/parallelProcessing/decomposePar/Make/options index b79ab555e8..3ae2128234 100644 --- a/applications/utilities/parallelProcessing/decomposePar/Make/options +++ b/applications/utilities/parallelProcessing/decomposePar/Make/options @@ -7,6 +7,6 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ -lgenericPatchFields \ - -ldecompositionMethods \ + -ldecompositionMethods -lmetisDecomp -lscotchDecomp \ -llagrangian \ -lmeshTools diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options b/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options index b691383cf6..f1839dafad 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options +++ b/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options @@ -7,5 +7,6 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ -ldecompositionMethods \ + -L$(FOAM_MPI_LIBBIN) -lptscotchDecomp -lparMetisDecomp -lmetisDecomp \ -lmeshTools \ -ldynamicMesh diff --git a/src/dummyThirdParty/Allwmake b/src/dummyThirdParty/Allwmake index 6629894909..20fc2517d2 100755 --- a/src/dummyThirdParty/Allwmake +++ b/src/dummyThirdParty/Allwmake @@ -3,6 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x wmake libso scotchDecomp +wmake libso ptscotchDecomp wmake libso metisDecomp wmake libso parMetisDecomp wmake libso MGridGen diff --git a/src/dummyThirdParty/parMetisDecomp/dummyParMetisDecomp.C b/src/dummyThirdParty/parMetisDecomp/dummyParMetisDecomp.C index 2898907047..9375c74398 100644 --- a/src/dummyThirdParty/parMetisDecomp/dummyParMetisDecomp.C +++ b/src/dummyThirdParty/parMetisDecomp/dummyParMetisDecomp.C @@ -163,23 +163,4 @@ Foam::labelList Foam::parMetisDecomp::decompose } -void Foam::parMetisDecomp::calcMetisDistributedCSR -( - const polyMesh& mesh, - List& adjncy, - List& xadj -) -{ - FatalErrorIn - ( - "void parMetisDecomp::calcMetisDistributedCSR" - "(" - "const polyMesh&, " - "List&, " - "List&" - ")" - ) << notImplementedMessage << exit(FatalError); -} - - // ************************************************************************* // diff --git a/src/dummyThirdParty/ptscotchDecomp/Make/files b/src/dummyThirdParty/ptscotchDecomp/Make/files new file mode 100644 index 0000000000..18402ebfca --- /dev/null +++ b/src/dummyThirdParty/ptscotchDecomp/Make/files @@ -0,0 +1,3 @@ +dummyPtscotchDecomp.C + +LIB = $(FOAM_LIBBIN)/dummy/libptscotchDecomp diff --git a/src/dummyThirdParty/ptscotchDecomp/Make/options b/src/dummyThirdParty/ptscotchDecomp/Make/options new file mode 100644 index 0000000000..3cb176ccf9 --- /dev/null +++ b/src/dummyThirdParty/ptscotchDecomp/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(FOAM_SRC)/parallel/decompose/decompositionMethods/lnInclude \ + -I$(FOAM_SRC)/parallel/decompose/ptscotchDecomp/lnInclude + +LIB_LIBS = diff --git a/src/dummyThirdParty/ptscotchDecomp/dummyPtscotchDecomp.C b/src/dummyThirdParty/ptscotchDecomp/dummyPtscotchDecomp.C new file mode 100644 index 0000000000..6130c240d3 --- /dev/null +++ b/src/dummyThirdParty/ptscotchDecomp/dummyPtscotchDecomp.C @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "ptscotchDecomp.H" +#include "addToRunTimeSelectionTable.H" +#include "Time.H" + +static const char* notImplementedMessage = +"You are trying to use ptscotch but do not have the " +"ptscotchDecomp library loaded." +"\nThis message is from the dummy ptscotchDecomp stub library instead.\n" +"\n" +"Please install ptscotch and make sure that libptscotch.so is in your " +"LD_LIBRARY_PATH.\n" +"The ptscotchDecomp library can then be built in " +"$FOAM_SRC/parallel/decompose/ptscotchDecomp\n"; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(ptscotchDecomp, 0); + + addToRunTimeSelectionTable + ( + decompositionMethod, + ptscotchDecomp, + dictionaryMesh + ); +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::ptscotchDecomp::check(const int retVal, const char* str) +{} + + +Foam::label Foam::ptscotchDecomp::decompose +( + List& adjncy, + List& xadj, + const scalarField& cWeights, + List& finalDecomp +) +{ + FatalErrorIn + ( + "label ptscotchDecomp::decompose" + "(" + "const List&, " + "const List&, " + "const scalarField&, " + "List&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return -1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::ptscotchDecomp::ptscotchDecomp +( + const dictionary& decompositionDict, + const polyMesh& mesh +) +: + decompositionMethod(decompositionDict), + mesh_(mesh) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::labelList Foam::ptscotchDecomp::decompose +( + const pointField& points, + const scalarField& pointWeights +) +{ + FatalErrorIn + ( + "labelList ptscotchDecomp::decompose" + "(" + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList::null(); +} + + +Foam::labelList Foam::ptscotchDecomp::decompose +( + const labelList& agglom, + const pointField& agglomPoints, + const scalarField& pointWeights +) +{ + FatalErrorIn + ( + "labelList ptscotchDecomp::decompose" + "(" + "const labelList&, " + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList::null(); +} + + +Foam::labelList Foam::ptscotchDecomp::decompose +( + const labelListList& globalCellCells, + const pointField& cellCentres, + const scalarField& cWeights +) +{ + FatalErrorIn + ( + "labelList ptscotchDecomp::decompose" + "(" + "const labelListList&, " + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList::null(); +} + + +// ************************************************************************* // diff --git a/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C b/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C index b9a7ba73e2..a77286a767 100644 --- a/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C +++ b/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C @@ -22,87 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - From scotch forum: - - By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ] - 2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order - not to be confused, you must have a clear view of how they are built. - Here are some rules: - - 1- Strategies are made up of "methods" which are combined by means of - "operators". - - 2- A method is of the form "m{param=value,param=value,...}", where "m" - is a single character (this is your first error: "f" is a method name, - not a parameter name). - - 3- There exist different sort of strategies : bipartitioning strategies, - mapping strategies, ordering strategies, which cannot be mixed. For - instance, you cannot build a bipartitioning strategy and feed it to a - mapping method (this is your second error). - - To use the "mapCompute" routine, you must create a mapping strategy, not - a bipartitioning one, and so use stratGraphMap() and not - stratGraphBipart(). Your mapping strategy should however be based on the - "recursive bipartitioning" method ("b"). For instance, a simple (and - hence not very efficient) mapping strategy can be : - - "b{sep=f}" - - which computes mappings with the recursive bipartitioning method "b", - this latter using the Fiduccia-Mattheyses method "f" to compute its - separators. - - If you want an exact partition (see your previous post), try - "b{sep=fx}". - - However, these strategies are not the most efficient, as they do not - make use of the multi-level framework. - - To use the multi-level framework, try for instance: - - "b{sep=m{vert=100,low=h,asc=f}x}" - - The current default mapping strategy in Scotch can be seen by using the - "-vs" option of program gmap. It is, to date: - - b - { - job=t, - map=t, - poli=S, - sep= - ( - m - { - asc=b - { - bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005}, - org=f{move=80,pass=-1,bal=0.005}, - width=3 - }, - low=h{pass=10}f{move=80,pass=-1,bal=0.0005}, - type=h, - vert=80, - rat=0.8 - } - | m - { - asc=b - { - bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005}, - org=f{move=80,pass=-1,bal=0.005}, - width=3 - }, - low=h{pass=10}f{move=80,pass=-1,bal=0.0005}, - type=h, - vert=80, - rat=0.8 - } - ) - } - - \*---------------------------------------------------------------------------*/ #include "scotchDecomp.H" @@ -239,42 +158,4 @@ Foam::labelList Foam::scotchDecomp::decompose } -void Foam::scotchDecomp::calcCSR -( - const polyMesh& mesh, - List& adjncy, - List& xadj -) -{ - FatalErrorIn - ( - "labelList scotchDecomp::decompose" - "(" - "const polyMesh&, " - "const List&, " - "const List&" - ")" - ) << notImplementedMessage << exit(FatalError); -} - - -void Foam::scotchDecomp::calcCSR -( - const labelListList& cellCells, - List& adjncy, - List& xadj -) -{ - FatalErrorIn - ( - "labelList scotchDecomp::decompose" - "(" - "const labelListList&, " - "const List&, " - "const List&" - ")" - ) << notImplementedMessage << exit(FatalError); -} - - // ************************************************************************* // diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index 2adc739cf1..d39aecaa73 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -9,7 +9,7 @@ wmake libso metisDecomp if [ -d "$FOAM_MPI_LIBBIN" ] then - ( WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB; wmake libso parMetisDecomp ) + ( WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB; wmake libso ptscotchDecomp && wmake libso parMetisDecomp ) fi wmake libso decompositionMethods diff --git a/src/parallel/decompose/AllwmakeLnInclude b/src/parallel/decompose/AllwmakeLnInclude index 6542722030..5a65c3a89c 100755 --- a/src/parallel/decompose/AllwmakeLnInclude +++ b/src/parallel/decompose/AllwmakeLnInclude @@ -6,5 +6,6 @@ wmakeLnInclude decompositionMethods wmakeLnInclude metisDecomp wmakeLnInclude parMetisDecomp wmakeLnInclude scotchDecomp +wmakeLnInclude ptscotchDecomp # ----------------------------------------------------------------- end-of-file diff --git a/src/parallel/decompose/decompositionMethods/Make/options b/src/parallel/decompose/decompositionMethods/Make/options index fbe9e72228..197eb651c5 100644 --- a/src/parallel/decompose/decompositionMethods/Make/options +++ b/src/parallel/decompose/decompositionMethods/Make/options @@ -1,9 +1,9 @@ EXE_INC = LIB_LIBS = \ - -L$(FOAM_LIBBIN)/dummy \ - -L$(FOAM_MPI_LIBBIN) \ - -lscotchDecomp \ - -lmetisDecomp \ - -lparMetisDecomp + /* -L$(FOAM_LIBBIN)/dummy */ \ + /* -L$(FOAM_MPI_LIBBIN) */ \ + /* -lscotchDecomp */ \ + /* -lmetisDecomp */ \ + /* -lparMetisDecomp */ diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C index d5c98d52b5..8dcecfb7dc 100644 --- a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -28,6 +28,9 @@ InClass \*---------------------------------------------------------------------------*/ #include "decompositionMethod.H" +#include "globalIndex.H" +#include "cyclicPolyPatch.H" +#include "syncTools.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -156,6 +159,18 @@ Foam::labelList Foam::decompositionMethod::decompose } +Foam::labelList Foam::decompositionMethod::decompose +( + const labelListList& globalCellCells, + const pointField& cc +) +{ + scalarField cWeights(0); + + return decompose(globalCellCells, cc, cWeights); +} + + void Foam::decompositionMethod::calcCellCells ( const polyMesh& mesh, @@ -201,15 +216,284 @@ void Foam::decompositionMethod::calcCellCells } -Foam::labelList Foam::decompositionMethod::decompose +void Foam::decompositionMethod::calcCSR ( - const labelListList& globalCellCells, - const pointField& cc + const polyMesh& mesh, + List& adjncy, + List& xadj ) { - scalarField cWeights(0); + // Make Metis CSR (Compressed Storage Format) storage + // adjncy : contains neighbours (= edges in graph) + // xadj(celli) : start of information in adjncy for celli - return decompose(globalCellCells, cc, cWeights); + xadj.setSize(mesh.nCells()+1); + + // Initialise the number of internal faces of the cells to twice the + // number of internal faces + label nInternalFaces = 2*mesh.nInternalFaces(); + + // Check the boundary for coupled patches and add to the number of + // internal faces + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + forAll(pbm, patchi) + { + if (isA(pbm[patchi])) + { + nInternalFaces += pbm[patchi].size(); + } + } + + // Create the adjncy array the size of the total number of internal and + // coupled faces + adjncy.setSize(nInternalFaces); + + // Fill in xadj + // ~~~~~~~~~~~~ + label freeAdj = 0; + + for (label cellI = 0; cellI < mesh.nCells(); cellI++) + { + xadj[cellI] = freeAdj; + + const labelList& cFaces = mesh.cells()[cellI]; + + forAll(cFaces, i) + { + label faceI = cFaces[i]; + + if + ( + mesh.isInternalFace(faceI) + || isA(pbm[pbm.whichPatch(faceI)]) + ) + { + freeAdj++; + } + } + } + xadj[mesh.nCells()] = freeAdj; + + + // Fill in adjncy + // ~~~~~~~~~~~~~~ + + labelList nFacesPerCell(mesh.nCells(), 0); + + // Internal faces + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + label own = mesh.faceOwner()[faceI]; + label nei = mesh.faceNeighbour()[faceI]; + + adjncy[xadj[own] + nFacesPerCell[own]++] = nei; + adjncy[xadj[nei] + nFacesPerCell[nei]++] = own; + } + + // Coupled faces. Only cyclics done. + forAll(pbm, patchi) + { + if (isA(pbm[patchi])) + { + const unallocLabelList& faceCells = pbm[patchi].faceCells(); + + label sizeby2 = faceCells.size()/2; + + for (label facei=0; facei& adjncy, + List& xadj +) +{ + // Count number of internal faces + label nConnections = 0; + + forAll(cellCells, coarseI) + { + nConnections += cellCells[coarseI].size(); + } + + // Create the adjncy array as twice the size of the total number of + // internal faces + adjncy.setSize(nConnections); + + xadj.setSize(cellCells.size()+1); + + + // Fill in xadj + // ~~~~~~~~~~~~ + label freeAdj = 0; + + forAll(cellCells, coarseI) + { + xadj[coarseI] = freeAdj; + + const labelList& cCells = cellCells[coarseI]; + + forAll(cCells, i) + { + adjncy[freeAdj++] = cCells[i]; + } + } + xadj[cellCells.size()] = freeAdj; +} + + +void Foam::decompositionMethod::calcDistributedCSR +( + const polyMesh& mesh, + List& adjncy, + List& xadj +) +{ + // Create global cell numbers + // ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + globalIndex globalCells(mesh.nCells()); + + + // + // Make Metis Distributed CSR (Compressed Storage Format) storage + // adjncy : contains cellCells (= edges in graph) + // xadj(celli) : start of information in adjncy for celli + // + + + const labelList& faceOwner = mesh.faceOwner(); + const labelList& faceNeighbour = mesh.faceNeighbour(); + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + + // Get renumbered owner on other side of coupled faces + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + List globalNeighbour(mesh.nFaces()-mesh.nInternalFaces()); + + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + + if (pp.coupled()) + { + label faceI = pp.start(); + label bFaceI = pp.start() - mesh.nInternalFaces(); + + forAll(pp, i) + { + globalNeighbour[bFaceI++] = globalCells.toGlobal + ( + faceOwner[faceI++] + ); + } + } + } + + // Get the cell on the other side of coupled patches + syncTools::swapBoundaryFaceList(mesh, globalNeighbour, false); + + + // Count number of faces (internal + coupled) + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Number of faces per cell + List nFacesPerCell(mesh.nCells(), 0); + + // Number of coupled faces + label nCoupledFaces = 0; + + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + nFacesPerCell[faceOwner[faceI]]++; + nFacesPerCell[faceNeighbour[faceI]]++; + } + // Handle coupled faces + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + + if (pp.coupled()) + { + label faceI = pp.start(); + + forAll(pp, i) + { + nCoupledFaces++; + nFacesPerCell[faceOwner[faceI++]]++; + } + } + } + + + // Fill in xadj + // ~~~~~~~~~~~~ + + xadj.setSize(mesh.nCells()+1); + + int freeAdj = 0; + + for (label cellI = 0; cellI < mesh.nCells(); cellI++) + { + xadj[cellI] = freeAdj; + + freeAdj += nFacesPerCell[cellI]; + } + xadj[mesh.nCells()] = freeAdj; + + + + // Fill in adjncy + // ~~~~~~~~~~~~~~ + + adjncy.setSize(2*mesh.nInternalFaces() + nCoupledFaces); + + nFacesPerCell = 0; + + // For internal faces is just offsetted owner and neighbour + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + label own = faceOwner[faceI]; + label nei = faceNeighbour[faceI]; + + adjncy[xadj[own] + nFacesPerCell[own]++] = globalCells.toGlobal(nei); + adjncy[xadj[nei] + nFacesPerCell[nei]++] = globalCells.toGlobal(own); + } + // For boundary faces is offsetted coupled neighbour + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + + if (pp.coupled()) + { + label faceI = pp.start(); + label bFaceI = pp.start()-mesh.nInternalFaces(); + + forAll(pp, i) + { + label own = faceOwner[faceI]; + adjncy[xadj[own] + nFacesPerCell[own]++] = + globalNeighbour[bFaceI]; + + faceI++; + bFaceI++; + } + } + } } diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H index 7f66e9f50d..71f26d4ac3 100644 --- a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H +++ b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.H @@ -66,6 +66,31 @@ protected: labelListList& cellCells ); + // From mesh to compact row storage format + // (like CompactListList) + static void calcCSR + ( + const polyMesh& mesh, + List& adjncy, + List& xadj + ); + + // From cell-cell connections to compact row storage format + // (like CompactListList) + static void calcCSR + ( + const labelListList& cellCells, + List& adjncy, + List& xadj + ); + + static void calcDistributedCSR + ( + const polyMesh& mesh, + List& adjncy, + List& xadj + ); + private: // Private Member Functions diff --git a/src/parallel/decompose/metisDecomp/Make/options b/src/parallel/decompose/metisDecomp/Make/options index 2115beb95a..a7d5398f03 100644 --- a/src/parallel/decompose/metisDecomp/Make/options +++ b/src/parallel/decompose/metisDecomp/Make/options @@ -1,7 +1,6 @@ EXE_INC = \ -I$(WM_THIRD_PARTY_DIR)/metis-5.0pre2/include \ - -I../decompositionMethods/lnInclude \ - -I../scotchDecomp/lnInclude + -I../decompositionMethods/lnInclude LIB_LIBS = \ -lmetis \ diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.C b/src/parallel/decompose/metisDecomp/metisDecomp.C index fb2fddb868..50e58cdf06 100644 --- a/src/parallel/decompose/metisDecomp/metisDecomp.C +++ b/src/parallel/decompose/metisDecomp/metisDecomp.C @@ -28,7 +28,6 @@ License #include "addToRunTimeSelectionTable.H" #include "floatScalar.H" #include "Time.H" -#include "scotchDecomp.H" extern "C" { @@ -340,7 +339,7 @@ Foam::labelList Foam::metisDecomp::decompose List adjncy; List xadj; - scotchDecomp::calcCSR(mesh_, adjncy, xadj); + calcCSR(mesh_, adjncy, xadj); // Decompose using default weights List finalDecomp; @@ -390,7 +389,7 @@ Foam::labelList Foam::metisDecomp::decompose cellCells ); - scotchDecomp::calcCSR(cellCells, adjncy, xadj); + calcCSR(cellCells, adjncy, xadj); } // Decompose using default weights @@ -435,7 +434,7 @@ Foam::labelList Foam::metisDecomp::decompose List adjncy; List xadj; - scotchDecomp::calcCSR(globalCellCells, adjncy, xadj); + calcCSR(globalCellCells, adjncy, xadj); // Decompose using default weights diff --git a/src/parallel/decompose/parMetisDecomp/parMetisDecomp.C b/src/parallel/decompose/parMetisDecomp/parMetisDecomp.C index f8e590c957..b339095d80 100644 --- a/src/parallel/decompose/parMetisDecomp/parMetisDecomp.C +++ b/src/parallel/decompose/parMetisDecomp/parMetisDecomp.C @@ -26,7 +26,6 @@ License #include "parMetisDecomp.H" #include "metisDecomp.H" -#include "scotchDecomp.H" #include "syncTools.H" #include "addToRunTimeSelectionTable.H" #include "floatScalar.H" @@ -406,7 +405,7 @@ Foam::labelList Foam::parMetisDecomp::decompose Field adjncy; // Offsets into adjncy Field xadj; - calcMetisDistributedCSR + calcDistributedCSR ( mesh_, adjncy, @@ -774,7 +773,7 @@ Foam::labelList Foam::parMetisDecomp::decompose Field adjncy; // Offsets into adjncy Field xadj; - scotchDecomp::calcCSR(globalCellCells, adjncy, xadj); + calcCSR(globalCellCells, adjncy, xadj); // decomposition options. 0 = use defaults List options(3, 0); @@ -871,146 +870,4 @@ Foam::labelList Foam::parMetisDecomp::decompose } -void Foam::parMetisDecomp::calcMetisDistributedCSR -( - const polyMesh& mesh, - List& adjncy, - List& xadj -) -{ - // Create global cell numbers - // ~~~~~~~~~~~~~~~~~~~~~~~~~~ - - globalIndex globalCells(mesh.nCells()); - - - // - // Make Metis Distributed CSR (Compressed Storage Format) storage - // adjncy : contains cellCells (= edges in graph) - // xadj(celli) : start of information in adjncy for celli - // - - - const labelList& faceOwner = mesh.faceOwner(); - const labelList& faceNeighbour = mesh.faceNeighbour(); - const polyBoundaryMesh& patches = mesh.boundaryMesh(); - - - // Get renumbered owner on other side of coupled faces - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - List globalNeighbour(mesh.nFaces()-mesh.nInternalFaces()); - - forAll(patches, patchI) - { - const polyPatch& pp = patches[patchI]; - - if (pp.coupled()) - { - label faceI = pp.start(); - label bFaceI = pp.start() - mesh.nInternalFaces(); - - forAll(pp, i) - { - globalNeighbour[bFaceI++] = globalCells.toGlobal - ( - faceOwner[faceI++] - ); - } - } - } - - // Get the cell on the other side of coupled patches - syncTools::swapBoundaryFaceList(mesh, globalNeighbour, false); - - - // Count number of faces (internal + coupled) - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - // Number of faces per cell - List nFacesPerCell(mesh.nCells(), 0); - - // Number of coupled faces - label nCoupledFaces = 0; - - for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) - { - nFacesPerCell[faceOwner[faceI]]++; - nFacesPerCell[faceNeighbour[faceI]]++; - } - // Handle coupled faces - forAll(patches, patchI) - { - const polyPatch& pp = patches[patchI]; - - if (pp.coupled()) - { - label faceI = pp.start(); - - forAll(pp, i) - { - nCoupledFaces++; - nFacesPerCell[faceOwner[faceI++]]++; - } - } - } - - - // Fill in xadj - // ~~~~~~~~~~~~ - - xadj.setSize(mesh.nCells()+1); - - int freeAdj = 0; - - for (label cellI = 0; cellI < mesh.nCells(); cellI++) - { - xadj[cellI] = freeAdj; - - freeAdj += nFacesPerCell[cellI]; - } - xadj[mesh.nCells()] = freeAdj; - - - - // Fill in adjncy - // ~~~~~~~~~~~~~~ - - adjncy.setSize(2*mesh.nInternalFaces() + nCoupledFaces); - - nFacesPerCell = 0; - - // For internal faces is just offsetted owner and neighbour - for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) - { - label own = faceOwner[faceI]; - label nei = faceNeighbour[faceI]; - - adjncy[xadj[own] + nFacesPerCell[own]++] = globalCells.toGlobal(nei); - adjncy[xadj[nei] + nFacesPerCell[nei]++] = globalCells.toGlobal(own); - } - // For boundary faces is offsetted coupled neighbour - forAll(patches, patchI) - { - const polyPatch& pp = patches[patchI]; - - if (pp.coupled()) - { - label faceI = pp.start(); - label bFaceI = pp.start()-mesh.nInternalFaces(); - - forAll(pp, i) - { - label own = faceOwner[faceI]; - adjncy[xadj[own] + nFacesPerCell[own]++] = - globalNeighbour[bFaceI]; - - faceI++; - bFaceI++; - } - } - } -} - - // ************************************************************************* // diff --git a/src/parallel/decompose/ptscotchDecomp/Make/files b/src/parallel/decompose/ptscotchDecomp/Make/files new file mode 100644 index 0000000000..d2494e36ba --- /dev/null +++ b/src/parallel/decompose/ptscotchDecomp/Make/files @@ -0,0 +1,3 @@ +ptscotchDecomp.C + +LIB = $(FOAM_MPI_LIBBIN)/libptscotchDecomp diff --git a/src/parallel/decompose/ptscotchDecomp/Make/options b/src/parallel/decompose/ptscotchDecomp/Make/options new file mode 100644 index 0000000000..8c5ff0c5ad --- /dev/null +++ b/src/parallel/decompose/ptscotchDecomp/Make/options @@ -0,0 +1,12 @@ +include $(RULES)/mplib$(WM_MPLIB) + +EXE_INC = \ + $(PFLAGS) $(PINC) \ + -I$(WM_THIRD_PARTY_DIR)/scotch_5.1/include \ + -I/usr/include/scotch \ + /* -I$(LIB_SRC)/parallel/decompose/parMetisDecomp */ \ + /* -I$(LIB_SRC)/parallel/decompose/scotchDecomp */ \ + -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude + +LIB_LIBS = \ + -L$(FOAM_MPI_LIBBIN) -lptscotch -lptscotcherrexit diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C new file mode 100644 index 0000000000..9cf84914bb --- /dev/null +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -0,0 +1,592 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + From scotch forum: + + By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ] + 2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order + not to be confused, you must have a clear view of how they are built. + Here are some rules: + + 1- Strategies are made up of "methods" which are combined by means of + "operators". + + 2- A method is of the form "m{param=value,param=value,...}", where "m" + is a single character (this is your first error: "f" is a method name, + not a parameter name). + + 3- There exist different sort of strategies : bipartitioning strategies, + mapping strategies, ordering strategies, which cannot be mixed. For + instance, you cannot build a bipartitioning strategy and feed it to a + mapping method (this is your second error). + + To use the "mapCompute" routine, you must create a mapping strategy, not + a bipartitioning one, and so use stratGraphMap() and not + stratGraphBipart(). Your mapping strategy should however be based on the + "recursive bipartitioning" method ("b"). For instance, a simple (and + hence not very efficient) mapping strategy can be : + + "b{sep=f}" + + which computes mappings with the recursive bipartitioning method "b", + this latter using the Fiduccia-Mattheyses method "f" to compute its + separators. + + If you want an exact partition (see your previous post), try + "b{sep=fx}". + + However, these strategies are not the most efficient, as they do not + make use of the multi-level framework. + + To use the multi-level framework, try for instance: + + "b{sep=m{vert=100,low=h,asc=f}x}" + + The current default mapping strategy in Scotch can be seen by using the + "-vs" option of program gmap. It is, to date: + + b + { + job=t, + map=t, + poli=S, + sep= + ( + m + { + asc=b + { + bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005}, + org=f{move=80,pass=-1,bal=0.005}, + width=3 + }, + low=h{pass=10}f{move=80,pass=-1,bal=0.0005}, + type=h, + vert=80, + rat=0.8 + } + | m + { + asc=b + { + bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005}, + org=f{move=80,pass=-1,bal=0.005}, + width=3 + }, + low=h{pass=10}f{move=80,pass=-1,bal=0.0005}, + type=h, + vert=80, + rat=0.8 + } + ) + } + + +\*---------------------------------------------------------------------------*/ + +#include "ptscotchDecomp.H" +#include "addToRunTimeSelectionTable.H" +#include "Time.H" +#include "OFstream.H" + +extern "C" +{ +#include +#include "mpi.h" +#include "ptscotch.h" +} + + +// Hack: scotch generates floating point errors so need to switch of error +// trapping! +#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64) +# define LINUX +#endif + +#if defined(LINUX) && defined(__GNUC__) +# define LINUX_GNUC +#endif + +#ifdef LINUX_GNUC +# ifndef __USE_GNU +# define __USE_GNU +# endif +# include +#endif + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(ptscotchDecomp, 0); + + addToRunTimeSelectionTable + ( + decompositionMethod, + ptscotchDecomp, + dictionaryMesh + ); +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::ptscotchDecomp::check(const int retVal, const char* str) +{ + if (retVal) + { + FatalErrorIn("ptscotchDecomp::decompose(..)") + << "Call to scotch routine " << str << " failed." + << exit(FatalError); + } +} + + +// Call scotch with options from dictionary. +Foam::label Foam::ptscotchDecomp::decompose +( + List& adjncy, + List& xadj, + const scalarField& cWeights, + + List& finalDecomp +) +{ +// // Dump graph +// if (decompositionDict_.found("ptscotchCoeffs")) +// { +// const dictionary& scotchCoeffs = +// decompositionDict_.subDict("ptscotchCoeffs"); +// +// if (scotchCoeffs.found("writeGraph")) +// { +// Switch writeGraph(scotchCoeffs.lookup("writeGraph")); +// +// if (writeGraph) +// { +// OFstream str(mesh_.time().path() / mesh_.name() + ".grf"); +// +// Info<< "Dumping Scotch graph file to " << str.name() << endl +// << "Use this in combination with gpart." << endl; +// +// label version = 0; +// str << version << nl; +// // Numer of vertices +// str << xadj.size()-1 << ' ' << adjncy.size() << nl; +// // Numbering starts from 0 +// label baseval = 0; +// // Has weights? +// label hasEdgeWeights = 0; +// label hasVertexWeights = 0; +// label numericflag = 10*hasEdgeWeights+hasVertexWeights; +// str << baseval << ' ' << numericflag << nl; +// for (label cellI = 0; cellI < xadj.size()-1; cellI++) +// { +// label start = xadj[cellI]; +// label end = xadj[cellI+1]; +// str << end-start; +// +// for (label i = start; i < end; i++) +// { +// str << ' ' << adjncy[i]; +// } +// str << nl; +// } +// } +// } +// } + + + // Strategy + // ~~~~~~~~ + + // Default. + SCOTCH_Strat stradat; + check(SCOTCH_stratInit(&stradat), "SCOTCH_stratInit"); + + if (decompositionDict_.found("scotchCoeffs")) + { + const dictionary& scotchCoeffs = + decompositionDict_.subDict("scotchCoeffs"); + + + string strategy; + if (scotchCoeffs.readIfPresent("strategy", strategy)) + { + if (debug) + { + Info<< "ptscotchDecomp : Using strategy " << strategy << endl; + } + SCOTCH_stratDgraphMap(&stradat, strategy.c_str()); + //fprintf(stdout, "S\tStrat="); + //SCOTCH_stratSave(&stradat, stdout); + //fprintf(stdout, "\n"); + } + } + + + // Graph + // ~~~~~ + + List velotab; + + + // Check for externally provided cellweights and if so initialise weights + scalar minWeights = gMin(cWeights); + if (cWeights.size() > 0) + { + if (minWeights <= 0) + { + WarningIn + ( + "ptscotchDecomp::decompose" + "(const pointField&, const scalarField&)" + ) << "Illegal minimum weight " << minWeights + << endl; + } + + if (cWeights.size() != xadj.size()-1) + { + FatalErrorIn + ( + "ptscotchDecomp::decompose" + "(const pointField&, const scalarField&)" + ) << "Number of cell weights " << cWeights.size() + << " does not equal number of cells " << xadj.size()-1 + << exit(FatalError); + } + + // Convert to integers. + velotab.setSize(cWeights.size()); + forAll(velotab, i) + { + velotab[i] = int(cWeights[i]/minWeights); + } + } + + + + SCOTCH_Dgraph grafdat; + check(SCOTCH_dgraphInit(&grafdat, MPI_COMM_WORLD), "SCOTCH_dgraphInit"); + check + ( + SCOTCH_dgraphBuild + ( + &grafdat, // grafdat + 0, // baseval, c-style numbering + xadj.size()-1, // vertlocnbr, nCells + xadj.size()-1, // vertlocmax + const_cast(xadj.begin()), // vertloctab, start index per cell into + // adjncy + &xadj[1], // vendloctab, end index ,, + + velotab.begin(), // veloloctab, vertex weights + NULL, // vlblloctab + + adjncy.size(), // edgelocnbr, number of arcs + adjncy.size(), // edgelocsiz + adjncy.begin(), // edgeloctab + NULL, // edgegsttab + NULL // edlotab, edge weights + ), + "SCOTCH_dgraphBuild" + ); + check(SCOTCH_dgraphCheck(&grafdat), "SCOTCH_dgraphCheck"); + + + // Architecture + // ~~~~~~~~~~~~ + // (fully connected network topology since using switch) + + SCOTCH_Arch archdat; + check(SCOTCH_archInit(&archdat), "SCOTCH_archInit"); + + List