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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. 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 * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::heatTransferCoeffModels::fixedReferenceTemperature:: Foam::heatTransferCoeffModels::fixedReferenceTemperature::
@ -68,32 +89,14 @@ bool Foam::heatTransferCoeffModels::fixedReferenceTemperature::read
const dictionary& dict const dictionary& dict
) )
{ {
if (heatTransferCoeffModel::read(dict)) if (!heatTransferCoeffModel::read(dict))
{ {
dict.readEntry("TRef", TRef_); return false;
return true;
} }
return false; dict.readEntry("TRef", TRef_);
}
return true;
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);
}
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,18 +30,18 @@ Description
Heat transfer coefficient calculation Heat transfer coefficient calculation
that employs a fixed reference temperature. that employs a fixed reference temperature.
The heat transfer coefficient is specified by: The heat transfer coefficient is calculated by:
\f[ \f[
h = \frac{q}{T_{ref} - T_w} h = \frac{q}{T_{ref} - T_p}
\f] \f]
where where
\vartable \vartable
h | Convective heat transfer coefficient of the flow [W/(m2 K)] h | Heat transfer coefficient [W/m^2/K]
q | Heat flux [W/m2] q | Heat flux [W/m^2]
T_{ref} | Reference temperature of surrounding fluid [K] T_{ref} | User-specified reference temperature [K]
T_w | Patch temperature [K] T_p | Patch temperature field [K]
\endvartable \endvartable
Usage Usage
@ -49,27 +49,22 @@ Usage
\verbatim \verbatim
heatTransferCoeff1 heatTransferCoeff1
{ {
// Mandatory and other optional entries // Inherited entries
... ...
htcModel fixedReferenceTemperature;
// Conditional mandatory entries (runtime modifiable) // Mandatory entries
Tref 0; htcModel fixedReferenceTemperature;
Tref <scalar>;
} }
\endverbatim \endverbatim
where the entries mean: where the entries mean:
\table \table
Property | Description | Type | Reqd | Dflt Property | Description | Type | Reqd | Deflt
type | Model name: fixedReferenceTemperature | word | yes | - type | Model name: fixedReferenceTemperature | word | yes | -
Tref | Reference temperature of surrounding fluid | scalar | yes | - Tref | User-specied reference temperature | scalar | yes | -
\endtable \endtable
See also
- Foam::heatTransferCoeffModel
- Foam::heatTransferCoeffModels::localReferenceTemperature
- Foam::heatTransferCoeffModels::ReynoldsAnalogy
SourceFiles SourceFiles
fixedReferenceTemperature.C fixedReferenceTemperature.C
@ -99,7 +94,7 @@ protected:
// Protected Data // Protected Data
//- Reference temperature //- Reference temperature [K]
scalar TRef_; 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::tmp<Foam::FieldField<Foam::Field, Foam::scalar>>
Foam::heatTransferCoeffModel::q() const 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 bool Foam::heatTransferCoeffModel::calc
( (
volScalarField& result, 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 \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -33,44 +33,18 @@ Class
Foam::heatTransferCoeffModel Foam::heatTransferCoeffModel
Description Description
An abstract base class for heat transfer coeffcient models. A base class for heat transfer coefficient 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
SourceFiles SourceFiles
- heatTransferCoeffModel.C heatTransferCoeffModel.C
- heatTransferCoeffModelNew.C heatTransferCoeffModelNew.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef heatTransferCoeffModel_H #ifndef Foam_heatTransferCoeffModel_H
#define heatTransferCoeffModel_H #define Foam_heatTransferCoeffModel_H
#include "dictionary.H"
#include "HashSet.H"
#include "volFields.H" #include "volFields.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -90,16 +64,16 @@ protected:
// Protected Data // Protected Data
//- Mesh reference //- Const reference to the mesh
const fvMesh& mesh_; const fvMesh& mesh_;
//- Optional list of (wall) patches to process //- List of (wall) patches to process
labelHashSet patchSet_; labelHashSet patchSet_;
//- Temperature name //- Name of temperature field
const word TName_; const word TName_;
//- Name of radiative heat flux //- Name of radiative heat flux field
word qrName_; word qrName_;
@ -169,41 +143,51 @@ public:
// Member Functions // Member Functions
//- The mesh reference // Access
const fvMesh& mesh() const
//- Return const reference to the mesh
const fvMesh& mesh() const noexcept
{ {
return mesh_; return mesh_;
} }
//- Wall patches to process //- Return const reference to wall patches to process
const labelHashSet& patchSet() const const labelHashSet& patchSet() const noexcept
{ {
return patchSet_; return patchSet_;
} }
//- Temperature name //- Return const reference to name of temperature field
const word& TName() const const word& TName() const noexcept
{ {
return TName_; return TName_;
} }
//- Name of radiative heat flux //- Return const reference to name of radiative heat-flux field
const word& qrName() const const word& qrName() const noexcept
{ {
return qrName_; 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 virtual bool calc
( (
volScalarField& result, volScalarField& result,
const FieldField<Field, scalar>& q 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 \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. 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 * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::heatTransferCoeffModels::localReferenceTemperature:: 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 \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -30,18 +30,18 @@ Description
Heat transfer coefficient calculation that employs Heat transfer coefficient calculation that employs
the patch internal field as the reference temperature. the patch internal field as the reference temperature.
The heat transfer coefficient is specified by: The heat transfer coefficient is calculated by:
\f[ \f[
h = \frac{q}{T_c - T_w} h = \frac{q}{T_c - T_p}
\f] \f]
where where
\vartable \vartable
h | Convective heat transfer coefficient of the flow [W/(m2 K)] h | Heat transfer coefficient [W/m^2/K]
q | Heat flux [W/m2] q | Heat flux [W/m^2]
T_{ref} | Reference temperature of patch internal field [K] T_c | Patch internal temperature field [K]
T_w | Patch temperature [K] T_p | Patch temperature [K]
\endvartable \endvartable
Usage Usage
@ -49,23 +49,20 @@ Usage
\verbatim \verbatim
heatTransferCoeff1 heatTransferCoeff1
{ {
// Mandatory and other optional entries // Inherited entries
... ...
// Mandatory entries
htcModel localReferenceTemperature; htcModel localReferenceTemperature;
} }
\endverbatim \endverbatim
where the entries mean: where the entries mean:
\table \table
Property | Description | Type | Reqd | Dflt Property | Description | Type | Reqd | Deflt
type | Model name: localReferenceTemperature | word | yes | - type | Model name: localReferenceTemperature | word | yes | -
\endtable \endtable
See also
- Foam::heatTransferCoeffModel
- Foam::heatTransferCoeffModels::fixedReferenceTemperature
- Foam::heatTransferCoeffModels::ReynoldsAnalogy
SourceFiles SourceFiles
localReferenceTemperature.C localReferenceTemperature.C

View File

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

View File

@ -28,7 +28,56 @@ Class
Description Description
A heat transfer coefficient for multiphase inter solvers 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 SourceFiles
multiphaseInterHtcModel.C multiphaseInterHtcModel.C
@ -38,16 +87,16 @@ SourceFiles
#ifndef Foam_functionObjects_multiphaseInterHtcModel_H #ifndef Foam_functionObjects_multiphaseInterHtcModel_H
#define Foam_functionObjects_multiphaseInterHtcModel_H #define Foam_functionObjects_multiphaseInterHtcModel_H
#include "HashSet.H"
#include "volFields.H"
#include "fieldExpression.H" #include "fieldExpression.H"
#include "runTimeSelectionTables.H"
#include "heatTransferCoeffModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Forward Declarations
class heatTransferCoeffModel;
namespace functionObjects namespace functionObjects
{ {

View File

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

View File

@ -27,7 +27,56 @@ Class
Foam::functionObjects::reactingEulerHtcModel Foam::functionObjects::reactingEulerHtcModel
Description 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 SourceFiles
reactingEulerHtcModel.C reactingEulerHtcModel.C
@ -37,16 +86,16 @@ SourceFiles
#ifndef Foam_functionObjects_reactingEulerHtcModel_H #ifndef Foam_functionObjects_reactingEulerHtcModel_H
#define Foam_functionObjects_reactingEulerHtcModel_H #define Foam_functionObjects_reactingEulerHtcModel_H
#include "HashSet.H"
#include "volFields.H"
#include "fieldExpression.H" #include "fieldExpression.H"
#include "runTimeSelectionTables.H"
#include "heatTransferCoeffModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Forward Declarations
class heatTransferCoeffModel;
namespace functionObjects namespace functionObjects
{ {

View File

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