From b09f3e95d8d8ee9c58242e6063d49872231f34a2 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Tue, 22 Jan 2019 16:11:30 +0100
Subject: [PATCH] Philippe 22/01/2019: bugs: incorrect writes + unauthorized
 goto

---
 src/MNH/ini_rain_ice.f90            |  9 +++++++--
 src/MNH/init_aerosol_properties.f90 | 25 +++++++++++++------------
 src/MNH/read_exsegn.f90             | 13 +++++++------
 3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/src/MNH/ini_rain_ice.f90 b/src/MNH/ini_rain_ice.f90
index f4698d441..530ad47cd 100644
--- a/src/MNH/ini_rain_ice.f90
+++ b/src/MNH/ini_rain_ice.f90
@@ -1,3 +1,8 @@
+!MNH_LIC Copyright 1995-2019 CNRS, Meteo-France and Universite Paul Sabatier
+!MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
+!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
+!MNH_LIC for details. version 1.
+!-----------------------------------------------------------------
 !     ######spl
        MODULE MODI_INI_RAIN_ICE
 !      ########################
@@ -95,6 +100,7 @@ END MODULE MODI_INI_RAIN_ICE
 !!                  24/03/01 Update XCRIAUTI for cirrus cases
 !!      J.-P. Pinty 24/11/01 Update ICE3/ICE4 options
 !!      S. Riette 2016-11: new ICE3/ICE4 options
+!!      P. Wautelet 22/01/2019 bug correction: incorrect write
 !!
 !-------------------------------------------------------------------------------
 !
@@ -585,8 +591,7 @@ IF (GFLAG) THEN
   WRITE(UNIT=KLUOUT,FMT='(" Crit. ice cont. XCRIAUTI=",E13.6)') XCRIAUTI
   WRITE(UNIT=KLUOUT,FMT='(" A Coef. for cirrus law XACRIAUTI=",E13.6)')XACRIAUTI
   WRITE(UNIT=KLUOUT,FMT='(" B Coef. for cirrus law XBCRIAUTI=",E13.6)')XBCRIAUTI
