Commit a813b9dc authored by Andrew Heather's avatar Andrew Heather
Browse files

Further updates to turbulent heat flux BCs

parent e5ef0607
......@@ -210,6 +210,8 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::write
) const
{
fvPatchScalarField::write(os);
os.writeKeyword("heatSource") << heatSourceTypeNames_[heatSource_]
<< token::END_STATEMENT << nl;
q_.writeEntry("q", os);
gradient().writeEntry("gradient", os);
writeEntry("value", os);
......
......@@ -26,7 +26,20 @@ Class
Foam::turbulentHeatFluxTemperatureFvPatchScalarField
Description
Fixed heat flux boundary condition for temperature.
Fixed heat boundary condition to specify temperature gradient. Input
heat source either specified in terms of an absolute power [W], or as a
flux [W/m2].
Example usage:
hotWall
{
type compressible::turbulentHeatFluxTemperature;
heatSource flux; // power [W]; flux [W/m2]
q uniform 10; // heat power or flux
value uniform 300; // initial temperature value
}
SourceFiles
turbulentHeatFluxTemperatureFvPatchScalarField.C
......@@ -67,18 +80,18 @@ public:
};
private:
private:
// Private data
// Private data
//- Heat source type names
static const NamedEnum<heatSourceType, 2> heatSourceTypeNames_;
//- Heat source type names
static const NamedEnum<heatSourceType, 2> heatSourceTypeNames_;
//- Heat source type
heatSourceType heatSource_;
//- Heat source type
heatSourceType heatSource_;
//- Heat flux [W/m2]
scalarField q_;
//- Heat power [W] or flux [W/m2]
scalarField q_;
public:
......
......@@ -36,6 +36,22 @@ namespace Foam
namespace incompressible
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char*
NamedEnum<turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceType, 2>::
names[] =
{
"power",
"flux"
};
const
NamedEnum<turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceType, 2>
turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceTypeNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
turbulentHeatFluxTemperatureFvPatchScalarField::
......@@ -46,6 +62,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(p, iF),
heatSource_(hsPower),
q_(p.size(), 0.0),
alphaEffName_("undefinedAlphaEff"),
CpName_("undefinedCp")
......@@ -62,6 +79,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
heatSource_(ptf.heatSource_),
q_(ptf.q_, mapper),
alphaEffName_(ptf.alphaEffName_),
CpName_(ptf.CpName_)
......@@ -77,6 +95,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(p, iF),
heatSource_(heatSourceTypeNames_.read(dict.lookup("heatSource"))),
q_("q", dict, p.size()),
alphaEffName_(dict.lookup("alphaEff")),
CpName_(dict.lookup("Cp"))
......@@ -93,6 +112,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(thftpsf),
heatSource_(thftpsf.heatSource_),
q_(thftpsf.q_),
alphaEffName_(thftpsf.alphaEffName_),
CpName_(thftpsf.CpName_)
......@@ -107,6 +127,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(thftpsf, iF),
heatSource_(thftpsf.heatSource_),
q_(thftpsf.q_),
alphaEffName_(thftpsf.alphaEffName_),
CpName_(thftpsf.CpName_)
......@@ -156,7 +177,33 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
const scalarField& Cpp =
patch().lookupPatchField<volScalarField, scalar>(CpName_);
gradient() = q_/(Cpp*alphaEffp);
switch (heatSource_)
{
case hsPower:
{
const scalar Ap = gSum(patch().magSf());
gradient() = q_/(Ap*Cpp*alphaEffp);
break;
}
case hsFlux:
{
gradient() = q_/(Cpp*alphaEffp);
break;
}
default:
{
FatalErrorIn
(
"turbulentHeatFluxTemperatureFvPatchScalarField"
"("
"const fvPatch&, "
"const DimensionedField<scalar, volMesh>&, "
"const dictionary&"
")"
) << "Unknown heat source type. Valid types are: "
<< heatSourceTypeNames_ << nl << exit(FatalError);
}
}
fixedGradientFvPatchScalarField::updateCoeffs();
}
......@@ -165,6 +212,8 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
void turbulentHeatFluxTemperatureFvPatchScalarField::write(Ostream& os) const
{
fixedGradientFvPatchScalarField::write(os);
os.writeKeyword("heatSource") << heatSourceTypeNames_[heatSource_]
<< token::END_STATEMENT << nl;
q_.writeEntry("q", os);
os.writeKeyword("alphaEff") << alphaEffName_ << token::END_STATEMENT << nl;
os.writeKeyword("Cp") << CpName_ << token::END_STATEMENT << nl;
......
......@@ -26,7 +26,22 @@ Class
Foam::turbulentHeatFluxTemperatureFvPatchScalarField
Description
Fixed heat flux boundary condition for temperature.
Fixed heat boundary condition to specify temperature gradient. Input
heat source either specified in terms of an absolute power [W], or as a
flux [W/m2].
Example usage:
hotWall
{
type turbulentHeatFluxTemperature;
heatSource flux; // power [W]; flux [W/m2]
q uniform 10; // heat power or flux
alphaEff alphaEff; // alphaEff field name;
// alphaEff in [kg/m/s]
Cp Cp; // Cp field name; Cp in [J/kg/K]
value uniform 300; // initial temperature value
}
SourceFiles
turbulentHeatFluxTemperatureFvPatchScalarField.C
......@@ -38,6 +53,7 @@ SourceFiles
#include "fvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -54,16 +70,37 @@ class turbulentHeatFluxTemperatureFvPatchScalarField
:
public fixedGradientFvPatchScalarField
{
// Private data
public:
// Data types
//- Enumeration listing the possible hest source input modes
enum heatSourceType
{
hsPower,
hsFlux
};
private:
// Private data
//- Heat source type names
static const NamedEnum<heatSourceType, 2> heatSourceTypeNames_;
//- Heat source type
heatSourceType heatSource_;
//- Heat flux [W/m2]
scalarField q_;
//- Heat power [W] or flux [W/m2]
// NOTE: to be divided by density, rho, if used in kinematic form
scalarField q_;
//- Name of effective thermal diffusivity field
word alphaEffName_;
//- Name of effective thermal diffusivity field
word alphaEffName_;
//- Name of specific heat capacity field
word CpName_;
//- Name of specific heat capacity field
word CpName_;
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment