Newer
Older
!MNH_LIC Copyright 1994-2014 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.
! ######################
MODULE MODI_INI_LB
! ######################
!
INTERFACE
!

WAUTELET Philippe
committed
SUBROUTINE INI_LB(TPINIFILE,HLUOUT,OLSOURCE,KSV, &
KSIZELBX_ll,KSIZELBXU_ll,KSIZELBY_ll,KSIZELBYV_ll, &
KSIZELBXTKE_ll,KSIZELBYTKE_ll, &
KSIZELBXR_ll,KSIZELBYR_ll,KSIZELBXSV_ll,KSIZELBYSV_ll, &
HGETTKEM,HGETRVM,HGETRCM,HGETRRM,HGETRIM,HGETRSM, &
HGETRGM,HGETRHM,HGETSVM, &
PLBXUM,PLBXVM,PLBXWM,PLBXTHM,PLBXTKEM,PLBXRM,PLBXSVM, &
PLBYUM,PLBYVM,PLBYWM,PLBYTHM,PLBYTKEM,PLBYRM,PLBYSVM, &
PLBXUMM,PLBXVMM,PLBXWMM,PLBXTHMM,PLBXTKEMM,PLBXRMM,PLBXSVMM, &
PLBYUMM,PLBYVMM,PLBYWMM,PLBYTHMM,PLBYTKEMM,PLBYRMM,PLBYSVMM, &
PLENG )
!

WAUTELET Philippe
committed
USE MODD_IO_ll, ONLY: TFILEDATA
!
TYPE(TFILEDATA), INTENT(IN) :: TPINIFILE ! Initial file
CHARACTER (LEN=*), INTENT(IN) :: HLUOUT ! name for output-listing of nested models
LOGICAL, INTENT(IN) :: OLSOURCE ! switch for the source term
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
! Larger Scale fields (source if OLSOURCE=T, fields at time t-dt if OLSOURCE=F) :
INTEGER, INTENT(IN) :: KSV ! number of passive variables
! sizes of the West-east total LB area
INTEGER, INTENT(IN) :: KSIZELBX_ll,KSIZELBXU_ll ! for T,V,W and u
INTEGER, INTENT(IN) :: KSIZELBXTKE_ll ! for TKE
INTEGER, INTENT(IN) :: KSIZELBXR_ll,KSIZELBXSV_ll ! for Rx and SV
! sizes of the North-south total LB area
INTEGER, INTENT(IN) :: KSIZELBY_ll,KSIZELBYV_ll ! for T,U,W and v
INTEGER, INTENT(IN) :: KSIZELBYTKE_ll ! for TKE
INTEGER, INTENT(IN) :: KSIZELBYR_ll,KSIZELBYSV_ll ! for Rx and SV
! Get indicators
CHARACTER (LEN=*), INTENT(IN) :: HGETTKEM, &
HGETRVM,HGETRCM,HGETRRM, &
HGETRIM,HGETRSM,HGETRGM,HGETRHM
CHARACTER (LEN=*), DIMENSION(:),INTENT(IN) :: HGETSVM
! LB fields (source if OLSOURCE=T, fields at time t-dt if OLSOURCE=F) :
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBXUM,PLBXVM,PLBXWM ! Wind
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBXTHM ! Mass
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBYUM,PLBYVM,PLBYWM ! Wind
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBYTHM ! Mass
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBXTKEM ! TKE
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBYTKEM
REAL, DIMENSION(:,:,:,:), INTENT(OUT) :: PLBXRM ,PLBXSVM ! Moisture and SV
REAL, DIMENSION(:,:,:,:), INTENT(OUT) :: PLBYRM ,PLBYSVM ! in x and y-dir.
! LB arrays at time t-dt (if OLSOURCE=T) :
REAL, DIMENSION(:,:,:), INTENT(IN), OPTIONAL :: PLBXUMM,PLBXVMM,PLBXWMM ! Wind
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBXTHMM ! Mass
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBYUMM,PLBYVMM,PLBYWMM ! Wind
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBYTHMM ! Mass
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBXTKEMM ! TKE
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBYTKEMM
REAL, DIMENSION(:,:,:,:),INTENT(IN), OPTIONAL :: PLBXRMM ,PLBXSVMM ! Moisture and SV
REAL, DIMENSION(:,:,:,:),INTENT(IN), OPTIONAL :: PLBYRMM ,PLBYSVMM ! in x and y-dir.
REAL, INTENT(IN), OPTIONAL :: PLENG ! Interpolation length
!
END SUBROUTINE INI_LB
!
END INTERFACE
!
END MODULE MODI_INI_LB
! ############################################################

