From: henry Date: Mon, 8 Jun 2009 16:41:32 +0000 (+0100) Subject: Added support for compressible and multiphase momentum equations. X-Git-Url: https://repo.or.cz/w/OpenFOAM-1.5.x.git/commitdiff_plain/6c35f32ce6ed2cb0819abad9aa8082037f74934e Added support for compressible and multiphase momentum equations. --- diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index 8b689d0..3618d87 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,53 +32,96 @@ License #include "syncTools.H" #include "faceSet.H" +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::MRFZone, 0); + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::MRFZone::setMRFFaces -( - labelList& faceType, - const labelList& excludedPatchIDs -) +void Foam::MRFZone::setMRFFaces() { const polyBoundaryMesh& patches = mesh_.boundaryMesh(); - // Knock out coupled patches - forAll(patches, patchi) + // Type per face: + // 0:not in zone + // 1:moving with frame + // 2:other + labelList faceType(mesh_.nFaces(), 0); + + // Determine faces in cell zone + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // (without constructing cells) + + const labelList& own = mesh_.faceOwner(); + const labelList& nei = mesh_.faceNeighbour(); + + // Cells in zone + boolList zoneCell(mesh_.nCells(), false); + + if (cellZoneID_ != -1) { - if (patches[patchi].coupled()) + const labelList& cellLabels = mesh_.cellZones()[cellZoneID_]; + forAll(cellLabels, i) { - const polyPatch& pp = patches[patchi]; + zoneCell[cellLabels[i]] = true; + } + } - forAll(pp, j) - { - label faceI = pp.start()+j; - if (faceType[faceI] == 1) - { - faceType[faceI] = 2; - } - } + label nZoneFaces = 0; + + for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) + { + if (zoneCell[own[faceI]] || zoneCell[nei[faceI]]) + { + faceType[faceI] = 1; + nZoneFaces++; } } - // All explicitly provided exclusions - forAll(excludedPatchIDs, i) + + labelHashSet excludedPatches(excludedPatchLabels_); + + forAll(patches, patchI) { - const polyPatch& pp = patches[excludedPatchIDs[i]]; + const polyPatch& pp = patches[patchI]; - forAll(pp, j) + if (pp.coupled() || excludedPatches.found(patchI)) { - label faceI = pp.start()+j; + forAll(pp, i) + { + label faceI = pp.start()+i; - if (faceType[faceI] == 1) + if (zoneCell[own[faceI]]) + { + faceType[faceI] = 2; + nZoneFaces++; + } + } + } + else if (!isA(pp)) + { + forAll(pp, i) { - faceType[faceI] = 2; + label faceI = pp.start()+i; + + if (zoneCell[own[faceI]]) + { + faceType[faceI] = 1; + nZoneFaces++; + } } } } - // Collect into lists per patch. + // Now we have for faceType: + // 0 : face not in cellZone + // 1 : internal face or normal patch face + // 2 : coupled patch face or excluded patch face + + // Sort into lists per patch. + internalFaces_.setSize(mesh_.nFaces()); label nInternal = 0; @@ -142,149 +185,43 @@ void Foam::MRFZone::setMRFFaces } } - //if (debug) - //{ - // faceSet internalFaces(mesh_, "internalFaces", internalFaces_); - // Pout<< "Writing internal faces in MRF zone to faceSet " - // << internalFaces.name() << endl; - // internalFaces.write(); - //} - //{ - // faceSet MRFFaces(mesh_, "includedFaces", 100); - // forAll(includedFaces_, patchi) - // { - // forAll(includedFaces_[patchi], i) - // { - // label patchFacei = includedFaces_[patchi][i]; - // MRFFaces.insert(patches[patchi].start()+patchFacei); - // } - // } - // Pout<< "Writing patch faces in MRF zone to faceSet " - // << MRFFaces.name() << endl; - // MRFFaces.write(); - //} - //{ - // faceSet excludedFaces(mesh_, "excludedFaces", 100); - // forAll(excludedFaces_, patchi) - // { - // forAll(excludedFaces_[patchi], i) - // { - // label patchFacei = excludedFaces_[patchi][i]; - // excludedFaces.insert(patches[patchi].start()+patchFacei); - // } - // } - // Pout<< "Writing faces in MRF zone with special handling to faceSet " - // << excludedFaces.name() << endl; - // excludedFaces.write(); - //} -} - - -void Foam::MRFZone::setMRFFaces() -{ - const polyBoundaryMesh& patches = mesh_.boundaryMesh(); - - // Type per face: - // 0:not in zone - // 1:moving with frame - // 2:other - labelList faceType(mesh_.nFaces(), 0); - - bool faceZoneFound = (faceZoneID_ != -1); - reduce(faceZoneFound, orOp()); - if (faceZoneFound) + if (debug) { - // Explicitly provided faces. - if (faceZoneID_ != -1) + faceSet internalFaces(mesh_, "internalFaces", internalFaces_); + Pout<< "Writing " << internalFaces.size() + << " internal faces in MRF zone to faceSet " + << internalFaces.name() << endl; + internalFaces.write(); + + faceSet MRFFaces(mesh_, "includedFaces", 100); + forAll(includedFaces_, patchi) { - const labelList& zoneFaces = mesh_.faceZones()[faceZoneID_]; - - forAll(zoneFaces, i) - { - faceType[zoneFaces[i]] = 1; - } - - if (allPatchesMove_) + forAll(includedFaces_[patchi], i) { - // Explicitly provided patches that do not move - setMRFFaces(faceType, patchLabels_); - } - else - { - setMRFFaces(faceType, labelList(0)); + label patchFacei = includedFaces_[patchi][i]; + MRFFaces.insert(patches[patchi].start()+patchFacei); } } - } - else - { - // Determine faces in cell zone - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // (without constructing cells) - - const labelList& own = mesh_.faceOwner(); - const labelList& nei = mesh_.faceNeighbour(); - - // Cells in zone - boolList zoneCell(mesh_.nCells(), false); + Pout<< "Writing " << MRFFaces.size() + << " patch faces in MRF zone to faceSet " + << MRFFaces.name() << endl; + MRFFaces.write(); - if (cellZoneID_ != -1) + faceSet excludedFaces(mesh_, "excludedFaces", 100); + forAll(excludedFaces_, patchi) { - const labelList& cellLabels = mesh_.cellZones()[cellZoneID_]; - forAll(cellLabels, i) + forAll(excludedFaces_[patchi], i) { - zoneCell[cellLabels[i]] = true; + label patchFacei = excludedFaces_[patchi][i]; + excludedFaces.insert(patches[patchi].start()+patchFacei); } } - - - label nZoneFaces = 0; - - for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) - { - if (zoneCell[own[faceI]] || zoneCell[nei[faceI]]) - { - faceType[faceI] = 1; - nZoneFaces++; - } - } - forAll(patches, patchI) - { - const polyPatch& pp = patches[patchI]; - - if (!isA(pp)) - { - forAll(pp, i) - { - label faceI = pp.start()+i; - - if (zoneCell[own[faceI]]) - { - faceType[faceI] = 1; - nZoneFaces++; - } - } - } - } - syncTools::syncFaceList(mesh_, faceType, maxEqOp