From 5b252183798efa23a616d25143372c1b582a114f Mon Sep 17 00:00:00 2001
From: WURTZ Jean <wurtzj@sxville>
Date: Fri, 13 Oct 2023 12:14:10 +0200
Subject: [PATCH] Jean Wurtz: Bugfix in init_tebn when LGARDEN=F, number of
 soil layer in garden set equal to number of soil layer in TEB for writing
 CLAY SAND

---
 src/SURFEX/init_tebn.F90 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/SURFEX/init_tebn.F90 b/src/SURFEX/init_tebn.F90
index 3cc24cab9..26aa3ff0b 100644
--- a/src/SURFEX/init_tebn.F90
+++ b/src/SURFEX/init_tebn.F90
@@ -463,7 +463,7 @@ DO JP=1,TOP%NTEB_PATCH
   IF (TOP%LGARDEN) THEN
      !
      IF (JP==1) THEN    
-       CALL SET_SURFEX_FILEIN(HPROGRAM,'PGD ') ! change input file name to pgd name
+        CALL SET_SURFEX_FILEIN(HPROGRAM,'PGD ') ! change input file name to pgd name
         CALL INIT_IO_SURF_n(DTCO, U, HPROGRAM,'TOWN  ','TEB   ','READ ')     
         CALL INIT_TEB_VEG_OPTIONS_n(CHT, TD%MTO%LSURF_DIAG_ALBEDO, TOP%LGREENROOF, GDM%O, GRM%O, TOP, HPROGRAM, HINIT)
         CALL END_IO_SURF_n(HPROGRAM)
@@ -474,6 +474,8 @@ DO JP=1,TOP%NTEB_PATCH
         ALLOCATE(GDM%O%XSOILGRID(GDM%O%NGROUND_LAYER))
         GDM%O%XSOILGRID = TOP%XTEB_SOILGRID 
      END IF
+  ELSE
+        GDM%O%NGROUND_LAYER = TOP%NTEB_SOIL
      !
   ENDIF
   !
-- 
GitLab