From 4f9f3bcc1b587693546aec5b79fe15cf70a502ad Mon Sep 17 00:00:00 2001
From: Kutscher <kutscher@irmb.tu-bs.de>
Date: Thu, 30 Nov 2023 17:16:05 +0100
Subject: [PATCH] fixes laminar plane flow config-file; adds exception for odd
 number of nodes

---
 apps/cpu/LaminarPlaneFlow/LaminarPlaneFlow.cfg         | 10 +++++-----
 .../SetInterpolationConnectorsBlockVisitor.cpp         |  4 ++++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/apps/cpu/LaminarPlaneFlow/LaminarPlaneFlow.cfg b/apps/cpu/LaminarPlaneFlow/LaminarPlaneFlow.cfg
index 161c21057..a767d4d2a 100644
--- a/apps/cpu/LaminarPlaneFlow/LaminarPlaneFlow.cfg
+++ b/apps/cpu/LaminarPlaneFlow/LaminarPlaneFlow.cfg
@@ -1,15 +1,15 @@
 pathname = ./output/LaminarPlaneFlow
-numOfThreads = 18
+numOfThreads = 1
 blocknx = 16 16 1
-boundingBox = 32 32 1 
+boundingBox = 64 64 1 
 deltax = 1
 
-refineLevel = 0
+refineLevel = 1
 
 newStart    = true
 restartStep = 1000000
 
-cpStep      = 1000000
-cpStepStart = 1000000
+cpStep  = 1000000
+cpStart = 1000000
 outTime     = 10
 endTime     = 10
diff --git a/src/cpu/core/Visitors/SetInterpolationConnectorsBlockVisitor.cpp b/src/cpu/core/Visitors/SetInterpolationConnectorsBlockVisitor.cpp
index 4f882353f..691c65ba8 100644
--- a/src/cpu/core/Visitors/SetInterpolationConnectorsBlockVisitor.cpp
+++ b/src/cpu/core/Visitors/SetInterpolationConnectorsBlockVisitor.cpp
@@ -59,6 +59,10 @@ void SetInterpolationConnectorsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block
 {
     if(!block) return;
 
+    UbTupleInt3 blockNX = grid->getBlockNX();
+    if (val<1>(blockNX) % 2 == 0 && val<2>(blockNX) % 2 == 0 && val<3>(blockNX) % 2 == 0)
+        UB_THROW(UbException(UB_EXARGS, "Odd number of nodes: The number of nodes in each dimension (x,y,z) has to be even."));
+
     UBLOG(logDEBUG5, "SetInterpolationConnectorsBlockVisitor::visit() - start");
     UBLOG(logDEBUG5, block->toString());
 
-- 
GitLab