From 791796c67fbfb83bd95c6ea3cb68c8a41c7f22bc Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Thu, 7 Nov 2024 15:55:09 +0000
Subject: [PATCH] BUG: cellReduce: use boundary values. Fixes #3255

---
 .../finiteVolume/fvc/fvcCellReduce.C            | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C
index 73488db5a09..ce6f13b961c 100644
--- a/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C
+++ b/src/finiteVolume/finiteVolume/fvc/fvcCellReduce.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2013-2016 OpenFOAM Foundation
+    Copyright (C) 2024 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -71,15 +72,27 @@ Foam::fvc::cellReduce
 
     forAll(own, i)
     {
-        label celli = own[i];
+        const label celli = own[i];
         cop(result[celli], ssf[i]);
     }
     forAll(nbr, i)
     {
-        label celli = nbr[i];
+        const label celli = nbr[i];
         cop(result[celli], ssf[i]);
     }
 
+    forAll(mesh.boundary(), patchi)
+    {
+        const auto& pFaceCells = mesh.boundary()[patchi].faceCells();
+        const auto& pssf = ssf.boundaryField()[patchi];
+
+        forAll(pssf, i)
+        {
+            const label celli = pFaceCells[i];
+            cop(result[celli], pssf[i]);
+        }
+    }
+
     result.correctBoundaryConditions();
 
     return tresult;
-- 
GitLab