diff --git a/src/fieldSources/Make/files b/src/fieldSources/Make/files index 41fecea800..11f91ff58a 100644 --- a/src/fieldSources/Make/files +++ b/src/fieldSources/Make/files @@ -3,7 +3,7 @@ basicSource/basicSourceIO.C basicSource/basicSourceList.C basicSource/IObasicSourceList.C -general/explicitSource/explicitSource.C +general/semiImplicitSource/semiImplicitSource.C general/explicitSetValue/explicitSetValue.C general/codedSource/codedSource.C diff --git a/src/fieldSources/general/explicitSource/ExplicitSource.C b/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.C similarity index 71% rename from src/fieldSources/general/explicitSource/ExplicitSource.C rename to src/fieldSources/general/semiImplicitSource/SemiImplicitSource.C index 64ed783cb9..2e556eaf01 100644 --- a/src/fieldSources/general/explicitSource/ExplicitSource.C +++ b/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.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 @@ -23,15 +23,16 @@ License \*---------------------------------------------------------------------------*/ -#include "ExplicitSource.H" +#include "SemiImplicitSource.H" #include "fvMesh.H" #include "fvMatrices.H" #include "DimensionedField.H" +#include "fvmSup.H" // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // template -const Foam::wordList Foam::ExplicitSource:: +const Foam::wordList Foam::SemiImplicitSource:: volumeModeTypeNames_ ( IStringStream("(absolute specific)")() @@ -41,8 +42,8 @@ volumeModeTypeNames_ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -typename Foam::ExplicitSource::volumeModeType -Foam::ExplicitSource::wordToVolumeModeType +typename Foam::SemiImplicitSource::volumeModeType +Foam::SemiImplicitSource::wordToVolumeModeType ( const word& vmtName ) const @@ -57,8 +58,8 @@ Foam::ExplicitSource::wordToVolumeModeType FatalErrorIn ( - "ExplicitSource::volumeModeType" - "ExplicitSource::wordToVolumeModeType(const word&)" + "SemiImplicitSource::volumeModeType" + "SemiImplicitSource::wordToVolumeModeType(const word&)" ) << "Unknown volumeMode type " << vmtName << ". Valid volumeMode types are:" << nl << volumeModeTypeNames_ << exit(FatalError); @@ -68,7 +69,7 @@ Foam::ExplicitSource::wordToVolumeModeType template -Foam::word Foam::ExplicitSource::volumeModeTypeToWord +Foam::word Foam::SemiImplicitSource::volumeModeTypeToWord ( const volumeModeType& vmtType ) const @@ -85,7 +86,7 @@ Foam::word Foam::ExplicitSource::volumeModeTypeToWord template -void Foam::ExplicitSource::setFieldData(const dictionary& dict) +void Foam::SemiImplicitSource::setFieldData(const dictionary& dict) { fieldNames_.setSize(dict.toc().size()); injectionRate_.setSize(fieldNames_.size()); @@ -111,7 +112,7 @@ void Foam::ExplicitSource::setFieldData(const dictionary& dict) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::ExplicitSource::ExplicitSource +Foam::SemiImplicitSource::SemiImplicitSource ( const word& name, const word& modelType, @@ -131,7 +132,7 @@ Foam::ExplicitSource::ExplicitSource // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void Foam::ExplicitSource::addSup +void Foam::SemiImplicitSource::addSup ( fvMatrix& eqn, const label fieldI @@ -139,15 +140,17 @@ void Foam::ExplicitSource::addSup { if (debug) { - Info<< "ExplicitSource<"<< pTraits::typeName + Info<< "SemiImplicitSource<" << pTraits::typeName << ">::addSup for source " << name_ << endl; } + const GeometricField& psi = eqn.psi(); + DimensionedField Su ( IOobject ( - name_ + fieldNames_[fieldI] + "Sup", + name_ + fieldNames_[fieldI] + "Su", mesh_.time().timeName(), mesh_, IOobject::NO_READ, @@ -163,9 +166,31 @@ void Foam::ExplicitSource::addSup false ); - UIndirectList(Su, cells_) = injectionRate_[fieldI]/VDash_; + UIndirectList(Su, cells_) = injectionRate_[fieldI].first()/VDash_; - eqn += Su; + DimensionedField Sp + ( + IOobject + ( + name_ + fieldNames_[fieldI] + "Sp", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensioned + ( + "zero", + Su.dimensions()/psi.dimensions(), + 0.0 + ), + false + ); + + UIndirectList(Sp, cells_) = injectionRate_[fieldI].second()/VDash_; + + eqn += Su + fvm::Sp(Sp, psi); } diff --git a/src/fieldSources/general/explicitSource/ExplicitSource.H b/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.H similarity index 78% rename from src/fieldSources/general/explicitSource/ExplicitSource.H rename to src/fieldSources/general/semiImplicitSource/SemiImplicitSource.H index 30a18dd5d3..94a174034b 100644 --- a/src/fieldSources/general/explicitSource/ExplicitSource.H +++ b/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.H @@ -22,21 +22,33 @@ License along with OpenFOAM. If not, see . Class - Foam::ExplicitSource + Foam::SemiImplicitSource Description - Explicit source + Semi-implicit source, described using an input dictionary. The injection + rate coefficients are specified as pairs of Su-Sp coefficients, i.e. - Sources described by: + \f[ + S(x) = S_u + S_p x + \f] + + where + \vartable + S(x) | net source for field 'x' + S_u | explicit source contribution + S_p | linearised implicit contribution + \endvartable + + Example of the source specification: \verbatim - ExplicitSourceCoeffs + SemiImplicitSourceCoeffs { volumeMode absolute; // specific - injectionRate + injectionRateSuSp { - k 30.7; - epsilon 1.5; + k (30.7 0); + epsilon (1.5 0); } } \verbatim @@ -49,12 +61,12 @@ SeeAlso Foam::basicSource SourceFiles - ExplicitSource.C + SemiImplicitSource.C \*---------------------------------------------------------------------------*/ -#ifndef ExplicitSource_H -#define ExplicitSource_H +#ifndef SemiImplicitSource_H +#define SemiImplicitSource_H #include "Tuple2.H" #include "basicSource.H" @@ -69,7 +81,7 @@ namespace Foam class fvMesh; template -class ExplicitSource; +class SemiImplicitSource; // Forward declaration of friend functions @@ -77,15 +89,15 @@ template Ostream& operator<< ( Ostream&, - const ExplicitSource& + const SemiImplicitSource& ); /*---------------------------------------------------------------------------*\ - Class ExplicitSource Declaration + Class SemiImplicitSource Declaration \*---------------------------------------------------------------------------*/ template -class ExplicitSource +class SemiImplicitSource : public basicSource { @@ -115,7 +127,7 @@ protected: scalar VDash_; //- Source field values - List injectionRate_; + List > injectionRate_; // Protected functions @@ -133,13 +145,13 @@ protected: public: //- Runtime type information - TypeName("ExplicitSource"); + TypeName("SemiImplicitSource"); // Constructors //- Construct from components - ExplicitSource + SemiImplicitSource ( const word& name, const word& modelType, @@ -156,7 +168,7 @@ public: inline const volumeModeType& volumeMode() const; //- Return const access to the source field values - inline const List& injectionRate() const; + inline const List >& injectionRate() const; // Edit @@ -165,7 +177,7 @@ public: inline volumeModeType& volumeMode(); //- Return access to the source field values - inline List& injectionRate(); + inline List >& injectionRate(); // Evaluation @@ -191,13 +203,13 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "ExplicitSource.C" -# include "ExplicitSourceIO.C" +# include "SemiImplicitSource.C" +# include "SemiImplicitSourceIO.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "ExplicitSourceI.H" +#include "SemiImplicitSourceI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fieldSources/general/explicitSource/ExplicitSourceI.H b/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceI.H similarity index 72% rename from src/fieldSources/general/explicitSource/ExplicitSourceI.H rename to src/fieldSources/general/semiImplicitSource/SemiImplicitSourceI.H index e3f4b8aa63..eb352de08a 100644 --- a/src/fieldSources/general/explicitSource/ExplicitSourceI.H +++ b/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceI.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 @@ -23,35 +23,37 @@ License \*---------------------------------------------------------------------------*/ -#include "ExplicitSource.H" +#include "SemiImplicitSource.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline const typename Foam::ExplicitSource::volumeModeType& -Foam::ExplicitSource::volumeMode() const +inline const typename Foam::SemiImplicitSource::volumeModeType& +Foam::SemiImplicitSource::volumeMode() const { return volumeMode_; } template -inline const Foam::List& Foam::ExplicitSource::injectionRate() const +inline const Foam::List >& +Foam::SemiImplicitSource::injectionRate() const { return injectionRate_; } template -inline typename Foam::ExplicitSource::volumeModeType& -Foam::ExplicitSource::volumeMode() +inline typename Foam::SemiImplicitSource::volumeModeType& +Foam::SemiImplicitSource::volumeMode() { return volumeMode_; } template -inline Foam::List& Foam::ExplicitSource::injectionRate() +inline Foam::List >& Foam::SemiImplicitSource::injectionRate() { return injectionRate_; } diff --git a/src/fieldSources/general/explicitSource/ExplicitSourceIO.C b/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceIO.C similarity index 83% rename from src/fieldSources/general/explicitSource/ExplicitSourceIO.C rename to src/fieldSources/general/semiImplicitSource/SemiImplicitSourceIO.C index f2abe69cbd..6b91798be6 100644 --- a/src/fieldSources/general/explicitSource/ExplicitSourceIO.C +++ b/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceIO.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 @@ -23,12 +23,12 @@ License \*---------------------------------------------------------------------------*/ -#include "ExplicitSource.H" +#include "SemiImplicitSource.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void Foam::ExplicitSource::writeData(Ostream& os) const +void Foam::SemiImplicitSource::writeData(Ostream& os) const { os << indent << name_ << endl; dict_.write(os); @@ -36,12 +36,12 @@ void Foam::ExplicitSource::writeData(Ostream& os) const template -bool Foam::ExplicitSource::read(const dictionary& dict) +bool Foam::SemiImplicitSource::read(const dictionary& dict) { if (basicSource::read(dict)) { volumeMode_ = wordToVolumeModeType(coeffs_.lookup("volumeMode")); - setFieldData(coeffs_.subDict("injectionRate")); + setFieldData(coeffs_.subDict("injectionRateSuSp")); return true; } diff --git a/src/fieldSources/general/explicitSource/explicitSource.C b/src/fieldSources/general/semiImplicitSource/semiImplicitSource.C similarity index 78% rename from src/fieldSources/general/explicitSource/explicitSource.C rename to src/fieldSources/general/semiImplicitSource/semiImplicitSource.C index 338a422059..e3b294fa59 100644 --- a/src/fieldSources/general/explicitSource/explicitSource.C +++ b/src/fieldSources/general/semiImplicitSource/semiImplicitSource.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 @@ -24,17 +24,17 @@ License \*---------------------------------------------------------------------------*/ #include "makeBasicSource.H" -#include "ExplicitSource.H" +#include "SemiImplicitSource.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - makeBasicSource(ExplicitSource, scalar); - makeBasicSource(ExplicitSource, vector); - makeBasicSource(ExplicitSource, sphericalTensor); - makeBasicSource(ExplicitSource, symmTensor); - makeBasicSource(ExplicitSource, tensor); + makeBasicSource(SemiImplicitSource, scalar); + makeBasicSource(SemiImplicitSource, vector); + makeBasicSource(SemiImplicitSource, sphericalTensor); + makeBasicSource(SemiImplicitSource, symmTensor); + makeBasicSource(SemiImplicitSource, tensor); }