From d802092ccc196058511ccce16f059cac4fc54952 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Fri, 29 Jan 2021 14:23:24 +0100
Subject: [PATCH] Philippe 29/01/2021: budgets: small checks at init

---
 src/MNH/ini_budget.f90 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/MNH/ini_budget.f90 b/src/MNH/ini_budget.f90
index f30c57b3d..eba251b14 100644
--- a/src/MNH/ini_budget.f90
+++ b/src/MNH/ini_budget.f90
@@ -336,7 +336,7 @@ if ( cbutype == 'CART' .or. cbutype == 'MASK' ) then
   if ( cbutype == 'CART' ) then
     !Check if xseglen is a multiple of xbulen (within tolerance)
     if ( Abs( Nint( xseglen / xbulen ) * xbulen - xseglen ) > ( ITOL * xseglen ) ) &
-      call Print_msg( NVERB_WARNING, 'BUD', 'Ini_budget', 'xseglen is not a multiple of xbuwri' )
+      call Print_msg( NVERB_WARNING, 'BUD', 'Ini_budget', 'xseglen is not a multiple of xbulen' )
 
     !Write cartesian budgets every xbulen time period (do not take xbuwri into account)
     xbuwri = xbulen
@@ -363,16 +363,21 @@ end if
 
 IF (CBUTYPE=='CART') THEN              ! cartesian case only
 !
+  IF ( NBUIH < NBUIL ) CALL Print_msg( NVERB_ERROR, 'BUD', 'Ini_budget', 'NBUIH < NBUIL' )
   IF (LBU_ICP) THEN
     NBUIMAX_ll = 1
   ELSE
     NBUIMAX_ll = NBUIH - NBUIL +1
   END IF
-  IF (LBU_JCP) THEN 
+
+  IF ( NBUJH < NBUJL ) CALL Print_msg( NVERB_ERROR, 'BUD', 'Ini_budget', 'NBUJH < NBUJL' )
+  IF (LBU_JCP) THEN
     NBUJMAX_ll = 1
   ELSE
     NBUJMAX_ll = NBUJH - NBUJL +1
   END IF
+
+  IF ( NBUKH < NBUKL ) CALL Print_msg( NVERB_ERROR, 'BUD', 'Ini_budget', 'NBUKH < NBUKL' )
 !
   CALL GET_INTERSECTION_ll(NBUIL+JPHEXT,NBUJL+JPHEXT,NBUIH+JPHEXT,NBUJH+JPHEXT, &
       NBUSIL,NBUSJL,NBUSIH,NBUSJH,"PHYS",IINFO_ll)
-- 
GitLab