From d981028d3540275a05f7a6ade86c80a1ca7403a6 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 26 Mar 2010 13:35:42 +0000 Subject: [PATCH 1/5] STYLE: Added to header --- .../manipulation/splitMeshRegions/splitMeshRegions.C | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 7b9d5ea8ce..07a3b84426 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -22,6 +22,9 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Application + splitMeshRegions + Description Splits mesh into multiple regions. @@ -32,6 +35,7 @@ Description - any face inbetween differing cellZones (-cellZones) Output is: + - volScalarField with regions as different scalars (-detectOnly) or - mesh with multiple regions or - mesh with cells put into cellZones (-makeCellZones) @@ -47,7 +51,13 @@ Description - useCellZonesOnly does not do a walk and uses the cellZones only. Use this if you don't mind having disconnected domains in a single region. This option requires all cells to be in one (and one only) cellZone. - + - writes maps like decomposePar back to original mesh: + - pointRegionAddressing : for every point in this region the point in + the original mesh + - cellRegionAddressing : ,, cell ,, cell ,, + - faceRegionAddressing : ,, face ,, face in + the original mesh + 'turning index'. For a face in the same orientation + this is the original facelabel+1, for a turned face this is -facelabel-1 \*---------------------------------------------------------------------------*/ #include "SortableList.H" From d6c5d294b43936bf813f39b6447ebfc2a3be4fc5 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 26 Mar 2010 13:36:24 +0000 Subject: [PATCH 2/5] ENH: added patchID access function --- .../polyBoundaryMesh/polyBoundaryMesh.C | 53 ++++++++++++++----- .../polyBoundaryMesh/polyBoundaryMesh.H | 7 ++- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index 07bb357ff3..1820c43ef0 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -61,8 +61,7 @@ Foam::polyBoundaryMesh::polyBoundaryMesh : polyPatchList(), regIOobject(io), - mesh_(mesh), - neighbourEdgesPtr_(NULL) + mesh_(mesh) { if (readOpt() == IOobject::MUST_READ) { @@ -110,17 +109,14 @@ Foam::polyBoundaryMesh::polyBoundaryMesh : polyPatchList(size), regIOobject(io), - mesh_(pm), - neighbourEdgesPtr_(NULL) + mesh_(pm) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::polyBoundaryMesh::~polyBoundaryMesh() -{ - deleteDemandDrivenData(neighbourEdgesPtr_); -} +{} void Foam::polyBoundaryMesh::clearGeom() @@ -134,7 +130,8 @@ void Foam::polyBoundaryMesh::clearGeom() void Foam::polyBoundaryMesh::clearAddressing() { - deleteDemandDrivenData(neighbourEdgesPtr_); + neighbourEdgesPtr_.clear(); + patchIDPtr_.clear(); forAll (*this, patchi) { @@ -201,10 +198,10 @@ Foam::polyBoundaryMesh::neighbourEdges() const << " boundaries." << endl; } - if (!neighbourEdgesPtr_) + if (!neighbourEdgesPtr_.valid()) { - neighbourEdgesPtr_ = new List(size()); - List& neighbourEdges = *neighbourEdgesPtr_; + neighbourEdgesPtr_.reset(new List(size())); + List& neighbourEdges = neighbourEdgesPtr_(); // Initialize. label nEdgePairs = 0; @@ -320,7 +317,36 @@ Foam::polyBoundaryMesh::neighbourEdges() const } } - return *neighbourEdgesPtr_; + return neighbourEdgesPtr_(); +} + + +const Foam::labelList& Foam::polyBoundaryMesh::patchID() const +{ + if (!patchIDPtr_.valid()) + { + patchIDPtr_.reset + ( + new labelList + ( + mesh_.nFaces() + - mesh_.nInternalFaces() + ) + ); + labelList& patchID = patchIDPtr_(); + + const polyBoundaryMesh& bm = *this; + + forAll(bm, patchI) + { + label bFaceI = bm[patchI].start() - mesh_.nInternalFaces(); + forAll(bm[patchI], i) + { + patchID[bFaceI++] = patchI; + } + } + } + return patchIDPtr_(); } @@ -654,7 +680,8 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p) void Foam::polyBoundaryMesh::updateMesh() { - deleteDemandDrivenData(neighbourEdgesPtr_); + neighbourEdgesPtr_.clear(); + patchIDPtr_.clear(); PstreamBuffers pBufs(Pstream::defaultCommsType); diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index fdea473ed3..76981ef2bc 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -67,8 +67,10 @@ class polyBoundaryMesh //- Reference to mesh const polyMesh& mesh_; + mutable autoPtr patchIDPtr_; + //- Edges of neighbouring patches - mutable List* neighbourEdgesPtr_; + mutable autoPtr > neighbourEdgesPtr_; // Private Member Functions @@ -157,6 +159,9 @@ public: //- Return patch index for a given face label label whichPatch(const label faceIndex) const; + //- Per boundary face label the patch index + const labelList& patchID() const; + //- Return the set of patch IDs corresponding to the given list of names // Wild cards are expanded. labelHashSet patchSet(const wordList&) const; From df56a5b192cccbe3d9e5cb68529420cbb225d6ea Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 26 Mar 2010 13:36:53 +0000 Subject: [PATCH 3/5] STYLE: corrected header. --- .../functionObjects/field/fieldValues/faceSource/faceSource.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H index 8ef65d870b..0d013cd7e3 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H @@ -29,9 +29,9 @@ Description Face source variant of field value function object. Values of user- specified fields reported for collections of faces. - cellObj1 // Name also used to identify output folder + faceObj1 // Name also used to identify output folder { - type cellSource; + type faceSource; functionObjectLibs ("libfieldValueFunctionObjects.so"); enabled true; outputControl outputTime; From c521e80c9f6dc884d8ed041fb701fafff692774f Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 26 Mar 2010 13:38:55 +0000 Subject: [PATCH 4/5] ENH: Added missing surfaceField types (surfaceVectorField, surfaceTensorField etc) --- .../decomposePar/decomposePar.C | 16 +++++++++++++ .../reconstructPar/reconstructPar.C | 24 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 02d8005e92..afd3667f6e 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -334,6 +334,14 @@ int main(int argc, char *argv[]) // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PtrList surfaceScalarFields; readFields(mesh, objects, surfaceScalarFields); + PtrList surfaceVectorFields; + readFields(mesh, objects, surfaceVectorFields); + PtrList surfaceSphericalTensorFields; + readFields(mesh, objects, surfaceSphericalTensorFields); + PtrList surfaceSymmTensorFields; + readFields(mesh, objects, surfaceSymmTensorFields); + PtrList surfaceTensorFields; + readFields(mesh, objects, surfaceTensorFields); // Construct the point fields @@ -619,6 +627,10 @@ int main(int argc, char *argv[]) || volSymmTensorFields.size() || volTensorFields.size() || surfaceScalarFields.size() + || surfaceVectorFields.size() + || surfaceSphericalTensorFields.size() + || surfaceSymmTensorFields.size() + || surfaceTensorFields.size() ) { labelIOList faceProcAddressing @@ -650,6 +662,10 @@ int main(int argc, char *argv[]) fieldDecomposer.decomposeFields(volTensorFields); fieldDecomposer.decomposeFields(surfaceScalarFields); + fieldDecomposer.decomposeFields(surfaceVectorFields); + fieldDecomposer.decomposeFields(surfaceSphericalTensorFields); + fieldDecomposer.decomposeFields(surfaceSymmTensorFields); + fieldDecomposer.decomposeFields(surfaceTensorFields); } diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index d2dcd818ca..d40be34b0a 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -191,6 +191,10 @@ int main(int argc, char *argv[]) || objects.lookupClass(volSymmTensorField::typeName).size() || objects.lookupClass(volTensorField::typeName).size() || objects.lookupClass(surfaceScalarField::typeName).size() + || objects.lookupClass(surfaceVectorField::typeName).size() + || objects.lookupClass(surfaceSphericalTensorField::typeName).size() + || objects.lookupClass(surfaceSymmTensorField::typeName).size() + || objects.lookupClass(surfaceTensorField::typeName).size() ) { Info<< "Reconstructing FV fields" << nl << endl; @@ -235,6 +239,26 @@ int main(int argc, char *argv[]) objects, selectedFields ); + fvReconstructor.reconstructFvSurfaceFields + ( + objects, + selectedFields + ); + fvReconstructor.reconstructFvSurfaceFields + ( + objects, + selectedFields + ); + fvReconstructor.reconstructFvSurfaceFields + ( + objects, + selectedFields + ); + fvReconstructor.reconstructFvSurfaceFields + ( + objects, + selectedFields + ); } else { From d01adb74e30d85561a6f021e5b7162ad613e877a Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 26 Mar 2010 13:39:51 +0000 Subject: [PATCH 5/5] ENH: Added tet volume check to checkMesh and snappyHexMesh --- .../snappyHexMesh/snappyHexMeshDict | 9 +- .../manipulation/checkMesh/checkGeometry.C | 19 ++ .../meshes/primitiveMesh/primitiveMesh.H | 9 +- .../primitiveMeshCheck/primitiveMeshCheck.C | 111 ++++++++- .../motionSmoother/motionSmootherCheck.C | 54 ++++- .../polyMeshGeometry/polyMeshGeometry.C | 212 ++++++++++++++++++ .../polyMeshGeometry/polyMeshGeometry.H | 37 +++ .../iglooWithFridges/system/snappyHexMeshDict | 9 +- .../system/snappyHexMeshDict | 9 +- .../motorBike/system/snappyHexMeshDict | 9 +- .../cavitatingBullet/system/snappyHexMeshDict | 9 +- 11 files changed, 469 insertions(+), 18 deletions(-) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index dab2d1d064..31a841b80f 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -327,14 +327,17 @@ meshQualityControls // Set to 180 to disable. maxConcave 80; - //- Minimum projected area v.s. actual area. Set to -1 to disable. - minFlatness 0.5; - //- Minimum pyramid volume. Is absolute volume of cell pyramid. // Set to a sensible fraction of the smallest cell volume expected. // Set to very negative number (e.g. -1E30) to disable. minVol 1e-13; + //- Minimum tet volume. Is absolute volume of the tet formed by the + // face-centre decomposition triangle and the cell centre. + // Set to a sensible fraction of the smallest cell volume expected. + // Set to very negative number (e.g. -1E30) to disable. + minTetVol 1e-20; + //- Minimum face area. Set to <0 to disable. minArea -1; diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 44ad601a02..e16d90bbbd 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -159,6 +159,25 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) } } + { + faceSet faces(mesh, "wrongOrientedTriangleFaces", mesh.nFaces()/100 + 1); + if (mesh.checkFaceTets(true, 0, &faces)) + { + noFailedChecks++; + + label nFaces = returnReduce(faces.size(), sumOp