functionObjects::wallHeatTransferCoeff: Redesign of the wall heat transfer coefficient (HTC) function object.

Following functionality added:
- support of dimensional inputs
- run time selection mechanism of HTC model (kappaEff, ReynoldsAnalogy)
- kappaEff has now two options for calculating HTC (with/without characteristic length)
- Reynolds Analogy estimation for HTC
- integrated HTC replaced with an average log output

Description
    Calculates and writes the estimated heat transfer coefficient at wall
    patches as the volScalarField field.

    All wall patches are included by default; to restrict the calculation to
    certain patches, use the optional 'patches' entry.

    The models are selected run time by model entry. For detailed description
    look at the header file for specific model under
    wallHeatTransferCoeffModels.

    Example of function object specification:
    \verbatim
    kappaEff1
    {
        type        wallHeatTransferCoeff;
        libs        ("libfieldFunctionObjects.so");
        model       kappaEff;
        ...
        region      fluid;
        patches     (".*Wall");
        rho         1.225;
        Cp          1005;
        Prl         0.707;
        Prt         0.9;
    }
    \endverbatim

    \verbatim
    kappaEff2
    {
        type        wallHeatTransferCoeff;
        libs        ("libfieldFunctionObjects.so");
        model       kappaEff;
        ...
        region      fluid;
        patches     (".*Wall");
        rho         1.225;
        Cp          1005;
        Prl         0.707;
        Prt         0.9;
        Lchar       0.001;
    }
    \endverbatim

    \verbatim
    ReynoldsAnalogy1
    {
        type       wallHeatTransferCoeff;
        libs       ("libfieldFunctionObjects.so");
        model      ReynoldsAnalogy;
        ...
        region     fluid;
        patches    (".*Wall");
        rho        1.225;
        Cp         1005;
        Uref       1.0;
    }
    \endverbatim

Note
    Writing field 'wallHeatTransferCoeff' is done by default, but it can be
    overridden by defining an empty \c objects list. For details see
    writeLocalObjects.
This commit is contained in:
Jakub Knir
2020-11-17 00:44:09 +00:00
parent 4e183e33d4
commit c0978ac0e1
9 changed files with 1010 additions and 131 deletions

View File

