From 5937c37a4ea2526d7b9746609e5b8c8d0b7af915 Mon Sep 17 00:00:00 2001
From: Vaggelis Papoutsis <vaggelisp@gmail.com>
Date: Wed, 1 Jun 2022 18:40:12 +0300
Subject: [PATCH] BUG: nearWallDist not updated throughout optimisation loops

Partially fixes #2502 (see discussion there)
---
 .../displacementMethod/displacementMethod.C                  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/optimisation/adjointOptimisation/adjoint/displacementMethod/displacementMethod/displacementMethod.C b/src/optimisation/adjointOptimisation/adjoint/displacementMethod/displacementMethod/displacementMethod.C
index 58f2586a15d..298fcd4f679 100644
--- a/src/optimisation/adjointOptimisation/adjoint/displacementMethod/displacementMethod/displacementMethod.C
+++ b/src/optimisation/adjointOptimisation/adjoint/displacementMethod/displacementMethod/displacementMethod.C
@@ -128,7 +128,10 @@ void Foam::displacementMethod::update()
     mesh_.movePoints(tnewPoints());
     scalar timeAft = mesh_.time().elapsedCpuTime();
     Info<< "Mesh movement took " << timeAft - timeBef << " seconds" << endl;
-    mesh_.moving(false);
+    if (!mesh_.steady())
+    {
+        mesh_.moving(false);
+    }
 }
 
 
-- 
GitLab