WAUTELET Philippe
committed
SUBROUTINE INI_LB(TPINIFILE,HLUOUT,OLSOURCE,KSV, &
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
KSIZELBX_ll,KSIZELBXU_ll,KSIZELBY_ll,KSIZELBYV_ll, &
KSIZELBXTKE_ll,KSIZELBYTKE_ll, &
KSIZELBXR_ll,KSIZELBYR_ll,KSIZELBXSV_ll,KSIZELBYSV_ll, &
HGETTKEM,HGETRVM,HGETRCM,HGETRRM,HGETRIM,HGETRSM, &
HGETRGM,HGETRHM,HGETSVM, &
PLBXUM,PLBXVM,PLBXWM,PLBXTHM,PLBXTKEM,PLBXRM,PLBXSVM, &
PLBYUM,PLBYVM,PLBYWM,PLBYTHM,PLBYTKEM,PLBYRM,PLBYSVM, &
PLBXUMM,PLBXVMM,PLBXWMM,PLBXTHMM,PLBXTKEMM,PLBXRMM,PLBXSVMM, &
PLBYUMM,PLBYVMM,PLBYWMM,PLBYTHMM,PLBYTKEMM,PLBYRMM,PLBYSVMM, &
PLENG )
! ############################################################
!
!!**** *INI_LB* - routine to initialize LB fields
!!
!! PURPOSE
!! -------
! The purpose of this routine is to read the LB fields and to distribute
! on subdomain which have a non-nul intersection with the LB areas.
! In case of OLSOURCE=T, it initializes the LB sources instead of the
! LB fields at time t-dt
!
!!** METHOD
!! ------
!! The LB fields are read in file and distributed by FMREAD_LB
!!
!! In case of OLSOURCE=T (INI_LB called by INI_CPL or LS_COUPLING), the LB sources
!! are computed
!!
!!
!! EXTERNAL
!! --------
!! FMLOOK : to retrieve logical number
!! FMREAD : to read data in LFIFM file
!! FMREAD_LB : to read LB data in LFIFM file
!!
!! IMPLICIT ARGUMENTS
!! ------------------
!! Module MODD_CONF : NVERB
!!
!! REFERENCE
!! ---------
!! Book2 of the documentation (routine INI_LB)
!!
!!
!! AUTHOR
!! ------
!! V. Ducrocq * Meteo France *
!! D. Gazen L.A.
!!
!! MODIFICATIONS
!! -------------
!! Original 22/09/98 FMREAD_LB handle LBs fields
!! J. Stein 18/09/99 problem with the dry case
!! D. Gazen 22/01/01 treat NSV_* with floating indices
!! F Gheusi 29/10/03 bug in LB sources for NSV
!! J.-P. Pinty 06/05/04 treat NSV_* for C1R3 and ELEC
!! 20/05/06 Remove KEPS
!! C.Lac 20/03/08 Add passive pollutants
!! M.Leriche 16/07/10 Add ice phase chemical species
!! Pialat/tulet 15/02/12 Add ForeFire scalars
!! J.Escobar : 15/09/2015 : WENO5 & JPHEXT <> 1
!! M.Leriche 09/02/16 Treat gas and aq. chemicals separately
!! J.Escobar : 27/04/2016 : bug , test only on ANY(HGETSVM({{1:KSV}})=='READ'
!! M.Leriche 09/02/16 Treat gas and aq. chemicals separately
!-------------------------------------------------------------------------------
!
!* 0. DECLARATIONS
!
USE MODD_NSV
USE MODD_CONF
USE MODD_CTURB
USE MODD_DUST

WAUTELET Philippe
committed
USE MODD_IO_ll, ONLY: TFILEDATA
USE MODD_SALT
USE MODD_CH_AEROSOL
USE MODE_FIELD, ONLY: TFIELDDATA,TYPELOG,TYPEREAL

WAUTELET Philippe
committed
USE MODE_IO_ll, ONLY: CLOSE_ll
!
USE MODD_RAIN_C2R2_DESCR, ONLY: C2R2NAMES
USE MODD_ICE_C1R3_DESCR, ONLY: C1R3NAMES
USE MODD_CH_M9_n, ONLY: CNAMES, CICNAMES
USE MODD_LG, ONLY: CLGNAMES
USE MODD_ELEC_DESCR, ONLY: CELECNAMES
USE MODD_PARAMETERS, ONLY: JPHEXT
USE MODD_PARAM_LIMA_WARM, ONLY: CLIMA_WARM_NAMES
USE MODD_PARAM_LIMA_COLD, ONLY: CLIMA_COLD_NAMES
IMPLICIT NONE
!
!* 0.1 declarations of arguments
!
!
!

WAUTELET Philippe
committed
TYPE(TFILEDATA), INTENT(IN) :: TPINIFILE ! Initial file
CHARACTER (LEN=*), INTENT(IN) :: HLUOUT ! name for output-listing of nested models
LOGICAL, INTENT(IN) :: OLSOURCE ! switch for the source term
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
! Larger Scale fields (source if OLSOURCE=T, fields at time t-dt if OLSOURCE=F) :
INTEGER, INTENT(IN) :: KSV ! number of passive variables
! sizes of the West-east total LB area
INTEGER, INTENT(IN) :: KSIZELBX_ll,KSIZELBXU_ll ! for T,V,W and u
INTEGER, INTENT(IN) :: KSIZELBXTKE_ll ! for TKE
INTEGER, INTENT(IN) :: KSIZELBXR_ll,KSIZELBXSV_ll ! for Rx and SV
! sizes of the North-south total LB area
INTEGER, INTENT(IN) :: KSIZELBY_ll,KSIZELBYV_ll ! for T,U,W and v
INTEGER, INTENT(IN) :: KSIZELBYTKE_ll ! for TKE
INTEGER, INTENT(IN) :: KSIZELBYR_ll,KSIZELBYSV_ll ! for Rx and SV
! Get indicators
CHARACTER (LEN=*), INTENT(IN) :: HGETTKEM, &
HGETRVM,HGETRCM,HGETRRM, &
HGETRIM,HGETRSM,HGETRGM,HGETRHM
CHARACTER (LEN=*), DIMENSION(:),INTENT(IN) :: HGETSVM
! LB fields (source if OLSOURCE=T, fields at time t-dt if OLSOURCE=F) :
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBXUM,PLBXVM,PLBXWM ! Wind
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBXTHM ! Mass
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBYUM,PLBYVM,PLBYWM ! Wind
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBYTHM ! Mass
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBXTKEM ! TKE
REAL, DIMENSION(:,:,:), INTENT(OUT) :: PLBYTKEM !
REAL, DIMENSION(:,:,:,:), INTENT(OUT) :: PLBXRM ,PLBXSVM ! Moisture and SV
REAL, DIMENSION(:,:,:,:), INTENT(OUT) :: PLBYRM ,PLBYSVM ! in x and y-dir.
! LB arrays at time t-dt (if OLSOURCE=T) :
REAL, DIMENSION(:,:,:), INTENT(IN), OPTIONAL :: PLBXUMM,PLBXVMM,PLBXWMM ! Wind
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBXTHMM ! Mass
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBYUMM,PLBYVMM,PLBYWMM ! Wind
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBYTHMM ! Mass
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBXTKEMM ! TKE
REAL, DIMENSION(:,:,:),INTENT(IN), OPTIONAL :: PLBYTKEMM
REAL, DIMENSION(:,:,:,:),INTENT(IN), OPTIONAL :: PLBXRMM ,PLBXSVMM ! Moisture and SV
REAL, DIMENSION(:,:,:,:),INTENT(IN), OPTIONAL :: PLBYRMM ,PLBYSVMM ! in x and y-dir.
REAL, INTENT(IN), OPTIONAL :: PLENG ! Interpolation length
!
!
!* 0.2 declarations of local variables
!
INTEGER :: ILBSIZEX,ILBSIZEY ! depth of the LB area in the RIM direction
! written in FM file
INTEGER :: IL3DX,IL3DY ! Size of the LB arrays in FM file
! in the RIM direction
INTEGER :: IL3DXU,IL3DYV ! Size of the LB arrays in FM file
! in the RIM direction for the normal wind
INTEGER :: IRIMX,IRIMY ! Total size of the LB area (for the RIM direction)
INTEGER :: IRIMXU,IRIMYV ! Total size of the LB area (for the RIM direction)
! for the normal wind (spatial gradient needed)
INTEGER :: JSV,JRR ! Loop index for MOIST AND
! additional scalar variables
INTEGER :: IRR ! counter for moist variables
INTEGER :: IGRID,ILENCH,IRESP ! File
CHARACTER (LEN=16) :: YRECFM ! management
CHARACTER (LEN=100) :: YCOMMENT ! variables
CHARACTER (LEN=2) :: YDIR
CHARACTER (LEN=4) :: YDIRLB
INTEGER :: ILUOUT ! Logical unit number associated with HLUOUT
LOGICAL :: GHORELAX_UVWTH ! switch for the horizontal relaxation for U,V,W,TH in the FM file
LOGICAL :: GHORELAX_TKE ! switch for the horizontal relaxation for tke in the FM file
LOGICAL :: GHORELAX_R, GHORELAX_SV ! switch for the horizontal relaxation
! for moist and scalar variables
CHARACTER (LEN= LEN(HGETRVM)), DIMENSION (7) :: YGETRXM ! Arrays with the get indicators
! for the moist variables
CHARACTER (LEN=1), DIMENSION (7) :: YC ! array with the prefix of the moist variables
CHARACTER(LEN=2) :: INDICE ! to index CCN and IFN fields of LIMA scheme
TYPE(TFIELDDATA) :: TZFIELD
!-------------------------------------------------------------------------------
!
!
!* 0. READ CPL_AROME to know which LB_fileds there are to read
! --------------------

WAUTELET Philippe
committed
CALL IO_READ_FIELD(TPINIFILE,'MASDEV',IMASDEV)

WAUTELET Philippe
committed
CALL IO_READ_FIELD(TPINIFILE,'CPL_AROME',LCPL_AROME)
ELSE
LCPL_AROME=.FALSE.
ENDIF
!
!
!* 1. SOME INITIALIZATIONS
! --------------------
!
CALL FMLOOK_ll(HLUOUT,HLUOUT,ILUOUT,IRESP)
!
!
!-------------------------------------------------------------------------------
!
!* 2. READ 2D "surfacic" LB fields
! ----------------------------
!
!* 2.1 read the number of available points for the horizontal relaxation
! for basic variables

WAUTELET Philippe
committed
CALL IO_READ_FIELD(TPINIFILE,'RIMX',ILBSIZEX)
CALL IO_READ_FIELD(TPINIFILE,'RIMY',ILBSIZEY)

WAUTELET Philippe
committed
CALL IO_READ_FIELD(TPINIFILE,'HORELAX_UVWTH',GHORELAX_UVWTH)
IRIMX =(KSIZELBX_ll-2*JPHEXT)/2
IRIMXU=(KSIZELBXU_ll-2*JPHEXT)/2
IRIMY =(KSIZELBY_ll-2*JPHEXT)/2
IRIMYV=(KSIZELBYV_ll-2*JPHEXT)/2
IL3DX=2*ILBSIZEX+2*JPHEXT
IL3DY=2*ILBSIZEY+2*JPHEXT
IL3DYV=IL3DY
ELSE
IRIMX=0
IRIMXU=1
IRIMY=0
IRIMYV=1
IL3DX=2*JPHEXT ! 2
IL3DY=2*JPHEXT ! 2
IL3DXU=2 + 2*JPHEXT ! 4
IL3DYV=2 + 2*JPHEXT ! 4
ENDIF
!
IF (KSIZELBXU_ll/= 0) THEN
CALL IO_READ_FIELD_LB(TPINIFILE,'LBXUM',IL3DXU,IRIMXU,PLBXUM)
END IF
IF ( KSIZELBX_ll /= 0) THEN
CALL IO_READ_FIELD_LB(TPINIFILE,'LBXVM',IL3DX,IRIMX,PLBXVM)
IF ( KSIZELBX_ll /= 0) THEN
CALL IO_READ_FIELD_LB(TPINIFILE,'LBXWM',IL3DX,IRIMX,PLBXWM)
IF ( KSIZELBY_ll /= 0) THEN
CALL IO_READ_FIELD_LB(TPINIFILE,'LBYUM',IL3DY,IRIMY,PLBYUM)
END IF
IF ( KSIZELBYV_ll /= 0) THEN
CALL IO_READ_FIELD_LB(TPINIFILE,'LBYVM',IL3DYV,IRIMYV,PLBYVM)
END IF
IF (KSIZELBY_ll /= 0) THEN
CALL IO_READ_FIELD_LB(TPINIFILE,'LBYWM',IL3DY,IRIMY,PLBYWM)
END IF
IF (KSIZELBX_ll /= 0) THEN
CALL IO_READ_FIELD_LB(TPINIFILE,'LBXTHM',IL3DX,IRIMX,PLBXTHM)
END IF
IF ( KSIZELBY_ll /= 0) THEN
CALL IO_READ_FIELD_LB(TPINIFILE,'LBYTHM',IL3DY,IRIMY,PLBYTHM)
END IF
!
!* 2.3 LB-TKE
!
SELECT CASE(HGETTKEM)
CASE('READ')
IF (.NOT. LCPL_AROME .AND. OLSOURCE) THEN
IF (PRESENT(PLBXTKEMM).AND.PRESENT(PLBYTKEMM)) THEN
WRITE ( ILUOUT,*) 'LBXTKES AND LBYTKES WILL BE INITIALIZED TO 0'
PLBXTKEM(:,:,:) = PLBXTKEMM(:,:,:)
PLBYTKEM(:,:,:) = PLBYTKEMM(:,:,:)
ELSE
WRITE ( ILUOUT,*) 'PB TO INITIALIZE LBXTKES AND LBYTKES '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
ELSE
YRECFM = 'HORELAX_TKE'
YDIR='--'

WAUTELET Philippe
committed
CALL FMREAD(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIR,GHORELAX_TKE,IGRID,ILENCH,YCOMMENT,IRESP)
IRIMX=(KSIZELBXTKE_ll-2*JPHEXT)/2
IRIMY=(KSIZELBYTKE_ll-2*JPHEXT)/2
IL3DX=2*ILBSIZEX+2*JPHEXT
IL3DY=2*ILBSIZEY+2*JPHEXT
IL3DX=2*JPHEXT ! 2
IL3DY=2*JPHEXT ! 2
ENDIF
!
YRECFM='LBXTKEM'
IF (KSIZELBXTKE_ll /= 0) THEN
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXTKEM,IRIMX,IL3DX,IGRID,&
& ILENCH,YCOMMENT,IRESP)
END IF
!
YRECFM='LBYTKEM'
IF (KSIZELBYTKE_ll /= 0) THEN
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYTKEM,IRIMY,IL3DY,IGRID,&
& ILENCH,YCOMMENT,IRESP)
END IF
ENDIF
CASE('INIT')
IF (SIZE(PLBXTKEM,1) /= 0) PLBXTKEM(:,:,:) = XTKEMIN
IF (SIZE(PLBYTKEM,1) /= 0) PLBYTKEM(:,:,:) = XTKEMIN
END SELECT
!
!
!* 2.5 LB-Rx
!
IF(KSIZELBXR_ll > 0 ) THEN
TZFIELD%CMNHNAME = 'HORELAX_R'
TZFIELD%CSTDNAME = ''
TZFIELD%CLONGNAME = 'MesoNH: HORELAX_R'
TZFIELD%CUNITS = ''
TZFIELD%CDIR = '--'
TZFIELD%CCOMMENT = 'Switch to activate the HOrizontal RELAXation'
TZFIELD%CLBTYPE = 'NONE'
TZFIELD%NGRID = 1
TZFIELD%NTYPE = TYPELOG
TZFIELD%NDIMS = 0
!
CALL IO_READ_FIELD(TPINIFILE,TZFIELD,GHORELAX_R)
!
YGETRXM(:)=(/HGETRVM,HGETRCM,HGETRRM,HGETRIM,HGETRSM,HGETRGM,HGETRHM/)
YC(:)=(/"V","C","R","I","S","G","H"/)
IRIMX=(KSIZELBXR_ll-2*JPHEXT)/2
IRIMY= (KSIZELBYR_ll-2*JPHEXT)/2
IL3DX=2*ILBSIZEX+2*JPHEXT
IL3DY=2*ILBSIZEY+2*JPHEXT
IL3DX=2*JPHEXT ! 2
IL3DY=2*JPHEXT ! 2
!
TZFIELD%CSTDNAME = ''
TZFIELD%CUNITS = 'kg kg-1'
TZFIELD%CDIR = 'XY'
TZFIELD%NGRID = 1
TZFIELD%NTYPE = TYPEREAL
TZFIELD%NDIMS = 3
!
SELECT CASE(YGETRXM(1))
CASE('READ')
IRR=IRR+1
IF ( KSIZELBXR_ll /= 0 ) THEN
TZFIELD%CMNHNAME = 'LBXR'//YC(JRR)//'M'
TZFIELD%CLONGNAME = 'MesoNH: LBXR'//YC(JRR)//'M'
TZFIELD%CLBTYPE = 'LBX'
TZFIELD%CCOMMENT = '2_Y_Z_LBXR'//YC(JRR)//'M'
CALL IO_READ_FIELD_LB(TPINIFILE,TZFIELD,IL3DX,IRIMX,PLBXRM(:,:,:,IRR))
END IF
!
IF ( KSIZELBYR_ll /= 0 ) THEN
TZFIELD%CMNHNAME = 'LBYR'//YC(JRR)//'M'
TZFIELD%CLONGNAME = 'MesoNH: LBYR'//YC(JRR)//'M'
TZFIELD%CLBTYPE = 'LBY'
TZFIELD%CCOMMENT = '2_Y_Z_LBYR'//YC(JRR)//'M'
CALL IO_READ_FIELD_LB(TPINIFILE,TZFIELD,IL3DY,IRIMY,PLBYRM(:,:,:,IRR))
END IF
CASE('INIT')
IRR=IRR+1
IF ( SIZE(PLBXRM,1) /= 0 ) PLBXRM(:,:,:,IRR) = 0.
IF ( SIZE(PLBYRM,1) /= 0 ) PLBYRM(:,:,:,IRR) = 0.
END SELECT
!
!
DO JRR=2,7
SELECT CASE(YGETRXM(JRR))
CASE('READ')
IRR=IRR+1
IF ( KSIZELBXR_ll /= 0 ) THEN
IF (.NOT. LCPL_AROME .AND. OLSOURCE) THEN
IF (PRESENT(PLBXRMM)) THEN
PLBXRM(:,:,:,IRR)=PLBXRMM(:,:,:,IRR)
WRITE(ILUOUT,*) 'PLBXRS will be initialized to 0 for LBXR'//YC(JRR)//'M'
WRITE(ILUOUT,*) 'Pb to initialize PLBXRM for LBXR'//YC(JRR)//'M'
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
ELSE
TZFIELD%CMNHNAME = 'LBXR'//YC(JRR)//'M'
TZFIELD%CLONGNAME = 'MesoNH: LBXR'//YC(JRR)//'M'
TZFIELD%CLBTYPE = 'LBX'
TZFIELD%CCOMMENT = '2_Y_Z_LBXR'//YC(JRR)//'M'
CALL IO_READ_FIELD_LB(TPINIFILE,TZFIELD,IL3DX,IRIMX,PLBXRM(:,:,:,IRR))
ENDIF
END IF
!
IF ( KSIZELBYR_ll /= 0 ) THEN
IF (.NOT. LCPL_AROME .AND. OLSOURCE) THEN
IF (PRESENT(PLBYRMM)) THEN
PLBYRM(:,:,:,IRR)=PLBYRMM(:,:,:,IRR)
WRITE(ILUOUT,*) 'PLBYRS will be initialized to 0 for LBYR'//YC(JRR)//'M'
WRITE(ILUOUT,*) 'Pb to initialize PLBYRM for LBYR'//YC(JRR)//'M'
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
ELSE
TZFIELD%CMNHNAME = 'LBYR'//YC(JRR)//'M'
TZFIELD%CLONGNAME = 'MesoNH: LBYR'//YC(JRR)//'M'
TZFIELD%CLBTYPE = 'LBY'
TZFIELD%CCOMMENT = '2_Y_Z_LBYR'//YC(JRR)//'M'
CALL IO_READ_FIELD_LB(TPINIFILE,TZFIELD,IL3DY,IRIMY,PLBYRM(:,:,:,IRR))
ENDIF
END IF
CASE('INIT')
IRR=IRR+1
IF ( SIZE(PLBXRM,1) /= 0 ) PLBXRM(:,:,:,IRR) = 0.
IF ( SIZE(PLBYRM,1) /= 0 ) PLBYRM(:,:,:,IRR) = 0.
END SELECT
END DO
END IF
!
!* 2.6 LB-Scalar Variables
!
IF (KSV > 0) THEN
IF (ANY(HGETSVM(1:KSV)=='READ')) THEN
YRECFM = 'HORELAX_SV'
YDIR='--'