-  WRITE(UNIT=KLUOUT,FMT='(" Temp degC at which cirrus law starts to be &
-                              used=",E13.6)') XT0CRIAUTI
+  WRITE(UNIT=KLUOUT,FMT='(" Temp degC at which cirrus law starts to be used=",E13.6)') XT0CRIAUTI
 END IF
 !
 !
diff --git a/src/MNH/init_aerosol_properties.f90 b/src/MNH/init_aerosol_properties.f90
index 06b69e668..0c4c4e4f2 100644
--- a/src/MNH/init_aerosol_properties.f90
+++ b/src/MNH/init_aerosol_properties.f90
@@ -1,6 +1,6 @@
-!MNH_LIC Copyright 2013-2018 CNRS, Meteo-France and Universite Paul Sabatier
+!MNH_LIC Copyright 2013-2019 CNRS, Meteo-France and Universite Paul Sabatier
 !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
-!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt  
+!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 !MNH_LIC for details. version 1.
 !-----------------------------------------------------------------
 !      ####################
@@ -34,6 +34,7 @@ END MODULE MODI_INIT_AEROSOL_PROPERTIES
 !!    -------------
 !!      Original             ??/??/13 
 !!  Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
+!!  Philippe Wautelet: 22/01/2019: bugs correction: incorrect writes + unauthorized goto
 !!
 !-------------------------------------------------------------------------------
 !
@@ -158,9 +159,16 @@ IF ( NMOD_CCN .GE. 1 ) THEN
   IF (.NOT.(ALLOCATED(XBETAHEN_MULTI))) ALLOCATE(XBETAHEN_MULTI(NMOD_CCN))
   IF (.NOT.(ALLOCATED(XLIMIT_FACTOR)))  ALLOCATE(XLIMIT_FACTOR(NMOD_CCN))
 !
-  IF (HINI_CCN == 'CCN'.AND. (.NOT. LSCAV) ) THEN
+  IF (HINI_CCN == 'CCN') THEN
+    IF (LSCAV) THEN
+! Attention !
+      WRITE(UNIT=ILUOUT0,FMT='("You are using a numerical initialization &
+        &not depending on the aerosol properties, however you need it for &
+        &scavenging.                                                      &
+        &With LSCAV = true, HINI_CCN should be set to AER for consistency")')
+    END IF
 ! Numerical initialization without dependence on AP physical properties
-100 DO JMOD = 1, NMOD_CCN 
+    DO JMOD = 1, NMOD_CCN
       XKHEN_MULTI(JMOD)    = XKHEN_TMP(JMOD)  
       XMUHEN_MULTI(JMOD)   = XMUHEN_TMP(JMOD)
       XBETAHEN_MULTI(JMOD) = XBETAHEN_TMP(JMOD)*(100.)**2                    
@@ -170,13 +178,6 @@ IF ( NMOD_CCN .GE. 1 ) THEN
            /( XBETAHEN_MULTI(JMOD)**(0.5*XKHEN_MULTI(JMOD))       &
            *GAMMA_X0D(XMUHEN_MULTI(JMOD)) ) ! N/C
     END DO
-  ELSE IF (HINI_CCN == 'CCN'.AND. LSCAV ) THEN
-! Attention !
-    WRITE(UNIT=ILUOUT0,FMT='("You are using a numerical initialization &
-      not depending on the aerosol properties, however you need it for &
-      scavenging.                                                      &
-      With LSCAV = true, HINI_CCN should be set to AER for consistency")')
-    go to 100
   ELSE IF (HINI_CCN == 'AER') THEN
 ! 
 ! Initialisation depending on aerosol physical properties
@@ -218,7 +219,7 @@ IF ( NMOD_CCN .GE. 1 ) THEN
           XALPHA6    = 3.076
        CASE DEFAULT
           WRITE(UNIT=ILUOUT0,FMT='("You must specify HTYPE_CNN(JMOD)=C or M &
-               in EXSEG1.nam for each CCN mode")')
+               &in EXSEG1.nam for each CCN mode")')
           CALL ABORT
        ENDSELECT
 !
diff --git a/src/MNH/read_exsegn.f90 b/src/MNH/read_exsegn.f90
index b33406107..938165d51 100644
--- a/src/MNH/read_exsegn.f90
+++ b/src/MNH/read_exsegn.f90
@@ -1,6 +1,6 @@
-!MNH_LIC Copyright 1994-2018 CNRS, Meteo-France and Universite Paul Sabatier
+!MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier
 !MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
-!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt  
+!MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 !MNH_LIC for details. version 1.
 !-----------------------------------------------------------------
 !     ###################### 
@@ -289,6 +289,7 @@ END MODULE MODI_READ_EXSEG_n
 !!  Philippe Wautelet: 05/2016-04/2018: new data structures and calls for I/O
 !!      Modification   07/2017   (V. Vionnet) add blowing snow scheme
 !!      Modification   01/2019   (Q. Rodier) define XCEDIS depending on BL89 or RM17 mixing length
+!!      Modification   01/2019   (P. Wautelet) bugs correction: incorrect writes
 !!------------------------------------------------------------------------------
 !
 !*       0.    DECLARATIONS
@@ -1033,16 +1034,16 @@ SELECT CASE ( CCLOUD )
 !
     IF(LACTI .AND. NMOD_CCN == 0) THEN
       WRITE(UNIT=ILUOUT,FMT=9001) KMI
-      WRITE(UNIT=ILUOUT,FMT='("ACTIVATION OF AEROSOL PARTICLES IS NOT "    &
-           &"POSSIBLE IF NMOD_CCN HAS VALUE ZERO. YOU HAVE TO SET AN UPPER " &
+      WRITE(UNIT=ILUOUT,FMT='("ACTIVATION OF AEROSOL PARTICLES IS NOT ",      &
+           &"POSSIBLE IF NMOD_CCN HAS VALUE ZERO. YOU HAVE TO SET AN UPPER ", &
            &"VALUE OF NMOD_CCN IN ORDER TO USE LIMA WARM ACTIVATION SCHEME.")') 
       STOP
     END IF
 !
     IF(LNUCL .AND. NMOD_IFN == 0 .AND. (.NOT.LMEYERS)) THEN
       WRITE(UNIT=ILUOUT,FMT=9001) KMI
-      WRITE(UNIT=ILUOUT,FMT='("NUCLEATION BY DEPOSITION AND CONTACT IS NOT "&
-           &"POSSIBLE IF NMOD_IFN HAS VALUE ZERO. YOU HAVE TO SET AN UPPER"   &
+      WRITE(UNIT=ILUOUT,FMT='("NUCLEATION BY DEPOSITION AND CONTACT IS NOT ", &
+           &"POSSIBLE IF NMOD_IFN HAS VALUE ZERO. YOU HAVE TO SET AN UPPER",  &
            &"VALUE OF NMOD_IFN IN ORDER TO USE LIMA COLD NUCLEATION SCHEME.")') 
     END IF
 !
-- 
GitLab