diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H index 3b94c89e315277bcb6447a1f2a876a4dfd4c0e28..0968002e55d2d4fbba0cea2001629784b69ba5a6 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H @@ -12,7 +12,4 @@ tmp<volScalarField> tkappa = thermo.kappa(); const volScalarField& kappa = tkappa(); - //tmp<volSymmTensorField> tkappa = thermo.directionalKappa(); - //const volSymmTensorField& kappa = tkappa(); - volScalarField& h = thermo.he(); diff --git a/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C b/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C index f852c06ec41db5a2e3700a6791e7b07e3ebd1f26..139aa65f9b3f69129bb1e52239da04454b70d4b5 100644 --- a/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C +++ b/applications/utilities/mesh/conversion/star3ToFoam/createCoupleMatches.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -123,7 +123,7 @@ void starMesh::createCoupleMatches() cellRemovedFaces.insert ( fp.masterCell(), - fp.masterFace() + SLList<label>(fp.masterFace()) ); } else @@ -1362,7 +1362,7 @@ void starMesh::createCoupleMatches() cellRemovedFaces.insert ( fp.masterCell(), - fp.masterFace() + SLList<label>(fp.masterFace()) ); } else @@ -1378,7 +1378,7 @@ void starMesh::createCoupleMatches() cellRemovedFaces.insert ( fp.slaveCell(), - fp.slaveFace() + SLList<label>(fp.slaveFace()) ); } else diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index d99171907165810616b5add1936234603cbfd029..9080f58e670beb940e62e2c83a49fb9f20de3e18 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -179,18 +179,19 @@ int main(int argc, char *argv[]) // Read decomposePar dictionary dictionary decomposeDict; { - IOobject io - ( - "decomposeParDict", - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ); - - if (io.headerOk()) + if (Pstream::parRun()) { - decomposeDict = IOdictionary(io); + decomposeDict = IOdictionary + ( + IOobject + ( + "decomposeParDict", + runTime.system(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ); } else { diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index 1f58d59ddee437f838f92bd7905cd044ec58232c..be90a8fb80eb85a7dc22cbdfced7592b08c761d8 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -95,11 +95,12 @@ FoamFile // type hex; // hex/wedge/prism/pyr/tet/tetWedge/splitHex // } // -// // Cells with cell centre within box +// // Cells with cell centre within box ('box') or multiple boxes ('boxes') // source boxToCell; // sourceInfo // { // box (0 0 0) (1 1 1); +// //boxes ((0 0 0) (1 1 1) (10 10 10)(11 11 11)); // } // // // Cells with cell centre within box @@ -170,6 +171,15 @@ FoamFile // insidePoint (1 2 3); // point inside region to select // } // +// // Cells underneath plane such that volume is reached. Can be used +// // in setFields. +// source targetVolumeToCell; +// sourceInfo +// { +// volume 2e-05; +// normal (1 1 1); +// } +// // // // faceSet @@ -223,11 +233,12 @@ FoamFile // name ".*Zone1"; // Name of faceZone, regular expressions allowed // } // -// // Faces with face centre within box +// // Faces with face centre within box ('box') or multiple boxes ('boxes') // source boxToFace; // sourceInfo // { // box (0 0 0) (1 1 1); +// //boxes ((0 0 0) (1 1 1) (10 10 10)(11 11 11)); // } // // // Faces with normal to within certain angle aligned with vector. @@ -295,11 +306,12 @@ FoamFile // points ((0 0 0) (1 1 1)); // } // -// // Points with coordinate within box +// // Points with coordinate within box ('box') or multiple boxes ('boxes') // source boxToPoint; // sourceInfo // { // box (0 0 0) (1 1 1); +// //boxes ((0 0 0) (1 1 1) (10 10 10)(11 11 11)); // } // // // Select based on surface diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index b3270edb6b8e03c3942da961097befe57dee57d1..b383a6efe3d6f07576df236a33415dda2b3a380c 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -122,7 +122,8 @@ structuredCoeffs patches (bottomPatch); } -//// Is the case distributed +//// Is the case distributed? Note: command-line argument -roots takes +//// precedence //distributed yes; //// Per slave (so nProcs-1 entries) the directory above the case. //roots diff --git a/src/OpenFOAM/containers/LinkedLists/user/SLList.H b/src/OpenFOAM/containers/LinkedLists/user/SLList.H index 2b88b5eff01110c7a8e9fa7bd6b5f20a0954fe32..6cb3d6ac6251336c9c62d0ef8f2eda8429a85be6 100644 --- a/src/OpenFOAM/containers/LinkedLists/user/SLList.H +++ b/src/OpenFOAM/containers/LinkedLists/user/SLList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,13 +59,13 @@ public: {} //- Construct given initial T - SLList(T a) + explicit SLList(T a) : LList<SLListBase, T>(a) {} //- Construct from Istream - SLList(Istream& is) + explicit SLList(Istream& is) : LList<SLListBase, T>(is) {} diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H index 43c398bbf19f9526e3fce45fed958fe916ed18e8..f734409d0936ce04ed4fc488bbcacad139a1667a 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H +++ b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresGrad.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -85,7 +85,7 @@ public: gradScheme<Type>(mesh), minDet_(readScalar(schemeData)) { - if (minDet_ < 0 || minDet_ > 8) + if (minDet_ < 0) //-for facearea weighted: || minDet_ > 8) { FatalIOErrorIn ( @@ -93,7 +93,7 @@ public: "(const fvMesh&, Istream& schemeData)", schemeData ) << "Minimum determinant = " << minDet_ - << " should be >= 0 and <= 8" + << " should be >= 0" // and <= 8" << exit(FatalIOError); } } diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C index e9ecd484c357eefbedcc9df9bbbf73af7314c316..254038b3fa5dcd999de33a42c31bdf44465d9400 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C @@ -138,7 +138,7 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const else if (nDims == 2) { Info<< "extendedLeastSquares : detected " << nDims - << " valid directions. Missing direction " << twoD << nl << endl; + << " valid directions. Missing direction " << twoD << endl; } @@ -207,6 +207,7 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const << "min(detdd) = " << min(detdd) << nl << "average(detdd) = " << average(detdd) << endl; + label nAdaptedCells = 0; label nAddCells = 0; label maxNaddCells = 4*detdd.size(); additionalCellsPtr_ = new List<labelPair>(maxNaddCells); @@ -216,6 +217,8 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const { label count = 0; + label oldNAddCells = nAddCells; + while (++count < 100 && detdd[i] < minDet_) { if (nAddCells == maxNaddCells) @@ -305,16 +308,24 @@ void Foam::extendedLeastSquaresVectors::makeLeastSquaresVectors() const detdd[i] = det(dd[i]); } } + + if (oldNAddCells < nAddCells) + { + nAdaptedCells++; + } } additionalCells_.setSize(nAddCells); reduce(nAddCells, sumOp<label>()); + reduce(nAdaptedCells, sumOp<label>()); if (nAddCells) { Info<< "max(detdd) = " << max(detdd) << nl << "min(detdd) = " << min(detdd) << nl << "average(detdd) = " << average(detdd) << nl + << "nAdapted/nCells = " + << scalar(nAdaptedCells)/mesh.globalData().nTotalCells() << nl << "nAddCells/nCells = " << scalar(nAddCells)/mesh.globalData().nTotalCells() << endl; diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index 4abc57669ebf212139abd71a21710d3b9fcbfc00..2621adbc235f55c1d4ae65bd5ae9e937abf05afb 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -99,6 +99,7 @@ $(cellSources)/sphereToCell/sphereToCell.C $(cellSources)/cylinderToCell/cylinderToCell.C $(cellSources)/faceZoneToCell/faceZoneToCell.C $(cellSources)/cylinderAnnulusToCell/cylinderAnnulusToCell.C +$(cellSources)/targetVolumeToCell/targetVolumeToCell.C faceSources = sets/faceSources $(faceSources)/faceToFace/faceToFace.C diff --git a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C index 58f62f93d7f904b26c0c882fe6842a515a53c6e3..28bec358bc1bd83f7bb07bd1a1ed64c7caabc3bb 100644 --- a/src/meshTools/sets/cellSources/boxToCell/boxToCell.C +++ b/src/meshTools/sets/cellSources/boxToCell/boxToCell.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,9 +58,13 @@ void Foam::boxToCell::combine(topoSet& set, const bool add) const forAll(ctrs, cellI) { - if (bb_.contains(ctrs[cellI])) + forAll(bbs_, i) { - addOrDelete(set, cellI, add); + if (bbs_[i].contains(ctrs[cellI])) + { + addOrDelete(set, cellI, add); + break; + } } } } @@ -72,11 +76,11 @@ void Foam::boxToCell::combine(topoSet& set, const bool add) const Foam::boxToCell::boxToCell ( const polyMesh& mesh, - const treeBoundBox& bb + const treeBoundBoxList& bbs ) : topoSetSource(mesh), - bb_(bb) + bbs_(bbs) {} @@ -88,7 +92,12 @@ Foam::boxToCell::boxToCell ) : topoSetSource(mesh), - bb_(dict.lookup("box")) + bbs_ + ( + dict.found("box") + ? treeBoundBoxList(1, treeBoundBox(dict.lookup("box"))) + : dict.lookup("boxes") + ) {} @@ -100,7 +109,7 @@ Foam::boxToCell::boxToCell ) : topoSetSource(mesh), - bb_(checkIs(is)) + bbs_(1, treeBoundBox(checkIs(is))) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -119,13 +128,13 @@ void Foam::boxToCell::applyToSet { if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) { - Info<< " Adding cells with center within box " << bb_ << endl; + Info<< " Adding cells with center within boxes " << bbs_ << endl; combine(set, true); } else if (action == topoSetSource::DELETE) { - Info<< " Removing cells with center within box " << bb_ << endl; + Info<< " Removing cells with center within boxes " << bbs_ << endl; combine(set, false); } diff --git a/src/meshTools/sets/cellSources/boxToCell/boxToCell.H b/src/meshTools/sets/cellSources/boxToCell/boxToCell.H index ee1d0deb12edcfa28c571e87004619eaefc94843..488ceb934f12821f904dc8003734ff2e61289454 100644 --- a/src/meshTools/sets/cellSources/boxToCell/boxToCell.H +++ b/src/meshTools/sets/cellSources/boxToCell/boxToCell.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::boxToCell Description - A topoSetSource to select cells based on cell centres inside box. + A topoSetSource to select cells based on cell centres inside box(es). SourceFiles boxToCell.C @@ -36,7 +36,7 @@ SourceFiles #define boxToCell_H #include "topoSetSource.H" -#include "treeBoundBox.H" +#include "treeBoundBoxList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,7 +59,7 @@ class boxToCell //- bounding box. - treeBoundBox bb_; + treeBoundBoxList bbs_; // Private Member Functions @@ -78,7 +78,7 @@ public: boxToCell ( const polyMesh& mesh, - const treeBoundBox& bb + const treeBoundBoxList& bbs ); //- Construct from dictionary diff --git a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C new file mode 100644 index 0000000000000000000000000000000000000000..c64c29e1e6eb62aaf4bdb825f1bac03e2447f2fa --- /dev/null +++ b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.C @@ -0,0 +1,328 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "targetVolumeToCell.H" +#include "polyMesh.H" +#include "globalMeshData.H" +#include "plane.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(targetVolumeToCell, 0); + +addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, word); + +addToRunTimeSelectionTable(topoSetSource, targetVolumeToCell, istream); + +} + + +Foam::topoSetSource::addToUsageTable Foam::targetVolumeToCell::usage_ +( + targetVolumeToCell::typeName, + "\n Usage: targetVolumeToCell (nx ny nz)\n\n" + " Adjust plane until obtained selected volume\n\n" +); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::scalar Foam::targetVolumeToCell::volumeOfSet +( + const PackedBoolList& selected +) const +{ + scalar sumVol = 0.0; + forAll(selected, cellI) + { + if (selected[cellI]) + { + sumVol += mesh_.cellVolumes()[cellI]; + } + } + return returnReduce(sumVol, sumOp<scalar>()); +} + + +Foam::label Foam::targetVolumeToCell::selectCells +( + const scalar normalComp, + PackedBoolList& selected +) const +{ + selected.setSize(mesh_.nCells()); + selected = false; + + label nSelected = 0; + + forAll(mesh_.cellCentres(), cellI) + { + const point& cc = mesh_.cellCentres()[cellI]; + + if ((cc&n_) < normalComp) + { + selected[cellI] = true; + nSelected++; + } + } + return returnReduce(nSelected, sumOp<label>()); +} + + +void Foam::targetVolumeToCell::combine(topoSet& set, const bool add) const +{ + if (vol_ <= 0) + { + // Select no cells + return; + } + else if (gSum(mesh_.cellVolumes()) < vol_) + { + // Select all cells + forAll(mesh_.cellVolumes(), cellI) + { + addOrDelete(set, cellI, add); + } + return; + } + + + // Get plane for min,max volume. + // Planes all have base (0 0 0) and fixed normal so work only on normal + // component. + + scalar maxComp = -GREAT; + label maxCells = 0; + scalar maxVol = 0; + scalar minComp = GREAT; + { + const boundBox& bb = mesh_.bounds(); + pointField points(bb.points()); + + label minPointI = -1; + label maxPointI = -1; + forAll(points, pointI) + { + scalar c = (points[pointI]&n_); + if (c > maxComp) + { + maxComp = c; + maxPointI = pointI; + } + else if (c < minComp) + { + minComp = c; + minPointI = pointI; + } + } + + PackedBoolList maxSelected(mesh_.nCells()); + maxCells = selectCells(maxComp, maxSelected); + maxVol = volumeOfSet(maxSelected); + + // Check that maxPoint indeed selects all cells + if (maxCells != mesh_.globalData().nTotalCells()) + { + WarningIn("targetVolumeToCell::combine(topoSet&, const bool) const") + << "Plane " << plane(points[maxPointI], n_) + << " selects " << maxCells + << " cells instead of all " << mesh_.globalData().nTotalCells() + << " cells. Results might be wrong." << endl; + } + } + + + + // Bisection + // ~~~~~~~~~ + + PackedBoolList selected(mesh_.nCells()); + label nSelected = -1; + scalar selectedVol = 0.0; + scalar selectedComp = 0.0; + + + scalar low = minComp; + scalar high = maxComp; + + const scalar tolerance = SMALL*100*(maxComp-minComp); + + while ((high-low) > tolerance) + { + scalar mid = 0.5*(low + high); + + nSelected = selectCells(mid, selected); + selectedVol = volumeOfSet(selected); + + //Pout<< "High:" << high << " low:" << low << " mid:" << mid << nl + // << " nSelected:" << nSelected << nl + // << " vol :" << selectedVol << nl + // << endl; + + if (selectedVol < vol_) + { + low = mid; + + PackedBoolList highSelected(mesh_.nCells()); + label nHigh = selectCells(high, selected); + if (nSelected == nHigh) + { + break; + } + } + else + { + high = mid; + + PackedBoolList lowSelected(mesh_.nCells()); + label nLow = selectCells(low, selected); + if (nSelected == nLow) + { + break; + } + } + } + + nSelected = selectCells(high, selected); + selectedVol = volumeOfSet(selected); + + if (selectedVol < vol_) + { + selectedComp = high; + } + else + { + nSelected = selectCells(low, selected); + selectedVol = volumeOfSet(selected); + + if (selectedVol < vol_) + { + selectedComp = low; + } + else + { + WarningIn("targetVolumeToCell::combine(topoSet&, const bool) const") + << "Did not converge onto plane. " << nl + << "high plane:" + << plane(high*n_, n_) + << nl + << "low plane :" + << plane(low*n_, n_) + << endl; + } + } + + + Info<< " Selected " << nSelected << " with actual volume " << selectedVol + << endl; + + forAll(selected, cellI) + { + if (selected[cellI]) + { + addOrDelete(set, cellI, add); + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +Foam::targetVolumeToCell::targetVolumeToCell +( + const polyMesh& mesh, + const scalar vol, + const vector& n +) +: + topoSetSource(mesh), + vol_(vol), + n_(n) +{} + + +// Construct from dictionary +Foam::targetVolumeToCell::targetVolumeToCell +( + const polyMesh& mesh, + const dictionary& dict +) +: + topoSetSource(mesh), + vol_(readScalar(dict.lookup("volume"))), + n_(dict.lookup("normal")) +{} + + +// Construct from Istream +Foam::targetVolumeToCell::targetVolumeToCell +( + const polyMesh& mesh, + Istream& is +) +: + topoSetSource(mesh), + vol_(readScalar(checkIs(is))), + n_(checkIs(is)) +{} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::targetVolumeToCell::~targetVolumeToCell() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::targetVolumeToCell::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding cells up to target volume " << vol_ + << " out of total volume " << gSum(mesh_.cellVolumes()) << endl; + + combine(set, true); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing cells up to target volume " << vol_ + << " out of total volume " << gSum(mesh_.cellVolumes()) << endl; + + combine(set, false); + } +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.H b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.H new file mode 100644 index 0000000000000000000000000000000000000000..398e49c9f92ee1e07a1cf91d4238dc444cec8237 --- /dev/null +++ b/src/meshTools/sets/cellSources/targetVolumeToCell/targetVolumeToCell.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::targetVolumeToCell + +Description + A topoSetSource to select cells based on the wanted volume of selected + cells. Adapts a plane until it has enough. + +SourceFiles + targetVolumeToCell.C + +\*---------------------------------------------------------------------------*/ + +#ifndef targetVolumeToCell_H +#define targetVolumeToCell_H + +#include "topoSetSource.H" +//#include "plane.H" +#include "PackedBoolList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class targetVolumeToCell Declaration +\*---------------------------------------------------------------------------*/ + +class targetVolumeToCell +: + public topoSetSource +{ + + // Private data + + //- Add usage string + static addToUsageTable usage_; + + //- Wanted volume + const scalar vol_; + + //- Normal of plane to sweep + vector n_; + //plane pl_; + + + // Private Member Functions + + scalar volumeOfSet(const PackedBoolList&) const; + + label selectCells + ( + const scalar normalComp, + PackedBoolList& selected + ) const; + + void combine(topoSet& set, const bool add) const; + + +public: + + //- Runtime type information + TypeName("targetVolumeToCell"); + + // Constructors + + //- Construct from components + targetVolumeToCell + ( + const polyMesh& mesh, + const scalar vol, + //const plane& + const vector& + ); + + //- Construct from dictionary + targetVolumeToCell + ( + const polyMesh& mesh, + const dictionary& dict + ); + + //- Construct from Istream + targetVolumeToCell + ( + const polyMesh& mesh, + Istream& + ); + + + //- Destructor + virtual ~targetVolumeToCell(); + + + // Member Functions + + virtual sourceType setType() const + { + return CELLSETSOURCE; + } + + virtual void applyToSet + ( + const topoSetSource::setAction action, + topoSet& + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C index f46c1dd0b2cf9c04d2f6346ccdbce614f1c4e0d2..698bb5c311e262934e3256157774591ae3925fc0 100644 --- a/src/meshTools/sets/faceSources/boxToFace/boxToFace.C +++ b/src/meshTools/sets/faceSources/boxToFace/boxToFace.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,9 +58,13 @@ void Foam::boxToFace::combine(topoSet& set, const bool add) const forAll(ctrs, faceI) { - if (bb_.contains(ctrs[faceI])) + forAll(bbs_, i) { - addOrDelete(set, faceI, add); + if (bbs_[i].contains(ctrs[faceI])) + { + addOrDelete(set, faceI, add); + break; + } } } } @@ -72,11 +76,11 @@ void Foam::boxToFace::combine(topoSet& set, const bool add) const Foam::boxToFace::boxToFace ( const polyMesh& mesh, - const treeBoundBox& bb + const treeBoundBoxList& bbs ) : topoSetSource(mesh), - bb_(bb) + bbs_(bbs) {} @@ -88,7 +92,12 @@ Foam::boxToFace::boxToFace ) : topoSetSource(mesh), - bb_(dict.lookup("box")) + bbs_ + ( + dict.found("box") + ? treeBoundBoxList(1, treeBoundBox(dict.lookup("box"))) + : dict.lookup("boxes") + ) {} @@ -100,7 +109,7 @@ Foam::boxToFace::boxToFace ) : topoSetSource(mesh), - bb_(checkIs(is)) + bbs_(1, treeBoundBox(checkIs(is))) {} @@ -120,13 +129,13 @@ void Foam::boxToFace::applyToSet { if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) { - Info<< " Adding faces with centre within box " << bb_ << endl; + Info<< " Adding faces with centre within boxes " << bbs_ << endl; combine(set, true); } else if (action == topoSetSource::DELETE) { - Info<< " Removing faces with centre within box " << bb_ << endl; + Info<< " Removing faces with centre within boxes " << bbs_ << endl; combine(set, false); } diff --git a/src/meshTools/sets/faceSources/boxToFace/boxToFace.H b/src/meshTools/sets/faceSources/boxToFace/boxToFace.H index 16685861ea82014091cb31a6a535fe4d64306d79..056dbac11878b9f118eaaaf8492906c61567ab07 100644 --- a/src/meshTools/sets/faceSources/boxToFace/boxToFace.H +++ b/src/meshTools/sets/faceSources/boxToFace/boxToFace.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,7 @@ SourceFiles #define boxToFace_H #include "topoSetSource.H" -#include "treeBoundBox.H" +#include "treeBoundBoxList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,7 +58,7 @@ class boxToFace static addToUsageTable usage_; //- bounding box. - treeBoundBox bb_; + treeBoundBoxList bbs_; // Private Member Functions @@ -77,7 +77,7 @@ public: boxToFace ( const polyMesh& mesh, - const treeBoundBox& bb + const treeBoundBoxList& bbs ); //- Construct from dictionary diff --git a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C index 56975ded6eeeeb8871d06cd858334457c2ef5359..53bb9b41fed7563597ae644657769bd54f5dac25 100644 --- a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C +++ b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,9 +58,12 @@ void Foam::boxToPoint::combine(topoSet& set, const bool add) const forAll(pts, pointI) { - if (bb_.contains(pts[pointI])) + forAll(bbs_, i) { - addOrDelete(set, pointI, add); + if (bbs_[i].contains(pts[pointI])) + { + addOrDelete(set, pointI, add); + } } } } @@ -72,11 +75,11 @@ void Foam::boxToPoint::combine(topoSet& set, const bool add) const Foam::boxToPoint::boxToPoint ( const polyMesh& mesh, - const treeBoundBox& bb + const treeBoundBoxList& bbs ) : topoSetSource(mesh), - bb_(bb) + bbs_(bbs) {} @@ -88,7 +91,12 @@ Foam::boxToPoint::boxToPoint ) : topoSetSource(mesh), - bb_(dict.lookup("box")) + bbs_ + ( + dict.found("box") + ? treeBoundBoxList(1, treeBoundBox(dict.lookup("box"))) + : dict.lookup("boxes") + ) {} @@ -100,7 +108,7 @@ Foam::boxToPoint::boxToPoint ) : topoSetSource(mesh), - bb_(checkIs(is)) + bbs_(1, treeBoundBox(checkIs(is))) {} @@ -120,14 +128,14 @@ void Foam::boxToPoint::applyToSet { if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) { - Info<< " Adding points that are within box " << bb_ << " ..." + Info<< " Adding points that are within boxes " << bbs_ << " ..." << endl; combine(set, true); } else if (action == topoSetSource::DELETE) { - Info<< " Removing points that are within box " << bb_ << " ..." + Info<< " Removing points that are within boxes " << bbs_ << " ..." << endl; combine(set, false); diff --git a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H index d40eb2e052d2491ddbfa83d44e220b6e57e807ea..e5f5cfc5599cc977fdbe6f221340a9bdb77ef6c8 100644 --- a/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H +++ b/src/meshTools/sets/pointSources/boxToPoint/boxToPoint.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,7 @@ SourceFiles #define boxToPoint_H #include "topoSetSource.H" -#include "treeBoundBox.H" +#include "treeBoundBoxList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,7 +58,7 @@ class boxToPoint static addToUsageTable usage_; //- bounding box. - treeBoundBox bb_; + treeBoundBoxList bbs_; // Private Member Functions @@ -77,7 +77,7 @@ public: boxToPoint ( const polyMesh& mesh, - const treeBoundBox& bb + const treeBoundBoxList& bb ); //- Construct from dictionary diff --git a/tutorials/incompressible/icoFoam/cavity/constant/polyMesh/boundary b/tutorials/incompressible/icoFoam/cavity/constant/polyMesh/boundary deleted file mode 100644 index 61feadd97403fbf58a57c925fc262f3de46ec95a..0000000000000000000000000000000000000000 --- a/tutorials/incompressible/icoFoam/cavity/constant/polyMesh/boundary +++ /dev/null @@ -1,40 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class polyBoundaryMesh; - location "constant/polyMesh"; - object boundary; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -3 -( - movingWall - { - type wall; - nFaces 20; - startFace 760; - } - fixedWalls - { - type wall; - nFaces 60; - startFace 780; - } - frontAndBack - { - type empty; - nFaces 800; - startFace 840; - } -) - -// ************************************************************************* // diff --git a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict index feb4f2f871c001855b7ad3212f00677c0d57bede..66499680bde7bf4ae915624bbf562fb0351925b2 100644 --- a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict +++ b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict @@ -292,7 +292,7 @@ meshQualityControls // <0 = inside out tet, // 0 = flat tet // 1 = regular tet - minTetQuality 1e-30; + minTetQuality 1e-9; //- Minimum face area. Set to <0 to disable. minArea -1; diff --git a/wmake/rules/linux64Icc/c b/wmake/rules/linux64Icc/c index 08ea0f8049ef07e00b1f00af8f11616383492907..1085d50498d3fb5e5aeab451a90bdbb5b4d8fa83 100644 --- a/wmake/rules/linux64Icc/c +++ b/wmake/rules/linux64Icc/c @@ -13,4 +13,4 @@ ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@ LINK_LIBS = $(cDBUG) -L$(IA32ROOT)/lib LINKLIBSO = $(cc) $(cFLAGS) -shared -LINKEXE = $(cc) $(cFLAGS) +LINKEXE = $(cc) $(cFLAGS) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs diff --git a/wmake/rules/linux64Icc/c++ b/wmake/rules/linux64Icc/c++ index 5ad41fd9b49fba4ce7fbc2dca54e09c1bfd3eb81..dfad97cee6182ea4cc4a82428f00de37b5342514 100644 --- a/wmake/rules/linux64Icc/c++ +++ b/wmake/rules/linux64Icc/c++ @@ -17,5 +17,5 @@ cpptoo = $(Ctoo) LINK_LIBS = $(c++DBUG) -L$(IA64ROOT)/lib -LINKLIBSO = $(CC) $(c++FLAGS) -shared -LINKEXE = $(CC) $(c++FLAGS) +LINKLIBSO = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed +LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed diff --git a/wmake/rules/linuxIcc/c b/wmake/rules/linuxIcc/c index 269eeaba47f37947712379112a41e8fc20b66de9..e8059d9dbb79c4081d103a53d3233efc01f93ee0 100644 --- a/wmake/rules/linuxIcc/c +++ b/wmake/rules/linuxIcc/c @@ -13,4 +13,4 @@ ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@ LINK_LIBS = $(cDBUG) -L$(IA32ROOT)/lib LINKLIBSO = $(cc) $(cFLAGS) -shared -LINKEXE = $(cc) $(cFLAGS) +LINKEXE = $(cc) $(cFLAGS) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs diff --git a/wmake/rules/linuxIcc/c++ b/wmake/rules/linuxIcc/c++ index 409e289014c83697adb49d78b5cdd1ad65a0adab..d06a874848504e101193730eee12ff9a7d2a1402 100644 --- a/wmake/rules/linuxIcc/c++ +++ b/wmake/rules/linuxIcc/c++ @@ -19,5 +19,5 @@ cpptoo = $(Ctoo) #LINK_LIBS = $(c++DBUG) -lstdc++ LINK_LIBS = $(c++DBUG) -L$(IA32ROOT)/lib -LINKLIBSO = $(CC) $(c++FLAGS) -shared -LINKEXE = $(CC) $(c++FLAGS) +LINKLIBSO = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed +LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed