diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C index fdddddfbfee1d75bd8b95ba5351581ff3dec79ee..821eb5adb0579ddf53af1006248d9177e01030ae 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.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 @@ -121,9 +121,8 @@ PDRkEpsilon::PDRkEpsilon IOobject::MUST_READ, IOobject::AUTO_WRITE ), - mesh_ + autoCreateK("k", mesh_) ), - epsilon_ ( IOobject @@ -134,9 +133,8 @@ PDRkEpsilon::PDRkEpsilon IOobject::MUST_READ, IOobject::AUTO_WRITE ), - mesh_ + autoCreateEpsilon("epsilon", mesh_) ), - mut_ ( IOobject @@ -147,9 +145,8 @@ PDRkEpsilon::PDRkEpsilon IOobject::NO_READ, IOobject::NO_WRITE ), - Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_) + autoCreateMut("mut", mesh_) ), - alphat_ ( IOobject @@ -163,7 +160,9 @@ PDRkEpsilon::PDRkEpsilon autoCreateAlphat("alphat", mesh_) ) { - mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(epsilon_, epsilonMin_); + + mut_ = Cmu_*rho_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); alphat_ = mut_/Prt_; @@ -250,7 +249,7 @@ void PDRkEpsilon::correct() if (!turbulence_) { // Re-calculate viscosity - mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity @@ -302,7 +301,7 @@ void PDRkEpsilon::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -320,7 +319,7 @@ void PDRkEpsilon::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity mut_ = rho_*Cmu_*sqr(k_)/epsilon_; diff --git a/applications/solvers/multiphase/settlingFoam/kEpsilon.H b/applications/solvers/multiphase/settlingFoam/kEpsilon.H index 522a9afac7f814ba75914179853a53c360ff13a9..e27594ffed49a1d5b4804a6be73d0864a0c9e965 100644 --- a/applications/solvers/multiphase/settlingFoam/kEpsilon.H +++ b/applications/solvers/multiphase/settlingFoam/kEpsilon.H @@ -5,8 +5,8 @@ if (turbulence) y.correct(); } - dimensionedScalar k0("k0", k.dimensions(), SMALL); - dimensionedScalar epsilon0("epsilon0", epsilon.dimensions(), SMALL); + dimensionedScalar kMin("kMin", k.dimensions(), SMALL); + dimensionedScalar epsilonMin("epsilonMin", epsilon.dimensions(), SMALL); volScalarField divU = fvc::div(phi/fvc::interpolate(rho)); @@ -15,7 +15,7 @@ if (turbulence) tgradU.clear(); volScalarField Gcoef = - Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilon0); + Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilonMin); #include "wallFunctions.H" @@ -40,7 +40,7 @@ if (turbulence) epsEqn.relax(); epsEqn.solve(); - bound(epsilon, epsilon0); + bound(epsilon, epsilonMin); // Turbulent kinetic energy equation @@ -60,11 +60,13 @@ if (turbulence) - fvm::Sp(rho*epsilon/k, k) ); - bound(k, k0); + //FIXME: why no kEqn.relax()? + + bound(k, kMin); //- Re-calculate viscosity - mut = rho*Cmu*sqr(k)/(epsilon + epsilon0); + mut = rho*Cmu*sqr(k)/(epsilon + epsilonMin); #include "wallViscosity.H" } diff --git a/bin/foamEtcFile b/bin/foamEtcFile index b749a76e9735840e0aa020667a1c525b53105f79..9b43222de486f4cdddd75c40ad8574d4d94270f5 100755 --- a/bin/foamEtcFile +++ b/bin/foamEtcFile @@ -30,7 +30,7 @@ # Locate user/group/shipped file with semantics similar to the # ~OpenFOAM/fileName expansion. # -# The -mode option can be used to allow chaining from +# The -mode option can be used to allow chaining from # personal settings to site-wide settings. # # For example, within the user ~/.OpenFOAM/<VER>/prefs.sh: @@ -119,27 +119,27 @@ nArgs=$# fileName="$1" # Define the various places to be searched: -files="" +unset dirList case "$mode" in *u*) # user - files="$files $HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION" - files="$files $HOME/.${WM_PROJECT:-OpenFOAM}" + dirList="$dirList $HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION" + dirList="$dirList $HOME/.${WM_PROJECT:-OpenFOAM}" ;; esac case "$mode" in *g*) # group - files="$files $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION" - files="$files $WM_PROJECT_INST_DIR/site" + dirList="$dirList $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION" + dirList="$dirList $WM_PROJECT_INST_DIR/site" ;; esac case "$mode" in *o*) # other - files="$files $WM_PROJECT_DIR/etc" + dirList="$dirList $WM_PROJECT_DIR/etc" ;; esac -set -- $files +set -- $dirList # diff --git a/bin/foamInstallationTest b/bin/foamInstallationTest index 708c63841026d556d4fcde194276e2eb5549f099..5035b48201324525957ffa530368a8679391a80b 100755 --- a/bin/foamInstallationTest +++ b/bin/foamInstallationTest @@ -34,72 +34,73 @@ # Base settings FOAM_VERSION=1.6 -SUPPLIED_VERSION_GCC=4.3.3 -MIN_VERSION_GCC=4.3.1 +SUPPLIED_VERSION_GCC=4.4.3 +MIN_VERSION_GCC=4.3.3 # General WIDTH=20 # Global variables -FATALERROR=0 -CRITICALERROR=0 -SSHRSHOK=0 +fatalError=0 +criticalError=0 # System variables -HOST_NAME=`uname -n` -OS=`uname -s` +HOST=`uname -n` +OSTYPE=`uname -s` USER_NAME=$LOGNAME -if [ ! -n $USER_NAME ]; then - USER_NAME=$USER -fi +: ${USER_NAME:=$USER} + +# which OpenFOAM application to test for the Version +foamTestApp=icoFoam #============================================================================== # HELPER FUNCTIONS #============================================================================== -hline () { +hline() +{ echo "-------------------------------------------------------------------------------" } -expenv () { - eval "echo $1" -} - - -heading () { - echo "" - echo "" +heading() +{ + echo + echo echo "$1" } -lenBase () { +lenBase() +{ echo $1 | tr -d " " | wc -m | tr -d " " } -length () { +length() +{ NOCHAR=`lenBase $1` NOCHAR=`expr $NOCHAR - 1` - if [ $NOCHAR -eq -1 ]; then - NOCHAR=0 - fi + [ $NOCHAR -ge 0 ] || NOCHAR=0 echo $NOCHAR } -stringLength () { +stringLength() +{ echo $1 | wc -m | tr -d " " } -fixlen () { +fixlen() +{ WORD=$1 ONELEN=`stringLength $1` LDIFF=`expr $ONELEN - $2` - if [ $LDIFF -le 1 ]; then - while [ $LDIFF -lt 0 ] ; do + if [ $LDIFF -le 1 ] + then + while [ $LDIFF -lt 0 ] + do WORD="$WORD " LDIFF=`expr $LDIFF + 1` done @@ -112,33 +113,34 @@ fixlen () { } -reportEnv () { +reportEnv() +{ EXP_ENV=`eval "echo $1"` EXP_PATH=`eval "echo $2"` CRIT="$3" EXISTS=" no " ON_PATH="" - if [ `length $EXP_ENV` -gt 0 ] ; then - case $OS in + if [ `length $EXP_ENV` -gt 0 ] + then + case "$OSTYPE" in SunOS) - if /usr/bin/test -e $EXP_ENV ; then + if /usr/bin/test -e $EXP_ENV + then EXISTS=" yes " - if [ "$2" != noPath ]; then + if [ "$2" != noPath ] + then ON_PATH=" no " - OLD_IFS=$IFS + oldIFS=$IFS IFS=':' for e in $EXP_PATH do - if \ - [ \ - "$e" = "$EXP_ENV" \ - -o "$e" = "${EXP_ENV}/bin" \ - -o "${EXP_ENV}/lib" = "$e" \ - ] ; then + case "$e" in + "$EXP_ENV" | "$EXP_ENV/bin" | "$EXP_ENV/lib") ON_PATH="yes " - fi + ;; + esac done - IFS=$OLD_IFS + IFS=$oldIFS else CRIT=" $3" fi @@ -148,24 +150,23 @@ reportEnv () { echo "`fixlen "$1" 21` `fixlen "$EXP_ENV" 40` $EXISTS $ON_PATH $CRIT" ;; *) - if [ -e "$EXP_ENV" ] ; then + if [ -e "$EXP_ENV" ] + then EXISTS=" yes " - if [ "$2" != noPath ]; then + if [ "$2" != noPath ] + then ON_PATH=" no " - OLD_IFS=$IFS + oldIFS=$IFS IFS=':' for e in $EXP_PATH do - if \ - [ \ - "$e" = "$EXP_ENV" \ - -o "$e" = "${EXP_ENV}/bin" \ - -o "${EXP_ENV}/lib" = "$e" \ - ] ; then + case "$e" in + "$EXP_ENV" | "$EXP_ENV/bin" | "$EXP_ENV/lib") ON_PATH="yes " - fi + ;; + esac done - IFS=$OLD_IFS + IFS=$oldIFS else CRIT=" $3" fi @@ -180,11 +181,13 @@ reportEnv () { fi ERROR="false" - if [ "$EXISTS" = no ] || [ "$ON_PATH" = no ]; then + if [ "$EXISTS" = no ] || [ "$ON_PATH" = no ] + then ERROR="true" fi - if [ "$3" = yes ] && [ "$ERROR" = true ]; then - CRITICALERROR=`expr $CRITICALERROR + 1` + if [ "$3" = yes ] && [ "$ERROR" = true ] + then + criticalError=`expr $criticalError + 1` echo "WARNING: CRITICAL ERROR" echo fi @@ -192,197 +195,111 @@ reportEnv () { } -findExec() { - OLD_IFS=$IFS +findExec() +{ + oldIFS=$IFS IFS=':' for d in $1 do - case $OS in + case "$OSTYPE" in SunOS) - if /usr/bin/test ! -d "$d/$2" -a -x "$d/$2" ; then - IFS=$OLD_IFS + if /usr/bin/test ! -d "$d/$2" -a -x "$d/$2" + then + IFS=$oldIFS echo "$d/$2" return 0 fi ;; *) - if [ ! -d "$d/$2" -a -x "$d/$2" ]; then - IFS=$OLD_IFS + if [ ! -d "$d/$2" -a -x "$d/$2" ] + then + IFS=$oldIFS echo "$d/$2" return 0 fi ;; esac done - IFS=$OLD_IFS + IFS=$oldIFS return 1 } -reportExecutable () { +reportExecutable() +{ APP_PATH="" APP_PATH=`findExec $PATH $1` APP_SPEC="$2" - if [ ! -n $APP_PATH ];then + if [ ! -n $APP_PATH ] + then echo "`fixlen "$1" 9`" "*** not installed ***" VERSION="" - case $1 in - icoFoam) - echo " CRITICAL ERROR" - CRITICALERROR=`expr $CRITICALERROR + 1` - ;; - gcc) - echo " CRITICAL ERROR" - CRITICALERROR=`expr $CRITICALERROR + 1` - ;; - tar) ;; - gtar) ;; - gzip) ;; - dx) ;; + case "$1" in + gcc | $foamTestApp) + echo " CRITICAL ERROR" + criticalError=`expr $criticalError + 1` + ;; esac echo return 1 fi - case $1 in - icoFoam) - VERSION=`$1 2>&1 \ - | \grep ' Version:' \ - | sed -e 's/.*Version:/Version:/' \ - | cut -d" " -f3` - ;; - gcc) - VERSION=`$1 -v 2>&1 \ - | grep 'gcc version' \ - | cut -d" " -f3` - if [ ! "$VERSION" = "$SUPPLIED_VERSION_GCC" ]; then - echo "WARNING: gcc version does not match gcc supplied" \ - "with this release of OpenFOAM" - echo " Supplied version: $SUPPLIED_VERSION_GCC" - echo " User version : $VERSION" - echo " Minimum required: $MIN_VERSION_GCC" - echo "" - fi - ;; - gtar) - VERSION=`$APP_PATH --version | head -1` - ;; - tar) - VERSION=`$APP_PATH --version | head -1 | cut -d" " -f4` + case "$1" in + $foamTestApp) + VERSION=`$1 -case /dev/null 2>&1 \ + | sed -ne 's/^.*Version: *\([^ ][^ ]*\).*/\1/p'` + ;; + gcc) + VERSION=`$1 -v 2>&1 \ + | sed -ne 's/^gcc version \([0-9][0-9.]*\).*/\1/p' ` + + if [ "$VERSION" != "$SUPPLIED_VERSION_GCC" ] + then + echo "WARNING: gcc version does not match gcc supplied" \ + "with this release of OpenFOAM" + echo " Supplied version: $SUPPLIED_VERSION_GCC" + echo " User version : $VERSION" + echo " Minimum required: $MIN_VERSION_GCC" + echo "" + fi + ;; + gtar) + VERSION=`$APP_PATH --version | head -1` + ;; + tar) + VERSION=`$APP_PATH --version | head -1 | cut -d" " -f4` + ;; + gzip) + case "$OSTYPE" in + SunOS) + VERSION=`$1 --version 2>&1 | grep gzip | cut -d" " -f2` ;; - gzip) - case $OS in - SunOS) - VERSION=`$1 --version 2>&1 | grep gzip | cut -d" " -f2` - ;; - *) - VERSION=`$1 --version | head -1 | cut -d" " -f2` - ;; - esac + *) + VERSION=`$1 --version | head -1 | cut -d" " -f2` ;; + esac + ;; esac - if [ "$APP_PATH" = "$APP_SPEC" ] || [ ! "$2" ]; then + if [ "$APP_PATH" = "$APP_SPEC" ] || [ ! "$2" ] + then echo "`fixlen "$1" 9` `fixlen "$VERSION" 10` `fixlen "$APP_PATH" 58`" else echo "`fixlen "$1" 9` `fixlen "$VERSION" 10`" echo "WARNING: Conflicting installations:" echo " OpenFOAM settings : $APP_SPEC" echo " current path : $APP_PATH" - case $1 in - icoFoam) - echo " CRITICAL ERROR" - CRITICALERROR=`expr $CRITICALERROR + 1` - ;; - gcc) - echo " CRITICAL ERROR" - CRITICALERROR=`expr $CRITICALERROR + 1` - ;; - gtar) ;; - gzip) ;; - dx) ;; + case "$1" in + gcc | $foamTestApp) + echo " CRITICAL ERROR" + criticalError=`expr $criticalError + 1` + ;; esac echo "" fi } -pingTest () { - RESULT="" - case $OS in - SunOS) - PINGTEST=`/usr/sbin/ping $1 2>&1` - if [ "`echo $PINGTEST | grep alive`" != "" ] ; then - RESULT="Successful" - elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then - RESULT="No_entry_for_\"$1\"_in_/etc/hosts" - else - RESULT="Networking_cannot_reach_$1" - fi - ;; - *) - PINGTEST=`/bin/ping -w 3 -c 1 $1 2>&1` - if [ "`echo $PINGTEST | grep '1 received'`" != "" ] ; then - RESULT="Successful" - elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then - RESULT="No_entry_for_\"$1\"_in_/etc/hosts" - else - RESULT="Networking_cannot_reach_$1" - fi - ;; - esac - - echo "`fixlen "Pinging_$1" 25` `fixlen "$RESULT" 45` `fixlen "$2" 5`" - - if [ "$2" = yes ] && [ "$RESULT" != Successful ]; then - CRITICALERROR=`expr $CRITICALERROR + 1` - echo "WARNING: CRITICAL ERROR" - echo - fi -} - - -telnetPortTest () { -telnet -e A $1 $2 <<EOF -A -quit -EOF -} - - -checkTelnetPort () { - if [ -x "/usr/bin/telnet" ] || [ -x "/bin/telnet" ] ; then - RESULT=`telnetPortTest $1 $2 2>&1 | egrep "onnect.* [t|r]"` - if [ "`echo $RESULT | grep 'Connected to'`" ] ; then - RESULT='Successful' - elif [ "`echo $RESULT | grep 'Connection refused'`" ] ; then - RESULT='Unsuccessful_connection_refused*' - else - RESULT="Not_active*" - fi - else - RESULT='No_telnet_installed:_cannot_check*' - fi -} - - -checkRsh () { - checkTelnetPort $HOST_NAME 222 - echo "`fixlen "Test_rsh:" 25` `fixlen "$RESULT" 45` "yes"" - if [ "$RESULT" != Successful ]; then - SSHRSHOK=`expr $SSHRSHOK + 1` - fi -} - - -checkSsh () { - checkTelnetPort $HOST_NAME 22 - echo "`fixlen "Test_ssh:" 25` `fixlen "$RESULT" 45` "yes"" - if [ "$RESULT" != Successful ]; then - SSHRSHOK=`expr $SSHRSHOK + 1` - fi -} - - -checkOpenFOAMEnvironment() { +checkOpenFOAMEnvironment() +{ [ -d "$WM_PROJECT_INST_DIR" ] && [ -d "$WM_THIRD_PARTY_DIR" ] || { echo "" echo "FATAL ERROR: OpenFOAM environment not configured." @@ -396,54 +313,50 @@ checkOpenFOAMEnvironment() { } -checkUserShell() { +checkUserShell() +{ + echo "`fixlen Shell: $WIDTH` ${SHELL##*/}" case $SHELL in - */csh | */tcsh) - # USER_CONFIG_TYPE="cshrc" - echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}" - ;; - */bash | */ksh) - # USER_CONFIG_TYPE="bashrc" - echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}" - ;; - *) - # USER_CONFIG_TYPE="" - echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}" - echo "FATAL ERROR: Cannot identify the shell you are running." - echo " OpenFOAM ${FOAM_VERSION} is compatible with " - echo " csh, tcsh, ksh and bash." - echo - FATALERROR=`expr $FATALERROR + 1`;; + */csh | */tcsh | */bash | */ksh) + ;; + *) + echo "FATAL ERROR: Cannot identify the shell you are running." + echo " OpenFOAM ${FOAM_VERSION} is compatible with " + echo " csh, tcsh, ksh and bash." + echo + fatalError=`expr $fatalError + 1` + ;; esac } -checkHostName() { - if [ ! "$HOST_NAME" ]; then - echo "`fixlen "Host:" $WIDTH` ${HOST_NAME}" +checkHostName() +{ + echo "`fixlen Host: $WIDTH` $HOST" + if [ ! "$HOST" ] + then echo "FATAL ERROR: Cannot stat hostname." echo " Contact your system administrator, " echo " OpenFOAM ${FOAM_VERSION} needs a valid " echo " hostname to function." echo - FATALERROR=`expr $FATALERROR + 1` - else - echo "`fixlen "Host:" $WIDTH` ${HOST_NAME}" + fatalError=`expr $fatalError + 1` fi } -checkOS () { - case "$OS" in +checkOS() +{ + case "$OSTYPE" in Linux | LinuxAMD64 | SunOS ) - echo "`fixlen "OS:" $WIDTH` ${OS} version $(uname -r)" + echo "`fixlen OS: $WIDTH` $OSTYPE version $(uname -r)" ;; *) - echo "FATAL ERROR: Incompatible operating system \"$OS\"." - echo " OpenFOAM ${FOAM_VERSION} is currently " + echo "FATAL ERROR: Incompatible operating system \"$OSTYPE\"." + echo " OpenFOAM $FOAM_VERSION is currently " echo " available for Linux and SunOS only." echo - FATALERROR=`expr $FATALERROR + 1` + fatalError=`expr $fatalError + 1` ;; esac } @@ -466,8 +379,8 @@ hline #------------------------------------------------------------------------------ heading "Checking main OpenFOAM env variables..." -COL1=`fixlen "Environment_variable" 21` -COL2=`fixlen "Set_to_file_or_directory" 40` +COL1=`fixlen Environment_variable 21` +COL2=`fixlen Set_to_file_or_directory 40` COL3="Valid" COL4="Path" COL5="Crit" @@ -505,20 +418,21 @@ hline #------------------------------------------------------------------------------ heading "Third party software" -COL1=`fixlen "Software" 9` -COL2=`fixlen "Version" 10` -COL3=`fixlen "Location" 10` +COL1=`fixlen Software 9` +COL2=`fixlen Version 10` +COL3=`fixlen Location 10` hline echo "$COL1 $COL2 $COL3" hline -reportExecutable gcc "${WM_COMPILER_DIR}/bin/gcc" +reportExecutable gcc reportExecutable gzip -if [ "$OS" = Linux ] ; then +if [ "$OSTYPE" = Linux ] +then reportExecutable tar else reportExecutable gtar fi -reportExecutable icoFoam "${FOAM_APPBIN}/icoFoam" +reportExecutable $foamTestApp "$FOAM_APPBIN/$foamTestApp" hline @@ -526,27 +440,28 @@ hline heading "Summary" hline -if [ $FATALERROR -gt 0 ] ; then - echo "The system test has evoked $FATALERROR fatal error(s)." +if [ $fatalError -gt 0 ] +then + echo "The system test has evoked $fatalError fatal error(s)." else echo "Base configuration ok." fi -echo "" -if [ $CRITICALERROR -gt 0 ]; then - echo "The foam installation contains $CRITICALERROR critical error(s)." +if [ $criticalError -gt 0 ] +then + echo "The foam installation contains $criticalError critical error(s)." else echo "Critical systems ok." fi -echo "" -if [ $CRITICALERROR -gt 0 ] || [ $FATALERROR -gt 0 ]; then - echo "Review the output for warning messages and consult " - echo "the installation guide for trouble shooting." +if [ $criticalError -gt 0 ] || [ $fatalError -gt 0 ] +then + echo + echo "Review the output for warning messages and consult" + echo "the installation guide for troubleshooting." fi -echo "" -echo "done." - -echo "" +echo +echo Done +echo exit 0 diff --git a/bin/foamRunTutorials b/bin/foamRunTutorials index 7c52b6b9e1793eca994bc47f593ea6ad06e14817..2d0c8f7a711ec649a8ff4e7a7bf53f5e48a7b439 100755 --- a/bin/foamRunTutorials +++ b/bin/foamRunTutorials @@ -46,7 +46,7 @@ if [ $# = 0 -a -f "./Allrun" ] then # Specialised script. ./Allrun -elif [ -d "./system" ] +elif [ -d system ] then # Normal case. parentDir=`dirname $PWD` @@ -55,19 +55,19 @@ then runApplication $application else # Loop over sub-directories and compile any applications - for case in * + for caseName in * do - if [ -d $case -a -d "$case/Make" ] + if [ -d $caseName -a -d "$caseName/Make" ] then - (compileApplication $case) + ( compileApplication $caseName ) fi done # Recurse to subdirectories - for case in * + for caseName in * do - if [ -d $case ] + if [ -d $caseName ] then - (cd $case && $thisScript) + ( cd $caseName && $thisScript ) fi done fi diff --git a/bin/foamSystemCheck b/bin/foamSystemCheck index 0d739d64fae008920631fa68ef0a7e873f621446..50061b532d6160a065b9812021ae956ad96eecc1 100755 --- a/bin/foamSystemCheck +++ b/bin/foamSystemCheck @@ -38,31 +38,32 @@ FOAM_VERSION=1.6 HLINE="-----------------------------------------------------------------------" WIDTH=16 -unset FATALERROR +unset fatalError # FUNCTIONS # ~~~~~~~~~ -heading () { - echo "" +heading() +{ + echo echo "$1" echo "$HLINE" } -lenBase () { +lenBase() +{ echo $1 | tr -d " " | wc -m | tr -d " " } -length () { +length() +{ NOCHAR=$(lenBase $1) NOCHAR=$(expr $NOCHAR - 1) - if [ $NOCHAR -eq -1 ] - then - NOCHAR=0 - fi + [ $NOCHAR -ge 0 ] || NOCHAR=0 echo $NOCHAR } -fixlen () { +fixlen() +{ WORD=$1 ONELEN=$(length "$1") LDIFF=$(expr $ONELEN - $2) @@ -86,48 +87,43 @@ fixlen () { heading "Checking basic system..." # check shell -echo "$(fixlen "Shell:" $WIDTH) $SHELL" +echo "$(fixlen Shell: $WIDTH) $SHELL" case "$SHELL" in -*/csh | */tcsh) - USER_CONFIG_TYPE=cshrc - ;; -*/bash | */ksh) - USER_CONFIG_TYPE=bashrc +*/csh | */tcsh | */bash | */ksh) ;; *) - USER_CONFIG_TYPE="" - echo "FATALERROR: Cannot identify the current shell." - echo " OpenFOAM ${FOAM_VERSION} is compatible" - echo " with csh, tcsh, ksh and bash." + echo "ERROR: Cannot identify the current shell." + echo " OpenFOAM $FOAM_VERSION is compatible" + echo " with csh, tcsh, ksh and bash." echo - FATALERROR=yes + fatalError=true ;; esac # check hostname HOST=$(uname -n) -echo "$(fixlen "Host:" $WIDTH) $HOST" +echo "$(fixlen Host: $WIDTH) $HOST" if [ $(length $HOST) -eq 0 ] then - echo "FATALERROR: Cannot stat hostname." - echo " OpenFOAM ${FOAM_VERSION} needs a valid hostname to function." - echo " Contact your system administrator. " + echo "ERROR: Cannot stat hostname." + echo " OpenFOAM $FOAM_VERSION needs a valid hostname to function." + echo " Contact your system administrator. " echo - FATALERROR=yes + fatalError=true fi # check os -OS=$(uname -s) -case "$OS" in +OSTYPE=$(uname -s) +case "$OSTYPE" in Linux | LinuxAMD64 | SunOS ) - echo "$(fixlen "OS:" $WIDTH) ${OS} version $(uname -r)" + echo "$(fixlen OS: $WIDTH) $OSTYPE version $(uname -r)" ;; *) - echo "FATALERROR: Incompatible operating system \"$OS\"." - echo " OpenFOAM ${FOAM_VERSION} is currently available for " - echo " Linux, LinuxAMD64 and SunOS only." + echo "ERROR: Incompatible operating system \"$OSTYPE\"." + echo " OpenFOAM $FOAM_VERSION is currently available for " + echo " Linux, LinuxAMD64 and SunOS only." echo - FATALERROR=yes + fatalError=true ;; esac @@ -139,20 +135,20 @@ then USER_NAME=$USER fi -echo "$(fixlen "User:" $WIDTH) ${USER_NAME}" +echo "$(fixlen User: $WIDTH) ${USER_NAME}" if [ $(length $USER_NAME) -eq 0 ] then - echo "FATALERROR: Cannot stat user name ${USER_NAME}." - echo " OpenFOAM ${FOAM_VERSION} needs a valid user name." - echo " Contact your system administrator. " - echo "" - FATALERROR=yes + echo "ERROR: Cannot stat user name $USER_NAME." + echo " OpenFOAM $FOAM_VERSION needs a valid user name." + echo " Contact your system administrator. " + echo + fatalError=true fi -echo "" -echo "" -if [ -n "$FATALERROR" ] +echo +echo +if [ "$fatalError" = true ] then echo "System check: FAIL" echo "==================" diff --git a/bin/foamTags b/bin/foamTags index 18ad697768d0ab0da6fbd3e1e728611cab0795e1..3331c16bf211d8f2ce59a0a5d6219234d2b50478 100755 --- a/bin/foamTags +++ b/bin/foamTags @@ -45,12 +45,12 @@ for cmd in etags ectags do type $cmd >/dev/null 2>&1 || { echo "${0##*/} cannot build tag files: '$cmd' command not found" - exit + exit 1 } done -cd $WM_PROJECT_DIR || exit +cd $WM_PROJECT_DIR || exit 1 mkdir .tags 2>/dev/null diff --git a/bin/rm~all b/bin/rm~all index afc658b76bafe3868584e2f8d84d3ea45b97542d..6d53ec55a2ee5c1ee6d23959769786a318e233c6 100755 --- a/bin/rm~all +++ b/bin/rm~all @@ -49,7 +49,7 @@ do echo "removing all *~ files: $i" find $i \( -name '*~' -o -name '.*~' \) -print | xargs -t rm 2>/dev/null else - echo "no directory: $i" 1>&2 + echo "no directory: $i" 1>&2 fi done diff --git a/bin/tools/inlineReplace b/bin/tools/inlineReplace index 4e502bccb2935dcd2d524b5fce1675f9a0ed1323..27d19f8164984cc6df4a4cea9e96690fe15a4127 100755 --- a/bin/tools/inlineReplace +++ b/bin/tools/inlineReplace @@ -1,31 +1,30 @@ #!/bin/sh -# $0 string1 string2 file1 .. filen +# $0 oldString newString file1 .. fileN # if [ $# -lt 3 ] then - echo "Usage: ${0##*/} [-f] <string1> <string2> <file1> .. <filen>" + echo "Usage: ${0##*/} <oldString> <newString> <file1> [.. fileN]" echo "" - echo "Replaces all occurrences of string1 by string2 in files." - echo "(replacement of sed -i on those systems that don't support it)" + echo "Replaces all occurrences of oldString by newString in files." + echo "(replacement for sed -i on systems that don't support it)" exit 1 fi -FROMSTRING=$1 -shift -TOSTRING=$1 -shift +oldString="$1" +newString="$2" +shift 2 -for f in $* +for f do - if grep "$FROMSTRING" "$f" >/dev/null + if grep "$oldString" "$f" >/dev/null then cp "$f" "${f}_bak" - sed -e "s@$FROMSTRING@$TOSTRING@g" "${f}"_bak > "$f" - rm -f "${f}"_bak + sed -e "s@$oldString@$newString@g" "${f}_bak" > "$f" + rm -f "${f}_bak" #else - # echo "String $FROMSTRING not present in $f" - #fi + # echo "String $oldString not present in $f" + fi done # ----------------------------------------------------------------- end-of-file diff --git a/etc/bashrc b/etc/bashrc index c3e7c82bb35b207dd6e247066469fae7d8f8ec10..d05a702df0733aa60f3c18b73adc82211dd51895 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -159,7 +159,7 @@ Linux) export WM_LDFLAGS='-m64' ;; *) - echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64 + echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64" ;; esac ;; diff --git a/etc/cshrc b/etc/cshrc index fd3e7d68344cbae91dce9075a028a69932baccf8..29c1d82983433986c4c393b952987ea69a430ec2 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -149,7 +149,7 @@ case Linux: breaksw default: - echo Unknown WM_ARCH_OPTION $WM_ARCH_OPTION, should be 32 or 64 + echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64" breaksw endsw @@ -213,13 +213,15 @@ endsw # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath +#- prevent local variables from shadowing setenv variables +unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD + if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH '' if (! $?MANPATH) setenv MANPATH '' #- Clean PATH (path) set cleaned=`$foamClean "$PATH" "$foamOldDirs"` if ( $status == 0 ) then - unset PATH setenv PATH $cleaned endif diff --git a/etc/settings.csh b/etc/settings.csh index 5d2950662c71b5fde615e0b1dfc3f59f71fe4a54..a09edd6f1476d4d141ec11c9a0fc5471e9a366a3 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -74,6 +74,11 @@ _foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN} # Make sure to pick up dummy versions of external libraries last _foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_LIBBIN}/dummy +# Compiler settings +# ~~~~~~~~~~~~~~~~~ +unset gcc_version gmp_version mpfr_version +unsetenv MPFR_ARCH_PATH + # Select compiler installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -84,40 +89,95 @@ switch ("$compilerInstall") case OpenFOAM: switch ("$WM_COMPILER") case Gcc: - setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.3 - _foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.2/lib - _foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-5.0.1/lib - breaksw + set gcc_version=gcc-4.4.3 + set gmp_version=gmp-5.0.1 + set mpfr_version=mpfr-2.4.2 + breaksw + case Gcc442: - setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.2 - _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 + set gcc_version=gcc-4.4.2 + set gmp_version=gmp-4.2.4 + set mpfr_version=mpfr-2.4.1 + breaksw + + case Gcc44: + set gcc_version=gcc-4.4.2 + set gmp_version=gmp-4.2.4 + set mpfr_version=mpfr-2.4.1 + breaksw + case Gcc43: - setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.3.3 - _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 - endsw + set gcc_version=gcc-4.3.3 + set gmp_version=gmp-4.2.4 + set mpfr_version=mpfr-2.4.1 + breaksw - # Check that the compiler directory can be found - if ( ! -d "$WM_COMPILER_DIR" ) then + default: echo echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" - echo " Cannot find $WM_COMPILER_DIR installation." - echo " Please install this compiler version or if you wish to use the system compiler," - echo " change the 'compilerInstall' setting to 'system' in this file" + echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" + echo " Please check your settings" echo - endif + breaksw - _foamAddPath ${WM_COMPILER_DIR}/bin - _foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}:${WM_COMPILER_DIR}/lib - _foamAddMan ${WM_COMPILER_DIR}/man + endsw + + if ( $?gcc_version ) then + set gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version + set gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version + set mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version + + # Check that the compiler directory can be found + if ( ! -d "$gccDir" ) then + echo + echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo " Cannot find $gccDir installation." + echo " Please install this compiler version or if you wish to use the system compiler," + echo " change the 'compilerInstall' setting to 'system' in this file" + echo + endif + + _foamAddMan $gccDir/man + _foamAddPath $gccDir/bin + _foamAddLib $gccDir/lib${WM_COMPILER_LIB_ARCH}:$gccDir/lib + + # add in gmp/mpfr libraries + _foamAddLib $gmpDir/lib + _foamAddLib $mpfrDir/lib + + # used by boost/CGAL: + setenv MPFR_ARCH_PATH $mpfrDir + endif + unset gcc_version gccDir gmp_version gmpDir mpfr_version mpfrDir breaksw endsw +# boost and CGAL +# ~~~~~~~~~~~~~~ + +set boost_version=boost_1_42_0 +set cgal_version=CGAL-3.5.1 + +setenv BOOST_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version +setenv CGAL_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version + +# enabled if CGAL is available +if ( -d "$CGAL_ARCH_PATH" ) then + if ( -d "$BOOST_ARCH_PATH" ) then + _foamAddLib $BOOST_ARCH_PATH/lib + else + unsetenv BOOST_ARCH_PATH + endif + _foamAddLib $CGAL_ARCH_PATH/lib +else + unsetenv BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH +endif + +unset boost_version cgal_version + + # Communications library # ~~~~~~~~~~~~~~~~~~~~~~ @@ -259,17 +319,10 @@ else endif -# CGAL library if available -# ~~~~~~~~~~~~~~~~~~~~~~~~~ -if ( $?CGAL_LIB_DIR ) then - _foamAddLib $CGAL_LIB_DIR -endif - - # Enable the hoard memory allocator if available # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #if ( -f $FOAM_LIBBIN/libhoard.so ) then -# setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:${LD_PRELOAD} +# setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:$LD_PRELOAD #endif diff --git a/etc/settings.sh b/etc/settings.sh index 8aab7498a68b36526799a4de0c8e58b69db43198..779725847fe6ada161e6bc72fbef92bcf7310151 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -98,10 +98,9 @@ _foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN # Make sure to pick up dummy versions of external libraries last _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_LIBBIN/dummy - # Compiler settings # ~~~~~~~~~~~~~~~~~ -unset compilerBin compilerLib compilerMan +unset gcc_version gmp_version mpfr_version MPFR_ARCH_PATH # Select compiler installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -112,52 +111,97 @@ case "${compilerInstall:-OpenFOAM}" in OpenFOAM) case "$WM_COMPILER" in Gcc) - export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.3 - _foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/mpfr-2.4.2/lib - _foamAddLib $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gmp-5.0.1/lib + gcc_version=gcc-4.4.3 + gmp_version=gmp-5.0.1 + mpfr_version=mpfr-2.4.2 ;; Gcc442) - export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.2 - _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 + gcc_version=gcc-4.4.2 + gmp_version=gmp-4.2.4 + mpfr_version=mpfr-2.4.1 ;; Gcc44) - export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.4.2 - _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 + gcc_version=gcc-4.4.2 + gmp_version=gmp-4.2.4 + mpfr_version=mpfr-2.4.1 ;; Gcc43) - export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/gcc-4.3.3 - _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 + gcc_version=gcc-4.3.3 + gmp_version=gmp-4.2.4 + mpfr_version=mpfr-2.4.1 ;; - esac - - # Check that the compiler directory can be found - if [ ! -d "$WM_COMPILER_DIR" ] - then + *) echo echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" - echo " Cannot find $WM_COMPILER_DIR installation." - echo " Please install this compiler version or if you wish to use the system compiler," - echo " change the 'compilerInstall' setting to 'system' in this file" + echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" + echo " Please check your settings" echo - fi + ;; + esac - compilerBin=$WM_COMPILER_DIR/bin - compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib - compilerMan=$WM_COMPILER_DIR/man + if [ -n "$gcc_version" ] + then + gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version + gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version + mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version + + # Check that the compiler directory can be found + [ -d "$gccDir" ] || { + echo + echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" + echo " Cannot find $gccDir installation." + echo " Please install this compiler version or if you wish to use the system compiler," + echo " change the 'compilerInstall' setting to 'system' in this file" + echo + } + + _foamAddMan $gccDir/man + _foamAddPath $gccDir/bin + _foamAddLib $gccDir/lib + + # 64-bit needs lib64, but 32-bit needs lib (not lib32) + if [ "$WM_ARCH_OPTION" = 64 ] + then + _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH + fi + + # add in gmp/mpfr libraries + _foamAddLib $gmpDir/lib + _foamAddLib $mpfrDir/lib + + # used by boost/CGAL: + export MPFR_ARCH_PATH=$mpfrDir + fi + unset gcc_version gccDir gmp_version gmpDir mpfr_version mpfrDir ;; esac -if [ -d "$compilerBin" ] + +# boost and CGAL +# ~~~~~~~~~~~~~~ + +boost_version=boost_1_42_0 +cgal_version=CGAL-3.5.1 + +export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version +export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version + +# enabled if CGAL is available +if [ -d "$CGAL_ARCH_PATH" ] then - _foamAddPath $compilerBin - _foamAddLib $compilerLib - _foamAddMan $compilerMan + if [ -d "$BOOST_ARCH_PATH" ] + then + _foamAddLib $BOOST_ARCH_PATH/lib + else + unset BOOST_ARCH_PATH + fi + _foamAddLib $CGAL_ARCH_PATH/lib +else + unset BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH fi -unset compilerBin compilerLib compilerMan compilerInstall +unset boost_version cgal_version + # Communications library # ~~~~~~~~~~~~~~~~~~~~~~ @@ -301,11 +345,6 @@ fi export MPI_BUFFER_SIZE -# CGAL library if available -# ~~~~~~~~~~~~~~~~~~~~~~~~~ -[ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR - - # Enable the hoard memory allocator if available # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #if [ -f $FOAM_LIBBIN/libhoard.so ] @@ -316,6 +355,6 @@ export MPI_BUFFER_SIZE # cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ -unset _foamAddPath _foamAddLib _foamAddMan minBufferSize +unset _foamAddPath _foamAddLib _foamAddMan compilerInstall minBufferSize # ----------------------------------------------------------------- end-of-file diff --git a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C index 017c20d692c6d205042050eabb8ae0bae43840b5..654497a782daf70fc16f057407d6fe318a45973f 100644 --- a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C +++ b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C @@ -40,7 +40,7 @@ template <class Type> const Foam::scalar Foam::FaceCellWave<Type>::geomTol_ = 1e-6; template <class Type> -const Foam::scalar Foam::FaceCellWave<Type>::propagationTol_ = 0.01; +Foam::scalar Foam::FaceCellWave<Type>::propagationTol_ = 0.01; // Write to ostream template <class Type> diff --git a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.H b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.H index 6bf08d8e92eab7a587c7eb3de5a3048564da4e8f..86cb13e3517250000b80a6a8b44aee00c70a666a 100644 --- a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.H +++ b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.H @@ -252,7 +252,7 @@ class FaceCellWave // Private static data static const scalar geomTol_; - static const scalar propagationTol_; + static scalar propagationTol_; public: diff --git a/src/finiteVolume/cfdTools/general/bound/bound.C b/src/finiteVolume/cfdTools/general/bound/bound.C index b6290337546252e9c547907cde00c7989a5b5e05..7054434c0ff654f7934df602e962780538bdb375 100644 --- a/src/finiteVolume/cfdTools/general/bound/bound.C +++ b/src/finiteVolume/cfdTools/general/bound/bound.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 @@ -30,11 +30,11 @@ License // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // -void Foam::bound(volScalarField& vsf, const dimensionedScalar& vsf0) +void Foam::bound(volScalarField& vsf, const dimensionedScalar& lowerBound) { - scalar minVsf = min(vsf).value(); + const scalar minVsf = min(vsf).value(); - if (minVsf < vsf0.value()) + if (minVsf < lowerBound.value()) { Info<< "bounding " << vsf.name() << ", min: " << minVsf @@ -47,13 +47,13 @@ void Foam::bound(volScalarField& vsf, const dimensionedScalar& vsf0) max ( vsf.internalField(), - fvc::average(max(vsf, vsf0))().internalField() - *pos(-vsf.internalField()) + fvc::average(max(vsf, lowerBound))().internalField() + * pos(-vsf.internalField()) ), - vsf0.value() + lowerBound.value() ); - vsf.boundaryField() = max(vsf.boundaryField(), vsf0.value()); + vsf.boundaryField() = max(vsf.boundaryField(), lowerBound.value()); } } diff --git a/src/finiteVolume/cfdTools/general/bound/bound.H b/src/finiteVolume/cfdTools/general/bound/bound.H index 08a58e55504b474ac9a575beec9b572512410f01..f301c5a217f6e5337d74874b1536ce6d4378288d 100644 --- a/src/finiteVolume/cfdTools/general/bound/bound.H +++ b/src/finiteVolume/cfdTools/general/bound/bound.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 @@ -23,11 +23,13 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA InNamespace - Foam::bound + Foam Description - Bound the given scalar field if it has gone unbounded. Used extensively - in RAS and LES turbulence models. + Bound the given scalar field if it has gone unbounded. + + Used extensively in RAS and LES turbulence models, but also of use + within solvers. SourceFiles bound.C @@ -49,7 +51,7 @@ namespace Foam //- Bound the given scalar field if it has gone unbounded. // Used extensively in RAS and LES turbulence models. -void bound(volScalarField& vsf, const dimensionedScalar& vsf0); +void bound(volScalarField&, const dimensionedScalar& lowerBound); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.C b/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.C index 41063cd2cd9ceab0c265ad068e8223471ed21427..609fa986f183e5db1b702c804f9c6ba7d2a3ac2e 100644 --- a/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.C +++ b/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.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 @@ -106,7 +106,7 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU) volScalarField K = 0.5*tr(B_); - solve + tmp<fvSymmTensorMatrix> BEqn ( fvm::ddt(rho(), B_) + fvm::div(phi(), B_) @@ -118,6 +118,8 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU) - (2*ce_ - 0.667*cm_)*I*rho()*epsilon() ); + BEqn().relax(); + BEqn().solve(); // Bounding the component kinetic energies @@ -132,7 +134,7 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU) } K = 0.5*tr(B_); - bound(K, k0()); + bound(K, kMin_); updateSubGridScaleFields(K); } diff --git a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.C b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.C index 055c76214e814589ba1dd8c461a0d6f6c53810d3..366808ad08ab9cbe1de929c3e3932df81ea33c3b 100644 --- a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.C +++ b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.C @@ -108,7 +108,9 @@ GenEddyVisc::GenEddyVisc ), mesh_ ) -{} +{ + bound(k_, kMin_); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/compressible/LES/LESModel/LESModel.C b/src/turbulenceModels/compressible/LES/LESModel/LESModel.C index 6ac295dea68c6bcf8ec213714e6fee2f40b45ed1..556ee0ca51554326b4d66a0987bd4875aa5faa61 100644 --- a/src/turbulenceModels/compressible/LES/LESModel/LESModel.C +++ b/src/turbulenceModels/compressible/LES/LESModel/LESModel.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 @@ -79,11 +79,11 @@ LESModel::LESModel printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), coeffDict_(subOrEmptyDict(type + "Coeffs")), - k0_("k0", dimVelocity*dimVelocity, SMALL), + kMin_("kMin", sqr(dimVelocity), SMALL), delta_(LESdelta::New("delta", U.mesh(), *this)) { - readIfPresent("k0", k0_); + readIfPresent("kMin", kMin_); // Force the construction of the mesh deltaCoeffs which may be needed // for the construction of the derived models and BCs @@ -131,8 +131,12 @@ autoPtr<LESModel> LESModel::New { FatalErrorIn ( - "LESModel::New(const volVectorField& U, const " - "surfaceScalarField& phi, const basicThermo&)" + "LESModel::New" + "(" + "const volVectorField&, " + "const surfaceScalarField&, " + "const basicThermo&" + ")" ) << "Unknown LESModel type " << modelName << endl << endl << "Valid LESModel types are :" << endl @@ -167,7 +171,7 @@ bool LESModel::read() coeffDict_ <<= *dictPtr; } - readIfPresent("k0", k0_); + kMin_.readIfPresent(*this); delta_().read(*this); diff --git a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H index 2cdde6c61eda86c94183ae323944ef04866bdb89..6b10b930cccd63f432ece858d60d9f7b6a323a9c 100644 --- a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/compressible/LES/LESModel/LESModel.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 @@ -83,7 +83,7 @@ protected: Switch printCoeffs_; dictionary coeffDict_; - dimensionedScalar k0_; + dimensionedScalar kMin_; autoPtr<LESdelta> delta_; @@ -170,16 +170,16 @@ public: return coeffDict_; } - //- Return the value of k0 which k is not allowed to be less than - const dimensionedScalar& k0() const + //- Return the lower allowable limit for k (default: SMALL) + const dimensionedScalar& kMin() const { - return k0_; + return kMin_; } - //- Allow k0 to be changed - dimensionedScalar& k0() + //- Allow kMin to be changed + dimensionedScalar& kMin() { - return k0_; + return kMin_; } //- Access function to filter width diff --git a/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.C b/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.C index 22f688e7d5715a941ed8898c03c47b621a9af260..b054f2eebac1a0d79bf32699cd6f3f8a1f5b6591 100644 --- a/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.C +++ b/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.C @@ -302,7 +302,7 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& tgradU) volScalarField Stilda = fv3()*::sqrt(2.0)*mag(skew(gradU)) + fv2()*nuTilda_/sqr(kappa_*dTilda_); - solve + tmp<fvScalarMatrix> nuTildaEqn ( fvm::ddt(rho(), nuTilda_) + fvm::div(phi(), nuTilda_) @@ -318,6 +318,9 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& tgradU) - fvm::Sp(rho()*Cw1_*fw(Stilda)*nuTilda_/sqr(dTilda_), nuTilda_) ); + nuTildaEqn().relax(); + nuTildaEqn().solve(); + bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0)); nuTilda_.correctBoundaryConditions(); diff --git a/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.C b/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.C index edd0f4bcf079b07f551a0e1fc831a075900ecc19..08587e11e958e48966a41e27e91c6b50d9204537 100644 --- a/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.C +++ b/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.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 @@ -74,10 +74,10 @@ dimensionedScalar dynOneEqEddy::ce_(const volSymmTensorField& D) const pow(KK + filter_(k_), 1.5)/(2*delta()) - filter_(pow(k_, 1.5))/delta(); volScalarField ee = - 2*delta()*ck_(D)* - ( + 2*delta()*ck_(D) + *( filter_(sqrt(k_)*magSqr(D)) - - 2*sqrt(KK + filter_(k_))*magSqr(filter_(D)) + - 2*sqrt(KK + filter_(k_))*magSqr(filter_(D)) ); return average(ee*mm)/average(mm*mm); @@ -118,7 +118,7 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU) volScalarField divU = fvc::div(phi()/fvc::interpolate(rho())); volScalarField G = 2*muSgs_*(gradU && D); - solve + tmp<fvScalarMatrix> kEqn ( fvm::ddt(rho(), k_) + fvm::div(phi(), k_) @@ -129,7 +129,10 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU) - fvm::Sp(ce_(D)*rho()*sqrt(k_)/delta(), k_) ); - bound(k_, dimensionedScalar("0", k_.dimensions(), 1.0e-10)); + kEqn().relax(); + kEqn().solve(); + + bound(k_, kMin_); updateSubGridScaleFields(D); } diff --git a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C index 77b12af60e986f60818ce5a63aac45687f2642c6..4ab154f209d3b3c31ec1eeda67ceb6f096051d2e 100644 --- a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C +++ b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.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 @@ -106,7 +106,7 @@ void lowReOneEqEddy::correct(const tmp<volTensorField>& tgradU) volScalarField divU = fvc::div(phi()/fvc::interpolate(rho())); volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU))); - solve + tmp<fvScalarMatrix> kEqn ( fvm::ddt(rho(), k_) + fvm::div(phi(), k_) @@ -117,7 +117,10 @@ void lowReOneEqEddy::correct(const tmp<volTensorField>& tgradU) - fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_) ); - bound(k_, k0()); + kEqn().relax(); + kEqn().solve(); + + bound(k_, kMin_); updateSubGridScaleFields(); } diff --git a/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C b/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C index c6212dd74c250cc9faba61c91ad05d7792e68443..b2a01a7ac59f8ce6e8cef57a089932953201ef75 100644 --- a/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C +++ b/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.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 @@ -93,7 +93,7 @@ void oneEqEddy::correct(const tmp<volTensorField>& tgradU) volScalarField divU = fvc::div(phi()/fvc::interpolate(rho())); volScalarField G = 2*muSgs_*(gradU && dev(symm(gradU))); - fvScalarMatrix kEqn + tmp<fvScalarMatrix> kEqn ( fvm::ddt(rho(), k_) + fvm::div(phi(), k_) @@ -104,10 +104,10 @@ void oneEqEddy::correct(const tmp<volTensorField>& tgradU) - fvm::Sp(ce_*rho()*sqrt(k_)/delta(), k_) ); - kEqn.relax(); - kEqn.solve(); + kEqn().relax(); + kEqn().solve(); - bound(k_, k0()); + bound(k_, kMin_); updateSubGridScaleFields(); } diff --git a/src/turbulenceModels/compressible/RAS/LRR/LRR.C b/src/turbulenceModels/compressible/RAS/LRR/LRR.C index e2d925c3bbf4616c0175371a4b03145b61a29160..c567a4df2f54dca589ccdf057783848a0e84c32d 100644 --- a/src/turbulenceModels/compressible/RAS/LRR/LRR.C +++ b/src/turbulenceModels/compressible/RAS/LRR/LRR.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 @@ -229,7 +229,10 @@ LRR::LRR << exit(FatalError); } - mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + mut_ = Cmu_*rho_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); alphat_ = mut_/Prt_; @@ -324,7 +327,7 @@ void LRR::correct() if (!turbulence_) { // Re-calculate viscosity - mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity @@ -359,7 +362,7 @@ void LRR::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Reynolds stress equation @@ -406,15 +409,15 @@ void LRR::correct() R_.dimensions(), symmTensor ( - k0_.value(), -GREAT, -GREAT, - k0_.value(), -GREAT, - k0_.value() + kMin_.value(), -GREAT, -GREAT, + kMin_.value(), -GREAT, + kMin_.value() ) ) ); k_ = 0.5*tr(R_); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C index 66c54ec222233cd8cdbae18fc8b8f755e4533b82..8f019890db89736f62bd10e516d8ac0c7a4d8924 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.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 @@ -258,7 +258,10 @@ LaunderGibsonRSTM::LaunderGibsonRSTM << exit(FatalError); } - mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + mut_ = Cmu_*rho_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); alphat_ = mut_/Prt_; @@ -357,7 +360,7 @@ void LaunderGibsonRSTM::correct() if (!turbulence_) { // Re-calculate viscosity - mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity @@ -397,7 +400,7 @@ void LaunderGibsonRSTM::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Reynolds stress equation @@ -453,15 +456,15 @@ void LaunderGibsonRSTM::correct() R_.dimensions(), symmTensor ( - k0_.value(), -GREAT, -GREAT, - k0_.value(), -GREAT, - k0_.value() + kMin_.value(), -GREAT, -GREAT, + kMin_.value(), -GREAT, + kMin_.value() ) ) ); k_ == 0.5*tr(R_); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate turbulent viscosity diff --git a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C index f1dc4e9203767f045707e99ffb66103d7e5e47e4..93f30ec930d644d6cf269d33444a520fc728958b 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C +++ b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.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 @@ -187,7 +187,10 @@ LaunderSharmaKE::LaunderSharmaKE autoCreateAlphat("alphat", mesh_) ) { - mut_ = rho_*Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + mut_ = rho_*Cmu_*fMu()*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); alphat_ = mut_/Prt_; @@ -275,7 +278,7 @@ void LaunderSharmaKE::correct() if (!turbulence_) { // Re-calculate viscosity - mut_ == rho_*Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_); + mut_ == rho_*Cmu_*fMu()*sqr(k_)/epsilon_; // Re-calculate thermal diffusivity alphat_ = mut_/Prt_; @@ -320,7 +323,7 @@ void LaunderSharmaKE::correct() epsEqn().relax(); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -338,11 +341,11 @@ void LaunderSharmaKE::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity - mut_ == Cmu_*fMu()*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); + mut_ == Cmu_*fMu()*rho_*sqr(k_)/epsilon_; // Re-calculate thermal diffusivity diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C index ffab28703b52976b621b8dd3506ded787962e2e6..2c35c3cec0fd88d0f744f379d43aa4003b439e45 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.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 @@ -81,11 +81,9 @@ RASModel::RASModel printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), coeffDict_(subOrEmptyDict(type + "Coeffs")), - k0_("k0", dimVelocity*dimVelocity, SMALL), - epsilon0_("epsilon", k0_.dimensions()/dimTime, SMALL), - epsilonSmall_("epsilonSmall", epsilon0_.dimensions(), SMALL), - omega0_("omega", dimless/dimTime, SMALL), - omegaSmall_("omegaSmall", omega0_.dimensions(), SMALL), + kMin_("kMin", sqr(dimVelocity), SMALL), + epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL), + omegaMin_("omegaMin", dimless/dimTime, SMALL), y_(mesh_) { @@ -135,9 +133,13 @@ autoPtr<RASModel> RASModel::New { FatalErrorIn ( - "RASModel::New(const volScalarField&, " - "const volVectorField&, const surfaceScalarField&, " - "basicThermo&)" + "RASModel::New" + "(" + "const volScalarField&, " + "const volVectorField&, " + "const surfaceScalarField&, " + "basicThermo&" + ")" ) << "Unknown RASModel type " << modelName << endl << endl << "Valid RASModel types are :" << endl @@ -219,11 +221,9 @@ bool RASModel::read() coeffDict_ <<= *dictPtr; } - k0_.readIfPresent(*this); - epsilon0_.readIfPresent(*this); - epsilonSmall_.readIfPresent(*this); - omega0_.readIfPresent(*this); - omegaSmall_.readIfPresent(*this); + kMin_.readIfPresent(*this); + epsilonMin_.readIfPresent(*this); + omegaMin_.readIfPresent(*this); return true; } diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H index 883fa0825a32e106dadd870c853f38ec3319a061..9bddec38aa7f7d0eee0e5b9379af7944c0f5820c 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.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 @@ -93,19 +93,13 @@ protected: scalar yPlusLam_; //- Lower limit of k - dimensionedScalar k0_; + dimensionedScalar kMin_; //- Lower limit of epsilon - dimensionedScalar epsilon0_; - - //- Small epsilon value used to avoid divide by zero - dimensionedScalar epsilonSmall_; + dimensionedScalar epsilonMin_; //- Lower limit for omega - dimensionedScalar omega0_; - - //- Small omega value used to avoid divide by zero - dimensionedScalar omegaSmall_; + dimensionedScalar omegaMin_; //- Near wall distance boundary field nearWallDist y_; @@ -185,68 +179,40 @@ public: // Access - //- Return the value of k0 which k is not allowed to be less than - const dimensionedScalar& k0() const - { - return k0_; - } - - //- Return the value of epsilon0 which epsilon is not allowed to be - // less than - const dimensionedScalar& epsilon0() const - { - return epsilon0_; - } - - //- Return the value of epsilonSmall which is added to epsilon when - // calculating nut - const dimensionedScalar& epsilonSmall() const - { - return epsilonSmall_; - } - - //- Return the value of omega0 which epsilon is not allowed to be - // less than - const dimensionedScalar& omega0() const - { - return omega0_; - } - - //- Return the value of omegaSmall which is added to epsilon when - // calculating nut - const dimensionedScalar& omegaSmall() const + //- Return the lower allowable limit for k (default: SMALL) + const dimensionedScalar& kMin() const { - return omegaSmall_; + return kMin_; } - //- Allow k0 to be changed - dimensionedScalar& k0() + //- Return the lower allowable limit for epsilon (default: SMALL) + const dimensionedScalar& epsilonMin() const { - return k0_; + return epsilonMin_; } - //- Allow epsilon0 to be changed - dimensionedScalar& epsilon0() + //- Return the lower allowable limit for omega (default: SMALL) + const dimensionedScalar& omegaMin() const { - return epsilon0_; + return omegaMin_; } - //- Allow epsilonSmall to be changed - dimensionedScalar& epsilonSmall() + //- Allow kMin to be changed + dimensionedScalar& kMin() { - return epsilonSmall_; + return kMin_; } - //- Allow omega0 to be changed - dimensionedScalar& omega0() + //- Allow epsilonMin to be changed + dimensionedScalar& epsilonMin() { - return omega0_; + return epsilonMin_; } - //- Allow omegaSmall to be changed - dimensionedScalar& omegaSmall() + //- Allow omegaMin to be changed + dimensionedScalar& omegaMin() { - return omegaSmall_; + return omegaMin_; } //- Return the near wall distances diff --git a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C index 2fc2bdab294ab8a4c8247cd54e2a2f9ab92d80cd..3159265c96b9ba59eb761e94b4d706300c83ef46 100644 --- a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.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 @@ -186,7 +186,10 @@ RNGkEpsilon::RNGkEpsilon autoCreateAlphat("alphat", mesh_) ) { - mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + mut_ = Cmu_*rho_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); alphat_ = mut_/Prt_; @@ -276,7 +279,7 @@ void RNGkEpsilon::correct() if (!turbulence_) { // Re-calculate viscosity - mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity @@ -327,7 +330,7 @@ void RNGkEpsilon::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -339,12 +342,12 @@ void RNGkEpsilon::correct() - fvm::laplacian(DkEff(), k_) == G - fvm::SuSp(2.0/3.0*rho_*divU, k_) - - fvm::Sp(rho_*(epsilon_)/k_, k_) + - fvm::Sp(rho_*epsilon_/k_, k_) ); kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C index e0c04f1e446f9594b093b3ea543954d7a670016f..973c802fd9e3da5080177e655e2c29d84a30aab6 100644 --- a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C +++ b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.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 @@ -168,7 +168,10 @@ kEpsilon::kEpsilon autoCreateAlphat("alphat", mesh_) ) { - mut_ = Cmu_*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + mut_ = Cmu_*rho_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); alphat_ = mut_/Prt_; @@ -257,7 +260,7 @@ void kEpsilon::correct() if (!turbulence_) { // Re-calculate viscosity - mut_ = rho_*Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + mut_ = rho_*Cmu_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity @@ -300,7 +303,7 @@ void kEpsilon::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -318,7 +321,7 @@ void kEpsilon::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C index d7627f35e00e636e2a89b12995e2f9aecd72cdd1..123de2099dbad5eb0a903542ff30f6c4670ac9c8 100644 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C +++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.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 @@ -258,7 +258,18 @@ kOmegaSST::kOmegaSST autoCreateAlphat("alphat", mesh_) ) { - mut_ = a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(magSqr(symm(fvc::grad(U_))))); + bound(k_, kMin_); + bound(omega_, omegaMin_); + + mut_ = + ( + a1_*rho_*k_ + / max + ( + a1_*omega_, + F2()*sqrt(magSqr(symm(fvc::grad(U_)))) + ) + ); mut_.correctBoundaryConditions(); alphat_ = mut_/Prt_; @@ -414,7 +425,7 @@ void kOmegaSST::correct() omegaEqn().boundaryManipulate(omega_.boundaryField()); solve(omegaEqn); - bound(omega_, omega0_); + bound(omega_, omegaMin_); // Turbulent kinetic energy equation tmp<fvScalarMatrix> kEqn @@ -430,7 +441,7 @@ void kOmegaSST::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C index a79eff7b8a9e7647e8a85022f55f445fed39d863..c03e603acf69d3b1eac5736f40b4426f8ff1d4c5 100644 --- a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C +++ b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.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 @@ -69,7 +69,7 @@ tmp<volScalarField> realizableKE::rCmu volScalarField As = sqrt(6.0)*cos(phis); volScalarField Us = sqrt(S2/2.0 + magSqr(skew(gradU))); - return 1.0/(A0_ + As*Us*k_/(epsilon_ + epsilonSmall_)); + return 1.0/(A0_ + As*Us*k_/epsilon_); } @@ -200,10 +200,10 @@ realizableKE::realizableKE autoCreateAlphat("alphat", mesh_) ) { - bound(k_, k0_); - bound(epsilon_, epsilon0_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); - mut_ = rCmu(fvc::grad(U_))*rho_*sqr(k_)/(epsilon_ + epsilonSmall_); + mut_ = rCmu(fvc::grad(U_))*rho_*sqr(k_)/epsilon_; mut_.correctBoundaryConditions(); alphat_ = mut_/Prt_; @@ -341,7 +341,7 @@ void realizableKE::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -353,12 +353,12 @@ void realizableKE::correct() - fvm::laplacian(DkEff(), k_) == G - fvm::SuSp(2.0/3.0*rho_*divU, k_) - - fvm::Sp(rho_*(epsilon_)/k_, k_) + - fvm::Sp(rho_*epsilon_/k_, k_) ); kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity mut_ = rCmu(gradU, S2, magS)*rho_*sqr(k_)/epsilon_; diff --git a/src/turbulenceModels/incompressible/LES/DeardorffDiffStress/DeardorffDiffStress.C b/src/turbulenceModels/incompressible/LES/DeardorffDiffStress/DeardorffDiffStress.C index dd35b035ece5d9e6bcea56bd2d8909c83da1d60e..06b7beedfbdeacf48741184fcb7799a86bb8397d 100644 --- a/src/turbulenceModels/incompressible/LES/DeardorffDiffStress/DeardorffDiffStress.C +++ b/src/turbulenceModels/incompressible/LES/DeardorffDiffStress/DeardorffDiffStress.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 @@ -102,7 +102,7 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU) volScalarField K = 0.5*tr(B_); volScalarField Epsilon = 2*nuEff()*magSqr(D); - fvSymmTensorMatrix BEqn + tmp<fvSymmTensorMatrix> BEqn ( fvm::ddt(B_) + fvm::div(phi(), B_) @@ -114,23 +114,23 @@ void DeardorffDiffStress::correct(const tmp<volTensorField>& tgradU) - (2*ce_ - 0.667*cm_)*I*Epsilon ); - BEqn.relax(); - BEqn.solve(); + BEqn().relax(); + BEqn().solve(); // Bounding the component kinetic energies forAll(B_, celli) { B_[celli].component(symmTensor::XX) = - max(B_[celli].component(symmTensor::XX), k0().value()); + max(B_[celli].component(symmTensor::XX), kMin_.value()); B_[celli].component(symmTensor::YY) = - max(B_[celli].component(symmTensor::YY), k0().value()); + max(B_[celli].component(symmTensor::YY), kMin_.value()); B_[celli].component(symmTensor::ZZ) = - max(B_[celli].component(symmTensor::ZZ), k0().value()); + max(B_[celli].component(symmTensor::ZZ), kMin_.value()); } K = 0.5*tr(B_); - bound(K, k0()); + bound(K, kMin_); updateSubGridScaleFields(K); } diff --git a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.C b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.C index fd7791d9f322cfae4c5ba3bd81335d714fe00903..34966eb22c64375dafbcc0864e4553a25d2de8e6 100644 --- a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.C +++ b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.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 @@ -78,10 +78,10 @@ LESModel::LESModel printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), coeffDict_(subOrEmptyDict(type + "Coeffs")), - k0_("k0", dimVelocity*dimVelocity, SMALL), + kMin_("kMin", sqr(dimVelocity), SMALL), delta_(LESdelta::New("delta", U.mesh(), *this)) { - readIfPresent("k0", k0_); + readIfPresent("kMin", kMin_); // Force the construction of the mesh deltaCoeffs which may be needed // for the construction of the derived models and BCs @@ -128,8 +128,12 @@ autoPtr<LESModel> LESModel::New { FatalErrorIn ( - "LESModel::New(const volVectorField& U, const " - "surfaceScalarField& phi, transportModel&)" + "LESModel::New" + "(" + "const volVectorField&, " + "const surfaceScalarField& ," + "transportModel&" + ")" ) << "Unknown LESModel type " << modelName << endl << endl << "Valid LESModel types are :" << endl @@ -167,7 +171,7 @@ bool LESModel::read() delta_().read(*this); - readIfPresent("k0", k0_); + kMin_.readIfPresent(*this); return true; } diff --git a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H index 49fe52c4541d1ee46d56953f33a732c1869a0911..8b4b43ceda126b522643cae4ae40d3908bd53144 100644 --- a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.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 @@ -83,7 +83,7 @@ protected: Switch printCoeffs_; dictionary coeffDict_; - dimensionedScalar k0_; + dimensionedScalar kMin_; autoPtr<LESdelta> delta_; @@ -171,16 +171,16 @@ public: return delta_(); } - //- Return the value of k0 which k is not allowed to be less than - const dimensionedScalar& k0() const + //- Return the lower allowable limit for k (default: SMALL) + const dimensionedScalar& kMin() const { - return k0_; + return kMin_; } - //- Allow k0 to be changed - dimensionedScalar& k0() + //- Allow kMin to be changed + dimensionedScalar& kMin() { - return k0_; + return kMin_; } diff --git a/src/turbulenceModels/incompressible/LES/LRRDiffStress/LRRDiffStress.C b/src/turbulenceModels/incompressible/LES/LRRDiffStress/LRRDiffStress.C index 58368cc587c12a74a477d6a85159492340a62bb2..5e31e281dc2f3e96fc9313f73d7acc2db6c19450 100644 --- a/src/turbulenceModels/incompressible/LES/LRRDiffStress/LRRDiffStress.C +++ b/src/turbulenceModels/incompressible/LES/LRRDiffStress/LRRDiffStress.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 @@ -90,7 +90,10 @@ LRRDiffStress::LRRDiffStress ) ) { - updateSubGridScaleFields(0.5*tr(B_)); + volScalarField K = 0.5*tr(B_); + bound(K, kMin_); + + updateSubGridScaleFields(K); printCoeffs(); } @@ -111,7 +114,7 @@ void LRRDiffStress::correct(const tmp<volTensorField>& tgradU) volScalarField K = 0.5*tr(B_); volScalarField Epsilon = 2*nuEff()*magSqr(D); - fvSymmTensorMatrix BEqn + tmp<fvSymmTensorMatrix> BEqn ( fvm::ddt(B_) + fvm::div(phi(), B_) @@ -124,23 +127,23 @@ void LRRDiffStress::correct(const tmp<volTensorField>& tgradU) - (0.667 - 2*c1_)*I*pow(K, 1.5)/delta() ); - BEqn.relax(); - BEqn.solve(); + BEqn().relax(); + BEqn().solve(); // Bounding the component kinetic energies forAll(B_, celli) { B_[celli].component(symmTensor::XX) = - max(B_[celli].component(symmTensor::XX), k0().value()); + max(B_[celli].component(symmTensor::XX), kMin_.value()); B_[celli].component(symmTensor::YY) = - max(B_[celli].component(symmTensor::YY), k0().value()); + max(B_[celli].component(symmTensor::YY), kMin_.value()); B_[celli].component(symmTensor::ZZ) = - max(B_[celli].component(symmTensor::ZZ), k0().value()); + max(B_[celli].component(symmTensor::ZZ), kMin_.value()); } K = 0.5*tr(B_); - bound(K, k0()); + bound(K, kMin_); updateSubGridScaleFields(K); } diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C index 0932bb524eeed23598afcb244f8fe0639390b062..431656cc6fe03e4437135052e58cfec85584344a 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C @@ -295,7 +295,7 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU) const volScalarField dTilda = this->dTilda(S); const volScalarField STilda = this->STilda(S, dTilda); - fvScalarMatrix nuTildaEqn + tmp<fvScalarMatrix> nuTildaEqn ( fvm::ddt(nuTilda_) + fvm::div(phi(), nuTilda_) @@ -311,8 +311,8 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU) - fvm::Sp(Cw1_*fw(STilda, dTilda)*nuTilda_/sqr(dTilda), nuTilda_) ); - nuTildaEqn.relax(); - nuTildaEqn.solve(); + nuTildaEqn().relax(); + nuTildaEqn().solve(); bound(nuTilda_, dimensionedScalar("zero", nuTilda_.dimensions(), 0.0)); nuTilda_.correctBoundaryConditions(); diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C index 22f9b638e21dadc30e3a0f027fa61d073290304f..48dac551fa5fd40e2322db493db95befb4b7fb8c 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C @@ -176,7 +176,6 @@ SpalartAllmarasIDDES::SpalartAllmarasIDDES 1.63 ) ) - {} diff --git a/src/turbulenceModels/incompressible/LES/dynOneEqEddy/dynOneEqEddy.C b/src/turbulenceModels/incompressible/LES/dynOneEqEddy/dynOneEqEddy.C index 4aadf02bf2ea098f7521c95f826768894638bae5..ab777728354d6f5a868a12084417159b5ecfa81b 100644 --- a/src/turbulenceModels/incompressible/LES/dynOneEqEddy/dynOneEqEddy.C +++ b/src/turbulenceModels/incompressible/LES/dynOneEqEddy/dynOneEqEddy.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 @@ -80,10 +80,10 @@ dimensionedScalar dynOneEqEddy::ce(const volSymmTensorField& D) const pow(KK + filter_(k_), 1.5)/(2*delta()) - filter_(pow(k_, 1.5))/delta(); volScalarField ee = - 2*delta()*ck(D) + 2*delta()*ck(D) *( - filter_(sqrt(k_)*magSqr(D)) - - 2*sqrt(KK + filter_(k_))*magSqr(filter_(D)) + filter_(sqrt(k_)*magSqr(D)) + - 2*sqrt(KK + filter_(k_))*magSqr(filter_(D)) ); dimensionedScalar mmmm = average(magSqr(mm)); @@ -127,6 +127,8 @@ dynOneEqEddy::dynOneEqEddy filterPtr_(LESfilter::New(U.mesh(), coeffDict())), filter_(filterPtr_()) { + bound(k_, kMin_); + updateSubGridScaleFields(symm(fvc::grad(U))); printCoeffs(); @@ -135,15 +137,17 @@ dynOneEqEddy::dynOneEqEddy // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void dynOneEqEddy::correct(const tmp<volTensorField>& gradU) +void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU) { + const volTensorField& gradU = tgradU(); + GenEddyVisc::correct(gradU); volSymmTensorField D = symm(gradU); volScalarField P = 2.0*nuSgs_*magSqr(D); - fvScalarMatrix kEqn + tmp<fvScalarMatrix> kEqn ( fvm::ddt(k_) + fvm::div(phi(), k_) @@ -153,10 +157,10 @@ void dynOneEqEddy::correct(const tmp<volTensorField>& gradU) - fvm::Sp(ce(D)*sqrt(k_)/delta(), k_) ); - kEqn.relax(); - kEqn.solve(); + kEqn().relax(); + kEqn().solve(); - bound(k_, k0()); + bound(k_, kMin_); updateSubGridScaleFields(D); } diff --git a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C b/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C index fedd18ee7d169d5fcb7f2741dc1e05f82f78db2a..f2bf70721feceff64543e5e97c477e77f7d8e647 100644 --- a/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C +++ b/src/turbulenceModels/incompressible/LES/dynSmagorinsky/dynSmagorinsky.C @@ -118,6 +118,8 @@ dynSmagorinsky::dynSmagorinsky filterPtr_(LESfilter::New(U.mesh(), coeffDict())), filter_(filterPtr_()) { + bound(k_, kMin_); + updateSubGridScaleFields(dev(symm(fvc::grad(U)))); printCoeffs(); @@ -133,6 +135,7 @@ void dynSmagorinsky::correct(const tmp<volTensorField>& gradU) volSymmTensorField D = dev(symm(gradU)); k_ = cI(D)*sqr(delta())*magSqr(D); + bound(k_, kMin_); updateSubGridScaleFields(D); } diff --git a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C index a755d4e56e8a02b6fccea56adf22b75043471c6a..708c090351d36c772f185ec0068e10dedc2f91be 100644 --- a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C +++ b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -263,8 +263,7 @@ kOmegaSSTSAS::kOmegaSSTSAS ) ), - omega0_("omega0", dimless/dimTime, SMALL), - omegaSmall_("omegaSmall", dimless/dimTime, SMALL), + omegaMin_("omegaMin", dimless/dimTime, SMALL), y_(mesh_), Cmu_ ( @@ -324,6 +323,9 @@ kOmegaSSTSAS::kOmegaSSTSAS mesh_ ) { + bound(k_, kMin_); + bound(omega_, omegaMin_); + updateSubGridScaleFields(magSqr(symm(fvc::grad(U)))); printCoeffs(); @@ -346,9 +348,8 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU) volVectorField gradK = fvc::grad(k_); volVectorField gradOmega = fvc::grad(omega_); - volScalarField L = sqrt(k_)/(pow025(Cmu_)*(omega_ + omegaSmall_)); - volScalarField CDkOmega = - (2.0*alphaOmega2_)*(gradK & gradOmega)/(omega_ + omegaSmall_); + volScalarField L = sqrt(k_)/(pow025(Cmu_)*omega_); + volScalarField CDkOmega = (2.0*alphaOmega2_)*(gradK & gradOmega)/omega_; volScalarField F1 = this->F1(CDkOmega); volScalarField G = nuSgs_*2.0*S2; @@ -368,14 +369,12 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU) kEqn.relax(); kEqn.solve(); } - bound(k_, k0()); + bound(k_, kMin_); volScalarField grad_omega_k = max ( - magSqr(gradOmega)/ - sqr(omega_ + omegaSmall_), - magSqr(gradK)/ - sqr(k_ + k0()) + magSqr(gradOmega)/sqr(omega_), + magSqr(gradK)/sqr(k_) ); // Turbulent frequency equation @@ -397,7 +396,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU) + FSAS_ *max ( - dimensionedScalar("zero",dimensionSet(0, 0 , -2, 0, 0),0. ), + dimensionedScalar("zero",dimensionSet(0, 0, -2, 0, 0), 0.0), zetaTilda2_*kappa_*S2*(L/Lvk2(S2)) - 2.0/alphaPhi_*k_*grad_omega_k ) @@ -406,7 +405,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU) omegaEqn.relax(); omegaEqn.solve(); } - bound(omega_, omega0_); + bound(omega_, omegaMin_); updateSubGridScaleFields(S2); } diff --git a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.H b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.H index 89b9a8819021d01d4d360e7e3111dcd1db1ffbd8..4c2ac8d55bc753d74c915daeb0b135fb13646405 100644 --- a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.H +++ b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -103,8 +103,7 @@ protected: dimensionedScalar zetaTilda2_; dimensionedScalar FSAS_; - dimensionedScalar omega0_; - dimensionedScalar omegaSmall_; + dimensionedScalar omegaMin_; wallDist y_; dimensionedScalar Cmu_; diff --git a/src/turbulenceModels/incompressible/LES/locDynOneEqEddy/locDynOneEqEddy.C b/src/turbulenceModels/incompressible/LES/locDynOneEqEddy/locDynOneEqEddy.C index f463e3f2082aad874af2ce36dfd8def76e93ed75..93db2120edd700866b2340144d20ab0ac6daac1f 100644 --- a/src/turbulenceModels/incompressible/LES/locDynOneEqEddy/locDynOneEqEddy.C +++ b/src/turbulenceModels/incompressible/LES/locDynOneEqEddy/locDynOneEqEddy.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 @@ -119,6 +119,8 @@ locDynOneEqEddy::locDynOneEqEddy filterPtr_(LESfilter::New(U.mesh(), coeffDict())), filter_(filterPtr_()) { + bound(k_, kMin_); + volScalarField KK = 0.5*(filter_(magSqr(U)) - magSqr(filter_(U))); updateSubGridScaleFields(symm(fvc::grad(U)), KK); @@ -139,7 +141,7 @@ void locDynOneEqEddy::correct(const tmp<volTensorField>& gradU) volScalarField P = 2.0*nuSgs_*magSqr(D); - fvScalarMatrix kEqn + tmp<fvScalarMatrix> kEqn ( fvm::ddt(k_) + fvm::div(phi(), k_) @@ -149,10 +151,10 @@ void locDynOneEqEddy::correct(const tmp<volTensorField>& gradU) - fvm::Sp(ce(D, KK)*sqrt(k_)/delta(), k_) ); - kEqn.relax(); - kEqn.solve(); + kEqn().relax(); + kEqn().solve(); - bound(k_, k0()); + bound(k_, kMin_); updateSubGridScaleFields(D, KK); } diff --git a/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C b/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C index 28a0a1ed5a00ddac94a2b0818ee2343c279f9faf..89ad1892e35ad07e335b44fbfa55b74c5dcff2b6 100644 --- a/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C +++ b/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.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 @@ -86,6 +86,8 @@ oneEqEddy::oneEqEddy ) ) { + bound(k_, kMin_); + updateSubGridScaleFields(); printCoeffs(); @@ -100,7 +102,7 @@ void oneEqEddy::correct(const tmp<volTensorField>& gradU) volScalarField G = 2.0*nuSgs_*magSqr(symm(gradU)); - fvScalarMatrix kEqn + tmp<fvScalarMatrix> kEqn ( fvm::ddt(k_) + fvm::div(phi(), k_) @@ -110,10 +112,10 @@ void oneEqEddy::correct(const tmp<volTensorField>& gradU) - fvm::Sp(ce_*sqrt(k_)/delta(), k_) ); - kEqn.relax(); - kEqn.solve(); + kEqn().relax(); + kEqn().solve(); - bound(k_, k0()); + bound(k_, kMin_); updateSubGridScaleFields(); } diff --git a/src/turbulenceModels/incompressible/LES/spectEddyVisc/spectEddyVisc.C b/src/turbulenceModels/incompressible/LES/spectEddyVisc/spectEddyVisc.C index 4a16af3576c37166c229ea34e97bc78e2805cda9..f6ab218082d99d3c6be18e74c82d0f53c897a946 100644 --- a/src/turbulenceModels/incompressible/LES/spectEddyVisc/spectEddyVisc.C +++ b/src/turbulenceModels/incompressible/LES/spectEddyVisc/spectEddyVisc.C @@ -72,7 +72,6 @@ spectEddyVisc::spectEddyVisc LESModel(typeName, U, phi, transport), GenEddyVisc(U, phi, transport), - cB_ ( dimensioned<scalar>::lookupOrAddToDict diff --git a/src/turbulenceModels/incompressible/RAS/LRR/LRR.C b/src/turbulenceModels/incompressible/RAS/LRR/LRR.C index 08d1b4a39aaefcb1a9686281ae1672ed29e9d0b5..ae79bb4389bfa00896e6b28f9885f4d058a02c43 100644 --- a/src/turbulenceModels/incompressible/RAS/LRR/LRR.C +++ b/src/turbulenceModels/incompressible/RAS/LRR/LRR.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 @@ -186,9 +186,6 @@ LRR::LRR autoCreateNut("nut", mesh_) ) { - nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); - nut_.correctBoundaryConditions(); - if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0) { FatalErrorIn @@ -201,6 +198,12 @@ LRR::LRR << exit(FatalError); } + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + nut_ = Cmu_*sqr(k_)/epsilon_; + nut_.correctBoundaryConditions(); + printCoeffs(); } @@ -320,7 +323,7 @@ void LRR::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Reynolds stress equation @@ -368,15 +371,15 @@ void LRR::correct() R_.dimensions(), symmTensor ( - k0_.value(), -GREAT, -GREAT, - k0_.value(), -GREAT, - k0_.value() + kMin_.value(), -GREAT, -GREAT, + kMin_.value(), -GREAT, + kMin_.value() ) ) ); k_ = 0.5*tr(R_); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C index 1edcb224b556829a6a0aa2a1a8ce383ed251b662..5f036cff106db453c031fa064bbee469c5123988 100644 --- a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C +++ b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.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 @@ -140,7 +140,10 @@ LamBremhorstKE::LamBremhorstKE autoCreateLowReNut("nut", mesh_) ) { - nut_ = Cmu_*fMu_*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + nut_ = Cmu_*fMu_*sqr(k_)/epsilon_; nut_.correctBoundaryConditions(); printCoeffs(); @@ -260,7 +263,7 @@ void LamBremhorstKE::correct() epsEqn().relax(); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -276,7 +279,7 @@ void LamBremhorstKE::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C index 33939dfc15f32f79a28c0d32c2bb4cb9ce0fbf99..41f696222463a969dbdcc6720015557d2594f0fa 100644 --- a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.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 @@ -224,7 +224,10 @@ LaunderGibsonRSTM::LaunderGibsonRSTM autoCreateNut("nut", mesh_) ) { - nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + nut_ = Cmu_*sqr(k_)/epsilon_; nut_.correctBoundaryConditions(); if (couplingFactor_.value() < 0.0 || couplingFactor_.value() > 1.0) @@ -362,7 +365,7 @@ void LaunderGibsonRSTM::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Reynolds stress equation @@ -419,15 +422,15 @@ void LaunderGibsonRSTM::correct() R_.dimensions(), symmTensor ( - k0_.value(), -GREAT, -GREAT, - k0_.value(), -GREAT, - k0_.value() + kMin_.value(), -GREAT, -GREAT, + kMin_.value(), -GREAT, + kMin_.value() ) ) ); k_ == 0.5*tr(R_); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate turbulent viscosity diff --git a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C index 3bbdcb6a4734a47eee3a0543d5ed6d741d653e12..e62cbf2578f52ce83bd29ca3f4e5c4ddebb05b79 100644 --- a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C +++ b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.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 @@ -146,7 +146,10 @@ LaunderSharmaKE::LaunderSharmaKE autoCreateLowReNut("nut", mesh_) ) { - nut_ = Cmu_*fMu()*sqr(k_)/(epsilonTilda_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilonTilda_, epsilonMin_); + + nut_ = Cmu_*fMu()*sqr(k_)/epsilonTilda_; nut_.correctBoundaryConditions(); printCoeffs(); @@ -256,7 +259,7 @@ void LaunderSharmaKE::correct() epsEqn().relax(); solve(epsEqn); - bound(epsilonTilda_, epsilon0_); + bound(epsilonTilda_, epsilonMin_); // Turbulent kinetic energy equation @@ -272,7 +275,7 @@ void LaunderSharmaKE::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C index c786116bd9dd1652bcdd24027a8b18074312610b..d91f974fbe8f2a7f210747d659ee355e2d93d3c5 100644 --- a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C +++ b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.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 @@ -171,8 +171,16 @@ LienCubicKE::LienCubicKE ), gradU_(fvc::grad(U)), - eta_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))), - ksi_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))), + eta_ + ( + k_/(epsilon_ + epsilonMin_) + *sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T()))) + ), + ksi_ + ( + k_/(epsilon_ + epsilonMin_) + *sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T()))) + ), Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))), fEta_(A2_ + pow(eta_, 3.0)), @@ -226,7 +234,10 @@ LienCubicKE::LienCubicKE ) ) { - nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_) + C5viscosity_; + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + nut_ = Cmu_*sqr(k_)/epsilon_ + C5viscosity_; nut_.correctBoundaryConditions(); printCoeffs(); @@ -350,7 +361,7 @@ void LienCubicKE::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -367,7 +378,7 @@ void LienCubicKE::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C index 2146553f0f6b758230156e68243fdb28af9b598c..046f5a6fa1b339ea2968223560624faadaffba22 100644 --- a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C +++ b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.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 @@ -220,14 +220,22 @@ LienCubicKELowRe::LienCubicKELowRe y_(mesh_), gradU_(fvc::grad(U)), - eta_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))), - ksi_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))), + eta_ + ( + k_/(epsilon_ + epsilonMin_) + *sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T()))) + ), + ksi_ + ( + k_/(epsilon_ + epsilonMin_) + *sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T()))) + ), Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))), - fEta_(A2_ + pow(eta_, 3.0)), + fEta_(A2_ + pow3(eta_)), C5viscosity_ ( - -2.0*pow(Cmu_, 3.0)*pow(k_, 4.0)/pow(epsilon_, 3.0) + -2.0*pow3(Cmu_)*pow4(k_)/pow3(epsilon_ + epsilonMin_) *(magSqr(gradU_ + gradU_.T()) - magSqr(gradU_ - gradU_.T())) ), @@ -252,7 +260,7 @@ LienCubicKELowRe::LienCubicKELowRe symm ( // quadratic terms - pow(k_, 3.0)/sqr(epsilon_) + pow3(k_)/sqr(epsilon_ + epsilonMin_) *( Ctau1_/fEta_ *( @@ -263,8 +271,8 @@ LienCubicKELowRe::LienCubicKELowRe + Ctau3_/fEta_*(gradU_.T() & gradU_) ) // cubic term C4 - - 20.0*pow(k_, 4.0)/pow(epsilon_, 3.0) - *pow(Cmu_, 3.0) + - 20.0*pow4(k_)/pow3(epsilon_ + epsilonMin_) + *pow3(Cmu_) *( ((gradU_ & gradU_) & gradU_.T()) + ((gradU_ & gradU_.T()) & gradU_.T()) @@ -280,12 +288,13 @@ LienCubicKELowRe::LienCubicKELowRe ) ) { + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + nut_ = Cmu_ - *( - scalar(1) - exp(-Am_*yStar_)) - /(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL - ) - *sqr(k_)/(epsilon_ + epsilonSmall_) + * (scalar(1) - exp(-Am_*yStar_)) + / (scalar(1) - exp(-Aepsilon_*yStar_) + SMALL) + * sqr(k_)/epsilon_ // cubic term C5, implicit part + max ( @@ -430,11 +439,11 @@ void LienCubicKELowRe::correct() epsEqn().relax(); -# include "LienCubicKELowReSetWallDissipation.H" -# include "wallDissipationI.H" + #include "LienCubicKELowReSetWallDissipation.H" + #include "wallDissipationI.H" solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -451,7 +460,7 @@ void LienCubicKELowRe::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C index 6e47e1d926f77bd2e5a794decc8a6c4c16ddfd65..72a455d945fb04a3f509e193315683e0d5b9ab76 100644 --- a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C +++ b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.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 @@ -180,9 +180,12 @@ LienLeschzinerLowRe::LienLeschzinerLowRe autoCreateLowReNut("nut", mesh_) ) { + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + nut_ = Cmu_*(scalar(1) - exp(-Am_*yStar_)) /(scalar(1) - exp(-Aepsilon_*yStar_) + SMALL)*sqr(k_) - /(epsilon_ + epsilonSmall_); + /(epsilon_); nut_.correctBoundaryConditions(); printCoeffs(); @@ -322,7 +325,7 @@ void LienLeschzinerLowRe::correct() #include "wallDissipationI.H" solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -339,7 +342,7 @@ void LienLeschzinerLowRe::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C index f6d778b3a6f68b8762725a8c798bc3c0f926bc56..c885d87f163ec5cce7ad3e4a790aa2ee4d8faec5 100644 --- a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C +++ b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.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 @@ -190,19 +190,27 @@ NonlinearKEShih::NonlinearKEShih ), gradU_(fvc::grad(U)), - eta_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T())))), - ksi_(k_/epsilon_*sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T())))), + eta_ + ( + k_/(epsilon_ + epsilonMin_) + *sqrt(2.0*magSqr(0.5*(gradU_ + gradU_.T()))) + ), + ksi_ + ( + k_/(epsilon_+ epsilonMin_) + *sqrt(2.0*magSqr(0.5*(gradU_ - gradU_.T()))) + ), Cmu_(2.0/(3.0*(A1_ + eta_ + alphaKsi_*ksi_))), fEta_(A2_ + pow(eta_, 3.0)), - nut_("nut", Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_)), + nut_("nut", Cmu_*sqr(k_)/(epsilon_ + epsilonMin_)), nonlinearStress_ ( "nonlinearStress", symm ( - pow(k_, 3.0)/sqr(epsilon_) + pow3(k_)/sqr(epsilon_ + epsilonMin_) *( Ctau1_/fEta_ *( @@ -215,6 +223,9 @@ NonlinearKEShih::NonlinearKEShih ) ) { + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + #include "wallNonlinearViscosityI.H" printCoeffs(); @@ -343,7 +354,7 @@ void NonlinearKEShih::correct() #include "wallDissipationI.H" solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -360,7 +371,7 @@ void NonlinearKEShih::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.C b/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.C index 1803075428c9e1ac2a8b9b0317fe9f9ef6f49b79..c7d97e08e9f340da09d9541f373e14338e1331ce 100644 --- a/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.C +++ b/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.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 @@ -80,11 +80,9 @@ RASModel::RASModel printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), coeffDict_(subOrEmptyDict(type + "Coeffs")), - k0_("k0", dimVelocity*dimVelocity, SMALL), - epsilon0_("epsilon", k0_.dimensions()/dimTime, SMALL), - epsilonSmall_("epsilonSmall", epsilon0_.dimensions(), SMALL), - omega0_("omega0", dimless/dimTime, SMALL), - omegaSmall_("omegaSmall", omega0_.dimensions(), SMALL), + kMin_("kMin", sqr(dimVelocity), SMALL), + epsilonMin_("epsilonMin", kMin_.dimensions()/dimTime, SMALL), + omegaMin_("omegaMin", dimless/dimTime, SMALL), y_(mesh_) { @@ -133,8 +131,12 @@ autoPtr<RASModel> RASModel::New { FatalErrorIn ( - "RASModel::New(const volVectorField&, " - "const surfaceScalarField&, transportModel&)" + "RASModel::New" + "(" + "const volVectorField&, " + "const surfaceScalarField&, " + "transportModel&" + ")" ) << "Unknown RASModel type " << modelName << endl << endl << "Valid RASModel types are :" << endl @@ -213,11 +215,9 @@ bool RASModel::read() coeffDict_ <<= *dictPtr; } - k0_.readIfPresent(*this); - epsilon0_.readIfPresent(*this); - epsilonSmall_.readIfPresent(*this); - omega0_.readIfPresent(*this); - omegaSmall_.readIfPresent(*this); + kMin_.readIfPresent(*this); + epsilonMin_.readIfPresent(*this); + omegaMin_.readIfPresent(*this); return true; } diff --git a/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H index ce57c6690edae2da612bbbef2fc0f3dda1357cda..337f044f0a5e27c289cb426f984647180a1fad9c 100644 --- a/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.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 @@ -87,19 +87,13 @@ protected: dictionary coeffDict_; //- Lower limit of k - dimensionedScalar k0_; + dimensionedScalar kMin_; //- Lower limit of epsilon - dimensionedScalar epsilon0_; - - //- Small epsilon value used to avoid divide by zero - dimensionedScalar epsilonSmall_; + dimensionedScalar epsilonMin_; //- Lower limit for omega - dimensionedScalar omega0_; - - //- Small omega value used to avoid divide by zero - dimensionedScalar omegaSmall_; + dimensionedScalar omegaMin_; //- Near wall distance boundary field nearWallDist y_; @@ -176,68 +170,40 @@ public: // Access - //- Return the value of k0 which k is not allowed to be less than - const dimensionedScalar& k0() const - { - return k0_; - } - - //- Return the value of epsilon0 which epsilon is not allowed to be - // less than - const dimensionedScalar& epsilon0() const - { - return epsilon0_; - } - - //- Return the value of epsilonSmall which is added to epsilon when - // calculating nut - const dimensionedScalar& epsilonSmall() const - { - return epsilonSmall_; - } - - //- Return the value of omega0 which epsilon is not allowed to be - // less than - const dimensionedScalar& omega0() const - { - return omega0_; - } - - //- Return the value of omegaSmall which is added to epsilon when - // calculating nut - const dimensionedScalar& omegaSmall() const + //- Return lower allowable limit for k (default: SMALL) + const dimensionedScalar& kMin() const { - return omegaSmall_; + return kMin_; } - //- Allow k0 to be changed - dimensionedScalar& k0() + //- Return the lower allowable limit for epsilon (default: SMALL) + const dimensionedScalar& epsilonMin() const { - return k0_; + return epsilonMin_; } - //- Allow epsilon0 to be changed - dimensionedScalar& epsilon0() + //- Return the lower allowable limit for omega (default: SMALL) + const dimensionedScalar& omegaMin() const { - return epsilon0_; + return omegaMin_; } - //- Allow epsilonSmall to be changed - dimensionedScalar& epsilonSmall() + //- Allow kMin to be changed + dimensionedScalar& kMin() { - return epsilonSmall_; + return kMin_; } - //- Allow omega0 to be changed - dimensionedScalar& omega0() + //- Allow epsilonMin to be changed + dimensionedScalar& epsilonMin() { - return omega0_; + return epsilonMin_; } - //- Allow omegaSmall to be changed - dimensionedScalar& omegaSmall() + //- Allow omegaMin to be changed + dimensionedScalar& omegaMin() { - return omegaSmall_; + return omegaMin_; } //- Return the near wall distances diff --git a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C index aa7e53700195d98a9ef0f51a819a332e1df88a4f..6c8d874be3850fbc13f4db48f9f9b6dfff810b02 100644 --- a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.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 @@ -155,7 +155,10 @@ RNGkEpsilon::RNGkEpsilon autoCreateNut("nut", mesh_) ) { - nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + nut_ = Cmu_*sqr(k_)/epsilon_; nut_.correctBoundaryConditions(); printCoeffs(); @@ -274,7 +277,7 @@ void RNGkEpsilon::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -290,7 +293,7 @@ void RNGkEpsilon::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C index 08618636737bd6da17157329b66ec81efe546580..53f2e041494f0233d6994b2880a04519fc6e9354 100644 --- a/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C +++ b/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.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 @@ -128,7 +128,10 @@ kEpsilon::kEpsilon autoCreateNut("nut", mesh_) ) { - nut_ = Cmu_*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + + nut_ = Cmu_*sqr(k_)/epsilon_; nut_.correctBoundaryConditions(); printCoeffs(); @@ -237,7 +240,7 @@ void kEpsilon::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -254,7 +257,7 @@ void kEpsilon::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C b/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C index 64b095d27b9b6933f7e7aa25e3879bac43238ce4..77225d5edeb55b3174f3c7ed9d4e881d9279e8f5 100644 --- a/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C +++ b/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.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 @@ -137,7 +137,10 @@ kOmega::kOmega autoCreateNut("nut", mesh_) ) { - nut_ = k_/(omega_ + omegaSmall_); + bound(k_, kMin_); + bound(omega_, omegaMin_); + + nut_ = k_/omega_; nut_.correctBoundaryConditions(); printCoeffs(); @@ -246,7 +249,7 @@ void kOmega::correct() omegaEqn().boundaryManipulate(omega_.boundaryField()); solve(omegaEqn); - bound(omega_, omega0_); + bound(omega_, omegaMin_); // Turbulent kinetic energy equation @@ -263,11 +266,11 @@ void kOmega::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity - nut_ = k_/(omega_ + omegaSmall_); + nut_ = k_/omega_; nut_.correctBoundaryConditions(); } diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C index 99721f6a12afb044c4a00d20b8068a706ba1adf8..4d37b287528d9cfcf70db6a173984864a454c411 100644 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C +++ b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.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 @@ -236,13 +236,18 @@ kOmegaSST::kOmegaSST autoCreateNut("nut", mesh_) ) { + bound(k_, kMin_); + bound(omega_, omegaMin_); + nut_ = + ( a1_*k_ - /max + / max ( - a1_*(omega_ + omegaSmall_), + a1_*omega_, F2()*mag(symm(fvc::grad(U_))) - ); + ) + ); nut_.correctBoundaryConditions(); printCoeffs(); @@ -374,7 +379,7 @@ void kOmegaSST::correct() omegaEqn().boundaryManipulate(omega_.boundaryField()); solve(omegaEqn); - bound(omega_, omega0_); + bound(omega_, omegaMin_); // Turbulent kinetic energy equation tmp<fvScalarMatrix> kEqn @@ -390,7 +395,7 @@ void kOmegaSST::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C index 9b16f1c621076a051cd969a5e126147bd418a9d1..422f8b1463a40c8dd680015d34d3bdf91525b935 100644 --- a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C +++ b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.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 @@ -126,6 +126,9 @@ qZeta::qZeta ) ), + qMin_("qMin", dimVelocity, SMALL), + zetaMin_("zetaMin", dimVelocity/dimTime, SMALL), + k_ ( IOobject @@ -193,7 +196,12 @@ qZeta::qZeta autoCreateNut("nut", mesh_) ) { - nut_ = Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + bound(q_, qMin_); + bound(zeta_, zetaMin_); + + nut_ = Cmu_*fMu()*sqr(k_)/epsilon_; nut_.correctBoundaryConditions(); printCoeffs(); @@ -263,6 +271,9 @@ bool qZeta::read() sigmaZeta_.readIfPresent(coeffDict()); anisotropic_.readIfPresent("anisotropic", coeffDict()); + qMin_.readIfPresent(*this); + zetaMin_.readIfPresent(*this); + return true; } else @@ -302,7 +313,7 @@ void qZeta::correct() zetaEqn().relax(); solve(zetaEqn); - bound(zeta_, epsilon0_/(2*sqrt(k0_))); + bound(zeta_, zetaMin_); // q equation @@ -318,7 +329,7 @@ void qZeta::correct() qEqn().relax(); solve(qEqn); - bound(q_, sqrt(k0_)); + bound(q_, qMin_); // Re-calculate k and epsilon diff --git a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.H b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.H index 6300868d2d7f8b40b0d47bdc5c8068ad381846cb..4c396c13a13e18c8643d1b396ebd5a675682f50f 100644 --- a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.H +++ b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.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 @@ -66,6 +66,11 @@ class qZeta dimensionedScalar sigmaZeta_; Switch anisotropic_; + //- Lower limit of q + dimensionedScalar qMin_; + + //- Lower limit of zeta + dimensionedScalar zetaMin_; // Fields @@ -107,6 +112,33 @@ public: // Member Functions + // Access + + //- Return lower allowable limit for q (default: SMALL) + const dimensionedScalar& qMin() const + { + return qMin_; + } + + //- Return the lower allowable limit for zeta (default: SMALL) + const dimensionedScalar& zetaMin() const + { + return zetaMin_; + } + + //- Allow qMin to be changed + dimensionedScalar& qMin() + { + return qMin_; + } + + //- Allow zetaMin to be changed + dimensionedScalar& zetaMin() + { + return zetaMin_; + } + + //- Return the turbulence viscosity virtual tmp<volScalarField> nut() const { diff --git a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C index 5072f9b1cffb87e5d6f4f7041caebaac68e62e84..5a53c6b0fc0826085dc5a6dec001928817ca1909 100644 --- a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C +++ b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.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 @@ -69,7 +69,7 @@ tmp<volScalarField> realizableKE::rCmu volScalarField As = sqrt(6.0)*cos(phis); volScalarField Us = sqrt(S2/2.0 + magSqr(skew(gradU))); - return 1.0/(A0_ + As*Us*k_/(epsilon_ + epsilonSmall_)); + return 1.0/(A0_ + As*Us*k_/epsilon_); } @@ -178,10 +178,10 @@ realizableKE::realizableKE autoCreateNut("nut", mesh_) ) { - bound(k_, k0_); - bound(epsilon_, epsilon0_); + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); - nut_ = rCmu(fvc::grad(U_))*sqr(k_)/(epsilon_ + epsilonSmall_); + nut_ = rCmu(fvc::grad(U_))*sqr(k_)/epsilon_; nut_.correctBoundaryConditions(); printCoeffs(); @@ -303,7 +303,7 @@ void realizableKE::correct() epsEqn().boundaryManipulate(epsilon_.boundaryField()); solve(epsEqn); - bound(epsilon_, epsilon0_); + bound(epsilon_, epsilonMin_); // Turbulent kinetic energy equation @@ -319,7 +319,7 @@ void realizableKE::correct() kEqn().relax(); solve(kEqn); - bound(k_, k0_); + bound(k_, kMin_); // Re-calculate viscosity diff --git a/wmake/Makefile b/wmake/Makefile index 6b4fd0abe6faaa58688664345e0c81439fc66b1b..b58d8b08580b678f40f5cecad5f4d33fb1350b4d 100644 --- a/wmake/Makefile +++ b/wmake/Makefile @@ -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,7 +31,7 @@ #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ -# The Makefile use a POSIX shell +# The Makefile uses a POSIX shell #------------------------------------------------------------------------------ SHELL = /bin/sh @@ -120,7 +120,7 @@ MAKE_DEP = @$(MKDEP) $< | $(WM_SCRIPTS)/addCompile $< #------------------------------------------------------------------------------ # Include PROJECT directory tree file and # source, object and dependency list files. -# These are constructed by wmakeDerivedFiles +# These are constructed by scripts/makeDerivedFiles #------------------------------------------------------------------------------ include $(OBJECTS_DIR)/options @@ -148,7 +148,7 @@ LIB_HEADER_DIRS = \ #------------------------------------------------------------------------------ $(EXE): $(OBJECTS) - @$(WM_SCRIPTS)/mkObjectDir $(EXE) + @$(WM_SCRIPTS)/makeTargetDir $(EXE) $(LINKEXE) $(OBJECTS) -L$(LIB_WM_OPTIONS_DIR) \ $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE) @@ -156,7 +156,7 @@ exe: $(SEXE) @echo \'$(SEXE)\' is up to date. $(SEXE): $(OBJECTS) - @$(WM_SCRIPTS)/mkObjectDir $(SEXE) + @$(WM_SCRIPTS)/makeTargetDir $(SEXE) $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \ $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE) @@ -169,7 +169,7 @@ libso: $(LIB).$(SO) @echo \'$(LIB).$(SO)\' is up to date. $(LIB).$(SO): $(OBJECTS) - @$(WM_SCRIPTS)/mkObjectDir $(LIB) + @$(WM_SCRIPTS)/makeTargetDir $(LIB) @rm -f so_locations @cd $(OBJECTS_DIR) ; \ $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO) @@ -178,7 +178,7 @@ lib: $(LIB).a @echo \'$(LIB).a\' is up to date. $(LIB).a: $(OBJECTS) - @$(WM_SCRIPTS)/mkObjectDir $(LIB) + @$(WM_SCRIPTS)/makeTargetDir $(LIB) @rm -f $(LIB).a $(AR) $(ARFLAGS) $(LIB).a $(OBJECTS) $(RANLIB) $(LIB).a @@ -187,7 +187,7 @@ libo: $(LIB).o @echo \'$(LIB).o\' is up to date. $(LIB).o: $(OBJECTS) - @$(WM_SCRIPTS)/mkObjectDir $(LIB) + @$(WM_SCRIPTS)/makeTargetDir $(LIB) @rm -f $(LIB).o $(LD) -r -o $(LIB).o $(OBJECTS) @@ -195,7 +195,7 @@ jar: $(LIB).jar @echo \'$(LIB).jar\' is up to date. $(LIB).jar: $(OBJECTS) - @$(WM_SCRIPTS)/mkObjectDir $(LIB) + @$(WM_SCRIPTS)/makeTargetDir $(LIB) jar cfm $(LIB).jar $(LIB_LIBS) -C $(CLASSES_DIR) . #------------------------------------------------------------------------------ diff --git a/wmake/MakefileApps b/wmake/MakefileApps index 55efa80ff8acd041be0b526b10fde8a8183b1c14..41a74a3085100e96c184a0b680d96a3e7e1c5852 100644 --- a/wmake/MakefileApps +++ b/wmake/MakefileApps @@ -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 diff --git a/wmake/MakefileFiles b/wmake/MakefileFiles index d927682d9bcc4078d791ca401aada60a483a12d5..0ad78c6198ad67e505579b88b41cb7601955089e 100644 --- a/wmake/MakefileFiles +++ b/wmake/MakefileFiles @@ -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 @@ -32,6 +32,7 @@ GENERAL_RULES = $(WM_DIR)/rules/General RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) +WM_SCRIPTS = $(WM_DIR)/scripts OBJECTS_DIR = $(WM_OPTIONS) FFLAGS = @@ -61,16 +62,16 @@ $(FILES) : files @$(CPP) $(GFLAGS) $(FFLAGS) files > $(FILES) $(SFILES): files - @wmakeDerivedFiles + @$(WM_SCRIPTS)/makeDerivedFiles $(OFILES): files - @wmakeDerivedFiles + @$(WM_SCRIPTS)/makeDerivedFiles $(DFILES): files - @wmakeDerivedFiles + @$(WM_SCRIPTS)/makeDerivedFiles $(IFILES): files - @wmakeDerivedFiles + @$(WM_SCRIPTS)/makeDerivedFiles #------------------------------------------------------------------------------ diff --git a/wmake/MakefileOptions b/wmake/MakefileOptions index 3e7779ff5244f745f74ac77b1f77682087bbef7f..98746d34c66d903addb672b41d814e7714ca6eef 100644 --- a/wmake/MakefileOptions +++ b/wmake/MakefileOptions @@ -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 @@ -32,6 +32,7 @@ GENERAL_RULES = $(WM_DIR)/rules/General RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) +WM_SCRIPTS = $(WM_DIR)/scripts include $(GENERAL_RULES)/general include $(RULES)/general @@ -47,8 +48,8 @@ OPTIONS = $(WM_OPTIONS)/options # Causes all derived files to be remade if any are changed or missing #------------------------------------------------------------------------------ -$(OPTIONS) : options - @wmkdir $(WM_OPTIONS) ; $(CPP) $(GFLAGS) options > $(OPTIONS) +$(OPTIONS) : options + @$(WM_SCRIPTS)/makeDir $(WM_OPTIONS) ; $(CPP) $(GFLAGS) options > $(OPTIONS) #------------------------------------------------------------------------------ diff --git a/wmake/makeWmake b/wmake/makeWmake index 21386f41be03fd953fa8d610297fadd4ac4e6616..ee4423437221d7537e8a6f447777d720cb782e92 100755 --- a/wmake/makeWmake +++ b/wmake/makeWmake @@ -3,7 +3,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 diff --git a/wmake/rules/General/CGAL b/wmake/rules/General/CGAL index b31cd53a7fc46706aa52c6beeed24df5cb6e6893..e0a71bd968c1ac3108820c5fb5256932ce903cac 100644 --- a/wmake/rules/General/CGAL +++ b/wmake/rules/General/CGAL @@ -1,4 +1,11 @@ CGAL_INC = \ -Wno-old-style-cast \ - -I${CGAL_SRC}/include \ - -I${BOOST_ROOT}/include/boost-${BOOST_LIB_VERSION} + -I$(CGAL_ARCH_PATH)/include \ + -I$(MPFR_ARCH_PATH)/include \ + -I$(BOOST_ARCH_PATH)/include/boost + +CGAL_LIBS = \ + -L$(MPFR_ARCH_PATH)/lib \ + -L$(BOOST_ARCH_PATH)/lib \ + -lmpfr \ + -lboost_thread diff --git a/wmake/scripts/addCompile b/wmake/scripts/addCompile index 1e75e7eae1959c6a26901ee1b36aac19b6f463c3..cac0070a810d4048b37461f691d555fad8a06da5 100755 --- a/wmake/scripts/addCompile +++ b/wmake/scripts/addCompile @@ -3,7 +3,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 diff --git a/wmake/wmakeDerivedFiles b/wmake/scripts/makeDerivedFiles similarity index 83% rename from wmake/wmakeDerivedFiles rename to wmake/scripts/makeDerivedFiles index fe6d53e08c3d56a9e2b9789e2c83c0b83da1cf99..96377d68325b54ddeaa591f4f7b9d32b2a5c425d 100755 --- a/wmake/wmakeDerivedFiles +++ b/wmake/scripts/makeDerivedFiles @@ -3,7 +3,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 @@ -24,22 +24,21 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# wmakeDerivedFiles +# makeDerivedFiles # # Description -# Constructs all the file list for make given the source file list -# (which written by hand or using makeFilesAndDirectories.) +# Constructs all the file list for make given the source file list, +# written was by hand or using makeFilesAndOptions. # #------------------------------------------------------------------------------ -if [ ! -d "$WM_OPTIONS" ] -then - echo "The $WM_OPTIONS directory does not exist, exiting" 1>&2 +[ -d "$WM_OPTIONS" ] || { + echo "The '$WM_OPTIONS' directory does not exist, exiting" 1>&2 exit 1 -fi +} # change to the $WM_OPTIONS directory -cd $WM_OPTIONS 2>/dev/null || { +cd "$WM_OPTIONS" 2>/dev/null || { echo "Could not change to directory '$WM_OPTIONS'" 1>&2 exit 1 } @@ -50,15 +49,15 @@ grep "=" files > filesMacros # Remove all macro definitions from the files list grep -v "=" files > filesPlusBlank -# Add a newline to files to make sure the last line is followed by a newline +# Add a newline to files to ensure the last line is followed by a newline echo "" >> filesPlusBlank -# Remove commented lines blank lines, and trailing blanks from files -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -sed -e '/^#/ d' \ - -e '/^[ \t]*$/ d' \ - -e 's/[ \t]*$//' \ +# Remove commented lines, blank lines, and trailing blanks from files +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +sed -e '/^#/ d' \ + -e '/^[ \t]*$/ d' \ + -e 's/[ \t]*$//' \ filesPlusBlank > files.$$ rm filesPlusBlank @@ -80,7 +79,7 @@ rm tmpSourceFile # ~~~~~~~~~~~~~~~~ sed -e 's%.*/%%' \ -e 's%^%$(OBJECTS_DIR)/%' \ - -e 's%\.[a-zA-Z]*$%\.o%' \ + -e 's%\.[a-zA-Z]*$%\.o%' \ files.$$ > tmpObjectFiles echo "OBJECTS = " > tmpObjectFiles2 @@ -96,7 +95,7 @@ rm tmpObjectFiles tmpObjectFiles2 # make localObjectFiles # ~~~~~~~~~~~~~~~~~~~~~ sed -e 's%.*/%%' \ - -e 's%\.[a-zA-Z]*$%\.o%' \ + -e 's%\.[a-zA-Z]*$%\.o%' \ files.$$ > tmpLocalObjectFiles echo "LOCAL_OBJECTS = " > tmpLocalObjectFiles2 @@ -132,6 +131,4 @@ sed -e 's/\.[a-zA-Z]*$/.dep/' \ rm files.$$ -cd .. - #------------------------------------------------------------------------------ diff --git a/wmake/wmkdir b/wmake/scripts/makeDir similarity index 75% rename from wmake/wmkdir rename to wmake/scripts/makeDir index e9703d2733d49b1ead616b49a62d56043a6524df..365dda9fd809b061c642c6a1545e9ff47553c419 100755 --- a/wmake/wmkdir +++ b/wmake/scripts/makeDir @@ -3,7 +3,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 @@ -24,28 +24,18 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# wmkdir +# makeDir # # Description # Script to make directories that do not already exist -# Usage : wmkdir <dir> [.. <dirN>] +# Usage : makeDir <dir> [.. <dirN>] # #------------------------------------------------------------------------------ -if [ $# -ge 1 ] -then - # provide help - if [ "$1" = "-h" -o "$1" = "-help" ] - then - echo "usage: ${0##*/} <dir> [.. <dirN>]" - echo " mkdir if directories do not already exist" - echo - else - for dir - do - [ -d "$dir" ] || mkdir -p "$dir" - done - fi -fi +for dir +do + [ -d "$dir" ] || mkdir -p "$dir" +done + #------------------------------------------------------------------------------ diff --git a/wmake/scripts/makeFiles b/wmake/scripts/makeFiles index c36f153b3ce5006636f96dc1f722734383f733c1..8416970039ad73c9c453f61a680f1403b5803239 100755 --- a/wmake/scripts/makeFiles +++ b/wmake/scripts/makeFiles @@ -3,7 +3,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 diff --git a/wmake/scripts/makeOptions b/wmake/scripts/makeOptions index 47c9f0c271fc96e9d6fbab068b3deb8aee80f872..609a447ba0adba59a073a02ef38325833445719b 100755 --- a/wmake/scripts/makeOptions +++ b/wmake/scripts/makeOptions @@ -3,7 +3,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 diff --git a/wmake/scripts/mkObjectDir b/wmake/scripts/makeTargetDir similarity index 82% rename from wmake/scripts/mkObjectDir rename to wmake/scripts/makeTargetDir index 3008303ae36c94ca7a03806fe6235b7f28f272ea..b4d1e01385707070303007aa2b77dc4763467cba 100755 --- a/wmake/scripts/mkObjectDir +++ b/wmake/scripts/makeTargetDir @@ -3,7 +3,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 @@ -24,21 +24,19 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# mkObjectDir +# makeTargetDir # # Description -# Makes a directory hierarchy for the given object file +# Makes a directory hierarchy for the given target file # -# Usage: mkObjectDir <directory> +# Usage: makeTargetDir <directory> # #------------------------------------------------------------------------------ -if [ $# -eq 1 ] -then - if [ ! -d ${1%/*} -a $1 != ${1%/*} ] - then - mkdir -p ${1%/*} - fi -fi +for target +do + dir=${target%/*} + [ -d "$dir" ] || [ "$dir" = "$target" ] || mkdir -p "$dir" +done #------------------------------------------------------------------------------ diff --git a/wmake/src/dirToString.c b/wmake/src/dirToString.c index b5fb428b0ed462964838b917257087cce9b6e910..26d2876c311ceb254224b9851cca202dd0117129 100644 --- a/wmake/src/dirToString.c +++ b/wmake/src/dirToString.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 diff --git a/wmake/wcleanLnIncludeAll b/wmake/wcleanLnIncludeAll index 0ca7561c6a00e8cc0bd1acc991a12551a127b4e2..6756391a4747120146e8e07cab14ad2e405c5a72 100755 --- a/wmake/wcleanLnIncludeAll +++ b/wmake/wcleanLnIncludeAll @@ -3,7 +3,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 diff --git a/wmake/wcleanMachine b/wmake/wcleanMachine index 0af523c186a443f69f458d36264102f1c097c0a0..6ffb0c2f2a533dde1261675a8ecb6821a5591640 100755 --- a/wmake/wcleanMachine +++ b/wmake/wcleanMachine @@ -3,7 +3,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 diff --git a/wmake/wmakeCheckPwd b/wmake/wmakeCheckPwd index 48266543faa39818ada320105b68ace0b4d32474..4a26185fddbddf960e1a550bb4dda951ba9bd899 100755 --- a/wmake/wmakeCheckPwd +++ b/wmake/wmakeCheckPwd @@ -3,7 +3,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 diff --git a/wmake/wmakeFilesAndOptions b/wmake/wmakeFilesAndOptions index d9fdca1854b355adca1d65c94167decde2c4e4fe..fe5472c55d96603294fa80d46fa3b3729fbd00d3 100755 --- a/wmake/wmakeFilesAndOptions +++ b/wmake/wmakeFilesAndOptions @@ -3,7 +3,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 diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude index 0580893b768bb5660b9766e9c6ebc31dae2129db..820acf91a4cb126db6e8775951c4f3e7fa17b4a6 100755 --- a/wmake/wmakeLnInclude +++ b/wmake/wmakeLnInclude @@ -3,7 +3,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 @@ -58,13 +58,14 @@ USAGE #------------------------------------------------------------------------------ -# simple option parsing -unset forceUpdate +# default 'find' option unset findOpt -# default ln option +# default 'ln' option lnOpt="-s" +unset forceUpdate + # simple parse options while [ "$#" -gt 0 ] do @@ -74,7 +75,7 @@ do ;; -f) shift - forceUpdate=1 + forceUpdate=true lnOpt="-sf" ;; -*) @@ -110,28 +111,25 @@ done incDir=$baseDir/lnInclude -if [ ! -d $baseDir ] -then +[ -d $baseDir ] || { echo "$Script error: base directory $baseDir does not exist" 1>&2 exit 2 -fi +} if [ -d $incDir ] then - if [ ! "$forceUpdate" ] - then - # echo "$Script error: include directory $incDir already exists" 1>&2 - exit 0 - fi + [ "$forceUpdate" = true ] || { + # echo "$Script error: include directory $incDir already exists" 1>&2 + exit 0 + } else mkdir $incDir fi -if [ ! -d $incDir ] -then +[ -d $incDir ] || { echo "$Script error: failed to create include directory $incDir" 1>&2 exit 0 -fi +} cd $incDir || exit 1 diff --git a/wmake/wmakeLnIncludeAll b/wmake/wmakeLnIncludeAll index 07d7df7c5963dc33ca01abf0a434052747c7df28..84f2922115f7d9308f806585c6c1c0c70587189b 100755 --- a/wmake/wmakeLnIncludeAll +++ b/wmake/wmakeLnIncludeAll @@ -3,7 +3,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 diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild index da3c8d408659e73854c8930bb98fa4299c6942f5..453844541813c116970d2aed810d79fc632a08ae 100755 --- a/wmake/wmakePrintBuild +++ b/wmake/wmakePrintBuild @@ -3,7 +3,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 diff --git a/wmake/wmakeScheduler b/wmake/wmakeScheduler index 5d82d8a21e39dfa9f54833cc89f7b0cbd42f6f6b..e5156628a54465e65ebeb2b5a47714127cabf792 100755 --- a/wmake/wmakeScheduler +++ b/wmake/wmakeScheduler @@ -3,7 +3,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