From 64c15e179a9f8293c9408af3a3ef7d950de854e6 Mon Sep 17 00:00:00 2001
From: Andrew Heather <>
Date: Mon, 3 Jun 2024 12:33:01 +0100
Subject: [PATCH] ENH: New viewFactorHeatFlux function object
Determines radiation heat flux between patches when using the viewFactor
radiation model.
Example usage
viewFactorHeatFlux1
{
// Mandatory entries (unmodifiable)
type viewFactorHeatFlux;
libs (utilityFunctionObjects);
// Optional entries (runtime modifiable)
qr qr;
}
---
src/functionObjects/utilities/Make/files | 2 +
.../viewFactorHeatFlux/viewFactorHeatFlux.C | 372 ++++++++++++++++++
.../viewFactorHeatFlux/viewFactorHeatFlux.H | 181 +++++++++
3 files changed, 555 insertions(+)
create mode 100644 src/functionObjects/utilities/viewFactorHeatFlux/viewFactorHeatFlux.C
create mode 100644 src/functionObjects/utilities/viewFactorHeatFlux/viewFactorHeatFlux.H
diff --git a/src/functionObjects/utilities/Make/files b/src/functionObjects/utilities/Make/files
index 2e3e9c84f4..aed6a6fa70 100644
--- a/src/functionObjects/utilities/Make/files
+++ b/src/functionObjects/utilities/Make/files
@@ -39,6 +39,8 @@ systemCall/systemCall.C
timeActivatedFileUpdate/timeActivatedFileUpdate.C
+viewFactorHeatFlux/viewFactorHeatFlux.C
+
writeDictionary/writeDictionary.C
writeObjects/writeObjects.C
diff --git a/src/functionObjects/utilities/viewFactorHeatFlux/viewFactorHeatFlux.C b/src/functionObjects/utilities/viewFactorHeatFlux/viewFactorHeatFlux.C
new file mode 100644
index 0000000000..2bc479fe5a
--- /dev/null
+++ b/src/functionObjects/utilities/viewFactorHeatFlux/viewFactorHeatFlux.C
@@ -0,0 +1,372 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2024 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "viewFactorHeatFlux.H"
+#include "addToRunTimeSelectionTable.H"
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace functionObjects
+{
+ defineTypeNameAndDebug(viewFactorHeatFlux, 0);
+ addToRunTimeSelectionTable(functionObject, viewFactorHeatFlux, dictionary);
+}
+}
+
+
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+void Foam::functionObjects::viewFactorHeatFlux::initialise()
+{
+ const auto& pbm = mesh_.boundaryMesh();
+ const labelList selectedPatches = pbm.indices("viewFactorWall");
+
+
+ // Initialise output file
+
+ auto& os = file();
+
+ writeHeader(os, "Radiation heat flux");
+ writeCommented(os, "Time");
+
+ for (const label patchi : selectedPatches)
+ {
+ writeTabbed(os, pbm[patchi].name());
+ }
+
+ os << endl;
+
+
+ // Create compact patch addressing
+
+ label nFace = 0;
+ forAll(selectedPatches, i)
+ {
+ const label patchi = selectedPatches[i];
+ auto slice = compactPatchID_.slice(nFace, pbm[patchi].size());
+ slice = i;
+ nFace += slice.size();
+ }
+
+
+ if (Pstream::parRun())
+ {
+ mapDistPtr_.reset
+ (
+ new IOmapDistribute
+ (
+ IOobject
+ (
+ "mapDist",
+ mesh_.facesInstance(),
+ mesh_,
+ IOobject::MUST_READ,
+ IOobject::NO_WRITE,
+ IOobject::NO_REGISTER
+ )
+ )
+ );
+
+ auto& mapDist = mapDistPtr_();
+
+ mapDist.distribute(compactPatchID_);
+
+
+ // Convert global addressing into compact form
+
+ labelList compactGlobalIds(mapDist.constructSize(), Zero);
+
+ globalIndex gi(nFace);
+
+ SubList