WAUTELET Philippe
committed
CALL FMREAD(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIR,GHORELAX_SV,IGRID,ILENCH,YCOMMENT,IRESP)
IRIMX=(KSIZELBXSV_ll-2*JPHEXT)/2
IRIMY=(KSIZELBYSV_ll-2*JPHEXT)/2
IL3DX=2*ILBSIZEX+2*JPHEXT
IL3DY=2*ILBSIZEY+2*JPHEXT
IL3DX=2*JPHEXT !2
IL3DY=2*JPHEXT !2
END IF
END IF
END IF
! User scalar variables
DO JSV = 1, NSV_USER
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
IF ( KSIZELBXSV_ll /= 0 ) THEN
WRITE(YRECFM,'(A6,I3.3)')'LBXSVM',JSV
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'PLXYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialze PLBXSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
WRITE(YRECFM,'(A6,I3.3)')'LBYSVM',JSV
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN
PLBYSVM(:,:,:,JSV)=PLBYSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'PLBYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialze PLBYSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
CASE('INIT')
IF ( SIZE(PLBXSVM,1) /= 0 ) PLBXSVM(:,:,:,JSV) = 0.
IF ( SIZE(PLBYSVM,1) /= 0 ) PLBYSVM(:,:,:,JSV) = 0.
END SELECT
END DO
! C2R2 scalar variables
DO JSV = NSV_C2R2BEG, NSV_C2R2END
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
IF ( KSIZELBXSV_ll /= 0 ) THEN
YRECFM='LBX_'//TRIM(C2R2NAMES(JSV-NSV_C2R2BEG+1))
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'C2R2 PLBXSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize C2R2 PLBXSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
YRECFM='LBY_'//TRIM(C2R2NAMES(JSV-NSV_C2R2BEG+1))
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN
PLBYSVM(:,:,:,JSV)=PLBYSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'C2R2 PLBYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize C2R2 PLBYSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
CASE('INIT')
IF ( SIZE(PLBXSVM,1) /= 0 ) PLBXSVM(:,:,:,JSV) = 0.
IF ( SIZE(PLBYSVM,1) /= 0 ) PLBYSVM(:,:,:,JSV) = 0.
END SELECT
END DO
! C1R3 scalar variables
DO JSV = NSV_C1R3BEG, NSV_C1R3END
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
IF ( KSIZELBXSV_ll /= 0 ) THEN
YRECFM='LBX_'//TRIM(C1R3NAMES(JSV-NSV_C1R3BEG+1))
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'C1R3 PLBXSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize C1R3 PLBXSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
YRECFM='LBY_'//TRIM(C1R3NAMES(JSV-NSV_C1R3BEG+1))
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN
PLBYSVM(:,:,:,JSV)=PLBYSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'C1R3 PLBYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize C1R3 PLBYSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
CASE('INIT')
IF ( SIZE(PLBXSVM,1) /= 0 ) PLBXSVM(:,:,:,JSV) = 0.
IF ( SIZE(PLBYSVM,1) /= 0 ) PLBYSVM(:,:,:,JSV) = 0.
END SELECT
END DO
!
! LIMA: CCN and IFN scalar variables
!
IF (CCLOUD=='LIMA' ) THEN
DO JSV = NSV_LIMA_CCN_FREE,NSV_LIMA_CCN_FREE+NMOD_CCN-1
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
WRITE(INDICE,'(I2.2)')(JSV - NSV_LIMA_CCN_FREE + 1)
IF ( KSIZELBXSV_ll /= 0 ) THEN
YRECFM = 'LBX_'//TRIM(UPCASE(CLIMA_WARM_NAMES(3))//INDICE)
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'CCN PLBXSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize CCN PLBXSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
YRECFM = 'LBY_'//TRIM(UPCASE(CLIMA_WARM_NAMES(3))//INDICE)
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN
PLBYSVM(:,:,:,JSV)=PLBYSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'CCN PLBYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize CCN PLBYSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
CASE('INIT')
IF ( SIZE(PLBXSVM,1) /= 0 ) PLBXSVM(:,:,:,JSV) = 0.
IF ( SIZE(PLBYSVM,1) /= 0 ) PLBYSVM(:,:,:,JSV) = 0.
END SELECT
END DO
DO JSV = NSV_LIMA_IFN_FREE,NSV_LIMA_IFN_FREE+NMOD_IFN-1
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
WRITE(INDICE,'(I2.2)')(JSV - NSV_LIMA_IFN_FREE + 1)
IF ( KSIZELBXSV_ll /= 0 ) THEN
YRECFM = 'LBX_'//TRIM(UPCASE(CLIMA_COLD_NAMES(2))//INDICE)
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'IFN PLBXSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize IFN'
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
YRECFM = 'LBY_'//TRIM(UPCASE(CLIMA_COLD_NAMES(2))//INDICE)
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN
PLBYSVM(:,:,:,JSV)=PLBYSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'IFN PLBYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize IFN'
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
CASE('INIT')
IF ( SIZE(PLBXSVM,1) /= 0 ) PLBXSVM(:,:,:,JSV) = 0.
IF ( SIZE(PLBYSVM,1) /= 0 ) PLBYSVM(:,:,:,JSV) = 0.
END SELECT
END DO
ENDIF
! ELEC scalar variables
DO JSV = NSV_ELECBEG, NSV_ELECEND
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
IF ( KSIZELBXSV_ll /= 0 ) THEN
YRECFM='LBX_'//TRIM(CELECNAMES(JSV-NSV_ELECBEG+1))
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'ELEC PLBXSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize ELEC PLBXSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
YRECFM='LBY_'//TRIM(CELECNAMES(JSV-NSV_ELECBEG+1))
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN
PLBYSVM(:,:,:,JSV)=PLBYSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'ELEC PLBYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize ELEC PLBYSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
CASE('INIT')
IF ( SIZE(PLBXSVM,1) /= 0 ) PLBXSVM(:,:,:,JSV) = 0.
IF ( SIZE(PLBYSVM,1) /= 0 ) PLBYSVM(:,:,:,JSV) = 0.
END SELECT
END DO
! Chemical gas phase scalar variables
DO JSV = NSV_CHGSBEG, NSV_CHGSEND
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
IF ( KSIZELBXSV_ll /= 0 ) THEN
YRECFM = 'LBX_'//TRIM(UPCASE(CNAMES(JSV-NSV_CHGSBEG+1)))

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'Chemical PLBXSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize gas phase Chemical PLBXSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
YRECFM = 'LBY_'//TRIM(UPCASE(CNAMES(JSV-NSV_CHGSBEG+1)))

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN
PLBYSVM(:,:,:,JSV)=PLBYSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'Chemical PLBYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize gas phase Chemical PLBYSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
CASE('INIT')
IF ( SIZE(PLBXSVM,1) /= 0 ) PLBXSVM(:,:,:,JSV) = 0.
IF ( SIZE(PLBYSVM,1) /= 0 ) PLBYSVM(:,:,:,JSV) = 0.
END SELECT
END DO
! Chemical aqueous phase scalar variables
DO JSV = NSV_CHACBEG, NSV_CHACEND
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
IF ( KSIZELBXSV_ll /= 0 ) THEN
YRECFM = 'LBX_'//TRIM(UPCASE(CNAMES(JSV-NSV_CHACBEG+NSV_CHGS+1)))
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'Chemical PLBXSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize aqueous phase chemical PLBXSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
YRECFM = 'LBY_'//TRIM(UPCASE(CNAMES(JSV-NSV_CHACBEG+NSV_CHGS+1)))
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN
PLBYSVM(:,:,:,JSV)=PLBYSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'Chemical PLBYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize aqueous phase chemical PLBYSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
CASE('INIT')
IF ( SIZE(PLBXSVM,1) /= 0 ) PLBXSVM(:,:,:,JSV) = 0.
IF ( SIZE(PLBYSVM,1) /= 0 ) PLBYSVM(:,:,:,JSV) = 0.
END SELECT
END DO
! Chemical ice phase scalar variables
DO JSV = NSV_CHICBEG, NSV_CHICEND
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
IF ( KSIZELBXSV_ll /= 0 ) THEN
YRECFM = 'LBX_'//TRIM(UPCASE(CICNAMES(JSV-NSV_CHICBEG+1)))
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'Ice phase chemical PLBXSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize ice phase chemical PLBXSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
YRECFM = 'LBY_'//TRIM(UPCASE(CICNAMES(JSV-NSV_CHICBEG+1)))
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN
PLBYSVM(:,:,:,JSV)=PLBYSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'Ice phase chemical PLBYSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize Ice phase chemical PLBYSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
CASE('INIT')
IF ( SIZE(PLBXSVM,1) /= 0 ) PLBXSVM(:,:,:,JSV) = 0.
IF ( SIZE(PLBYSVM,1) /= 0 ) PLBYSVM(:,:,:,JSV) = 0.
END SELECT
END DO
! Orilam aerosol scalar variables
DO JSV = NSV_AERBEG, NSV_AEREND
SELECT CASE(HGETSVM(JSV))
CASE ('READ')
IF ( KSIZELBXSV_ll /= 0 ) THEN
YRECFM = 'LBX_'//TRIM(UPCASE(CAERONAMES(JSV-NSV_AERBEG+1)))
YDIRLB='LBX'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBXSVM(:,:,:,JSV),IRIMX,IL3DX,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBXSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBXSVMM)) THEN
PLBXSVM(:,:,:,JSV)=PLBXSVMM(:,:,:,JSV)
WRITE(ILUOUT,*) 'Aerosol PLBXSVM will be initialized to 0'
ELSE
WRITE(ILUOUT,*) 'Pb to initialize Aerosol PLBXSVM '
!callabortstop
CALL CLOSE_ll(HLUOUT,IOSTAT=IRESP)
CALL ABORT
STOP
ENDIF
END IF
END IF
END IF
!
IF (KSIZELBYSV_ll /= 0 ) THEN
YRECFM = 'LBY_'//TRIM(UPCASE(CAERONAMES(JSV-NSV_AERBEG+1)))
YDIRLB='LBY'

WAUTELET Philippe
committed
CALL FMREAD_LB(TPINIFILE%CNAME,YRECFM,HLUOUT,YDIRLB,PLBYSVM(:,:,:,JSV),IRIMY,IL3DY,&
& IGRID,ILENCH,YCOMMENT,IRESP)
IF ( SIZE(PLBYSVM,1) /= 0 ) THEN
IF (IRESP/=0) THEN
IF (PRESENT(PLBYSVMM)) THEN