Commit ce7b8dc2 authored by andy's avatar andy
Browse files

ENH: Updated externalWallHeatFlux BC

parent e63b58b6
......@@ -65,7 +65,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
:
mixedFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
oldMode_(unknown),
mode_(unknown),
q_(p.size(), 0.0),
h_(p.size(), 0.0),
Ta_(p.size(), 0.0)
......@@ -87,7 +87,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
temperatureCoupledBase(patch(), ptf.KMethod(), ptf.kappaName()),
oldMode_(ptf.oldMode_),
mode_(ptf.mode_),
q_(ptf.q_, mapper),
h_(ptf.h_, mapper),
Ta_(ptf.Ta_, mapper)
......@@ -104,19 +104,19 @@ externalWallHeatFluxTemperatureFvPatchScalarField
:
mixedFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), dict),
oldMode_(unknown),
mode_(unknown),
q_(p.size(), 0.0),
h_(p.size(), 0.0),
Ta_(p.size(), 0.0)
{
if (dict.found("q") && !dict.found("h") && !dict.found("Ta"))
{
oldMode_ = fixedHeatFlux;
mode_ = fixedHeatFlux;
q_ = scalarField("q", dict, p.size());
}
else if (dict.found("h") && dict.found("Ta") && !dict.found("q"))
{
oldMode_ = fixedHeatTransferCoeff;
mode_ = fixedHeatTransferCoeff;
h_ = scalarField("h", dict, p.size());
Ta_ = scalarField("Ta", dict, p.size());
}
......@@ -166,7 +166,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
:
mixedFvPatchScalarField(tppsf),
temperatureCoupledBase(tppsf),
oldMode_(tppsf.oldMode_),
mode_(tppsf.mode_),
q_(tppsf.q_),
h_(tppsf.h_),
Ta_(tppsf.Ta_)
......@@ -182,7 +182,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
:
mixedFvPatchScalarField(tppsf, iF),
temperatureCoupledBase(patch(), tppsf.KMethod(), tppsf.kappaName()),
oldMode_(tppsf.oldMode_),
mode_(tppsf.mode_),
q_(tppsf.q_),
h_(tppsf.h_),
Ta_(tppsf.Ta_)
......@@ -228,39 +228,45 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
}
scalarField q(size(), 0.0);
scalarField KWall(kappa(*this));
scalarField KDelta(KWall*patch().deltaCoeffs());
const scalarField Tc(patchInternalField());
const scalarField KWall(kappa(Tc));
const scalarField KDelta(KWall*patch().deltaCoeffs());
if (oldMode_ == fixedHeatFlux)
switch (mode_)
{
q = q_;
}
else if (oldMode_ == fixedHeatTransferCoeff)
{
q = (Ta_ - *this)*h_;
}
else
{
FatalErrorIn
(
"externalWallHeatFluxTemperatureFvPatchScalarField"
"::updateCoeffs()"
) << "Illegal heat flux mode " << operationModeNames[oldMode_]
<< exit(FatalError);
case fixedHeatFlux:
{
q = q_;
break;
}
case fixedHeatTransferCoeff:
{
q = (Ta_ - Tc)*h_;
break;
}
default:
{
FatalErrorIn
(
"externalWallHeatFluxTemperatureFvPatchScalarField"
"::updateCoeffs()"
) << "Illegal heat flux mode " << operationModeNames[mode_]
<< exit(FatalError);
}
}
forAll (*this, i)
forAll(*this, i)
{
if (q[i] > 0) //in
{
this->refGrad()[i] = q[i]/kappa(*this)()[i];
this->refGrad()[i] = q[i]/KWall[i];
this->refValue()[i] = 0.0;
this->valueFraction()[i] = 0.0;
}
else //out
{
this->refGrad()[i] = 0.0;
this->refValue()[i] = q[i]/KDelta[i] + patchInternalField()()[i];
this->refValue()[i] = q[i]/KDelta[i] + Tc[i];
this->valueFraction()[i] = 1.0;
}
}
......@@ -291,7 +297,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
{
mixedFvPatchScalarField::write(os);
temperatureCoupledBase::write(os);
switch (oldMode_)
switch (mode_)
{
case fixedHeatFlux:
{
......@@ -312,7 +318,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
"("
"Ostream& os"
") const"
) << "Illegal heat flux mode " << operationModeNames[oldMode_]
) << "Illegal heat flux mode " << operationModeNames[mode_]
<< abort(FatalError);
}
}
......
......@@ -102,7 +102,7 @@ private:
// Private data
//- Operation mode
operationMode oldMode_;
operationMode mode_;
//- Heat flux / [W/m2]
scalarField q_;
......
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