From a3ad89e16875eafdbe24353d9016bed5c95d9985 Mon Sep 17 00:00:00 2001 From: Zeljko Tukovic Date: Thu, 4 Nov 2010 11:25:33 +0100 Subject: [PATCH] update --- .../faMesh/faMeshDemandDrivenData.C | 123 +++++++++++------- .../constraint/symmetry/symmetryFaPatch.C | 13 ++ .../constraint/symmetry/symmetryFaPatch.H | 29 +++++ .../cylinder/constant/polyMesh/boundary | 6 +- 4 files changed, 119 insertions(+), 52 deletions(-) diff --git a/src/finiteArea/faMesh/faMeshDemandDrivenData.C b/src/finiteArea/faMesh/faMeshDemandDrivenData.C index 24b512e47..14030a415 100644 --- a/src/finiteArea/faMesh/faMeshDemandDrivenData.C +++ b/src/finiteArea/faMesh/faMeshDemandDrivenData.C @@ -38,6 +38,8 @@ Description #include "PstreamCombineReduceOps.H" #include "coordinateSystem.H" #include "scalarMatrices.H" +#include "processorFaPatchFields.H" +#include "emptyFaPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -261,6 +263,7 @@ void faMesh::calcMagLe() const } } + void faMesh::calcAreaCentres() const { if (debug) @@ -304,20 +307,30 @@ void faMesh::calcAreaCentres() const forAll (boundary(), patchI) { - if (!boundary()[patchI].coupled()) - { - const edgeList::subList patchEdges = - boundary()[patchI].patchSlice(edges()); + const edgeList::subList patchEdges = + boundary()[patchI].patchSlice(edges()); - forAll (patchEdges, edgeI) - { - centres.boundaryField()[patchI][edgeI] = - patchEdges[edgeI].centre(localPoints); - } + forAll (patchEdges, edgeI) + { + centres.boundaryField()[patchI][edgeI] = + patchEdges[edgeI].centre(localPoints); } } - centres.correctBoundaryConditions(); + forAll(centres.boundaryField(), patchI) + { + if + ( + isA + ( + centres.boundaryField()[patchI] + ) + ) + { + centres.boundaryField()[patchI].initEvaluate(); + centres.boundaryField()[patchI].evaluate(); + } + } } @@ -469,14 +482,24 @@ void faMesh::calcFaceAreaNormals() const forAll (boundary(), patchI) { - if (!boundary()[patchI].coupled()) - { - faceAreaNormals.boundaryField()[patchI] = - edgeAreaNormals().boundaryField()[patchI]; - } + faceAreaNormals.boundaryField()[patchI] = + edgeAreaNormals().boundaryField()[patchI]; } - faceAreaNormals.correctBoundaryConditions(); + forAll(faceAreaNormals.boundaryField(), patchI) + { + if + ( + isA + ( + faceAreaNormals.boundaryField()[patchI] + ) + ) + { + faceAreaNormals.boundaryField()[patchI].initEvaluate(); + faceAreaNormals.boundaryField()[patchI].evaluate(); + } + } } @@ -1159,31 +1182,6 @@ void faMesh::calcPointAreaNormals() const } } - // Boundary points correction - forAll (boundary(), patchI) - { - if (correctPatchPointNormals(patchI) && !boundary()[patchI].coupled()) - { - if (boundary()[patchI].ngbPolyPatchIndex() == -1) - { - FatalErrorIn - ( - "void faMesh::calcPointAreaNormals const" - ) << "Neighbour polyPatch index is not defined " - << "for faPatch " << boundary()[patchI].name() - << abort(FatalError); - } - - labelList patchPoints = boundary()[patchI].pointLabels(); - vectorField N = boundary()[patchI].ngbPolyPatchPointNormals(); - - forAll (patchPoints, pointI) - { - result[patchPoints[pointI]] - -= N[pointI]*(N[pointI]&result[patchPoints[pointI]]); - } - } - } // Processor patch points correction forAll (boundary(), patchI) @@ -1224,13 +1222,13 @@ void faMesh::calcPointAreaNormals() const ); { - IPstream::read - ( - Pstream::blocking, - procPatch.neighbProcNo(), - reinterpret_cast(ngbPatchPointNormals.begin()), - ngbPatchPointNormals.byteSize() - ); + IPstream::read + ( + Pstream::blocking, + procPatch.neighbProcNo(), + reinterpret_cast(ngbPatchPointNormals.begin()), + ngbPatchPointNormals.byteSize() + ); } const labelList& nonGlobalPatchPoints = @@ -1249,7 +1247,6 @@ void faMesh::calcPointAreaNormals() const // Correct global points - if (globalData().nGlobalPoints() > 0) { const labelList& spLabels = @@ -1288,6 +1285,34 @@ void faMesh::calcPointAreaNormals() const } } + + // Boundary points correction + forAll (boundary(), patchI) + { + if (correctPatchPointNormals(patchI) && !boundary()[patchI].coupled()) + { + if (boundary()[patchI].ngbPolyPatchIndex() == -1) + { + FatalErrorIn + ( + "void faMesh::calcPointAreaNormals const" + ) << "Neighbour polyPatch index is not defined " + << "for faPatch " << boundary()[patchI].name() + << abort(FatalError); + } + + labelList patchPoints = boundary()[patchI].pointLabels(); + + vectorField N = boundary()[patchI].ngbPolyPatchPointNormals(); + + forAll (patchPoints, pointI) + { + result[patchPoints[pointI]] + -= N[pointI]*(N[pointI]&result[patchPoints[pointI]]); + } + } + } + result /= mag(result); } diff --git a/src/finiteArea/faMesh/faPatches/constraint/symmetry/symmetryFaPatch.C b/src/finiteArea/faMesh/faPatches/constraint/symmetry/symmetryFaPatch.C index 3027dab7b..285f6ddf8 100644 --- a/src/finiteArea/faMesh/faPatches/constraint/symmetry/symmetryFaPatch.C +++ b/src/finiteArea/faMesh/faPatches/constraint/symmetry/symmetryFaPatch.C @@ -50,6 +50,19 @@ void symmetryFaPatch::makeCorrVecs(vectorField& cv) const // * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * // +// Construct from components +symmetryFaPatch::symmetryFaPatch +( + const word& name, + const labelList& edgeLabels, + const label index, + const faBoundaryMesh& bm, + const label ngbPolyPatchIndex +) +: + faPatch(name, edgeLabels, index, bm, ngbPolyPatchIndex) +{} + //- Construct from dictionary symmetryFaPatch::symmetryFaPatch ( diff --git a/src/finiteArea/faMesh/faPatches/constraint/symmetry/symmetryFaPatch.H b/src/finiteArea/faMesh/faPatches/constraint/symmetry/symmetryFaPatch.H index d3b52b8f4..62211b265 100644 --- a/src/finiteArea/faMesh/faPatches/constraint/symmetry/symmetryFaPatch.H +++ b/src/finiteArea/faMesh/faPatches/constraint/symmetry/symmetryFaPatch.H @@ -69,6 +69,16 @@ public: // Constructors + //- Construct from components + symmetryFaPatch + ( + const word& name, + const labelList& edgeLabels, + const label index, + const faBoundaryMesh& bm, + const label ngbPolyPatchIndex + ); + //- Construct from dictionary symmetryFaPatch ( @@ -78,6 +88,25 @@ public: const faBoundaryMesh& bm ); + //- Construct and return a clone, resetting the edge list + // and boundary mesh + virtual autoPtr clone + ( + const faBoundaryMesh& bm, + const labelList& edgeLabels, + const label index, + const label ngbPolyPatchIndex + ) const + { + return autoPtr + ( + new symmetryFaPatch + ( + name(), edgeLabels, index, bm, ngbPolyPatchIndex + ) + ); + } + // Destructor virtual ~symmetryFaPatch() diff --git a/tutorials/basic/potentialFoam/cylinder/constant/polyMesh/boundary b/tutorials/basic/potentialFoam/cylinder/constant/polyMesh/boundary index dce655917..d1fbb8940 100644 --- a/tutorials/basic/potentialFoam/cylinder/constant/polyMesh/boundary +++ b/tutorials/basic/potentialFoam/cylinder/constant/polyMesh/boundary @@ -1,9 +1,9 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.6 | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | +| \\ / O peration | Version: 1.5-dev | +| \\ / A nd | Revision: 1842 | +| \\/ M anipulation | Web: http://www.OpenFOAM.org | \*---------------------------------------------------------------------------*/ FoamFile {