From ffbc93b9d5d73193ca0ba54283cf9ed7f021f452 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2015 12:44:26 +0000 Subject: [PATCH 01/11] ENH: containers: small changes to containers --- .../containers/Lists/ListOps/ListOps.H | 13 +++- .../Lists/ListOps/ListOpsTemplates.C | 25 +++++++- src/OpenFOAM/containers/Lists/UList/UListI.H | 4 +- .../containers/Lists/UPtrList/UPtrList.C | 26 +++++++- .../containers/Lists/UPtrList/UPtrList.H | 9 ++- .../IOobjects/CompactIOList/CompactIOList.C | 59 ++++++++++++++++++- .../IOobjects/CompactIOList/CompactIOList.H | 5 +- .../regionSplit}/minData.H | 0 .../regionSplit}/minDataI.H | 0 9 files changed, 131 insertions(+), 10 deletions(-) rename src/{parallel/decompose/decompositionMethods/decompositionMethod => meshTools/regionSplit}/minData.H (100%) rename src/{parallel/decompose/decompositionMethods/decompositionMethod => meshTools/regionSplit}/minDataI.H (100%) diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H index c322c7856f..cbaf373a44 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -226,7 +226,7 @@ label findLower ( const ListType&, typename ListType::const_reference, - const label stary, + const label start, const BinaryOp& bop ); @@ -263,6 +263,15 @@ public: }; +//- Helper class for list to append unique elelements of y onto the end of x +template +class ListUniqueEqOp +{ +public: + void operator()(List& x, const List& y) const; +}; + + //- Reverse a list. First element becomes last element etc. template ListType reverseList(const ListType& list); diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C index 29ea650551..7aabfd7964 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -742,6 +742,29 @@ void Foam::ListAppendEqOp::operator()(List& x, const List& y) const } +template +void Foam::ListUniqueEqOp::operator()(List& x, const List& y) const +{ + if (y.size()) + { + if (x.size()) + { + forAll(y, i) + { + if (findIndex(x, y[i]) == -1) + { + x.append(y[i]); + } + } + } + else + { + x = y; + } + } +} + + template ListType Foam::reverseList(const ListType& list) { diff --git a/src/OpenFOAM/containers/Lists/UList/UListI.H b/src/OpenFOAM/containers/Lists/UList/UListI.H index 815c9aafcd..ba72bc8871 100644 --- a/src/OpenFOAM/containers/Lists/UList/UListI.H +++ b/src/OpenFOAM/containers/Lists/UList/UListI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -101,7 +101,7 @@ inline void Foam::UList::checkIndex(const label i) const if (!size_) { FatalErrorIn("UList::checkIndex(const label)") - << "attempt to access element from zero sized list" + << "attempt to access element " << i << " from zero sized list" << abort(FatalError); } else if (i<0 || i>=size_) diff --git a/src/OpenFOAM/containers/Lists/UPtrList/UPtrList.C b/src/OpenFOAM/containers/Lists/UPtrList/UPtrList.C index cc54117f8b..0d1a2fe63f 100644 --- a/src/OpenFOAM/containers/Lists/UPtrList/UPtrList.C +++ b/src/OpenFOAM/containers/Lists/UPtrList/UPtrList.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -43,6 +43,30 @@ Foam::UPtrList::UPtrList(const label s) {} +template +Foam::UPtrList::UPtrList(UList& lst) +: + ptrs_(lst.size()) +{ + forAll(lst, i) + { + ptrs_[i] = &lst[i]; + } +} + + +template +Foam::UPtrList::UPtrList(PtrList& lst) +: + ptrs_(lst.size()) +{ + forAll(lst, i) + { + ptrs_[i] = &lst[i]; + } +} + + template Foam::UPtrList::UPtrList(const Xfer >& lst) { diff --git a/src/OpenFOAM/containers/Lists/UPtrList/UPtrList.H b/src/OpenFOAM/containers/Lists/UPtrList/UPtrList.H index cdf32f630a..4df5a82627 100644 --- a/src/OpenFOAM/containers/Lists/UPtrList/UPtrList.H +++ b/src/OpenFOAM/containers/Lists/UPtrList/UPtrList.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,6 +42,7 @@ SourceFiles #define UPtrList_H #include "List.H" +#include "PtrList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -109,6 +110,12 @@ public: //- Construct with size specified. explicit UPtrList(const label); + //- Construct from UList + explicit UPtrList(UList&); + + //- Construct from PtrList + explicit UPtrList(PtrList&); + //- Construct by transferring the parameter contents UPtrList(const Xfer >&); diff --git a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.C b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.C index a7ada172d4..e723e6ad5e 100644 --- a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.C +++ b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -58,6 +58,23 @@ void Foam::CompactIOList::readFromStream() } +template +bool Foam::CompactIOList::overflows() const +{ + label size = 0; + forAll(*this, i) + { + label oldSize = size; + size += this->operator[](i).size(); + if (size < oldSize) + { + return true; + } + } + return false; +} + + // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // template @@ -178,6 +195,29 @@ bool Foam::CompactIOList::writeObject return good; } + else if (overflows()) + { + WarningIn + ( + "CompactIOList::writeObject" + "(IOstream::streamFormat, IOstream::versionNumber" + ", IOstream::compressionType) const" + ) << "Overall number of elements of CompactIOList of size " + << this->size() << " overflows the representation of a label" + << endl << " Switching to ascii writing" << endl; + + // Change type to be non-compact format type + const word oldTypeName = typeName; + + const_cast(typeName) = IOList::typeName; + + bool good = regIOobject::writeObject(IOstream::ASCII, ver, cmp); + + // Change type back + const_cast(typeName) = oldTypeName; + + return good; + } else { return regIOobject::writeObject(fmt, ver, cmp); @@ -264,7 +304,22 @@ Foam::Ostream& Foam::operator<< start[0] = 0; for (label i = 1; i < start.size(); i++) { - start[i] = start[i-1]+L[i-1].size(); + label prev = start[i-1]; + start[i] = prev+L[i-1].size(); + + if (start[i] < prev) + { + FatalIOErrorIn + ( + "operator<<" + "(Ostream& os, const CompactIOList&)", + os + ) << "Overall number of elements " << start[i] + << " of CompactIOList of size " + << L.size() << " overflows the representation of a label" + << endl << "Please recompile with a larger representation" + << " for label" << exit(FatalIOError); + } } List elems(start[start.size()-1]); diff --git a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H index dc06092c59..fafcdef52f 100644 --- a/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H +++ b/src/OpenFOAM/db/IOobjects/CompactIOList/CompactIOList.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -79,6 +79,9 @@ class CompactIOList //- Read according to header type void readFromStream(); + //- Has too many elements in it? + bool overflows() const; + public: //- Runtime type information diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/minData.H b/src/meshTools/regionSplit/minData.H similarity index 100% rename from src/parallel/decompose/decompositionMethods/decompositionMethod/minData.H rename to src/meshTools/regionSplit/minData.H diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/minDataI.H b/src/meshTools/regionSplit/minDataI.H similarity index 100% rename from src/parallel/decompose/decompositionMethods/decompositionMethod/minDataI.H rename to src/meshTools/regionSplit/minDataI.H From afcd545a08a200054e016854b0a220e8b634c003 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2015 12:48:51 +0000 Subject: [PATCH 02/11] BUG: ISstream: only check character if reading succeeded --- src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H b/src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H index 6135f51f46..2488bb04e3 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstreamI.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,7 +59,7 @@ inline Foam::ISstream& Foam::ISstream::get(char& c) is_.get(c); setState(is_.rdstate()); - if (c == '\n') + if (good() && c == '\n') { lineNumber_++; } From beef95c497c46c738deecc1288cf3bb1959154d2 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2015 12:49:51 +0000 Subject: [PATCH 03/11] BUG: dictionary: topDict function --- src/OpenFOAM/db/dictionary/dictionary.C | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index d8d791a21d..3ca3d5e21a 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -221,9 +221,7 @@ Foam::autoPtr Foam::dictionary::clone() const // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::dictionary::~dictionary() -{ - // cerr<< "~dictionary() " << name() << " " << long(this) << std::endl; -} +{} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -238,7 +236,7 @@ const Foam::dictionary& Foam::dictionary::topDict() const } else { - return p; + return *this; } } From 7d11807f0378a45c0b38705884da999831b65ebd Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2015 12:51:13 +0000 Subject: [PATCH 04/11] ENH: objectRegistry: print type when debugging --- src/OpenFOAM/db/objectRegistry/objectRegistry.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C index 4903ca4e28..f2420e13d1 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -222,6 +222,7 @@ bool Foam::objectRegistry::checkIn(regIOobject& io) const { Pout<< "objectRegistry::checkIn(regIOobject&) : " << name() << " : checking in " << io.name() + << " of type " << io.type() << endl; } @@ -354,6 +355,7 @@ bool Foam::objectRegistry::writeObject Pout<< "objectRegistry::write() : " << name() << " : Considering writing object " << iter.key() + << " of type " << iter()->type() << " with writeOpt " << iter()->writeOpt() << " to file " << iter()->objectPath() << endl; From 1603d5e65d01d4d656c717344aa720c0c79a9088 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2015 12:52:51 +0000 Subject: [PATCH 05/11] ENH: uniformFixedValue: typo in comment --- .../uniformFixedValue/uniformFixedValuePointPatchField.H | 4 ++-- .../nonuniformTransformCyclicPolyPatch.H | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.H index 120f1ffe16..a9f93d1d38 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/derived/uniformFixedValue/uniformFixedValuePointPatchField.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -149,7 +149,7 @@ public: // Access - //- Return the fluctuation scale + //- Return the uniform value const DataEntry& uniformValue() const { return uniformValue_; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H index 75431fdaa8..e04604c4ed 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class nonuniformTransformCyclicPolyPatch Declaration + Class nonuniformTransformCyclicPolyPatch Declaration \*---------------------------------------------------------------------------*/ class nonuniformTransformCyclicPolyPatch From a69538de4897ffdbd0cc438328903fa7fe664375 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2015 12:54:08 +0000 Subject: [PATCH 06/11] BUG: procesorPolyPatch: fixed check on oppositeness, correct tolerance --- src/OpenFOAM/meshes/meshTools/matchPoints.C | 7 ++++--- .../constraint/processor/processorPolyPatch.C | 14 +++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/OpenFOAM/meshes/meshTools/matchPoints.C b/src/OpenFOAM/meshes/meshTools/matchPoints.C index d309e8e501..0afa4e3ae6 100644 --- a/src/OpenFOAM/meshes/meshTools/matchPoints.C +++ b/src/OpenFOAM/meshes/meshTools/matchPoints.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -187,9 +187,11 @@ bool Foam::matchPoints // Go through range of equal mag and find nearest vector. scalar minDistSqr = VGREAT; - scalar minDistNorm = 0; label minFaceI = -1; + // Valid candidate points should have opposite normal + const scalar minDistNorm = 0; + for ( label j = startI; @@ -220,7 +222,6 @@ bool Foam::matchPoints // Check that the normals point in equal and opposite directions if (distNorm < minDistNorm) { - minDistNorm = distNorm; minDistSqr = distSqr; minFaceI = faceI; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index 5b2a4332fd..0ca20652c9 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -913,7 +913,7 @@ bool Foam::processorPolyPatch::order faceMap ); - // Try using face point average for matching + // Fallback: try using face point average for matching if (!matchedAll) { const pointField& ppPoints = pp.points(); @@ -933,16 +933,20 @@ bool Foam::processorPolyPatch::order scalarField tols2 ( - calcFaceTol(pp, pp.points(), facePointAverages) + matchTolerance() + *calcFaceTol(pp, pp.points(), facePointAverages) ); + // Note that we do not use the faceNormals anymore for + // comparison. Since we're + // having problems with the face centres (e.g. due to extreme + // aspect ratios) we will probably also have problems with + // reliable normals calculation labelList faceMap2(faceMap.size(), -1); matchedAll = matchPoints ( facePointAverages, masterFacePointAverages, - pp.faceNormals(), - masterNormals, tols2, true, faceMap2 From dc2b92c99415ee6036e2b2022fed66fea50d535d Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2015 13:25:37 +0000 Subject: [PATCH 07/11] STYLE: processorPolyPatch: typo in comment --- .../constraint/processor/processorPolyPatch.H | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H index 63c2a7dd8a..188bc45e62 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -62,13 +62,13 @@ class processorPolyPatch int myProcNo_; int neighbProcNo_; - //- Processor-neighbbour patch face centres + //- Processor-neighbour patch face centres vectorField neighbFaceCentres_; - //- Processor-neighbbour patch face areas + //- Processor-neighbour patch face areas vectorField neighbFaceAreas_; - //- Processor-neighbbour patch neighbour cell centres + //- Processor-neighbour patch neighbour cell centres vectorField neighbFaceCellCentres_; //- Corresponding neighbouring local point label for every local point @@ -270,19 +270,19 @@ public: return !owner(); } - //- Return processor-neighbbour patch face centres + //- Return processor-neighbour patch face centres const vectorField& neighbFaceCentres() const { return neighbFaceCentres_; } - //- Return processor-neighbbour patch face areas + //- Return processor-neighbour patch face areas const vectorField& neighbFaceAreas() const { return neighbFaceAreas_; } - //- Return processor-neighbbour patch neighbour cell centres + //- Return processor-neighbour patch neighbour cell centres const vectorField& neighbFaceCellCentres() const { return neighbFaceCellCentres_; From cae9f4e7299972022b534a0586d9d218e5f1353f Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2015 13:26:09 +0000 Subject: [PATCH 08/11] STYLE: cyclicPolyPatch: unused include files --- .../polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 05720e178f..c4fcaf52c0 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,11 +29,9 @@ License #include "polyMesh.H" #include "demandDrivenData.H" #include "OFstream.H" -#include "patchZones.H" #include "matchPoints.H" #include "EdgeMap.H" #include "Time.H" -#include "diagTensor.H" #include "transformField.H" #include "SubField.H" #include "unitConversion.H" From 5e19fee4c6160c11def0e263a23869565a5eaee2 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2015 13:28:41 +0000 Subject: [PATCH 09/11] BUG: polyMesh: update patchGroups when polyMesh::readUpdate --- src/OpenFOAM/meshes/polyMesh/polyMeshIO.C | 5 ++- src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C | 44 +++++++++++++++---- .../polyPatches/polyPatch/polyPatch.C | 26 ++++++++++- .../polyPatches/polyPatch/polyPatch.H | 14 +++++- 4 files changed, 77 insertions(+), 12 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C index 6015f1167d..7b36d92c58 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -227,7 +227,8 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate() newBoundary[patchI].start(), patchI, boundary_, - newBoundary[patchI].type() + newBoundary[patchI].physicalType(), + newBoundary[patchI].inGroups() ); } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C index 4a8b5dd7d7..f26f77cad3 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -78,15 +78,43 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm) newMotionPoints.setSize(points_.size()); // Map the list - newMotionPoints.map(oldMotionPoints, mpm.pointMap()); - - // Any points created out-of-nothing get set to the current coordinate - // for lack of anything better. - forAll(mpm.pointMap(), newPointI) + if (mpm.hasMotionPoints()) { - if (mpm.pointMap()[newPointI] == -1) + newMotionPoints.map(oldMotionPoints, mpm.pointMap()); + + // Any points created out-of-nothing get set to the current + // coordinate for lack of anything better. + forAll(mpm.pointMap(), newPointI) { - newMotionPoints[newPointI] = points_[newPointI]; + if (mpm.pointMap()[newPointI] == -1) + { + newMotionPoints[newPointI] = points_[newPointI]; + } + } + } + else + { + const labelList& pointMap = mpm.pointMap(); + const labelList& revPointMap = mpm.reversePointMap(); + + forAll(pointMap, newPointI) + { + label oldPointI = pointMap[newPointI]; + if (oldPointI >= 0) + { + if (revPointMap[oldPointI] == newPointI) // master point + { + newMotionPoints[newPointI] = oldMotionPoints[oldPointI]; + } + else + { + newMotionPoints[newPointI] = points_[newPointI]; + } + } + else + { + newMotionPoints[newPointI] = points_[newPointI]; + } } } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C index d7508c3d94..dd1583577f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -107,6 +107,30 @@ Foam::polyPatch::polyPatch } +Foam::polyPatch::polyPatch +( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& physicalType, + const wordList& inGroups +) +: + patchIdentifier(name, index, physicalType, inGroups), + primitivePatch + ( + faceSubList(bm.mesh().faces(), size, start), + bm.mesh().points() + ), + start_(start), + boundaryMesh_(bm), + faceCellsPtr_(NULL), + mePtr_(NULL) +{} + + Foam::polyPatch::polyPatch ( const word& name, diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index b13faf0968..2e12697a18 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -179,6 +179,18 @@ public: const word& patchType ); + //- Construct from components + polyPatch + ( + const word& name, + const label size, + const label start, + const label index, + const polyBoundaryMesh& bm, + const word& physicalType, + const wordList& inGroups + ); + //- Construct from dictionary polyPatch ( From 1c066c14287c03a2434707e239a489e6b89db1d6 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 17 Nov 2015 14:56:13 +0000 Subject: [PATCH 10/11] ENH: foamLog: added support for multi-region --- bin/tools/foamLog.db | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/tools/foamLog.db b/bin/tools/foamLog.db index d2719eb203..08077630c8 100644 --- a/bin/tools/foamLog.db +++ b/bin/tools/foamLog.db @@ -15,12 +15,18 @@ # #------------------------------------------------------------------------------ +#- Lines to ignore +Ignore/Solving for .* region / + #- String to recognize new iteration by (usually same as 'Time') Separator/^[ \t]*Time = /Time = #- Time value: Time/^[ \t]*Time = /Time = +#- DeltaT value: +deltaT/^[ \t]*deltaT = /deltaT = + #- Continuity errors: contLocal/time step continuity errors :/sum local = contGlobal/time step continuity errors :/ global = @@ -33,6 +39,10 @@ minFt/min\(ft\) = /min(ft) = #- Execution time: executionTime/ExecutionTime = /ExecutionTime = +#- Interface Courant no: +IntCourantMax/Interface Courant Number /max: +IntCourantMean/Interface Courant Number /mean: + #- Courant no: CourantMax/Courant Number /max: CourantMean/Courant Number /mean: @@ -48,8 +58,8 @@ epsMax/bounding epsilon,/max: epsAvg/bounding epsilon,/average: #- gamma bounding -alpha1Min/Min\(alpha1\) =/Min(alpha1) = -alpha1Max/Max\(alpha1\) =/Max(alpha1) = +alpha1Min/Min\(alpha1\) =/Min(alpha1) = +alpha1Max/Max\(alpha1\) =/Max(alpha1) = # AMI AMIMin/AMI: Patch source sum/average = From 436902f5a8ea7da137c2f4b4a975e60a1b54154a Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 17 Nov 2015 15:05:05 +0000 Subject: [PATCH 11/11] ENH: parallel: overhaul of parallel mapping - redistributePar to have almost (complete) functionality of decomposePar+reconstructPar - low-level distributed Field mapping - support for mapping surfaceFields (including flipping faces) - support for decomposing/reconstructing refinement data --- .../splitMeshRegions/splitMeshRegions.C | 9 +- .../decomposePar/Make/options | 2 + .../decomposePar/decomposePar.C | 90 +- .../decomposePar/decomposeParDict | 55 +- .../decomposePar/domainDecomposition.C | 169 +- .../decomposePar/domainDecomposition.H | 15 +- .../domainDecompositionDistribute.C | 15 +- .../decomposePar/readFields.C | 65 +- .../decomposePar/readFields.H | 12 +- .../reconstructPar/Make/options | 2 + .../reconstructPar/reconstructPar.C | 78 +- .../reconstructParMesh/reconstructParMesh.C | 4 +- .../redistributePar/Make/files | 2 + .../redistributePar/Make/options | 6 +- .../distributedUnallocatedDirectFieldMapper.H | 131 + ...butedUnallocatedDirectFvPatchFieldMapper.H | 71 +- .../redistributePar/loadOrCreateMesh.C | 113 +- .../redistributePar/parFvFieldReconstructor.C | 113 + .../redistributePar/parFvFieldReconstructor.H | 194 ++ ...parFvFieldReconstructorReconstructFields.C | 543 ++++ .../parLagrangianRedistributor.C | 321 ++ .../parLagrangianRedistributor.H | 186 ++ ...agrangianRedistributorRedistributeFields.C | 320 ++ .../redistributePar/redistributePar.C | 2871 ++++++++++++++--- .../unmappedPassiveParticleCloud.H | 112 + .../dataConversion/foamToEnsight/Make/options | 2 + .../foamToTecplot360/Make/options | 2 + .../dataConversion/foamToVTK/Make/options | 2 + .../PV4FoamReader/vtkPV4Foam/Make/options | 2 + .../preProcessing/mapFieldsPar/mapFieldsPar.C | 70 +- bin/tools/CleanFunctions | 49 +- bin/tools/RunFunctions | 34 +- src/OpenFOAM/Make/files | 6 + src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C | 49 +- src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H | 9 +- .../IOstreams/Pstreams/combineGatherScatter.C | 14 +- src/OpenFOAM/db/IOstreams/Pstreams/exchange.C | 7 +- .../db/IOstreams/Pstreams/gatherScatter.C | 6 +- .../db/IOstreams/Pstreams/gatherScatterList.C | 6 +- src/OpenFOAM/db/Time/TimePaths.H | 12 +- src/OpenFOAM/db/dictionary/dictionary.H | 4 +- src/OpenFOAM/db/regIOobject/regIOobjectRead.C | 10 +- .../DimensionedField/DimensionedField.C | 4 +- .../DimensionedField/DimensionedField.H | 11 +- .../DimensionedField/DimensionedFieldIO.C | 22 +- src/OpenFOAM/fields/Fields/Field/Field.C | 156 +- src/OpenFOAM/fields/Fields/Field/Field.H | 29 +- .../fields/Fields/Field/FieldMapper.H | 19 +- .../GeometricField/GeometricField.C | 16 +- .../GeometricField/GeometricField.H | 5 +- src/OpenFOAM/fields/ReadFields/ReadFields.C | 188 +- src/OpenFOAM/fields/ReadFields/ReadFields.H | 36 +- .../fields/ReadFields/ReadFieldsTemplates.C | 314 ++ .../UniformDimensionedField.C | 4 +- src/OpenFOAM/global/argList/argList.C | 50 +- .../mapDistribute/IOmapDistribute.C | 4 +- .../mapPolyMesh/mapDistribute/mapDistribute.C | 945 +----- .../mapPolyMesh/mapDistribute/mapDistribute.H | 268 +- .../mapDistribute/mapDistributeBase.C | 1293 ++++++++ .../mapDistribute/mapDistributeBase.H | 485 +++ .../mapDistributeBaseTemplates.C | 1375 ++++++++ .../mapDistribute/mapDistributePolyMesh.C | 196 +- .../mapDistribute/mapDistributePolyMesh.H | 85 +- .../mapDistribute/mapDistributeTemplates.C | 940 +----- .../primitiveShapes/triangle/triPoints.H | 100 + src/OpenFOAM/primitives/ops/flipOp.C | 76 + src/OpenFOAM/primitives/ops/flipOp.H | 103 + src/dynamicMesh/Make/files | 12 +- .../IOmapDistributePolyMesh.C | 126 + .../IOmapDistributePolyMesh.H | 95 + .../fvMeshDistribute/fvMeshDistribute.C | 527 ++- .../fvMeshDistribute/fvMeshDistribute.H | 31 +- .../fvMeshDistributeTemplates.C | 93 +- .../fvMeshSubset/fvMeshSubset.C | 149 +- .../fvMeshSubset/fvMeshSubset.H | 80 +- .../fvMeshSubset/fvMeshSubsetInterpolate.C | 71 +- src/dynamicMesh/fvMeshTools/fvMeshTools.C | 267 +- src/dynamicMesh/fvMeshTools/fvMeshTools.H | 18 +- .../meshCut/cellLooper/geomCellLooper.H | 6 +- .../multiDirRefinement/multiDirRefinement.C | 10 +- .../polyTopoChange/{ => hexRef8}/hexRef8.C | 3 +- .../polyTopoChange/{ => hexRef8}/hexRef8.H | 0 .../polyTopoChange/hexRef8/hexRef8Data.C | 339 ++ .../polyTopoChange/hexRef8/hexRef8Data.H | 136 + .../{ => hexRef8}/refinementHistory.C | 827 ++++- .../{ => hexRef8}/refinementHistory.H | 160 +- src/finiteVolume/Make/files | 1 - .../fixedFluxPressureFvPatchScalarField.C | 31 +- .../timeVaryingMappedFixedValueFvPatchField.C | 10 +- .../fvPatchFields/fvPatchField/fvPatchField.C | 54 +- .../volPointInterpolate.C | 191 +- .../volPointInterpolation.H | 38 +- .../basic/passiveParticle/passiveParticle.H | 28 +- src/meshTools/AABBTree/AABBTree.C | 531 +++ src/meshTools/AABBTree/AABBTree.H | 197 ++ .../AMIInterpolation/AMIInterpolation.C | 18 +- .../AMIInterpolationParallelOps.C | 36 +- .../AMIMethod/AMIMethod/AMIMethod.C | 4 +- .../AMIMethod/directAMI/directAMI.C | 8 +- .../faceAreaIntersect/faceAreaIntersect.H | 7 +- .../faceAreaIntersect/faceAreaIntersectI.H | 4 +- .../mappedPolyPatch/mappedPatchBase.C | 36 +- .../mappedPatchBaseTemplates.C | 14 +- .../momentOfInertia/momentOfInertia.C | 57 +- .../momentOfInertia/momentOfInertia.H | 18 +- src/meshTools/regionSplit/minData.H | 2 +- src/meshTools/regionSplit/minDataI.H | 2 +- .../tetOverlapVolume/tetOverlapVolume.C | 342 +- .../tetOverlapVolume/tetOverlapVolume.H | 145 +- .../tetOverlapVolumeTemplates.C | 220 ++ src/parallel/decompose/Allwmake | 15 +- src/parallel/decompose/decompose/Make/files | 1 + src/parallel/decompose/decompose/Make/options | 1 + .../decompose/decompose/decompositionModel.C | 164 + .../decompose/decompose/decompositionModel.H | 145 + .../decompose/decompositionMethods/Make/files | 11 + .../decompositionMethods/Make/options | 2 + .../decompositionConstraint.C | 93 + .../decompositionConstraint.H | 155 + .../preserveBafflesConstraint.C | 245 ++ .../preserveBafflesConstraint.H | 116 + .../preserveFaceZonesConstraint.C | 215 ++ .../preserveFaceZonesConstraint.H | 122 + .../preservePatchesConstraint.C | 199 ++ .../preservePatchesConstraint.H | 123 + .../refinementHistoryConstraint.C | 211 ++ .../refinementHistoryConstraint.H | 114 + .../singleProcessorFaceSetsConstraint.C | 318 ++ .../singleProcessorFaceSetsConstraint.H | 124 + .../decompositionMethod/decompositionMethod.C | 543 +++- .../decompositionMethod/decompositionMethod.H | 43 +- .../decompose/ptscotchDecomp/ptscotchDecomp.C | 156 +- .../decompose/scotchDecomp/scotchDecomp.C | 90 +- src/parallel/distributed/Make/options | 1 + .../distributedTriSurfaceMesh.C | 78 +- .../distributedTriSurfaceMesh.H | 4 +- .../reconstruct/reconstruct/processorMeshes.H | 9 +- .../field/streamLine/streamLine.C | 28 +- .../wallBoundedStreamLine.C | 28 +- src/renumber/renumberMethods/Make/options | 2 + src/sampling/Make/files | 1 + src/sampling/Make/options | 2 + .../cellVolumeWeight/cellVolumeWeightMethod.C | 46 +- .../cellVolumeWeight/cellVolumeWeightMethod.H | 12 +- .../correctedCellVolumeWeightMethod.C | 296 ++ .../correctedCellVolumeWeightMethod.H | 119 + .../calcMethod/direct/directMethod.C | 37 +- .../calcMethod/direct/directMethod.H | 12 +- .../calcMethod/mapNearest/mapNearestMethod.C | 8 +- .../calcMethod/mapNearest/mapNearestMethod.H | 12 +- .../meshToMeshMethod/meshToMeshMethod.C | 40 +- .../meshToMeshMethod/meshToMeshMethod.H | 23 +- .../distributedWeightedFvPatchFieldMapper.H | 170 + src/sampling/meshToMesh/meshToMesh.C | 315 +- src/sampling/meshToMesh/meshToMesh.H | 340 +- src/sampling/meshToMesh/meshToMeshI.H | 28 +- .../meshToMesh/meshToMeshParallelOps.C | 43 +- src/sampling/meshToMesh/meshToMeshTemplates.C | 501 ++- tutorials/mesh/parallel/cavity/0/U | 41 + tutorials/mesh/parallel/cavity/0/p | 39 + tutorials/mesh/parallel/cavity/Allclean | 12 + tutorials/mesh/parallel/cavity/Allrun | 35 + .../cavity/constant/polyMesh/blockMeshDict | 75 + .../cavity/constant/transportProperties | 21 + .../mesh/parallel/cavity/system/controlDict | 49 + .../cavity/system/controlDict-latestTime | 49 + .../cavity/system/controlDict-startTime | 49 + .../parallel/cavity/system/decomposeParDict | 143 + .../parallel/cavity/system/decomposeParDict-2 | 143 + .../parallel/cavity/system/decomposeParDict-5 | 143 + .../mesh/parallel/cavity/system/fvSchemes | 57 + .../mesh/parallel/cavity/system/fvSolution | 46 + .../cavity/system/renumberMeshDict-random | 112 + tutorials/mesh/parallel/filter/0.org/G | 73 + tutorials/mesh/parallel/filter/0.org/H2O | 60 + tutorials/mesh/parallel/filter/0.org/N2 | 60 + tutorials/mesh/parallel/filter/0.org/O2 | 60 + tutorials/mesh/parallel/filter/0.org/T | 61 + tutorials/mesh/parallel/filter/0.org/U | 61 + tutorials/mesh/parallel/filter/0.org/alphat | 62 + tutorials/mesh/parallel/filter/0.org/epsilon | 61 + tutorials/mesh/parallel/filter/0.org/k | 61 + tutorials/mesh/parallel/filter/0.org/nut | 45 + tutorials/mesh/parallel/filter/0.org/p | 60 + tutorials/mesh/parallel/filter/Allclean | 15 + tutorials/mesh/parallel/filter/Allrun | 33 + .../filter/constant/chemistryProperties | 41 + .../filter/constant/combustionProperties | 29 + tutorials/mesh/parallel/filter/constant/g | 22 + .../filter/constant/parcelInjectionProperties | 26 + .../filter/constant/particleTrackProperties | 25 + .../filter/constant/polyMesh/blockMeshDict | 123 + .../filter/constant/radiationProperties | 24 + .../filter/constant/reactingCloud1Properties | 188 ++ .../mesh/parallel/filter/constant/reactions | 9 + .../filter/constant/thermo.incompressiblePoly | 115 + .../filter/constant/thermophysicalProperties | 53 + .../filter/constant/turbulenceProperties | 28 + .../mesh/parallel/filter/system/controlDict | 54 + .../parallel/filter/system/createBafflesDict | 81 + .../parallel/filter/system/decomposeParDict | 47 + .../mesh/parallel/filter/system/fvOptions | 124 + .../mesh/parallel/filter/system/fvSchemes | 65 + .../mesh/parallel/filter/system/fvSolution | 112 + .../mesh/parallel/filter/system/topoSetDict | 157 + 205 files changed, 21665 insertions(+), 4196 deletions(-) create mode 100644 applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFieldMapper.H rename src/sampling/meshToMesh/weightedFvPatchFieldMapper.H => applications/utilities/parallelProcessing/redistributePar/distributedUnallocatedDirectFvPatchFieldMapper.H (60%) create mode 100644 applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructor.C create mode 100644 applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructor.H create mode 100644 applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C create mode 100644 applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.C create mode 100644 applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributor.H create mode 100644 applications/utilities/parallelProcessing/redistributePar/parLagrangianRedistributorRedistributeFields.C create mode 100644 applications/utilities/parallelProcessing/redistributePar/unmappedPassiveParticleCloud.H create mode 100644 src/OpenFOAM/fields/ReadFields/ReadFieldsTemplates.C create mode 100644 src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.C create mode 100644 src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBase.H create mode 100644 src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeBaseTemplates.C create mode 100644 src/OpenFOAM/meshes/primitiveShapes/triangle/triPoints.H create mode 100644 src/OpenFOAM/primitives/ops/flipOp.C create mode 100644 src/OpenFOAM/primitives/ops/flipOp.H create mode 100644 src/dynamicMesh/fvMeshDistribute/IOmapDistributePolyMesh.C create mode 100644 src/dynamicMesh/fvMeshDistribute/IOmapDistributePolyMesh.H rename src/{finiteVolume/fvMesh => dynamicMesh}/fvMeshSubset/fvMeshSubset.C (91%) rename src/{finiteVolume/fvMesh => dynamicMesh}/fvMeshSubset/fvMeshSubset.H (74%) rename src/{finiteVolume/fvMesh => dynamicMesh}/fvMeshSubset/fvMeshSubsetInterpolate.C (89%) rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/hexRef8.C (99%) rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/hexRef8.H (100%) create mode 100644 src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.C create mode 100644 src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8Data.H rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/refinementHistory.C (65%) rename src/dynamicMesh/polyTopoChange/polyTopoChange/{ => hexRef8}/refinementHistory.H (70%) create mode 100644 src/meshTools/AABBTree/AABBTree.C create mode 100644 src/meshTools/AABBTree/AABBTree.H create mode 100644 src/meshTools/tetOverlapVolume/tetOverlapVolumeTemplates.C create mode 100644 src/parallel/decompose/decompose/decompositionModel.C create mode 100644 src/parallel/decompose/decompose/decompositionModel.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/decompositionConstraint/decompositionConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveBaffles/preserveBafflesConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveBaffles/preserveBafflesConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveFaceZones/preserveFaceZonesConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preserveFaceZones/preserveFaceZonesConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preservePatches/preservePatchesConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/preservePatches/preservePatchesConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/refinementHistory/refinementHistoryConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/refinementHistory/refinementHistoryConstraint.H create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/singleProcessorFaceSets/singleProcessorFaceSetsConstraint.C create mode 100644 src/parallel/decompose/decompositionMethods/decompositionConstraints/singleProcessorFaceSets/singleProcessorFaceSetsConstraint.H create mode 100644 src/sampling/meshToMesh/calcMethod/correctedCellVolumeWeight/correctedCellVolumeWeightMethod.C create mode 100644 src/sampling/meshToMesh/calcMethod/correctedCellVolumeWeight/correctedCellVolumeWeightMethod.H create mode 100644 src/sampling/meshToMesh/distributedWeightedFvPatchFieldMapper.H create mode 100644 tutorials/mesh/parallel/cavity/0/U create mode 100644 tutorials/mesh/parallel/cavity/0/p create mode 100755 tutorials/mesh/parallel/cavity/Allclean create mode 100755 tutorials/mesh/parallel/cavity/Allrun create mode 100644 tutorials/mesh/parallel/cavity/constant/polyMesh/blockMeshDict create mode 100644 tutorials/mesh/parallel/cavity/constant/transportProperties create mode 100644 tutorials/mesh/parallel/cavity/system/controlDict create mode 100644 tutorials/mesh/parallel/cavity/system/controlDict-latestTime create mode 100644 tutorials/mesh/parallel/cavity/system/controlDict-startTime create mode 100644 tutorials/mesh/parallel/cavity/system/decomposeParDict create mode 100644 tutorials/mesh/parallel/cavity/system/decomposeParDict-2 create mode 100644 tutorials/mesh/parallel/cavity/system/decomposeParDict-5 create mode 100644 tutorials/mesh/parallel/cavity/system/fvSchemes create mode 100644 tutorials/mesh/parallel/cavity/system/fvSolution create mode 100644 tutorials/mesh/parallel/cavity/system/renumberMeshDict-random create mode 100644 tutorials/mesh/parallel/filter/0.org/G create mode 100644 tutorials/mesh/parallel/filter/0.org/H2O create mode 100644 tutorials/mesh/parallel/filter/0.org/N2 create mode 100644 tutorials/mesh/parallel/filter/0.org/O2 create mode 100644 tutorials/mesh/parallel/filter/0.org/T create mode 100644 tutorials/mesh/parallel/filter/0.org/U create mode 100644 tutorials/mesh/parallel/filter/0.org/alphat create mode 100644 tutorials/mesh/parallel/filter/0.org/epsilon create mode 100644 tutorials/mesh/parallel/filter/0.org/k create mode 100644 tutorials/mesh/parallel/filter/0.org/nut create mode 100644 tutorials/mesh/parallel/filter/0.org/p create mode 100755 tutorials/mesh/parallel/filter/Allclean create mode 100755 tutorials/mesh/parallel/filter/Allrun create mode 100644 tutorials/mesh/parallel/filter/constant/chemistryProperties create mode 100644 tutorials/mesh/parallel/filter/constant/combustionProperties create mode 100644 tutorials/mesh/parallel/filter/constant/g create mode 100644 tutorials/mesh/parallel/filter/constant/parcelInjectionProperties create mode 100644 tutorials/mesh/parallel/filter/constant/particleTrackProperties create mode 100644 tutorials/mesh/parallel/filter/constant/polyMesh/blockMeshDict create mode 100644 tutorials/mesh/parallel/filter/constant/radiationProperties create mode 100644 tutorials/mesh/parallel/filter/constant/reactingCloud1Properties create mode 100644 tutorials/mesh/parallel/filter/constant/reactions create mode 100644 tutorials/mesh/parallel/filter/constant/thermo.incompressiblePoly create mode 100644 tutorials/mesh/parallel/filter/constant/thermophysicalProperties create mode 100644 tutorials/mesh/parallel/filter/constant/turbulenceProperties create mode 100644 tutorials/mesh/parallel/filter/system/controlDict create mode 100644 tutorials/mesh/parallel/filter/system/createBafflesDict create mode 100644 tutorials/mesh/parallel/filter/system/decomposeParDict create mode 100644 tutorials/mesh/parallel/filter/system/fvOptions create mode 100644 tutorials/mesh/parallel/filter/system/fvSchemes create mode 100644 tutorials/mesh/parallel/filter/system/fvSolution create mode 100644 tutorials/mesh/parallel/filter/system/topoSetDict diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 6565776cdf..9120fd6dd9 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -202,6 +202,7 @@ void subsetSurfaceFields ( const fvMesh& mesh, const fvMesh& subMesh, + const labelList& cellMap, const labelList& faceMap, const labelHashSet& addedPatches ) @@ -225,6 +226,7 @@ void subsetSurfaceFields fld, subMesh, patchMap, + cellMap, faceMap ) ); @@ -830,6 +832,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -837,6 +840,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -844,6 +848,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -851,6 +856,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); @@ -858,6 +864,7 @@ void createAndWriteRegion ( mesh, newMesh(), + map().cellMap(), map().faceMap(), addedPatches ); diff --git a/applications/utilities/parallelProcessing/decomposePar/Make/options b/applications/utilities/parallelProcessing/decomposePar/Make/options index 5d5d67f989..cd78de0d1e 100644 --- a/applications/utilities/parallelProcessing/decomposePar/Make/options +++ b/applications/utilities/parallelProcessing/decomposePar/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude @@ -12,5 +13,6 @@ EXE_LIBS = \ -lgenericPatchFields \ -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \ -llagrangian \ + -ldynamicMesh \ -lmeshTools \ -lregionModels diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index 6020608541..63303d9f8c 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -96,6 +96,7 @@ Usage #include "fvFieldDecomposer.H" #include "pointFieldDecomposer.H" #include "lagrangianFieldDecomposer.H" +#include "decompositionModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -142,6 +143,12 @@ int main(int argc, char *argv[]) ); argList::noParallel(); + Foam::argList::addOption + ( + "decomposeParDict", + "file", + "read decomposePar dictionary from specified location" + ); #include "addRegionOption.H" argList::addBoolOption ( @@ -199,6 +206,17 @@ int main(int argc, char *argv[]) instantList times = timeSelector::selectIfPresent(runTime, args); + // Allow override of decomposeParDict location + fileName decompDictFile; + if (args.optionReadIfPresent("decomposeParDict", decompDictFile)) + { + if (isDir(decompDictFile)) + { + decompDictFile = decompDictFile/"decomposeParDict"; + } + } + + wordList regionNames; wordList regionDirs; if (allRegions) @@ -260,21 +278,27 @@ int main(int argc, char *argv[]) ++nProcs; } - // get requested numberOfSubdomains + // get requested numberOfSubdomains. Note: have no mesh yet so + // cannot use decompositionModel::New const label nDomains = readLabel ( IOdictionary ( - IOobject + decompositionModel::selectIO ( - "decomposeParDict", - runTime.time().system(), - regionDir, // use region if non-standard - runTime, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false + IOobject + ( + "decomposeParDict", + runTime.time().system(), + regionDir, // use region if non-standard + runTime, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ), + decompDictFile ) + ).lookup("numberOfSubdomains") ); @@ -288,8 +312,7 @@ int main(int argc, char *argv[]) << nProcs << " domains" << nl << "instead of " << nDomains - << " domains as specified in decomposeParDict" - << nl + << " domains as specified in decomposeParDict" << nl << exit(FatalError); } } @@ -351,7 +374,8 @@ int main(int argc, char *argv[]) IOobject::NO_READ, IOobject::NO_WRITE, false - ) + ), + decompDictFile ); // Decompose the mesh @@ -447,15 +471,15 @@ int main(int argc, char *argv[]) // Construct the vol fields // ~~~~~~~~~~~~~~~~~~~~~~~~ PtrList volScalarFields; - readFields(mesh, objects, volScalarFields); + readFields(mesh, objects, volScalarFields, false); PtrList volVectorFields; - readFields(mesh, objects, volVectorFields); + readFields(mesh, objects, volVectorFields, false); PtrList volSphericalTensorFields; - readFields(mesh, objects, volSphericalTensorFields); + readFields(mesh, objects, volSphericalTensorFields, false); PtrList volSymmTensorFields; - readFields(mesh, objects, volSymmTensorFields); + readFields(mesh, objects, volSymmTensorFields, false); PtrList volTensorFields; - readFields(mesh, objects, volTensorFields); + readFields(mesh, objects, volTensorFields, false); // Construct the dimensioned fields @@ -476,15 +500,15 @@ int main(int argc, char *argv[]) // Construct the surface fields // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PtrList surfaceScalarFields; - readFields(mesh, objects, surfaceScalarFields); + readFields(mesh, objects, surfaceScalarFields, false); PtrList surfaceVectorFields; - readFields(mesh, objects, surfaceVectorFields); + readFields(mesh, objects, surfaceVectorFields, false); PtrList surfaceSphericalTensorFields; - readFields(mesh, objects, surfaceSphericalTensorFields); + readFields(mesh, objects, surfaceSphericalTensorFields, false); PtrList surfaceSymmTensorFields; - readFields(mesh, objects, surfaceSymmTensorFields); + readFields(mesh, objects, surfaceSymmTensorFields, false); PtrList surfaceTensorFields; - readFields(mesh, objects, surfaceTensorFields); + readFields(mesh, objects, surfaceTensorFields, false); // Construct the point fields @@ -492,15 +516,15 @@ int main(int argc, char *argv[]) const pointMesh& pMesh = pointMesh::New(mesh); PtrList pointScalarFields; - readFields(pMesh, objects, pointScalarFields); + readFields(pMesh, objects, pointScalarFields, false); PtrList pointVectorFields; - readFields(pMesh, objects, pointVectorFields); + readFields(pMesh, objects, pointVectorFields, false); PtrList pointSphericalTensorFields; - readFields(pMesh, objects, pointSphericalTensorFields); + readFields(pMesh, objects, pointSphericalTensorFields, false); PtrList pointSymmTensorFields; - readFields(pMesh, objects, pointSymmTensorFields); + readFields(pMesh, objects, pointSymmTensorFields, false); PtrList pointTensorFields; - readFields(pMesh, objects, pointTensorFields); + readFields(pMesh, objects, pointTensorFields, false); // Construct the Lagrangian fields @@ -820,16 +844,6 @@ int main(int argc, char *argv[]) processorDb.setTime(runTime); - // remove files remnants that can cause horrible problems - // - mut and nut are used to mark the new turbulence models, - // their existence prevents old models from being upgraded - { - fileName timeDir(processorDb.path()/processorDb.timeName()); - - rm(timeDir/"mut"); - rm(timeDir/"nut"); - } - // read the mesh if (!procMeshList.set(procI)) { diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index 39483a01e3..0beef4f762 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -17,11 +17,61 @@ FoamFile numberOfSubdomains 2; + +// Optional decomposition constraints +//constraints +//{ +// preserveBaffles +// { +// //- Keep owner and neighbour of baffles on same processor (i.e. +// // keep it detectable as a baffle). Baffles are two boundary face +// // sharing the same points +// type preserveBaffles; +// } +// preserveFaceZones +// { +// //- Keep owner and neighbour on same processor for faces in zones +// type preserveFaceZones; +// zones (".*"); +// } +// preservePatches +// { +// //- Keep owner and neighbour on same processor for faces in patches +// // (only makes sense for cyclic patches. Not suitable for e.g. +// // cyclicAMI since these are not coupled on the patch level. Use +// // singleProcessorFaceSets for those) +// type preservePatches; +// patches (".*"); +// } +// singleProcessorFaceSets +// { +// //- Keep all of faceSet on a single processor. This puts all cells +// // connected with a point, edge or face on the same processor. +// // (just having face connected cells might not guarantee a balanced +// // decomposition) +// // The processor can be -1 (the decompositionMethod chooses the +// // processor for a good load balance) or explicitly provided (upsets +// // balance) +// type singleProcessorFaceSets; +// singleProcessorFaceSets ((f1 -1)); +// } +// refinementHistory +// { +// //- Decompose cells such that all cell originating from single cell +// // end up on same processor +// type refinementHistory; +// } +//} + + +// Deprecated form of specifying decomposition constraints: //- Keep owner and neighbour on same processor for faces in zones: // preserveFaceZones (heater solid1 solid3); //- Keep owner and neighbour on same processor for faces in patches: -// (makes sense only for cyclic patches) +// (makes sense only for cyclic patches. Not suitable for e.g. cyclicAMI +// since these are not coupled on the patch level. Use +// singleProcessorFaceSets for those) //preservePatches (cyclic_half0 cyclic_half1); //- Keep all of faceSet on a single processor. This puts all cells @@ -32,12 +82,13 @@ numberOfSubdomains 2; // for a good load balance) or explicitly provided (upsets balance). //singleProcessorFaceSets ((f0 -1)); - //- Keep owner and neighbour of baffles on same processor (i.e. keep it // detectable as a baffle). Baffles are two boundary face sharing the // same points. //preserveBaffles true; + + //- Use the volScalarField named here as a weight for each cell in the // decomposition. For example, use a particle population field to decompose // for a balanced number of particles in a lagrangian simulation. diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 7d86369398..b27f7628c8 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,14 +31,14 @@ License #include "fvMesh.H" #include "OSspecific.H" #include "Map.H" -#include "globalMeshData.H" #include "DynamicList.H" #include "fvFieldDecomposer.H" #include "IOobjectList.H" #include "cellSet.H" #include "faceSet.H" #include "pointSet.H" -#include "uniformDimensionedFields.H" +#include "decompositionModel.H" +#include "hexRef8Data.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -69,7 +69,12 @@ void Foam::domainDecomposition::mark // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::domainDecomposition::domainDecomposition(const IOobject& io) +// from components +Foam::domainDecomposition::domainDecomposition +( + const IOobject& io, + const fileName& decompDictFile +) : fvMesh(io), facesInstancePointsPtr_ @@ -90,18 +95,18 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) ) : NULL ), - decompositionDict_ + decompDictFile_(decompDictFile), + nProcs_ ( - IOobject + readInt ( - "decomposeParDict", - time().system(), - *this, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + decompositionModel::New + ( + *this, + decompDictFile + ).lookup("numberOfSubdomains") ) ), - nProcs_(readInt(decompositionDict_.lookup("numberOfSubdomains"))), distributed_(false), cellToProc_(nCells()), procPointAddressing_(nProcs_), @@ -115,7 +120,11 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io) procProcessorPatchSubPatchIDs_(nProcs_), procProcessorPatchSubPatchStarts_(nProcs_) { - decompositionDict_.readIfPresent("distributed", distributed_); + decompositionModel::New + ( + *this, + decompDictFile + ).readIfPresent("distributed", distributed_); } @@ -195,57 +204,20 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } - autoPtr cellLevelPtr; - { - IOobject io + // Load refinement data (if any) + hexRef8Data baseMeshData + ( + IOobject ( - "cellLevel", + "dummy", facesInstance(), polyMesh::meshSubDir, *this, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - if (io.headerOk()) - { - Info<< "Reading hexRef8 data : " << io.name() << endl; - cellLevelPtr.reset(new labelIOList(io)); - } - } - autoPtr pointLevelPtr; - { - IOobject io - ( - "pointLevel", - facesInstance(), - polyMesh::meshSubDir, - *this, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - if (io.headerOk()) - { - Info<< "Reading hexRef8 data : " << io.name() << endl; - pointLevelPtr.reset(new labelIOList(io)); - } - } - autoPtr level0EdgePtr; - { - IOobject io - ( - "level0Edge", - facesInstance(), - polyMesh::meshSubDir, - *this, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - if (io.headerOk()) - { - Info<< "Reading hexRef8 data : " << io.name() << endl; - level0EdgePtr.reset(new uniformDimensionedScalarField(io)); - } - } + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ) + ); @@ -816,8 +788,8 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } } - // Set the precision of the points data to 10 - IOstream::defaultPrecision(10); + // Set the precision of the points data to be min 10 + IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision())); procMesh.write(); @@ -887,64 +859,23 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets) } - // hexRef8 data - if (cellLevelPtr.valid()) - { - labelIOList + // Optional hexRef8 data + hexRef8Data + ( + IOobject ( - IOobject - ( - cellLevelPtr().name(), - facesInstance(), - polyMesh::meshSubDir, - procMesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - UIndirectList