diff --git a/src/fieldSources/Make/files b/src/fieldSources/Make/files index 11f91ff58a..54ad1edc42 100644 --- a/src/fieldSources/Make/files +++ b/src/fieldSources/Make/files @@ -3,13 +3,16 @@ basicSource/basicSourceIO.C basicSource/basicSourceList.C basicSource/IObasicSourceList.C -general/semiImplicitSource/semiImplicitSource.C -general/explicitSetValue/explicitSetValue.C general/codedSource/codedSource.C +general/explicitSetValue/explicitSetValue.C +general/semiImplicitSource/semiImplicitSource.C +derived/actuationDiskSource/actuationDiskSource.C +derived/explicitPorositySource/explicitPorositySource.C +derived/fixedTemperatureSource/fixedTemperatureSource.C derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C - +derived/radialActuationDiskSource/radialActuationDiskSource.C derived/rotorDiskSource/rotorDiskSource.C derived/rotorDiskSource/bladeModel/bladeModel.C derived/rotorDiskSource/profileModel/profileModel.C @@ -21,15 +24,11 @@ derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C derived/rotorDiskSource/trimModel/fixed/fixedTrim.C derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C -derived/actuationDiskSource/actuationDiskSource.C -derived/radialActuationDiskSource/radialActuationDiskSource.C - interRegion = derived/interRegionHeatTransferModel -$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C $(interRegion)/constantHeatTransfer/constantHeatTransfer.C +$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C $(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C $(interRegion)/variableHeatTransfer/variableHeatTransfer.C -derived/fixedTemperatureSource/fixedTemperatureSource.C LIB = $(FOAM_LIBBIN)/libfieldSources diff --git a/src/fieldSources/derived/explicitPorositySource/explicitPorositySource.C b/src/fieldSources/derived/explicitPorositySource/explicitPorositySource.C new file mode 100644 index 0000000000..44f5fa2bfd --- /dev/null +++ b/src/fieldSources/derived/explicitPorositySource/explicitPorositySource.C @@ -0,0 +1,145 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "explicitPorositySource.H" +#include "fvMesh.H" +#include "fvMatrices.H" +#include "porosityModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(explicitPorositySource, 0); + addToRunTimeSelectionTable + ( + basicSource, + explicitPorositySource, + dictionary + ); +} + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::explicitPorositySource::initialise() +{ + if (selectionMode_ != smCellZone) + { + FatalErrorIn("void Foam::explicitPorositySource::initialise()") + << "The porosity region must be specified as a cellZone. Current " + << "selection mode is " << selectionModeTypeNames_[selectionMode_] + << exit(FatalError); + } + + porosityPtr_.reset + ( + porosityModel::New + ( + name_, + mesh_, + coeffs_, + cellSetName_ + ).ptr() + ), + + fieldNames_.setSize(1, UName_); + applied_.setSize(1, false); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::explicitPorositySource::explicitPorositySource +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + basicSource(name, modelType, dict, mesh), + porosityPtr_(NULL), + UName_(coeffs_.lookupOrDefault("UName", "U")), + rhoName_(coeffs_.lookupOrDefault("rhoName", "rho")), + muName_(coeffs_.lookupOrDefault("muName", "mu")) +{ + initialise(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::explicitPorositySource::addSup +( + fvMatrix& eqn, + const label fieldI +) +{ + fvMatrix porosityEqn(eqn.psi(), eqn.dimensions()); + + if (eqn.dimensions() == dimForce) + { + const volScalarField& rho = + mesh_.lookupObject(rhoName_); + const volScalarField& mu = mesh_.lookupObject(muName_); + + porosityPtr_->addResistance(porosityEqn, rho, mu); + } + else + { + porosityPtr_->addResistance(porosityEqn); + } + + eqn -= porosityEqn; +} + + +void Foam::explicitPorositySource::writeData(Ostream& os) const +{ + os << indent << name_ << endl; + dict_.write(os); +} + + +bool Foam::explicitPorositySource::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + coeffs_.readIfPresent("UName", UName_); + coeffs_.readIfPresent("rhoName", rhoName_); + coeffs_.readIfPresent("muName", muName_); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/fieldSources/derived/explicitPorositySource/explicitPorositySource.H b/src/fieldSources/derived/explicitPorositySource/explicitPorositySource.H new file mode 100644 index 0000000000..c4731df62b --- /dev/null +++ b/src/fieldSources/derived/explicitPorositySource/explicitPorositySource.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::explicitPorositySource + +Description + Explicit porosity source + + Sources described by, for example using the DarcyForchheimer model: + + explicitPorositySourceCoeffs + { + type DarcyForchheimer; + DarcyForchheimerCoeffs + { + d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + + coordinateSystem + { + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); + } + } + } + +Note: + The porous region must be selected as a cellZone. + +SourceFiles + basicSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef explicitPorositySource_H +#define explicitPorositySource_H + +#include "basicSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class porosityModel; + +/*---------------------------------------------------------------------------*\ + Class explicitPorositySource Declaration +\*---------------------------------------------------------------------------*/ + +class explicitPorositySource +: + public basicSource +{ + +protected: + + // Protected data + + //- Run-time selectable porosity model + autoPtr porosityPtr_; + + //- Velocity field name, default = U + word UName_; + + //- Density field name (compressible case only), default = rho + word rhoName_; + + //- Dynamic viscosity field name (compressible case only), default = mu + word muName_; + + + // Protected Member Functions + + //- Initialise + void initialise(); + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + explicitPorositySource(const explicitPorositySource&); + + //- Disallow default bitwise assignment + void operator=(const explicitPorositySource&); + + +public: + + //- Runtime type information + TypeName("explicitPorositySource"); + + + // Constructors + + //- Construct from components + explicitPorositySource + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~explicitPorositySource() + {} + + + // Member Functions + + // Add explicit and implicit contributions + + //- Vector + virtual void addSup + ( + fvMatrix& eqn, + const label fieldI + ); + + + // I-O + + //- Write data + virtual void writeData(Ostream&) const; + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C index aa4e4ad641..6266e5bb49 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C @@ -82,18 +82,14 @@ Foam::porosityModel::porosityModel dict_(dict), coeffs_(dict.subDict(modelType + "Coeffs")), active_(true), - zoneName_(), + zoneName_(cellZoneName), cellZoneIds_() { - if (cellZoneName == "unknown") + if (zoneName_ == word::null) { dict.lookup("actuve") >> active_; dict_.lookup("cellZone") >> zoneName_; } - else - { - zoneName_ = cellZoneName; - } cellZoneIds_ = mesh_.cellZones().findIndices(zoneName_); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H index 01098aff44..1c61e29f18 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H @@ -140,7 +140,7 @@ public: const word& modelType, const fvMesh& mesh, const dictionary& dict, - const word& cellZoneName + const word& cellZoneName = word::null ); //- Return pointer to new porosityModel object created on the freestore @@ -185,7 +185,7 @@ public: const word& name, const fvMesh& mesh, const dictionary& dict, - const word& cellZoneName = "unknown" + const word& cellZoneName = word::null ); //- Destructor