From 0ad9d140a32a13bbd5b15d44772baf64bb2306c1 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Wed, 28 Aug 2024 14:36:14 +0100
Subject: [PATCH] BUG: fan: bc value not updated. See #3211

---
 .../fields/GeometricFields/GeometricField/GeometricField.C    | 4 ++++
 .../constraint/processor/processorFaPatchField.H              | 2 +-
 .../fvPatchFields/constraint/cyclic/cyclicFvPatchField.H      | 2 +-
 .../constraint/jumpCyclic/jumpCyclicFvPatchField.H            | 2 +-
 .../constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H      | 2 +-
 5 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C
index 2ec59ff2d74..cd35ac3b3cb 100644
--- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C
+++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C
@@ -1092,6 +1092,10 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha)
         << "Relaxing" << nl << this->info() << " by " << alpha << endl;
 
     operator==(prevIter() + alpha*(*this - prevIter()));
+
+    // Make sure any e.g. jump-cyclic are updated. Note: unfortunately also
+    // triggers e.g. cyclic interpolation.
+    this->correctLocalBoundaryConditions();
 }
 
 
diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H
index e50d5a2a918..65ebe8a830f 100644
--- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H
+++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.H
@@ -175,7 +175,7 @@ public:
         virtual bool ready() const;
 
         //- Return neighbour field given internal field
-        tmp<Field<Type>> patchNeighbourField() const;
+        virtual tmp<Field<Type>> patchNeighbourField() const;
 
 
     // Evaluation
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H
index b8199cb28ec..84e8dcb6f9f 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H
@@ -170,7 +170,7 @@ public:
         // Evaluation functions
 
             //- Return neighbour coupled internal cell data
-            tmp<Field<Type>> patchNeighbourField() const;
+            virtual tmp<Field<Type>> patchNeighbourField() const;
 
             //- Return reference to neighbour patchField
             const cyclicFvPatchField<Type>& neighbourPatchField() const;
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H
index 199215c6282..5d46b8f67fb 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.H
@@ -128,7 +128,7 @@ public:
         // Evaluation functions
 
             //- Return neighbour coupled given internal cell data
-            tmp<Field<Type>> patchNeighbourField() const;
+            virtual tmp<Field<Type>> patchNeighbourField() const;
 
             //- Update result field based on interface functionality
             virtual void updateInterfaceMatrix
diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H
index 81bc12133d9..78208ad80bb 100644
--- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H
@@ -128,7 +128,7 @@ public:
         // Evaluation functions
 
             //- Return neighbour coupled given internal cell data
-            tmp<Field<Type>> patchNeighbourField() const;
+            virtual tmp<Field<Type>> patchNeighbourField() const;
 
             //- Update result field based on interface functionality
             virtual void updateInterfaceMatrix
-- 
GitLab