From da74b204d78a603529f551ccbf2131978832379b Mon Sep 17 00:00:00 2001
From: Boris Basic <boris.basic@edf.fr>
Date: Mon, 31 Mar 2025 17:22:04 +0200
Subject: [PATCH 1/2] [hermes] Fix reading of MED boundary nodes and elements

---
 sources/utils/hermes/utils_med.F | 43 +++++++++++++++-----------------
 1 file changed, 20 insertions(+), 23 deletions(-)

diff --git a/sources/utils/hermes/utils_med.F b/sources/utils/hermes/utils_med.F
index fa5c1f21db..af38a228e7 100644
--- a/sources/utils/hermes/utils_med.F
+++ b/sources/utils/hermes/utils_med.F
@@ -2250,7 +2250,6 @@
 !
 #if defined (HAVE_MED)
       INTEGER :: MY_ID
-      INTEGER(KIND=KMED_INT) :: TYPE_ELEM_MED
 !
 !-----------------------------------------------------------------------
 !
@@ -2262,15 +2261,6 @@
         RETURN
       ENDIF
 !
-!     CONVERTS TYPE OF ELEMENTS
-      CALL CONVERT_ELEM_TYPE(TYPE_ELEM, TYPE_ELEM_MED, IERR)
-      IF(IERR.NE.0) THEN
-        ERROR_MESSAGE = 'ERROR IN '//
-     &       TRIM(MY_OBJ_TAB(MY_ID)%FILE_NAME)//': '//
-     &       'GET_BND_NELEM_MED:CONVERT_ELEM_TYPE'
-        RETURN
-      ENDIF
-!
 !     Identify bnd element if necessary
       CALL IDENTIFY_BND_ELMT(FILE_ID,TYPE_ELEM,IERR)
       IF(IERR.NE.0) THEN
@@ -5319,7 +5309,7 @@
      &         'ALLOCATING IDENTIFY_BND_ELMT:IS_BND'
           RETURN
         ENDIF
-
+!
         IF(NELEM.NE.0) THEN
 !
 !         READ THE FAMILY NUMBER FOR EACH ELEMENT
@@ -5438,20 +5428,27 @@
           ENDDO
           DEALLOCATE(GRP_NAME)
         ENDDO
+!
         IF(NELEM.NE.0) THEN
-          ! Looping on all element and checking if their family is in
-          ! bnd_fam
-          DO I=1,NELEM
-            MY_OBJ_TAB(MY_ID)%IS_BND(I) = .FALSE.
-            DO IFAM=1,NB_FAMILY
-              IF(NUM_FAMILY(I).EQ.
-     &           MY_OBJ_TAB(MY_ID)%BND_FAM(INT(IFAM),1)) THEN
-                MY_OBJ_TAB(MY_ID)%IS_BND(I) =
-     &                MY_OBJ_TAB(MY_ID)%BND_FAM(INT(IFAM),2).NE.0
-                EXIT
-              ENDIF
+          IF(MY_OBJ_TAB(MY_ID)%NBND_GRP.NE.0) THEN
+            ! Looping on all element and checking if their family is in
+            ! bnd_fam
+            MY_OBJ_TAB(MY_ID)%IS_BND(:) = .FALSE.
+            DO I=1,NELEM
+              DO IFAM=1,NB_FAMILY
+                IF(NUM_FAMILY(I).EQ.
+     &             MY_OBJ_TAB(MY_ID)%BND_FAM(INT(IFAM),1)) THEN
+                  MY_OBJ_TAB(MY_ID)%IS_BND(I) =
+     &              MY_OBJ_TAB(MY_ID)%BND_FAM(INT(IFAM),2).NE.0
+                  EXIT
+                ENDIF
+              ENDDO
             ENDDO
-          ENDDO
+          ELSE
+            ! No boundary conditions file has been provided, all
+            ! boundary elements are presumed valid
+            MY_OBJ_TAB(MY_ID)%IS_BND(:) = .TRUE.
+          ENDIF
           DEALLOCATE(NUM_FAMILY)
         ENDIF
       ENDIF
-- 
GitLab


From cf9456a7d15cb488af7372d951dea7d29ec1277d Mon Sep 17 00:00:00 2001
From: Boris Basic <boris.basic@edf.fr>
Date: Mon, 31 Mar 2025 17:27:10 +0200
Subject: [PATCH 2/2] Add NEWS.txt

---
 NEWS.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NEWS.txt b/NEWS.txt
index ff007917b5..84d80f3356 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,9 @@
 Latest changes
 ==============
 
+HERMES: read boundary information in MED files regardless of the presence or
+not of a boundary conditions file
+
 TELEMAC-2D: Fix mass balance issue with finite volumes and tracer
 Initialization of MASSOU for finite volumes kernel
 Correction of mass balance computation for parellel runs
-- 
GitLab