From 75b0c7d1f8f58292bc8151a02b914f9cbd54be76 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 7 Sep 2009 13:37:58 +0100 Subject: [PATCH 01/43] added wall check for particle lambda calc --- src/lagrangian/basic/Particle/ParticleI.H | 56 +++++++++++++---------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/lagrangian/basic/Particle/ParticleI.H b/src/lagrangian/basic/Particle/ParticleI.H index 65ac64e525..2e6d8f868f 100644 --- a/src/lagrangian/basic/Particle/ParticleI.H +++ b/src/lagrangian/basic/Particle/ParticleI.H @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "polyMesh.H" +#include "wallPolyPatch.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -46,21 +47,25 @@ inline Foam::scalar Foam::Particle::lambda Sf /= mag(Sf); vector Cf = mesh.faceCentres()[facei]; - // move reference point for wall + // patch interaction if (!cloud_.internalFace(facei)) { - const vector& C = mesh.cellCentres()[celli_]; - scalar CCf = mag((C - Cf) & Sf); - // check if distance between cell centre and face centre - // is larger than wallImpactDistance - if - ( - CCf - > static_cast(*this).wallImpactDistance(Sf) - ) + label patchi = patch(facei); + const polyPatch& patch = mesh.boundaryMesh()[patchi]; + + // move reference point for wall + if (isA(patch)) { - Cf -= static_cast(*this) - .wallImpactDistance(Sf)*Sf; + const vector& C = mesh.cellCentres()[celli_]; + scalar CCf = mag((C - Cf) & Sf); + // check if distance between cell centre and face centre + // is larger than wallImpactDistance + const ParticleType& p = + static_cast(*this); + if (CCf > p.wallImpactDistance(Sf)) + { + Cf -=p.wallImpactDistance(Sf)*Sf; + } } } @@ -190,21 +195,24 @@ inline Foam::scalar Foam::Particle::lambda Sf /= mag(Sf); vector Cf = mesh.faceCentres()[facei]; - // move reference point for wall + // patch interaction if (!cloud_.internalFace(facei)) { - const vector& C = mesh.cellCentres()[celli_]; - scalar CCf = mag((C - Cf) & Sf); - // check if distance between cell centre and face centre - // is larger than wallImpactDistance - if - ( - CCf - > static_cast(*this).wallImpactDistance(Sf) - ) + label patchi = patch(facei); + const polyPatch& patch = mesh.boundaryMesh()[patchi]; + + // move reference point for wall + if (isA(patch)) { - Cf -= static_cast(*this) - .wallImpactDistance(Sf)*Sf; + const vector& C = mesh.cellCentres()[celli_]; + scalar CCf = mag((C - Cf) & Sf); + // check if distance between cell centre and face centre + // is larger than wallImpactDistance + const ParticleType& p = static_cast(*this); + if (CCf > p.wallImpactDistance(Sf)) + { + Cf -=p.wallImpactDistance(Sf)*Sf; + } } } From fd35d9d36abbebc92e9d2266e501a8eeef5ede3c Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 7 Sep 2009 16:57:17 +0100 Subject: [PATCH 02/43] more descriptive comment --- src/lagrangian/intermediate/particleForces/particleForces.H | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/particleForces/particleForces.H b/src/lagrangian/intermediate/particleForces/particleForces.H index fbe88a6dc8..f0be486381 100644 --- a/src/lagrangian/intermediate/particleForces/particleForces.H +++ b/src/lagrangian/intermediate/particleForces/particleForces.H @@ -26,7 +26,8 @@ Class Foam::particleForces Description - Particle forces + Provides a mechanism to calculate particle forces + Note: forces are force per unit mass (accelerations) SourceFiles particleForces.C From 21ba33aad1bfc286fc374b3d499961980f13d344 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Sep 2009 17:37:56 +0100 Subject: [PATCH 03/43] added region option --- .../manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C index e12ab576fd..b1c064a6ee 100644 --- a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C +++ b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C @@ -222,13 +222,14 @@ labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces) int main(int argc, char *argv[]) { +# include "addRegionOption.H" argList::validOptions.insert("split", ""); argList::validOptions.insert("overwrite", ""); argList::validOptions.insert("detectOnly", ""); # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); -# include "createMesh.H" +# include "createNamedMesh.H" const word oldInstance = mesh.pointsInstance(); bool split = args.optionFound("split"); From 0aa0114310b963a901fcb02b1f38e88db3169d24 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Sep 2009 17:39:01 +0100 Subject: [PATCH 04/43] preservePatches option still needed for geometric decomposition options --- .../decomposePar/decomposeParDict | 6 ++++ .../decomposePar/distributeCells.C | 29 +++++++++++++++++++ .../decompositionMethod/decompositionMethod.C | 13 +++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index aad15ee459..e1620d7201 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -22,6 +22,12 @@ numberOfSubdomains 4; //- 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) +//preservePatches (cyclic_left_right); + + method scotch; // method hierarchical; // method simple; diff --git a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C index af47af244f..ffd54ac685 100644 --- a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C +++ b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C @@ -45,6 +45,35 @@ void domainDecomposition::distributeCells() labelHashSet sameProcFaces; + if (decompositionDict_.found("preservePatches")) + { + wordList pNames(decompositionDict_.lookup("preservePatches")); + + Info<< "Keeping owner of faces in patches " << pNames + << " on same processor. This only makes sense for cyclics." << endl; + + const polyBoundaryMesh& patches = boundaryMesh(); + + forAll(pNames, i) + { + label patchI = patches.findPatchID(pNames[i]); + + if (patchI == -1) + { + FatalErrorIn("domainDecomposition::distributeCells()") + << "Unknown preservePatch " << pNames[i] + << endl << "Valid patches are " << patches.names() + << exit(FatalError); + } + + const polyPatch& pp = patches[patchI]; + + forAll(pp, i) + { + sameProcFaces.insert(pp.start() + i); + } + } + } if (decompositionDict_.found("preserveFaceZones")) { wordList zNames(decompositionDict_.lookup("preserveFaceZones")); diff --git a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C index c38e0494ae..d5c98d52b5 100644 --- a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -141,9 +141,18 @@ Foam::labelList Foam::decompositionMethod::decompose const pointField& coarsePoints ) { - scalarField coarseWeights(0); + // Decompose based on agglomerated points + labelList coarseDistribution(decompose(coarsePoints)); - return decompose(fineToCoarse, coarsePoints, coarseWeights); + // Rework back into decomposition for original mesh_ + labelList fineDistribution(fineToCoarse.size()); + + forAll(fineDistribution, i) + { + fineDistribution[i] = coarseDistribution[fineToCoarse[i]]; + } + + return fineDistribution; } From 9c86fec6e3e31b5d17d928c64ab0e0435f17ee49 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Sep 2009 17:39:47 +0100 Subject: [PATCH 05/43] protect against illegal number of layers --- .../autoHexMeshDriver/autoLayerDriver.C | 48 +++++++++++++------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 27ca388fe3..3d0274bc33 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2661,10 +2661,22 @@ void Foam::autoLayerDriver::addLayers { const polyBoundaryMesh& patches = mesh.boundaryMesh(); - Info<< nl - << "patch faces layers avg thickness[m]" << nl - << " near-wall overall" << nl - << "----- ----- ------ --------- -------" << endl; + // Find maximum length of a patch name, for a nicer output + label maxPatchNameLen = 0; + forAll(meshMover.adaptPatchIDs(), i) + { + label patchI = meshMover.adaptPatchIDs()[i]; + word patchName = patches[patchI].name(); + maxPatchNameLen = max(maxPatchNameLen,label(patchName.size())); + } + + Info<< nl + << setf(ios_base::left) << setw(maxPatchNameLen) << "patch" + << setw(0) << " faces layers avg thickness[m]" << nl + << setf(ios_base::left) << setw(maxPatchNameLen) << " " + << setw(0) << " near-wall overall" << nl + << setf(ios_base::left) << setw(maxPatchNameLen) << "-----" + << setw(0) << " ----- ------ --------- -------" << endl; forAll(meshMover.adaptPatchIDs(), i) { @@ -2704,18 +2716,24 @@ void Foam::autoLayerDriver::addLayers label totNPoints = returnReduce(meshPoints.size(), sumOp