diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C index 33f7c5ada8..68f0c2a5bf 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C @@ -80,12 +80,14 @@ Foam::actuationDiskSource::actuationDiskSource ) : basicSource(name, modelType, dict, mesh), - fieldName_(coeffs_.lookup("fieldName")), diskDir_(coeffs_.lookup("diskDir")), Cp_(readScalar(coeffs_.lookup("Cp"))), Ct_(readScalar(coeffs_.lookup("Ct"))), diskArea_(readScalar(coeffs_.lookup("diskArea"))) { + coeffs_.lookup("fieldNames") >> fieldNames_; + applied_.setSize(fieldNames_.size(), false); + Info<< " - creating actuation disk zone: " << this->name() << endl; @@ -95,20 +97,6 @@ Foam::actuationDiskSource::actuationDiskSource // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::label Foam::actuationDiskSource::applyToField -( - const word& fieldName -) const -{ - if (fieldName == fieldName_) - { - return 0; - } - - return -1; -} - - void Foam::actuationDiskSource::addSup ( fvMatrix& eqn, @@ -150,8 +138,6 @@ void Foam::actuationDiskSource::addSup ); } } - - basicSource::addSup(eqn, fieldI); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H index b0e983e11e..0774425892 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H @@ -43,7 +43,7 @@ Description actuationDiskSourceCoeffs { - fieldName U; // name of field to apply source + fieldNames (U); // names of fields to apply source diskDir (-1 0 0); // disk direction Cp 0.1; // power coefficient Ct 0.5; // thrust coefficient @@ -80,9 +80,6 @@ protected: // Protected data - //- Name of field to apply source upon - word fieldName_; - //- Disk area normal vector diskDir_; @@ -146,12 +143,6 @@ public: // Member Functions - // Check - - //- Return index of field name if found in fieldNames list - virtual label applyToField(const word& fieldName) const; - - // Access //- Return Cp diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C index 2b10f3236c..5f454974f2 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C @@ -201,7 +201,6 @@ Foam::basicSource::basicSource dict_(dict), coeffs_(dict.subDict(modelType + "Coeffs")), active_(readBool(dict_.lookup("active"))), - applied_(false), timeStart_(readScalar(dict_.lookup("timeStart"))), duration_(readScalar(dict_.lookup("duration"))), selectionMode_ @@ -209,7 +208,9 @@ Foam::basicSource::basicSource selectionModeTypeNames_.read(dict_.lookup("selectionMode")) ), cellSetName_("none"), - V_(0.0) + V_(0.0), + fieldNames_(), + applied_() { setSelection(dict_); @@ -228,7 +229,7 @@ Foam::autoPtr Foam::basicSource::New { word modelType(coeffs.lookup("type")); - Info<< "Selecting model type " << modelType << endl; + Info<< "Selecting source model type " << modelType << endl; dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(modelType); @@ -275,15 +276,43 @@ bool Foam::basicSource::isActive() } +Foam::label Foam::basicSource::applyToField(const word& fieldName) const +{ + forAll(fieldNames_, i) + { + if (fieldNames_[i] == fieldName) + { + return i; + } + } + + return -1; +} + + +void Foam::basicSource::checkApplied() const +{ + forAll(applied_, i) + { + if (!applied_[i]) + { + WarningIn("void Foam::basicSource::checkApplied() const") + << "Source " << name_ << " defined for field " + << fieldNames_[i] << " but never used" << endl; + } + } +} + + void Foam::basicSource::addSup(fvMatrix& eqn, const label fieldI) { - applied_ = true; + // do nothing } void Foam::basicSource::addSup(fvMatrix& eqn, const label fieldI) { - applied_ = true; + // do nothing } @@ -293,31 +322,31 @@ void Foam::basicSource::addSup const label fieldI ) { - applied_ = true; + // do nothing } void Foam::basicSource::addSup(fvMatrix& eqn, const label fieldI) { - applied_ = true; + // do nothing } void Foam::basicSource::addSup(fvMatrix& eqn, const label fieldI) { - applied_ = true; + // do nothing } void Foam::basicSource::setValue(fvMatrix& eqn, const label fieldI) { - applied_ = true; + // do nothing } void Foam::basicSource::setValue(fvMatrix& eqn, const label fieldI) { - applied_ = true; + // do nothing } @@ -327,7 +356,7 @@ void Foam::basicSource::setValue const label fieldI ) { - applied_ = true; + // do nothing } @@ -337,13 +366,13 @@ void Foam::basicSource::setValue const label fieldI ) { - applied_ = true; + // do nothing } void Foam::basicSource::setValue(fvMatrix& eqn, const label fieldI) { - applied_ = true; + // do nothing } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H index f8a74cc6de..c70a2ba267 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H @@ -97,9 +97,6 @@ protected: //- Source active flag bool active_; - //- Flag to indicate whether or not the source has been applied - bool applied_; - //- Time start scalar timeStart_; @@ -121,6 +118,12 @@ protected: //- Sum of cell volumes scalar V_; + //- Field names to apply source to - populated by derived models + wordList fieldNames_; + + //- Applied flag list - corresponds to each fieldNames_ entry + List applied_; + // Protected functions @@ -242,9 +245,6 @@ public: //- Return const access to the source active flag inline bool active() const; - //- Return const access to the applied flag - inline bool applied() const; - //- Return const access to the time start inline scalar timeStart() const; @@ -267,6 +267,9 @@ public: //- Return const access to the cell set inline const labelList& cells() const; + //- Set the applied flag to true for field index fieldI + inline void setApplied(const label fieldI); + // Edit @@ -283,10 +286,13 @@ public: // Checks //- Is the source active? - bool isActive(); + virtual bool isActive(); //- Return index of field name if found in fieldNames list - virtual label applyToField(const word& fieldName) const = 0; + virtual label applyToField(const word& fieldName) const; + + //- Check that the source has been applied + virtual void checkApplied() const; // Evaluation diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H index 47c348e105..daf00bfc7c 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H @@ -51,12 +51,6 @@ inline bool Foam::basicSource::active() const } -inline bool Foam::basicSource::applied() const -{ - return applied_; -} - - inline Foam::scalar Foam::basicSource::timeStart() const { return timeStart_; @@ -100,6 +94,12 @@ inline const Foam::labelList& Foam::basicSource::cells() const } +inline void Foam::basicSource::setApplied(const label fieldI) +{ + applied_[fieldI] = true; +} + + inline bool& Foam::basicSource::active() { return active_; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C index 8b471084e3..1fe8bd12c2 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C @@ -25,6 +25,8 @@ License #include "basicSourceList.H" #include "addToRunTimeSelectionTable.H" +#include "fvMesh.H" +#include "Time.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -38,14 +40,12 @@ namespace Foam void Foam::basicSourceList::checkApplied() const { - forAll(*this, i) + if (mesh_.time().timeIndex() == checkTimeIndex_) { - const basicSource& bs = this->operator[](i); - - if (!bs.applied()) + forAll(*this, i) { - WarningIn("void Foam::basicSourceList::checkApplied() const") - << "Source " << bs.name() << " defined, but not used" << endl; + const basicSource& bs = this->operator[](i); + bs.checkApplied(); } } } @@ -60,7 +60,8 @@ Foam::basicSourceList::basicSourceList ) : PtrList(), - mesh_(mesh) + mesh_(mesh), + checkTimeIndex_(mesh_.time().startTimeIndex() + 2) { label count = 0; forAllConstIter(dictionary, dict, iter) @@ -95,6 +96,8 @@ Foam::basicSourceList::basicSourceList bool Foam::basicSourceList::read(const dictionary& dict) { + checkTimeIndex_ = mesh_.time().timeIndex() + 2; + bool allOk = true; forAll(*this, i) { @@ -111,7 +114,7 @@ bool Foam::basicSourceList::writeData(Ostream& os) const // Write list contents forAll(*this, i) { - os << nl; + os << nl; this->operator[](i).writeData(os); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H index 68d848289c..59134e64c2 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class basicSourceList Declaration + Class basicSourceList Declaration \*---------------------------------------------------------------------------*/ class basicSourceList @@ -59,6 +59,9 @@ private: //- Reference to the mesh database const fvMesh& mesh_; + //- Time index to check that all defined sources have been applied + label checkTimeIndex_; + // Private Member Functions diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceListTemplates.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceListTemplates.C index 91a03ceb70..fef93a9e95 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceListTemplates.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceListTemplates.C @@ -23,18 +23,12 @@ License \*---------------------------------------------------------------------------*/ -#include "fvMesh.H" -#include "Time.H" - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void Foam::basicSourceList::apply(fvMatrix& eqn) { - if (mesh_.time().timeIndex() == mesh_.time().startTimeIndex() + 2) - { - checkApplied(); - } + checkApplied(); const word& fieldName = eqn.psi().name(); @@ -44,16 +38,21 @@ void Foam::basicSourceList::apply(fvMatrix& eqn) label fieldI = source.applyToField(fieldName); - if (source.isActive() && (fieldI != -1)) + if (fieldI != -1) { - if (debug) - { - Info<< "Applying source " << source.name() << " to field " - << fieldName << endl; - } + source.setApplied(fieldI); - source.addSup(eqn, fieldI); - source.setValue(eqn, fieldI); + if (source.isActive()) + { + if (debug) + { + Info<< "Applying source " << source.name() << " to field " + << fieldName << endl; + } + + source.addSup(eqn, fieldI); + source.setValue(eqn, fieldI); + } } } } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C index b21091a647..6a14cb2bff 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C @@ -33,13 +33,16 @@ License template void Foam::ExplicitSetValue::setFieldData(const dictionary& dict) { - fieldData_.setSize(dict.toc().size()); + fieldNames_.setSize(dict.toc().size()); + fieldData_.setSize(fieldNames_.size()); + + applied_.setSize(fieldNames_.size(), false); label i = 0; forAllConstIter(dictionary, dict, iter) { - fieldData_[i].first() = iter().keyword(); - dict.lookup(iter().keyword()) >> fieldData_[i].second(); + fieldNames_[i] = iter().keyword(); + dict.lookup(iter().keyword()) >> fieldData_[i]; i++; } } @@ -65,24 +68,6 @@ Foam::ExplicitSetValue::ExplicitSetValue // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -Foam::label Foam::ExplicitSetValue::applyToField -( - const word& fieldName -) const -{ - forAll(fieldData_, i) - { - if (fieldData_[i].first() == fieldName) - { - return i; - } - } - - return -1; -} - - template void Foam::ExplicitSetValue::setValue ( @@ -100,7 +85,7 @@ void Foam::ExplicitSetValue::setValue ( IOobject ( - name_ + fieldData_[fieldI].first() + "rhs", + name_ + fieldNames_[fieldI] + "rhs", eqn.psi().mesh().time().timeName(), eqn.psi().mesh(), IOobject::NO_READ, @@ -120,12 +105,10 @@ void Foam::ExplicitSetValue::setValue forAll(values, i) { - values[i] = fieldData_[fieldI].second(); + values[i] = fieldData_[fieldI]; } eqn.setValues(cells_, values); - - basicSource::setValue(eqn, fieldI); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H index 7c78084fc8..58a50ea75c 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H @@ -69,10 +69,8 @@ protected: // Protected data - typedef Tuple2 fieldNameValuePair; - //- Source value per field - List fieldData_; + List fieldData_; // Protected functions @@ -101,12 +99,6 @@ public: // Member Functions - // Check - - //- Return index of field name if found in fieldNames list - virtual label applyToField(const word& fieldName) const; - - // Evaluation //- Set value on vector field diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.C index 0df1c4fabc..b95cd7ba0e 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.C @@ -87,13 +87,16 @@ Foam::word Foam::ExplicitSource::volumeModeTypeToWord template void Foam::ExplicitSource::setFieldData(const dictionary& dict) { - fieldData_.setSize(dict.toc().size()); + fieldNames_.setSize(dict.toc().size()); + fieldData_.setSize(fieldNames_.size()); + + applied_.setSize(fieldNames_.size(), false); label i = 0; forAllConstIter(dictionary, dict, iter) { - fieldData_[i].first() = iter().keyword(); - dict.lookup(iter().keyword()) >> fieldData_[i].second(); + fieldNames_[i] = iter().keyword(); + dict.lookup(iter().keyword()) >> fieldData_[i]; i++; } @@ -127,24 +130,6 @@ Foam::ExplicitSource::ExplicitSource // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -Foam::label Foam::ExplicitSource::applyToField -( - const word& fieldName -) const -{ - forAll(fieldData_, i) - { - if (fieldData_[i].first() == fieldName) - { - return i; - } - } - - return -1; -} - - template void Foam::ExplicitSource::addSup ( @@ -152,7 +137,7 @@ void Foam::ExplicitSource::addSup const label fieldI ) { - if (debug) +// if (debug) { Info<< "ExplicitSource<"<< pTraits::typeName << ">::addSup for source " << name_ << endl; @@ -162,7 +147,7 @@ void Foam::ExplicitSource::addSup ( IOobject ( - name_ + fieldData_[fieldI].first() + "Sup", + name_ + fieldNames_[fieldI] + "Sup", mesh_.time().timeName(), mesh_, IOobject::NO_READ, @@ -180,12 +165,10 @@ void Foam::ExplicitSource::addSup forAll(cells_, i) { - Su[cells_[i]] = fieldData_[fieldI].second()/VDash_; + Su[cells_[i]] = fieldData_[fieldI]/VDash_; } eqn -= Su; - - basicSource::addSup(eqn, fieldI); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.H index 5c1d3daa2f..7248b5ef26 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.H @@ -104,16 +104,14 @@ protected: // Protected data - typedef Tuple2 fieldNameValuePair; - //- Volume mode volumeModeType volumeMode_; //- Volume normalisation scalar VDash_; - //- Source value per field - List fieldData_; + //- Source field values + List fieldData_; // Protected functions @@ -148,19 +146,13 @@ public: // Member Functions - // Check - - //- Return index of field name if found in fieldNames list - virtual label applyToField(const word& fieldName) const; - - // Access //- Return const access to the volume mode inline const volumeModeType& volumeMode() const; - //- Return const access to the source field value - inline const Type& fieldData() const; + //- Return const access to the source field values + inline const List& fieldData() const; // Edit @@ -168,8 +160,8 @@ public: //- Return access to the volume mode inline volumeModeType& volumeMode(); - //- Return access to the source field value - inline Type& fieldData(); + //- Return access to the source field values + inline List& fieldData(); // Evaluation diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSourceI.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSourceI.H index 0cb38f2a53..14276e0197 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSourceI.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSourceI.H @@ -36,7 +36,7 @@ Foam::ExplicitSource::volumeMode() const template -inline const Type& Foam::ExplicitSource::fieldData() const +inline const Foam::List& Foam::ExplicitSource::fieldData() const { return fieldData_; } @@ -51,7 +51,7 @@ Foam::ExplicitSource::volumeMode() template -inline Type& Foam::ExplicitSource::fieldData() +inline Foam::List& Foam::ExplicitSource::fieldData() { return fieldData_; } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C index 79f2751e7b..e3ff7ca50e 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C @@ -69,15 +69,12 @@ void Foam::pressureGradientExplicitSource::writeGradP() const } -void Foam::pressureGradientExplicitSource::update() +void Foam::pressureGradientExplicitSource::update(fvMatrix& eqn) { - volVectorField& U = const_cast - ( - mesh_.lookupObject(UName_) - ); + volVectorField& U = const_cast(eqn.psi()); const volScalarField& rAU = - mesh_.lookupObject("(1|A(" + UName_ + "))"); + mesh_.lookupObject("(1|A(" + U.name() + "))"); // Integrate flow variables over cell set scalar magUbarAve = 0.0; @@ -130,12 +127,14 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource ) : basicSource(sourceName, modelType, dict, mesh), - UName_(coeffs_.lookupOrDefault("UName", "U")), Ubar_(coeffs_.lookup("Ubar")), gradPini_(coeffs_.lookup("gradPini")), gradP_(gradPini_), flowDir_(Ubar_/mag(Ubar_)) { + coeffs_.lookup("fieldNames") >> fieldNames_; + applied_.setSize(fieldNames_.size(), false); + // Read the initial pressure gradient from file if it exists IFstream propsFile ( @@ -155,35 +154,19 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::label Foam::pressureGradientExplicitSource::applyToField -( - const word& fieldName -) const -{ - if (fieldName == UName_) - { - return 0; - } - else - { - return -1; - } -} - - void Foam::pressureGradientExplicitSource::addSup ( fvMatrix& eqn, - const label + const label fieldI ) { - update(); + update(eqn); DimensionedField Su ( IOobject ( - name_ + UName_ + "Sup", + name_ + fieldNames_[fieldI] + "Sup", mesh_.time().timeName(), mesh_, IOobject::NO_READ, diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H index 9c3732da49..287c1701f3 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H @@ -70,9 +70,6 @@ class pressureGradientExplicitSource { // Private data - //- Velocity field name - word UName_; - //- Average velocity vector Ubar_; @@ -92,7 +89,7 @@ class pressureGradientExplicitSource void writeGradP() const; //- Correct driving force for a constant mass flow rate - void update(); + void update(fvMatrix& eqn); //- Disallow default bitwise copy construct pressureGradientExplicitSource(const pressureGradientExplicitSource&); @@ -121,12 +118,6 @@ public: // Member Functions - // Checks - - //- Return index of field name if found in fieldNames list - virtual label applyToField(const word& fieldName) const; - - // Access //- Add explicit contribution to equation diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C index b43c00d2a0..4a5631270a 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C @@ -102,8 +102,6 @@ void Foam::radialActuationDiskSource::addSup ); } } - - basicSource::addSup(eqn, fieldI); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C index 6309f450db..02f29fcd77 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C @@ -368,7 +368,6 @@ Foam::rotorDiskSource::rotorDiskSource ) : basicSource(name, modelType, dict, mesh), - fieldName_(coeffs_.lookup("fieldName")), rhoName_("none"), omega_(0.0), nBlades_(0), @@ -398,19 +397,6 @@ Foam::rotorDiskSource::~rotorDiskSource() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::label Foam::rotorDiskSource::applyToField(const word& fieldName) const -{ - if (fieldName == fieldName_) - { - return 0; - } - else - { - return -1; - } -} - - void Foam::rotorDiskSource::addSup(fvMatrix& eqn, const label fieldI) { // add source to lhs of eqn @@ -440,8 +426,6 @@ void Foam::rotorDiskSource::addSup(fvMatrix& eqn, const label fieldI) dimForce/dimVolume/dimDensity ); } - - basicSource::addSup(eqn, fieldI); } @@ -456,6 +440,9 @@ bool Foam::rotorDiskSource::read(const dictionary& dict) { if (basicSource::read(dict)) { + coeffs_.lookup("fieldNames") >> fieldNames_; + applied_.setSize(fieldNames_.size(), false); + scalar rpm(readScalar(coeffs_.lookup("rpm"))); omega_ = rpm/60.0*mathematical::twoPi; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H index 4113463d4b..7565fa17ce 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H @@ -34,7 +34,7 @@ Description rotorDiskSourceCoeffs { - fieldName U; // name of field on which to apply source + fieldNames (U); // names of fields on which to apply source rhoName rho; // density field if compressible case nBlades 3; // number of blades tip effect 0.96; // normalised radius above which lift = 0 @@ -149,9 +149,6 @@ protected: // Protected data - //- Name of field on which to apply the source - word fieldName_; - //- Name of density field word rhoName_; @@ -263,13 +260,6 @@ public: // Member Functions - - // Checks - - //- Return index of field name if found in fieldNames list - virtual label applyToField(const word& fieldName) const; - - // Source term addition //- Source term to fvMatrix