@ -54,7 +54,11 @@ yPlus/yPlus.C
turbulenceIntensity/turbulenceIntensity.C
wallShearStress/wallShearStress.C
wallHeatFlux/wallHeatFlux.C
wallHeatTransferCoeff/wallHeatTransferCoeff.C
wallHeatTransferCoeff/wallHeatTransferCoeffModels/wallHeatTransferCoeffModel/wallHeatTransferCoeffModel.C
wallHeatTransferCoeff/wallHeatTransferCoeffModels/kappaEff/kappaEff.C
wallHeatTransferCoeff/wallHeatTransferCoeffModels/ReynoldsAnalogy/ReynoldsAnalogy.C
writeCellCentres/writeCellCentres.C
writeCellVolumes/writeCellVolumes.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,7 @@ License
#include "wallHeatTransferCoeff.H"
#include "kinematicMomentumTransportModel.H"
#include "fluidThermoMomentumTransportModel.H"
#include "wallPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
@ -45,7 +46,7 @@ namespace functionObjects
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::wallHeatTransferCoeff::writeFileHeader
(
@ -58,51 +59,11 @@ void Foam::functionObjects::wallHeatTransferCoeff::writeFileHeader
writeTabbed(file(), "patch");
writeTabbed(file(), "min");
writeTabbed(file(), "max");
writeTabbed(file(), "integral");
writeTabbed(file(), "average");
file() << endl;
}
Foam::tmp<Foam::volScalarField>
Foam::functionObjects::wallHeatTransferCoeff::calcHeatTransferCoeff
(
const volScalarField& nu,
const volScalarField& nut
)
{
tmp<volScalarField> twallHeatTransferCoeff
(
volScalarField::New
(
type(),
mesh_,
dimensionedScalar
(
dimMass/pow3(dimTime)/(dimTemperature/dimLength),
0
)
)
);
volScalarField::Boundary& wallHeatTransferCoeffBf =
twallHeatTransferCoeff.ref().boundaryFieldRef();
const volScalarField::Boundary& nuBf = nu.boundaryField();
const volScalarField::Boundary& nutBf = nut.boundaryField();
forAll(wallHeatTransferCoeffBf, patchi)
{
if (!wallHeatTransferCoeffBf[patchi].coupled())
{
wallHeatTransferCoeffBf[patchi] =
rho_*Cp_*(nuBf[patchi]/Prl_ + nutBf[patchi]/Prt_);
}
}
return twallHeatTransferCoeff;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::wallHeatTransferCoeff::wallHeatTransferCoeff
@ -115,8 +76,12 @@ Foam::functionObjects::wallHeatTransferCoeff::wallHeatTransferCoeff
fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name),
writeLocalObjects(obr_, log),
rho_("rho", dimDensity, Zero),
Cp_("Cp", dimArea/sqr(dimTime)/dimTemperature, Zero),
runTime_(runTime),
patchSet_()
{
coeffModel_ = wallHeatTransferCoeffModel::New(dict.name(), mesh_, dict);
read(dict);
resetName(typeName);
resetLocalObjectName(typeName);
@ -136,15 +101,27 @@ bool Foam::functionObjects::wallHeatTransferCoeff::read(const dictionary& dict)
fvMeshFunctionObject::read(dict);
writeLocalObjects::read(dict);
const momentumTransportModel& mmtm =
lookupObject<momentumTransportModel>
(
momentumTransportModel::typeName
);
if (isA<incompressible::momentumTransportModel>(mmtm))
{
rho_.read(dict);
Cp_.read(dict);
}
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
patchSet_ =
mesh_.boundaryMesh().patchSet
pbm.patchSet
(
wordReList(dict.lookupOrDefault("patches", wordReList()))
);
Info<< type() << " " << name() << ":" << nl;
Info<< type() << ":" << nl;
if (patchSet_.empty())
{
@ -173,8 +150,8 @@ bool Foam::functionObjects::wallHeatTransferCoeff::read(const dictionary& dict)
else
{
WarningInFunction
<< "Requested wall heat-transferCoeff on non-wall boundary "
<< "type patch: " << pbm[patchi].name() << endl;
<< "Requested wall heat-transferCoeff on non-wall boundary"
<< " type patch: " << pbm[patchi].name() << nl << endl;
}
}
@ -183,10 +160,7 @@ bool Foam::functionObjects::wallHeatTransferCoeff::read(const dictionary& dict)
patchSet_ = filteredPatchSet;
}
dict.lookup("rho") >> rho_;
dict.lookup("Cp") >> Cp_;
dict.lookup("Prl") >> Prl_;
dict.lookup("Prt") >> Prt_;
coeffModel_->read(dict);
return true;
}
@ -194,49 +168,41 @@ bool Foam::functionObjects::wallHeatTransferCoeff::read(const dictionary& dict)
bool Foam::functionObjects::wallHeatTransferCoeff::execute()
{
word name(type());
if
(
foundObject<incompressible::momentumTransportModel>
tmp<volScalarField> thtc;
const momentumTransportModel& mmtm =
lookupObject<momentumTransportModel>
(
momentumTransportModel::typeName
)
)
{
const incompressible::momentumTransportModel& turbModel =
lookupObject<incompressible::momentumTransportModel>
(
momentumTransportModel::typeName
);
return store
(
name,
calcHeatTransferCoeff(turbModel.nu(), turbModel.nut())
);
}
else
{
FatalErrorInFunction
<< "Unable to find incompressible turbulence model in the "
<< "database" << exit(FatalError);
return false;
thtc = coeffModel_->htcByRhoCp(mmtm, patchSet_);
if (isA<incompressible::momentumTransportModel>(mmtm))
{
thtc.ref() *= rho_*Cp_;
}
else if (isA<compressible::momentumTransportModel>(mmtm))
{
const compressible::momentumTransportModel& mtm =
refCast<const compressible::momentumTransportModel>(mmtm);
thtc.ref() *= mtm.rho()*mtm.thermo().Cp();
}
store("wallHeatTransferCoeff", thtc);
return true;
}
bool Foam::functionObjects::wallHeatTransferCoeff::write()
{
Log << type() << " " << name() << " write:" << nl;
Log << name() << " write:" << nl;
writeLocalObjects::write();
logFiles::write();
const volScalarField& wallHeatTransferCoeff =
obr_.lookupObject<volScalarField>(type());
const volScalarField& htc = obr_.lookupObject<volScalarField>(type());
const fvPatchList& patches = mesh_.boundary();
@ -248,11 +214,12 @@ bool Foam::functionObjects::wallHeatTransferCoeff::write()
label patchi = iter.key();
const fvPatch& pp = patches[patchi];
const scalarField& hfp = wallHeatTransferCoeff.boundaryField()[patchi];
const scalarField& hfp = htc.boundaryField()[patchi];
const scalar minHtcp = gMin(hfp);
const scalar maxHtcp = gMax(hfp);
const scalar integralHtcp = gSum(magSf[patchi]*hfp);
const scalar averageHtcp =
gSum(magSf[patchi]*hfp)/gSum(magSf[patchi]);
if (Pstream::master())
{
@ -261,12 +228,12 @@ bool Foam::functionObjects::wallHeatTransferCoeff::write()
<< tab << pp.name()
<< tab << minHtcp
<< tab << maxHtcp
<< tab << integralHtcp
<< tab << averageHtcp
<< endl;
}
Log << " min/max/integ(" << pp.name() << ") = "
<< minHtcp << ", " << maxHtcp << ", " << integralHtcp << endl;
Log << " min/max/average(" << pp.name() << ") = "
<< minHtcp << ", " << maxHtcp << ", " << averageHtcp << endl;
}
Log << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,19 +25,23 @@ Class
Foam::functionObjects::wallHeatTransferCoeff
Description
Calculates and write the estimated incompressible flow heat transfer
coefficient at wall patches as the volScalarField field
'wallHeatTransferCoeff'.
Calculates and writes the estimated heat transfer coefficient at wall
patches as the volScalarField field.
All wall patches are included by default; to restrict the calculation to
certain patches, use the optional 'patches' entry.
The models are selected run time by model entry. For detailed description
look at the header file for specific model under
wallHeatTransferCoeffModels.
Example of function object specification:
\verbatim
wallHeatTransferCoeff1
kappaEff1
{
type wallHeatTransferCoeff;
libs ("libfieldFunctionObjects.so");
model kappaEff;
...
region fluid;
patches (".*Wall");
@ -48,17 +52,37 @@ Description
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | Type name: wallHeatTransferCoeff | yes |
patches | List of patches to process | no | all wall patches
region | Region to be evaluated | no | default region
rho | Fluid density | yes |
Cp | Fluid heat capacity | yes |
Prl | Fluid laminar Prandtl number | yes |
Prt | Fluid turbulent Prandtl number| yes |
\endtable
\verbatim
kappaEff2
{
type wallHeatTransferCoeff;
libs ("libfieldFunctionObjects.so");
model kappaEff;
...
region fluid;
patches (".*Wall");
rho 1.225;
Cp 1005;
Prl 0.707;
Prt 0.9;
Lchar 0.001;
}
\endverbatim
\verbatim
ReynoldsAnalogy1
{
type wallHeatTransferCoeff;
libs ("libfieldFunctionObjects.so");
model ReynoldsAnalogy;
...
region fluid;
patches (".*Wall");
rho 1.225;
Cp 1005;
Uref 1.0;
}
\endverbatim
Note
Writing field 'wallHeatTransferCoeff' is done by default, but it can be
@ -83,8 +107,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "logFiles.H"
#include "writeLocalObjects.H"
#include "HashSet.H"
#include "volFieldsFwd.H"
#include "wallHeatTransferCoeffModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -104,38 +127,39 @@ class wallHeatTransferCoeff
public writeLocalObjects
{
private:
// Protected data
// Pointer to the model
autoPtr<wallHeatTransferCoeffModel> coeffModel_;
// Return wall shear stress
tmp<volSymmTensorField> devSigma();
// Private data
//- Density [kg/m^3]
dimensionedScalar rho_;
//- Specific capacity [J/K/kg]
dimensionedScalar Cp_;
protected:
// Protected data
//- Reference to Time
const Time& runTime_;
//- Optional list of patches to process
labelHashSet patchSet_;
//- Fluid density
scalar rho_;
//- Fluid heat capacity
scalar Cp_;
//- Fluid laminar Prandtl number
scalar Prl_;
//- Fluid turbulent Prandtl number
scalar Prt_;
// Protected Member Functions
//- File header information
virtual void writeFileHeader(const label i);
//- Calculate the heat transfer coefficient
tmp<volScalarField> calcHeatTransferCoeff
(
const volScalarField& nu,
const volScalarField& nut
);
public:
@ -145,17 +169,14 @@ public:
// Constructors
//- Construct from Time and dictionary
//- Construct from name, mesh and dict
wallHeatTransferCoeff
(
const word& name,
const Time& runTime,
const dictionary&
const dictionary& dict
);
//- Disallow default bitwise copy construction
wallHeatTransferCoeff(const wallHeatTransferCoeff&) = delete;
//- Destructor
virtual ~wallHeatTransferCoeff();
@ -163,7 +184,7 @@ public:
// Member Functions
//- Read the wallHeatTransferCoeff data
//- Read the wallHeatTransferCoeffs data
virtual bool read(const dictionary&);
//- Calculate the wall heat transfer coefficient

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 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 "ReynoldsAnalogy.H"
#include "kinematicMomentumTransportModel.H"
#include "fluidThermoMomentumTransportModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace wallHeatTransferCoeffModels
{
defineTypeNameAndDebug(ReynoldsAnalogy, 0);
addToRunTimeSelectionTable
(
wallHeatTransferCoeffModel,
ReynoldsAnalogy,
word
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallHeatTransferCoeffModels::ReynoldsAnalogy::ReynoldsAnalogy
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
)
:
wallHeatTransferCoeffModel(name, mesh, dict),
mesh_(mesh),
Uref_("Uref", dimVelocity, dict)
{
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallHeatTransferCoeffModels::ReynoldsAnalogy::~ReynoldsAnalogy()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::wallHeatTransferCoeffModels::ReynoldsAnalogy::read
(
const dictionary& dict
)
{
Uref_.read(dict);
return true;
}
Foam::tmp<Foam::volScalarField>
Foam::wallHeatTransferCoeffModels::ReynoldsAnalogy::htcByRhoCp
(
const momentumTransportModel& mmtm,
const labelHashSet& patches
) const
{
tmp<volSymmTensorField> ttau(this->tau(mmtm, mesh_));
const volSymmTensorField::Boundary& tauBf = ttau.ref().boundaryField();
// Create temporary field for heat transfer coefficient
tmp<volScalarField> thtcByRhoCp
(
volScalarField::New
(
type(),
mesh_,
dimensionedScalar(dimLength/dimTime, 0)
)
);
volScalarField::Boundary& thtcByRhoCpBf =
thtcByRhoCp.ref().boundaryFieldRef();
forAll(thtcByRhoCpBf, patchi)
{
if (!thtcByRhoCpBf[patchi].coupled())
{
const vectorField nf(tauBf[patchi].patch().nf());
// Wall shear stress in [m^2/s^2]
tmp<vectorField> tauwp(-nf&tauBf[patchi]);
// Non-dimensional skin friction coefficient [-]
const scalarField Cf(2*mag(tauwp)/sqr(Uref_.value()));
thtcByRhoCpBf[patchi] = 0.5*Uref_.value()*Cf;
}
}
return thtcByRhoCp;
}
// ************************************************************************* //

View File

@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 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::wallHeatTransferCoeffModels::ReynoldsAnalogy
Description
Calculates and writes the estimated flow heat transfer coefficient at wall
patches as the volScalarField field 'wallHeatTransferCoeff' using Reynolds
Analogy.
Reynolds Analogy model, given by:
\f[
htc = 0.5 \rho C_p |U_{ref}| C_f
\f]
where
\vartable
rho | Density [kg/m^3]
Cp | Specific heat capacity [m^2/K/s^2)]
Uref | Far field velocity magnitude [m/s]
Cf | Skin friction coefficient []
\endvartable
All wall patches are included by default; to restrict the calculation to
certain patches, use the optional 'patches' entry.
Example of function object specification:
\verbatim
ReynoldsAnalogy1
{
type wallHeatTransferCoeff;
libs ("libfieldFunctionObjects.so");
model ReynoldsAnalogy;
...
region fluid;
patches (".*Wall");
rho 1.225;
Cp 1005;
Uref 1.0;
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | type name: wallHeatTransferCoeff | yes |
model | Type name: ReynoldsAnalogy | no | kappaEff
patches | List of patches to process | no | all wall patches
region | Region to be evaluated | no | default region
rho | Density | yes |
Cp | Specific heat capacity | yes |
Uref | Reference velocity magnitude | yes | no
\endtable
Note
Cp and rho are required only for incompressible flow calclulations.
SourceFiles
ReynoldsAnalogy.C
\*---------------------------------------------------------------------------*/
#ifndef wallHeatTransferCoeffModels_ReynoldsAnalogy_H
#define wallHeatTransferCoeffModels_ReynoldsAnalogy_H
#include "wallHeatTransferCoeffModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace wallHeatTransferCoeffModels
{
/*---------------------------------------------------------------------------*\
Class ReynoldsAnalogy Declaration
\*---------------------------------------------------------------------------*/
class ReynoldsAnalogy
:
public wallHeatTransferCoeffModel
{
// Private Data
//- Reference to mesh
const fvMesh& mesh_;
//- Reference velocity magnitude [m/s]
dimensionedScalar Uref_;
// Private member functions
//- Calculate the wall shear-stress
tmp<volVectorField> calcShearStress
(
const volSymmTensorField& tau
);
public:
//- Runtime type information
TypeName("ReynoldsAnalogy");
// Constructors
//- Construct from name, mesh and dict
ReynoldsAnalogy
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
);
//- Disallow default bitwise copy construction
ReynoldsAnalogy
(
const ReynoldsAnalogy&
) = delete;
//- Destructor
virtual ~ReynoldsAnalogy();
// Member Functions
//- Read the ReynoldsAnalogy data
virtual bool read(const dictionary&);
//- Calculate the heat transfer coefficient
virtual tmp<volScalarField> htcByRhoCp
(
const momentumTransportModel& mmtm,
const labelHashSet& patches
) const;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const ReynoldsAnalogy&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace wallHeatTransferCoeffModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 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 "kappaEff.H"
#include "kinematicMomentumTransportModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace wallHeatTransferCoeffModels
{
defineTypeNameAndDebug(kappaEff, 0);
addToRunTimeSelectionTable
(
wallHeatTransferCoeffModel,
kappaEff,
word
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallHeatTransferCoeffModels::kappaEff::kappaEff
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
)
:
wallHeatTransferCoeffModel(name, mesh, dict),
mesh_(mesh),
Prl_("Prl", dimless, dict),
Prt_("Prl", dimless, dict),
Lchar_("Lchar", dimLength, dict),
isCharLength_(false)
{
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallHeatTransferCoeffModels::kappaEff::~kappaEff()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::wallHeatTransferCoeffModels::kappaEff::read(const dictionary& dict)
{
Prl_.read(dict);
Prt_.read(dict);
Lchar_.lookupOrDefault("Lchar", dict, dimLength);
isCharLength_ = dict.found("Lchar") ? true : false;
return true;
}
Foam::tmp<Foam::volScalarField>
Foam::wallHeatTransferCoeffModels::kappaEff::htcByRhoCp
(
const momentumTransportModel& mmtm,
const labelHashSet& patches
) const
{
tmp<volScalarField> thtcByRhoCp
(
volScalarField::New
(
type(),
mesh_,
isCharLength_
? dimensionedScalar(dimLength/dimTime, 0)
: dimensionedScalar(dimArea/dimTime, 0)
)
);
volScalarField::Boundary& thtcByRhoCpBf =
thtcByRhoCp.ref().boundaryFieldRef();
forAllConstIter(labelHashSet, patches, iter)
{
label patchi = iter.key();
if (!thtcByRhoCpBf[patchi].coupled())
{
thtcByRhoCpBf[patchi] =
mmtm.nu(patchi)/Prl_.value() + mmtm.nut(patchi)/Prt_.value();
if (isCharLength_)
{
thtcByRhoCpBf[patchi] /= Lchar_.value();
}
}
}
return thtcByRhoCp;
}
// ************************************************************************* //

View File

@ -0,0 +1,200 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 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::wallHeatTransferCoeffModels::kappaEff
Description
Calculates the estimated flow heat transfer coefficient at wall patches
as the volScalarField field 'kappaEff' using one of equeations bellow.
kappaEff model, given by:
\f[
htc = \rho*C_p*({\frac{\nu}{Prl} + \frac{\nu_t}{Prt}})
\f]
kappaEff model with characteristic length, given by:
\f[
htc =
\rho*C_p*({\frac{\nu}{Prl} + \frac{\nu_t}{Prt}})\frac{1}{L_{char}};
\f]
where
\vartable
rho | Density [kg/m^3]
Cp | Specific heat capacity [m^2/K/s^2)]
Prl | Fluid laminar Prandtl number []
Prt | Fluid turbulent Prandtl number []
Lchar | Characteristic length [m]
\endvartable
Example of function object specification:
\verbatim
kappaEff1
{
type wallHeatTransferCoeff;
libs ("libfieldFunctionObjects.so");
model kappaEff;
...
region fluid;
patches (".*Wall");
rho 1.225;
Cp 1005;
Prl 0.707;
Prt 0.9;
}
\endverbatim
\verbatim
kappaEff2
{
type wallHeatTransferCoeff;
libs ("libfieldFunctionObjects.so");
model kappaEff;
...
region fluid;
patches (".*Wall");
rho 1.225;
Cp 1005;
Prl 0.707;
Prt 0.9;
Lchar 0.001;
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | Type name: wallHeatTransferCoeff | yes |
model | Type name: kappaEff | no | kappaEff
patches | List of patches to process | no | all wall patches
region | Region to be evaluated | no | default region
rho | Fluid density | yes |
Cp | Fluid heat capacity | yes |
Prl | Fluid laminar Prandtl number | yes |
Prt | Fluid turbulent Prandtl number| yes |
Lchar | Characteristic length | no | no
\endtable
Note
Cp and rho are required only for incompressible flow calclulations.
SourceFiles
kappaEff.C
\*---------------------------------------------------------------------------*/
#ifndef wallHeatTransferCoeffModels_kappaEff_H
#define wallHeatTransferCoeffModels_kappaEff_H
#include "wallHeatTransferCoeffModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace wallHeatTransferCoeffModels
{
/*---------------------------------------------------------------------------*\
Class kappaEff Declaration
\*---------------------------------------------------------------------------*/
class kappaEff
:
public wallHeatTransferCoeffModel
{
// Private data
//- Reference to mesh
const fvMesh& mesh_;
//- Fluid laminar Prandtl number
dimensionedScalar Prl_;
//- Fluid turbulent Prandtl number
dimensionedScalar Prt_;
//- Characteristic length
dimensionedScalar Lchar_;
//- Is characteristic length used?
bool isCharLength_;
public:
//- Runtime type information
TypeName("kappaEff");
// Constructors
//- Construct from name, mesh and dict
kappaEff
(
const word& name,
const fvMesh& mesh,
const dictionary&
);
//- Disallow default bitwise copy construction
kappaEff(const kappaEff&) = delete;
//- Destructor
virtual ~kappaEff();
// Member Functions
//- Read the kappaEff data
virtual bool read(const dictionary&);
//- Calculate the wall heat transfer coefficient
virtual tmp<volScalarField> htcByRhoCp
(
const momentumTransportModel& mmtm,
const labelHashSet& patches
) const;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const kappaEff&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace wallHeatTransferCoeffModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 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 "wallHeatTransferCoeffModel.H"
#include "fluidThermoMomentumTransportModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(wallHeatTransferCoeffModel, 0);
defineRunTimeSelectionTable(wallHeatTransferCoeffModel, word);
}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::wallHeatTransferCoeffModel>
Foam::wallHeatTransferCoeffModel::New
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
)
{
const word model(dict.lookupOrDefault<word>("model", "kappaEff"));
if (debug)
{
Info<< "Selecting heat transfer coefficient type: "
<< model << endl;
}
wordConstructorTable::iterator cstrIter =
wordConstructorTablePtr_->find(model);
if (cstrIter == wordConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown heat transfer coefficient type "
<< model << nl << nl
<< "Valid coefficient types: " << endl
<< wordConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<wallHeatTransferCoeffModel>(cstrIter()(name, mesh, dict));
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::volSymmTensorField> Foam::wallHeatTransferCoeffModel::tau
(
const momentumTransportModel& mmtm,
const fvMesh& mesh
) const
{
if (isA<incompressible::momentumTransportModel>(mmtm))
{
return
refCast<const incompressible::momentumTransportModel>
(
mmtm
).devSigma();
}
else if (isA<compressible::momentumTransportModel>(mmtm))
{
return
refCast<const compressible::momentumTransportModel>(mmtm).devTau()
/refCast<const compressible::momentumTransportModel>(mmtm).rho();
}
else
{
FatalErrorInFunction
<< "The type of momentum transport model was not recognised"
<< exit(FatalError);
}
return tmp<Foam::volSymmTensorField>();
}
// ************************************************************************* //

View File

@ -0,0 +1,148 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 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::wallHeatTransferCoeffModel
Description
Abstract base class for run time selection of heat transfer coefficient
models.
SourceFiles
wallHeatTransferCoeffModel.C
\*---------------------------------------------------------------------------*/
#ifndef wallHeatTransferCoeffModel_H
#define wallHeatTransferCoeffModel_H
#include "kinematicMomentumTransportModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class wallHeatTransferCoeffModel Declaration
\*---------------------------------------------------------------------------*/
class wallHeatTransferCoeffModel
{
public:
//- Runtime type information
TypeName("wallHeatTransferCoeffModel");
// Declare run-time selection table
declareRunTimeSelectionTable
(
autoPtr,
wallHeatTransferCoeffModel,
word,
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
),
(name, mesh, dict)
);
// Constructors
//- Construct from name, mesh and dict
wallHeatTransferCoeffModel
(
const word& name,
const fvMesh& mesh,
const dictionary&
)
{}
//- Disallow default bitwise copy construction
wallHeatTransferCoeffModel(const wallHeatTransferCoeffModel&) = delete;
//- Clone
autoPtr<wallHeatTransferCoeffModel> clone() const
{
NotImplemented;
return autoPtr<wallHeatTransferCoeffModel>(nullptr);
}
// Selectors
//- Return a reference to the selected subset
static autoPtr<wallHeatTransferCoeffModel> New
(
const word& name,
const fvMesh& mesh,
const dictionary&
);
//- Destructor
virtual ~wallHeatTransferCoeffModel()
{}
// Member Functions
//- Read the wallHeatTransferCoeffModel data
virtual bool read(const dictionary&) = 0;
//- Interface for heat transfer coefficient
virtual tmp<volScalarField> htcByRhoCp
(
const momentumTransportModel& mmtm,
const labelHashSet& patches
) const = 0;
//- Calculate wall shear stress
tmp<volSymmTensorField> tau
(
const momentumTransportModel& mmtm,
const fvMesh& mesh
) const;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const wallHeatTransferCoeffModel&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //