From e61ac9d842485b5a782a32ed074396e2d619e32b Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 8 Jan 2015 17:21:07 +0000 Subject: [PATCH] wallDist: Set BCs for y and n appropriately for solving PDEs --- .../patchDistMethod/patchDistMethod.H | 6 +++ .../fvMesh/wallDist/wallDist/wallDist.C | 39 +++++++++++++++---- .../fvMesh/wallDist/wallDist/wallDist.H | 5 +++ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/patchDistMethod/patchDistMethod.H b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/patchDistMethod/patchDistMethod.H index 774f6d9d5..c5cbdb296 100644 --- a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/patchDistMethod/patchDistMethod.H +++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/patchDistMethod/patchDistMethod.H @@ -126,6 +126,12 @@ public: // Member Functions + //- Return the patchIDs + const labelHashSet& patchIDs() const + { + return patchIDs_; + } + //- Update cached geometry when the mesh moves virtual bool movePoints() { diff --git a/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.C b/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.C index d06a8456b..21ef0d7fd 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.C +++ b/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.C @@ -24,7 +24,9 @@ License \*---------------------------------------------------------------------------*/ #include "wallDist.H" -#include "wallFvPatch.H" +#include "wallPolyPatch.H" +#include "fixedValueFvPatchFields.H" +#include "zeroGradientFvPatchFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -34,6 +36,26 @@ namespace Foam } +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +Foam::wordList Foam::wallDist::patchTypes(const labelHashSet& patchIDs) const +{ + wordList yTypes + ( + mesh().boundary().size(), + zeroGradientFvPatchField::typeName + ); + + forAllConstIter(labelHashSet, patchIDs, iter) + { + yTypes[iter.key()] = fixedValueFvPatchField::typeName; + } + + return yTypes; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::wallDist::wallDist(const fvMesh& mesh) @@ -57,7 +79,8 @@ Foam::wallDist::wallDist(const fvMesh& mesh) mesh ), mesh, - dimensionedScalar("yWall", dimLength, GREAT) + dimensionedScalar("yWall", dimLength, GREAT), + patchTypes(pdm_->patchIDs()) ), n_(NULL) { @@ -74,18 +97,18 @@ Foam::wallDist::wallDist(const fvMesh& mesh) mesh ), mesh, - dimensionedVector("nWall", dimless, vector::zero) + dimensionedVector("nWall", dimless, vector::zero), + patchTypes(pdm_->patchIDs()) ) ); + const labelHashSet& patchIDs = pdm_->patchIDs(); const fvPatchList& patches = mesh.boundary(); - forAll(patches, patchi) + forAllConstIter(labelHashSet, patchIDs, iter) { - if (isA(patches[patchi])) - { - n_().boundaryField()[patchi] = patches[patchi].nf(); - } + label patchi = iter.key(); + n_().boundaryField()[patchi] == patches[patchi].nf(); } movePoints(); diff --git a/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.H b/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.H index 683a8c095..60dfc8044 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.H +++ b/src/finiteVolume/fvMesh/wallDist/wallDist/wallDist.H @@ -68,6 +68,11 @@ class wallDist // Private Member Functions + //- Return the patch types for y and n + // These are fixedValue for the set provided otherwise zero-gradient + template + wordList patchTypes(const labelHashSet& patchIDs) const; + //- Disallow default bitwise copy construct wallDist(const wallDist&);