diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C index cdce53e932c44d6927c3c160cb5d3965c9ec7880..97fe34d5868d0b91c3f6077dedf608b6c5f09cae 100644 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C +++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -445,6 +445,13 @@ void Foam::porousZone::writeDict(Ostream& os, bool subDict) const dictPtr->write(os); } + // thermalModel + if (const dictionary* dictPtr = dict_.subDictPtr("thermalModel")) + { + os << indent << "thermalModel"; + dictPtr->write(os); + } + os << decrIndent << indent << token::END_BLOCK << endl; } diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C index dba5a3d470c994e66093b803864f6b18d1a48b22..4f75d3ee135a794e71e752a353a10659874cd633 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,8 +51,8 @@ namespace porousMedia Foam::porousMedia::fixedTemperature::fixedTemperature(const porousZone& pZone) : - thermalModel(pZone, typeName), - T_(readScalar(coeffDict_.lookup("T"))) + thermalModel(pZone), + T_(readScalar(thermalCoeffs_.lookup("T"))) {} diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H index 4ae9aab656f1a9821f26c834efd432f0c2a27f11..5498cf7b90881fee35082d3d9155de8a6cdef708 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,6 @@ Description #define fixedTemperature_H #include "thermalModel.H" -#include "autoPtr.H" #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -81,7 +80,7 @@ public: //- Add the thermal source to the enthalpy equation virtual void addEnthalpySource ( - const basicThermo& thermo, + const basicThermo&, const volScalarField& rho, fvScalarMatrix& hEqn ) const; diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H b/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H index 123a9b2fd5602c3a52778d24b04e6f8f7ca37e59..4f6df998528b47cf7984cdc2be6b0c02da08b40e 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,6 @@ Description #define noThermalModel_H #include "thermalModel.H" -#include "autoPtr.H" #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,7 +72,7 @@ public: //- Add the thermal source to the enthalpy equation virtual void addEnthalpySource ( - const basicThermo& thermo, + const basicThermo&, const volScalarField& rho, fvScalarMatrix& hEqn ) const; diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C index d7e36c8ed8c1b5d23de3432f0bfd50bb49dc5c9c..36d06cf91eda1a1ea82e30337bebf4ca96d4c0c8 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,18 +42,18 @@ namespace porousMedia Foam::porousMedia::thermalModel::thermalModel(const porousZone& pZone) : pZone_(pZone), - coeffDict_(dictionary::null) + thermalCoeffs_(pZone.dict().subDictPtr("thermalModel")) {} Foam::porousMedia::thermalModel::thermalModel ( const porousZone& pZone, - const word& modelType + const dictionary& thermalCoeffs ) : pZone_(pZone), - coeffDict_(pZone_.dict().subDict(modelType + "Coeffs")) + thermalCoeffs_(thermalCoeffs) {} diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H index bda42db68e2462a9189eab4981eb400073d30bcc..a4f762c2852aae136dce11a2191feff6e6cadf35 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,8 +63,8 @@ protected: //- Reference to the porous zone const porousZone& pZone_; - //- Sub-model coefficients dictionary - const dictionary coeffDict_; + //- Thermal model coefficients dictionary + const dictionary thermalCoeffs_; public: @@ -87,11 +87,11 @@ public: // Constructors - //- Construct null from porous zone + //- Construct from porous zone, coefficients from "thermalModel" entry thermalModel(const porousZone&); - //- Construct from porous zone and model type name - thermalModel(const porousZone&, const word& modelType); + //- Construct from porous zone and thermal model coefficients + thermalModel(const porousZone&, const dictionary& thermalCoeffs); //- Destructor @@ -107,7 +107,7 @@ public: //- Add the thermal source to the enthalpy equation virtual void addEnthalpySource ( - const basicThermo& thermo, + const basicThermo&, const volScalarField& rho, fvScalarMatrix& hEqn ) const = 0; diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C index 8b89b7eef1b2dc5d2529c2c4ba97db4a073fa643..731fdeac4a4564447311f0faf121d7e6202f43aa 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,13 @@ Foam::porousMedia::thermalModel::New const porousZone& pZone ) { - const word modelType(pZone.dict().lookup("thermalModel")); + // a missing thermalModel is the same as type "none" + word modelType("none"); + + if (const dictionary* dictPtr = pZone.dict().subDictPtr("thermalModel")) + { + dictPtr->lookup("type") >> modelType; + } Info<< "Selecting thermalModel " << modelType << endl; diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C index 9207716af53621ed6595be03157a7404c5cc6cb2..78ab986742adb6b87a10ed2f2826cf67a36e5bfd 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -51,7 +51,10 @@ void Foam::thermalPorousZone::addEnthalpySource fvScalarMatrix& hEqn ) const { - model_->addEnthalpySource(thermo, rho, hEqn); + if (model_.valid()) + { + model_->addEnthalpySource(thermo, rho, hEqn); + } } diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H index 57d5e2923757537a3a05d4d3c6ec4a829be4bd9b..ce864586f9c131fc730a488c8d4216c5fd4e47f0 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -127,7 +127,7 @@ public: //- Add the thermal source to the enthalpy equation void addEnthalpySource ( - const basicThermo& thermo, + const basicThermo&, const volScalarField& rho, fvScalarMatrix& hEqn ) const; diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C index a7d80ab9b169750a681fb71598d53b2ad1933f66..daccc2574948a8f8e6668e364081924a68f5d67c 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H index f30e0e50c389edfc2d4b226a1e8c6d7661969bd7..2589e51ce5456653f3036ce91a14abd709a6b33d 100644 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H +++ b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,7 +32,8 @@ Description thermalPorousZone. The input file \c constant/thermalPorousZone is implemented as - IOPtrList\<thermalPorousZone\> and contains the following type of data: + IOPtrList\<thermalPorousZone\> (but written as a dictionary) + and contains the following type of data: \verbatim 1 @@ -94,7 +95,7 @@ public: //- Add the thermal source to the enthalpy equation void addEnthalpySource ( - const basicThermo& thermo, + const basicThermo&, const volScalarField& rho, fvScalarMatrix& hEqn ) const; diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porousZones b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porousZones index e4d251bf9eb593fbcd0b9242b50b5182411c360c..ef7fd5ea5e4eab406551708d7ebb93876b289129 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porousZones +++ b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porousZones @@ -31,11 +31,12 @@ FoamFile f f [0 -1 0 0 0 0 0] (0 0 0); } - thermalModel none; // fixedTemperature; - - fixedTemperatureCoeffs + thermalModel { - T 350; + type none; // fixedTemperature; + + // fixedTemperature coefficients + T 350; } } )