ENH: changing externalWallHeatFluxTemperature BC to work using mixed type.

This commit is contained in:
sergio
2014-04-30 12:00:17 +01:00
committed by Andrew Heather
parent 60c761d0ca
commit 222e403794
2 changed files with 17 additions and 24 deletions

View File

@ -72,9 +72,9 @@ externalWallHeatFluxTemperatureFvPatchScalarField
thicknessLayers_(), thicknessLayers_(),
kappaLayers_() kappaLayers_()
{ {
this->refValue() = 0.0; refValue() = 0.0;
this->refGrad() = 0.0; refGrad() = 0.0;
this->valueFraction() = 1.0; valueFraction() = 1.0;
} }
@ -242,17 +242,13 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
return; return;
} }
scalarField q(size(), 0.0);
const scalarField Tc(patchInternalField());
const scalarField Tp(*this); const scalarField Tp(*this);
const scalarField KWall(kappa(Tp)); scalarField hp(patch().size(), 0.0);
const scalarField KDelta(KWall*patch().deltaCoeffs());
switch (mode_) switch (mode_)
{ {
case fixedHeatFlux: case fixedHeatFlux:
{ {
q = q_;
break; break;
} }
case fixedHeatTransferCoeff: case fixedHeatTransferCoeff:
@ -269,7 +265,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
} }
} }
} }
q = (Ta_ - Tp)/(1.0/h_ + totalSolidRes); hp = 1.0/(1.0/h_ + totalSolidRes);
break; break;
} }
default: default:
@ -283,27 +279,24 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
} }
} }
forAll(*this, i) if (mode_ == fixedHeatFlux)
{ {
if (q[i] > 0) //in refGrad() = q_/kappa(Tp);
{ refValue() = 0.0;
this->refGrad()[i] = q[i]/KWall[i]; valueFraction() = 0.0;
this->refValue()[i] = 0.0; }
this->valueFraction()[i] = 0.0; else if (mode_ == fixedHeatTransferCoeff)
} {
else //out refGrad() = 0.0;
{ refValue() = Ta_;
this->refGrad()[i] = 0.0; valueFraction() = hp/(hp + kappa(Tp)*patch().deltaCoeffs());
this->refValue()[i] = q[i]/KDelta[i] + Tc[i];
this->valueFraction()[i] = 1.0;
}
} }
mixedFvPatchScalarField::updateCoeffs(); mixedFvPatchScalarField::updateCoeffs();
if (debug) if (debug)
{ {
scalar Q = gSum(KWall*patch().magSf()*snGrad()); scalar Q = gSum(kappa(Tp)*patch().magSf()*snGrad());
Info<< patch().boundaryMesh().mesh().name() << ':' Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':' << patch().name() << ':'

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License