ENH: heatTransferCoeff: add optional Nusselt number functionality

DOC: heatTransferCoeff models: complete remaining header docs
  STYLE: heatTransferCoeff models: use auto specifier when appropriate

  Optionally, the Nusselt number (i.e. the ratio of convective to conductive
  heat transfer at a boundary in a fluid) can be output:

  ```math
      Nu = \frac{h L}{\kappa}
  ```

  where
  ```
    Nu | Nusselt number
    h  | Convective heat transfer coefficient of the flow
    L  | Characteristic length that defines the scale of the physical system
    \kappa | Thermal conductivity of the fluid
  ```
This commit is contained in:
Kutalmis Bercin
2020-09-03 18:11:50 +01:00
parent bbeda07862
commit a1c25e6201
10 changed files with 245 additions and 192 deletions

View File

@ -45,10 +45,12 @@ namespace functionObjects
bool Foam::functionObjects::heatTransferCoeff::calc()
{
volScalarField& htc = mesh_.lookupObjectRef<volScalarField>(resultName_);
auto& htc = mesh_.lookupObjectRef<volScalarField>(resultName_);
htcModelPtr_->calc(htc, htcModelPtr_->q());
htc *= L_/kappa_;
return true;
}
@ -63,13 +65,15 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
)
:
fieldExpression(name, runTime, dict),
L_(1),
kappa_(1),
htcModelPtr_(nullptr)
{
read(dict);
setResultName(typeName, name + ":htc:" + htcModelPtr_->type());
volScalarField* heatTransferCoeffPtr =
auto* heatTransferCoeffPtr =
new volScalarField
(
IOobject
@ -92,16 +96,19 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
bool Foam::functionObjects::heatTransferCoeff::read(const dictionary& dict)
{
if (fieldExpression::read(dict))
if (!fieldExpression::read(dict))
{
htcModelPtr_ = heatTransferCoeffModel::New(dict, mesh_, fieldName_);
htcModelPtr_->read(dict);
return true;
return false;
}
return false;
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

@ -30,11 +30,23 @@ Group
grpFieldFunctionObjects
Description
Computes the heat transfer coefficient as a \c volScalarField
for a set of patches.
Computes the heat transfer coefficient [W/(m2 K)]
as a \c volScalarField for a given set of patches.
The field is stored on the mesh database so that it can be retrieved and
used for other applications.
Optionally, the Nusselt number (i.e. the ratio of convective
to conductive heat transfer at a boundary in a fluid) can be output:
\f[
Nu = \frac{h L}{\kappa}
\f]
where
\vartable
Nu | Nusselt number
h | Convective heat transfer coefficient of the flow
L | Characteristic length that defines the scale of the physical system
\kappa | Thermal conductivity of the fluid
\endvartable
Operands:
\table
@ -53,99 +65,61 @@ Usage
type heatTransferCoeff;
libs (fieldFunctionObjects);
field T;
patches ("walls.*");
// Mandatory (inherited) entries (runtime modifiable)
field <field>;
patches (<patch1> <patch2> ... <patchN>);
htcModel <htcModel>;
htcModel ReynoldsAnalogy;
UInf (20 0 0);
Cp CpInf;
CpInf 1000;
rho rhoInf;
rhoInf 1.2;
// Optional entries (runtime modifable)
qr <qrName>;
L 1.0;
kappa 1.0;
// Conditional mandatory and optional
// entries based on selected <htcModel> (runtime modifiable)
...
// Optional (inherited) entries
...
}
\endverbatim
Example usage for mode \c ReynoldsAnalogy for incompressible case:
\verbatim
heatTransferCoeff1
{
// Mandatory entries (unmodifiable)
type heatTransferCoeff;
libs (fieldFunctionObjects);
where the entries mean:
\table
Property | Description | Type | Reqd | Dflt
type | Type name: heatTransferCoeff | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of the 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
L | Characteristic length that defines <!--
--> the scale of the physical system | scalar | no | 1
kappa | Thermal conductivity of fluid | scalar | no | 1
\endtable
field T;
patches ("walls.*");
htcModel ReynoldsAnalogy;
UInf (20 0 0);
Cp CpInf;
CpInf 1000;
rho rhoInf;
rhoInf 1.2;
}
\endverbatim
Example usage for mode \c ReynoldsAnalogy for compressible case:
\verbatim
htc
{
type heatTransferCoeff;
libs (fieldFunctionObjects);
field T;
patches ("walls.*");
htcModel ReynoldsAnalogy;
UInf (20 0 0);
}
\endverbatim
Example usage for mode \c localReferenceTemperature for compressible case:
\verbatim
htc
{
type heatTransferCoeff;
libs (fieldFunctionObjects);
field T;
patches ("walls.*");
htcModel localReferenceTemperature;
}
\endverbatim
Example usage for mode \c fixedReferenceTemperature for compressible case:
\verbatim
htc
{
type heatTransferCoeff;
libs (fieldFunctionObjects);
field T;
patches ("walls.*");
htcModel fixedReferenceTemperature;
TRef 300;
}
\endverbatim
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 | Specified reference temperature
ReynoldsAnalogy | Reynold's analogy
localReferenceTemperature | Local reference temperature
fixedReferenceTemperature | Specified reference temperature
\endverbatim
The inherited entries are elaborated in:
- \link functionObject.H \endlink
- \link fieldExpression.H \endlink
Usage by the \c postProcess utility is not available.
See also
- Foam::functionObject
- Foam::functionObjects::fieldExpression
- Foam::heatTransferCoeffModels::fixedReferenceTemperature
- Foam::heatTransferCoeffModels::localReferenceTemperature
- ExtendedCodeGuide::functionObjects::field::heatTransferCoeff
- Foam::functionObject
- Foam::functionObjects::fieldExpression
- Foam::heatTransferCoeffModels::fixedReferenceTemperature
- Foam::heatTransferCoeffModels::localReferenceTemperature
- Foam::heatTransferCoeffModels::ReynoldsAnalogy
- ExtendedCodeGuide::functionObjects::field::heatTransferCoeff
SourceFiles
heatTransferCoeff.C
@ -178,6 +152,12 @@ class heatTransferCoeff
{
// Private Data
//- Characteristic length that defines the scale of the physical system
scalar L_;
//- Thermal conductivity of the fluid
scalar kappa_;
//- Heat transfer coefficient model
autoPtr<heatTransferCoeffModel> htcModelPtr_;
@ -197,6 +177,9 @@ public:
// Constructors
//- No default construct
heatTransferCoeff() = delete;
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
heatTransferCoeff

View File

@ -60,8 +60,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::rho(const label patchi) const
}
else if (mesh_.foundObject<volScalarField>(rhoName_, false))
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
const auto& rho = mesh_.lookupObject<volScalarField>(rhoName_);
return rho.boundaryField()[patchi];
}
@ -83,7 +82,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::Cp(const label patchi) const
}
else if (mesh_.foundObject<fluidThermo>(fluidThermo::dictName))
{
const fluidThermo& thermo =
const auto& thermo =
mesh_.lookupObject<fluidThermo>(fluidThermo::dictName);
const scalarField& pp = thermo.p().boundaryField()[patchi];
@ -108,7 +107,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::devReff() const
if (mesh_.foundObject<cmpTurbModel>(cmpTurbModel::propertiesName))
{
const cmpTurbModel& turb =
const auto& turb =
mesh_.lookupObject<cmpTurbModel>(cmpTurbModel::propertiesName);
return turb.devRhoReff()/turb.rho();
@ -122,30 +121,30 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::devReff() const
}
else if (mesh_.foundObject<fluidThermo>(fluidThermo::dictName))
{
const fluidThermo& thermo =
const auto& thermo =
mesh_.lookupObject<fluidThermo>(fluidThermo::dictName);
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
const auto& U = mesh_.lookupObject<volVectorField>(UName_);
return -thermo.nu()*dev(twoSymm(fvc::grad(U)));
}
else if (mesh_.foundObject<transportModel>("transportProperties"))
{
const transportModel& laminarT =
const auto& laminarT =
mesh_.lookupObject<transportModel>("transportProperties");
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
const auto& U = mesh_.lookupObject<volVectorField>(UName_);
return -laminarT.nu()*dev(twoSymm(fvc::grad(U)));
}
else if (mesh_.foundObject<dictionary>("transportProperties"))
{
const dictionary& transportProperties =
const auto& transportProperties =
mesh_.lookupObject<dictionary>("transportProperties");
dimensionedScalar nu("nu", dimViscosity, transportProperties);
const dimensionedScalar nu("nu", dimViscosity, transportProperties);
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
const auto& U = mesh_.lookupObject<volVectorField>(UName_);
return -nu*dev(twoSymm(fvc::grad(U)));
}
@ -161,7 +160,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::devReff() const
Foam::tmp<Foam::FieldField<Foam::Field, Foam::scalar>>
Foam::heatTransferCoeffModels::ReynoldsAnalogy::Cf() const
{
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
const auto& U = mesh_.lookupObject<volVectorField>(UName_);
const volVectorField::Boundary& Ubf = U.boundaryField();
auto tCf = tmp<FieldField<Field, scalar>>::New(Ubf.size());
@ -205,9 +204,9 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::ReynoldsAnalogy
UName_("U"),
URef_(Zero),
rhoName_("rho"),
rhoRef_(0.0),
rhoRef_(0),
CpName_("Cp"),
CpRef_(0.0)
CpRef_(0)
{
read(dict);
}

View File

@ -27,10 +27,11 @@ Class
Foam::heatTransferCoeffModels::ReynoldsAnalogy
Description
Heat transfer coefficient calculation based on Reynolds Analogy
Heat transfer coefficient calculation based on Reynolds Analogy,
which is used to relate turbulent momentum and heat transfer.
The heat transfer coefficient is derived from the skin friction
coefficient:
The heat transfer coefficient is derived
from the skin friction coefficient:
\f[
C_f = \frac{\tau_w}{0.5 \rho_\infty |U|^2}
@ -39,42 +40,66 @@ Description
as:
\f[
h = 0.5 \rho_\infty C_{p,\infty} |U_{\infty}| C_f
h = 0.5 \rho_\infty c_{p,\infty} |U_{\infty}| 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
\endvartable
Usage
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
type heatTransferCoeff;
libs (fieldFunctionObjects);
heatTransferCoeff1
{
// Mandatory and other optional entries
...
htcModel ReynoldsAnalogy;
UInf (20 0 0);
Cp CpInf;
// Conditional mandatory entries (runtime modifiable)
UInf (10 0 0);
// Conditional optional entries (runtime modifiable)
Cp <CpName>;
rho <rhoName>;
// mandatory if Cp == CpInf
CpInf 1005;
...
// mandatory if rho == rhoInf
rhoInf 1;
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: heatTransferCoeff | yes |
htcModel | selected htc model | yes |
UInf | reference velocity | yes |
Cp | specific heat capacity field name | no |
rho | density field name | no |
Property | Description | Type | Reqd | Dflt
type | Model name: ReynoldsAnalogy | word | yes | -
UInf | Reference velocity | scalar | yes | -
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 | -
\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
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
SourceFiles
ReynoldsAnalogy.C
SeeAlso
Foam::heatTransferCoeffModel
\*---------------------------------------------------------------------------*/
#ifndef heatTransferCoeffModels_ReynoldsAnalogy_H
@ -138,13 +163,6 @@ protected:
);
//- No copy construct
ReynoldsAnalogy(const ReynoldsAnalogy&) = delete;
//- No copy assignment
void operator=(const ReynoldsAnalogy&) = delete;
public:
//- Runtime type information
@ -161,6 +179,12 @@ public:
const word& TName
);
//- No copy construct
ReynoldsAnalogy(const ReynoldsAnalogy&) = delete;
//- No copy assignment
void operator=(const ReynoldsAnalogy&) = delete;
//- Destructor
virtual ~ReynoldsAnalogy() = default;

View File

@ -85,8 +85,7 @@ void Foam::heatTransferCoeffModels::fixedReferenceTemperature::htc
const FieldField<Field, scalar>& q
)
{
//const FieldField<Field, scalar> qBf(q());
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
const auto& T = mesh_.lookupObject<volScalarField>(TName_);
const volScalarField::Boundary& Tbf = T.boundaryField();
const scalar eps = ROOTVSMALL;

View File

@ -27,8 +27,8 @@ Class
Foam::heatTransferCoeffModels::fixedReferenceTemperature
Description
Heat transfer coefficient calculation that employs a fixed reference
temperature
Heat transfer coefficient calculation
that employs a fixed reference temperature.
The heat transfer coefficient is specified by:
@ -36,31 +36,43 @@ Description
h = \frac{q}{T_{ref} - T_w}
\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]
\endvartable
Usage
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
type heatTransferCoeff;
libs (fieldFunctionObjects);
heatTransferCoeff1
{
// Mandatory and other optional entries
...
htcModel fixedReferenceTemperature;
TRef 300;
...
// Conditional mandatory entries (runtime modifiable)
Tref 0;
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default
type | type name: heatTransferCoeff | yes |
htcModel | selected htc model | yes |
TRef | reference temperature | yes |
Property | Description | Type | Reqd | Dflt
type | Model name: fixedReferenceTemperature | word | yes | -
Tref | Reference temperature of surrounding fluid | scalar | yes | -
\endtable
See also
- Foam::heatTransferCoeffModel
- Foam::heatTransferCoeffModels::localReferenceTemperature
- Foam::heatTransferCoeffModels::ReynoldsAnalogy
SourceFiles
fixedReferenceTemperature.C
SeeAlso
Foam::heatTransferCoeffModel
\*---------------------------------------------------------------------------*/
#ifndef heatTransferCoeffModels_fixedReferenceTemperature_H
@ -100,12 +112,6 @@ protected:
const FieldField<Field, scalar>& q
);
//- No copy construct
fixedReferenceTemperature(const fixedReferenceTemperature&) = delete;
//- No copy assignment
void operator=(const fixedReferenceTemperature&) = delete;
public:
@ -123,6 +129,12 @@ public:
const word& TName
);
//- No copy construct
fixedReferenceTemperature(const fixedReferenceTemperature&) = delete;
//- No copy assignment
void operator=(const fixedReferenceTemperature&) = delete;
//- Destructor
virtual ~fixedReferenceTemperature() = default;

View File

@ -45,7 +45,7 @@ namespace Foam
Foam::tmp<Foam::FieldField<Foam::Field, Foam::scalar>>
Foam::heatTransferCoeffModel::q() const
{
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
const auto& T = mesh_.lookupObject<volScalarField>(TName_);
const volScalarField::Boundary& Tbf = T.boundaryField();
auto tq = tmp<FieldField<Field, scalar>>::New(Tbf.size());
@ -60,7 +60,7 @@ Foam::heatTransferCoeffModel::q() const
if (mesh_.foundObject<cmpTurbModel>(cmpTurbModel::propertiesName))
{
const cmpTurbModel& turb =
const auto& turb =
mesh_.lookupObject<cmpTurbModel>(cmpTurbModel::propertiesName);
const volScalarField& he = turb.transport().he();
@ -76,7 +76,7 @@ Foam::heatTransferCoeffModel::q() const
}
else if (mesh_.foundObject<fluidThermo>(fluidThermo::dictName))
{
const fluidThermo& thermo =
const auto& thermo =
mesh_.lookupObject<fluidThermo>(fluidThermo::dictName);
const volScalarField& he = thermo.he();
@ -99,7 +99,7 @@ Foam::heatTransferCoeffModel::q() const
// Add radiative heat flux contribution if present
const volScalarField* qrPtr = mesh_.cfindObject<volScalarField>(qrName_);
const auto* qrPtr = mesh_.cfindObject<volScalarField>(qrName_);
if (qrPtr)
{

View File

@ -35,9 +35,32 @@ Class
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
SourceFiles
heatTransferCoeffModel.C
heatTransferCoeffModelNew.C
- heatTransferCoeffModel.C
- heatTransferCoeffModelNew.C
\*---------------------------------------------------------------------------*/
@ -65,7 +88,7 @@ class heatTransferCoeffModel
{
protected:
// Public Data
// Protected Data
//- Mesh reference
const fvMesh& mesh_;
@ -76,12 +99,10 @@ protected:
//- Temperature name
const word TName_;
//- Name of radiative heat flux (default = qr)
//- Name of radiative heat flux
word qrName_;
protected:
// Protected Member Functions
//- Set the heat transfer coefficient
@ -91,12 +112,6 @@ protected:
const FieldField<Field, scalar>& q
) = 0;
//- No copy construct
heatTransferCoeffModel(const heatTransferCoeffModel&) = delete;
//- No copy assignment
void operator=(const heatTransferCoeffModel&) = delete;
public:
@ -141,6 +156,12 @@ public:
const word& TName
);
//- No copy construct
heatTransferCoeffModel(const heatTransferCoeffModel&) = delete;
//- No copy assignment
void operator=(const heatTransferCoeffModel&) = delete;
//- Destructor
virtual ~heatTransferCoeffModel() = default;
@ -172,7 +193,6 @@ public:
return qrName_;
}
//- Read from dictionary
virtual bool read(const dictionary& dict);

View File

@ -78,8 +78,7 @@ void Foam::heatTransferCoeffModels::localReferenceTemperature::htc
const FieldField<Field, scalar>& q
)
{
///const FieldField<Field, scalar> qBf(q());
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
const auto& T = mesh_.lookupObject<volScalarField>(TName_);
const volScalarField::Boundary& Tbf = T.boundaryField();
const scalar eps = ROOTVSMALL;

View File

@ -27,8 +27,8 @@ Class
Foam::heatTransferCoeffModels::localReferenceTemperature
Description
Heat transfer coefficient calculation that employs the patch internal
field as the reference temperature
Heat transfer coefficient calculation that employs
the patch internal field as the reference temperature.
The heat transfer coefficient is specified by:
@ -36,29 +36,39 @@ Description
h = \frac{q}{T_c - T_w}
\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]
\endvartable
Usage
Example of function object specification:
Minimal example by using \c system/controlDict.functions:
\verbatim
type heatTransferCoeff;
libs (fieldFunctionObjects);
heatTransferCoeff1
{
// Mandatory and other optional entries
...
htcModel localReferenceTemperature;
...
}
\endverbatim
Where the entries comprise:
where the entries mean:
\table
Property | Description | Required | Default value
type | type name: heatTransferCoeff | yes |
htcModel | selected htc model | yes |
Property | Description | Type | Reqd | Dflt
type | Model name: localReferenceTemperature | word | yes | -
\endtable
See also
- Foam::heatTransferCoeffModel
- Foam::heatTransferCoeffModels::fixedReferenceTemperature
- Foam::heatTransferCoeffModels::ReynoldsAnalogy
SourceFiles
localReferenceTemperature.C
SeeAlso
Foam::heatTransferCoeffModel
\*---------------------------------------------------------------------------*/
#ifndef heatTransferCoeffModels_localReferenceTemperature_H