diff --git a/src/fieldSources/Make/files b/src/fieldSources/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..0df9defae420aee6085a2a0de30d5f5c7c816abd --- /dev/null +++ b/src/fieldSources/Make/files @@ -0,0 +1,28 @@ +basicSource/basicSource/basicSource.C +basicSource/basicSource/basicSourceIO.C +basicSource/basicSource/basicSourceList.C +basicSource/basicSource/IObasicSourceList.C + +basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C +basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C + +basicSource/explicitSource/explicitSource.C +basicSource/explicitSetValue/explicitSetValue.C + +basicSource/rotorDiskSource/rotorDiskSource.C +basicSource/rotorDiskSource/bladeModel/bladeModel.C +basicSource/rotorDiskSource/profileModel/profileModel.C +basicSource/rotorDiskSource/profileModel/profileModelList.C +basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C +basicSource/rotorDiskSource/profileModel/series/seriesProfile.C + +basicSource/actuationDiskSource/actuationDiskSource.C +basicSource/radialActuationDiskSource/radialActuationDiskSource.C + +interRegion = basicSource/interRegionHeatTransferModel +$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C +$(interRegion)/constantHeatTransfer/constantHeatTransfer.C +$(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C +$(interRegion)/variableHeatTransfer/variableHeatTransfer.C + +LIB = $(FOAM_LIBBIN)/libfieldSources \ No newline at end of file diff --git a/src/fieldSources/Make/options b/src/fieldSources/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..bb78896172a40e95f91e6b5196d0e9aec60f3e6e --- /dev/null +++ b/src/fieldSources/Make/options @@ -0,0 +1,17 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \ + -I$(LIB_SRC)/turbulenceModels + + +LIB_LIBS = \ + -lfiniteVolume \ + -lsampling \ + -lmeshTools \ + -lbasicSolidThermo \ + -lcompressibleTurbulenceModel diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C rename to src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H rename to src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C b/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C rename to src/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C b/src/fieldSources/basicSource/basicSource/IObasicSourceList.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C rename to src/fieldSources/basicSource/basicSource/IObasicSourceList.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H b/src/fieldSources/basicSource/basicSource/IObasicSourceList.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H rename to src/fieldSources/basicSource/basicSource/IObasicSourceList.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C b/src/fieldSources/basicSource/basicSource/basicSource.C similarity index 78% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C rename to src/fieldSources/basicSource/basicSource/basicSource.C index da790fab4d93f59189ac855948ff98ec15e4a933..40f283a78a06f70daac4619bb4361369793900bd 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C +++ b/src/fieldSources/basicSource/basicSource/basicSource.C @@ -38,16 +38,17 @@ namespace Foam template<> const char* NamedEnum < basicSource::selectionModeType, - 4 + 5 >::names[] = { "points", "cellSet", "cellZone", + "mapRegion", "all" }; - const NamedEnum<basicSource::selectionModeType, 4> + const NamedEnum<basicSource::selectionModeType, 5> basicSource::selectionModeTypeNames_; } @@ -73,6 +74,13 @@ void Foam::basicSource::setSelection(const dictionary& dict) dict.lookup("cellZone") >> cellSetName_; break; } + case smMapRegion: + { + dict_.lookup("secondarySourceName") >> secondarySourceName_; + dict_.lookup("mapRegionName") >> mapRegionName_; + master_ = readBool(dict_.lookup("master")); + break; + } case smAll: { break; @@ -151,6 +159,47 @@ void Foam::basicSource::setCellSet() break; } + case smMapRegion: + { + if(active_) + { + Info<< indent << "- selecting inter region mapping" << endl; + const fvMesh& secondaryMesh = + mesh_.time().lookupObject<fvMesh>(mapRegionName_); + const boundBox primaryBB = mesh_.bounds(); + const boundBox secondaryBB = secondaryMesh.bounds(); + if (secondaryBB.overlaps(primaryBB)) + { + + // Dummy patches + wordList cuttingPatches; + HashTable<word> patchMap; + + secondaryToPrimaryInterpPtr_.reset + ( + new meshToMesh + ( + secondaryMesh, + mesh_, + patchMap, + cuttingPatches + ) + ); + } + else + { + FatalErrorIn + ( + "Foam::basicSource::setCellSet()" + ) << "regions dont overlap " + << secondaryMesh.name() + << " in region " << mesh_.name() + << nl + << exit(FatalError); + } + } + break; + } case smAll: { Info<< indent << "- selecting all cells" << endl; @@ -169,16 +218,19 @@ void Foam::basicSource::setCellSet() } // Set volume information - V_ = 0.0; - forAll(cells_, i) + if(selectionMode_ != smMapRegion) { - V_ += mesh_.V()[cells_[i]]; - } - reduce(V_, sumOp<scalar>()); + V_ = 0.0; + forAll(cells_, i) + { + V_ += mesh_.V()[cells_[i]]; + } + reduce(V_, sumOp<scalar>()); - Info<< indent << "- selected " - << returnReduce(cells_.size(), sumOp<label>()) - << " cell(s) with volume " << V_ << nl << decrIndent << endl; + Info<< indent << "- selected " + << returnReduce(cells_.size(), sumOp<label>()) + << " cell(s) with volume " << V_ << nl << decrIndent << endl; + } } @@ -205,6 +257,11 @@ Foam::basicSource::basicSource ), cellSetName_("none"), V_(0.0), + secondaryToPrimaryInterpPtr_(), + secondarySourceName_("none"), + mapRegionName_("none"), + master_(false), + fieldNames_(), applied_() { @@ -246,6 +303,13 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New return autoPtr<basicSource>(cstrIter()(name, modelType, coeffs, mesh)); } +Foam::basicSource::~basicSource() +{ + if (!secondaryToPrimaryInterpPtr_.empty()) + { + secondaryToPrimaryInterpPtr_.clear(); + } +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H b/src/fieldSources/basicSource/basicSource/basicSource.H similarity index 91% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H rename to src/fieldSources/basicSource/basicSource/basicSource.H index bf61cfe0ca697fbd34427b1558c923a2919f4dcd..3fa4974c8647d5909e3949520103c156cc1900c2 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H +++ b/src/fieldSources/basicSource/basicSource/basicSource.H @@ -32,6 +32,7 @@ Description timeStart 0.0; // start time duration 1000.0; // duration selectionMode cellSet; // cellSet // points //cellZone + // mapRegion On evaluation, source expects to be added to the rhs of the equation @@ -48,6 +49,8 @@ SourceFiles #include "fvMatricesFwd.H" #include "cellSet.H" #include "autoPtr.H" +#include "meshToMesh.H" + #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,6 +60,7 @@ namespace Foam class fvMesh; + /*---------------------------------------------------------------------------*\ Class basicSource Declaration \*---------------------------------------------------------------------------*/ @@ -73,11 +77,13 @@ public: smPoints, smCellSet, smCellZone, + smMapRegion, smAll }; //- Word list of selection mode type names - static const NamedEnum<selectionModeType, 4> selectionModeTypeNames_; + static const NamedEnum<selectionModeType, 5> + selectionModeTypeNames_; protected: @@ -120,6 +126,21 @@ protected: //- Sum of cell volumes scalar V_; + // Data for smMapRegion only + + //- Mesh to mesh mapping for map optiom + autoPtr<meshToMesh> secondaryToPrimaryInterpPtr_; + + //- Name of the source in the secondary mesh + word secondarySourceName_; + + //- Name of the region to map + word mapRegionName_; + + //- Master or slave region + bool master_; + + //- Field names to apply source to - populated by derived models wordList fieldNames_; @@ -227,8 +248,8 @@ public: //- Destructor - virtual ~basicSource() - {} + virtual ~basicSource(); + // Member Functions @@ -266,6 +287,15 @@ public: //- Return const access to the total cell volume inline scalar V() const; + //- Return const access to the secondarySourceName + inline const word secondarySourceName() const; + + //- Return const access to the mapToMap Ptr + inline const autoPtr<meshToMesh> secondaryToPrimaryInterpPtr() const; + + //- Return const referenc to the mapRegion + inline const word mapRegionName() const; + //- Return const access to the cell set inline const labelList& cells() const; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H b/src/fieldSources/basicSource/basicSource/basicSourceI.H similarity index 88% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H rename to src/fieldSources/basicSource/basicSource/basicSourceI.H index daf00bfc7c07995156484fbe9553f48ec0c77aa3..84444144f3071540bd9044cea1c5c86f74b3d2c7 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H +++ b/src/fieldSources/basicSource/basicSource/basicSourceI.H @@ -118,4 +118,21 @@ inline Foam::scalar& Foam::basicSource::duration() } +inline const Foam::word Foam::basicSource::secondarySourceName() const +{ + return secondarySourceName_; +} + + +inline const Foam::autoPtr<Foam::meshToMesh> Foam::basicSource:: +secondaryToPrimaryInterpPtr() const +{ + return secondaryToPrimaryInterpPtr_; +} + +inline const Foam::word Foam::basicSource::mapRegionName() const +{ + return mapRegionName_; +} + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C b/src/fieldSources/basicSource/basicSource/basicSourceIO.C similarity index 97% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C rename to src/fieldSources/basicSource/basicSource/basicSourceIO.C index 55eb290087b927a17e75a4c04957d339307919b1..ce0c88cace525798efe9cb203116214171ed128c 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C +++ b/src/fieldSources/basicSource/basicSource/basicSourceIO.C @@ -72,6 +72,10 @@ void Foam::basicSource::writeData(Ostream& os) const { break; } + case smMapRegion: + { + break; + } default: { FatalErrorIn("basicSource::writeData(Ostream&) const") diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C b/src/fieldSources/basicSource/basicSource/basicSourceList.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C rename to src/fieldSources/basicSource/basicSource/basicSourceList.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H b/src/fieldSources/basicSource/basicSource/basicSourceList.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H rename to src/fieldSources/basicSource/basicSource/basicSourceList.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceListTemplates.C b/src/fieldSources/basicSource/basicSource/basicSourceListTemplates.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceListTemplates.C rename to src/fieldSources/basicSource/basicSource/basicSourceListTemplates.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/makeBasicSource.H b/src/fieldSources/basicSource/basicSource/makeBasicSource.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/makeBasicSource.H rename to src/fieldSources/basicSource/basicSource/makeBasicSource.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C b/src/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C rename to src/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H b/src/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H rename to src/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValueIO.C b/src/fieldSources/basicSource/explicitSetValue/ExplicitSetValueIO.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/ExplicitSetValueIO.C rename to src/fieldSources/basicSource/explicitSetValue/ExplicitSetValueIO.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.C b/src/fieldSources/basicSource/explicitSetValue/explicitSetValue.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.C rename to src/fieldSources/basicSource/explicitSetValue/explicitSetValue.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.C b/src/fieldSources/basicSource/explicitSource/ExplicitSource.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.C rename to src/fieldSources/basicSource/explicitSource/ExplicitSource.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.H b/src/fieldSources/basicSource/explicitSource/ExplicitSource.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSource.H rename to src/fieldSources/basicSource/explicitSource/ExplicitSource.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSourceI.H b/src/fieldSources/basicSource/explicitSource/ExplicitSourceI.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSourceI.H rename to src/fieldSources/basicSource/explicitSource/ExplicitSourceI.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSourceIO.C b/src/fieldSources/basicSource/explicitSource/ExplicitSourceIO.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/ExplicitSourceIO.C rename to src/fieldSources/basicSource/explicitSource/ExplicitSourceIO.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C b/src/fieldSources/basicSource/explicitSource/explicitSource.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C rename to src/fieldSources/basicSource/explicitSource/explicitSource.C diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C b/src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C new file mode 100644 index 0000000000000000000000000000000000000000..eb49266305cc4e51b2aa6bee8b424210657eb607 --- /dev/null +++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C @@ -0,0 +1,141 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 "constantHeatTransfer.H" +#include "fvm.H" +#include "IObasicSourceList.H" +#include "addToRunTimeSelectionTable.H" +#include "fvcVolumeIntegrate.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(constantHeatTransfer, 0); + addToRunTimeSelectionTable + ( + basicSource, + constantHeatTransfer, + dictionary + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::constantHeatTransfer::constantHeatTransfer +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + interRegionHeatTransferModel(name, modelType, dict, mesh), + htCoeffs_(), + area_() +{ + if (master_) + { + htCoeffs_.reset + ( + new volScalarField + ( + IOobject + ( + "htCoeffs", + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) + ); + + area_.reset + ( + new volScalarField + ( + IOobject + ( + "area", + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) + ); + + htc_.internalField() = htCoeffs_()*area_()/mesh_.V(); + htc_.correctBoundaryConditions(); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::constantHeatTransfer::~constantHeatTransfer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::tmp<Foam::volScalarField>Foam::constantHeatTransfer:: +calculateHtc() +{ + return htc_; +} + + +void Foam::constantHeatTransfer::writeData(Ostream& os) const +{ + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + interRegionHeatTransferModel::writeData(os); + + os << indent << "constantHeatTransfer"; + + dict_.write(os); + + os << decrIndent << indent << token::END_BLOCK << endl; +} + + +bool Foam::constantHeatTransfer::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // \ No newline at end of file diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H b/src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H new file mode 100644 index 0000000000000000000000000000000000000000..375d00ae8b205773f18036affbca85bce19e0216 --- /dev/null +++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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::constantHeatTransfer + +Description + Constant heat transfer model. htCoeffs [W/m2/K] and area [m2] must be + provided. + +\*---------------------------------------------------------------------------*/ + +#ifndef constantHeatTransfer_H +#define constantHeatTransfer_H + +#include "interRegionHeatTransferModel.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class constantHeatTransfer Declaration +\*---------------------------------------------------------------------------*/ + +class constantHeatTransfer +: + public interRegionHeatTransferModel +{ +private: + + // Private data + + //- Heat transfer coefficient + autoPtr<volScalarField> htCoeffs_; + + //- Area of heat exchange + autoPtr<volScalarField> area_; + + +public: + + //- Runtime type information + TypeName("constantHeatTransfer"); + + + // Constructors + + //- Construct from dictionary + constantHeatTransfer + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~constantHeatTransfer(); + + + // Public Functions + + //- Calculate the heat transfer coefficient + virtual const tmp<volScalarField> calculateHtc(); + + + // 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/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C b/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C new file mode 100644 index 0000000000000000000000000000000000000000..497ff86ef5029967cd3b2479cb31a2debfda495d --- /dev/null +++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C @@ -0,0 +1,273 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 "interRegionHeatTransferModel.H" +#include "basicThermo.H" +#include "fvm.H" +#include "IObasicSourceList.H" +#include "zeroGradientFvPatchFields.H" +#include "fvcVolumeIntegrate.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(interRegionHeatTransferModel, 0); +}; + + +// * * * * * * * * * * * * Private member functions * * * * * * * * * * * // + +void Foam::interRegionHeatTransferModel::check() +{ + const fvMesh& secondaryMesh = + mesh_.time().lookupObject<fvMesh>(mapRegionName_); + + const basicSourceList& IObsl = + secondaryMesh.lookupObject<basicSourceList> + ( + "sourcesProperties" + ); + + const PtrList<basicSource>& bsl = IObsl; + + bool secSourceFound(false); + + forAll(bsl, i) + { + if (bsl[i].name() == secondarySourceName_) + { + secIrht_ = &const_cast<interRegionHeatTransferModel&> + ( + refCast<const interRegionHeatTransferModel>(bsl[i]) + ); + secSourceFound = true; + break; + } + } + + if(!secSourceFound) + { + FatalErrorIn + ( + "constantHeatTransfer::interRegionHeatTransferModel" + "(" + " const word& name," + " const word& modelType," + " const dictionary& dict," + " const fvMesh& mesh" + ")" + ) << "Secondary source name not found" << secondarySourceName_ + << " in region " << secondaryMesh.name() + << nl + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interRegionHeatTransferModel::interRegionHeatTransferModel +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + basicSource(name, modelType, dict, mesh), + secIrht_(), + firstIter_(true), + htc_ + ( + IOobject + ( + "htc", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar + ( + "htc", + dimEnergy/dimTime/dimTemperature/dimVolume, + 0.0 + ), + zeroGradientFvPatchScalarField::typeName + ) +{ + coeffs_.lookup("fieldNames") >> fieldNames_; + applied_.setSize(fieldNames_.size(), false); +} + + +Foam::interRegionHeatTransferModel::~interRegionHeatTransferModel() +{} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +void Foam::interRegionHeatTransferModel::addSup +( + fvMatrix<scalar>& eEqn, + const label fieldI +) +{ + if (firstIter_) + { + check(); + firstIter_ = false; + } + + const volScalarField& h = eEqn.psi(); + + tmp<volScalarField> tTmapped + ( + new volScalarField + ( + IOobject + ( + "Tmapped" + mesh_.name(), + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("T", dimTemperature, 0.0) + ) + ); + + volScalarField& Tmapped = tTmapped(); + + const fvMesh& secondaryMesh = + mesh_.time().lookupObject<fvMesh>(mapRegionName_); + + basicThermo& secondaryThermo = + const_cast<basicThermo&> + ( + secondaryMesh.lookupObject<basicThermo>("thermophysicalProperties") + ); + + secondaryToPrimaryInterpPtr_->interpolateInternalField + ( + Tmapped, + secondaryThermo.T(), + meshToMesh::MAP, + eqOp<scalar>() + ); + + if (!master_) + { + secondaryToPrimaryInterpPtr_->interpolateInternalField + ( + htc_, + secIrht_->calculateHtc(), + meshToMesh::CELL_VOLUME_WEIGHT, + eqOp<scalar>() + ); + } + + if (debug) + { + Info<< " Volumetric integral of htc : " + << fvc::domainIntegrate(htc_).value() + << endl; + } + + //SAF: temporarily output + if (mesh_.time().outputTime()) + { + Tmapped.write(); + htc_.write(); + } + + if (h.dimensions() == dimEnergy/dimMass) + { + const basicThermo& primaryThermo = + mesh_.lookupObject<basicThermo>("thermophysicalProperties"); + + eEqn += htc_*Tmapped - fvm::Sp(htc_/primaryThermo.Cp(), h); + + if (debug) + { + Info<< " Energy exchange from region " << secondaryMesh.name() + << " To " << mesh_.name() << " : " + << fvc::domainIntegrate + ( + htc_*(h/primaryThermo.Cp() - Tmapped) + ).value() + << endl; + } + } + else if(h.dimensions() == dimTemperature) + { + eEqn += htc_*Tmapped - fvm::Sp(htc_, h); + + if (debug) + { + Info<< " Enegy exchange from region " << secondaryMesh.name() + << " To " << mesh_.name() << " : " + << fvc::domainIntegrate(htc_*(h - Tmapped)).value() + << endl; + } + } +} + + +void Foam::interRegionHeatTransferModel::writeData(Ostream& os) const +{ + os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl; + os.writeKeyword("mapRegionName") << mapRegionName_ + << token::END_STATEMENT << nl; + os.writeKeyword("secondarySourceName") << secondarySourceName_ + << token::END_STATEMENT << nl; + + os.writeKeyword("master") << master_ << token::END_STATEMENT << nl; + + if (dict_.found("note")) + { + os.writeKeyword("note") << string(dict_.lookup("note")) + << token::END_STATEMENT << nl; + } + + dict_.write(os); +} + + +bool Foam::interRegionHeatTransferModel::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + return true; + } + else + { + return false; + } +} +// ************************************************************************* // diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H b/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H new file mode 100644 index 0000000000000000000000000000000000000000..38c8141bed017e28b0a94f286fdadd2a44bcaf8f --- /dev/null +++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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::interRegionHeatTransferModel + +Description + Base class for inter region heat exchange. The derived classes must + provide the heat transfer coefficient (htc) + NOTE: mapToMap does to work in paralell + +\*---------------------------------------------------------------------------*/ + +#ifndef interRegionHeatTransferModel_H +#define interRegionHeatTransferModel_H + +#include "basicSource.H" +#include "volFields.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class interRegionHeatTransferModel Declaration +\*---------------------------------------------------------------------------*/ + +class interRegionHeatTransferModel +: + public basicSource +{ + +private: + + // Private data + + //- Pointer to secondary interRegionHeatTransferModel + interRegionHeatTransferModel* secIrht_; + + //- First iteration + bool firstIter_; + + + // Private members + + //- Check coupled interRegionHeatTransferModel + void check(); + + +protected: + + // Protected data + + //- Heat transfer coefficient [W/m2/k] by area/volume [1/m] + // registered on the master mesh + volScalarField htc_; + + +public: + + //- Runtime type information + TypeName("interRegionHeatTransferModel"); + + + // Constructors + + //- Construct from dictionary + interRegionHeatTransferModel + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~interRegionHeatTransferModel(); + + + // Member Functions + + + // Access + + //- Return the heat transfer coefficient + const volScalarField& htc() const + { + return htc_; + } + + //-Source term to fvMatrix<scalar> + virtual void addSup(fvMatrix<scalar>& eEqn, const label fieldI); + + //- Calculate heat transfer coefficient + virtual const tmp<volScalarField> calculateHtc() = 0; + + + // 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/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C b/src/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C new file mode 100644 index 0000000000000000000000000000000000000000..5a6a22d295b24bf7d735fde573ca7cdc1a9477f1 --- /dev/null +++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 "tabulatedHeatTransfer.H" + +#include "turbulenceModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(tabulatedHeatTransfer, 0); + addToRunTimeSelectionTable + ( + basicSource, + tabulatedHeatTransfer, + dictionary + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::tabulatedHeatTransfer::tabulatedHeatTransfer +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + interRegionHeatTransferModel(name, modelType, dict, mesh), + hTable_(), + area_() +{ + if (master_) + { + hTable_.reset + ( + new interpolation2DTable<scalar> + ( + dict.subDict(typeName + "Coeffs") + ) + ); + area_.reset + ( + new volScalarField + ( + IOobject + ( + "area", + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) + ); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::tabulatedHeatTransfer::~tabulatedHeatTransfer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +const Foam::tmp<Foam::volScalarField>Foam::tabulatedHeatTransfer:: +calculateHtc() +{ + const fvMesh& secondaryMesh = + mesh_.time().lookupObject<fvMesh>(mapRegionName()); + + const volVectorField& Usecondary = + secondaryMesh.lookupObject<volVectorField>("U"); + + scalarField UMagMapped(htc_.internalField().size(), 0.0); + + secondaryToPrimaryInterpPtr_->interpolateInternalField + ( + UMagMapped, + mag(Usecondary), + meshToMesh::MAP, + eqOp<scalar>() + ); + + const volVectorField& U = mesh_.lookupObject<volVectorField>("U"); + + forAll (htc_.internalField(), i) + { + htc_.internalField()[i] = + hTable_->operator()(mag(U[i]), UMagMapped[i]); + } + + htc_.internalField() = htc_*area_/mesh_.V(); + + return htc_; +} + + +void Foam::tabulatedHeatTransfer::writeData(Ostream& os) const +{ + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + interRegionHeatTransferModel::writeData(os); + + os << indent << "tabulatedHeatTransfer"; + + dict_.write(os); + + os << decrIndent << indent << token::END_BLOCK << endl; +} + + +bool Foam::tabulatedHeatTransfer::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // \ No newline at end of file diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H b/src/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H new file mode 100644 index 0000000000000000000000000000000000000000..e5c37fdf3b94629bc911f952b240ae2b93f6e112 --- /dev/null +++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H @@ -0,0 +1,112 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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::tabulatedHeatTransfer + +Description + Tabulated heat transfer model. The heat exchange area must be + provided. The 2D table look for heat transfer coefficients uses the + primary and secondary region velocities + +\*---------------------------------------------------------------------------*/ + +#ifndef tabulatedHeatTransfer_H +#define tabulatedHeatTransfer_H + +#include "interRegionHeatTransferModel.H" +#include "autoPtr.H" +#include "interpolation2DTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class tabulatedHeatTransfer Declaration +\*---------------------------------------------------------------------------*/ + +class tabulatedHeatTransfer +: + public interRegionHeatTransferModel +{ +private: + + // Private data + + //- 2D look up table + autoPtr<interpolation2DTable<scalar> > hTable_; + + //- Area of heat exchange + autoPtr<volScalarField> area_; + + +public: + + //- Runtime type information + TypeName("tabulatedHeatTransfer"); + + + // Constructors + + //- Construct from dictionary + tabulatedHeatTransfer + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~tabulatedHeatTransfer(); + + + // Public Functions + + //- Calculate the heat transfer coefficient + virtual const tmp<volScalarField> calculateHtc(); + + + // 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/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C b/src/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C new file mode 100644 index 0000000000000000000000000000000000000000..bce2c5a66ab86241881bc8d0d97d241d6bc7da13 --- /dev/null +++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C @@ -0,0 +1,187 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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 "variableHeatTransfer.H" +#include "IObasicSourceList.H" +#include "turbulenceModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(variableHeatTransfer, 0); + addToRunTimeSelectionTable + ( + basicSource, + variableHeatTransfer, + dictionary + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::variableHeatTransfer::variableHeatTransfer +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + interRegionHeatTransferModel(name, modelType, dict, mesh), + a_(0), + b_(0), + c_(0), + ds_(0), + Pr_(0), + area_() +{ + if (master_) + { + a_ = readScalar(dict_.lookup("a")); + b_ = readScalar(dict_.lookup("b")); + c_ = readScalar(dict_.lookup("c")); + ds_ = readScalar(dict_.lookup("ds")); + Pr_ = readScalar(dict_.lookup("Pr")); + area_.reset + ( + new volScalarField + ( + IOobject + ( + "area", + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ) + ); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::variableHeatTransfer::~variableHeatTransfer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +const Foam::tmp<Foam::volScalarField> Foam::variableHeatTransfer:: +calculateHtc() +{ + + const fvMesh& secondaryMesh = + mesh_.time().lookupObject<fvMesh>(mapRegionName()); + + const compressible::turbulenceModel& turb = + secondaryMesh.lookupObject<compressible::turbulenceModel> + ( + "turbulenceModel" + ); + + const basicThermo& secondaryThermo = + secondaryMesh.lookupObject<basicThermo> + ( + "thermophysicalProperties" + ); + + const volVectorField& U = + secondaryMesh.lookupObject<volVectorField>("U"); + + const volScalarField Re + ( + mag(U)*ds_*secondaryThermo.rho()/turb.mut() + ); + + const volScalarField Nu(a_*pow(Re, b_)*pow(Pr_, c_)); + + const volScalarField K(turb.alphaEff()*secondaryThermo.Cp()); + + scalarField htcMapped(htc_.internalField().size(), 0.0); + + secondaryToPrimaryInterpPtr_->interpolateInternalField + ( + htcMapped, + Nu*K/ds_, + meshToMesh::MAP, + eqOp<scalar>() + ); + + htc_.internalField() = htcMapped*area_/mesh_.V(); + + return htc_; +} + + +void Foam::variableHeatTransfer::writeData(Ostream& os) const +{ + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + interRegionHeatTransferModel::writeData(os); + + os.writeKeyword("a") << a_ << token::END_STATEMENT << nl; + os.writeKeyword("b") << b_ << token::END_STATEMENT << nl; + os.writeKeyword("c") << c_ << token::END_STATEMENT << nl; + os.writeKeyword("ds") << ds_ << token::END_STATEMENT << nl; + os.writeKeyword("Pr") << Pr_ << token::END_STATEMENT << nl; + + os << indent << "variableHeatTransfer"; + + dict_.write(os); + + os << decrIndent << indent << token::END_BLOCK << endl; +} + + +bool Foam::variableHeatTransfer::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + + const dictionary& sourceDict = dict.subDict(name()); + const dictionary& subDictCoeffs = + sourceDict.subDict(typeName + "Coeffs"); + subDictCoeffs.readIfPresent("a", a_); + subDictCoeffs.readIfPresent("b", b_); + subDictCoeffs.readIfPresent("c", c_); + subDictCoeffs.readIfPresent("ds", ds_); + subDictCoeffs.readIfPresent("Pr", Pr_); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // \ No newline at end of file diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H b/src/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H new file mode 100644 index 0000000000000000000000000000000000000000..1d8f25caadca2518bed348a1675bc31619396bf6 --- /dev/null +++ b/src/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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::variableHeatTransfer + +Description + Variable heat transfer model depending on local values. The area of contact + between regions (area) must be provided. The Nu number is calculated as: + + Nu = a*pow(Re, b)*pow(Pr, c) + + and the heat transfer coefficient as: + + htc = Nu*K/ds + + where: + K is the heat conduction + ds is the strut diameter + +\*---------------------------------------------------------------------------*/ + +#ifndef variableHeatTransfer_H +#define variableHeatTransfer_H + +#include "interRegionHeatTransferModel.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class variableHeatTransfer Declaration +\*---------------------------------------------------------------------------*/ + +class variableHeatTransfer +: + public interRegionHeatTransferModel +{ +private: + + // Private data + + //- Model constants + scalar a_; + scalar b_; + scalar c_; + + //- Strut diameter + scalar ds_; + + //- Fluid Prandt number + scalar Pr_; + + //- Area of heat exchange + autoPtr<volScalarField> area_; + + +public: + + //- Runtime type information + TypeName("variableHeatTransfer"); + + + // Constructors + + //- Construct from dictionary + variableHeatTransfer + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~variableHeatTransfer(); + + + // Public Functions + + //- Calculate the heat transfer coefficient + virtual const tmp<volScalarField> calculateHtc(); + + + // 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/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C b/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C rename to src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H b/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H rename to src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C b/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C rename to src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C b/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C rename to src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H b/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H rename to src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C b/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C rename to src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.C b/src/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.C rename to src/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.H b/src/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.H rename to src/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C b/src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C rename to src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.H b/src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.H rename to src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.C b/src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.C rename to src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.H b/src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.H rename to src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.C b/src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.C rename to src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.H b/src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.H rename to src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C b/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C rename to src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H b/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H rename to src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C rename to src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H rename to src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C b/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C similarity index 100% rename from src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C rename to src/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C