From 9c9c43f23a1ac3dcaafe99bccb8525a36d05eb2e Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 15 Jan 2009 18:25:11 +0000 Subject: [PATCH 001/771] new boundary syntax --- .../cavity/constant/polyMesh/blockMeshDict | 66 ++++++++++++++----- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/tutorials/icoFoam/cavity/constant/polyMesh/blockMeshDict b/tutorials/icoFoam/cavity/constant/polyMesh/blockMeshDict index d89701b420..8cd967d0a9 100644 --- a/tutorials/icoFoam/cavity/constant/polyMesh/blockMeshDict +++ b/tutorials/icoFoam/cavity/constant/polyMesh/blockMeshDict @@ -37,25 +37,59 @@ edges ( ); -patches +//patches +//( +// wall movingWall +// ( +// (3 7 6 2) +// ) +// wall fixedWalls +// ( +// (0 4 7 3) +// (2 6 5 1) +// (1 5 4 0) +// ) +// empty frontAndBack +// ( +// (0 3 2 1) +// (4 5 6 7) +// ) +//); + +boundary ( - wall movingWall - ( - (3 7 6 2) - ) - wall fixedWalls - ( - (0 4 7 3) - (2 6 5 1) - (1 5 4 0) - ) - empty frontAndBack - ( - (0 3 2 1) - (4 5 6 7) - ) + movingWall + { + type wall; + faces + ( + (3 7 6 2) + ); + } + + fixedWalls + { + type wall; + faces + ( + (0 4 7 3) + (2 6 5 1) + (1 5 4 0) + ); + } + + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ); + } ); + mergePatchPairs ( ); From 73426723b00133a57755a167ef23a09e377ceaa7 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 15 Jan 2009 18:25:51 +0000 Subject: [PATCH 002/771] new boundary syntax --- .../constant/polyMesh/blockMeshDict | 154 ++++++++++++++---- 1 file changed, 125 insertions(+), 29 deletions(-) diff --git a/tutorials/channelOodles/channel395/constant/polyMesh/blockMeshDict b/tutorials/channelOodles/channel395/constant/polyMesh/blockMeshDict index 1f78c2420b..2adabb4f21 100644 --- a/tutorials/channelOodles/channel395/constant/polyMesh/blockMeshDict +++ b/tutorials/channelOodles/channel395/constant/polyMesh/blockMeshDict @@ -42,36 +42,132 @@ edges ( ); -patches +//patches +//( +// wall bottomWall +// ( +// (0 1 7 6) +// ) +// wall topWall +// ( +// (4 10 11 5) +// ) +// cyclic sides1 +// ( +// (0 2 3 1) +// (6 7 9 8) +// ) +// cyclic sides2 +// ( +// (2 4 5 3) +// (8 9 11 10) +// ) +// cyclic inout1 +// ( +// (1 3 9 7) +// (0 6 8 2) +// ) +// cyclic inout2 +// ( +// (3 5 11 9) +// (2 8 10 4) +// ) +//); + +boundary ( - wall bottomWall - ( - (0 1 7 6) - ) - wall topWall - ( - (4 10 11 5) - ) - cyclic sides1 - ( - (0 2 3 1) - (6 7 9 8) - ) - cyclic sides2 - ( - (2 4 5 3) - (8 9 11 10) - ) - cyclic inout1 - ( - (1 3 9 7) - (0 6 8 2) - ) - cyclic inout2 - ( - (3 5 11 9) - (2 8 10 4) - ) + bottomWall + { + type wall; + faces + ( + (0 1 7 6) + ); + } + topWall + { + type wall; + faces + ( + (4 10 11 5) + ); + } + + sides1_half0 + { + type cyclic; + neighbourPatch sides1_half1; + faces + ( + (0 2 3 1) + ); + } + sides1_half1 + { + type cyclic; + neighbourPatch sides1_half0; + faces + ( + (6 7 9 8) + ); + } + + sides2_half0 + { + type cyclic; + neighbourPatch sides2_half1; + faces + ( + (2 4 5 3) + ); + } + sides2_half1 + { + type cyclic; + neighbourPatch sides2_half0; + faces + ( + (8 9 11 10) + ); + } + + inout1_half0 + { + type cyclic; + neighbourPatch inout1_half1; + faces + ( + (1 3 9 7) + ); + } + inout1_half1 + { + type cyclic; + neighbourPatch inout1_half0; + faces + ( + (0 6 8 2) + ); + } + + inout2_half0 + { + type cyclic; + neighbourPatch inout2_half1; + faces + ( + (3 5 11 9) + ); + } + inout2_half1 + { + type cyclic; + neighbourPatch inout2_half0; + faces + ( + (2 8 10 4) + ); + } ); mergePatchPairs From 2dbf42085dcf395beb5b3acf1e391331719b82da Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 15 Jan 2009 18:29:08 +0000 Subject: [PATCH 003/771] Initial set of changes. --- .../mesh/generation/blockMesh/Make/options | 2 +- .../mesh/generation/blockMesh/blockMesh.C | 44 +- .../mesh/generation/blockMesh/blockMesh.H | 34 +- .../mesh/generation/blockMesh/blockMeshApp.C | 21 +- .../generation/blockMesh/createTopology.C | 492 +++++--- .../decomposePar/decomposeMesh.C | 1003 +++++++---------- .../decomposePar/decomposePar.C | 2 +- .../decomposePar/distributeCells.C | 1 - .../decomposePar/domainDecomposition.C | 33 +- .../decomposePar/domainDecomposition.H | 34 +- src/Allwmake | 20 +- src/OpenFOAM/Make/files | 5 + .../algorithms/MeshWave/FaceCellWave.C | 18 +- .../algorithms/MeshWave/FaceCellWave.H | 2 +- .../containers/Lists/ListOps/ListOps.C | 16 +- .../containers/Lists/ListOps/ListOps.H | 117 +- .../Lists/ListOps/ListOpsTemplates.C | 209 ++-- src/OpenFOAM/containers/Lists/UList/UList.C | 2 +- src/OpenFOAM/containers/Lists/UList/UList.H | 20 + src/OpenFOAM/containers/Lists/UList/UListI.H | 4 +- src/OpenFOAM/containers/Lists/UList/UListIO.C | 4 +- .../Fields/transformList/transformList.C | 61 +- .../Fields/transformList/transformList.H | 33 +- .../constraint/cyclic/cyclicPointPatchField.C | 4 +- .../constraint/cyclic/cyclicPointPatchField.H | 4 +- .../processor/processorPointPatchField.C | 118 +- .../processor/processorPointPatchField.H | 4 +- .../lduInterface/cyclicLduInterface.C | 9 + .../lduInterface/cyclicLduInterface.H | 30 +- .../lduInterface/processorLduInterface.C | 12 - .../lduInterface/processorLduInterface.H | 36 +- .../processorLduInterfaceTemplates.C | 211 +++- .../cyclicLduInterfaceField.C | 13 +- .../cyclicLduInterfaceField.H | 4 +- .../processorLduInterfaceField.C | 36 +- .../processorLduInterfaceField.H | 22 +- .../cyclicGAMGInterface/cyclicGAMGInterface.C | 19 +- .../cyclicGAMGInterface/cyclicGAMGInterface.H | 8 +- .../constraint/cyclic/cyclicPointPatch.C | 2 +- .../constraint/cyclic/cyclicPointPatch.H | 6 +- .../polyMesh/globalMeshData/globalMeshData.C | 42 +- .../polyMesh/globalMeshData/globalMeshData.H | 7 - src/OpenFOAM/meshes/polyMesh/polyMesh.C | 22 +- src/OpenFOAM/meshes/polyMesh/polyMesh.H | 29 + .../meshes/polyMesh/polyMeshFromShapeMesh.C | 804 ++++++++----- .../basic/coupled/coupledPolyPatch.C | 135 ++- .../basic/coupled/coupledPolyPatch.H | 78 +- .../constraint/cyclic/cyclicPolyPatch.C | 630 +++++++---- .../constraint/cyclic/cyclicPolyPatch.H | 189 +++- .../constraint/processor/processorPolyPatch.C | 524 +++------ .../constraint/processor/processorPolyPatch.H | 224 +++- .../polyPatches/polyPatch/polyPatch.H | 8 - .../meshes/polyMesh/syncTools/syncTools.C | 106 +- .../meshes/polyMesh/syncTools/syncTools.H | 20 +- .../polyMesh/syncTools/syncToolsTemplates.C | 128 ++- src/conversion/Make/files | 2 + src/decompositionAgglomeration/Allwmake | 8 +- .../decompositionMethods/Make/files | 4 +- .../decompositionMethods/Make/options | 4 +- src/dynamicMesh/Make/files | 3 +- .../polyTopoChange/localPointRegion.C | 2 +- .../polyTopoChange/polyTopoChange.C | 236 +++- .../polyTopoChange/polyTopoChange.H | 32 +- src/finiteVolume/Make/files | 30 +- .../basic/coupled/coupledFvPatchField.C | 119 +- .../basic/coupled/coupledFvPatchField.H | 118 ++ .../basic/coupled/coupledFvPatchFields.C | 2 + .../constraint/cyclic/cyclicFvPatchField.C | 235 +++- .../constraint/cyclic/cyclicFvPatchField.H | 66 +- .../constraint/cyclic/cyclicFvPatchFields.C | 1 + .../processor/processorFvPatchField.C | 335 +++++- .../processor/processorFvPatchField.H | 104 +- .../processor/processorFvPatchFields.C | 1 + .../fvPatches/basic/coupled/coupledFvPatch.H | 65 +- .../constraint/cyclic/cyclicFvPatch.C | 50 +- .../constraint/cyclic/cyclicFvPatch.H | 37 +- .../constraint/processor/processorFvPatch.C | 147 ++- .../constraint/processor/processorFvPatch.H | 54 +- src/lagrangian/basic/Particle/Particle.C | 60 +- src/meshTools/Make/files | 14 +- .../polyMeshZipUpCells/polyMeshZipUpCells.C | 19 +- .../channel395/constant/polyMesh/boundary | 61 - .../icoFoam/cavity/constant/polyMesh/boundary | 39 - wmake/rules/linux64Gcc/c++Opt | 2 +- 84 files changed, 4747 insertions(+), 2764 deletions(-) delete mode 100644 tutorials/channelOodles/channel395/constant/polyMesh/boundary delete mode 100644 tutorials/icoFoam/cavity/constant/polyMesh/boundary diff --git a/applications/utilities/mesh/generation/blockMesh/Make/options b/applications/utilities/mesh/generation/blockMesh/Make/options index a5b85e4298..0a78d6dc5f 100644 --- a/applications/utilities/mesh/generation/blockMesh/Make/options +++ b/applications/utilities/mesh/generation/blockMesh/Make/options @@ -5,4 +5,4 @@ EXE_INC = \ EXE_LIBS = \ -lmeshTools \ - -ldynamicMesh + /* -ldynamicMesh */ diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/applications/utilities/mesh/generation/blockMesh/blockMesh.C index ebd8db02f2..2739ad2d1a 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.C @@ -81,45 +81,21 @@ const curvedEdgeList& blockMesh::edges() const } -wordList blockMesh::patchNames() const +PtrList blockMesh::patchDicts() const { const polyPatchList& patchTopologies = topology().boundaryMesh(); - wordList names(patchTopologies.size()); - forAll (names, patchI) + PtrList patchDicts(patchTopologies.size()); + + forAll(patchTopologies, patchI) { - names[patchI] = patchTopologies[patchI].name(); + OStringStream os; + patchTopologies[patchI].write(os); + IStringStream is(os.str()); + patchDicts.set(patchI, new dictionary(is)); + patchDicts[patchI].set("name", patchTopologies[patchI].name()); } - - return names; -} - - -wordList blockMesh::patchTypes() const -{ - const polyPatchList& patchTopologies = topology().boundaryMesh(); - wordList types(patchTopologies.size()); - - forAll (types, patchI) - { - types[patchI] = patchTopologies[patchI].type(); - } - - return types; -} - - -wordList blockMesh::patchPhysicalTypes() const -{ - const polyPatchList& patchTopologies = topology().boundaryMesh(); - wordList physicalTypes(patchTopologies.size()); - - forAll (physicalTypes, patchI) - { - physicalTypes[patchI] = patchTopologies[patchI].physicalType(); - } - - return physicalTypes; + return patchDicts; } diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.H b/applications/utilities/mesh/generation/blockMesh/blockMesh.H index 808e93dad5..0e14b1272e 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.H +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.H @@ -88,6 +88,30 @@ class blockMesh const faceList& patchShapes ); + bool readPatches + ( + const dictionary& meshDescription, + const pointField& tmpBlockPoints, + faceListList& tmpBlocksPatches, + wordList& patchNames, + wordList& patchTypes, + wordList& nbrPatchNames + ); + + bool readBoundary + ( + const dictionary& meshDescription, + const pointField& tmpBlockPoints, + faceListList& tmpBlocksPatches, + PtrList& patchDicts + ); + + void createCellShapes + ( + const pointField& tmpBlockPoints, + PtrList& tmpBlockCells + ); + polyMesh* createTopology(IOdictionary&); void checkBlockMesh(const polyMesh&); @@ -140,11 +164,15 @@ public: return patches_; } - wordList patchNames() const; - wordList patchTypes() const; + //- Get patch information from the topology mesh + PtrList patchDicts() const; - wordList patchPhysicalTypes() const; +// wordList patchNames() const; +// +// wordList patchTypes() const; +// +// wordList patchPhysicalTypes() const; //- Number of blocks with specified zones label numZonedBlocks() const; diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index e73a5262b9..a5f82830c9 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -190,23 +190,8 @@ int main(int argc, char *argv[]) Info<< nl << "Creating mesh from block mesh" << endl; - wordList patchNames = blocks.patchNames(); - wordList patchTypes = blocks.patchTypes(); word defaultFacesName = "defaultFaces"; word defaultFacesType = emptyPolyPatch::typeName; - wordList patchPhysicalTypes = blocks.patchPhysicalTypes(); - - preservePatchTypes - ( - runTime, - runTime.constant(), - polyMeshDir, - patchNames, - patchTypes, - defaultFacesName, - defaultFacesType, - patchPhysicalTypes - ); polyMesh mesh ( @@ -219,11 +204,9 @@ int main(int argc, char *argv[]) blocks.points(), blocks.cells(), blocks.patches(), - patchNames, - patchTypes, + blocks.patchDicts(), defaultFacesName, - defaultFacesType, - patchPhysicalTypes + defaultFacesType ); diff --git a/applications/utilities/mesh/generation/blockMesh/createTopology.C b/applications/utilities/mesh/generation/blockMesh/createTopology.C index 6b74db8b0a..d1ad520328 100644 --- a/applications/utilities/mesh/generation/blockMesh/createTopology.C +++ b/applications/utilities/mesh/generation/blockMesh/createTopology.C @@ -28,6 +28,7 @@ License #include "Time.H" #include "preservePatchTypes.H" #include "emptyPolyPatch.H" +#include "cyclicPolyPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -126,6 +127,248 @@ bool Foam::blockMesh::patchLabelsOK } +bool Foam::blockMesh::readPatches +( + const dictionary& meshDescription, + const pointField& tmpBlockPoints, + faceListList& tmpBlocksPatches, + wordList& patchNames, + wordList& patchTypes, + wordList& nbrPatchNames +) +{ + bool topologyOK = true; + + ITstream& patchStream(meshDescription.lookup("patches")); + + // read number of patches in mesh + label nPatches = 0; + + token firstToken(patchStream); + + if (firstToken.isLabel()) + { + nPatches = firstToken.labelToken(); + + tmpBlocksPatches.setSize(nPatches); + patchNames.setSize(nPatches); + patchTypes.setSize(nPatches); + nbrPatchNames.setSize(nPatches); + } + else + { + patchStream.putBack(firstToken); + } + + // Read beginning of blocks + patchStream.readBegin("patches"); + + nPatches = 0; + + token lastToken(patchStream); + while + ( + !( + lastToken.isPunctuation() + && lastToken.pToken() == token::END_LIST + ) + ) + { + if (tmpBlocksPatches.size() <= nPatches) + { + tmpBlocksPatches.setSize(nPatches + 1); + patchNames.setSize(nPatches + 1); + patchTypes.setSize(nPatches + 1); + nbrPatchNames.setSize(nPatches + 1); + } + + patchStream.putBack(lastToken); + + patchStream + >> patchTypes[nPatches] + >> patchNames[nPatches]; + + // Read optional neighbour patch name + if (patchTypes[nPatches] == cyclicPolyPatch::typeName) + { + patchStream >> lastToken; + if (lastToken.isWord()) + { + nbrPatchNames[nPatches] = lastToken.wordToken(); + } + else + { + patchStream.putBack(lastToken); + } + } + + // Read patch faces + patchStream >> tmpBlocksPatches[nPatches]; + + + // Catch multiple patches asap. + for (label i = 0; i < nPatches; i++) + { + if (patchNames[nPatches] == patchNames[i]) + { + FatalErrorIn + ( + "blockMesh::createTopology(IOdictionary&)" + ) << "Duplicate patch " << patchNames[nPatches] + << " at line " << patchStream.lineNumber() + << ". Exiting !" << nl + << exit(FatalError); + } + } + + topologyOK = topologyOK && patchLabelsOK + ( + nPatches, + tmpBlockPoints, + tmpBlocksPatches[nPatches] + ); + + nPatches++; + + + // Split old style cyclics + + if (patchTypes[nPatches-1] == cyclicPolyPatch::typeName) + { + if (nbrPatchNames[nPatches] == word::null) + { + word halfA = patchNames[nPatches-1] + "_half0"; + word halfB = patchNames[nPatches-1] + "_half1"; + + WarningIn("blockMesh::createTopology(IOdictionary&)") + << "Old-style cyclic definition." + << " Splitting patch " + << patchNames[nPatches-1] << " into two halves " + << halfA << " and " << halfB << endl + << " Alternatively use new syntax " + << " cyclic " << endl; + + // Add extra patch + if (tmpBlocksPatches.size() <= nPatches) + { + tmpBlocksPatches.setSize(nPatches + 1); + patchNames.setSize(nPatches + 1); + patchTypes.setSize(nPatches + 1); + nbrPatchNames.setSize(nPatches + 1); + } + + patchNames[nPatches-1] = halfA; + nbrPatchNames[nPatches-1] = halfB; + patchTypes[nPatches] = patchTypes[nPatches-1]; + patchNames[nPatches] = halfB; + nbrPatchNames[nPatches] = halfA; + + // Split faces + if ((tmpBlocksPatches[nPatches-1].size() % 2) != 0) + { + FatalErrorIn + ( + "blockMesh::createTopology(IOdictionary&)" + ) << "Size of cyclic faces is not a multiple of 2 :" + << tmpBlocksPatches[nPatches-1] + << exit(FatalError); + } + label sz = tmpBlocksPatches[nPatches-1].size()/2; + faceList unsplitFaces(tmpBlocksPatches[nPatches-1], true); + tmpBlocksPatches[nPatches-1] = faceList + ( + SubList(unsplitFaces, sz) + ); + tmpBlocksPatches[nPatches] = faceList + ( + SubList(unsplitFaces, sz, sz) + ); + + nPatches++; + } + } + + patchStream >> lastToken; + } + patchStream.putBack(lastToken); + + // Read end of blocks + patchStream.readEnd("patches"); + + return topologyOK; +} + + +bool Foam::blockMesh::readBoundary +( + const dictionary& meshDescription, + const pointField& tmpBlockPoints, + faceListList& tmpBlocksPatches, + PtrList& patchDicts +) +{ + bool topologyOK = true; + + // Read like boundary file + const PtrList patchesInfo + ( + meshDescription.lookup("boundary") + ); + + tmpBlocksPatches.setSize(patchesInfo.size()); + patchDicts.setSize(patchesInfo.size()); + + forAll(tmpBlocksPatches, patchI) + { + const entry& patchInfo = patchesInfo[patchI]; + + // Construct dictionary and add name + patchDicts.set(patchI, new dictionary(patchInfo.dict())); + patchDicts[patchI].set("name", patchInfo.keyword()); + // Read block faces + patchDicts[patchI].lookup("faces") >> tmpBlocksPatches[patchI]; + + topologyOK = topologyOK && patchLabelsOK + ( + patchI, + tmpBlockPoints, + tmpBlocksPatches[patchI] + ); + } + + return topologyOK; +} + + +void Foam::blockMesh::createCellShapes +( + const pointField& tmpBlockPoints, + PtrList& tmpBlockCells +) +{ + const blockMesh& blocks = *this; + + tmpBlockCells.setSize(blocks.size()); + forAll(blocks, blockLabel) + { + tmpBlockCells.set + ( + blockLabel, + new cellShape(blocks[blockLabel].blockDef().blockShape()) + ); + + if (tmpBlockCells[blockLabel].mag(tmpBlockPoints) < 0.0) + { + WarningIn + ( + "blockMesh::createTopology(IOdictionary&)" + ) << "negative volume block : " << blockLabel + << ", probably defined inside-out" << endl; + } + } +} + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) @@ -296,158 +539,127 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) } + polyMesh* blockMeshPtr = NULL; + Info<< nl << "Creating patches" << endl; - faceListList tmpBlocksPatches; - wordList patchNames; - wordList patchTypes; - + if (meshDescription.found("patches")) { - ITstream& patchStream(meshDescription.lookup("patches")); + Info<< nl << "Reading patches section" << endl; - // read number of patches in mesh - label nPatches = 0; + faceListList tmpBlocksPatches; + wordList patchNames; + wordList patchTypes; + wordList nbrPatchNames; - token firstToken(patchStream); - - if (firstToken.isLabel()) - { - nPatches = firstToken.labelToken(); - - tmpBlocksPatches.setSize(nPatches); - patchNames.setSize(nPatches); - patchTypes.setSize(nPatches); - } - else - { - patchStream.putBack(firstToken); - } - - // Read beginning of blocks - patchStream.readBegin("patches"); - - nPatches = 0; - - token lastToken(patchStream); - while + topologyOK = topologyOK && readPatches ( - !( - lastToken.isPunctuation() - && lastToken.pToken() == token::END_LIST - ) - ) - { - if (tmpBlocksPatches.size() <= nPatches) - { - tmpBlocksPatches.setSize(nPatches + 1); - patchNames.setSize(nPatches + 1); - patchTypes.setSize(nPatches + 1); - } - - patchStream.putBack(lastToken); - - patchStream - >> patchTypes[nPatches] - >> patchNames[nPatches] - >> tmpBlocksPatches[nPatches]; - - - // Catch multiple patches asap. - for (label i = 0; i < nPatches; i++) - { - if (patchNames[nPatches] == patchNames[i]) - { - FatalErrorIn - ( - "blockMesh::createTopology(IOdictionary&)" - ) << "Duplicate patch " << patchNames[nPatches] - << " at line " << patchStream.lineNumber() - << ". Exiting !" << nl - << exit(FatalError); - } - } - - topologyOK = topologyOK && patchLabelsOK - ( - nPatches, - tmpBlockPoints, - tmpBlocksPatches[nPatches] - ); - - nPatches++; - - patchStream >> lastToken; - } - patchStream.putBack(lastToken); - - // Read end of blocks - patchStream.readEnd("patches"); - } - - - if (!topologyOK) - { - FatalErrorIn("blockMesh::createTopology(IOdictionary&)") - << "Cannot create mesh due to errors in topology, exiting !" << nl - << exit(FatalError); - } - - - Info<< nl << "Creating block mesh topology" << endl; - - PtrList tmpBlockCells(blocks.size()); - forAll(blocks, blockLabel) - { - tmpBlockCells.set - ( - blockLabel, - new cellShape(blocks[blockLabel].blockDef().blockShape()) + meshDescription, + tmpBlockPoints, + tmpBlocksPatches, + patchNames, + patchTypes, + nbrPatchNames ); - if (tmpBlockCells[blockLabel].mag(tmpBlockPoints) < 0.0) + if (!topologyOK) { - WarningIn - ( - "blockMesh::createTopology(IOdictionary&)" - ) << "negative volume block : " << blockLabel - << ", probably defined inside-out" << endl; + FatalErrorIn("blockMesh::createTopology(IOdictionary&)") + << "Cannot create mesh due to errors in topology, exiting !" + << nl << exit(FatalError); } + + + Info<< nl << "Creating block mesh topology" << endl; + + PtrList tmpBlockCells(blocks.size()); + createCellShapes(tmpBlockPoints, tmpBlockCells); + + + Info<< nl << "Reading physicalType from existing boundary file" << endl; + + wordList patchPhysicalTypes(tmpBlocksPatches.size()); + + preservePatchTypes + ( + meshDescription.time(), + meshDescription.time().constant(), + polyMesh::meshSubDir, + patchNames, + patchTypes, + defaultPatchName, + defaultPatchType, + patchPhysicalTypes + ); + + blockMeshPtr = new polyMesh + ( + IOobject + ( + "blockMesh", + meshDescription.time().constant(), + meshDescription.time(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + tmpBlockPoints, + tmpBlockCells, + tmpBlocksPatches, + patchNames, + patchTypes, + defaultPatchName, + defaultPatchType, + patchPhysicalTypes + ); + } + else if (meshDescription.found("boundary")) + { + faceListList tmpBlocksPatches; + PtrList patchDicts; + + topologyOK = topologyOK && readBoundary + ( + meshDescription, + tmpBlockPoints, + tmpBlocksPatches, + patchDicts + ); + + if (!topologyOK) + { + FatalErrorIn("blockMesh::createTopology(IOdictionary&)") + << "Cannot create mesh due to errors in topology, exiting !" + << nl << exit(FatalError); + } + + + Info<< nl << "Creating block mesh topology" << endl; + + PtrList tmpBlockCells(blocks.size()); + createCellShapes(tmpBlockPoints, tmpBlockCells); + + + blockMeshPtr = new polyMesh + ( + IOobject + ( + "blockMesh", + meshDescription.time().constant(), + meshDescription.time(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + tmpBlockPoints, + tmpBlockCells, + tmpBlocksPatches, + patchDicts, + defaultPatchName, + defaultPatchType + ); } - wordList patchPhysicalTypes(tmpBlocksPatches.size()); - - preservePatchTypes - ( - meshDescription.time(), - meshDescription.time().constant(), - polyMesh::meshSubDir, - patchNames, - patchTypes, - defaultPatchName, - defaultPatchType, - patchPhysicalTypes - ); - - polyMesh* blockMeshPtr = new polyMesh - ( - IOobject - ( - "blockMesh", - meshDescription.time().constant(), - meshDescription.time(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - tmpBlockPoints, - tmpBlockCells, - tmpBlocksPatches, - patchNames, - patchTypes, - defaultPatchName, - defaultPatchType, - patchPhysicalTypes - ); checkBlockMesh(*blockMeshPtr); diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeMesh.C b/applications/utilities/parallelProcessing/decomposePar/decomposeMesh.C index 55f5c96579..22b9a99586 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeMesh.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeMesh.C @@ -40,6 +40,63 @@ Description // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +void domainDecomposition::append(labelList& lst, const label elem) +{ + label sz = lst.size(); + lst.setSize(sz+1); + lst[sz] = elem; +} + + +void domainDecomposition::addInterProcFace +( + const label facei, + const label ownerProc, + const label nbrProc, + + List >& nbrToInterPatch, + List > >& interPatchFaces +) const +{ + Map