STYLE: heatTransferCoeff: minor cleanup of models

TUT: solidQuenching2D: correct libs for reactingEulerHtcModel
This commit is contained in:
Kutalmis Bercin
2022-08-19 12:55:43 +01:00
committed by Andrew Heather
parent 354767c694
commit b18a6675cb
15 changed files with 387 additions and 331 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/
#include "heatTransferCoeff.H"
#include "dictionary.H"
#include "heatTransferCoeffModel.H"
#include "addToRunTimeSelectionTable.H"
@ -41,7 +40,8 @@ namespace functionObjects
}
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::functionObjects::heatTransferCoeff::calc()
{
@ -67,7 +67,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
fieldExpression(name, runTime, dict),
L_(1),
kappa_(1),
htcModelPtr_(nullptr)
htcModelPtr_(heatTransferCoeffModel::New(dict, mesh_, fieldName_))
{
read(dict);
@ -96,7 +96,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
bool Foam::functionObjects::heatTransferCoeff::read(const dictionary& dict)
{
if (!fieldExpression::read(dict))
if (!fieldExpression::read(dict) || !htcModelPtr_->read(dict))
{
return false;
}
@ -104,9 +104,6 @@ bool Foam::functionObjects::heatTransferCoeff::read(const dictionary& dict)
L_ = dict.getCheckOrDefault<scalar>("L", 1, scalarMinMax::ge(0));
kappa_ =
dict.getCheckOrDefault<scalar>("kappa", 1, scalarMinMax::ge(SMALL));
htcModelPtr_ = heatTransferCoeffModel::New(dict, mesh_, fieldName_);
htcModelPtr_->read(dict);
return true;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,9 +30,13 @@ Group
grpFieldFunctionObjects
Description
Computes the heat transfer coefficient [W/(m2 K)]
Computes the heat transfer coefficient [W/(m^2 K)]
as a \c volScalarField for a given set of patches.
The heat transfer coefficient is definition dependent;
therefore, different coefficient values could be
obtained based on different definitions.
Optionally, the Nusselt number (i.e. the ratio of convective
to conductive heat transfer at a boundary in a fluid) can be output:
@ -43,7 +47,7 @@ Description
where
\vartable
Nu | Nusselt number
h | Convective heat transfer coefficient of the flow
h | Heat transfer coefficient
L | Characteristic length that defines the scale of the physical system
\kappa | Thermal conductivity of the fluid
\endvartable
@ -53,7 +57,7 @@ Description
Operand | Type | Location
input | - | -
output file | - | -
output field | volScalarField | $FOAM_CASE/\<time\>/\<outField\>
output field | volScalarField | \<time\>/\<outField\>
\endtable
Usage
@ -61,39 +65,37 @@ Usage
\verbatim
heatTransferCoeff1
{
// Mandatory entries (unmodifiable)
// Mandatory entries
type heatTransferCoeff;
libs (fieldFunctionObjects);
// Mandatory (inherited) entries (runtime modifiable)
field <field>;
patches (<patch1> <patch2> ... <patchN>);
htcModel <htcModel>;
field <word>;
patches (<wordRes>);
htcModel <word>;
// Optional entries (runtime modifable)
qr <qrName>;
L 1.0;
kappa 1.0;
// Optional entries
qr <word>;
L <scalar>;
kappa <scalar>;
// Conditional mandatory and optional
// entries based on selected <htcModel> (runtime modifiable)
// Conditional entries based on selected <htcModel>
...
// Optional (inherited) entries
// Inherited entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Dflt
Property | Description | Type | Reqd | Deflt
type | Type name: heatTransferCoeff | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of the operand field | word | yes | -
field | Name of operand field | word | yes | -
patches | Names of operand patches | wordRes | yes | -
htcModel | Heat transfer coefficient model <!--
--> - see below | word | yes | -
qr | Name of radiative heat flux | word | no | qr
qr | Name of radiative heat flux field | word | no | qr
L | Characteristic length that defines <!--
--> the scale of the physical system | scalar | no | 1
kappa | Thermal conductivity of fluid | scalar | no | 1
@ -108,19 +110,10 @@ Usage
\verbatim
ReynoldsAnalogy | Reynold's analogy
localReferenceTemperature | Local reference temperature
fixedReferenceTemperature | Specified reference temperature
fixedReferenceTemperature | Fixed reference temperature
faceZoneReferenceTemperature | Face-zone reference temperature
\endverbatim
Usage by the \c postProcess utility is not available.
See also
- Foam::functionObject
- Foam::functionObjects::fieldExpression
- Foam::heatTransferCoeffModels::fixedReferenceTemperature
- Foam::heatTransferCoeffModels::localReferenceTemperature
- Foam::heatTransferCoeffModels::ReynoldsAnalogy
- ExtendedCodeGuide::functionObjects::field::heatTransferCoeff
SourceFiles
heatTransferCoeff.C
@ -177,11 +170,7 @@ public:
// Constructors
//- No default construct
heatTransferCoeff() = delete;
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
heatTransferCoeff
(
const word& name,
@ -202,7 +191,7 @@ public:
// Member Functions
//- Read the heatTransferCoeff data
//- Read the top-level dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -50,13 +50,13 @@ namespace heatTransferCoeffModels
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::Field<Foam::scalar>>
Foam::tmp<Foam::scalarField>
Foam::heatTransferCoeffModels::ReynoldsAnalogy::rho(const label patchi) const
{
if (rhoName_ == "rhoInf")
{
const label n = mesh_.boundary()[patchi].size();
return tmp<Field<scalar>>::New(n, rhoRef_);
return tmp<scalarField>::New(n, rhoRef_);
}
else if (mesh_.foundObject<volScalarField>(rhoName_, false))
{
@ -72,13 +72,13 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::rho(const label patchi) const
}
Foam::tmp<Foam::Field<Foam::scalar>>
Foam::tmp<Foam::scalarField>
Foam::heatTransferCoeffModels::ReynoldsAnalogy::Cp(const label patchi) const
{
if (CpName_ == "CpInf")
{
const label n = mesh_.boundary()[patchi].size();
return tmp<Field<scalar>>::New(n, CpRef_);
return tmp<scalarField>::New(n, CpRef_);
}
else if (mesh_.foundObject<fluidThermo>(fluidThermo::dictName))
{
@ -114,7 +114,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::devReff() const
}
else if (mesh_.foundObject<icoTurbModel>(icoTurbModel::propertiesName))
{
const incompressible::turbulenceModel& turb =
const auto& turb =
mesh_.lookupObject<icoTurbModel>(icoTurbModel::propertiesName);
return turb.devReff();
@ -180,17 +180,38 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::Cf() const
const symmTensorField& Rp = Rbf[patchi];
const vectorField nHat(Up.patch().nf());
tmp<vectorField> tnHat = Up.patch().nf();
const scalarField tauByRhop(mag(nHat & Rp));
tmp<scalarField> ttauByRhop = mag(tnHat & Rp);
Cf[patchi] = 2*tauByRhop/magSqr(URef_);
Cf[patchi] = 2*ttauByRhop/magSqr(URef_);
}
return tCf;
}
void Foam::heatTransferCoeffModels::ReynoldsAnalogy::htc
(
volScalarField& htc,
const FieldField<Field, scalar>& q
)
{
const FieldField<Field, scalar> CfBf(Cf());
const scalar magU = mag(URef_);
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
for (const label patchi : patchSet_)
{
tmp<scalarField> trhop = rho(patchi);
tmp<scalarField> tCpp = Cp(patchi);
htcBf[patchi] = 0.5*trhop*tCpp*magU*CfBf[patchi];
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::heatTransferCoeffModels::ReynoldsAnalogy::ReynoldsAnalogy
@ -219,47 +240,27 @@ bool Foam::heatTransferCoeffModels::ReynoldsAnalogy::read
const dictionary& dict
)
{
if (heatTransferCoeffModel::read(dict))
if (!heatTransferCoeffModel::read(dict))
{
dict.readEntry("UInf", URef_);
dict.readIfPresent("Cp", CpName_);
if (CpName_ == "CpInf")
{
dict.readEntry("CpInf", CpRef_);
}
dict.readIfPresent("rho", rhoName_);
if (rhoName_ == "rhoInf")
{
dict.readEntry("rhoInf", rhoRef_);
}
return true;
return false;
}
return false;
}
dict.readIfPresent("U", UName_);
dict.readEntry("UInf", URef_);
void Foam::heatTransferCoeffModels::ReynoldsAnalogy::htc
(
volScalarField& htc,
const FieldField<Field, scalar>& q
)
{
const FieldField<Field, scalar> CfBf(Cf());
const scalar magU = mag(URef_);
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
for (const label patchi : patchSet_)
dict.readIfPresent("Cp", CpName_);
if (CpName_ == "CpInf")
{
const scalarField rhop(rho(patchi));
const scalarField Cpp(Cp(patchi));
htcBf[patchi] = 0.5*rhop*Cpp*magU*CfBf[patchi];
dict.readEntry("CpInf", CpRef_);
}
dict.readIfPresent("rho", rhoName_);
if (rhoName_ == "rhoInf")
{
dict.readEntry("rhoInf", rhoRef_);
}
return true;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,23 +34,23 @@ Description
from the skin friction coefficient:
\f[
C_f = \frac{\tau_w}{0.5 \rho_\infty |U|^2}
C_f = \frac{\tau_w}{0.5 \rho_{ref} |U|^2}
\f]
as:
\f[
h = 0.5 \rho_\infty c_{p,\infty} |U_{\infty}| C_f
h = 0.5 \rho_{ref} c_{p,ref} |U_{ref}| C_f
\f]
where
\vartable
h | Convective heat transfer coefficient of the flow
\rho_\infty | Reference fluid density
c_{p,\infty} | Reference specific heat capacity at constant pressure
U_{\infty} | Reference velocity
C_f | Skin friction coefficient
\tau_w | Wall shear stress
h | Heat transfer coefficient [W/m^2/K]
\rho_{ref} | Reference fluid density [kg/m^3]
c_{p,ref} | Reference specific heat capacity at constant pressure [J/kg/K]
U_{ref} | Reference velocity [m/s]
C_f | Skin friction coefficient [-]
\tau_w | Wall shear stress [m^2/s^2]
\endvartable
Usage
@ -58,44 +58,43 @@ Usage
\verbatim
heatTransferCoeff1
{
// Mandatory and other optional entries
// Inherited entries
...
// Mandatory entries
htcModel ReynoldsAnalogy;
UInf <vector>;
// Conditional mandatory entries (runtime modifiable)
UInf (10 0 0);
// Optional entries
U <word>;
Cp <word>;
rho <word>;
// Conditional optional entries (runtime modifiable)
Cp <CpName>;
rho <rhoName>;
// Conditional mandatory entries
// mandatory if Cp == CpInf
CpInf 1005;
// when Cp == CpInf
CpInf <scalar>;
// mandatory if rho == rhoInf
rhoInf 1;
// when rho == rhoInf
rhoInf <scalar>;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Dflt
type | Model name: ReynoldsAnalogy | word | yes | -
UInf | Reference velocity | scalar | yes | -
Property | Description | Type | Reqd | Deflt
type | Model name: ReynoldsAnalogy | word | yes | -
UInf | Reference velocity | vector | yes | -
U | Name of velocity field | word | no | U
Cp | Name of reference specific heat capacity | word | no | Cp
CpInf | Reference specific heat capacity value | scalar | cndtnl | -
rho | Name of reference fluid density | word | no | rho
rhoInf | Reference fluid density value | scalar | cndtnl | -
CpInf | Reference specific heat capacity value | scalar | choice | -
rho | Name of fluid density field | word | no | rho
rhoInf | Reference fluid density value | scalar | choice | -
\endtable
Note
- to use a reference \c Cp, set \c Cp to \c CpInf
- to use a reference \c rho, set \c rho to \c rhoInf
See also
- Foam::heatTransferCoeffModel
- Foam::heatTransferCoeffModels::fixedReferenceTemperature
- Foam::heatTransferCoeffModels::localReferenceTemperature
- In order to use a reference \c Cp, set \c Cp to \c CpInf.
- In order to use a reference \c rho, set \c rho to \c rhoInf.
SourceFiles
ReynoldsAnalogy.C
@ -115,7 +114,7 @@ namespace heatTransferCoeffModels
{
/*---------------------------------------------------------------------------*\
Class ReynoldsAnalogy Declaration
Class ReynoldsAnalogy Declaration
\*---------------------------------------------------------------------------*/
class ReynoldsAnalogy
@ -132,10 +131,10 @@ protected:
//- Reference velocity
vector URef_;
//- Name of density field
//- Name of fluid density field
word rhoName_;
//- Reference density
//- Reference fluid density
scalar rhoRef_;
//- Name of specific heat capacity field
@ -147,12 +146,16 @@ protected:
// Protected Member Functions
virtual tmp<Field<scalar>> rho(const label patchi) const;
//- Return fluid density field [kg/m^3]
virtual tmp<scalarField> rho(const label patchi) const;
virtual tmp<Field<scalar>> Cp(const label patchi) const;
//- Return heat capacity at constant pressure [J/kg/K]
virtual tmp<scalarField> Cp(const label patchi) const;
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return skin friction coefficient field [-]
tmp<FieldField<Field, scalar>> Cf() const;
//- Set the heat transfer coefficient

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -44,6 +44,27 @@ namespace heatTransferCoeffModels
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::heatTransferCoeffModels::fixedReferenceTemperature::htc
(
volScalarField& htc,
const FieldField<Field, scalar>& q
)
{
const auto& T = mesh_.lookupObject<volScalarField>(TName_);
const volScalarField::Boundary& Tbf = T.boundaryField();
const scalar eps = ROOTVSMALL;
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
for (const label patchi : patchSet_)
{
htcBf[patchi] = q[patchi]/(TRef_ - Tbf[patchi] + eps);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::heatTransferCoeffModels::fixedReferenceTemperature::
@ -68,32 +89,14 @@ bool Foam::heatTransferCoeffModels::fixedReferenceTemperature::read
const dictionary& dict
)
{
if (heatTransferCoeffModel::read(dict))
if (!heatTransferCoeffModel::read(dict))
{
dict.readEntry("TRef", TRef_);
return true;
return false;
}
return false;
}
dict.readEntry("TRef", TRef_);
void Foam::heatTransferCoeffModels::fixedReferenceTemperature::htc
(
volScalarField& htc,
const FieldField<Field, scalar>& q
)
{
const auto& T = mesh_.lookupObject<volScalarField>(TName_);
const volScalarField::Boundary& Tbf = T.boundaryField();
const scalar eps = ROOTVSMALL;
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
for (const label patchi : patchSet_)
{
htcBf[patchi] = q[patchi]/(TRef_ - Tbf[patchi] + eps);
}
return true;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,18 +30,18 @@ Description
Heat transfer coefficient calculation
that employs a fixed reference temperature.
The heat transfer coefficient is specified by:
The heat transfer coefficient is calculated by:
\f[
h = \frac{q}{T_{ref} - T_w}
h = \frac{q}{T_{ref} - T_p}
\f]
where
\vartable
h | Convective heat transfer coefficient of the flow [W/(m2 K)]
q | Heat flux [W/m2]
T_{ref} | Reference temperature of surrounding fluid [K]
T_w | Patch temperature [K]
h | Heat transfer coefficient [W/m^2/K]
q | Heat flux [W/m^2]
T_{ref} | User-specified reference temperature [K]
T_p | Patch temperature field [K]
\endvartable
Usage
@ -49,27 +49,22 @@ Usage
\verbatim
heatTransferCoeff1
{
// Mandatory and other optional entries
// Inherited entries
...
htcModel fixedReferenceTemperature;
// Conditional mandatory entries (runtime modifiable)
Tref 0;
// Mandatory entries
htcModel fixedReferenceTemperature;
Tref <scalar>;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Dflt
Property | Description | Type | Reqd | Deflt
type | Model name: fixedReferenceTemperature | word | yes | -
Tref | Reference temperature of surrounding fluid | scalar | yes | -
Tref | User-specied reference temperature | scalar | yes | -
\endtable
See also
- Foam::heatTransferCoeffModel
- Foam::heatTransferCoeffModels::localReferenceTemperature
- Foam::heatTransferCoeffModels::ReynoldsAnalogy
SourceFiles
fixedReferenceTemperature.C
@ -99,7 +94,7 @@ protected:
// Protected Data
//- Reference temperature
//- Reference temperature [K]
scalar TRef_;

View File

@ -40,7 +40,23 @@ namespace Foam
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::heatTransferCoeffModel::heatTransferCoeffModel
(
const dictionary& dict,
const fvMesh& mesh,
const word& TName
)
:
mesh_(mesh),
patchSet_(),
TName_(TName),
qrName_("qr")
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::FieldField<Foam::Field, Foam::scalar>>
Foam::heatTransferCoeffModel::q() const
@ -118,34 +134,6 @@ Foam::heatTransferCoeffModel::q() const
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::heatTransferCoeffModel::heatTransferCoeffModel
(
const dictionary& dict,
const fvMesh& mesh,
const word& TName
)
:
mesh_(mesh),
patchSet_(),
TName_(TName),
qrName_("qr")
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::heatTransferCoeffModel::read(const dictionary& dict)
{
patchSet_ = mesh_.boundaryMesh().patchSet(dict.get<wordRes>("patches"));
dict.readIfPresent("qr", qrName_);
return true;
}
bool Foam::heatTransferCoeffModel::calc
(
volScalarField& result,
@ -158,4 +146,14 @@ bool Foam::heatTransferCoeffModel::calc
}
bool Foam::heatTransferCoeffModel::read(const dictionary& dict)
{
patchSet_ = mesh_.boundaryMesh().patchSet(dict.get<wordRes>("patches"));
dict.readIfPresent("qr", qrName_);
return true;
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,44 +33,18 @@ Class
Foam::heatTransferCoeffModel
Description
An abstract base class for heat transfer coeffcient models.
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
heatTransferCoeff1
{
// Mandatory and other optional entries
...
// Mandatory (inherited) entries (runtime modifiable)
patches (<patch1> <patch2> ... <patchN>);
// Optional (inherited) entries (runtime modifiable)
qr <qrName>;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Dflt
patches | Names of operand patches | wordRes | yes | -
qr | Name of radiative heat flux | word | no | qr
\endtable
A base class for heat transfer coefficient models.
SourceFiles
- heatTransferCoeffModel.C
- heatTransferCoeffModelNew.C
heatTransferCoeffModel.C
heatTransferCoeffModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef heatTransferCoeffModel_H
#define heatTransferCoeffModel_H
#ifndef Foam_heatTransferCoeffModel_H
#define Foam_heatTransferCoeffModel_H
#include "dictionary.H"
#include "HashSet.H"
#include "volFields.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -90,16 +64,16 @@ protected:
// Protected Data
//- Mesh reference
//- Const reference to the mesh
const fvMesh& mesh_;
//- Optional list of (wall) patches to process
//- List of (wall) patches to process
labelHashSet patchSet_;
//- Temperature name
//- Name of temperature field
const word TName_;
//- Name of radiative heat flux
//- Name of radiative heat flux field
word qrName_;
@ -169,41 +143,51 @@ public:
// Member Functions
//- The mesh reference
const fvMesh& mesh() const
// Access
//- Return const reference to the mesh
const fvMesh& mesh() const noexcept
{
return mesh_;
}
//- Wall patches to process
const labelHashSet& patchSet() const
//- Return const reference to wall patches to process
const labelHashSet& patchSet() const noexcept
{
return patchSet_;
}
//- Temperature name
const word& TName() const
//- Return const reference to name of temperature field
const word& TName() const noexcept
{
return TName_;
}
//- Name of radiative heat flux
const word& qrName() const
//- Return const reference to name of radiative heat-flux field
const word& qrName() const noexcept
{
return qrName_;
}
//- Read from dictionary
virtual bool read(const dictionary& dict);
// Evaluation
//- Return boundary fields of heat-flux field
tmp<FieldField<Field, scalar>> q() const;
//- Calculate the heat transfer coefficient field and return true
//- if successful
virtual bool calc
(
volScalarField& result,
const FieldField<Field, scalar>& q
);
//- Return q boundary fields
tmp<FieldField<Field, scalar>> q() const;
// I-O
//- Read from dictionary
virtual bool read(const dictionary& dict);
};

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,6 +45,28 @@ namespace heatTransferCoeffModels
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::heatTransferCoeffModels::localReferenceTemperature::htc
(
volScalarField& htc,
const FieldField<Field, scalar>& q
)
{
const auto& T = mesh_.lookupObject<volScalarField>(TName_);
const volScalarField::Boundary& Tbf = T.boundaryField();
const scalar eps = ROOTVSMALL;
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
for (const label patchi : patchSet_)
{
tmp<scalarField> tTc = Tbf[patchi].patchInternalField();
htcBf[patchi] = q[patchi]/(tTc - Tbf[patchi] + eps);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::heatTransferCoeffModels::localReferenceTemperature::
@ -72,24 +94,4 @@ bool Foam::heatTransferCoeffModels::localReferenceTemperature::read
}
void Foam::heatTransferCoeffModels::localReferenceTemperature::htc
(
volScalarField& htc,
const FieldField<Field, scalar>& q
)
{
const auto& T = mesh_.lookupObject<volScalarField>(TName_);
const volScalarField::Boundary& Tbf = T.boundaryField();
const scalar eps = ROOTVSMALL;
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
for (const label patchi : patchSet_)
{
const scalarField Tc(Tbf[patchi].patchInternalField());
htcBf[patchi] = q[patchi]/(Tc - Tbf[patchi] + eps);
}
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,18 +30,18 @@ Description
Heat transfer coefficient calculation that employs
the patch internal field as the reference temperature.
The heat transfer coefficient is specified by:
The heat transfer coefficient is calculated by:
\f[
h = \frac{q}{T_c - T_w}
h = \frac{q}{T_c - T_p}
\f]
where
\vartable
h | Convective heat transfer coefficient of the flow [W/(m2 K)]
q | Heat flux [W/m2]
T_{ref} | Reference temperature of patch internal field [K]
T_w | Patch temperature [K]
h | Heat transfer coefficient [W/m^2/K]
q | Heat flux [W/m^2]
T_c | Patch internal temperature field [K]
T_p | Patch temperature [K]
\endvartable
Usage
@ -49,23 +49,20 @@ Usage
\verbatim
heatTransferCoeff1
{
// Mandatory and other optional entries
// Inherited entries
...
// Mandatory entries
htcModel localReferenceTemperature;
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Dflt
Property | Description | Type | Reqd | Deflt
type | Model name: localReferenceTemperature | word | yes | -
\endtable
See also
- Foam::heatTransferCoeffModel
- Foam::heatTransferCoeffModels::fixedReferenceTemperature
- Foam::heatTransferCoeffModels::ReynoldsAnalogy
SourceFiles
localReferenceTemperature.C

View File

@ -26,9 +26,9 @@ License
\*---------------------------------------------------------------------------*/
#include "multiphaseInterHtcModel.H"
#include "heatTransferCoeffModel.H"
#include "multiphaseInterSystem.H"
#include "addToRunTimeSelectionTable.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -49,6 +49,17 @@ namespace functionObjects
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::functionObjects::multiphaseInterHtcModel::calc()
{
auto& htc =
htcModelPtr_->mesh().lookupObjectRef<volScalarField>(resultName_);
htcModelPtr_->calc(htc, q());
return true;
}
Foam::tmp<Foam::FieldField<Foam::Field, Foam::scalar>>
Foam::functionObjects::multiphaseInterHtcModel::q() const
{
@ -102,19 +113,6 @@ Foam::functionObjects::multiphaseInterHtcModel::q() const
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::functionObjects::multiphaseInterHtcModel::calc()
{
auto& htc =
htcModelPtr_->mesh().lookupObjectRef<volScalarField>(resultName_);
htcModelPtr_->calc(htc, q());
return true;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::multiphaseInterHtcModel::multiphaseInterHtcModel
@ -125,7 +123,7 @@ Foam::functionObjects::multiphaseInterHtcModel::multiphaseInterHtcModel
)
:
fieldExpression(name, runTime, dict),
htcModelPtr_(nullptr)
htcModelPtr_(heatTransferCoeffModel::New(dict, mesh_, fieldName_))
{
read(dict);
@ -157,15 +155,11 @@ bool Foam::functionObjects::multiphaseInterHtcModel::read
const dictionary& dict
)
{
if (!fieldExpression::read(dict))
if (!fieldExpression::read(dict) || !htcModelPtr_->read(dict))
{
return false;
}
htcModelPtr_ = heatTransferCoeffModel::New(dict, mesh_, fieldName_);
htcModelPtr_->read(dict);
return true;
}

View File

@ -28,7 +28,56 @@ Class
Description
A heat transfer coefficient for multiphase inter solvers
(i.e. icoReactingMultiphaseFoam).
(e.g. icoReactingMultiphaseFoam).
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
multiphaseInterHtcModel1
{
// Mandatory entries
type multiphaseInterHtcModel;
libs (fieldFunctionObjects);
field <word>;
patches (<wordRes>);
htcModel <word>;
// Optional entries
qr <word>;
// Conditional entries based on selected <htcModel>
...
// Inherited entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Deflt
type | Type name: multiphaseInterHtcModel | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of operand field | word | yes | -
patches | Names of operand patches | wordRes | yes | -
htcModel | Heat transfer coefficient model <!--
--> - see below | word | yes | -
qr | Name of radiative heat flux field | word | no | qr
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
- \link heatTransferCoeffModel.H \endlink
Options for the \c htcModel entry:
\verbatim
ReynoldsAnalogy | Reynold's analogy
localReferenceTemperature | Local reference temperature
fixedReferenceTemperature | Fixed reference temperature
faceZoneReferenceTemperature | Face-zone reference temperature
\endverbatim
SourceFiles
multiphaseInterHtcModel.C
@ -38,16 +87,16 @@ SourceFiles
#ifndef Foam_functionObjects_multiphaseInterHtcModel_H
#define Foam_functionObjects_multiphaseInterHtcModel_H
#include "HashSet.H"
#include "volFields.H"
#include "fieldExpression.H"
#include "runTimeSelectionTables.H"
#include "heatTransferCoeffModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class heatTransferCoeffModel;
namespace functionObjects
{

View File

@ -26,9 +26,9 @@ License
\*---------------------------------------------------------------------------*/
#include "reactingEulerHtcModel.H"
#include "heatTransferCoeffModel.H"
#include "phaseSystem.H"
#include "addToRunTimeSelectionTable.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -49,6 +49,17 @@ namespace functionObjects
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::functionObjects::reactingEulerHtcModel::calc()
{
auto& htc =
htcModelPtr_->mesh().lookupObjectRef<volScalarField>(resultName_);
htcModelPtr_->calc(htc, q());
return true;
}
Foam::tmp<Foam::FieldField<Foam::Field, Foam::scalar>>
Foam::functionObjects::reactingEulerHtcModel::q() const
{
@ -110,18 +121,6 @@ Foam::functionObjects::reactingEulerHtcModel::q() const
return tq;
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::functionObjects::reactingEulerHtcModel::calc()
{
auto& htc =
htcModelPtr_->mesh().lookupObjectRef<volScalarField>(resultName_);
htcModelPtr_->calc(htc, q());
return true;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -133,7 +132,7 @@ Foam::functionObjects::reactingEulerHtcModel::reactingEulerHtcModel
)
:
fieldExpression(name, runTime, dict),
htcModelPtr_(nullptr)
htcModelPtr_(heatTransferCoeffModel::New(dict, mesh_, fieldName_))
{
read(dict);
@ -162,16 +161,12 @@ Foam::functionObjects::reactingEulerHtcModel::reactingEulerHtcModel
bool Foam::functionObjects::reactingEulerHtcModel::read(const dictionary& dict)
{
if (fieldExpression::read(dict))
if (!fieldExpression::read(dict) || htcModelPtr_->read(dict))
{
htcModelPtr_ = heatTransferCoeffModel::New(dict, mesh_, fieldName_);
htcModelPtr_->read(dict);
return true;
return false;
}
return false;
return true;
}

View File

@ -27,7 +27,56 @@ Class
Foam::functionObjects::reactingEulerHtcModel
Description
A heat transfer coefficient for reactingEuler solvers
A heat transfer coefficient for reactingEuler solvers.
Usage
Minimal example by using \c system/controlDict.functions:
\verbatim
reactingEulerHtcModel1
{
// Mandatory entries
type reactingEulerHtcModel;
libs (fieldFunctionObjects);
field <word>;
patches (<wordRes>);
htcModel <word>;
// Optional entries
qr <word>;
// Conditional entries based on selected <htcModel>
...
// Inherited entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Reqd | Deflt
type | Type name: reactingEulerHtcModel | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of operand field | word | yes | -
patches | Names of operand patches | wordRes | yes | -
htcModel | Heat transfer coefficient model <!--
--> - see below | word | yes | -
qr | Name of radiative heat flux field | word | no | qr
\endtable
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
- \link heatTransferCoeffModel.H \endlink
Options for the \c htcModel entry:
\verbatim
ReynoldsAnalogy | Reynold's analogy
localReferenceTemperature | Local reference temperature
fixedReferenceTemperature | Fixed reference temperature
faceZoneReferenceTemperature | Face-zone reference temperature
\endverbatim
SourceFiles
reactingEulerHtcModel.C
@ -37,16 +86,16 @@ SourceFiles
#ifndef Foam_functionObjects_reactingEulerHtcModel_H
#define Foam_functionObjects_reactingEulerHtcModel_H
#include "HashSet.H"
#include "volFields.H"
#include "fieldExpression.H"
#include "runTimeSelectionTables.H"
#include "heatTransferCoeffModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class heatTransferCoeffModel;
namespace functionObjects
{

View File

@ -63,7 +63,7 @@ functions
htc
{
type reactingEulerHtcModel;
libs (reactingEulerFoamFunctionObjects);
libs (fieldFunctionObjects);
region water;
field T.liquid;
writeControl writeTime;