Commit d7641047 authored by Henry Weller's avatar Henry Weller Committed by Andrew Heather
Browse files

externalWallHeatFluxTemperature: Changed Ta entry to Function1 to support time variation

Temporal variation of Ta is generally more useful than spatial variation but
a run-time switch between the two modes of operation could be implemented in
needed.
parent 70bed0e8
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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 "Uniform.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::Function1Types::Uniform<Type>::Uniform
(
const word& entryName,
const dictionary& dict
)
:
Constant<Type>(entryName, dict)
{}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 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::Function1Types::Uniform
Description
Templated function that returns a constant value.
Provides backward-compatibility for cases where a field is spatially
"uniform" and may be treated as a constant value.
Usage - for entry \<entryName\> returning the value <value>:
\verbatim
<entryName> uniform <value>
\endverbatim
SourceFiles
Uniform.C
\*---------------------------------------------------------------------------*/
#ifndef Uniform_H
#define Uniform_H
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace Function1Types
{
/*---------------------------------------------------------------------------*\
Class Uniform Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class Uniform
:
public Constant<Type>
{
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const Uniform<Type>&);
public:
// Runtime type information
TypeName("uniform");
// Constructors
//- Construct from entry name and dictionary
Uniform(const word& entryName, const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Function1Types
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "Uniform.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -41,6 +41,7 @@ License
#define makeFunction1s(Type) \
makeFunction1(Type); \
makeFunction1Type(Constant, Type); \
makeFunction1Type(Uniform, Type); \
makeFunction1Type(ZeroConstant, Type); \
makeFunction1Type(OneConstant, Type); \
makeFunction1Type(Polynomial, Type); \
......
......@@ -58,6 +58,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
temperatureCoupledBase(patch(), "undefined", "undefined", "undefined-K"),
mode_(fixedHeatFlux),
Q_(0),
Ta_(),
relaxation_(1),
emissivity_(0),
qrRelaxation_(1),
......@@ -83,6 +84,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
temperatureCoupledBase(patch(), dict),
mode_(operationModeNames.lookup("mode", dict)),
Q_(0),
Ta_(Function1<scalar>::New("Ta", dict)),
relaxation_(dict.lookupOrDefault<scalar>("relaxation", 1)),
emissivity_(dict.lookupOrDefault<scalar>("emissivity", 0)),
qrRelaxation_(dict.lookupOrDefault<scalar>("qrRelaxation", 1)),
......@@ -107,7 +109,6 @@ externalWallHeatFluxTemperatureFvPatchScalarField
case fixedHeatTransferCoeff:
{
h_ = scalarField("h", dict, p.size());
Ta_ = scalarField("Ta", dict, p.size());
if (dict.found("thicknessLayers"))
{
......@@ -176,7 +177,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
Q_(ptf.Q_),
q_(ptf.q_, mapper),
h_(ptf.h_, mapper),
Ta_(ptf.Ta_, mapper),
Ta_(ptf.Ta_, false),
relaxation_(ptf.relaxation_),
emissivity_(ptf.emissivity_),
qrPrevious_(ptf.qrPrevious_, mapper),
......@@ -200,7 +201,6 @@ externalWallHeatFluxTemperatureFvPatchScalarField
case fixedHeatTransferCoeff:
{
h_.map(ptf.h_, mapper);
Ta_.map(ptf.Ta_, mapper);
break;
}
......@@ -225,7 +225,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
Q_(ewhftpsf.Q_),
q_(ewhftpsf.q_),
h_(ewhftpsf.h_),
Ta_(ewhftpsf.Ta_),
Ta_(ewhftpsf.Ta_, false),
relaxation_(ewhftpsf.relaxation_),
emissivity_(ewhftpsf.emissivity_),
qrPrevious_(ewhftpsf.qrPrevious_),
......@@ -249,7 +249,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
Q_(ewhftpsf.Q_),
q_(ewhftpsf.q_),
h_(ewhftpsf.h_),
Ta_(ewhftpsf.Ta_),
Ta_(ewhftpsf.Ta_, false),
relaxation_(ewhftpsf.relaxation_),
emissivity_(ewhftpsf.emissivity_),
qrPrevious_(ewhftpsf.qrPrevious_),
......@@ -284,7 +284,6 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::autoMap
case fixedHeatTransferCoeff:
{
h_.autoMap(m);
Ta_.autoMap(m);
break;
}
......@@ -323,7 +322,6 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::rmap
case fixedHeatTransferCoeff:
{
h_.rmap(ewhftpsf.h_, addr);
Ta_.rmap(ewhftpsf.Ta_, addr);
break;
}
......@@ -390,7 +388,8 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
}
scalarField hp(1/(1/h_ + totalSolidRes));
scalarField hpTa(hp*Ta_);
const scalar Ta = Ta_->value(this->db().time().timeOutputValue());
scalarField hpTa(hp*Ta);
if (emissivity_ > 0)
{
......@@ -401,18 +400,18 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
// ... including the effect of the solid wall thermal
// resistance
scalarField TpLambda(h_/(h_ + 1/totalSolidRes));
scalarField Ts(TpLambda*Tp + (1 - TpLambda)*Ta_);
scalarField lambdaTa4(pow4((1 - TpLambda)*Ta_));
scalarField Ts(TpLambda*Tp + (1 - TpLambda)*Ta);
scalarField lambdaTa4(pow4((1 - TpLambda)*Ta));
hp += emissivity_*sigma.value()*(pow4(Ts) - lambdaTa4)/Tp;
hpTa += sigma.value()*(emissivity_*lambdaTa4 + pow4(Ta_));
hpTa += sigma.value()*(emissivity_*lambdaTa4 + pow4(Ta));
}
else
{
// ... if there is no solid wall thermal resistance use
// the current wall temperature
hp += emissivity_*sigma.value()*pow3(Tp);
hpTa += sigma.value()*pow4(Ta_);
hpTa += sigma.value()*pow4(Ta);
}
}
......@@ -491,7 +490,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
case fixedHeatTransferCoeff:
{
h_.writeEntry("h", os);
Ta_.writeEntry("Ta", os);
Ta_->writeData(os);
if (relaxation_ < 1)
{
......
......@@ -49,6 +49,9 @@ Description
The thermal conductivity \c kappa can either be retrieved from various
possible sources, as detailed in the class temperatureCoupledBase.
The ambient temperature Ta is specified as a Foam::Function1 of time but
uniform is space.
Usage
\table
Property | Description | Required | Default value
......@@ -75,7 +78,7 @@ Usage
mode coefficient;
Ta uniform 300.0;
Ta constant 300.0;
h uniform 10.0;
thicknessLayers (0.1 0.2 0.3 0.4);
kappaLayers (1 2 3 4);
......@@ -100,6 +103,7 @@ SourceFiles
#include "mixedFvPatchFields.H"
#include "temperatureCoupledBase.H"
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -147,7 +151,7 @@ private:
scalarField h_;
//- Ambient temperature [K]
scalarField Ta_;
autoPtr<Function1<scalar>> Ta_;
//- Relaxation for the wall temperature (thermal inertia)
scalar relaxation_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment