From 74f56fec0f06c42110f7dd08d56c8f1da2d370b4 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 16 Mar 2011 12:29:47 +0000 Subject: [PATCH 001/108] ENH: add option for version --- bin/tools/foamConfigurePaths | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) mode change 100644 => 100755 bin/tools/foamConfigurePaths diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths old mode 100644 new mode 100755 index 4cc15532c6..f3948c3cc2 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -37,6 +37,7 @@ usage() { usage: ${0##*/} --foamInstall dir specify installation directory (e.g. /opt) --projectName name specify project name (e.g. openfoam170) + --projectVersion ver specify project version (e.g. 1.7.x) --archOption arch specify architecture option (only 32 or 64 applicable) --paraviewInstall dir specify ParaView_DIR (e.g. /opt/paraviewopenfoam380) @@ -76,7 +77,7 @@ _inlineSed() [ -f etc/bashrc ] || usage "Please run from top-level directory of installation" -unset foamInstall projectName archOption paraviewInstall +unset foamInstall projectName projectVersion archOption paraviewInstall # parse options while [ "$#" -gt 0 ] @@ -102,7 +103,17 @@ do _inlineSed \ etc/bashrc \ '/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" \ - "Replacing WM_PROJECT_DIR setting by '$projectName'" + "Replacing WM_PROJECT_DIR setting by $projectName" + shift 2 + ;; + --projectVersion) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + projectVersion="$2" + # replace WM_PROJECT_VERSION=... + _inlineSed \ + etc/bashrc \ + '/^[^#]/s@WM_PROJECT_VERSION=.*@WM_PROJECT_VERSION='"$projectVersion@" \ + "Replacing WM_PROJECT_VERSION setting by $projectVersion" shift 2 ;; -archOption | --archOption) @@ -142,10 +153,10 @@ _inlineSed \ '/^[^#]/s@export WM_MPLIB=.*@export WM_MPLIB=SYSTEMOPENMPI@' \ "Replacing WM_MPLIB setting by 'SYSTEMOPENMPI'" -# set foamCompiler=system always -_inlineSed \ - etc/bashrc \ - '/^[^#]/s@foamCompiler=.*@foamCompiler=system@' \ - "Replacing foamCompiler setting by 'system'" +## set foamCompiler=system always +#_inlineSed \ +# etc/bashrc \ +# '/^[^#]/s@foamCompiler=.*@foamCompiler=system@' \ +# "Replacing foamCompiler setting by 'system'" #------------------------------------------------------------------------------ From d47133aed9a38bc57d81a89650b19ca2314fcb38 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 7 Apr 2011 08:54:29 +0100 Subject: [PATCH 002/108] ENH: polyMeshTetDecmoposition: move List allocation outside loop --- .../polyMeshTetDecomposition/polyMeshTetDecomposition.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C index 44e65e4c16..b881a5ae77 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshTetDecomposition/polyMeshTetDecomposition.C @@ -55,6 +55,8 @@ Foam::label Foam::polyMeshTetDecomposition::findSharedBasePoint const point& oCc = pC[oCI]; + List tetQualities(2, 0.0); + forAll(f, faceBasePtI) { scalar thisBaseMinTetQuality = VGREAT; @@ -66,8 +68,6 @@ Foam::label Foam::polyMeshTetDecomposition::findSharedBasePoint label facePtI = (tetPtI + faceBasePtI) % f.size(); label otherFacePtI = f.fcIndex(facePtI); - List tetQualities(2, 0.0); - { // owner cell tet label ptAI = f[facePtI]; From dccfa2171bf5b3350b6b080820e2874e9afd6fa1 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 7 Apr 2011 08:56:12 +0100 Subject: [PATCH 003/108] STYLE: primitiveMesh.H: removed extraneous includes --- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 1 + .../polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C | 1 + src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C | 1 + src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H | 4 ---- .../primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C | 2 +- src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C | 3 ++- src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFindCell.C | 1 + src/meshTools/cellDist/patchWave/patchWave.C | 1 + src/meshTools/cellQuality/cellQuality.C | 1 + .../directMappedPolyPatch/directMappedPatchBase.C | 1 + src/meshTools/twoDPointCorrector/twoDPointCorrector.C | 1 + .../decompositionMethods/simpleGeomDecomp/simpleGeomDecomp.C | 1 + src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C | 1 + src/parallel/decompose/scotchDecomp/scotchDecomp.C | 1 + 14 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 4c08d917e7..1e08d994e3 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -36,6 +36,7 @@ License #include "polyMeshTetDecomposition.H" #include "indexedOctree.H" #include "treeDataCell.H" +#include "SubField.H" #include "pointMesh.H" diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 0c8b033fbc..359c651020 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -35,6 +35,7 @@ License #include "Time.H" #include "diagTensor.H" #include "transformField.H" +#include "SubField.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index 23356b7069..9321959b2d 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C @@ -31,6 +31,7 @@ License #include "contiguous.H" #include "transform.H" #include "transformList.H" +#include "SubField.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H index 92937ed158..65f2adb157 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H @@ -56,8 +56,6 @@ SourceFiles #include "DynamicList.H" #include "edgeList.H" #include "pointField.H" -#include "SubField.H" -#include "SubList.H" #include "faceList.H" #include "cellList.H" #include "cellShapeList.H" @@ -65,8 +63,6 @@ SourceFiles #include "boolList.H" #include "HashSet.H" #include "Map.H" -#include "EdgeMap.H" -#include "boundBox.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C index 0cec531bde..94481b0eb7 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C @@ -29,7 +29,7 @@ License #include "ListOps.H" #include "unitConversion.H" #include "SortableList.H" - +#include "EdgeMap.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C index cc232c162f..464bfd60b0 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C @@ -25,7 +25,8 @@ License #include "primitiveMesh.H" #include "demandDrivenData.H" - +#include "indexedOctree.H" +#include "treeDataCell.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFindCell.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFindCell.C index c7087aa70f..32252cc3e6 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFindCell.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFindCell.C @@ -25,6 +25,7 @@ License #include "primitiveMesh.H" #include "cell.H" +#include "boundBox.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/meshTools/cellDist/patchWave/patchWave.C b/src/meshTools/cellDist/patchWave/patchWave.C index a8f55f5722..2d688c43b0 100644 --- a/src/meshTools/cellDist/patchWave/patchWave.C +++ b/src/meshTools/cellDist/patchWave/patchWave.C @@ -27,6 +27,7 @@ License #include "polyMesh.H" #include "wallPoint.H" #include "globalMeshData.H" +#include "SubField.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/cellQuality/cellQuality.C b/src/meshTools/cellQuality/cellQuality.C index ba1c5af981..e34cf0cc12 100644 --- a/src/meshTools/cellQuality/cellQuality.C +++ b/src/meshTools/cellQuality/cellQuality.C @@ -26,6 +26,7 @@ License #include "cellQuality.H" #include "unitConversion.H" +#include "SubField.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C index 544245faf5..f49a9b6ce6 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C @@ -36,6 +36,7 @@ License #include "polyPatch.H" #include "Time.H" #include "mapDistribute.H" +#include "SubField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/meshTools/twoDPointCorrector/twoDPointCorrector.C b/src/meshTools/twoDPointCorrector/twoDPointCorrector.C index 85cb880410..8aeba886c4 100644 --- a/src/meshTools/twoDPointCorrector/twoDPointCorrector.C +++ b/src/meshTools/twoDPointCorrector/twoDPointCorrector.C @@ -27,6 +27,7 @@ License #include "polyMesh.H" #include "wedgePolyPatch.H" #include "emptyPolyPatch.H" +#include "SubField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/decompose/decompositionMethods/simpleGeomDecomp/simpleGeomDecomp.C b/src/parallel/decompose/decompositionMethods/simpleGeomDecomp/simpleGeomDecomp.C index 4ce8706dea..84b3dc0544 100644 --- a/src/parallel/decompose/decompositionMethods/simpleGeomDecomp/simpleGeomDecomp.C +++ b/src/parallel/decompose/decompositionMethods/simpleGeomDecomp/simpleGeomDecomp.C @@ -27,6 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "SortableList.H" #include "globalIndex.H" +#include "SubField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C index 5083bb0e89..655b58fde1 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -117,6 +117,7 @@ License #include "Time.H" #include "OFstream.H" #include "globalIndex.H" +#include "SubField.H" extern "C" { diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C index b569b0bae5..3297b49461 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C @@ -110,6 +110,7 @@ License #include "Time.H" #include "OFstream.H" #include "globalIndex.H" +#include "SubField.H" extern "C" { From 472bb82160247d81567a53da09b261a05af268c7 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 7 Apr 2011 09:27:02 +0100 Subject: [PATCH 004/108] ENH: foamToFieldView: added region option. --- .../foamToFieldview9/foamToFieldview9.C | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C index d301525ccd..bba44829f9 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C +++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.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 @@ -183,12 +183,14 @@ int main(int argc, char *argv[]) ); timeSelector::addOptions(true, false); +# include "addRegionOption.H" + # include "setRootCase.H" # include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); -# include "createMesh.H" +# include "createNamedMesh.H" // Initialize name mapping table FieldviewNames.insert("alpha", "aalpha"); @@ -260,9 +262,22 @@ int main(int argc, char *argv[]) // make a directory called FieldView in the case fileName fvPath(runTime.path()/"Fieldview"); + if (regionName != polyMesh::defaultRegion) + { + fvPath = fvPath/regionName; + } + if (isDir(fvPath)) { - rmDir(fvPath); + if (regionName != polyMesh::defaultRegion) + { + Info<< "Keeping old FieldView files in " << fvPath << nl << endl; + } + else + { + Info<< "Deleting old FieldView files in " << fvPath << nl << endl; + rmDir(fvPath); + } } mkDir(fvPath); From 39de49429df2b309983ae263d6bdf5d89c4911bb Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 7 Apr 2011 22:35:34 +0100 Subject: [PATCH 005/108] ENH: surfaceFeatures: search start of string --- .../surfaceFeatures/surfaceFeatures.C | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C index 2639f854c1..06e97a41a1 100644 --- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C +++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.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 @@ -263,6 +263,16 @@ Foam::surfaceFeatures::labelScalar Foam::surfaceFeatures::walkSegment label vertI = startPointI; + scalar visitedLength = 0.0; + + label nVisited = 0; + + if (findIndex(featurePoints_, startPointI) >= 0) + { + // Do not walk across feature points + + return labelScalar(nVisited, visitedLength); + } // // Now we have: @@ -284,11 +294,6 @@ Foam::surfaceFeatures::labelScalar Foam::surfaceFeatures::walkSegment unsetVal = currentFeatI; } - - scalar visitedLength = 0.0; - - label nVisited = 0; - do { // Step to next feature edge with value unsetVal @@ -620,8 +625,13 @@ void Foam::surfaceFeatures::trimFeatures if ( - (leftPath.len_ + rightPath.len_ < minLen) - || (leftPath.n_ + rightPath.n_ < minElems) + ( + leftPath.len_ + + rightPath.len_ + + startEdge.mag(surf_.localPoints()) + < minLen + ) + || (leftPath.n_ + rightPath.n_ + 1 < minElems) ) { // Rewalk same route (recognizable by featLines == featI) From 13ce640b92a2dc6bcc636c61400d685c5254d8ce Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 7 Apr 2011 22:36:11 +0100 Subject: [PATCH 006/108] ENH: dates --- .../utilities/mesh/conversion/writeMeshObj/writeMeshObj.C | 2 +- .../utilities/mesh/manipulation/refineMesh/refineMesh.C | 2 +- .../primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C | 2 +- src/meshTools/cellDist/patchWave/patchWave.C | 2 +- src/meshTools/cellQuality/cellQuality.C | 2 +- src/meshTools/twoDPointCorrector/twoDPointCorrector.C | 2 +- src/parallel/decompose/scotchDecomp/scotchDecomp.C | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C index 4a73cf1204..7eac0b77c1 100644 --- a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C +++ b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.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 diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index b41304488d..9a04109709 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.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 diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C index 94481b0eb7..438e432816 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.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 diff --git a/src/meshTools/cellDist/patchWave/patchWave.C b/src/meshTools/cellDist/patchWave/patchWave.C index 2d688c43b0..6e20c7340e 100644 --- a/src/meshTools/cellDist/patchWave/patchWave.C +++ b/src/meshTools/cellDist/patchWave/patchWave.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 diff --git a/src/meshTools/cellQuality/cellQuality.C b/src/meshTools/cellQuality/cellQuality.C index e34cf0cc12..dcc1da09e5 100644 --- a/src/meshTools/cellQuality/cellQuality.C +++ b/src/meshTools/cellQuality/cellQuality.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 diff --git a/src/meshTools/twoDPointCorrector/twoDPointCorrector.C b/src/meshTools/twoDPointCorrector/twoDPointCorrector.C index 8aeba886c4..93b67bb179 100644 --- a/src/meshTools/twoDPointCorrector/twoDPointCorrector.C +++ b/src/meshTools/twoDPointCorrector/twoDPointCorrector.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 diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C index 3297b49461..7efb29d40c 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License From 7e810605fe9277fb3f219a5092f8a1aef800711a Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 8 Apr 2011 10:03:02 +0100 Subject: [PATCH 007/108] ENH: Updated kinematic cloud theta field calculation --- .../KinematicCloud/KinematicCloudI.H | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 5987192bfd..568d089030 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -370,42 +370,22 @@ Foam::KinematicCloud::theta() const false ), mesh_, - dimensionedScalar("zero", dimless, 0.0) + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName ) ); volScalarField& theta = ttheta(); - theta.boundaryField() == 0; - forAllConstIter(typename KinematicCloud, *this, iter) { const parcelType& p = iter(); const label cellI = p.cell(); - if ((p.face() != -1)) - { - const label patchI = p.patch(p.face()); - if (patchI != -1) - { - scalarField& thetap = theta.boundaryField()[patchI]; - const label faceI = p.patchFace(patchI, p.face()); - thetap[faceI] += p.nParticle()*p.areaP(); - } - } - theta[cellI] += p.nParticle()*p.volume(); } theta.internalField() /= mesh_.V(); - - forAll(theta.boundaryField(), patchI) - { - scalarField& thetap = theta.boundaryField()[patchI]; - if (thetap.size() > 0) - { - thetap /= mesh_.magSf().boundaryField()[patchI]; - } - } + theta.correctBoundaryConditions(); return ttheta; } From d1fdcc2698c9a6c5e32428a270493f1b4a5a0e71 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 8 Apr 2011 10:05:07 +0100 Subject: [PATCH 008/108] STYLE: minor code changes --- src/OpenFOAM/db/IOstreams/token/token.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/db/IOstreams/token/token.H b/src/OpenFOAM/db/IOstreams/token/token.H index c48c22b5c3..0497c75e8d 100644 --- a/src/OpenFOAM/db/IOstreams/token/token.H +++ b/src/OpenFOAM/db/IOstreams/token/token.H @@ -435,11 +435,11 @@ Ostream& operator<<(Ostream&, const token::compound&); #define defineCompoundTypeName(Type, Name) \ - typedef token::Compound tokenCompound##Name##_; \ + typedef token::Compound tokenCompound##Name##_; \ defineTemplateTypeNameAndDebugWithName(tokenCompound##Name##_, #Type, 0); #define addCompoundToRunTimeSelectionTable(Type, Name) \ - token::compound::addIstreamConstructorToTable > \ + token::compound::addIstreamConstructorToTable > \ add##Name##IstreamConstructorToTable_; From 386dd53f44beaaa4b427df57c200ad26db2eda76 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 8 Apr 2011 15:09:19 +0100 Subject: [PATCH 009/108] ENH:autoSnapDriver: added support for facezones --- .../autoHexMeshDriver/autoSnapDriver.C | 60 +-- .../autoHexMeshDriver/autoSnapDriver.H | 12 +- .../autoHexMeshDriver/autoSnapDriverFeature.C | 433 ++++++------------ .../meshRefinement/meshRefinementMerge.C | 48 +- 4 files changed, 219 insertions(+), 334 deletions(-) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 3787156a53..6c1925f064 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -722,10 +722,15 @@ void Foam::autoSnapDriver::preSmoothPatch if (debug) { const_cast(mesh.time())++; - Pout<< "Writing patch smoothed mesh to time " << meshRefiner_.timeName() - << endl; - - mesh.write(); + Pout<< "Writing patch smoothed mesh to time " + << meshRefiner_.timeName() << '.' << endl; + meshRefiner_.write + ( + debug, + mesh.time().path()/meshRefiner_.timeName() + ); + Pout<< "Dumped mesh in = " + << mesh.time().cpuTimeIncrement() << " s\n" << nl << endl; } Info<< "Patch points smoothed in = " @@ -956,25 +961,6 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface vector(GREAT, GREAT, GREAT) // null value (note: cannot use VGREAT) ); - - // Check for displacement being outwards. - outwardsDisplacement(pp, patchDisp); - - // Set initial distribution of displacement field (on patches) from - // patchDisp and make displacement consistent with b.c. on displacement - // pointVectorField. - meshMover.setDisplacement(patchDisp); - - if (debug) - { - dumpMove - ( - mesh.time().path()/"patchDisplacement.obj", - pp.localPoints(), - pp.localPoints() + patchDisp - ); - } - return patchDisp; } @@ -1128,8 +1114,8 @@ Foam::autoPtr Foam::autoSnapDriver::repatchToSurface indirectPrimitivePatch& pp = ppPtr(); // Divide surfaces into zoned and unzoned - labelList zonedSurfaces = meshRefiner_.surfaces().getNamedSurfaces(); - labelList unzonedSurfaces = meshRefiner_.surfaces().getUnnamedSurfaces(); + labelList zonedSurfaces = surfaces.getNamedSurfaces(); + labelList unzonedSurfaces = surfaces.getUnnamedSurfaces(); // Faces that do not move @@ -1344,19 +1330,6 @@ void Foam::autoSnapDriver::doSnap // Pre-smooth patch vertices (so before determining nearest) preSmoothPatch(snapParams, nInitErrors, baffles, meshMover); - if (debug) - { - Pout<< "Writing patch smoothed mesh to time " - << meshRefiner_.timeName() << '.' << endl; - meshRefiner_.write - ( - debug, - mesh.time().path()/meshRefiner_.timeName() - ); - Pout<< "Dumped mesh in = " - << mesh.time().cpuTimeIncrement() << " s\n" << nl << endl; - } - for (label iter = 0; iter < nFeatIter; iter++) { @@ -1382,6 +1355,15 @@ void Foam::autoSnapDriver::doSnap ); } + // Check for displacement being outwards. + outwardsDisplacement(ppPtr(), disp); + + // Set initial distribution of displacement field (on patches) + // from patchDisp and make displacement consistent with b.c. + // on displacement pointVectorField. + meshMover.setDisplacement(disp); + + if (debug&meshRefinement::OBJINTERSECTIONS) { dumpMove @@ -1467,7 +1449,7 @@ void Foam::autoSnapDriver::doSnap meshRefiner_.write ( debug, - mesh.time().path()/meshRefiner_.timeName() + meshRefiner_.timeName() ); } } diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index 4b0e1a30fd..59cd772a98 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -117,12 +117,12 @@ class autoSnapDriver const List& constraints, vectorField& disp ) const; - void calcNearest - ( - const pointField& points, - vectorField& disp, - vectorField& surfaceNormal - ) const; + //void calcNearest + //( + // const pointField& points, + // vectorField& disp, + // vectorField& surfaceNormal + //) const; void calcNearestFace ( const label iter, diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C index cc73efbe51..0227234822 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C @@ -135,63 +135,6 @@ void Foam::autoSnapDriver::smoothAndConstrain } -void Foam::autoSnapDriver::calcNearest -( - const pointField& points, - vectorField& disp, - vectorField& surfaceNormal -) const -{ - const refinementSurfaces& surfaces = meshRefiner_.surfaces(); - - // Displacement and orientation per pp face. - disp.setSize(points.size()); - disp = vector::zero; - surfaceNormal.setSize(points.size()); - surfaceNormal = vector::zero; - - { - // Divide surfaces into zoned and unzoned - labelList zonedSurfaces = - meshRefiner_.surfaces().getNamedSurfaces(); - labelList unzonedSurfaces = - meshRefiner_.surfaces().getUnnamedSurfaces(); - - { - List hitInfo; - labelList hitSurface; - labelList hitRegion; - surfaces.findNearestRegion - ( - unzonedSurfaces, - points, - sqr(scalarField(points.size(), GREAT)),// sqr of attract dist - hitSurface, - hitInfo, - hitRegion, - surfaceNormal - ); - - forAll(hitInfo, i) - { - if (hitInfo[i].hit()) - { - disp[i] = - hitInfo[i].hitPoint() - - points[i]; - } - else - { - WarningIn("calcNearest(..)") - << "Did not hit anything from face:" << i - << " at:" << points[i] << endl; - } - } - } - } -} - - void Foam::autoSnapDriver::calcNearestFace ( const label iter, @@ -202,6 +145,7 @@ void Foam::autoSnapDriver::calcNearestFace ) const { const fvMesh& mesh = meshRefiner_.mesh(); + const refinementSurfaces& surfaces = meshRefiner_.surfaces(); // Displacement and orientation per pp face. faceDisp.setSize(pp.size()); @@ -209,7 +153,148 @@ void Foam::autoSnapDriver::calcNearestFace faceSurfaceNormal.setSize(pp.size()); faceSurfaceNormal = vector::zero; - calcNearest(pp.faceCentres(), faceDisp, faceSurfaceNormal); + // Divide surfaces into zoned and unzoned + labelList zonedSurfaces = surfaces.getNamedSurfaces(); + labelList unzonedSurfaces = surfaces.getUnnamedSurfaces(); + + // Per pp face the current surface snapped to + labelList snapSurf(pp.size(), -1); + + + // Do zoned surfaces + // ~~~~~~~~~~~~~~~~~ + // Zoned faces only attract to corresponding surface + + // Extract faces per zone + const wordList& faceZoneNames = surfaces.faceZoneNames(); + + forAll(zonedSurfaces, i) + { + label zoneSurfI = zonedSurfaces[i]; + + // Get indices of faces on pp that are also in zone + label zoneI = mesh.faceZones().findZoneID(faceZoneNames[zoneSurfI]); + if (zoneI == -1) + { + FatalErrorIn + ( + "autoSnapDriver::calcNearestFace(..)" + ) << "Problem. Cannot find zone " << faceZoneNames[zoneSurfI] + << exit(FatalError); + } + const faceZone& fZone = mesh.faceZones()[zoneI]; + PackedBoolList isZonedFace(mesh.nFaces()); + forAll(fZone, i) + { + isZonedFace[fZone[i]] = 1; + } + + DynamicList