Commit 42b3f1c9 authored by Henry Weller's avatar Henry Weller
Browse files

wallHeatFlux: Add support for radiative and total heat-fluxes

Patch provided by Daniel Jasinski
Resolves feature request http://www.openfoam.org/mantisbt/view.php?id=1856
parent 469a8d85
......@@ -42,6 +42,7 @@ if (isA<fluidThermo>(thermo()))
const volVectorField& U = UPtr();
#include "compressibleCreatePhi.H"
// Copy phi to autoPtr. Rename to make sure copy is now registered as 'phi'.
phi.rename("phiFluid");
phiPtr.reset(new surfaceScalarField("phi", phi));
......@@ -54,3 +55,18 @@ if (isA<fluidThermo>(thermo()))
refCast<const fluidThermo>(thermo())
);
}
// Read radiative heat-flux if available
volScalarField Qr
(
IOobject
(
"Qr",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("Qr", dimMass/pow3(dimTime), 0.0)
);
......@@ -70,19 +70,24 @@ int main(int argc, char *argv[])
const surfaceScalarField::GeometricBoundaryField& patchHeatFlux =
heatFlux.boundaryField();
const volScalarField::GeometricBoundaryField& patchRadHeatFlux =
Qr.boundaryField();
const surfaceScalarField::GeometricBoundaryField& magSf =
mesh.magSf().boundaryField();
Info<< "\nWall heat fluxes [W]" << endl;
forAll(patchHeatFlux, patchi)
{
if (isA<wallFvPatch>(mesh.boundary()[patchi]))
{
Info<< mesh.boundary()[patchi].name()
<< " "
<< gSum
(
mesh.magSf().boundaryField()[patchi]
*patchHeatFlux[patchi]
)
<< endl;
scalar convFlux = gSum(magSf[patchi]*patchHeatFlux[patchi]);
scalar radFlux = gSum(magSf[patchi]*patchRadHeatFlux[patchi]);
Info<< mesh.boundary()[patchi].name() << endl
<< " convective: " << convFlux << endl
<< " radiative: " << radFlux << endl
<< " total: " << convFlux + radFlux << endl;
}
}
Info<< endl;
......@@ -105,6 +110,36 @@ int main(int argc, char *argv[])
}
wallHeatFlux.write();
// Write the total heat-flux including the radiative contribution
// if available
if (Qr.headerOk())
{
volScalarField totalWallHeatFlux
(
IOobject
(
"totalWallHeatFlux",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar
(
"totalWallHeatFlux",
heatFlux.dimensions(),
0.0
)
);
forAll(totalWallHeatFlux.boundaryField(), patchi)
{
totalWallHeatFlux.boundaryField()[patchi] =
patchHeatFlux[patchi] + patchRadHeatFlux[patchi];
}
totalWallHeatFlux.write();
}
}
Info<< "End" << endl;
......@@ -112,4 +147,5 @@ int main(int argc, char *argv[])
return 0;
}
// ************************************************************************* //
Supports Markdown
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