mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Corrections and updates to turbulent heat flux temperature BC
- Corrected calculation of temperature gradient - Option to specify the heat source in terms of a power [W] or flux [W/m2]
This commit is contained in:
@ -37,6 +37,22 @@ namespace Foam
|
||||
namespace compressible
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
const char*
|
||||
NamedEnum<turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceType, 2>::
|
||||
names[] =
|
||||
{
|
||||
"power",
|
||||
"flux"
|
||||
};
|
||||
|
||||
const
|
||||
NamedEnum<turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceType, 2>
|
||||
turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
turbulentHeatFluxTemperatureFvPatchScalarField::
|
||||
@ -47,8 +63,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
q_(p.size(), 0.0),
|
||||
rhoName_("rho")
|
||||
heatSource_(hsPower),
|
||||
q_(p.size(), 0.0)
|
||||
{}
|
||||
|
||||
|
||||
@ -62,8 +78,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
|
||||
q_(ptf.q_, mapper),
|
||||
rhoName_(ptf.rhoName_)
|
||||
heatSource_(ptf.heatSource_),
|
||||
q_(ptf.q_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
@ -76,8 +92,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
q_("q", dict, p.size()),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
||||
heatSource_(heatSourceTypeNames_.read(dict.lookup("heatSource"))),
|
||||
q_("q", dict, p.size())
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
gradient() = 0.0;
|
||||
@ -91,8 +107,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(thftpsf),
|
||||
q_(thftpsf.q_),
|
||||
rhoName_(thftpsf.rhoName_)
|
||||
heatSource_(thftpsf.heatSource_),
|
||||
q_(thftpsf.q_)
|
||||
{}
|
||||
|
||||
|
||||
@ -104,8 +120,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchScalarField(thftpsf, iF),
|
||||
q_(thftpsf.q_),
|
||||
rhoName_(thftpsf.rhoName_)
|
||||
heatSource_(thftpsf.heatSource_),
|
||||
q_(thftpsf.q_)
|
||||
{}
|
||||
|
||||
|
||||
@ -150,22 +166,39 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
||||
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
|
||||
const scalarField alphaEffp = rasModel.alphaEff()().boundaryField()[patchI];
|
||||
const scalarField alphaEffp = rasModel.alphaEff(patchI);
|
||||
|
||||
const basicThermo& thermo =
|
||||
db().lookupObject<basicThermo>("thermophysicalProperties");
|
||||
|
||||
// const scalarField& Tp = thermo.T().boundaryField()[patchI];
|
||||
const scalarField& Tp = *this;
|
||||
|
||||
const scalarField Cpp = thermo.Cp(Tp, patchI);
|
||||
const scalarField Cpp = rasModel.thermo().Cp(Tp, patchI);
|
||||
|
||||
const scalarField& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
||||
const scalar Ap = gSum(patch().magSf());
|
||||
|
||||
gradient() = q_/(Ap*rhop*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();
|
||||
}
|
||||
@ -178,7 +211,6 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::write
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
q_.writeEntry("q", os);
|
||||
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
|
||||
gradient().writeEntry("gradient", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
|
||||
#include "fvPatchFields.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -47,20 +48,37 @@ namespace compressible
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class turbulentHeatFluxTemperatureFvPatchScalarField Declaration
|
||||
Class turbulentHeatFluxTemperatureFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class turbulentHeatFluxTemperatureFvPatchScalarField
|
||||
:
|
||||
public fixedGradientFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
public:
|
||||
|
||||
//- Heat flux [W]
|
||||
scalarField q_;
|
||||
// Data types
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
//- 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_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user