From 1f2829ac2aa374b12e232d4a7265401f03fc357b Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 14 Oct 2010 18:31:08 +0100 Subject: [PATCH 01/60] ENH: foamToEnsight : filter proc patches only if running parallel --- .../dataConversion/foamToEnsight/ensightMesh.C | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index 6216228961..cff09a395d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -70,12 +70,15 @@ void Foam::ensightMesh::correct() // Patches are output. Check that they're synced. mesh_.boundaryMesh().checkParallelSync(true); - allPatchNames_ = wordList::subList - ( - mesh_.boundaryMesh().names(), - mesh_.boundary().size() - - mesh_.globalData().processorPatches().size() - ); + allPatchNames_ = mesh_.boundaryMesh().names(); + if (Pstream::parRun()) + { + allPatchNames_.setSize + ( + mesh_.boundary().size() + - mesh_.globalData().processorPatches().size() + ); + } if (patches_) { From a48897c558b9628dffccee3551467408f6f09750 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 15 Oct 2010 10:43:18 +0100 Subject: [PATCH 02/60] STYLE: directMapped : updated comment --- .../directMappedFixedValueFvPatchField.H | 8 +++++++- .../directMappedVelocityFluxFixedValueFvPatchField.H | 5 +++++ .../directMappedPolyPatch/directMappedPatchBase.H | 8 ++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/directMappedFixedValue/directMappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/directMappedFixedValue/directMappedFixedValueFvPatchField.H index e672c07e92..8d6038913e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/directMappedFixedValue/directMappedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/directMappedFixedValue/directMappedFixedValueFvPatchField.H @@ -25,7 +25,13 @@ Class Foam::directMappedFixedValueFvPatchField Description - Recycles the value at a set of internal faces back to *this. + Recycles the value at a set of cells or patch faces back to *this. Can not + sample internal faces (since volField not defined on faces). + + mode = NEARESTCELL : sample nearest cell + mode = NEARESTPATCHFACE : sample nearest face on selected patch + mode = NEARESTFACE : sample nearest face on any patch. Note: does not + warn if nearest actually is on internal face! SourceFiles directMappedFixedValueFvPatchField.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.H index 95f3954a1a..3aecda00c0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.H @@ -27,6 +27,11 @@ Class Description Recycles the velocity and flux at a patch to this patch + mode = NEARESTCELL : sample nearest cell + mode = NEARESTPATCHFACE : sample nearest face on selected patch + mode = NEARESTFACE : sample nearest face on any patch. Note: does not + warn if nearest actually is on internal face! + SourceFiles directMappedVelocityFluxFixedValueFvPatchField.C diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H index 9d3fd3a622..577f014dee 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H @@ -66,9 +66,9 @@ public: //- Mesh items to sample enum sampleMode { - NEARESTCELL, - NEARESTPATCHFACE, - NEARESTFACE + NEARESTCELL, // nearest cell + NEARESTPATCHFACE, // faces on selected patch + NEARESTFACE // nearest face }; private: @@ -201,7 +201,7 @@ public: return sampleRegion_; } - //- Patch (only if NEARESTBOUNDARY) + //- Patch (only if NEARESTPATCHFACE) const word& samplePatch() const { return samplePatch_; From 1526db114b94317d7b9a18d42fc162fe32db2673 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 15 Oct 2010 15:26:25 +0100 Subject: [PATCH 03/60] BUG: foamToEnsight : wedge and hex numbering inconsistent between mesh and fields --- .../dataConversion/foamToEnsight/cellSets.H | 2 -- .../foamToEnsight/ensightField.C | 31 +++++++++++++++++-- .../foamToEnsight/ensightMesh.C | 7 +---- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H index 86eaa03d88..ff358d7887 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/cellSets.H @@ -57,7 +57,6 @@ public: labelList prisms; labelList wedges; labelList hexes; - labelList hexesWedges; labelList polys; @@ -77,7 +76,6 @@ public: prisms(nCells), wedges(nCells), hexes(nCells), - hexesWedges(nCells), polys(nCells) {} }; diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C index 8a79f54d96..7ffa7a4ca5 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C @@ -38,6 +38,32 @@ using namespace Foam; // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // +template +Field map +( + const Field& vf, + const labelList& map1, + const labelList& map2 +) +{ + Field mf(map1.size() + map2.size()); + + forAll(map1, i) + { + mf[i] = vf[map1[i]]; + } + + label offset = map1.size(); + + forAll(map2, i) + { + mf[i + offset] = vf[map2[i]]; + } + + return mf; +} + + template void writeField ( @@ -274,7 +300,8 @@ void ensightField const labelList& tets = meshCellSets.tets; const labelList& pyrs = meshCellSets.pyrs; const labelList& prisms = meshCellSets.prisms; - const labelList& hexesWedges = meshCellSets.hexesWedges; + const labelList& wedges = meshCellSets.wedges; + const labelList& hexes = meshCellSets.hexes; const labelList& polys = meshCellSets.polys; ensightStream* ensightFilePtr = NULL; @@ -328,7 +355,7 @@ void ensightField writeField ( "hexa8", - Field(vf, hexesWedges), + map(vf, hexes, wedges), ensightFile ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index cff09a395d..77fb706d56 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -117,7 +117,6 @@ void Foam::ensightMesh::correct() labelList& prisms = meshCellSets_.prisms; labelList& wedges = meshCellSets_.wedges; labelList& hexes = meshCellSets_.hexes; - labelList& hexesWedges = meshCellSets_.hexesWedges; labelList& polys = meshCellSets_.polys; label nTets = 0; @@ -125,7 +124,6 @@ void Foam::ensightMesh::correct() label nPrisms = 0; label nWedges = 0; label nHexes = 0; - label nHexesWedges = 0; label nPolys = 0; forAll(cellShapes, cellI) @@ -148,12 +146,10 @@ void Foam::ensightMesh::correct() else if (cellModel == wedge) { wedges[nWedges++] = cellI; - hexesWedges[nHexesWedges++] = cellI; } else if (cellModel == hex) { hexes[nHexes++] = cellI; - hexesWedges[nHexesWedges++] = cellI; } else { @@ -166,7 +162,6 @@ void Foam::ensightMesh::correct() prisms.setSize(nPrisms); wedges.setSize(nWedges); hexes.setSize(nHexes); - hexesWedges.setSize(nHexesWedges); polys.setSize(nPolys); meshCellSets_.nTets = nTets; @@ -178,7 +173,7 @@ void Foam::ensightMesh::correct() meshCellSets_.nPrisms = nPrisms; reduce(meshCellSets_.nPrisms, sumOp