From 2f90efb0a3144a9fc83d18fc05ab02ee3a3699ed Mon Sep 17 00:00:00 2001
From: pdechamps <paul.dechamps@uliege.be>
Date: Sat, 22 Feb 2025 18:19:59 +0100
Subject: [PATCH] (fix) Small fix in blSolverInterface error raise

---
 blast/interfaces/blSolversInterface.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/blast/interfaces/blSolversInterface.py b/blast/interfaces/blSolversInterface.py
index 66f3238..360e44a 100644
--- a/blast/interfaces/blSolversInterface.py
+++ b/blast/interfaces/blSolversInterface.py
@@ -798,7 +798,7 @@ class SolversInterface:
             else:
                 raise RuntimeError('Expected "sections" in cfg')
         if len(cfg['sections']) != self.getnBodies():
-            raise RuntimeError(f'Expected the length of "sections" to be {self.getnBodies()}, got {len(self.cfg["sections"])}')
+            raise RuntimeError(f'Expected the length of "sections" to be {self.getnBodies()}, got {len(cfg["sections"])}')
         return cfg
 
     def _initDataStructures(self)->tuple[list, list]:
@@ -907,6 +907,7 @@ class SolversInterface:
                 allregs.append(vreg.type)
             # Compute average and max AR of viscous cells
             avgAR = 0
+            nNodes = 0
             if self.getnDim() == 3:
                 point_cpt = 0
                 for isec in range(1,len(self.vBnd[ibody])):
@@ -920,8 +921,13 @@ class SolversInterface:
                         # AR = b^2 / S
                         avgAR += dy**2 / (dx * dy)
                         point_cpt += 1
+                        nNodes += 1
                 avgAR /= point_cpt
-            print(f'  -{ibody}: {bodyName}, {len(self.vBnd[ibody])} section(s) with sides {allregs}, avg AR {avgAR:.2f}')
+            elif self.getnDim() == 2:
+                for isec in range(len(self.vBnd[ibody])):
+                    for ipoint in range(1,self.vBnd[ibody][isec][0].nodesCoord.shape[0]):
+                        nNodes += 1
+            print(f'  - {bodyName}: {len(self.vBnd[ibody])} section(s) with sides {allregs},\n\t{nNodes} surface nodes, avg AR {avgAR:.2f}')
         print('')
 
     # Abstract methods for the interface
-- 
GitLab