From 20693b96bddda69b7f86b8fae7d04f7f0be81bc6 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 2 May 2011 14:52:11 +0200 Subject: [PATCH 01/36] CONF: move OpenFOAM etc/apps -> etc/config - use standard *.sh, *.csh endings --- .gitignore | 2 -- bin/tools/foamConfigurePaths | 2 +- etc/aliases.csh | 2 +- etc/aliases.sh | 2 +- etc/bashrc | 4 ++-- etc/{apps/ensight/cshrc => config/ensight.csh} | 2 +- etc/{apps/ensight/bashrc => config/ensight.sh} | 2 +- etc/config/{compiler.csh-EXAMPLE => example/compiler.csh} | 4 ++-- etc/config/{compiler.sh-EXAMPLE => example/compiler.sh} | 4 ++-- etc/config/{openmpi.csh-EXAMPLE => example/openmpi.csh} | 4 ++-- etc/config/{openmpi.sh-EXAMPLE => example/openmpi.sh} | 4 ++-- .../cshrc-EXAMPLE => config/example/paraview.csh} | 8 ++++---- .../bashrc-EXAMPLE => config/example/paraview.sh} | 8 ++++---- etc/{apps/paraview3/cshrc => config/paraview.csh} | 2 +- etc/{apps/paraview3/bashrc => config/paraview.sh} | 3 +-- etc/{apps/scotch/bashrc => config/scotch.sh} | 3 +-- etc/cshrc | 4 ++-- src/parallel/decompose/Allwmake | 4 ++-- 18 files changed, 30 insertions(+), 34 deletions(-) rename etc/{apps/ensight/cshrc => config/ensight.csh} (98%) rename etc/{apps/ensight/bashrc => config/ensight.sh} (98%) rename etc/config/{compiler.csh-EXAMPLE => example/compiler.csh} (94%) rename etc/config/{compiler.sh-EXAMPLE => example/compiler.sh} (94%) rename etc/config/{openmpi.csh-EXAMPLE => example/openmpi.csh} (93%) rename etc/config/{openmpi.sh-EXAMPLE => example/openmpi.sh} (93%) rename etc/{apps/paraview3/cshrc-EXAMPLE => config/example/paraview.csh} (86%) rename etc/{apps/paraview3/bashrc-EXAMPLE => config/example/paraview.sh} (86%) rename etc/{apps/paraview3/cshrc => config/paraview.csh} (99%) rename etc/{apps/paraview3/bashrc => config/paraview.sh} (99%) rename etc/{apps/scotch/bashrc => config/scotch.sh} (98%) diff --git a/.gitignore b/.gitignore index e2c6f9b41f..1b8ce3cde3 100644 --- a/.gitignore +++ b/.gitignore @@ -60,8 +60,6 @@ doc/[Dd]oxygen/man # untracked configuration files /etc/prefs.csh /etc/prefs.sh -/etc/config/*.csh -/etc/config/*.sh # source packages - anywhere *.tar.bz2 diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index f3948c3cc2..9526748f07 100755 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -131,7 +131,7 @@ do paraviewInstall="$2" # replace ParaView_DIR=... _inlineSed \ - etc/apps/paraview3/bashrc \ + etc/config/paraview.sh \ '/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='"$paraviewInstall@" \ "Replacing ParaView_DIR setting by '$paraviewInstall'" shift 2 diff --git a/etc/aliases.csh b/etc/aliases.csh index 558390b403..5c5b344497 100644 --- a/etc/aliases.csh +++ b/etc/aliases.csh @@ -49,7 +49,7 @@ alias wmSchedOFF 'unsetenv WM_SCHEDULER' # Change ParaView version # ~~~~~~~~~~~~~~~~~~~~~~~ -alias foamPV 'source `$WM_PROJECT_DIR/etc/apps/paraview3/cshrc` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION' +alias foamPV 'source `$WM_PROJECT_DIR/etc/config/paraview.csh` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION' # Change directory aliases diff --git a/etc/aliases.sh b/etc/aliases.sh index e9c1227004..df0fda7389 100644 --- a/etc/aliases.sh +++ b/etc/aliases.sh @@ -52,7 +52,7 @@ alias wmSchedOFF='unset WM_SCHEDULER' unset foamPV foamPV() { - . $WM_PROJECT_DIR/etc/apps/paraview3/bashrc ParaView_VERSION=$1 + . $WM_PROJECT_DIR/etc/config/paraview.sh ParaView_VERSION=$1 echo "paraview-$ParaView_VERSION (major: $ParaView_MAJOR)" } diff --git a/etc/bashrc b/etc/bashrc index d2539c5b50..3aaff82598 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -206,8 +206,8 @@ _foamSource $WM_PROJECT_DIR/etc/aliases.sh # Source user setup files for optional packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/bashrc` -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile apps/ensight/bashrc` +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh` +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.sh` # Clean environment paths again. Only remove duplicates diff --git a/etc/apps/ensight/cshrc b/etc/config/ensight.csh similarity index 98% rename from etc/apps/ensight/cshrc rename to etc/config/ensight.csh index 73a00884fc..b1ce4ba112 100644 --- a/etc/apps/ensight/cshrc +++ b/etc/config/ensight.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# ensight/cshrc +# config/ensight.csh # # Description # Setup file for Ensight diff --git a/etc/apps/ensight/bashrc b/etc/config/ensight.sh similarity index 98% rename from etc/apps/ensight/bashrc rename to etc/config/ensight.sh index 0e6b981bc8..16ac2bd839 100644 --- a/etc/apps/ensight/bashrc +++ b/etc/config/ensight.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# ensight/bashrc +# config/ensight.sh # # Description # Setup file for Ensight diff --git a/etc/config/compiler.csh-EXAMPLE b/etc/config/example/compiler.csh similarity index 94% rename from etc/config/compiler.csh-EXAMPLE rename to etc/config/example/compiler.csh index 6d54edbd47..6905daf8bd 100644 --- a/etc/config/compiler.csh-EXAMPLE +++ b/etc/config/example/compiler.csh @@ -22,10 +22,10 @@ # along with OpenFOAM. If not, see . # # File -# config/compiler.csh +# config/example/compiler.csh # # Description -# Fine tuning of ThirdParty compiler settings for OpenFOAM +# Example of fine tuning ThirdParty compiler settings for OpenFOAM # Sourced from OpenFOAM-/etc/settings.csh # #------------------------------------------------------------------------------ diff --git a/etc/config/compiler.sh-EXAMPLE b/etc/config/example/compiler.sh similarity index 94% rename from etc/config/compiler.sh-EXAMPLE rename to etc/config/example/compiler.sh index bc6aada36e..7dffdcc10c 100644 --- a/etc/config/compiler.sh-EXAMPLE +++ b/etc/config/example/compiler.sh @@ -22,10 +22,10 @@ # along with OpenFOAM. If not, see . # # File -# config/compiler.sh +# config/example/compiler.sh # # Description -# Fine tuning of ThirdParty compiler settings for OpenFOAM +# Example of fine tuning ThirdParty compiler settings for OpenFOAM # Sourced from OpenFOAM-/etc/settings.sh # #------------------------------------------------------------------------------ diff --git a/etc/config/openmpi.csh-EXAMPLE b/etc/config/example/openmpi.csh similarity index 93% rename from etc/config/openmpi.csh-EXAMPLE rename to etc/config/example/openmpi.csh index 94be702e9d..da07872d31 100644 --- a/etc/config/openmpi.csh-EXAMPLE +++ b/etc/config/example/openmpi.csh @@ -22,10 +22,10 @@ # along with OpenFOAM. If not, see . # # File -# config/openmpi.csh +# config/example/openmpi.csh # # Description -# Fine tuning of openmpi settings for OpenFOAM +# Example of fine tuning openmpi settings for OpenFOAM # Sourced from OpenFOAM-/etc/settings.csh # #------------------------------------------------------------------------------ diff --git a/etc/config/openmpi.sh-EXAMPLE b/etc/config/example/openmpi.sh similarity index 93% rename from etc/config/openmpi.sh-EXAMPLE rename to etc/config/example/openmpi.sh index b7c5035b04..7c0ed18543 100644 --- a/etc/config/openmpi.sh-EXAMPLE +++ b/etc/config/example/openmpi.sh @@ -22,10 +22,10 @@ # along with OpenFOAM. If not, see . # # File -# config/openmpi.sh +# config/example/openmpi.sh # # Description -# Fine tuning of openmpi settings for OpenFOAM +# Example of fine tuning openmpi settings for OpenFOAM # Sourced from OpenFOAM-/etc/settings.sh # #------------------------------------------------------------------------------ diff --git a/etc/apps/paraview3/cshrc-EXAMPLE b/etc/config/example/paraview.csh similarity index 86% rename from etc/apps/paraview3/cshrc-EXAMPLE rename to etc/config/example/paraview.csh index 475dbffce0..8509e924e3 100644 --- a/etc/apps/paraview3/cshrc-EXAMPLE +++ b/etc/config/example/paraview.csh @@ -22,10 +22,10 @@ # along with OpenFOAM. If not, see . # # File -# paraview3/cshrc-EXAMPLE +# config/example/paraview.csh # # Description -# Example of chaining to the standard paraview3/cshrc with a +# Example of chaining to the standard config/paraview.csh with a # different ParaView_VERSION # # Note @@ -35,10 +35,10 @@ #------------------------------------------------------------------------------ # -# Use other (shipped) cshrc with a different ParaView_VERSION +# Use other (shipped) paraview.csh with a different ParaView_VERSION # -set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o apps/paraview3/cshrc` +set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o config/paraview.csh` if ( $status == 0 ) source $foamFile ParaView_VERSION=3.9.0 unset foamFile diff --git a/etc/apps/paraview3/bashrc-EXAMPLE b/etc/config/example/paraview.sh similarity index 86% rename from etc/apps/paraview3/bashrc-EXAMPLE rename to etc/config/example/paraview.sh index 8db47a9ec7..09b300f137 100644 --- a/etc/apps/paraview3/bashrc-EXAMPLE +++ b/etc/config/example/paraview.sh @@ -22,10 +22,10 @@ # along with OpenFOAM. If not, see . # # File -# paraview3/bashrc-EXAMPLE +# config/example/paraview.sh # # Description -# Example of chaining to the standard paraview3/bashrc with a +# Example of chaining to the standard config/paraview.sh with a # different ParaView_VERSION # # Note @@ -35,10 +35,10 @@ #------------------------------------------------------------------------------ # -# Use other (shipped) bashrc with a different ParaView_VERSION +# Use other (shipped) paraview.sh with a different ParaView_VERSION # -foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o apps/paraview3/bashrc 2>/dev/null) +foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config/paraview.sh 2>/dev/null) [ $? -eq 0 ] && . $foamFile ParaView_VERSION=3.9.0 unset foamFile diff --git a/etc/apps/paraview3/cshrc b/etc/config/paraview.csh similarity index 99% rename from etc/apps/paraview3/cshrc rename to etc/config/paraview.csh index 867353e843..c9adc6f198 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/config/paraview.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# paraview3/cshrc +# config/paraview.csh # # Description # Setup file for paraview-3.x diff --git a/etc/apps/paraview3/bashrc b/etc/config/paraview.sh similarity index 99% rename from etc/apps/paraview3/bashrc rename to etc/config/paraview.sh index 1dd5386829..1c38b3dd3f 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/config/paraview.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# paraview3/bashrc +# config/paraview.sh # # Description # Setup file for paraview-3.x @@ -113,7 +113,6 @@ else unset PV_PLUGIN_PATH fi - unset _foamParaviewEval unset cleaned cmake paraviewInstDir paraviewPython diff --git a/etc/apps/scotch/bashrc b/etc/config/scotch.sh similarity index 98% rename from etc/apps/scotch/bashrc rename to etc/config/scotch.sh index 0fb6952110..f32f62292c 100644 --- a/etc/apps/scotch/bashrc +++ b/etc/config/scotch.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# scotch/bashrc +# config/scotch.sh # # Description # Setup file for scotch include/libraries. @@ -36,5 +36,4 @@ export SCOTCH_VERSION=scotch_5.1.11 export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$SCOTCH_VERSION - # ----------------------------------------------------------------------------- diff --git a/etc/cshrc b/etc/cshrc index c2c1b12a9b..330fd66aa9 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -199,8 +199,8 @@ _foamSource $WM_PROJECT_DIR/etc/aliases.csh # Source user setup files for optional packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/cshrc` -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile apps/ensight/cshrc` +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.csh` +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.csh` # Clean environment paths again. Only remove duplicates diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index cded295a7e..b620b27791 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -3,13 +3,13 @@ cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} # get SCOTCH_VERSION, SCOTCH_ARCH_PATH -if settings=`$WM_PROJECT_DIR/bin/foamEtcFile apps/scotch/bashrc` +if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config/scotch.sh` then . $settings echo "using SCOTCH_ARCH_PATH=$SCOTCH_ARCH_PATH" else echo - echo "Error: no apps/scotch/bashrc settings" + echo "Error: no config/scotch.sh settings" echo fi From 3202ef296cd0118163d0b8c846210b34cf7d24f9 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 3 May 2011 15:06:48 +0200 Subject: [PATCH 02/36] CONF: consolidate more files into OpenFOAM etc/config --- .gitignore | 2 + etc/bashrc | 4 +- etc/config/README | 51 +++++++++++++++++++ etc/{ => config}/aliases.csh | 4 +- etc/{ => config}/aliases.sh | 4 +- etc/config/ensight.csh | 2 +- etc/config/ensight.sh | 2 +- .../example/prefs.csh} | 2 +- .../example/prefs.sh} | 2 +- etc/{ => config}/unset.csh | 2 +- etc/{ => config}/unset.sh | 2 +- etc/cshrc | 4 +- 12 files changed, 67 insertions(+), 14 deletions(-) create mode 100644 etc/config/README rename etc/{ => config}/aliases.csh (96%) rename etc/{ => config}/aliases.sh (97%) rename etc/{prefs.csh-EXAMPLE => config/example/prefs.csh} (98%) rename etc/{prefs.sh-EXAMPLE => config/example/prefs.sh} (98%) rename etc/{ => config}/unset.csh (99%) rename etc/{ => config}/unset.sh (99%) diff --git a/.gitignore b/.gitignore index 1b8ce3cde3..67ac189fcc 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,8 @@ doc/[Dd]oxygen/man # untracked configuration files /etc/prefs.csh /etc/prefs.sh +/etc/config/prefs.csh +/etc/config/prefs.sh # source packages - anywhere *.tar.bz2 diff --git a/etc/bashrc b/etc/bashrc index 3aaff82598..62c9854d95 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -177,7 +177,7 @@ _foamEval() _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` # Evaluate command-line parameters and record settings for later -# these can be used to set/unset values, or specify prefs files +# these can be used to set/unset values, or specify alternative pref files export FOAM_SETTINGS="$@" _foamEval $@ @@ -201,7 +201,7 @@ export PATH LD_LIBRARY_PATH MANPATH # Source project setup files # ~~~~~~~~~~~~~~~~~~~~~~~~~~ _foamSource $WM_PROJECT_DIR/etc/settings.sh -_foamSource $WM_PROJECT_DIR/etc/aliases.sh +_foamSource $WM_PROJECT_DIR/etc/config/aliases.sh # Source user setup files for optional packages diff --git a/etc/config/README b/etc/config/README new file mode 100644 index 0000000000..8c22b46016 --- /dev/null +++ b/etc/config/README @@ -0,0 +1,51 @@ +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 + + +The etc/config/ directory contains various configuration files in +sh/csh variants: + +* aliases.csh, aliases.sh + aliases for interactive shells + +* unset.csh, unset.sh + sourced to clear as many OpenFOAM environment settings as possible + + +* ensight.csh, ensight.sh + application settings for EnSight + +* paraview.csh, paraview.sh + application settings for ParaView + +* scotch.sh + application settings for compiling against scotch + +--- + +The config/example directory contains various example configuration files +in sh/csh variants + +* compiler.csh, compiler.sh + an example of fine tuning ThirdParty compiler settings for OpenFOAM + +* openmpi.csh, openmpi.sh + an example of fine tuning openmpi settings for OpenFOAM + +* paraview.csh, paraview.sh + an example of chaining to the standard config/paraview.sh with a + different ParaView_VERSION + +* prefs.csh, prefs.sh + an example of supplying alternative site-defined settings + +--- diff --git a/etc/aliases.csh b/etc/config/aliases.csh similarity index 96% rename from etc/aliases.csh rename to etc/config/aliases.csh index 5c5b344497..6573c91973 100644 --- a/etc/aliases.csh +++ b/etc/config/aliases.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/aliases.csh +# etc/config/aliases.csh # # Description # Aliases for working with OpenFOAM @@ -39,7 +39,7 @@ alias wmSP 'wmSET WM_PRECISION_OPTION=SP' alias wmDP 'wmSET WM_PRECISION_OPTION=DP' # clear env -alias wmUNSET='source $WM_PROJECT_DIR/etc/unset.csh' +alias wmUNSET='source $WM_PROJECT_DIR/etc/config/unset.csh' # Toggle wmakeScheduler on/off # - also need to set WM_HOSTS diff --git a/etc/aliases.sh b/etc/config/aliases.sh similarity index 97% rename from etc/aliases.sh rename to etc/config/aliases.sh index df0fda7389..188159745c 100644 --- a/etc/aliases.sh +++ b/etc/config/aliases.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/aliases.sh +# etc/config/aliases.sh # # Description # Aliases for working with OpenFOAM @@ -39,7 +39,7 @@ alias wmSP='wmSET WM_PRECISION_OPTION=SP' alias wmDP='wmSET WM_PRECISION_OPTION=DP' # clear env -alias wmUNSET='. $WM_PROJECT_DIR/etc/unset.sh' +alias wmUNSET='. $WM_PROJECT_DIR/etc/config/unset.sh' # Toggle wmakeScheduler on/off # - also need to set WM_HOSTS diff --git a/etc/config/ensight.csh b/etc/config/ensight.csh index b1ce4ba112..484fa0fc02 100644 --- a/etc/config/ensight.csh +++ b/etc/config/ensight.csh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License diff --git a/etc/config/ensight.sh b/etc/config/ensight.sh index 16ac2bd839..597c51c010 100644 --- a/etc/config/ensight.sh +++ b/etc/config/ensight.sh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License diff --git a/etc/prefs.csh-EXAMPLE b/etc/config/example/prefs.csh similarity index 98% rename from etc/prefs.csh-EXAMPLE rename to etc/config/example/prefs.csh index 56091f798e..83f7a7b7b4 100644 --- a/etc/prefs.csh-EXAMPLE +++ b/etc/config/example/prefs.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/prefs.csh +# config/example/prefs.csh # # Description # Preset variables for the OpenFOAM configuration - C-Shell shell syntax. diff --git a/etc/prefs.sh-EXAMPLE b/etc/config/example/prefs.sh similarity index 98% rename from etc/prefs.sh-EXAMPLE rename to etc/config/example/prefs.sh index f3e771d030..d2251ce63f 100644 --- a/etc/prefs.sh-EXAMPLE +++ b/etc/config/example/prefs.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/prefs.sh +# config/example/prefs.sh # # Description # Preset variables for the OpenFOAM configuration - POSIX shell syntax. diff --git a/etc/unset.csh b/etc/config/unset.csh similarity index 99% rename from etc/unset.csh rename to etc/config/unset.csh index 48a1637912..d9a3d69787 100644 --- a/etc/unset.csh +++ b/etc/config/unset.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/unset.csh +# etc/config/unset.csh # # Description # Clear as many OpenFOAM environment settings as possible diff --git a/etc/unset.sh b/etc/config/unset.sh similarity index 99% rename from etc/unset.sh rename to etc/config/unset.sh index 23e182aa53..66ee2e35b5 100644 --- a/etc/unset.sh +++ b/etc/config/unset.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/unset.sh +# etc/config/unset.sh # # Description # Clear as many OpenFOAM environment settings as possible diff --git a/etc/cshrc b/etc/cshrc index 330fd66aa9..c87986832a 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -138,7 +138,7 @@ alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh` # Evaluate command-line parameters and record settings for later -# these can be used to set/unset values, or specify prefs files +# these can be used to set/unset values, or specify alternative pref files setenv FOAM_SETTINGS "${*}" while ( $#argv > 0 ) switch ($argv[1]) @@ -195,7 +195,7 @@ if ( $status == 0 ) setenv MANPATH $cleaned # Source project setup files # ~~~~~~~~~~~~~~~~~~~~~~~~~~ _foamSource $WM_PROJECT_DIR/etc/settings.csh -_foamSource $WM_PROJECT_DIR/etc/aliases.csh +_foamSource $WM_PROJECT_DIR/etc/config/aliases.csh # Source user setup files for optional packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 6b81fecadfd7f2e925dc9130cd2702065d1d610e Mon Sep 17 00:00:00 2001 From: mattijs Date: Sun, 15 May 2011 20:52:33 +0100 Subject: [PATCH 03/36] STYLE: refinementHistory: removed printing --- .../polyTopoChange/refinementHistory.C | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C index 9f3911b164..ccd822d499 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -690,9 +690,9 @@ void Foam::refinementHistory::distribute(const mapDistributePolyMesh& map) // Remove unreferenced history. compact(); - Pout<< nl << "--BEFORE:" << endl; - writeDebug(); - Pout<< "---------" << nl << endl; + //Pout<< nl << "--BEFORE:" << endl; + //writeDebug(); + //Pout<< "---------" << nl << endl; // Distribution is only partially functional. @@ -746,18 +746,18 @@ void Foam::refinementHistory::distribute(const mapDistributePolyMesh& map) } } -Pout<< "refinementHistory::distribute :" - << " splitCellProc:" << splitCellProc << endl; - -Pout<< "refinementHistory::distribute :" - << " splitCellNum:" << splitCellNum << endl; + //Pout<< "refinementHistory::distribute :" + // << " splitCellProc:" << splitCellProc << endl; + // + //Pout<< "refinementHistory::distribute :" + // << " splitCellNum:" << splitCellNum << endl; // Create subsetted refinement tree consisting of all parents that // move in their whole to other processor. for (label procI = 0; procI < Pstream::nProcs(); procI++) { - Pout<< "-- Subetting for processor " << procI << endl; + //Pout<< "-- Subetting for processor " << procI << endl; // From uncompacted to compacted splitCells. labelList oldToNew(splitCells_.size(), -1); @@ -781,10 +781,10 @@ Pout<< "refinementHistory::distribute :" oldToNew[index] = newSplitCells.size(); newSplitCells.append(splitCells_[index]); - Pout<< "Added oldCell " << index - << " info " << newSplitCells.last() - << " at position " << newSplitCells.size()-1 - << endl; + //Pout<< "Added oldCell " << index + // << " info " << newSplitCells.last() + // << " at position " << newSplitCells.size()-1 + // << endl; } } @@ -797,9 +797,9 @@ Pout<< "refinementHistory::distribute :" { label parent = splitCells_[index].parent_; - Pout<< "Adding refined cell " << cellI - << " since moves to " - << procI << " old parent:" << parent << endl; + //Pout<< "Adding refined cell " << cellI + // << " since moves to " + // << procI << " old parent:" << parent << endl; // Create new splitCell with parent oldToNew[index] = newSplitCells.size(); @@ -891,8 +891,8 @@ Pout<< "refinementHistory::distribute :" // renumbering can be done here. label offset = splitCells_.size(); - Pout<< "**Renumbering data from proc " << procI << " with offset " - << offset << endl; + //Pout<< "**Renumbering data from proc " << procI << " with offset " + // << offset << endl; forAll(newSplitCells, index) { @@ -929,9 +929,9 @@ Pout<< "refinementHistory::distribute :" } splitCells_.shrink(); - Pout<< nl << "--AFTER:" << endl; - writeDebug(); - Pout<< "---------" << nl << endl; + //Pout<< nl << "--AFTER:" << endl; + //writeDebug(); + //Pout<< "---------" << nl << endl; } From 3868902d80d815d9310a52a179b630d2075e216f Mon Sep 17 00:00:00 2001 From: graham Date: Mon, 16 May 2011 10:26:40 +0100 Subject: [PATCH 04/36] STYLE: Using $internalField for lowerWall as per training notes. --- tutorials/incompressible/simpleFoam/motorBike/0.org/U | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/incompressible/simpleFoam/motorBike/0.org/U b/tutorials/incompressible/simpleFoam/motorBike/0.org/U index 0e62e1551f..c1fb7eec0a 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/0.org/U +++ b/tutorials/incompressible/simpleFoam/motorBike/0.org/U @@ -35,7 +35,7 @@ boundaryField lowerWall { type fixedValue; - value uniform (20 0 0); + value $internalField; } "motorBike_.*" From 709fc12c9050201146b5a1a377c96c2b274672a6 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 17 May 2011 15:33:57 +0100 Subject: [PATCH 05/36] ENH: Robustness updates to pointMVC interpolation --- src/finiteVolume/Make/files | 4 +- src/finiteVolume/Make/options | 1 + .../interpolationPointMVC.C} | 6 +-- .../interpolationPointMVC.H} | 21 +++++----- .../interpolationPointMVCI.H} | 6 +-- .../makeInterpolationPointMVC.C} | 6 +-- .../pointMVCWeight.C | 39 +++++++++---------- .../pointMVCWeight.H | 2 +- .../pointMVCWeightI.H | 2 +- 9 files changed, 44 insertions(+), 43 deletions(-) rename src/finiteVolume/interpolation/interpolation/{interpolationPoint/interpolationPoint.C => interpolationPointMVC/interpolationPointMVC.C} (90%) rename src/finiteVolume/interpolation/interpolation/{interpolationPoint/interpolationPoint.H => interpolationPointMVC/interpolationPointMVC.H} (88%) rename src/finiteVolume/interpolation/interpolation/{interpolationPoint/interpolationPointI.H => interpolationPointMVC/interpolationPointMVCI.H} (89%) rename src/finiteVolume/interpolation/interpolation/{interpolationPoint/makeInterpolationPoint.C => interpolationPointMVC/makeInterpolationPointMVC.C} (89%) rename src/finiteVolume/interpolation/interpolation/{interpolationPoint => interpolationPointMVC}/pointMVCWeight.C (88%) rename src/finiteVolume/interpolation/interpolation/{interpolationPoint => interpolationPointMVC}/pointMVCWeight.H (98%) rename src/finiteVolume/interpolation/interpolation/{interpolationPoint => interpolationPointMVC}/pointMVCWeightI.H (96%) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 854c89211b..817381be61 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -204,8 +204,8 @@ $(interpolation)/interpolationCellPoint/makeInterpolationCellPoint.C $(interpolation)/interpolationCellPointFace/makeInterpolationCellPointFace.C $(interpolation)/interpolationCellPointWallModified/cellPointWeightWallModified/cellPointWeightWallModified.C $(interpolation)/interpolationCellPointWallModified/makeInterpolationCellPointWallModified.C -$(interpolation)/interpolationPoint/pointMVCWeight.C -$(interpolation)/interpolationPoint/makeInterpolationPoint.C +$(interpolation)/interpolationPointMVC/pointMVCWeight.C +$(interpolation)/interpolationPointMVC/makeInterpolationPointMVC.C volPointInterpolation = interpolation/volPointInterpolation $(volPointInterpolation)/volPointInterpolation.C diff --git a/src/finiteVolume/Make/options b/src/finiteVolume/Make/options index b91061399e..d1cbdbad04 100644 --- a/src/finiteVolume/Make/options +++ b/src/finiteVolume/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -DFULLDEBUG -g -O0 \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPoint/interpolationPoint.C b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/interpolationPointMVC.C similarity index 90% rename from src/finiteVolume/interpolation/interpolation/interpolationPoint/interpolationPoint.C rename to src/finiteVolume/interpolation/interpolation/interpolationPointMVC/interpolationPointMVC.C index 516bb142db..592b9bf47f 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPoint/interpolationPoint.C +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/interpolationPointMVC.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,13 +23,13 @@ License \*---------------------------------------------------------------------------*/ -#include "interpolationPoint.H" +#include "interpolationPointMVC.H" #include "volPointInterpolation.H" // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // template -Foam::interpolationPoint::interpolationPoint +Foam::interpolationPointMVC::interpolationPointMVC ( const GeometricField& psi ) diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPoint/interpolationPoint.H b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/interpolationPointMVC.H similarity index 88% rename from src/finiteVolume/interpolation/interpolation/interpolationPoint/interpolationPoint.H rename to src/finiteVolume/interpolation/interpolation/interpolationPointMVC/interpolationPointMVC.H index 013ca76616..8b7ba07fae 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPoint/interpolationPoint.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/interpolationPointMVC.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::interpolationPoint + Foam::interpolationPointMVC Description Given cell centre values interpolates to vertices and uses these to @@ -30,8 +30,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef interpolationPoint_H -#define interpolationPoint_H +#ifndef interpolationPointMVC_H +#define interpolationPointMVC_H #include "interpolation.H" #include "pointMVCWeight.H" @@ -42,11 +42,11 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class interpolationPoint Declaration + Class interpolationPointMVC Declaration \*---------------------------------------------------------------------------*/ template -class interpolationPoint +class interpolationPointMVC : public interpolation { @@ -57,16 +57,17 @@ protected: //- Interpolated volfield const GeometricField psip_; + public: //- Runtime type information - TypeName("point"); + TypeName("pointMVC"); // Constructors //- Construct from components - interpolationPoint + interpolationPointMVC ( const GeometricField& psi ); @@ -93,12 +94,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "interpolationPointI.H" +#include "interpolationPointMVCI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "interpolationPoint.C" +# include "interpolationPointMVC.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPoint/interpolationPointI.H b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/interpolationPointMVCI.H similarity index 89% rename from src/finiteVolume/interpolation/interpolation/interpolationPoint/interpolationPointI.H rename to src/finiteVolume/interpolation/interpolation/interpolationPointMVC/interpolationPointMVCI.H index a3f47c3a0a..7d2a79f86f 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPoint/interpolationPointI.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/interpolationPointMVCI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline Type Foam::interpolationPoint::interpolate +inline Type Foam::interpolationPointMVC::interpolate ( const pointMVCWeight& cpw ) const @@ -36,7 +36,7 @@ inline Type Foam::interpolationPoint::interpolate template -inline Type Foam::interpolationPoint::interpolate +inline Type Foam::interpolationPointMVC::interpolate ( const vector& position, const label cellI, diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPoint/makeInterpolationPoint.C b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/makeInterpolationPointMVC.C similarity index 89% rename from src/finiteVolume/interpolation/interpolation/interpolationPoint/makeInterpolationPoint.C rename to src/finiteVolume/interpolation/interpolation/interpolationPointMVC/makeInterpolationPointMVC.C index b27f807019..a5882e17e7 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPoint/makeInterpolationPoint.C +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/makeInterpolationPointMVC.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,13 +23,13 @@ License \*---------------------------------------------------------------------------*/ -#include "interpolationPoint.H" +#include "interpolationPointMVC.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - makeInterpolation(interpolationPoint); + makeInterpolation(interpolationPointMVC); } // ************************************************************************* // diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPoint/pointMVCWeight.C b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C similarity index 88% rename from src/finiteVolume/interpolation/interpolation/interpolationPoint/pointMVCWeight.C rename to src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C index f011d5e6fb..3ff902c397 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPoint/pointMVCWeight.C +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ void Foam::pointMVCWeight::calcWeights forAll(f, j) { label jPlus1 = f.fcIndex(j); - scalar l = mag(u[j]-u[jPlus1]); + scalar l = mag(u[j] - u[jPlus1]); theta[j] = 2.0*Foam::asin(l/2.0); } @@ -68,7 +68,7 @@ void Foam::pointMVCWeight::calcWeights weights[pid] = 1.0 / dist[pid] - * (Foam::tan(theta[jMin1]/2.0)+Foam::tan(theta[j]/2.0)); + * (Foam::tan(theta[jMin1]/2.0) + Foam::tan(theta[j]/2.0)); sumWeight += weights[pid]; } @@ -132,11 +132,10 @@ void Foam::pointMVCWeight::calcWeights //Pout<< " uj:" << u[j] << " ujPlus1:" << u[jPlus1] // << " temp:" << temp << endl; - scalar l = mag(u[j]-u[jPlus1]); + scalar l = min(mag(u[j] - u[jPlus1]), 2.0); scalar angle = 2.0*Foam::asin(l/2.0); - //Pout<< " j:" << j << " l:" << l - // << " angle:" << angle << endl; + //Pout<< " j:" << j << " l:" << l << " angle:" << angle << endl; v += 0.5*angle*temp; } @@ -145,14 +144,14 @@ void Foam::pointMVCWeight::calcWeights v /= vNorm; // Make sure v points towards the polygon -//if (((v&u[0]) < 0) != (mesh.faceOwner()[faceI] != cellIndex_)) -//{ -// FatalErrorIn("pointMVCWeight::calcWeights(..)") -// << "v:" << v << " u[0]:" << u[0] -// << exit(FatalError); -//} + //if (((v&u[0]) < 0) != (mesh.faceOwner()[faceI] != cellIndex_)) + //{ + // FatalErrorIn("pointMVCWeight::calcWeights(..)") + // << "v:" << v << " u[0]:" << u[0] + // << exit(FatalError); + //} - if ((v&u[0]) < 0) + if ((v & u[0]) < 0) { v = -v; } @@ -165,22 +164,22 @@ void Foam::pointMVCWeight::calcWeights label jPlus1 = f.fcIndex(j); //Pout<< " uj:" << u[j] << " ujPlus1:" << u[jPlus1] << endl; - vector n0 = u[j] ^ v; + vector n0 = u[j]^v; n0 /= mag(n0); - vector n1 = u[jPlus1] ^ v; + vector n1 = u[jPlus1]^v; n1 /= mag(n1); - scalar l = mag(n0-n1); + scalar l = min(mag(n0 - n1), 2.0); //Pout<< " l:" << l << endl; alpha(j) = 2.0*Foam::asin(l/2.0); - vector temp = n0 ^ n1; + vector temp = n0^n1; if ((temp&v) < 0.0) { alpha[j] = -alpha[j]; } - l = mag(u[j]-v); + l = min(mag(u[j] - v), 2.0); //Pout<< " l:" << l << endl; theta(j) = 2.0*Foam::asin(l/2.0); } @@ -211,7 +210,7 @@ void Foam::pointMVCWeight::calcWeights sum += 1.0 / Foam::tan(theta[j]) - * (Foam::tan(alpha[j]/2.0)+Foam::tan(alpha[jMin1]/2.0)); + * (Foam::tan(alpha[j]/2.0) + Foam::tan(alpha[jMin1]/2.0)); } // The special case when x lies on the polygon, handle it using 2D mvc. @@ -234,7 +233,7 @@ void Foam::pointMVCWeight::calcWeights / sum / dist[pid] / Foam::sin(theta[j]) - * (Foam::tan(alpha[j]/2.0)+Foam::tan(alpha[jMin1]/2.0)); + * (Foam::tan(alpha[j]/2.0) + Foam::tan(alpha[jMin1]/2.0)); } } diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPoint/pointMVCWeight.H b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H similarity index 98% rename from src/finiteVolume/interpolation/interpolation/interpolationPoint/pointMVCWeight.H rename to src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H index 285114de4b..cc16c1dfbb 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPoint/pointMVCWeight.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPoint/pointMVCWeightI.H b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeightI.H similarity index 96% rename from src/finiteVolume/interpolation/interpolation/interpolationPoint/pointMVCWeightI.H rename to src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeightI.H index b2f1fc5545..329b6fb341 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPoint/pointMVCWeightI.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeightI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License From 87518b4af035c5d947744cda3bd997578aa8a5e8 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 17 May 2011 16:08:29 +0100 Subject: [PATCH 06/36] BUG: Removed debug flags - accidentally added to repo... --- src/finiteVolume/Make/options | 1 - 1 file changed, 1 deletion(-) diff --git a/src/finiteVolume/Make/options b/src/finiteVolume/Make/options index d1cbdbad04..b91061399e 100644 --- a/src/finiteVolume/Make/options +++ b/src/finiteVolume/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - -DFULLDEBUG -g -O0 \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude From 885f626aade60ae5bb2712fc015f441d09cc199d Mon Sep 17 00:00:00 2001 From: graham Date: Wed, 18 May 2011 16:28:53 +0100 Subject: [PATCH 07/36] BUG: Typo: faceNormal -> faceNormals --- src/meshTools/indexedOctree/treeDataPrimitivePatch.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C index e6b485d6f4..ac73884fa4 100644 --- a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C +++ b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C @@ -307,7 +307,7 @@ getVolumeType forAll(eFaces, i) { - edgeNormal += patch_.faceNormal()[eFaces[i]]; + edgeNormal += patch_.faceNormals()[eFaces[i]]; } if (debug & 2) From e8e5d2f5a86533b88cf46affe4f2486e63b541b4 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 19 May 2011 13:35:41 +0200 Subject: [PATCH 08/36] CONF: move settings.{csh,sh} into OpenFOAM etc/config - leave bashrc/cshrc and prefs.{csh,sh} in etc/ for visibility --- etc/bashrc | 2 +- etc/config/README | 6 +++--- etc/config/example/compiler.csh | 2 +- etc/config/example/compiler.sh | 2 +- etc/config/example/openmpi.csh | 2 +- etc/config/example/openmpi.sh | 2 +- etc/{ => config}/settings.csh | 10 +++++----- etc/{ => config}/settings.sh | 10 +++++----- etc/cshrc | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) rename etc/{ => config}/settings.csh (98%) rename etc/{ => config}/settings.sh (97%) diff --git a/etc/bashrc b/etc/bashrc index 62c9854d95..6cd4d8a8cf 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -200,7 +200,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..8e2597e901 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -194,7 +194,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 From 020d5f9b2d342a02302c2d67246a162324549896 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 19 May 2011 17:32:57 +0200 Subject: [PATCH 09/36] EHN: preserve WM_PROJECT_SITE in bashrc, cshrc - otherwise there is actually no means of placing a site-site prefs.sh in the $WM_PROJECT_SITE/ directory --- etc/bashrc | 7 ++++++- etc/cshrc | 10 ++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/etc/bashrc b/etc/bashrc index 6cd4d8a8cf..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 # ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/etc/cshrc b/etc/cshrc index 8e2597e901..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 # ~~~~~~~~~~~~~~~~~~~~~~ From 3d3cfa914cf15ed3b1141f1ab41e5ed5073ff3e3 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 19 May 2011 17:05:48 +0100 Subject: [PATCH 10/36] STYLE: Updated abbreviated class name --- .../CloudFunctionObjectList/CloudFunctionObjectList.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C index e4bb8b1878..639276e7cd 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C @@ -89,12 +89,12 @@ Foam::CloudFunctionObjectList::CloudFunctionObjectList template Foam::CloudFunctionObjectList::CloudFunctionObjectList ( - const CloudFunctionObjectList& ppm + const CloudFunctionObjectList& cfol ) : - PtrList >(ppm), - owner_(ppm.owner_), - dict_(ppm.dict_) + PtrList >(cfol), + owner_(cfol.owner_), + dict_(cfol.dict_) {} From 23d58e54023073e65cdba51b4f8e72897a9461d6 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 19 May 2011 17:07:13 +0100 Subject: [PATCH 11/36] ENH: Updated and restructured film force models, new contact angle force --- src/regionModels/surfaceFilmModels/Make/files | 7 + .../kinematicSingleLayer.C | 39 ++--- .../kinematicSingleLayer.H | 19 +- .../kinematicSingleLayerI.H | 6 - .../contactAngleForce/contactAngleForce.C | 164 ++++++++++++++++++ .../contactAngleForce/contactAngleForce.H | 125 +++++++++++++ .../submodels/kinematic/force/force/force.C | 73 ++++++++ .../submodels/kinematic/force/force/force.H | 138 +++++++++++++++ .../kinematic/force/force/forceNew.C | 77 ++++++++ .../kinematic/force/forceList/forceList.C | 101 +++++++++++ .../kinematic/force/forceList/forceList.H | 95 ++++++++++ .../surfaceShearForce/surfaceShearForce.C | 100 +++++++++++ .../surfaceShearForce/surfaceShearForce.H | 114 ++++++++++++ .../thermocapillaryForce.C | 83 +++++++++ .../thermocapillaryForce.H | 107 ++++++++++++ .../thermoSingleLayer/thermoSingleLayer.C | 12 +- 16 files changed, 1206 insertions(+), 54 deletions(-) create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/forceNew.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.H create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.C create mode 100644 src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.H diff --git a/src/regionModels/surfaceFilmModels/Make/files b/src/regionModels/surfaceFilmModels/Make/files index a0e33184d6..12f80a7ce7 100644 --- a/src/regionModels/surfaceFilmModels/Make/files +++ b/src/regionModels/surfaceFilmModels/Make/files @@ -10,6 +10,13 @@ thermoSingleLayer/thermoSingleLayer.C submodels/subModelBase.C KINEMATICMODELS=submodels/kinematic +$(KINEMATICMODELS)/force/force/force.C +$(KINEMATICMODELS)/force/force/forceNew.C +$(KINEMATICMODELS)/force/forceList/forceList.C +$(KINEMATICMODELS)/force/contactAngleForce/contactAngleForce.C +$(KINEMATICMODELS)/force/surfaceShearForce/surfaceShearForce.C +$(KINEMATICMODELS)/force/thermocapillaryForce/thermocapillaryForce.C + $(KINEMATICMODELS)/injectionModel/injectionModel/injectionModel.C $(KINEMATICMODELS)/injectionModel/injectionModel/injectionModelNew.C $(KINEMATICMODELS)/injectionModel/injectionModelList/injectionModelList.C diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index cecacd2dfb..add680dc79 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -34,6 +34,10 @@ License #include "directMappedWallPolyPatch.H" #include "mapDistribute.H" +#include "cachedRandom.H" +#include "normal.H" +#include "mathematicalConstants.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -61,8 +65,6 @@ bool kinematicSingleLayer::read() solution.lookup("nCorr") >> nCorr_; solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; - coeffs_.lookup("Cf") >> Cf_; - return true; } else @@ -76,9 +78,10 @@ void kinematicSingleLayer::correctThermoFields() { if (thermoModel_ == tmConstant) { - rho_ == dimensionedScalar(coeffs_.lookup("rho0")); - mu_ == dimensionedScalar(coeffs_.lookup("mu0")); - sigma_ == dimensionedScalar(coeffs_.lookup("sigma0")); + const dictionary& constDict(coeffs_.subDict("constantThermoCoeffs")); + rho_ == dimensionedScalar(constDict.lookup("rho0")); + mu_ == dimensionedScalar(constDict.lookup("mu0")); + sigma_ == dimensionedScalar(constDict.lookup("sigma0")); } else { @@ -273,25 +276,6 @@ void kinematicSingleLayer::updateSurfaceVelocities() } -tmp kinematicSingleLayer::tau(volVectorField& U) const -{ - // Calculate shear stress - volScalarField Cs("Cs", rho_*Cf_*mag(Us_ - U)); - volScalarField Cw - ( - "Cw", - mu_/(0.3333*(delta_ + dimensionedScalar("SMALL", dimLength, SMALL))) - ); - Cw.min(1.0e+06); - - return - ( - - fvm::Sp(Cs, U) + Cs*Us_ // surface contribution - - fvm::Sp(Cw, U) + Cw*Uw_ // wall contribution - ); -} - - tmp kinematicSingleLayer::solveMomentum ( const volScalarField& pu, @@ -312,9 +296,8 @@ tmp kinematicSingleLayer::solveMomentum + fvm::div(phi_, U_) == - USp_ - + tau(U_) - + fvc::grad(sigma_) - fvm::SuSp(rhoSp_, U_) + + forces_.correct(U_) ); fvVectorMatrix& UEqn = tUEqn(); @@ -459,8 +442,6 @@ kinematicSingleLayer::kinematicSingleLayer cumulativeContErr_(0.0), - Cf_(readScalar(coeffs().lookup("Cf"))), - rho_ ( IOobject @@ -773,6 +754,8 @@ kinematicSingleLayer::kinematicSingleLayer injection_(*this, coeffs_), + forces_(*this, coeffs_), + addedMassTotal_(0.0) { if (readFields) diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index 765f617719..5dea0a6329 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H @@ -42,6 +42,7 @@ SourceFiles #include "fvMatrices.H" #include "injectionModelList.H" +#include "forceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -93,12 +94,6 @@ protected: scalar cumulativeContErr_; - // Model parameters - - //- Skin frition coefficient for film/primary region interface - scalar Cf_; - - // Thermo properties // Fields @@ -199,6 +194,9 @@ protected: //- Cloud injection injectionModelList injection_; + //- List of film forces + forceList forces_; + // Checks @@ -238,9 +236,6 @@ protected: //- Update film surface velocities virtual void updateSurfaceVelocities(); - //- Return the stress term for the momentum equation - virtual tmp tau(volVectorField& dU) const; - //- Constrain a film region master/slave boundaries of a field to a // given value template @@ -314,12 +309,6 @@ public: inline label nNonOrthCorr() const; - // Model parameters - - //- Return the skin friction coefficient - inline scalar Cf() const; - - // Thermo properties //- Return const access to the dynamic viscosity / [Pa.s] diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H index 1777984af2..6e55827a97 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H @@ -61,12 +61,6 @@ inline label kinematicSingleLayer::nNonOrthCorr() const } -inline scalar kinematicSingleLayer::Cf() const -{ - return Cf_; -} - - inline const volScalarField& kinematicSingleLayer::mu() const { return mu_; diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C new file mode 100644 index 0000000000..5604859dee --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "contactAngleForce.H" +#include "addToRunTimeSelectionTable.H" +#include "fvcGrad.H" +#include "unitConversion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(contactAngleForce, 0); +addToRunTimeSelectionTable(force, contactAngleForce, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +contactAngleForce::contactAngleForce +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + force(typeName, owner, dict), + deltaWet_(readScalar(coeffs_.lookup("deltaWet"))), + Ccf_(readScalar(coeffs_.lookup("Ccf"))), + rndGen_(label(0), -1), + distribution_ + ( + distributionModels::distributionModel::New + ( + coeffs_.subDict("contactAngleDistribution"), + rndGen_ + ) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +contactAngleForce::~contactAngleForce() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +tmp contactAngleForce::correct(volVectorField& U) +{ + tmp tForce + ( + new volVectorField + ( + IOobject + ( + "contactForce", + owner_.time().timeName(), + owner_.regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner_.regionMesh(), + dimensionedVector("zero", dimForce/dimArea, vector::zero) + ) + ); + + vectorField& force = tForce().internalField(); + + const labelUList& own = owner_.regionMesh().owner(); + const labelUList& nbr = owner_.regionMesh().neighbour(); + + const scalarField& magSf = owner_.magSf(); + + const volScalarField& delta = owner_.delta(); + const volScalarField& sigma = owner_.sigma(); + + volScalarField alpha + ( + "alpha", + pos(delta - dimensionedScalar("deltaWet", dimLength, deltaWet_)) + ); + volVectorField gradAlpha(fvc::grad(alpha)); + + scalarField nHits(force.size(), 0.0); + + forAll(nbr, faceI) + { + const label cellO = own[faceI]; + const label cellN = nbr[faceI]; + + label cellI = -1; + if ((delta[cellO] > deltaWet_) && (delta[cellN] < deltaWet_)) + { + cellI = cellO; + } + else if ((delta[cellO] < deltaWet_) && (delta[cellN] > deltaWet_)) + { + cellI = cellN; + } + + if (cellI != -1) + { +// const scalar dx = Foam::sqrt(magSf[cellI]); + const scalar dx = owner_.regionMesh().deltaCoeffs()[faceI]; + const vector n = + gradAlpha[cellI]/(mag(gradAlpha[cellI]) + ROOTVSMALL); + scalar theta = cos(degToRad(distribution_->sample())); + force[cellI] += Ccf_*n*sigma[cellI]*(1.0 - theta)/dx; + nHits[cellI]++; + } + } + + nHits = max(nHits, 1.0); + force /= (nHits*magSf); + + if (owner_.regionMesh().time().outputTime()) + { + tForce().write(); + } + + tmp + tfvm(new fvVectorMatrix(U, dimForce/dimArea*dimVolume)); + + tfvm() += tForce; + + return tfvm; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H new file mode 100644 index 0000000000..e2a7acd305 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::contactAngleForce + +Description + Film contact angle force + +SourceFiles + contactAngleForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef contactAngleForce_H +#define contactAngleForce_H + +#include "force.H" +#include "distributionModel.H" +#include "cachedRandom.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class contactAngleForce Declaration +\*---------------------------------------------------------------------------*/ + +class contactAngleForce +: + public force +{ +private: + + // Private Data + + //- Threshold film thickness beyon which the film is 'wet' + scalar deltaWet_; + + //- Coefficient applied to the contact angle force + scalar Ccf_; + + //- Random number generator + cachedRandom rndGen_; + + //- Parcel size PDF model + const autoPtr distribution_; + + + + // Private member functions + + //- Disallow default bitwise copy construct + contactAngleForce(const contactAngleForce&); + + //- Disallow default bitwise assignment + void operator=(const contactAngleForce&); + + +public: + + //- Runtime type information + TypeName("contactAngle"); + + + // Constructors + + //- Construct from surface film model + contactAngleForce + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~contactAngleForce(); + + + // Member Functions + + // Evolution + + //- Correct + virtual tmp correct(volVectorField& U); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.C new file mode 100644 index 0000000000..4ea3112e43 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "force.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(force, 0); +defineRunTimeSelectionTable(force, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +force::force(const surfaceFilmModel& owner) +: + subModelBase(owner) +{} + + +force::force +( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict +) +: + subModelBase(type, owner, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +force::~force() +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.H new file mode 100644 index 0000000000..57dcc40bca --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/force.H @@ -0,0 +1,138 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::force + +Description + Base class for film (stress-based) force models + +SourceFiles + force.C + forceNew.C +\*---------------------------------------------------------------------------*/ + +#ifndef force_H +#define force_H + +#include "subModelBase.H" +#include "runTimeSelectionTables.H" +#include "fvMatrices.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class force Declaration +\*---------------------------------------------------------------------------*/ + +class force +: + public subModelBase +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + force(const force&); + + //- Disallow default bitwise assignment + void operator=(const force&); + + +public: + + //- Runtime type information + TypeName("force"); + + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + force, + dictionary, + ( + const surfaceFilmModel& owner, + const dictionary& dict + ), + (owner, dict) + ); + + // Constructors + + //- Construct null + force(const surfaceFilmModel& owner); + + //- Construct from type name, dictionary and surface film model + force + ( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + // Selectors + + //- Return a reference to the selected force model + static autoPtr New + ( + const surfaceFilmModel& owner, + const dictionary& dict, + const word& mdoelType + ); + + + //- Destructor + virtual ~force(); + + + // Member Functions + + // Evolution + + //- Correct + virtual tmp correct(volVectorField& U) = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/forceNew.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/forceNew.C new file mode 100644 index 0000000000..a4ada7ed14 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/force/forceNew.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "force.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +autoPtr force::New +( + const surfaceFilmModel& model, + const dictionary& dict, + const word& modelType +) +{ + Info<< " " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "force::New" + "(" + "const surfaceFilmModel&, " + "const dictionary&, " + "const word&" + ")" + ) << "Unknown force type " << modelType + << nl << nl << "Valid force types are:" << nl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(model, dict)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.C new file mode 100644 index 0000000000..80c4d31e2f --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.C @@ -0,0 +1,101 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "forceList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +forceList::forceList(const surfaceFilmModel& owner) +: + PtrList() +{} + + +forceList::forceList +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + PtrList() +{ + const wordList models(dict.lookup("forces")); + + Info<< " Selecting film force models" << endl; + if (models.size() > 0) + { + this->setSize(models.size()); + + forAll(models, i) + { + set(i, force::New(owner, dict, models[i])); + } + } + else + { + Info<< " none" << endl; + } +} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +forceList::~forceList() +{} + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +tmp forceList::correct(volVectorField& U) +{ + tmp tResult + ( + new fvVectorMatrix(U, dimForce/dimArea*dimVolume) + ); + fvVectorMatrix& result = tResult(); + + forAll(*this, i) + { + result += this->operator[](i).correct(U); + } + + return tResult; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.H new file mode 100644 index 0000000000..b1d19145c0 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.H @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::forceList + +Description + List container for film sources + +SourceFiles + forceList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef forceList_H +#define forceList_H + +#include "PtrList.H" +#include "force.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class forceList Declaration +\*---------------------------------------------------------------------------*/ + +class forceList +: + public PtrList +{ +public: + + // Constructors + + //- Construct null + forceList(const surfaceFilmModel& owner); + + //- Construct from type name, dictionary and surface film model + forceList + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~forceList(); + + + // Member functions + + //- Return (net) force system + tmp correct(volVectorField& U); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C new file mode 100644 index 0000000000..c65549f3d7 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "surfaceShearForce.H" +#include "addToRunTimeSelectionTable.H" +#include "fvmSup.H" +#include "kinematicSingleLayer.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(surfaceShearForce, 0); +addToRunTimeSelectionTable(force, surfaceShearForce, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +surfaceShearForce::surfaceShearForce +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + force(typeName, owner, dict), + Cf_(readScalar(coeffs_.lookup("Cf"))) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +surfaceShearForce::~surfaceShearForce() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +tmp surfaceShearForce::correct(volVectorField& U) +{ + const kinematicSingleLayer& film = + static_cast(owner_); + + const volScalarField& rho = film.rho(); + const volScalarField& mu = film.mu(); + const volVectorField& Us = film.Us(); + const volVectorField& Uw = film.Uw(); + const volScalarField& delta = film.delta(); + + // Calculate shear stress + volScalarField Cs("Cs", rho*Cf_*mag(Us - U)); + volScalarField Cw + ( + "Cw", + mu/(0.3333*(delta + dimensionedScalar("SMALL", dimLength, SMALL))) + ); + Cw.min(1.0e+06); + + return + ( + - fvm::Sp(Cs, U) + Cs*Us // surface contribution + - fvm::Sp(Cw, U) + Cw*Uw // wall contribution + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.H new file mode 100644 index 0000000000..06b73ba347 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.H @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::surfaceShearForce + +Description + Film surface shear force + +SourceFiles + surfaceShearForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef surfaceShearForce_H +#define surfaceShearForce_H + +#include "force.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class surfaceShearForce Declaration +\*---------------------------------------------------------------------------*/ + +class surfaceShearForce +: + public force +{ +private: + + // Private Data + + //- Surface roughness coefficient + scalar Cf_; + + + + // Private member functions + + //- Disallow default bitwise copy construct + surfaceShearForce(const surfaceShearForce&); + + //- Disallow default bitwise assignment + void operator=(const surfaceShearForce&); + + +public: + + //- Runtime type information + TypeName("surfaceShear"); + + + // Constructors + + //- Construct from surface film model + surfaceShearForce + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~surfaceShearForce(); + + + // Member Functions + + // Evolution + + //- Correct + virtual tmp correct(volVectorField& U); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.C new file mode 100644 index 0000000000..186b9625c8 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.C @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "thermocapillaryForce.H" +#include "addToRunTimeSelectionTable.H" +#include "fvcGrad.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(thermocapillaryForce, 0); +addToRunTimeSelectionTable(force, thermocapillaryForce, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermocapillaryForce::thermocapillaryForce +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + force(owner) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +thermocapillaryForce::~thermocapillaryForce() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +tmp thermocapillaryForce::correct(volVectorField& U) +{ + const volScalarField& sigma = owner_.sigma(); + + tmp + tfvm(new fvVectorMatrix(U, dimForce/dimArea*dimVolume)); + + tfvm() += fvc::grad(sigma); + + return tfvm; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.H new file mode 100644 index 0000000000..bfd3f9552e --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::thermocapillaryForce + +Description + Thermocapillary force + +SourceFiles + thermocapillaryForce.C + +\*---------------------------------------------------------------------------*/ + +#ifndef thermocapillaryForce_H +#define thermocapillaryForce_H + +#include "force.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class thermocapillaryForce Declaration +\*---------------------------------------------------------------------------*/ + +class thermocapillaryForce +: + public force +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + thermocapillaryForce(const thermocapillaryForce&); + + //- Disallow default bitwise assignment + void operator=(const thermocapillaryForce&); + + +public: + + //- Runtime type information + TypeName("thermocapillary"); + + + // Constructors + + //- Construct from surface film model + thermocapillaryForce + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~thermocapillaryForce(); + + + // Member Functions + + // Evolution + + //- Correct + virtual tmp correct(volVectorField& U); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 9a6ddee82b..83d1223d4a 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -97,11 +97,13 @@ void thermoSingleLayer::correctThermoFields() { case tmConstant: { - rho_ == dimensionedScalar(coeffs_.lookup("rho0")); - mu_ == dimensionedScalar(coeffs_.lookup("mu0")); - sigma_ == dimensionedScalar(coeffs_.lookup("sigma0")); - Cp_ == dimensionedScalar(coeffs_.lookup("Cp0")); - kappa_ == dimensionedScalar(coeffs_.lookup("kappa0")); + const dictionary& + constDict(coeffs_.subDict("constantThermoCoeffs")); + rho_ == dimensionedScalar(constDict.lookup("rho0")); + mu_ == dimensionedScalar(constDict.lookup("mu0")); + sigma_ == dimensionedScalar(constDict.lookup("sigma0")); + Cp_ == dimensionedScalar(constDict.lookup("Cp0")); + kappa_ == dimensionedScalar(constDict.lookup("kappa0")); break; } From f0cdca3be7734f653b9fdf3afca2bf80cd938497 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 19 May 2011 17:26:21 +0100 Subject: [PATCH 12/36] ENH: Updated film tutorials --- .../cylinder/constant/surfaceFilmProperties | 27 ++++++---------- .../hotBoxes/constant/surfaceFilmProperties | 32 +++++++++++++++++-- .../constant/surfaceFilmProperties | 26 +++++++-------- 3 files changed, 51 insertions(+), 34 deletions(-) diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties index 075dc96cef..1b428031a3 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties @@ -15,34 +15,27 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//surfaceFilmModel kinematicSingleLayer; surfaceFilmModel thermoSingleLayer; regionName wallFilmRegion; active true; -kinematicSingleLayerCoeffs -{ - thermoModel constant; - rho0 rho0 [1 -3 0 0 0] 1000; - mu0 mu0 [1 -1 -1 0 0] 1e-3; - sigma0 sigma0 [1 0 -2 0 0] 0.07; - - deltaStable deltaStable [0 1 0 0 0] 0; - Cf 0.005; - - injectionModels (); -} - - thermoSingleLayerCoeffs { thermoModel singleComponent; liquid H2O; - deltaStable deltaStable [0 1 0 0 0] 0; - Cf 0.005; + forces + ( + surfaceShear + thermocapillary + ); + + surfaceShearCoeffs + { + Cf 0.005; + } injectionModels (); diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties index 0944bef4da..4203d9b469 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties @@ -25,9 +25,8 @@ active true; thermoSingleLayerCoeffs { thermoModel singleComponent; // constant - liquid H2O; - Cf 0.005; + liquid H2O; radiationModel none; @@ -52,6 +51,35 @@ thermoSingleLayerCoeffs } } + forces + ( + surfaceShear + thermocapillary + contactAngle + ); + + surfaceShearCoeffs + { + Cf 0.005; + } + + contactAngleCoeffs + { + deltaWet 1e-4; + Ccf 0.085; + contactAngleDistribution + { + type normal; + normalDistribution + { + minValue 50; + maxValue 100; + expectation 75; + variance 100; + } + } + } + injectionModels ( curvatureSeparation diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties index 4edff7efd2..09b1f8c939 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties @@ -15,32 +15,28 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//surfaceFilmModel kinematicSingleLayer; surfaceFilmModel thermoSingleLayer; regionName wallFilmRegion; active true; -kinematicSingleLayerCoeffs -{ - thermoModel constant; - rho0 rho0 [1 -3 0 0 0] 1000; - mu0 mu0 [1 -1 -1 0 0] 1e-3; - sigma0 sigma0 [1 0 -2 0 0] 0.07; - - Cf 0.005; - - injectionModels (); -} - - thermoSingleLayerCoeffs { thermoModel singleComponent; + liquid H2O; - Cf 0.005; + forces + ( + surfaceShear + thermocapillary + ); + + surfaceShearCoeffs + { + Cf 0.005; + } injectionModels (); From 7e86354f4f6c36a100a2e9d1abd59c253e432ca8 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 20 May 2011 11:55:59 +0100 Subject: [PATCH 13/36] STYLE: writeRegisteredObject: remove unused switch --- .../writeRegisteredObject.C | 47 ++++++++----------- .../writeRegisteredObject.H | 4 -- 2 files changed, 20 insertions(+), 31 deletions(-) diff --git a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C index ab24cecb1a..0ec6bf7534 100644 --- a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C +++ b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C @@ -44,7 +44,6 @@ Foam::writeRegisteredObject::writeRegisteredObject : name_(name), obr_(obr), - active_(true), objectNames_() { read(dict); @@ -61,10 +60,7 @@ Foam::writeRegisteredObject::~writeRegisteredObject() void Foam::writeRegisteredObject::read(const dictionary& dict) { - if (active_) - { - dict.lookup("objectNames") >> objectNames_; - } + dict.lookup("objectNames") >> objectNames_; } @@ -82,32 +78,29 @@ void Foam::writeRegisteredObject::end() void Foam::writeRegisteredObject::write() { - if (active_) + forAll(objectNames_, i) { - forAll(objectNames_, i) + if (obr_.foundObject(objectNames_[i])) { - if (obr_.foundObject(objectNames_[i])) - { - regIOobject& obj = - const_cast - ( - obr_.lookupObject(objectNames_[i]) - ); - // Switch off automatic writing to prevent double write - obj.writeOpt() = IOobject::NO_WRITE; - obj.write(); - } - else - { - WarningIn + regIOobject& obj = + const_cast ( - "Foam::writeRegisteredObject::read(const dictionary&)" - ) << "Object " << objectNames_[i] << " not found in " - << "database. Available objects:" << nl << obr_.sortedToc() - << endl; - } - + obr_.lookupObject(objectNames_[i]) + ); + // Switch off automatic writing to prevent double write + obj.writeOpt() = IOobject::NO_WRITE; + obj.write(); } + else + { + WarningIn + ( + "Foam::writeRegisteredObject::read(const dictionary&)" + ) << "Object " << objectNames_[i] << " not found in " + << "database. Available objects:" << nl << obr_.sortedToc() + << endl; + } + } } diff --git a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H index 9a65acea9d..ecd96e5390 100644 --- a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H +++ b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H @@ -65,10 +65,6 @@ protected: const objectRegistry& obr_; - //- On/off switch - bool active_; - - // Read from dictionary //- Names of objects to control From d29798265c96075ae373a736d239f2cabf886889 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 20 May 2011 11:58:26 +0100 Subject: [PATCH 14/36] ENH: partialWrite: new functionObject for partial dumps --- .../functionObjects/IO/Make/files | 3 + .../functionObjects/IO/controlDict | 88 ++++++++++ .../IO/partialWrite/IOpartialWrite.H | 49 ++++++ .../IO/partialWrite/partialWrite.C | 142 ++++++++++++++++ .../IO/partialWrite/partialWrite.H | 156 ++++++++++++++++++ .../partialWrite/partialWriteFunctionObject.C | 46 ++++++ .../partialWrite/partialWriteFunctionObject.H | 54 ++++++ 7 files changed, 538 insertions(+) create mode 100644 src/postProcessing/functionObjects/IO/controlDict create mode 100644 src/postProcessing/functionObjects/IO/partialWrite/IOpartialWrite.H create mode 100644 src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C create mode 100644 src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H create mode 100644 src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.C create mode 100644 src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.H diff --git a/src/postProcessing/functionObjects/IO/Make/files b/src/postProcessing/functionObjects/IO/Make/files index a3517e560f..a00b7575f1 100644 --- a/src/postProcessing/functionObjects/IO/Make/files +++ b/src/postProcessing/functionObjects/IO/Make/files @@ -1,3 +1,6 @@ +partialWrite/partialWrite.C +partialWrite/partialWriteFunctionObject.C + writeRegisteredObject/writeRegisteredObject.C writeRegisteredObject/writeRegisteredObjectFunctionObject.C diff --git a/src/postProcessing/functionObjects/IO/controlDict b/src/postProcessing/functionObjects/IO/controlDict new file mode 100644 index 0000000000..4daa3a1c15 --- /dev/null +++ b/src/postProcessing/functionObjects/IO/controlDict @@ -0,0 +1,88 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.7.1 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application icoFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.5; + +deltaT 0.005; + +writeControl timeStep; + +writeInterval 20; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +functions +{ + partialWrite + { + // Write some registered objects more often than others. + // Above writeControl determines most frequent dump. + + type partialWrite; + + // Where to load it from + functionObjectLibs ("libIOFunctionObjects.so"); + + // Execute upon outputTime + outputControl outputTime; + + // Objects to write every outputTime + objectNames (p); + // Write as normal every writeInterval'th outputTime. + writeInterval 3; + } + + dumpObjects + { + // Forcibly write registered objects. E.g. fields that have been + // created with NO_READ. + + type writeRegisteredObject; + + // Where to load it from + functionObjectLibs ("libIOFunctionObjects.so"); + + // Execute upon outputTime + outputControl outputTime; + + // Objects to write + objectNames (); + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/IO/partialWrite/IOpartialWrite.H b/src/postProcessing/functionObjects/IO/partialWrite/IOpartialWrite.H new file mode 100644 index 0000000000..961f2b6d55 --- /dev/null +++ b/src/postProcessing/functionObjects/IO/partialWrite/IOpartialWrite.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Typedef + Foam::IOpartialWrite + +Description + Instance of the generic IOOutputFilter for partialWrite. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOpartialWrite_H +#define IOpartialWrite_H + +#include "partialWrite.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter IOpartialWrite; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C new file mode 100644 index 0000000000..327c7b804a --- /dev/null +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.C @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "partialWrite.H" +#include "dictionary.H" +#include "Time.H" +#include "IOobjectList.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(partialWrite, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::partialWrite::partialWrite +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr) +{ + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::partialWrite::~partialWrite() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::partialWrite::read(const dictionary& dict) +{ + dict.lookup("objectNames") >> objectNames_; + dict.lookup("writeInterval") >> writeInterval_; + writeInstance_ = 0; + + Info<< type() << " " << name() << ":" << nl + << " dumping every outputTime :"; + forAllConstIter(HashSet, objectNames_, iter) + { + Info<< ' ' << iter.key(); + } + Info<< nl + << " dumping all other fields every " + << writeInterval_ << "th outputTime" << nl + << endl; + + if (writeInterval_ < 1) + { + FatalIOErrorIn("partialWrite::read(const dictionary&)", dict) + << "Illegal value for writeInterval " << writeInterval_ + << ". It should be >= 1." + << exit(FatalIOError); + } +} + + +void Foam::partialWrite::execute() +{ + //Pout<< "execute at time " << obr_.time().timeName() + // << " index:" << obr_.time().timeIndex() << endl; +} + + +void Foam::partialWrite::end() +{ + //Pout<< "end at time " << obr_.time().timeName() << endl; + // Do nothing - only valid on write +} + + +void Foam::partialWrite::write() +{ + //Pout<< "write at time " << obr_.time().timeName() << endl; + if (obr_.time().outputTime()) + { + // Above check so it can be used both with + // outputControl timeStep; + // outputInterval 1; + // or with + // outputControl outputTime; + + writeInstance_++; + + if (writeInstance_ == writeInterval_) + { + // Normal dump + writeInstance_ = 0; + } + else + { + // Delete all but marked objects + IOobjectList objects(obr_, obr_.time().timeName()); + + forAllConstIter(HashPtrTable, objects, iter) + { + if (!objectNames_.found(iter()->name())) + { + const fileName f = obr_.time().timePath()/iter()->name(); + //Pout<< " rm " << f << endl; + rm(f); + } + } + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H new file mode 100644 index 0000000000..b51b9d1741 --- /dev/null +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H @@ -0,0 +1,156 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::partialWrite + +Description + Allows some fields/registered objects to be written more often than others. + + Works in the opposite way: deletes at intermediate times all + but selected fields. + +SourceFiles + partialWrite.C + IOpartialWrite.H + +\*---------------------------------------------------------------------------*/ + +#ifndef partialWrite_H +#define partialWrite_H + +#include "pointFieldFwd.H" +#include "HashSet.H" +#include "DynamicList.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class partialWrite Declaration +\*---------------------------------------------------------------------------*/ + +class partialWrite +{ +protected: + + // Private data + + //- Name of this set of partialWrite + word name_; + + const objectRegistry& obr_; + + + // Read from dictionary + + //- Names of objects to dump always + HashSet objectNames_; + + //- Write interval for restart dump + label writeInterval_; + + + //- Current dump instance. If reaches writeInterval do a full write. + label writeInstance_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + partialWrite(const partialWrite&); + + //- Disallow default bitwise assignment + void operator=(const partialWrite&); + + +public: + + //- Runtime type information + TypeName("partialWrite"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + partialWrite + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~partialWrite(); + + + // Member Functions + + //- Return name of the partialWrite + virtual const word& name() const + { + return name_; + } + + //- Read the partialWrite data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Write the partialWrite + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.C b/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.C new file mode 100644 index 0000000000..5c98c82580 --- /dev/null +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "partialWriteFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug + ( + partialWriteFunctionObject, + 0 + ); + + addToRunTimeSelectionTable + ( + functionObject, + partialWriteFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.H b/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.H new file mode 100644 index 0000000000..315a5c2282 --- /dev/null +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWriteFunctionObject.H @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Typedef + Foam::partialWriteFunctionObject + +Description + FunctionObject wrapper around partialWrite to allow them to be + created via the functions list within controlDict. + +SourceFiles + partialWriteFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef partialWriteFunctionObject_H +#define partialWriteFunctionObject_H + +#include "partialWrite.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject + partialWriteFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 38d068c4765652ebf02a0c1a02618f03bf18098c Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 20 May 2011 17:00:30 +0100 Subject: [PATCH 15/36] ENH: createShellMesh: guarantee 0'th vertex ordered --- .../extrudeToRegionMesh/createShellMesh.C | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C index e57db9f9b3..c2bce48a7a 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -453,6 +453,7 @@ void Foam::createShellMesh::setRefinement label region0 = pointRegions_[eFaces[0]][fp0]; label region1 = pointRegions_[eFaces[0]][fp1]; + // Pick up points with correct normal if (layerI == 0) { newF[0] = f[fp0]; @@ -468,6 +469,22 @@ void Foam::createShellMesh::setRefinement newF[3] = addedPoints[nLayers*region0+layerI]; } + // Optionally rotate so e[0] is always 0th vertex. Note that + // this normally is automatically done by coupled face ordering + // but with NOORDERING we have to do it ourselves. + if (f[fp0] != e[0]) + { + // rotate one back to get newF[1] (originating from e[0]) + // into newF[0] + label v0 = newF[0]; + for (label i = 0; i < newF.size()-1; i++) + { + newF[i] = newF[newF.fcIndex(i)]; + } + newF.last() = v0; + } + + label minCellI = addedCells[nLayers*eFaces[0]+layerI]; label maxCellI; label patchI; @@ -569,6 +586,21 @@ void Foam::createShellMesh::setRefinement newF[3] = addedPoints[nLayers*region0+layerI]; } + + // Optionally rotate so e[0] is always 0th vertex. Note that + // this normally is automatically done by coupled face + // ordering but with NOORDERING we have to do it ourselves. + if (f[fp0] != e[0]) + { + // rotate one back to get newF[1] (originating + // from e[0]) into newF[0]. + label v0 = newF[0]; + for (label i = 0; i < newF.size()-1; i++) + { + newF[i] = newF[newF.fcIndex(i)]; + } + newF.last() = v0; + } ////if (ePatches.size() == 0) //{ // Pout<< "Adding from MULTI face:" From 39d597f3fdb9d7c0b0b68208add5af0478934120 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 20 May 2011 17:02:33 +0100 Subject: [PATCH 16/36] ENH: globalIndexAndTransform: added debug printing --- .../globalIndexAndTransform.C | 38 ++++++++++++++++++- .../globalIndexAndTransform.H | 4 ++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C index 7032e74a74..b73020d735 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C @@ -24,11 +24,12 @@ License \*---------------------------------------------------------------------------*/ #include "globalIndexAndTransform.H" -#include "coupledPolyPatch.H" #include "cyclicPolyPatch.H" // * * * * * * * * * * * * Private Static Data Members * * * * * * * * * * * // +defineTypeNameAndDebug(Foam::globalIndexAndTransform, 0); + const Foam::label Foam::globalIndexAndTransform::base_ = 32; @@ -478,6 +479,41 @@ Foam::globalIndexAndTransform::globalIndexAndTransform determineTransformPermutations(); determinePatchTransformSign(); + + if (debug && transforms_.size() > 1) + { + Info<< "Determined global transforms :" << endl; + Info<< "\t\ttranslation\trotation" << endl; + forAll(transforms_, i) + { + Info<< '\t' << i << '\t'; + if (transforms_[i].hasR()) + { + Info<< transforms_[i].t() << '\t' << transforms_[i].R(); + } + else + { + Info<< transforms_[i].t() << '\t' << "---"; + } + Info<< endl; + } + Info<< endl; + + const polyBoundaryMesh& patches = mesh_.boundaryMesh(); + + Info<< "\tpatch\ttransform\tsign" << endl; + forAll(patchTransformSign_, patchI) + { + if (patchTransformSign_[patchI].first() != -1) + { + Info<< '\t' << patches[patchI].name() + << '\t' << patchTransformSign_[patchI].first() + << '\t' << patchTransformSign_[patchI].second() + << endl; + } + } + Info<< endl; + } } diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H index d9919309fe..0e3cc3f455 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.H @@ -164,6 +164,10 @@ public: friend class globalPoints; + // Declare name of the class and its debug switch + ClassName("globalIndexAndTransform"); + + // Constructors //- Construct from components From ccd2321a9093ff0b216c825c7960bd332e8e8dc8 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 20 May 2011 18:17:02 +0100 Subject: [PATCH 17/36] BUG: Corrected parallel behaviour of cloud FacePostProcessing model --- .../FacePostProcessing/FacePostProcessing.C | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C index b3cdad013e..024f439666 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C @@ -66,10 +66,9 @@ void Foam::FacePostProcessing::write() const label procI = Pstream::myProcNo(); scalarListList allProcMass(Pstream::nProcs()); - allProcMass[procI].setSize(massTotal_.size()); allProcMass[procI] = massTotal_; Pstream::gatherList(allProcMass); - scalarList allMass + scalarField allMass ( ListListOps::combine ( @@ -78,10 +77,9 @@ void Foam::FacePostProcessing::write() ); scalarListList allProcMassFlux(Pstream::nProcs()); - allProcMassFlux[procI].setSize(massFlux_.size()); allProcMassFlux[procI] = massFlux_; Pstream::gatherList(allProcMassFlux); - scalarList allMassFlux + scalarField allMassFlux ( ListListOps::combine ( @@ -109,16 +107,8 @@ void Foam::FacePostProcessing::write() pointField uniquePoints(mesh.points(), uniqueMeshPointLabels); List allProcPoints(Pstream::nProcs()); - allProcPoints[procI].setSize(uniquePoints.size()); allProcPoints[procI] = uniquePoints; Pstream::gatherList(allProcPoints); - pointField allPoints - ( - ListListOps::combine - ( - allProcPoints, accessOp() - ) - ); faceList faces(fZone_().localFaces()); forAll(faces, i) @@ -126,20 +116,27 @@ void Foam::FacePostProcessing::write() inplaceRenumber(pointToGlobal, faces[i]); } List allProcFaces(Pstream::nProcs()); - allProcFaces[procI].setSize(faces.size()); allProcFaces[procI] = faces; Pstream::gatherList(allProcFaces); - faceList allFaces - ( - ListListOps::combine - ( - allProcFaces, accessOp() - ) - ); - if (Pstream::master()) { + pointField allPoints + ( + ListListOps::combine + ( + allProcPoints, accessOp() + ) + ); + + faceList allFaces + ( + ListListOps::combine + ( + allProcFaces, accessOp() + ) + ); + fileName outputDir = mesh.time().path(); if (Pstream::parRun()) @@ -165,7 +162,7 @@ void Foam::FacePostProcessing::write() allPoints, allFaces, "massTotal", - massTotal_, + allMass, false ); writer->write @@ -175,7 +172,7 @@ void Foam::FacePostProcessing::write() allPoints, allFaces, "massFlux", - massFlux_, + allMassFlux, false ); } From c334f75873d5b687a84fe3cfcee0300c10d78e4a Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 23 May 2011 12:24:13 +0100 Subject: [PATCH 18/36] BUG: octree.C : tree building criterion needs to look at any change in tree. --- src/meshTools/octree/octree.C | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/meshTools/octree/octree.C b/src/meshTools/octree/octree.C index 86c2ffc62a..8731f0ef1f 100644 --- a/src/meshTools/octree/octree.C +++ b/src/meshTools/octree/octree.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -149,6 +149,7 @@ Foam::octree::octree // - has some guaranteed maximum size (maxShapeRatio) label oldNLeaves = -1; // make test below pass first time. + label oldNNodes = -1; deepestLevel_ = 1; while ( @@ -169,11 +170,11 @@ Foam::octree::octree break; } - if (oldNLeaves == nLeaves()) + if ((oldNLeaves == nLeaves()) && (oldNNodes == nNodes())) { if (debug & 1) { - Pout<< "octree : exiting since nLeaves does not change" + Pout<< "octree : exiting since nLeaves and nNodes do not change" << endl; } break; @@ -185,6 +186,7 @@ Foam::octree::octree } oldNLeaves = nLeaves(); + oldNNodes = nNodes(); topNode_->redistribute ( From ffffda19efc4f54ce627108abd12d883c80d34bd Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 23 May 2011 12:25:20 +0100 Subject: [PATCH 19/36] ENH: etc/controlDict: added missing entry --- etc/controlDict | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/controlDict b/etc/controlDict index cc45466672..f34834ca55 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -492,6 +492,7 @@ DebugSwitches geomCellLooper 0; geometricSurfacePatch 0; global 0; + globalIndexAndTransform 0; globalMeshData 0; globalPoints 0; gnuplot 0; From f206f572c92b86a1e02823f50499dd829fed1615 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 23 May 2011 16:05:56 +0100 Subject: [PATCH 20/36] ENH: ReleaseNotes-dev --- ReleaseNotes-dev | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ReleaseNotes-dev b/ReleaseNotes-dev index 5f25edc276..60ae48071f 100644 --- a/ReleaseNotes-dev +++ b/ReleaseNotes-dev @@ -241,9 +241,11 @@ - works in parallel + =snappyHexMesh=: + extrude across multi-processor boundaries - + preserve faceZones during layering - + combining patch faces after snapping + + preserve faceZones shape during layering + + combining coincident patch faces is now default after snapping + *Warning*: + - snapControls::tolerance setting fixed w.r.t. 17x. Is the + multiplication to calculate the local search distance for nearest. - minMedianAxisAngle angle fixed w.r.t. 17x. Set to 90 to get same behaviour as 130 in 17x. - nGrow did not work in 17x. Set to 0 @@ -308,6 +310,8 @@ + multipleBoxes, hotBoxes, panel, evaporationTest + =interDyMFoam= tutorials: + testTubeMixer: showcases =solidBodyMotionFunction= + + =snappyHexMesh= tutorials: + + flange: demonstration of feature lines in snappyHexMesh * Other + compilable with =clang= From 2ecef2c7b95686b63294755399be878fa1526897 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 23 May 2011 16:07:00 +0100 Subject: [PATCH 21/36] BUG: globalPoints: handling shared points on V-cyclics --- .../polyMesh/globalMeshData/globalPoints.C | 131 +++++++++--------- 1 file changed, 67 insertions(+), 64 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C index 9a1954c507..0b12acd728 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C @@ -613,80 +613,83 @@ void Foam::globalPoints::receivePatchPoints label meshPointA = meshPoints[i]; label meshPointB = coupledMeshPoints[i]; - //Pout<< "Connection between point " << meshPointA - // << " at " << mesh_.points()[meshPointA] - // << " and " << meshPointB - // << " at " << mesh_.points()[meshPointB] << endl; - - label localA = meshToLocalPoint - ( - meshToPatchPoint, - meshPointA - ); - label localB = meshToLocalPoint - ( - meshToPatchPoint, - meshPointB - ); - - - // Do we have information on pointA? - Map