diff --git a/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/ChangeMixingPlaneBoundary.py b/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/ChangeMixingPlaneBoundary.py index 4486fc5d4..128c75122 100644 --- a/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/ChangeMixingPlaneBoundary.py +++ b/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/ChangeMixingPlaneBoundary.py @@ -33,6 +33,11 @@ Change MixingPlane boundary condition parameters dest="shadowPatch", default=None, help='Name of the shadowPatch') + self.parser.add_option("--zone", + action="store", + dest="zone", + default=None, + help='Name of the zone for mixingPlanePatch') self.parser.add_option("--coordinateSystemName", action="store", dest="coordinateSystemName", @@ -68,11 +73,11 @@ Change MixingPlane boundary condition parameters dest="ribbonPatchStackAxis", default=None, help='ribbonPatch stackAxis (X|Y|Z|R|Theta') - self.parser.add_option("--ribbonPatchDiscretization", + self.parser.add_option("--ribbonPatchDiscretisation", action="store", - dest="ribbonPatchDiscretization", + dest="ribbonPatchDiscretisation", default=None, - help='ribbonPatch discretization (masterPatch|slavePatch|bothPatches|uniform|userDefined)') + help='ribbonPatch discretisation (masterPatch|slavePatch|bothPatches|uniform|userDefined)') self.parser.add_option("--test", action="store_true", @@ -102,6 +107,9 @@ Change MixingPlane boundary condition parameters if self.parser.getOptions().shadowPatch!=None: val["shadowPatch"]=self.parser.getOptions().shadowPatch + if self.parser.getOptions().zone!=None: + val["zone"]=self.parser.getOptions().zone + if val.has_key("coordinateSystem")==False: val["coordinateSystem"]={} @@ -129,8 +137,8 @@ Change MixingPlane boundary condition parameters if self.parser.getOptions().ribbonPatchStackAxis!=None: val["ribbonPatch"]["stackAxis"]=self.parser.getOptions().ribbonPatchStackAxis - if self.parser.getOptions().ribbonPatchDiscretization!=None: - val["ribbonPatch"]["discretization"]=self.parser.getOptions().ribbonPatchDiscretization + if self.parser.getOptions().ribbonPatchDiscretisation!=None: + val["ribbonPatch"]["discretisation"]=self.parser.getOptions().ribbonPatchDiscretisation break diff --git a/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/ConvertMixingPlaneBoundaryToNewSyntax.py b/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/ConvertMixingPlaneBoundaryToNewSyntax.py index e69de7785..c73c9f609 100644 --- a/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/ConvertMixingPlaneBoundaryToNewSyntax.py +++ b/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/ConvertMixingPlaneBoundaryToNewSyntax.py @@ -118,21 +118,24 @@ Change MixingPlane boundary condition parameters if bnd[indexDefPatch].has_key("ribbonPatch")==False: bnd[indexDefPatch]["ribbonPatch"]={} + + if bnd[indexDefPatch].has_key("zone")==False: + bnd[indexDefPatch]["zone"]=bnd[index] + "Zone" if oldAssembly != "": - # Converting "assembly" to ribbonPatch/discretization + # Converting "assembly" to ribbonPatch/discretisation for case in switch(oldAssembly): if case('master'): - bnd[indexDefPatch]["ribbonPatch"]["discretization"]="masterPatch" + bnd[indexDefPatch]["ribbonPatch"]["discretisation"]="masterPatch" break if case('slave'): - bnd[indexDefPatch]["ribbonPatch"]["discretization"]="slavePatch" + bnd[indexDefPatch]["ribbonPatch"]["discretisation"]="slavePatch" break if case('both'): - bnd[indexDefPatch]["ribbonPatch"]["discretization"]="bothPatches" + bnd[indexDefPatch]["ribbonPatch"]["discretisation"]="bothPatches" break if case('userdefined'): - bnd[indexDefPatch]["ribbonPatch"]["discretization"]="userDefined" + bnd[indexDefPatch]["ribbonPatch"]["discretisation"]="userDefined" break if case(): # default print "Unsupported assembly type: ", oldAssembly diff --git a/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/InitMixingPlaneInterface.py b/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/InitMixingPlaneInterface.py index b213dbbc1..f35e20073 100644 --- a/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/InitMixingPlaneInterface.py +++ b/ThirdParty/LocalDev/Hydro-Quebec/PyFoam/InitMixingPlaneInterface.py @@ -72,11 +72,11 @@ Init MixingPlane boundary condition parameters dest="ribbonPatchStackAxis", default=None, help='ribbonPatch stackAxis (X|Y|Z|R|Theta') - self.parser.add_option("--ribbonPatchDiscretization", + self.parser.add_option("--ribbonPatchDiscretisation", action="store", - dest="ribbonPatchDiscretization", + dest="ribbonPatchDiscretisation", default=None, - help='ribbonPatch discretization (masterPatch|slavePatch|bothPatches|uniform|userDefined)') + help='ribbonPatch discretisation (masterPatch|slavePatch|bothPatches|uniform|userDefined)') self.parser.add_option("--timeDirs", action="store", @@ -111,7 +111,7 @@ the current definition 'ribbonPatch' : { 'sweepAxis' : 'Theta', 'stackAxis' : 'Z', - 'discretization' : 'bothPatches', + 'discretisation' : 'bothPatches', } } return newPatch @@ -151,8 +151,8 @@ Modify the definition of a mixingPlane patch if self.parser.getOptions().ribbonPatchStackAxis!=None: patch["ribbonPatch"]["stackAxis"]=self.parser.getOptions().ribbonPatchStackAxis - if self.parser.getOptions().ribbonPatchDiscretization!=None: - patch["ribbonPatch"]["discretization"]=self.parser.getOptions().ribbonPatchDiscretization + if self.parser.getOptions().ribbonPatchDiscretisation!=None: + patch["ribbonPatch"]["discretisation"]=self.parser.getOptions().ribbonPatchDiscretisation diff --git a/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/Allrun b/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/Allrun index c0d510cfe..6e9b80a06 100755 --- a/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/Allrun +++ b/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/Allrun @@ -27,21 +27,25 @@ then echo "Using pyFoamChangeMixingPlaneBoundary.py" pyFoamChangeMixingPlaneBoundary.py . B_UPSTREAM \ --shadowPatch B_DOWNSTREAM \ + --zone B_UPSTREAMZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis R \ + --ribbonPatchSweepAxis Theta \ --coordinateSystemType cylindrical \ --coordinateSystemOrigin "(0 0 0)" \ --coordinateSystemE1 "(1 0 0)" \ --coordinateSystemE3 "(0 0 1)" \ - --assembly both \ - --orientation dirR_spanTheta pyFoamChangeMixingPlaneBoundary.py . B_DOWNSTREAM \ --shadowPatch B_UPSTREAM \ + --zone B_DOWNSTREAMZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis R \ + --ribbonPatchSweepAxis Theta \ --coordinateSystemType cylindrical \ --coordinateSystemOrigin "(0 0 0)" \ --coordinateSystemE1 "(1 0 0)" \ --coordinateSystemE3 "(0 0 1)" \ - --assembly both \ - --orientation dirR_spanTheta echo "Using pyFoamChangeGGIBoundary.py" pyFoamChangeGGIBoundary.py . sideWallA_BB_cyclic1 \ @@ -64,8 +68,17 @@ fi echo "$caseName: Creating the starting time directory" cp -r 0_orig 0 -runApplication setSet -batch setBatchGgi -runApplication setsToZones -noFlipMap +echo "$caseName: Creating zones for the mixingPlane" +runApplicationAndReportOnError setSet -batch setBatchMixingPlane +runApplicationAndReportOnError setsToZones -noFlipMap +mv log.setSet log.setSet_MixingPlane +mv log.setsToZones log.setsToZones_MixingPlane + +echo "$caseName: Creating zones for the Ggi" +runApplicationAndReportOnError setSet -batch setBatchGgi +runApplicationAndReportOnError setsToZones -noFlipMap +mv log.setSet log.setSet_Ggi +mv log.setsToZones log.setsToZones_Ggi echo "$caseName: Running laplacianFoam" runApplicationAndReportOnError laplacianFoam diff --git a/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/setBatchMixingPlane b/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/setBatchMixingPlane new file mode 100644 index 000000000..18a51f35c --- /dev/null +++ b/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/setBatchMixingPlane @@ -0,0 +1,3 @@ +faceSet B_UPSTREAMZone new patchToFace B_UPSTREAM +faceSet B_DOWNSTREAMZone new patchToFace B_DOWNSTREAM +quit diff --git a/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes b/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes index c33d5cfef..e4d576141 100644 --- a/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes +++ b/tutorials/basic/laplacianFoam/Case1.1_mixingPlane_sector_AB_60deg/system/fvSchemes @@ -68,4 +68,8 @@ fluxRequired p; } +mixingPlane +{ + default zeroGradient; +} // ************************************************************************* // diff --git a/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/Allrun b/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/Allrun index 2750c1fcf..e25c0d885 100755 --- a/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/Allrun +++ b/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/Allrun @@ -23,8 +23,10 @@ then echo "Using pyFoamChangeMixingPlaneBoundary.py" pyFoamChangeMixingPlaneBoundary.py . mixpLeftOut \ --shadowPatch mixpRightIn \ - --assembly both \ - --orientation dirY_spanZ \ + --zone mixpLeftOutZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Y \ + --ribbonPatchSweepAxis Z \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -32,8 +34,10 @@ then pyFoamChangeMixingPlaneBoundary.py . mixpRightIn \ --shadowPatch mixpLeftOut \ - --assembly both \ - --orientation dirY_spanZ \ + --zone mixpRightInZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Y \ + --ribbonPatchSweepAxis Z \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -43,6 +47,9 @@ else cp constant/polyMesh/boundary.preconfigured constant/polyMesh/boundary fi +echo "$caseName: Creating zones for the mixingPlane" +runApplicationAndReportOnError setSet -batch setBatch +runApplicationAndReportOnError setsToZones -noFlipMap echo "$caseName: Creating the starting time directory" cp -r 0_orig 0 diff --git a/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/setBatch b/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/setBatch new file mode 100644 index 000000000..070702982 --- /dev/null +++ b/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/setBatch @@ -0,0 +1,3 @@ +faceSet mixpLeftOutZone new patchToFace mixpLeftOut +faceSet mixpRightInZone new patchToFace mixpRightIn +quit diff --git a/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/system/fvSchemes b/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/system/fvSchemes index 11638e5bd..3af9eeda7 100644 --- a/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/system/fvSchemes +++ b/tutorials/basic/laplacianFoam/twoBlocksMixingPlane/system/fvSchemes @@ -52,4 +52,8 @@ fluxRequired T; } +mixingPlane +{ + default zeroGradient; +} // ************************************************************************* // diff --git a/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/Allrun b/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/Allrun index 2750c1fcf..e25c0d885 100755 --- a/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/Allrun +++ b/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/Allrun @@ -23,8 +23,10 @@ then echo "Using pyFoamChangeMixingPlaneBoundary.py" pyFoamChangeMixingPlaneBoundary.py . mixpLeftOut \ --shadowPatch mixpRightIn \ - --assembly both \ - --orientation dirY_spanZ \ + --zone mixpLeftOutZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Y \ + --ribbonPatchSweepAxis Z \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -32,8 +34,10 @@ then pyFoamChangeMixingPlaneBoundary.py . mixpRightIn \ --shadowPatch mixpLeftOut \ - --assembly both \ - --orientation dirY_spanZ \ + --zone mixpRightInZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Y \ + --ribbonPatchSweepAxis Z \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -43,6 +47,9 @@ else cp constant/polyMesh/boundary.preconfigured constant/polyMesh/boundary fi +echo "$caseName: Creating zones for the mixingPlane" +runApplicationAndReportOnError setSet -batch setBatch +runApplicationAndReportOnError setsToZones -noFlipMap echo "$caseName: Creating the starting time directory" cp -r 0_orig 0 diff --git a/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/setBatch b/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/setBatch new file mode 100644 index 000000000..070702982 --- /dev/null +++ b/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/setBatch @@ -0,0 +1,3 @@ +faceSet mixpLeftOutZone new patchToFace mixpLeftOut +faceSet mixpRightInZone new patchToFace mixpRightIn +quit diff --git a/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/system/fvSchemes b/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/system/fvSchemes index 11638e5bd..22e9846af 100644 --- a/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/system/fvSchemes +++ b/tutorials/basic/laplacianFoam/twoBlocksMixingPlaneMismatch/system/fvSchemes @@ -52,4 +52,8 @@ fluxRequired T; } +mixingPlane +{ + default zeroGradient; +} // ************************************************************************* // diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/Allrun b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/Allrun index 77dd56bc3..911f8ceda 100755 --- a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/Allrun +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/Allrun @@ -23,8 +23,10 @@ then echo "Using pyFoamChangeMixingPlaneBoundary.py" pyFoamChangeMixingPlaneBoundary.py . mixpLeftOut \ --shadowPatch mixpRightIn \ - --assembly both \ - --orientation dirY_spanZ \ + --zone mixpLeftOutZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Y \ + --ribbonPatchSweepAxis Z \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -32,8 +34,10 @@ then pyFoamChangeMixingPlaneBoundary.py . mixpRightIn \ --shadowPatch mixpLeftOut \ - --assembly both \ - --orientation dirY_spanZ \ + --zone mixpRightInZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Y \ + --ribbonPatchSweepAxis Z \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -43,6 +47,9 @@ else cp constant/polyMesh/boundary.preconfigured constant/polyMesh/boundary fi +echo "$caseName: Creating zones for the mixingPlane" +runApplicationAndReportOnError setSet -batch setBatch +runApplicationAndReportOnError setsToZones -noFlipMap echo "$caseName: Creating the starting time directory" cp -r 0_orig 0 diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/setBatch b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/setBatch new file mode 100644 index 000000000..070702982 --- /dev/null +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/setBatch @@ -0,0 +1,3 @@ +faceSet mixpLeftOutZone new patchToFace mixpLeftOut +faceSet mixpRightInZone new patchToFace mixpRightIn +quit diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/system/fvSchemes b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/system/fvSchemes index 8bbb145a1..cfb797a4e 100644 --- a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/system/fvSchemes +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlaneMismatch_dirY_spanZ/system/fvSchemes @@ -55,4 +55,8 @@ fluxRequired p; } +mixingPlane +{ + default zeroGradient; +} // ************************************************************************* // diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/Allrun b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/Allrun index 77dd56bc3..e2b1e8227 100755 --- a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/Allrun +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/Allrun @@ -3,9 +3,255 @@ #set -x . $WM_PROJECT_DIR/bin/tools/RunFunctions +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Description +# Additionnal run functions, based on the original RunFunctions file +# +# Author: +# Martin Beaudoin, Hydro-Quebec, 2010. All rights reserved +# +#------------------------------------------------------------------------------ + +# Exception handler: dump the tail of the log file on error +verbose_report_on_runApplication_error() +{ + ecode=$? + if [ "$reportOnErrorOnlyOnce" ] ; then + echo " " + echo " => Error running $APP_RUN..." + echo " => Here are the last 50 lines of the log file log.$APP_RUN..." + echo " " + if [ -f log.$APP_RUN ] ; then + tail -50 log.$APP_RUN + exit $ecode; + fi + fi + + # Do not report again when exiting + unset reportOnErrorOnlyOnce +} + +# Variation of runApplication with exception handling +runApplicationAndReportOnError () +{ + trap 'verbose_report_on_runApplication_error' ERR + + LOG_NAME= + while getopts "l:" OPTFLAG ; do + LOG_NAME=$OPTARG + shift $((OPTIND-1)) ; OPTIND=1 + done + + APP_RUN=$1; shift + APP_NAME=${APP_RUN##*/} + + if [ -z $LOG_NAME ] ; then + LOG_NAME=log.$APP_NAME + fi + + reportOnErrorOnlyOnce=1 + + if [ -f $LOG_NAME ] ; then + echo "$APP_NAME already run on $PWD: remove log file to run" + exit 1; + else + echo "Running $APP_NAME on $PWD" + $APP_RUN $* > $LOG_NAME 2>&1 + fi +} + +# We force the display of a stack trace if we encounter problems +export FOAM_ABORT=1 # Load additional RunFunctions +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Description +# Additionnal run functions, based on the original RunFunctions file +# +# Author: +# Martin Beaudoin, Hydro-Quebec, 2010. All rights reserved +# +#------------------------------------------------------------------------------ + +# Exception handler: dump the tail of the log file on error +verbose_report_on_runApplication_error() +{ + ecode=$? + if [ "$reportOnErrorOnlyOnce" ] ; then + echo " " + echo " => Error running $APP_RUN..." + echo " => Here are the last 50 lines of the log file log.$APP_RUN..." + echo " " + if [ -f log.$APP_RUN ] ; then + tail -50 log.$APP_RUN + exit $ecode; + fi + fi + + # Do not report again when exiting + unset reportOnErrorOnlyOnce +} + +# Variation of runApplication with exception handling +runApplicationAndReportOnError () +{ + trap 'verbose_report_on_runApplication_error' ERR + + LOG_NAME= + while getopts "l:" OPTFLAG ; do + LOG_NAME=$OPTARG + shift $((OPTIND-1)) ; OPTIND=1 + done + + APP_RUN=$1; shift + APP_NAME=${APP_RUN##*/} + + if [ -z $LOG_NAME ] ; then + LOG_NAME=log.$APP_NAME + fi + + reportOnErrorOnlyOnce=1 + + if [ -f $LOG_NAME ] ; then + echo "$APP_NAME already run on $PWD: remove log file to run" + exit 1; + else + echo "Running $APP_NAME on $PWD" + $APP_RUN $* > $LOG_NAME 2>&1 + fi +} + +# We force the display of a stack trace if we encounter problems +export FOAM_ABORT=1 . ./RunFunctionsSupplemental +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Description +# Additionnal run functions, based on the original RunFunctions file +# +# Author: +# Martin Beaudoin, Hydro-Quebec, 2010. All rights reserved +# +#------------------------------------------------------------------------------ + +# Exception handler: dump the tail of the log file on error +verbose_report_on_runApplication_error() +{ + ecode=$? + if [ "$reportOnErrorOnlyOnce" ] ; then + echo " " + echo " => Error running $APP_RUN..." + echo " => Here are the last 50 lines of the log file log.$APP_RUN..." + echo " " + if [ -f log.$APP_RUN ] ; then + tail -50 log.$APP_RUN + exit $ecode; + fi + fi + + # Do not report again when exiting + unset reportOnErrorOnlyOnce +} + +# Variation of runApplication with exception handling +runApplicationAndReportOnError () +{ + trap 'verbose_report_on_runApplication_error' ERR + + LOG_NAME= + while getopts "l:" OPTFLAG ; do + LOG_NAME=$OPTARG + shift $((OPTIND-1)) ; OPTIND=1 + done + + APP_RUN=$1; shift + APP_NAME=${APP_RUN##*/} + + if [ -z $LOG_NAME ] ; then + LOG_NAME=log.$APP_NAME + fi + + reportOnErrorOnlyOnce=1 + + if [ -f $LOG_NAME ] ; then + echo "$APP_NAME already run on $PWD: remove log file to run" + exit 1; + else + echo "Running $APP_NAME on $PWD" + $APP_RUN $* > $LOG_NAME 2>&1 + fi +} + +# We force the display of a stack trace if we encounter problems +export FOAM_ABORT=1 export caseName=`basename $PWD` @@ -21,19 +267,23 @@ command -v pyFoamChangeMixingPlaneBoundary.py >/dev/null if [ $? -eq 0 ]; then echo "Using pyFoamChangeMixingPlaneBoundary.py" - pyFoamChangeMixingPlaneBoundary.py . mixpLeftOut \ + pyFoamChangeMixingPlaneBoundary.py . mixpLeftOut \ --shadowPatch mixpRightIn \ - --assembly both \ - --orientation dirY_spanZ \ + --zone mixpLeftOutZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Y \ + --ribbonPatchSweepAxis Z \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ --coordinateSystemE3 "(0 0 1)" - pyFoamChangeMixingPlaneBoundary.py . mixpRightIn \ + pyFoamChangeMixingPlaneBoundary.py . mixpRightIn \ --shadowPatch mixpLeftOut \ - --assembly both \ - --orientation dirY_spanZ \ + --zone mixpRightInZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Y \ + --ribbonPatchSweepAxis Z \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -43,6 +293,9 @@ else cp constant/polyMesh/boundary.preconfigured constant/polyMesh/boundary fi +echo "$caseName: Creating zones for the mixingPlane" +runApplicationAndReportOnError setSet -batch setBatch +runApplicationAndReportOnError setsToZones -noFlipMap echo "$caseName: Creating the starting time directory" cp -r 0_orig 0 diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/setBatch b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/setBatch new file mode 100644 index 000000000..070702982 --- /dev/null +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/setBatch @@ -0,0 +1,3 @@ +faceSet mixpLeftOutZone new patchToFace mixpLeftOut +faceSet mixpRightInZone new patchToFace mixpRightIn +quit diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/system/fvSchemes b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/system/fvSchemes index 8bbb145a1..cfb797a4e 100644 --- a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/system/fvSchemes +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirY_spanZ/system/fvSchemes @@ -55,4 +55,8 @@ fluxRequired p; } +mixingPlane +{ + default zeroGradient; +} // ************************************************************************* // diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/Allrun b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/Allrun index d0c083a2c..b7b9abf03 100755 --- a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/Allrun +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/Allrun @@ -21,10 +21,12 @@ command -v pyFoamChangeMixingPlaneBoundary.py >/dev/null if [ $? -eq 0 ]; then echo "Using pyFoamChangeMixingPlaneBoundary.py" - pyFoamChangeMixingPlaneBoundary.py . mixpLeftOut \ + pyFoamChangeMixingPlaneBoundary.py . mixpLeftOut \ --shadowPatch mixpRightIn \ - --assembly both \ - --orientation dirZ_spanY \ + --zone mixpLeftOutZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Z \ + --ribbonPatchSweepAxis Y \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -32,8 +34,10 @@ then pyFoamChangeMixingPlaneBoundary.py . mixpRightIn \ --shadowPatch mixpLeftOut \ - --assembly both \ - --orientation dirZ_spanY \ + --zone mixpRightInZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Z \ + --ribbonPatchSweepAxis Y \ --coordinateSystemType coordinateSystem \ --coordinateSystemOrigin "(0 0 0.005)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -43,6 +47,9 @@ else cp constant/polyMesh/boundary.preconfigured constant/polyMesh/boundary fi +echo "$caseName: Creating zones for the mixingPlane" +runApplicationAndReportOnError setSet -batch setBatch +runApplicationAndReportOnError setsToZones -noFlipMap echo "$caseName: Creating the starting time directory" cp -r 0_orig 0 diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/setBatch b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/setBatch new file mode 100644 index 000000000..070702982 --- /dev/null +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/setBatch @@ -0,0 +1,3 @@ +faceSet mixpLeftOutZone new patchToFace mixpLeftOut +faceSet mixpRightInZone new patchToFace mixpRightIn +quit diff --git a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/system/fvSchemes b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/system/fvSchemes index 8bbb145a1..cfb797a4e 100644 --- a/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/system/fvSchemes +++ b/tutorials/incompressible/icoFoam/mixingPlane/twoBlocksMixingPlane_dirZ_spanY/system/fvSchemes @@ -55,4 +55,8 @@ fluxRequired p; } +mixingPlane +{ + default zeroGradient; +} // ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/mixingPlaneAxial/Allrun b/tutorials/incompressible/simpleFoam/mixingPlaneAxial/Allrun index e2b4b6474..c9c0da681 100755 --- a/tutorials/incompressible/simpleFoam/mixingPlaneAxial/Allrun +++ b/tutorials/incompressible/simpleFoam/mixingPlaneAxial/Allrun @@ -26,8 +26,10 @@ then echo "Using pyFoamChangeMixingPlaneBoundary.py" pyFoamChangeMixingPlaneBoundary.py . upstreamMixingPlanePatch \ --shadowPatch downstreamMixingPlanePatch \ - --assembly both \ - --orientation dirZ_spanTheta \ + --zone upstreamMixingPlaneZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Z \ + --ribbonPatchSweepAxis Theta \ --coordinateSystemType cylindrical \ --coordinateSystemOrigin "(0 0 0)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -35,8 +37,10 @@ then pyFoamChangeMixingPlaneBoundary.py . downstreamMixingPlanePatch \ --shadowPatch upstreamMixingPlanePatch \ - --assembly both \ - --orientation dirZ_spanTheta \ + --zone downstreamMixingPlaneZone \ + --ribbonPatchDiscretisation bothPatches \ + --ribbonPatchStackAxis Z \ + --ribbonPatchSweepAxis Theta \ --coordinateSystemType cylindrical \ --coordinateSystemOrigin "(0 0 0)" \ --coordinateSystemE1 "(1 0 0)" \ @@ -75,9 +79,16 @@ fi echo "$caseName: Creating the starting time directory" cp -r 0_orig 0 +echo "$caseName: Creating zones for the mixingPlane" +runApplicationAndReportOnError setSet -batch setBatchMixingPlane +runApplicationAndReportOnError setsToZones -noFlipMap +mv log.setSet log.setSet_MixingPlane +mv log.setsToZones log.setsToZones_MixingPlane runApplicationAndReportOnError setSet -batch setBatchGGIZone runApplicationAndReportOnError setsToZones -noFlipMap +mv log.setSet log.setSet_GGIZone +mv log.setsToZones log.setsToZones_GGIZone echo "$caseName: Running potentialFoam" runApplicationAndReportOnError potentialFoam diff --git a/tutorials/incompressible/simpleFoam/mixingPlaneAxial/setBatchMixingPlane b/tutorials/incompressible/simpleFoam/mixingPlaneAxial/setBatchMixingPlane new file mode 100644 index 000000000..2e9a05a1f --- /dev/null +++ b/tutorials/incompressible/simpleFoam/mixingPlaneAxial/setBatchMixingPlane @@ -0,0 +1,3 @@ +faceSet upstreamMixingPlaneZone new patchToFace upstreamMixingPlanePatch +faceSet downstreamMixingPlaneZone new patchToFace downstreamMixingPlanePatch +quit diff --git a/tutorials/incompressible/simpleFoam/mixingPlaneAxial/system/fvSchemes b/tutorials/incompressible/simpleFoam/mixingPlaneAxial/system/fvSchemes index 216ac3d98..5a533e6a7 100644 --- a/tutorials/incompressible/simpleFoam/mixingPlaneAxial/system/fvSchemes +++ b/tutorials/incompressible/simpleFoam/mixingPlaneAxial/system/fvSchemes @@ -67,4 +67,9 @@ fluxRequired p; } +mixingPlane +{ + default zeroGradient; +} + // ************************************************************************* //