diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C index a4f5773bfa..d2b6b6ba2a 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,7 @@ namespace Foam // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::actuationDiskSource::checkData() +void Foam::actuationDiskSource::checkData() const { if (magSqr(diskArea_) <= VSMALL) { @@ -74,7 +74,6 @@ Foam::actuationDiskSource::actuationDiskSource ) : basicSource(name, dict, mesh), - cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())), dict_(dict.subDict(typeName + "Coeffs")), diskDir_(dict_.lookup("diskDir")), Cp_(readScalar(dict_.lookup("Cp"))), @@ -84,20 +83,6 @@ Foam::actuationDiskSource::actuationDiskSource Info<< " - creating actuation disk zone: " << this->name() << endl; - bool foundZone = (cellZoneID_ != -1); - - reduce(foundZone, orOp()); - - if (!foundZone && Pstream::master()) - { - FatalErrorIn - ( - "Foam::actuationDiskSource::actuationDiskSource" - "(const word&, const dictionary&, const fvMesh&)" - ) << "cannot find porous cellZone " << this->name() - << exit(FatalError); - } - checkData(); } @@ -106,18 +91,12 @@ Foam::actuationDiskSource::actuationDiskSource void Foam::actuationDiskSource::addSu(fvMatrix& UEqn) { - if (cellZoneID_ == -1) - { - return; - } - bool compressible = false; if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0)) { compressible = true; } - const labelList& cells = mesh_.cellZones()[cellZoneID_]; const scalarField& V = this->mesh().V(); vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); @@ -127,7 +106,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix& UEqn) addActuationDiskAxialInertialResistance ( Usource, - cells, + cells_, V, this->mesh().lookupObject("rho"), U @@ -138,7 +117,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix& UEqn) addActuationDiskAxialInertialResistance ( Usource, - cells, + cells_, V, geometricOneField(), U @@ -149,7 +128,6 @@ void Foam::actuationDiskSource::addSu(fvMatrix& UEqn) void Foam::actuationDiskSource::writeData(Ostream& os) const { - os << indent << token::BEGIN_BLOCK << incrIndent << nl; os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H index 6b21973af3..9646a9641f 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,9 +71,6 @@ class actuationDiskSource { // Private data - //- Cell zone ID - label cellZoneID_; - //- Sub dictionary with actuationDisk information const dictionary& dict_; @@ -93,7 +90,7 @@ class actuationDiskSource // Private Member Functions //- Check data - void checkData(); + void checkData() const; //- Add resistance to the UEqn template @@ -139,12 +136,6 @@ public: // Access - //- cellZone number - label zoneId() const - { - return cellZoneID_; - } - //- Return Cp scalar Cp() const { @@ -178,15 +169,6 @@ public: //-Source term to fvMatrix virtual void addSu(fvMatrix& UEqn){} - //- Add all explicit source - virtual void addExplicitSources(){} - - //- Add source to scalar field - virtual void addSu(DimensionedField& field){} - - //- Add source to vector field - virtual void addSu(DimensionedField& field){} - // I-O diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C index a42ecd25f0..40f013b2d5 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,65 +39,32 @@ namespace Foam // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // -const Foam::wordList Foam::basicSource::selectionModeTypeNames_ -( - IStringStream("(points cellSet cellZone all)")() -); +template<> const char* Foam::NamedEnum +< + Foam::basicSource::selectionModeType, + 4 +>::names[] = +{ + "points", + "cellSet", + "cellZone", + "all" +}; + + +const Foam::NamedEnum + Foam::basicSource::selectionModeTypeNames_; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::basicSource::selectionModeType Foam::basicSource::wordToSelectionModeType -( - const word& smtName -) const -{ - forAll(selectionModeTypeNames_, i) - { - if (smtName == selectionModeTypeNames_[i]) - { - return selectionModeType(i); - } - } - - FatalErrorIn - ( - "basicSource::selectionModeType" - "basicSource::wordToSelectionModeType" - "(" - "const word&" - ")" - ) << "Unknown selectionMode type " << smtName - << ". Valid selectionMode types are:" << nl << selectionModeTypeNames_ - << exit(FatalError); - - return selectionModeType(0); -} - - -Foam::word Foam::basicSource::selectionModeTypeToWord -( - const selectionModeType& smtType -) const -{ - if (smtType > selectionModeTypeNames_.size()) - { - return "UNKNOWN"; - } - else - { - return selectionModeTypeNames_[smtType]; - } -} - - void Foam::basicSource::setSelection(const dictionary& dict) { switch (selectionMode_) { case smPoints: { - // Do nothing. It should be sorted out by derived class + dict.lookup("points") >> points_; break; } case smCellSet: @@ -135,6 +102,29 @@ void Foam::basicSource::setCellSet() { case smPoints: { + Info<< indent << "- selecting cells using points" << endl; + + labelHashSet selectedCells; + + forAll(points_, i) + { + label cellI = mesh_.findCell(points_[i]); + if (cellI >= 0) + { + selectedCells.insert(cellI); + } + + label globalCellI = returnReduce(cellI, maxOp