From 3dcf5f16353c3c48c090d1c92eea954999981440 Mon Sep 17 00:00:00 2001
From: Kutalmis Bercin <kutalmis.bercin@esi-group.com>
Date: Sat, 25 Sep 2021 21:40:00 +0100
Subject: [PATCH] BUG: LESdelta: avoid double object registrations (Fixes
 #1171)

---
 .../LES/LESdeltas/PrandtlDelta/PrandtlDelta.C    |  4 ++--
 .../maxDeltaxyzCubeRootLESDelta.C                | 16 +++++++++++++---
 .../LES/LESdeltas/smoothDelta/smoothDelta.C      |  4 ++--
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/PrandtlDelta/PrandtlDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/PrandtlDelta/PrandtlDelta.C
index a2dc5d20038..ffe34123470 100644
--- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/PrandtlDelta/PrandtlDelta.C
+++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/PrandtlDelta/PrandtlDelta.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -68,7 +68,7 @@ Foam::LESModels::PrandtlDelta::PrandtlDelta
     (
         LESdelta::New
         (
-            name,
+            IOobject::groupName("geometricDelta", turbulence.U().group()),
             turbulence,
             dict.optionalSubDict(type() + "Coeffs")
         )
diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.C
index 1ef74e6251d..a5ef97812e7 100644
--- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.C
+++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/maxDeltaxyzCubeRootLESDelta/maxDeltaxyzCubeRootLESDelta.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -74,8 +74,18 @@ Foam::LESModels::maxDeltaxyzCubeRootLESDelta::maxDeltaxyzCubeRootLESDelta
 )
 :
     LESdelta(name, turbulence),
-    maxDeltaxyz_(name, turbulence, dict.subDict(typeName + "Coeffs")),
-    cubeRootVolDelta_(name, turbulence, dict.subDict(typeName + "Coeffs"))
+    maxDeltaxyz_
+    (
+        name + "maxDeltaxyz",
+        turbulence,
+        dict.subDict(typeName + "Coeffs")
+    ),
+    cubeRootVolDelta_
+    (
+        name + "cubeRootVolDelta",
+        turbulence,
+        dict.subDict(typeName + "Coeffs")
+    )
 {
     calcDelta();
 }
diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C
index 8d36dab5752..3f5ed73a6a0 100644
--- a/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C
+++ b/src/TurbulenceModels/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2016 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -157,7 +157,7 @@ Foam::LESModels::smoothDelta::smoothDelta
     (
         LESdelta::New
         (
-            "geometricDelta",
+            IOobject::groupName("geometricDelta", turbulence.U().group()),
             turbulence,
             dict.optionalSubDict(type() + "Coeffs")
         )
-- 
GitLab