From eacad3d6ab81bd52c1b4c51438b3ec8fe5c1ba21 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 24 Sep 2008 18:27:56 +0200 Subject: [PATCH 1/8] blockMeshDict.m4 files: print *not* printf, don't need POSIX with Math::Trig --- .../sloshingTank2D/constant/polyMesh/blockMeshDict.m4 | 4 ++-- .../sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 | 4 ++-- .../sloshingTank3D/constant/polyMesh/blockMeshDict.m4 | 4 ++-- .../sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 | 4 ++-- .../sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 index 0473efbc15..b6c1cdd4ad 100644 --- a/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/interDyMFoam/sloshingTank2D/constant/polyMesh/blockMeshDict.m4 @@ -15,8 +15,8 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // General m4 macros -changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')]) +changecom(//)changequote([,]) dnl> +define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) diff --git a/tutorials/interDyMFoam/sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 index 5f286a9a6b..b6c1cdd4ad 100644 --- a/tutorials/interDyMFoam/sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/interDyMFoam/sloshingTank2D3DoF/constant/polyMesh/blockMeshDict.m4 @@ -15,8 +15,8 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // General m4 macros -changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; print ($1)')]) +changecom(//)changequote([,]) dnl> +define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) diff --git a/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict.m4 index d001104991..f97859e6bf 100644 --- a/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/interDyMFoam/sloshingTank3D/constant/polyMesh/blockMeshDict.m4 @@ -15,8 +15,8 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // General m4 macros -changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; printf ($1)')]) +changecom(//)changequote([,]) dnl> +define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) diff --git a/tutorials/interDyMFoam/sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 index 0b91b83dd2..f97859e6bf 100644 --- a/tutorials/interDyMFoam/sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/interDyMFoam/sloshingTank3D3DoF/constant/polyMesh/blockMeshDict.m4 @@ -15,8 +15,8 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // General m4 macros -changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; print ($1)')]) +changecom(//)changequote([,]) dnl> +define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) diff --git a/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 b/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 index 0b91b83dd2..f97859e6bf 100644 --- a/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 +++ b/tutorials/interDyMFoam/sloshingTank3D6DoF/constant/polyMesh/blockMeshDict.m4 @@ -15,8 +15,8 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // General m4 macros -changecom(//)changequote([,]) -define(calc, [esyscmd(perl -e 'use Math::Trig; use POSIX; print ($1)')]) +changecom(//)changequote([,]) dnl> +define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> define(VCOUNT, 0) define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) From e0bb935efb08afea0ba070d7263028fb09095bd4 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 26 Sep 2008 18:39:30 +0200 Subject: [PATCH 2/8] wmakeLnInclude: improvements and bugfix - fixed typo: had skipped '-Make' instead of 'Make' directory - remove broken links first * helps when file locations have changed - filter out trailing 'lnInclude' from the spec * this makes it easier to update existing lnInclude dirs: find -name lnInclude -exec wmakeLnInclude -f {} \; - reduced output noise when re-creating an identical link --- wmake/wcleanLnIncludeAll | 2 +- wmake/wmakeLnInclude | 45 ++++++++++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/wmake/wcleanLnIncludeAll b/wmake/wcleanLnIncludeAll index 7d7d0059c1..67da4d0bb0 100755 --- a/wmake/wcleanLnIncludeAll +++ b/wmake/wcleanLnIncludeAll @@ -24,7 +24,7 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# wmakeLnInclude +# wcleanLnIncludeAll # # Description # Delete all the lnInclude directories in the tree. diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude index fcf3bfbf50..ad63d6bca9 100755 --- a/wmake/wmakeLnInclude +++ b/wmake/wmakeLnInclude @@ -80,8 +80,18 @@ do done baseDir=$1 +# convert incorrect path/dir/lnInclude to something sensible +while [ "${baseDir##*/}" = lnInclude ] +do + baseDir="${baseDir%/*}" + if [ "$baseDir" = lnInclude ] + then + baseDir="." + fi +done incDir=$baseDir/lnInclude + if [ $# -eq 1 ] then lnOpt="-s" @@ -89,7 +99,7 @@ elif [ $# -eq 2 ] then lnOpt="$2" else - usage "ERROR: wrong number of arguments" + usage "ERROR: incorrect number of arguments" fi @@ -101,7 +111,6 @@ fi if [ -d $incDir ] then - # could change force to remove lnInclude first if [ ! "$forceUpdate" ] then # echo $Script: include directory $incDir already exists, exiting. @@ -117,24 +126,34 @@ then exit 0 fi +cd $incDir || exit 1 + # Link include files # ~~~~~~~~~~~~~~~~~~ echo $Script: linking include files to $incDir -echo - -cd $incDir - -find .. $findOpt \ - \( -name lnInclude -o -name -Make -o -name config \) -prune \ - -o \( -name '*.[CHh]' -o -name '*.[ch]xx' -o -name '*.[ch]pp' -o -name '*.type' \) \ - -a ! -name ".#*" \ - -exec ln $lnOpt {} . \; - # -# remove any broken links +# remove any broken links first (this helps when file locations have moved) # find -L . -type l -exec rm \{\} \; +# +# create links, avoid recreating links unless necessary +# +find .. $findOpt \ + \( -name lnInclude -o -name Make -o -name config \) -prune \ + -o \( -name '*.[CHh]' -o -name '*.[ch]xx' -o -name '*.[ch]pp' -o -name '*.type' \) \ + -a ! -name ".#*" \ + -print | \ + while read src + do + link=$(readlink ${src##*/}) + if [ "$link" != "$src" ] + then + rm $link 2>/dev/null + ln $lnOpt $src . + fi + done + #------------------------------------------------------------------------------ From 4c159d306f8de8bdc22dd27ad2aa810b0ff7bb4b Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 30 Sep 2008 19:08:00 +0200 Subject: [PATCH 3/8] use -f option wherever wmakeLnInclude is explicitly called in Allwmake scripts --- src/Allwmake | 2 +- src/turbulenceModels/LES/Allwmake | 3 ++- src/turbulenceModels/LES/compressible/Make/options | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Allwmake b/src/Allwmake index 2c532a41aa..57eb012eff 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -2,7 +2,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x -( cd OpenFOAM && wmakeLnInclude . ) +( cd OpenFOAM && wmakeLnInclude -f . ) ( cd Pstream && ./Allwmake ) wmake libo OSspecific/$WM_OS diff --git a/src/turbulenceModels/LES/Allwmake b/src/turbulenceModels/LES/Allwmake index bd99dd1f4e..a2521d21f0 100755 --- a/src/turbulenceModels/LES/Allwmake +++ b/src/turbulenceModels/LES/Allwmake @@ -2,8 +2,9 @@ cd ${0%/*} || exit 1 # run from this directory set -x +wmakeLnInclude -f incompressible + wmake libso LESfilters -wmakeLnInclude incompressible wmake libso LESdeltas wmake libso incompressible wmake libso compressible diff --git a/src/turbulenceModels/LES/compressible/Make/options b/src/turbulenceModels/LES/compressible/Make/options index 9f0da00e30..c148a902e0 100644 --- a/src/turbulenceModels/LES/compressible/Make/options +++ b/src/turbulenceModels/LES/compressible/Make/options @@ -1,6 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I../LESdeltas/lnInclude \ -I../LESfilters/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude From f8823b684b123bd899cbbc7b54f67e644f1688ac Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 30 Sep 2008 19:32:13 +0200 Subject: [PATCH 4/8] wcleanAll - provide some information about the progress - move tutorial cleanup to the end in case the user wishes to abort the wcleanAll script - adjusted wcleanAlmostAll according, but don't know if it's really needed any more --- tutorials/Allclean | 10 +++++----- wmake/wcleanAll | 11 +++++++++-- wmake/wcleanAlmostAll | 18 ++++++++++++------ 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/tutorials/Allclean b/tutorials/Allclean index c72811f9fa..2a79bb7ec4 100755 --- a/tutorials/Allclean +++ b/tutorials/Allclean @@ -32,15 +32,15 @@ cd ${0%/*} || exit 1 # run from this directory -echo "Cleaning backup files" +echo "--------" +echo "Cleaning tutorials ..." +echo "Removing backup files" find . -type f \( -name "*~" -o -name "*.bak" \) -exec rm {} \; find . \( -name 'core' -o -name 'core.[1-9]*' \) -exec rm {} \; find . \( -name '*.pvs' -o -name '*.OpenFOAM' \) -exec rm {} \; -rm logs > /dev/null 2>&1 -rm testLoopReport > /dev/null 2>&1 - -echo "" +rm logs testLoopReport > /dev/null 2>&1 foamCleanTutorials cases +echo "--------" # ----------------------------------------------------------------- end-of-file diff --git a/wmake/wcleanAll b/wmake/wcleanAll index e7d3477cb7..e9b36bc375 100755 --- a/wmake/wcleanAll +++ b/wmake/wcleanAll @@ -39,20 +39,27 @@ for dir in lib applications/bin do + echo "Removing $dir/" [ -d $dir ] && rm -rf $dir/* done -( cd tutorials && ./Allclean ) - +echo "Removing *~ backup files" find . -name '*~' -exec rm {} \; + +echo "Removing .dep files" find . -name '*.dep' -exec rm {} \; +echo "Cleaning Make subdirectories" find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d ! -name "*Make.[A-Za-z]*" ! -name "*Make" \) -exec rm -rf {} \; +echo "Removing lnInclude and intermediate directories" find . -depth -type d \( -name lnInclude -o -name ii_files -o -name Templates.DB \) -exec rm -rf {} \; +echo "Removing misc files" find . \( -name exe -o -name log -o -name so_locations \) -exec rm {} \; # rm -rf src/mpich-${MPICH_VERSION}/platforms +( cd tutorials && ./Allclean ) + #------------------------------------------------------------------------------ diff --git a/wmake/wcleanAlmostAll b/wmake/wcleanAlmostAll index 515c3110d8..8bd5291600 100755 --- a/wmake/wcleanAlmostAll +++ b/wmake/wcleanAlmostAll @@ -24,11 +24,10 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# wmakeAlmostAll +# wcleanAlmostAll # # Description -# script that searches all the directories below the current for the -# object file directories of all machines and then deletes them. +# as per wcleanAll, but retains "*~" backup files # #------------------------------------------------------------------------------ @@ -39,18 +38,25 @@ for dir in lib applications/bin do + echo "Removing $dir/" [ -d $dir ] && rm -rf $dir/* done -( cd tutorials && ./Allclean ) +echo "Retaining *~ backup files" +## find . -name '*~' -exec rm {} \; -# find . -name '*~' -exec rm {} \; +echo "Removing .dep files" find . -name '*.dep' -exec rm {} \; -find `find . -depth \( -name "Make[.A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d ! -name "*Make[.A-Za-z]*" ! -name "*Make" \) -exec rm -r {} \; +echo "Cleaning Make subdirectories" +find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d ! -name "*Make.[A-Za-z]*" ! -name "*Make" \) -exec rm -rf {} \; +echo "Removing lnInclude and intermediate directories" find . -depth -type d \( -name lnInclude -o -name ii_files -o -name Templates.DB \) -exec rm -rf {} \; +echo "Removing misc files" find . \( -name exe -o -name log -o -name so_locations \) -exec rm {} \; +( cd tutorials && ./Allclean ) + #------------------------------------------------------------------------------ From 736a04cf5fe3f655c2aea2a81b3565abc77ed85a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 30 Sep 2008 19:42:09 +0200 Subject: [PATCH 5/8] new regex wrapper requires wmakeLnInclude OSspecific/.. before making Pstream --- src/Allwmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Allwmake b/src/Allwmake index 57eb012eff..341ee2ed6f 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -2,7 +2,8 @@ cd ${0%/*} || exit 1 # run from this directory set -x -( cd OpenFOAM && wmakeLnInclude -f . ) +wmakeLnInclude -f OpenFOAM +wmakeLnInclude -f OSspecific/$WM_OS ( cd Pstream && ./Allwmake ) wmake libo OSspecific/$WM_OS From e6f81d2c20a7acf372a084fb73cf680f6ea105cf Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 1 Oct 2008 11:14:06 +0100 Subject: [PATCH 6/8] consistency update - nu/muSgsWallFunction to nu/muSgsSpalartAllmarasWallFunction --- .../LES/compressible/Make/files | 2 +- ...tAllmarasWallFunctionFvPatchScalarField.C} | 34 +++++++++----- ...tAllmarasWallFunctionFvPatchScalarField.H} | 46 +++++++++++-------- .../LES/incompressible/Make/files | 2 +- ...tAllmarasWallFunctionFvPatchScalarField.C} | 31 ++++++++----- ...tAllmarasWallFunctionFvPatchScalarField.H} | 44 ++++++++++-------- 6 files changed, 95 insertions(+), 64 deletions(-) rename src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/{muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C => muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C} (81%) rename src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/{muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.H => muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.H} (72%) rename src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/{nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C => nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C} (81%) rename src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/{nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.H => nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.H} (71%) diff --git a/src/turbulenceModels/LES/compressible/Make/files b/src/turbulenceModels/LES/compressible/Make/files index 06e7b76d45..dc31f55cae 100644 --- a/src/turbulenceModels/LES/compressible/Make/files +++ b/src/turbulenceModels/LES/compressible/Make/files @@ -14,6 +14,6 @@ SpalartAllmaras/SpalartAllmaras.C wallFunctions=derivedFvPatchFields/wallFunctions muSgsWallFunctions=$(wallFunctions)/muSgsWallFunctions -$(muSgsWallFunctions)/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C +$(muSgsWallFunctions)/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C LIB = $(FOAM_LIBBIN)/libcompressibleLESModels diff --git a/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C b/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C similarity index 81% rename from src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C rename to src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C index fb493237bf..e210c32c73 100644 --- a/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "muSgsWallFunctionFvPatchScalarField.H" +#include "muSgsSpalartAllmarasWallFunctionFvPatchScalarField.H" #include "LESModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" @@ -41,7 +41,8 @@ namespace LESModels // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF @@ -51,9 +52,10 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField& ptf, + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper @@ -63,7 +65,8 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -74,7 +77,8 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -85,18 +89,20 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField& tppsf + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField& tppsf ) : fixedValueFvPatchScalarField(tppsf) {} -muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField +muSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField& tppsf, + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField& tppsf, const DimensionedField& iF ) : @@ -106,7 +112,7 @@ muSgsWallFunctionFvPatchScalarField::muSgsWallFunctionFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void muSgsWallFunctionFvPatchScalarField::evaluate +void muSgsSpalartAllmarasWallFunctionFvPatchScalarField::evaluate ( const Pstream::commsTypes ) @@ -184,7 +190,11 @@ void muSgsWallFunctionFvPatchScalarField::evaluate // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, muSgsWallFunctionFvPatchScalarField); +makePatchTypeField +( + fvPatchScalarField, + muSgsSpalartAllmarasWallFunctionFvPatchScalarField +); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.H b/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.H similarity index 72% rename from src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.H rename to src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.H index 76f6aca405..9d3210c1d4 100644 --- a/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/LES/compressible/derivedFvPatchFields/wallFunctions/muSgsWallFunctions/muSgsSpalartAllmarasWallFunction/muSgsSpalartAllmarasWallFunctionFvPatchScalarField.H @@ -23,18 +23,19 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::compressible::LESModels::muSgsWallFunctionFvPatchScalarField + Foam::compressible::LESModels:: + muSgsSpalartAllmarasWallFunctionFvPatchScalarField Description - wall function boundary condition for compressible flows + Spalart Allmaas wall function boundary condition for compressible flows SourceFiles - muSgsWallFunctionFvPatchScalarField.C + muSgsSpalartAllmarasWallFunctionFvPatchScalarField.C \*---------------------------------------------------------------------------*/ -#ifndef muSgsWallFunctionFvPatchScalarField_H -#define muSgsWallFunctionFvPatchScalarField_H +#ifndef muSgsSpalartAllmarasWallFunctionFvPatchScalarField_H +#define muSgsSpalartAllmarasWallFunctionFvPatchScalarField_H #include "fixedValueFvPatchFields.H" @@ -48,10 +49,10 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - Class muSgsWallFunctionFvPatch Declaration + Class muSgsSpalartAllmarasWallFunctionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ -class muSgsWallFunctionFvPatchScalarField +class muSgsSpalartAllmarasWallFunctionFvPatchScalarField : public fixedValueFvPatchScalarField { @@ -61,20 +62,20 @@ class muSgsWallFunctionFvPatchScalarField public: //- Runtime type information - TypeName("muSgsWallFunction"); + TypeName("muSgsSpalartAllmarasWallFunction"); // Constructors //- Construct from patch and internal field - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField& ); //- Construct from patch, internal field and Istream - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField&, @@ -82,27 +83,28 @@ public: ); //- Construct from patch, internal field and dictionary - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField&, const dictionary& ); - //- Construct by mapping given muSgsWallFunctionFvPatchScalarField + //- Construct by mapping given + // muSgsSpalartAllmarasWallFunctionFvPatchScalarField // onto a new patch - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField&, + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField&, const fvPatch&, const DimensionedField&, const fvPatchFieldMapper& ); //- Construct as copy - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField& + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField& ); //- Construct and return a clone @@ -110,14 +112,14 @@ public: { return tmp ( - new muSgsWallFunctionFvPatchScalarField(*this) + new muSgsSpalartAllmarasWallFunctionFvPatchScalarField(*this) ); } //- Construct as copy setting internal field reference - muSgsWallFunctionFvPatchScalarField + muSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const muSgsWallFunctionFvPatchScalarField&, + const muSgsSpalartAllmarasWallFunctionFvPatchScalarField&, const DimensionedField& ); @@ -129,7 +131,11 @@ public: { return tmp ( - new muSgsWallFunctionFvPatchScalarField(*this, iF) + new muSgsSpalartAllmarasWallFunctionFvPatchScalarField + ( + *this, + iF + ) ); } diff --git a/src/turbulenceModels/LES/incompressible/Make/files b/src/turbulenceModels/LES/incompressible/Make/files index 0661520a6c..796bbee6a0 100644 --- a/src/turbulenceModels/LES/incompressible/Make/files +++ b/src/turbulenceModels/LES/incompressible/Make/files @@ -29,7 +29,7 @@ dynMixedSmagorinsky/dynMixedSmagorinsky.C wallFunctions=derivedFvPatchFields/wallFunctions nuSgsWallFunctions=$(wallFunctions)/nuSgsWallFunctions -$(nuSgsWallFunctions)/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C +$(nuSgsWallFunctions)/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C LIB = $(FOAM_LIBBIN)/libincompressibleLESModels diff --git a/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C b/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C similarity index 81% rename from src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C rename to src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C index d7be3cf9f0..ab02061c5d 100644 --- a/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "nuSgsWallFunctionFvPatchScalarField.H" +#include "nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.H" #include "LESModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" @@ -41,7 +41,8 @@ namespace LESModels // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF @@ -51,9 +52,10 @@ nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField {} -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField& ptf, + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper @@ -63,7 +65,8 @@ nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField {} -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, @@ -74,18 +77,20 @@ nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField {} -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField& tppsf + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField& tppsf ) : fixedValueFvPatchScalarField(tppsf) {} -nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField:: +nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField& tppsf, + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField& tppsf, const DimensionedField& iF ) : @@ -95,7 +100,7 @@ nuSgsWallFunctionFvPatchScalarField::nuSgsWallFunctionFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void nuSgsWallFunctionFvPatchScalarField::evaluate +void nuSgsSpalartAllmarasWallFunctionFvPatchScalarField::evaluate ( const Pstream::commsTypes ) @@ -166,7 +171,11 @@ void nuSgsWallFunctionFvPatchScalarField::evaluate // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField(fvPatchScalarField, nuSgsWallFunctionFvPatchScalarField); +makePatchTypeField +( + fvPatchScalarField, + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField +); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.H b/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.H similarity index 71% rename from src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.H rename to src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.H index 687e30a6a6..ecb1830757 100644 --- a/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsWallFunction/nuSgsWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/LES/incompressible/derivedFvPatchFields/wallFunctions/nuSgsWallFunctions/nuSgsSpalartAllmarasWallFunction/nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.H @@ -23,18 +23,19 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::incompressible::LESModels::nuSgsWallFunctionFvPatchScalarField + Foam::incompressible::LESModels:: + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField Description - wall function boundary condition for incompressible flows + Spalart Allmaras wall function boundary condition for incompressible flows SourceFiles - nuSgsWallFunctionFvPatchScalarField.C + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField.C \*---------------------------------------------------------------------------*/ -#ifndef nuSgsWallFunctionFvPatchScalarField_H -#define nuSgsWallFunctionFvPatchScalarField_H +#ifndef nuSgsSpalartAllmarasWallFunctionFvPatchScalarField_H +#define nuSgsSpalartAllmarasWallFunctionFvPatchScalarField_H #include "fixedValueFvPatchFields.H" @@ -48,10 +49,10 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - Class nuSgsWallFunctionFvPatch Declaration + Class nuSgsSpalartAllmarasWallFunctionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ -class nuSgsWallFunctionFvPatchScalarField +class nuSgsSpalartAllmarasWallFunctionFvPatchScalarField : public fixedValueFvPatchScalarField { @@ -61,40 +62,41 @@ class nuSgsWallFunctionFvPatchScalarField public: //- Runtime type information - TypeName("nuSgsWallFunction"); + TypeName("nuSgsSpalartAllmarasWallFunction"); // Constructors //- Construct from patch and internal field - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField& ); //- Construct from patch, internal field and dictionary - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField&, const dictionary& ); - //- Construct by mapping given nuSgsWallFunctionFvPatchScalarField + //- Construct by mapping given + // nuSgsSpalartAllmarasWallFunctionFvPatchScalarField // onto a new patch - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField&, + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField&, const fvPatch&, const DimensionedField&, const fvPatchFieldMapper& ); //- Construct as copy - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField& + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField& ); //- Construct and return a clone @@ -102,14 +104,14 @@ public: { return tmp ( - new nuSgsWallFunctionFvPatchScalarField(*this) + new nuSgsSpalartAllmarasWallFunctionFvPatchScalarField(*this) ); } //- Construct as copy setting internal field reference - nuSgsWallFunctionFvPatchScalarField + nuSgsSpalartAllmarasWallFunctionFvPatchScalarField ( - const nuSgsWallFunctionFvPatchScalarField&, + const nuSgsSpalartAllmarasWallFunctionFvPatchScalarField&, const DimensionedField& ); @@ -121,7 +123,11 @@ public: { return tmp ( - new nuSgsWallFunctionFvPatchScalarField(*this, iF) + new nuSgsSpalartAllmarasWallFunctionFvPatchScalarField + ( + *this, + iF + ) ); } From 911c46169924f197bd98ecec0efa998a26f8bc5c Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 1 Oct 2008 12:20:42 +0200 Subject: [PATCH 7/8] triSurface Nastran reader: bugfix and enhancement - handle long format (GRID*), even when fields are not separated by spaces - added support for Hypermesh "$HMNAME COMP" extension --- .../triSurface/interfaces/NAS/readNAS.C | 156 ++++++++++-------- 1 file changed, 83 insertions(+), 73 deletions(-) diff --git a/src/triSurface/triSurface/interfaces/NAS/readNAS.C b/src/triSurface/triSurface/interfaces/NAS/readNAS.C index 2ec15c6706..1440c2d15d 100644 --- a/src/triSurface/triSurface/interfaces/NAS/readNAS.C +++ b/src/triSurface/triSurface/interfaces/NAS/readNAS.C @@ -23,10 +23,16 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Nastran surface reader. Does Ansa $ANSA_NAME extension to get name - of patch. Handles Ansa coordinates like: + Nastran surface reader. + - Uses the Ansa "$ANSA_NAME" or the Hypermesh "$HMNAME COMP" extensions + to obtain patch names. + - Handles Nastran short and long formats, but not free format. + - Properly handles the Nastran compact floating point notation: \n + @verbatim GRID 28 10.20269-.030265-2.358-8 + @endverbatim + \*---------------------------------------------------------------------------*/ @@ -49,13 +55,13 @@ static scalar parseNASCoord(const string& s) if (expSign != string::npos && expSign > 0 && !isspace(s[expSign-1])) { scalar mantissa = readScalar(IStringStream(s.substr(0, expSign))()); - scalar exp = readScalar(IStringStream(s.substr(expSign+1))()); + scalar exponent = readScalar(IStringStream(s.substr(expSign+1))()); if (s[expSign] == '-') { - exp = -exp; + exponent = -exponent; } - return mantissa*pow(10, exp); + return mantissa*pow(10, exponent); } else { @@ -64,14 +70,14 @@ static scalar parseNASCoord(const string& s) } -bool triSurface::readNAS(const fileName& OBJfileName) +bool triSurface::readNAS(const fileName& fName) { - IFstream OBJfile(OBJfileName); + IFstream is(fName); - if (!OBJfile.good()) + if (!is.good()) { FatalErrorIn("triSurface::readNAS(const fileName&)") - << "Cannot read file " << OBJfileName + << "Cannot read file " << fName << exit(FatalError); } @@ -90,17 +96,17 @@ bool triSurface::readNAS(const fileName& OBJfileName) // Ansa tags. Denoted by $ANSA_NAME. These will appear just before the // first use of a type. We read them and store the pshell types which // are used to name the patches. - label ansaID = -1; + label ansaId = -1; word ansaType; string ansaName; - // Done warnings per unrecognized command + // A single warning per unrecognized command HashSet unhandledCmd; - while (OBJfile.good()) + while (is.good()) { string line; - OBJfile.getLine(line); + is.getLine(line); // Ansa extension if (line.substr(0, 10) == "$ANSA_NAME") @@ -116,14 +122,14 @@ bool triSurface::readNAS(const fileName& OBJfileName) && sem2 != string::npos ) { - ansaID = readLabel + ansaId = readLabel ( IStringStream(line.substr(sem0+1, sem1-sem0-1))() ); ansaType = line.substr(sem1+1, sem2-sem1-1); string nameString; - OBJfile.getLine(ansaName); + is.getLine(ansaName); if (ansaName[ansaName.size()-1] == '\r') { ansaName = ansaName.substr(1, ansaName.size()-2); @@ -132,13 +138,37 @@ bool triSurface::readNAS(const fileName& OBJfileName) { ansaName = ansaName.substr(1, ansaName.size()-1); } - //Pout<< "ANSA tag for NastranID:" << ansaID - // << " of type " << ansaType - // << " name " << ansaName << endl; + + // Info<< "ANSA tag for NastranID:" << ansaId + // << " of type " << ansaType + // << " name " << ansaName << endl; } } + // Hypermesh extension + // $HMNAME COMP 1"partName" + if + ( + line.substr(0, 12) == "$HMNAME COMP" + && line.find ('"') != string::npos + ) + { + label groupId = readLabel + ( + IStringStream(line.substr(16, 16))() + ); + + IStringStream lineStream(line.substr(32)); + + string rawName; + lineStream >> rawName; + + groupToName.insert(groupId, string::validate(rawName)); + Info<< "group " << groupId << " => " << rawName << endl; + } + + if (line.size() == 0 || line[0] == '$') { // Skip empty or comment @@ -153,7 +183,7 @@ bool triSurface::readNAS(const fileName& OBJfileName) while (true) { string buf; - OBJfile.getLine(buf); + is.getLine(buf); if (buf.size() > 72 && buf[72]=='+') { @@ -174,26 +204,21 @@ bool triSurface::readNAS(const fileName& OBJfileName) if (cmd == "CTRIA3") { - //label index, group, a, b, c; - //lineStream >> index >> group >> a >> b >> c; - label group = readLabel(IStringStream(line.substr(16,8))()); + label groupId = readLabel(IStringStream(line.substr(16,8))()); label a = readLabel(IStringStream(line.substr(24,8))()); label b = readLabel(IStringStream(line.substr(32,8))()); label c = readLabel(IStringStream(line.substr(40,8))()); // Convert group into patch - Map