externalWallHeatFluxTemperature: Combined logic into a single switch

This commit is contained in:
Henry
2014-12-29 11:12:29 +00:00
parent 5f6e909f72
commit a0e704c5cd
2 changed files with 31 additions and 33 deletions

View File

@ -33,27 +33,28 @@ License
namespace Foam namespace Foam
{ {
template<> template<>
const char* const char*
NamedEnum NamedEnum
<externalWallHeatFluxTemperatureFvPatchScalarField::operationMode, 3>::names[]= <
externalWallHeatFluxTemperatureFvPatchScalarField::operationMode,
3
>::names[] =
{ {
"fixed_heat_flux", "fixed_heat_flux",
"fixed_heat_transfer_coefficient", "fixed_heat_transfer_coefficient",
"unknown" "unknown"
}; };
const NamedEnum
<
externalWallHeatFluxTemperatureFvPatchScalarField::operationMode, 3
>
externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
const Foam::NamedEnum
<
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationMode,
3
> Foam::externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::externalWallHeatFluxTemperatureFvPatchScalarField:: Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
@ -260,6 +261,10 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
{ {
case fixedHeatFlux: case fixedHeatFlux:
{ {
refGrad() = (q_ + Qr)/kappa(Tp);
refValue() = 0.0;
valueFraction() = 0.0;
break; break;
} }
case fixedHeatTransferCoeff: case fixedHeatTransferCoeff:
@ -277,6 +282,13 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
} }
} }
hp = 1.0/(1.0/h_ + totalSolidRes); hp = 1.0/(1.0/h_ + totalSolidRes);
Qr /= Tp;
refGrad() = 0.0;
refValue() = hp*Ta_/(hp - Qr);
valueFraction() =
(hp - Qr)/((hp - Qr) + kappa(Tp)*patch().deltaCoeffs());
break; break;
} }
default: default:
@ -290,21 +302,6 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
} }
} }
if (mode_ == fixedHeatFlux)
{
refGrad() = (q_ + Qr)/kappa(Tp);
refValue() = 0.0;
valueFraction() = 0.0;
}
else if (mode_ == fixedHeatTransferCoeff)
{
Qr /= Tp;
refGrad() = 0.0;
refValue() = hp*Ta_/(hp - Qr);
valueFraction() =
(hp - Qr)/((hp - Qr) + kappa(Tp)*patch().deltaCoeffs());
}
mixedFvPatchScalarField::updateCoeffs(); mixedFvPatchScalarField::updateCoeffs();
if (debug) if (debug)

View File

@ -120,6 +120,7 @@ public:
fixedHeatTransferCoeff, fixedHeatTransferCoeff,
unknown unknown
}; };
static const NamedEnum<operationMode, 3> operationModeNames; static const NamedEnum<operationMode, 3> operationModeNames;