From 3631dd5f9418d1edfe912f056aa4b267ea219d99 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Thu, 4 Feb 2021 13:34:45 +0100
Subject: [PATCH] Philippe 04/02/2021: budgets: correct several conditions for
 LIMA in ini_budget

(cherry picked from commit 482ed92d138e1824c3e04d2cb556eba6f77f983a)
---
 src/MNH/ini_budget.f90 | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/MNH/ini_budget.f90 b/src/MNH/ini_budget.f90
index 3bae859ef..dc5671182 100644
--- a/src/MNH/ini_budget.f90
+++ b/src/MNH/ini_budget.f90
@@ -3498,12 +3498,12 @@ ELSEIF (JSV >= NSV_LIMA_BEG .AND. JSV <= NSV_LIMA_END) THEN
       ILAST_PROC_NBR = ILAST_PROC_NBR + 1
       YWORK2(12+JSV,ILAST_PROC_NBR)= 'NEGA_'
       IPROACTV(12+JSV,ILAST_PROC_NBR) = NNEGASV
-      IF (OWARM .AND. OACTI .AND. OPTSPLIT) THEN
+      IF (OWARM .AND. OACTI) THEN
          ILAST_PROC_NBR = ILAST_PROC_NBR + 1
          YWORK2(12+JSV,ILAST_PROC_NBR)= 'HENU_'
          IPROACTV(12+JSV,ILAST_PROC_NBR) = 1
       END IF
-      IF (OCOLD .AND. ONUCL .AND. .NOT. OMEYERS .AND. OPTSPLIT) THEN
+      IF (OCOLD .AND. ONUCL .AND. .NOT. OMEYERS) THEN
          ILAST_PROC_NBR = ILAST_PROC_NBR + 1
          YWORK2(12+JSV,ILAST_PROC_NBR)= 'HINC_'
          IPROACTV(12+JSV,ILAST_PROC_NBR) = 1
@@ -3720,17 +3720,14 @@ ELSEIF (JSV >= NSV_LIMA_BEG .AND. JSV <= NSV_LIMA_END) THEN
       ILAST_PROC_NBR = ILAST_PROC_NBR + 1
       YWORK2(12+JSV,ILAST_PROC_NBR)= 'NEGA_'
       IPROACTV(12+JSV,ILAST_PROC_NBR) = NNEGASV
-      IF (OCOLD .AND. ONUCL .AND. OMEYERS .AND. JSV == NSV_LIMA_IFN_NUCL .AND. OPTSPLIT) THEN
+      IF (OCOLD .AND. ONUCL .AND. ( .NOT.OMEYERS .OR. (OMEYERS .AND. JSV == NSV_LIMA_IFN_NUCL) ) ) THEN
          ILAST_PROC_NBR = ILAST_PROC_NBR + 1
          YWORK2(12+JSV,ILAST_PROC_NBR)= 'HIND_'
          IPROACTV(12+JSV,ILAST_PROC_NBR) = 1
-         ILAST_PROC_NBR = ILAST_PROC_NBR + 1
-         YWORK2(12+JSV,ILAST_PROC_NBR)= 'HINC_'
-         IPROACTV(12+JSV,ILAST_PROC_NBR) = 1
       END IF
-      IF (OCOLD .AND. ONUCL .AND. .NOT. OMEYERS .AND. OPTSPLIT) THEN
+      IF (OCOLD .AND. ONUCL .AND. OMEYERS .AND. JSV == NSV_LIMA_IFN_NUCL) THEN
          ILAST_PROC_NBR = ILAST_PROC_NBR + 1
-         YWORK2(12+JSV,ILAST_PROC_NBR)= 'HIND_'
+         YWORK2(12+JSV,ILAST_PROC_NBR)= 'HINC_'
          IPROACTV(12+JSV,ILAST_PROC_NBR) = 1
       END IF
       IF (OPTSPLIT .OR. (.NOT.OPTSPLIT .AND. OCOLD .AND. OWARM)) THEN
@@ -3767,7 +3764,7 @@ ELSEIF (JSV >= NSV_LIMA_BEG .AND. JSV <= NSV_LIMA_END) THEN
       ILAST_PROC_NBR = ILAST_PROC_NBR + 1
       YWORK2(12+JSV,ILAST_PROC_NBR)= 'NEGA_'
       IPROACTV(12+JSV,ILAST_PROC_NBR) = NNEGASV
-      IF (OCOLD .AND. ONUCL .AND. .NOT. OMEYERS .AND. OPTSPLIT) THEN
+      IF (OCOLD .AND. ONUCL .AND. .NOT. OMEYERS) THEN
          ILAST_PROC_NBR = ILAST_PROC_NBR + 1
          YWORK2(12+JSV,ILAST_PROC_NBR)= 'HINC_'
          IPROACTV(12+JSV,ILAST_PROC_NBR) = 1
@@ -3803,7 +3800,9 @@ ELSEIF (JSV >= NSV_LIMA_BEG .AND. JSV <= NSV_LIMA_END) THEN
       ILAST_PROC_NBR = ILAST_PROC_NBR + 1
       YWORK2(12+JSV,ILAST_PROC_NBR)= 'NEGA_'
       IPROACTV(12+JSV,ILAST_PROC_NBR) = NNEGASV
-      IF (.NOT.OPTSPLIT .AND. OCOLD .AND. ONUCL .AND. OWARM .AND. OHHONI) THEN
+      IF ( OCOLD .AND. ONUCL .AND. &
+           (      (     OPTSPLIT .AND.  (OHHONI .AND. NMOD_CCN.GE.1)             )   &
+             .OR. (.NOT.OPTSPLIT .AND. ((OHHONI .AND. NMOD_CCN.GE.1) .OR. LWARM) ) ) ) THEN
          ILAST_PROC_NBR = ILAST_PROC_NBR + 1
          YWORK2(12+JSV,ILAST_PROC_NBR)= 'HONH_'
          IPROACTV(12+JSV,ILAST_PROC_NBR) = 1
-- 
GitLab