diff --git a/bin/paraFoam b/bin/paraFoam index 540f90dc93..a57505f5f9 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -37,7 +37,7 @@ usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat</dev/null; exit 0" EXIT TERM INT - touch "$caseFile" - echo "created temporary '$caseFile'" -} + # check existence of essential files + warn="WARN file does not exist:" + case $extension in + blockMesh) + for check in \ + system/controlDict \ + constant/polyMesh/blockMeshDict \ + ; + do + [ -s "$parentDir/$check" ] || { + [ -n "$warn" ] && echo "$warn" 1>&2 + echo " $parentDir/$check" 1>&2 + unset warn + } + done + ;; + + builtin | OpenFOAM) + for check in \ + system/controlDict \ + $fvControls/fvSchemes \ + $fvControls/fvSolution \ + ; + do + [ -s "$parentDir/$check" ] || { + [ -n "$warn" ] && echo "$warn" 1>&2 + echo " $parentDir/$check" 1>&2 + unset warn + } + done + ;; + esac + + # only create/remove caseFile if it didn't already exist + [ -e $caseFile ] || { + trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch "$caseFile" + echo "created temporary '$caseFile'" + } + + paraview --data="$caseFile" "$@" +fi -paraview --data="$caseFile" #------------------------------------------------------------------------------ diff --git a/etc/bashrc b/etc/bashrc index 62c9854d95..edebe538fc 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -120,7 +120,12 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION # Location of site-specific templates etc # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # unset is equivalent to $WM_PROJECT_INST_DIR/site -unset WM_PROJECT_SITE +if [ -d "$WM_PROJECT_SITE" ] +then + export WM_PROJECT_SITE +else + unset WM_PROJECT_SITE +fi # Location of user files # ~~~~~~~~~~~~~~~~~~~~~~ @@ -200,7 +205,7 @@ export PATH LD_LIBRARY_PATH MANPATH # Source project setup files # ~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSource $WM_PROJECT_DIR/etc/settings.sh +_foamSource $WM_PROJECT_DIR/etc/config/settings.sh _foamSource $WM_PROJECT_DIR/etc/config/aliases.sh diff --git a/etc/config/README b/etc/config/README index 8c22b46016..2ad58dda54 100644 --- a/etc/config/README +++ b/etc/config/README @@ -3,9 +3,6 @@ The main OpenFOAM settings are located in the parent etc/ directory * bashrc, cshrc entry point for sourcing -* settings.csh, settings.sh - core settings - * prefs.csh, prefs.sh these files are untracked and can be used for some site-defined settings @@ -14,6 +11,9 @@ The main OpenFOAM settings are located in the parent etc/ directory The etc/config/ directory contains various configuration files in sh/csh variants: +* settings.csh, settings.sh + core settings + * aliases.csh, aliases.sh aliases for interactive shells diff --git a/etc/config/example/compiler.csh b/etc/config/example/compiler.csh index 6905daf8bd..a317a703c5 100644 --- a/etc/config/example/compiler.csh +++ b/etc/config/example/compiler.csh @@ -26,7 +26,7 @@ # # Description # Example of fine tuning ThirdParty compiler settings for OpenFOAM -# Sourced from OpenFOAM-/etc/settings.csh +# Sourced from OpenFOAM-/etc/config/settings.csh # #------------------------------------------------------------------------------ diff --git a/etc/config/example/compiler.sh b/etc/config/example/compiler.sh index 7dffdcc10c..3f13b1d9ea 100644 --- a/etc/config/example/compiler.sh +++ b/etc/config/example/compiler.sh @@ -26,7 +26,7 @@ # # Description # Example of fine tuning ThirdParty compiler settings for OpenFOAM -# Sourced from OpenFOAM-/etc/settings.sh +# Sourced from OpenFOAM-/etc/config/settings.sh # #------------------------------------------------------------------------------ diff --git a/etc/config/example/openmpi.csh b/etc/config/example/openmpi.csh index da07872d31..6b46e7494c 100644 --- a/etc/config/example/openmpi.csh +++ b/etc/config/example/openmpi.csh @@ -26,7 +26,7 @@ # # Description # Example of fine tuning openmpi settings for OpenFOAM -# Sourced from OpenFOAM-/etc/settings.csh +# Sourced from OpenFOAM-/etc/config/settings.csh # #------------------------------------------------------------------------------ diff --git a/etc/config/example/openmpi.sh b/etc/config/example/openmpi.sh index 7c0ed18543..1573aadf52 100644 --- a/etc/config/example/openmpi.sh +++ b/etc/config/example/openmpi.sh @@ -26,7 +26,7 @@ # # Description # Example of fine tuning openmpi settings for OpenFOAM -# Sourced from OpenFOAM-/etc/settings.sh +# Sourced from OpenFOAM-/etc/config/settings.sh # #------------------------------------------------------------------------------ diff --git a/etc/settings.csh b/etc/config/settings.csh similarity index 98% rename from etc/settings.csh rename to etc/config/settings.csh index b3daf1e288..986a35a1b6 100644 --- a/etc/settings.csh +++ b/etc/config/settings.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/settings.csh +# etc/config/settings.csh # # Description # Startup file for OpenFOAM @@ -193,7 +193,7 @@ unsetenv MPFR_ARCH_PATH GMP_ARCH_PATH # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ( ! $?foamCompiler ) then set foamCompiler=system - echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:" echo " foamCompiler not set, using '$foamCompiler'" endif @@ -241,7 +241,7 @@ case ThirdParty: breaksw default: echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:" echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" echo " Please check your settings" echo @@ -262,7 +262,7 @@ case ThirdParty: # Check that the compiler directory can be found if ( ! -d "$gccDir" ) then echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/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 'foamCompiler' setting to 'system'" @@ -302,7 +302,7 @@ case ThirdParty: # Check that the compiler directory can be found if ( ! -d "$clangDir" ) then echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:" echo " Cannot find $clangDir installation." echo " Please install this compiler version or if you wish to use the system compiler," echo " change the 'foamCompiler' setting to 'system'" diff --git a/etc/settings.sh b/etc/config/settings.sh similarity index 97% rename from etc/settings.sh rename to etc/config/settings.sh index 954868dad1..086ab174c9 100644 --- a/etc/settings.sh +++ b/etc/config/settings.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/settings.sh +# etc/config/settings.sh # # Description # Startup file for OpenFOAM @@ -215,7 +215,7 @@ unset MPFR_ARCH_PATH GMP_ARCH_PATH if [ -z "$foamCompiler" ] then foamCompiler=system - echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" 1>&2 + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2 echo " foamCompiler not set, using '$foamCompiler'" 1>&2 fi @@ -258,7 +258,7 @@ OpenFOAM | ThirdParty) ;; *) echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" echo " Please check your settings" echo @@ -278,7 +278,7 @@ OpenFOAM | ThirdParty) # Check that the compiler directory can be found [ -d "$gccDir" ] || { echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/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 'foamCompiler' setting to 'system'" @@ -322,7 +322,7 @@ OpenFOAM | ThirdParty) # Check that the compiler directory can be found [ -d "$clangDir" ] || { echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" echo " Cannot find $clangDir installation." echo " Please install this compiler version or if you wish to use the system compiler," echo " change the 'foamCompiler' setting to 'system'" diff --git a/etc/cshrc b/etc/cshrc index c87986832a..658f93da69 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -107,9 +107,6 @@ if ( $?WM_PROJECT_INST_DIR ) then set foamOldDirs="$WM_PROJECT_INST_DIR $foamOldDirs" endif endif -if ( $?WM_PROJECT_SITE ) then - set foamOldDirs="$WM_PROJECT_SITE $foamOldDirs" -endif # Location of installation @@ -124,7 +121,12 @@ setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION # Location of site-specific templates etc # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # unset is equivalent to $WM_PROJECT_INST_DIR/site -unsetenv WM_PROJECT_SITE +if ( $?WM_PROJECT_SITE ) then + set foamOldDirs="$WM_PROJECT_SITE $foamOldDirs" + if ( ! -d "$WM_PROJECT_SITE" ) unsetenv WM_PROJECT_SITE +else + unsetenv WM_PROJECT_SITE +endif # Location of user files # ~~~~~~~~~~~~~~~~~~~~~~ @@ -194,7 +196,7 @@ if ( $status == 0 ) setenv MANPATH $cleaned # Source project setup files # ~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSource $WM_PROJECT_DIR/etc/settings.csh +_foamSource $WM_PROJECT_DIR/etc/config/settings.csh _foamSource $WM_PROJECT_DIR/etc/config/aliases.csh # Source user setup files for optional packages diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index a020f3e5bd..fba0cefe17 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -414,11 +414,11 @@ Foam::argList::argList ( ( validOptions.found(optionName) - && validOptions[optionName] != "" + && !validOptions[optionName].empty() ) || ( validParOptions.found(optionName) - && validParOptions[optionName] != "" + && !validParOptions[optionName].empty() ) ) { @@ -833,6 +833,116 @@ Foam::argList::~argList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +bool Foam::argList::setOption(const word& opt, const string& param) +{ + bool changed = false; + + // only allow valid options + if (validOptions.found(opt)) + { + // some options are to be protected + if + ( + opt == "case" + || opt == "parallel" + || opt == "roots" + ) + { + FatalError + <<"used argList::setOption on a protected option: '" + << opt << "'" << endl; + FatalError.exit(); + } + + if (validOptions[opt].empty()) + { + // bool option + if (!param.empty()) + { + // disallow change of type + FatalError + <<"used argList::setOption to change bool to non-bool: '" + << opt << "'" << endl; + FatalError.exit(); + } + else + { + // did not previously exist + changed = !options_.found(opt); + } + } + else + { + // non-bool option + if (param.empty()) + { + // disallow change of type + FatalError + <<"used argList::setOption to change non-bool to bool: '" + << opt << "'" << endl; + FatalError.exit(); + } + else + { + // existing value needs changing, or did not previously exist + changed = options_.found(opt) ? options_[opt] != param : true; + } + } + } + else + { + FatalError + <<"used argList::setOption on an invalid option: '" + << opt << "'" << nl << "allowed are the following:" + << validOptions << endl; + FatalError.exit(); + } + + // set/change the option as required + if (changed) + { + options_.set(opt, param); + } + + return changed; +} + + +bool Foam::argList::unsetOption(const word& opt) +{ + // only allow valid options + if (validOptions.found(opt)) + { + // some options are to be protected + if + ( + opt == "case" + || opt == "parallel" + || opt == "roots" + ) + { + FatalError + <<"used argList::unsetOption on a protected option: '" + << opt << "'" << endl; + FatalError.exit(); + } + + // remove the option, return true if state changed + return options_.erase(opt); + } + else + { + FatalError + <<"used argList::unsetOption on an invalid option: '" + << opt << "'" << nl << "allowed are the following:" + << validOptions << endl; + FatalError.exit(); + } + + return false; +} + + void Foam::argList::printNotes() const { // output notes directly - no automatic text wrapping diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index db5c620451..4f2d236338 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -334,6 +334,19 @@ public: static void noParallel(); + //- Set option directly (use with caution) + // An option with an empty param is a bool option. + // Not all valid options can also be set: eg, -case, -roots, ... + // Return true if the existing option value needed changing, + // or if the option did not previously exist. + bool setOption(const word& opt, const string& param = ""); + + //- Unset option directly (use with caution) + // Not all valid options can also be unset: eg, -case, -roots ... + // Return true if the option existed before being unset. + bool unsetOption(const word& opt); + + // Print //- Print notes (if any) diff --git a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C index f8ab7acf60..973e60ff34 100644 --- a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C +++ b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C @@ -399,7 +399,7 @@ void kOmegaSSTSAS::correct(const tmp& gradU) *max ( dimensionedScalar("zero",dimensionSet(0, 0, -2, 0, 0), 0.0), - zetaTilda2_*kappa_*S2*(L/Lvk2(S2)) + zetaTilda2_*kappa_*S2*sqr(L/Lvk2(S2)) - 2.0/alphaPhi_*k_*grad_omega_k ) ); diff --git a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.H b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.H index bf7ef1b54a..37d82f4ccb 100644 --- a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.H +++ b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.H @@ -27,22 +27,12 @@ Class Description kOmegaSSTSAS LES turbulence model for incompressible flows - References: - Evaluation of the SST-SAS model: Channel flow, asymmetric diffuser and axi- - symmetric hill - European Conference on Computational Fluid Dynamics - ECCOMAS CFD 2006 - Lars Davison - - A Scale-Adaptive Simulation Model using Two-Equation Models - AIAA 2005-1095 - F. R. Menter and Y. Egorov DESider A European Effort on Hybrid RANS-LES Modelling: Results of the European-Union Funded Project, 2004 - 2007 (Notes on Numerical Fluid Mechanics and Multidisciplinary Design). Chapter 8 Formulation of the Scale-Adaptive Simulation (SAS) Model during - the DESIDER Project. + the DESIDER Project. Published in Springer-Verlag Berlin Heidelberg 2009. F. R. Menter and Y. Egorov. SourceFiles