source: LMDZ4/trunk/libf/phylmd/phys_output_mod.F90 @ 1334

Last change on this file since 1334 was 1334, checked in by idelkadi, 14 years ago
  • Rajout de champs de sorties
  • Correction dans la partie convection (nouvelle physique)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 74.3 KB
Line 
1! $Id: phys_output_mod.F90 1334 2010-03-31 12:54:07Z idelkadi $
2!
3! Abderrahmane 12 2007
4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5!!! Ecreture des Sorties du modele dans les fichiers Netcdf :
6! histmth.nc : moyennes mensuelles
7! histday.nc : moyennes journalieres
8! histhf.nc  : moyennes toutes les 3 heures
9! histins.nc : valeurs instantanees
10!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11
12MODULE phys_output_mod
13
14  IMPLICIT NONE
15
16  private histdef2d, histdef3d, conf_physoutputs
17
18
19   integer, parameter                           :: nfiles = 5
20   logical, dimension(nfiles), save             :: clef_files
21   integer, dimension(nfiles), save             :: lev_files
22   integer, dimension(nfiles), save             :: nid_files
23!!$OMP THREADPRIVATE(clef_files, lev_files,nid_files)
24 
25   integer, dimension(nfiles), private, save :: nhorim, nvertm
26   integer, dimension(nfiles), private, save :: nvertap, nvertbp, nvertAlt
27!   integer, dimension(nfiles), private, save :: nvertp0
28   real, dimension(nfiles), private, save                :: zoutm
29   real,                    private, save                :: zdtime
30   CHARACTER(len=20), dimension(nfiles), private, save   :: type_ecri
31!$OMP THREADPRIVATE(nhorim, nvertm, zoutm,zdtime,type_ecri)
32
33!   integer, save                     :: nid_hf3d
34
35!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
36!! Definition pour chaque variable du niveau d ecriture dans chaque fichier
37!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!/ histmth, histday, histhf, histins /),'!!!!!!!!!!!!
38!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
39
40  integer, private:: levmin(nfiles) = 1
41  integer, private:: levmax(nfiles)
42
43  TYPE ctrl_out
44   integer,dimension(5) :: flag
45   character(len=20)     :: name
46  END TYPE ctrl_out
47
48!!! Comosentes de la coordonnee sigma-hybride
49!!! Ap et Bp
50  type(ctrl_out),save :: o_Ahyb         = ctrl_out((/ 1, 1, 1, 1, 1 /), 'Ap')
51  type(ctrl_out),save :: o_Bhyb         = ctrl_out((/ 1, 1, 1, 1, 1 /), 'Bp')
52  type(ctrl_out),save :: o_Alt          = ctrl_out((/ 1, 1, 1, 1, 1 /), 'Alt')
53
54!!! 1D
55  type(ctrl_out),save :: o_phis         = ctrl_out((/ 1, 1, 10, 5, 1 /), 'phis')
56  type(ctrl_out),save :: o_aire         = ctrl_out((/ 1, 1, 10,  10, 1 /),'aire')
57  type(ctrl_out),save :: o_contfracATM  = ctrl_out((/ 10, 1,  1, 10, 10 /),'contfracATM')
58  type(ctrl_out),save :: o_contfracOR   = ctrl_out((/ 10, 1,  1, 10, 10 /),'contfracOR')
59  type(ctrl_out),save :: o_aireTER      = ctrl_out((/ 10, 10, 1, 10, 10 /),'aireTER')
60 
61!!! 2D
62  type(ctrl_out),save :: o_flat         = ctrl_out((/ 5, 1, 10, 5, 1 /),'flat')
63  type(ctrl_out),save :: o_slp          = ctrl_out((/ 1, 1, 1, 10, 1 /),'slp')
64  type(ctrl_out),save :: o_tsol         = ctrl_out((/ 1, 1, 1, 5, 1 /),'tsol')
65  type(ctrl_out),save :: o_t2m          = ctrl_out((/ 1, 1, 1, 5, 1 /),'t2m')
66  type(ctrl_out),save :: o_t2m_min      = ctrl_out((/ 1, 1, 10, 10, 10 /),'t2m_min')
67  type(ctrl_out),save :: o_t2m_max      = ctrl_out((/ 1, 1, 10, 10, 10 /),'t2m_max')
68  type(ctrl_out),save,dimension(4) :: o_t2m_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_ter'), &
69                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_lic'), &
70                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_oce'), &
71                                                 ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_sic') /)
72
73  type(ctrl_out),save :: o_wind10m      = ctrl_out((/ 1, 1, 1, 10, 10 /),'wind10m')
74  type(ctrl_out),save :: o_wind10max    = ctrl_out((/ 10, 1, 10, 10, 10 /),'wind10max')
75  type(ctrl_out),save :: o_sicf         = ctrl_out((/ 1, 1, 10, 10, 10 /),'sicf')
76  type(ctrl_out),save :: o_q2m          = ctrl_out((/ 1, 1, 1, 5, 1 /),'q2m')
77  type(ctrl_out),save :: o_u10m         = ctrl_out((/ 1, 1, 1, 5, 1 /),'u10m')
78  type(ctrl_out),save :: o_v10m         = ctrl_out((/ 1, 1, 1, 5, 1 /),'v10m')
79  type(ctrl_out),save :: o_psol         = ctrl_out((/ 1, 1, 1, 5, 1 /),'psol')
80  type(ctrl_out),save :: o_qsurf        = ctrl_out((/ 1, 10, 10, 10, 10 /),'qsurf')
81
82  type(ctrl_out),save,dimension(4) :: o_u10m_srf     = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_ter'), &
83                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_lic'), &
84                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_oce'), &
85                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_sic') /)
86
87  type(ctrl_out),save,dimension(4) :: o_v10m_srf     = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_ter'), &
88                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_lic'), &
89                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_oce'), &
90                                              ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_sic') /)
91
92  type(ctrl_out),save :: o_qsol         = ctrl_out((/ 1, 10, 10, 10, 10 /),'qsol')
93
94  type(ctrl_out),save :: o_ndayrain     = ctrl_out((/ 1, 10, 10, 10, 10 /),'ndayrain')
95  type(ctrl_out),save :: o_precip       = ctrl_out((/ 1, 1, 1, 5, 10 /),'precip')
96  type(ctrl_out),save :: o_plul         = ctrl_out((/ 1, 1, 1, 10, 10 /),'plul')
97
98  type(ctrl_out),save :: o_pluc         = ctrl_out((/ 1, 1, 1, 5, 10 /),'pluc')
99  type(ctrl_out),save :: o_snow         = ctrl_out((/ 1, 1, 10, 5, 10 /),'snow')
100  type(ctrl_out),save :: o_evap         = ctrl_out((/ 1, 1, 10, 10, 10 /),'evap')
101  type(ctrl_out),save,dimension(4) :: o_evap_srf     = (/ ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_ter'), &
102                                           ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_lic'), &
103                                           ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_oce'), &
104                                           ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_sic') /)
105  type(ctrl_out),save :: o_msnow       = ctrl_out((/ 1, 10, 10, 10, 10 /),'msnow')
106  type(ctrl_out),save :: o_fsnow       = ctrl_out((/ 1, 10, 10, 10, 10 /),'fsnow')
107
108  type(ctrl_out),save :: o_tops         = ctrl_out((/ 1, 1, 10, 10, 10 /),'tops')
109  type(ctrl_out),save :: o_tops0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'tops0')
110  type(ctrl_out),save :: o_topl         = ctrl_out((/ 1, 1, 10, 5, 10 /),'topl')
111  type(ctrl_out),save :: o_topl0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'topl0')
112  type(ctrl_out),save :: o_SWupTOA      = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWupTOA')
113  type(ctrl_out),save :: o_SWupTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWupTOAclr')
114  type(ctrl_out),save :: o_SWdnTOA      = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWdnTOA')
115  type(ctrl_out),save :: o_SWdnTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWdnTOAclr')
116  type(ctrl_out),save :: o_nettop       = ctrl_out((/ 1, 4, 10, 10, 10 /),'nettop')
117
118  type(ctrl_out),save :: o_SWup200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'SWup200')
119  type(ctrl_out),save :: o_SWup200clr   = ctrl_out((/ 10, 1, 10, 10, 10 /),'SWup200clr')
120  type(ctrl_out),save :: o_SWdn200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'SWdn200')
121  type(ctrl_out),save :: o_SWdn200clr   = ctrl_out((/ 10, 1, 10, 10, 10 /),'SWdn200clr')
122
123! arajouter
124!  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWupTOA')
125!  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWupTOAclr')
126!  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWdnTOA')
127!  type(ctrl_out),save :: o_LWdnTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWdnTOAclr')
128
129  type(ctrl_out),save :: o_LWup200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWup200')
130  type(ctrl_out),save :: o_LWup200clr   = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWup200clr')
131  type(ctrl_out),save :: o_LWdn200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWdn200')
132  type(ctrl_out),save :: o_LWdn200clr   = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWdn200clr')
133  type(ctrl_out),save :: o_sols         = ctrl_out((/ 1, 1, 10, 10, 10 /),'sols')
134  type(ctrl_out),save :: o_sols0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'sols0')
135  type(ctrl_out),save :: o_soll         = ctrl_out((/ 1, 1, 10, 10, 10 /),'soll')
136  type(ctrl_out),save :: o_soll0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'soll0')
137  type(ctrl_out),save :: o_radsol       = ctrl_out((/ 1, 1, 10, 10, 10 /),'radsol')
138  type(ctrl_out),save :: o_SWupSFC      = ctrl_out((/ 1, 4, 10, 5, 10 /),'SWupSFC')
139  type(ctrl_out),save :: o_SWupSFCclr   = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWupSFCclr')
140  type(ctrl_out),save :: o_SWdnSFC      = ctrl_out((/ 1, 1, 10, 5, 10 /),'SWdnSFC')
141  type(ctrl_out),save :: o_SWdnSFCclr   = ctrl_out((/ 1, 4, 10, 5, 10 /),'SWdnSFCclr')
142  type(ctrl_out),save :: o_LWupSFC      = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWupSFC')
143  type(ctrl_out),save :: o_LWupSFCclr   = ctrl_out((/ 1, 4, 10, 5, 10 /),'LWupSFCclr')
144  type(ctrl_out),save :: o_LWdnSFC      = ctrl_out((/ 1, 4, 10, 5, 10 /),'LWdnSFC')
145  type(ctrl_out),save :: o_LWdnSFCclr   = ctrl_out((/ 1, 4, 10, 5, 10 /),'LWdnSFCclr')
146  type(ctrl_out),save :: o_bils         = ctrl_out((/ 1, 2, 10, 5, 10 /),'bils')
147  type(ctrl_out),save :: o_sens         = ctrl_out((/ 1, 1, 10, 5, 10 /),'sens')
148  type(ctrl_out),save :: o_fder         = ctrl_out((/ 1, 2, 10, 10, 10 /),'fder')
149  type(ctrl_out),save :: o_ffonte       = ctrl_out((/ 1, 10, 10, 10, 10 /),'ffonte')
150  type(ctrl_out),save :: o_fqcalving    = ctrl_out((/ 1, 10, 10, 10, 10 /),'fqcalving')
151  type(ctrl_out),save :: o_fqfonte      = ctrl_out((/ 1, 10, 10, 10, 10 /),'fqfonte')
152
153  type(ctrl_out),save :: o_taux         = ctrl_out((/ 1, 10, 10, 10, 10 /),'taux')
154  type(ctrl_out),save :: o_tauy         = ctrl_out((/ 1, 10, 10, 10, 10 /),'tauy')
155  type(ctrl_out),save,dimension(4) :: o_taux_srf     = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_ter'), &
156                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_lic'), &
157                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_oce'), &
158                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_sic') /)
159
160  type(ctrl_out),save,dimension(4) :: o_tauy_srf     = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_ter'), &
161                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_lic'), &
162                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_oce'), &
163                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_sic') /)
164
165
166  type(ctrl_out),save,dimension(4) :: o_pourc_srf    = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_ter'), &
167                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_lic'), &
168                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_oce'), &
169                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_sic') /)     
170
171  type(ctrl_out),save,dimension(4) :: o_fract_srf    = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_ter'), &
172                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_lic'), &
173                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_oce'), &
174                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_sic') /)
175
176  type(ctrl_out),save,dimension(4) :: o_tsol_srf     = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_ter'), &
177                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_lic'), &
178                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_oce'), &
179                                                 ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_sic') /)
180
181  type(ctrl_out),save,dimension(4) :: o_sens_srf     = (/ ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_ter'), &
182                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_lic'), &
183                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_oce'), &
184                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_sic') /)
185
186  type(ctrl_out),save,dimension(4) :: o_lat_srf      = (/ ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_ter'), &
187                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_lic'), &
188                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_oce'), &
189                                                 ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_sic') /)
190
191  type(ctrl_out),save,dimension(4) :: o_flw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_ter'), &
192                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_lic'), &
193                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_oce'), &
194                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_sic') /)
195                                                 
196  type(ctrl_out),save,dimension(4) :: o_fsw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_ter'), &
197                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_lic'), &
198                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_oce'), &
199                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_sic') /)
200
201  type(ctrl_out),save,dimension(4) :: o_wbils_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_ter'), &
202                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_lic'), &
203                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_oce'), &
204                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_sic') /)
205
206  type(ctrl_out),save,dimension(4) :: o_wbilo_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_ter'), &
207                                                     ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_lic'), &
208                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_oce'), &
209                                                 ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_sic') /)
210
211
212  type(ctrl_out),save :: o_cdrm         = ctrl_out((/ 1, 10, 10, 10, 10 /),'cdrm')
213  type(ctrl_out),save :: o_cdrh         = ctrl_out((/ 1, 10, 10, 1, 10 /),'cdrh')
214  type(ctrl_out),save :: o_cldl         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldl')
215  type(ctrl_out),save :: o_cldm         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldm')
216  type(ctrl_out),save :: o_cldh         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldh')
217  type(ctrl_out),save :: o_cldt         = ctrl_out((/ 1, 1, 2, 5, 10 /),'cldt')
218  type(ctrl_out),save :: o_cldq         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldq')
219  type(ctrl_out),save :: o_lwp          = ctrl_out((/ 1, 5, 10, 10, 10 /),'lwp')
220  type(ctrl_out),save :: o_iwp          = ctrl_out((/ 1, 5, 10, 10, 10 /),'iwp')
221  type(ctrl_out),save :: o_ue           = ctrl_out((/ 1, 10, 10, 10, 10 /),'ue')
222  type(ctrl_out),save :: o_ve           = ctrl_out((/ 1, 10, 10, 10, 10 /),'ve')
223  type(ctrl_out),save :: o_uq           = ctrl_out((/ 1, 10, 10, 10, 10 /),'uq')
224  type(ctrl_out),save :: o_vq           = ctrl_out((/ 1, 10, 10, 10, 10 /),'vq')
225 
226  type(ctrl_out),save :: o_cape         = ctrl_out((/ 1, 10, 10, 10, 10 /),'cape')
227  type(ctrl_out),save :: o_pbase        = ctrl_out((/ 1, 5, 10, 10, 10 /),'pbase')
228  type(ctrl_out),save :: o_ptop         = ctrl_out((/ 1, 5, 10, 10, 10 /),'ptop')
229  type(ctrl_out),save :: o_fbase        = ctrl_out((/ 1, 10, 10, 10, 10 /),'fbase')
230  type(ctrl_out),save :: o_prw          = ctrl_out((/ 1, 1, 10, 10, 10 /),'prw')
231
232  type(ctrl_out),save :: o_s_pblh       = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_pblh')
233  type(ctrl_out),save :: o_s_pblt       = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_pblt')
234  type(ctrl_out),save :: o_s_lcl        = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_lcl')
235  type(ctrl_out),save :: o_s_capCL      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_capCL')
236  type(ctrl_out),save :: o_s_oliqCL     = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_oliqCL')
237  type(ctrl_out),save :: o_s_cteiCL     = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_cteiCL')
238  type(ctrl_out),save :: o_s_therm      = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_therm')
239  type(ctrl_out),save :: o_s_trmb1      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_trmb1')
240  type(ctrl_out),save :: o_s_trmb2      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_trmb2')
241  type(ctrl_out),save :: o_s_trmb3      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_trmb3')
242
243  type(ctrl_out),save :: o_slab_bils    = ctrl_out((/ 1, 1, 10, 10, 10 /),'slab_bils_oce')
244
245  type(ctrl_out),save :: o_ale_bl       = ctrl_out((/ 1, 1, 1, 10, 10 /),'ale_bl')
246  type(ctrl_out),save :: o_alp_bl       = ctrl_out((/ 1, 1, 1, 10, 10 /),'alp_bl')
247  type(ctrl_out),save :: o_ale_wk       = ctrl_out((/ 1, 1, 1, 10, 10 /),'ale_wk')
248  type(ctrl_out),save :: o_alp_wk       = ctrl_out((/ 1, 1, 1, 10, 10 /),'alp_wk')
249
250  type(ctrl_out),save :: o_ale          = ctrl_out((/ 1, 1, 1, 10, 10 /),'ale')
251  type(ctrl_out),save :: o_alp          = ctrl_out((/ 1, 1, 1, 10, 10 /),'alp')
252  type(ctrl_out),save :: o_cin          = ctrl_out((/ 1, 1, 1, 10, 10 /),'cin')
253  type(ctrl_out),save :: o_wape         = ctrl_out((/ 1, 1, 1, 10, 10 /),'wape')
254
255
256! Champs interpolles sur des niveaux de pression ??? a faire correctement
257                                             
258  type(ctrl_out),save,dimension(6) :: o_uSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'u850'), &
259                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u700'), &
260                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u500'), &
261                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u200'), &
262                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u50'), &
263                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'u10') /)
264                                                     
265
266  type(ctrl_out),save,dimension(6) :: o_vSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'v850'), &
267                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v700'), &
268                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v500'), &
269                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v200'), &
270                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v50'), &
271                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'v10') /)
272
273  type(ctrl_out),save,dimension(6) :: o_wSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'w850'), &
274                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w700'), &
275                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w500'), &
276                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w200'), &
277                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w50'), &
278                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'w10') /)
279
280  type(ctrl_out),save,dimension(6) :: o_tSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'t850'), &
281                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t700'), &
282                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t500'), &
283                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t200'), &
284                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t50'), &
285                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'t10') /)
286
287  type(ctrl_out),save,dimension(6) :: o_qSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'q850'), &
288                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q700'), &
289                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q500'), &
290                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q200'), &
291                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q50'), &
292                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'q10') /)
293
294  type(ctrl_out),save,dimension(6) :: o_phiSTDlevs   = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'phi850'), &
295                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'phi700'), &
296                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'phi500'), &
297                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'phi200'), &
298                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'phi50'), &
299                                                     ctrl_out((/ 1, 1, 3, 10, 10 /),'phi10') /)
300
301
302  type(ctrl_out),save :: o_t_oce_sic    = ctrl_out((/ 1, 10, 10, 10, 10 /),'t_oce_sic')
303
304  type(ctrl_out),save :: o_weakinv      = ctrl_out((/ 10, 1, 10, 10, 10 /),'weakinv')
305  type(ctrl_out),save :: o_dthmin       = ctrl_out((/ 10, 1, 10, 10, 10 /),'dthmin')
306  type(ctrl_out),save,dimension(4) :: o_u10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_ter'), &
307                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_lic'), &
308                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_oce'), &
309                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_sic') /)
310
311  type(ctrl_out),save,dimension(4) :: o_v10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_ter'), &
312                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_lic'), &
313                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_oce'), &
314                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_sic') /)
315
316  type(ctrl_out),save :: o_cldtau       = ctrl_out((/ 10, 5, 10, 10, 10 /),'cldtau')                     
317  type(ctrl_out),save :: o_cldemi       = ctrl_out((/ 10, 5, 10, 10, 10 /),'cldemi')
318  type(ctrl_out),save :: o_rh2m         = ctrl_out((/ 5, 5, 10, 10, 10 /),'rh2m')
319  type(ctrl_out),save :: o_rh2m_min     = ctrl_out((/ 10, 5, 10, 10, 10 /),'rh2m_min')
320  type(ctrl_out),save :: o_rh2m_max     = ctrl_out((/ 10, 5, 10, 10, 10 /),'rh2m_max')
321  type(ctrl_out),save :: o_qsat2m       = ctrl_out((/ 10, 5, 10, 10, 10 /),'qsat2m')
322  type(ctrl_out),save :: o_tpot         = ctrl_out((/ 10, 5, 10, 10, 10 /),'tpot')
323  type(ctrl_out),save :: o_tpote        = ctrl_out((/ 10, 5, 10, 10, 10 /),'tpote')
324  type(ctrl_out),save :: o_tke          = ctrl_out((/ 4, 10, 10, 10, 10 /),'tke ')
325  type(ctrl_out),save :: o_tke_max      = ctrl_out((/ 4, 10, 10, 10, 10 /),'tke_max')
326
327  type(ctrl_out),save,dimension(4) :: o_tke_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_ter'), &
328                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_lic'), &
329                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_oce'), &
330                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_sic') /)
331
332  type(ctrl_out),save,dimension(4) :: o_tke_max_srf  = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_ter'), &
333                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_lic'), &
334                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_oce'), &
335                                                     ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_sic') /)
336
337  type(ctrl_out),save :: o_kz           = ctrl_out((/ 4, 10, 10, 10, 10 /),'kz')
338  type(ctrl_out),save :: o_kz_max       = ctrl_out((/ 4, 10, 10, 10, 10 /),'kz_max')
339  type(ctrl_out),save :: o_SWnetOR      = ctrl_out((/ 10, 10, 2, 10, 10 /),'SWnetOR')
340  type(ctrl_out),save :: o_SWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10 /),'SWdownOR')
341  type(ctrl_out),save :: o_LWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10 /),'LWdownOR')
342
343  type(ctrl_out),save :: o_snowl        = ctrl_out((/ 10, 1, 10, 10, 10 /),'snowl')
344  type(ctrl_out),save :: o_cape_max     = ctrl_out((/ 10, 1, 10, 10, 10 /),'cape_max')
345  type(ctrl_out),save :: o_solldown     = ctrl_out((/ 10, 1, 10, 10, 10 /),'solldown')
346
347  type(ctrl_out),save :: o_dtsvdfo      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdfo')
348  type(ctrl_out),save :: o_dtsvdft      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdft')
349  type(ctrl_out),save :: o_dtsvdfg      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdfg')
350  type(ctrl_out),save :: o_dtsvdfi      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdfi')
351  type(ctrl_out),save :: o_rugs         = ctrl_out((/ 10, 10, 10, 10, 10 /),'rugs')
352
353  type(ctrl_out),save :: o_topswad      = ctrl_out((/ 2, 10, 10, 10, 10 /),'topswad')
354  type(ctrl_out),save :: o_topswai      = ctrl_out((/ 2, 10, 10, 10, 10 /),'topswai')
355  type(ctrl_out),save :: o_solswad      = ctrl_out((/ 2, 10, 10, 10, 10 /),'solswad')
356  type(ctrl_out),save :: o_solswai      = ctrl_out((/ 2, 10, 10, 10, 10 /),'solswai')
357
358  type(ctrl_out),save,dimension(10) :: o_tausumaero  = (/ ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_ASBCM'), &
359                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_ASPOMM'), &
360                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_ASSO4M'), &
361                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_CSSO4M'), &
362                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_SSSSM'), &
363                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_ASSSM'), &
364                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_CSSSM'), &
365                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_CIDUSTM'), &
366                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_AIBCM'), &
367                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'OD550_AIPOMM') /)
368
369  type(ctrl_out),save :: o_swtoaas_nat      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swtoaas_nat')
370  type(ctrl_out),save :: o_swsrfas_nat      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swsrfas_nat')
371  type(ctrl_out),save :: o_swtoacs_nat      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swtoacs_nat')
372  type(ctrl_out),save :: o_swsrfcs_nat      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swsrfcs_nat')
373
374  type(ctrl_out),save :: o_swtoaas_ant      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swtoaas_ant')
375  type(ctrl_out),save :: o_swsrfas_ant      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swsrfas_ant')
376  type(ctrl_out),save :: o_swtoacs_ant      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swtoacs_ant')
377  type(ctrl_out),save :: o_swsrfcs_ant      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swsrfcs_ant')
378
379  type(ctrl_out),save :: o_swtoacf_nat      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swtoacf_nat')
380  type(ctrl_out),save :: o_swsrfcf_nat      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swsrfcf_nat')
381  type(ctrl_out),save :: o_swtoacf_ant      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swtoacf_ant')
382  type(ctrl_out),save :: o_swsrfcf_ant      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swsrfcf_ant')
383  type(ctrl_out),save :: o_swtoacf_zero      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swtoacf_zero')
384  type(ctrl_out),save :: o_swsrfcf_zero      = ctrl_out((/ 4, 10, 10, 10, 10 /),'swsrfcf_zero')
385
386
387!!!!!!!!!!!!!!!!!!!!!! 3D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
388  type(ctrl_out),save :: o_lwcon        = ctrl_out((/ 2, 5, 10, 10, 1 /),'lwcon')
389  type(ctrl_out),save :: o_iwcon        = ctrl_out((/ 2, 5, 10, 10, 10 /),'iwcon')
390  type(ctrl_out),save :: o_temp         = ctrl_out((/ 2, 3, 4, 10, 1 /),'temp')
391  type(ctrl_out),save :: o_theta        = ctrl_out((/ 2, 3, 4, 10, 1 /),'theta')
392  type(ctrl_out),save :: o_ovap         = ctrl_out((/ 2, 3, 4, 10, 1 /),'ovap')
393  type(ctrl_out),save :: o_ovapinit         = ctrl_out((/ 2, 3, 10, 10, 1 /),'ovapinit')
394  type(ctrl_out),save :: o_wvapp        = ctrl_out((/ 2, 10, 10, 10, 10 /),'wvapp')
395  type(ctrl_out),save :: o_geop         = ctrl_out((/ 2, 3, 10, 10, 1 /),'geop')
396  type(ctrl_out),save :: o_vitu         = ctrl_out((/ 2, 3, 4, 5, 1 /),'vitu')
397  type(ctrl_out),save :: o_vitv         = ctrl_out((/ 2, 3, 4, 5, 1 /),'vitv')
398  type(ctrl_out),save :: o_vitw         = ctrl_out((/ 2, 3, 10, 5, 1 /),'vitw')
399  type(ctrl_out),save :: o_pres         = ctrl_out((/ 2, 3, 10, 10, 1 /),'pres')
400  type(ctrl_out),save :: o_paprs        = ctrl_out((/ 2, 3, 10, 10, 1 /),'paprs')
401  type(ctrl_out),save :: o_rneb         = ctrl_out((/ 2, 5, 10, 10, 1 /),'rneb')
402  type(ctrl_out),save :: o_rnebcon      = ctrl_out((/ 2, 5, 10, 10, 1 /),'rnebcon')
403  type(ctrl_out),save :: o_rhum         = ctrl_out((/ 2, 5, 10, 10, 10 /),'rhum')
404  type(ctrl_out),save :: o_ozone        = ctrl_out((/ 2, 10, 10, 10, 10 /),'ozone')
405  type(ctrl_out),save :: o_ozone_light        = ctrl_out((/ 2, 10, 10, 10, 10 /),'ozone_daylight')
406  type(ctrl_out),save :: o_upwd         = ctrl_out((/ 2, 10, 10, 10, 10 /),'upwd')
407  type(ctrl_out),save :: o_dtphy        = ctrl_out((/ 2, 10, 10, 10, 1 /),'dtphy')
408  type(ctrl_out),save :: o_dqphy        = ctrl_out((/ 2, 10, 10, 10, 1 /),'dqphy')
409  type(ctrl_out),save :: o_pr_con_l     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_con_l')
410  type(ctrl_out),save :: o_pr_con_i     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_con_i')
411  type(ctrl_out),save :: o_pr_lsc_l     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_lsc_l')
412  type(ctrl_out),save :: o_pr_lsc_i     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_lsc_i')
413  type(ctrl_out),save :: o_re           =ctrl_out((/ 5, 10, 10, 10, 10 /),'re')
414  type(ctrl_out),save :: o_fl           =ctrl_out((/ 5, 10, 10, 10, 10 /),'fl')
415!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
416
417  type(ctrl_out),save,dimension(4) :: o_albe_srf     = (/ ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_ter'), &
418                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_lic'), &
419                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_oce'), &
420                                                     ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_sic') /)
421
422  type(ctrl_out),save,dimension(4) :: o_ages_srf     = (/ ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_ter'), &
423                                                     ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_lic'), &
424                                                     ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_oce'), &
425                                                     ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_sic') /)
426
427  type(ctrl_out),save,dimension(4) :: o_rugs_srf     = (/ ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_ter'), &
428                                                     ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_lic'), &
429                                                     ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_oce'), &
430                                                     ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_sic') /)
431
432  type(ctrl_out),save :: o_albs         = ctrl_out((/ 3, 10, 10, 10, 10 /),'albs')
433  type(ctrl_out),save :: o_albslw       = ctrl_out((/ 3, 10, 10, 10, 10 /),'albslw')
434
435  type(ctrl_out),save :: o_clwcon       = ctrl_out((/ 4, 10, 10, 10, 10 /),'clwcon')
436  type(ctrl_out),save :: o_Ma           = ctrl_out((/ 4, 10, 10, 10, 10 /),'Ma')
437  type(ctrl_out),save :: o_dnwd         = ctrl_out((/ 4, 10, 10, 10, 10 /),'dnwd')
438  type(ctrl_out),save :: o_dnwd0        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dnwd0')
439  type(ctrl_out),save :: o_mc           = ctrl_out((/ 4, 10, 10, 10, 10 /),'mc')
440  type(ctrl_out),save :: o_ftime_con    = ctrl_out((/ 4, 10, 10, 10, 10 /),'ftime_con')
441  type(ctrl_out),save :: o_dtdyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dtdyn')
442  type(ctrl_out),save :: o_dqdyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dqdyn')
443  type(ctrl_out),save :: o_dudyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dudyn')  !AXC
444  type(ctrl_out),save :: o_dvdyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dvdyn')  !AXC
445  type(ctrl_out),save :: o_dtcon        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dtcon')
446  type(ctrl_out),save :: o_ducon        = ctrl_out((/ 4, 10, 10, 10, 10 /),'ducon')
447  type(ctrl_out),save :: o_dqcon        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dqcon')
448  type(ctrl_out),save :: o_dtwak        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dtwak')
449  type(ctrl_out),save :: o_dqwak        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dqwak')
450  type(ctrl_out),save :: o_wake_h       = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_h')
451  type(ctrl_out),save :: o_wake_s       = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_s')
452  type(ctrl_out),save :: o_wake_deltat  = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_deltat')
453  type(ctrl_out),save :: o_wake_deltaq  = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_deltaq')
454  type(ctrl_out),save :: o_wake_omg     = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_omg')
455  type(ctrl_out),save :: o_Vprecip      = ctrl_out((/ 10, 10, 10, 10, 10 /),'Vprecip')
456  type(ctrl_out),save :: o_ftd          = ctrl_out((/ 4, 5, 10, 10, 10 /),'ftd')
457  type(ctrl_out),save :: o_fqd          = ctrl_out((/ 4, 5, 10, 10, 10 /),'fqd')
458  type(ctrl_out),save :: o_dtlsc        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlsc')
459  type(ctrl_out),save :: o_dtlschr      = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlschr')
460  type(ctrl_out),save :: o_dqlsc        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqlsc')
461  type(ctrl_out),save :: o_dtvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtvdf')
462  type(ctrl_out),save :: o_dqvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqvdf')
463  type(ctrl_out),save :: o_dteva        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dteva')
464  type(ctrl_out),save :: o_dqeva        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqeva')
465  type(ctrl_out),save :: o_ptconv       = ctrl_out((/ 4, 10, 10, 10, 10 /),'ptconv')
466  type(ctrl_out),save :: o_ratqs        = ctrl_out((/ 4, 10, 10, 10, 10 /),'ratqs')
467  type(ctrl_out),save :: o_dtthe        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtthe')
468  type(ctrl_out),save :: o_f_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'f_th')
469  type(ctrl_out),save :: o_e_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'e_th')
470  type(ctrl_out),save :: o_w_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'w_th')
471  type(ctrl_out),save :: o_lambda_th    = ctrl_out((/ 10, 10, 10, 10, 10 /),'lambda_th')
472  type(ctrl_out),save :: o_ftime_th     = ctrl_out((/ 10, 10, 10, 10, 10 /),'ftime_th')
473  type(ctrl_out),save :: o_q_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'q_th')
474  type(ctrl_out),save :: o_a_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'a_th')
475  type(ctrl_out),save :: o_d_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'d_th')
476  type(ctrl_out),save :: o_f0_th        = ctrl_out((/ 4, 10, 10, 10, 10 /),'f0_th')
477  type(ctrl_out),save :: o_zmax_th      = ctrl_out((/ 4, 10, 10, 10, 10 /),'zmax_th')
478  type(ctrl_out),save :: o_dqthe        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dqthe')
479  type(ctrl_out),save :: o_dtajs        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtajs')
480  type(ctrl_out),save :: o_dqajs        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqajs')
481  type(ctrl_out),save :: o_dtswr        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dtswr')
482  type(ctrl_out),save :: o_dtsw0        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtsw0')
483  type(ctrl_out),save :: o_dtlwr        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dtlwr')
484  type(ctrl_out),save :: o_dtlw0        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlw0')
485  type(ctrl_out),save :: o_dtec         = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtec')
486  type(ctrl_out),save :: o_duvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'duvdf')
487  type(ctrl_out),save :: o_dvvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvvdf')
488  type(ctrl_out),save :: o_duoro        = ctrl_out((/ 4, 10, 10, 10, 10 /),'duoro')
489  type(ctrl_out),save :: o_dvoro        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvoro')
490  type(ctrl_out),save :: o_dulif        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dulif')
491  type(ctrl_out),save :: o_dvlif        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvlif')
492
493! Attention a refaire correctement
494  type(ctrl_out),save,dimension(2) :: o_trac         = (/ ctrl_out((/ 4, 10, 10, 10, 10 /),'trac01'), &
495                                                     ctrl_out((/ 4, 10, 10, 10, 10 /),'trac02') /)
496    CONTAINS
497
498!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
499!!!!!!!!! Ouverture des fichier et definition des variable de sortie !!!!!!!!
500!! histbeg, histvert et histdef
501!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
502 
503  SUBROUTINE phys_output_open(jjmp1,nlevSTD,clevSTD,nbteta, &
504       ctetaSTD,dtime, ok_veget, &
505       type_ocean, iflag_pbl,ok_mensuel,ok_journe, &
506       ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, read_climoz, &
507       new_aod, aerosol_couple)   
508
509
510  USE iophy
511  USE dimphy
512  USE infotrac
513  USE ioipsl
514  USE mod_phys_lmdz_para
515  USE aero_mod, only : naero_spc,name_aero
516
517  IMPLICIT NONE
518  include "dimensions.h"
519  include "temps.h"
520  include "indicesol.h"
521  include "clesphys.h"
522  include "thermcell.h"
523  include "comvert.h"
524
525  integer                               :: jjmp1
526  integer                               :: nbteta, nlevSTD, radpas
527  logical                               :: ok_mensuel, ok_journe, ok_hf, ok_instan
528  logical                               :: ok_LES,ok_ade,ok_aie
529  logical                               :: new_aod, aerosol_couple
530  integer, intent(in)::  read_climoz ! read ozone climatology
531  !     Allowed values are 0, 1 and 2
532  !     0: do not read an ozone climatology
533  !     1: read a single ozone climatology that will be used day and night
534  !     2: read two ozone climatologies, the average day and night
535  !     climatology and the daylight climatology
536
537  real                                  :: dtime
538  integer                               :: idayref
539  real                                  :: zjulian
540  real, dimension(klev)                 :: Ahyb, Bhyb, Alt
541  character(len=4), dimension(nlevSTD)  :: clevSTD
542  integer                               :: nsrf, k, iq, iiq, iff, i, j, ilev
543  integer                               :: naero
544  logical                               :: ok_veget
545  integer                               :: iflag_pbl
546  CHARACTER(len=4)                      :: bb2
547  CHARACTER(len=2)                      :: bb3
548  character(len=6)                      :: type_ocean
549  CHARACTER(len=3)                      :: ctetaSTD(nbteta)
550  real, dimension(nfiles)               :: ecrit_files
551  CHARACTER(len=20), dimension(nfiles)  :: phys_out_filenames
552  INTEGER, dimension(iim*jjmp1)         ::  ndex2d
553  INTEGER, dimension(iim*jjmp1*klev)    :: ndex3d
554  integer                               :: imin_ins, imax_ins
555  integer                               :: jmin_ins, jmax_ins
556  integer, dimension(nfiles)            :: phys_out_levmin, phys_out_levmax
557  integer, dimension(nfiles)            :: phys_out_filelevels
558  CHARACTER(len=20), dimension(nfiles)  :: type_ecri_files, phys_out_filetypes
559  character(len=20), dimension(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq' /)
560  logical, dimension(nfiles)            :: phys_out_filekeys
561
562!!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
563!                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
564
565  logical, dimension(nfiles), save  :: phys_out_regfkey       = (/ .false., .false., .false., .false., .false. /)
566  real, dimension(nfiles), save     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180. /)
567  real, dimension(nfiles), save     :: phys_out_lonmax        = (/ 180., 180., 180., 180., 180. /)
568  real, dimension(nfiles), save     :: phys_out_latmin        = (/ -90., -90., -90., -90., -90. /)
569  real, dimension(nfiles), save     :: phys_out_latmax        = (/ 90., 90., 90., 90., 90. /)
570 
571 
572
573!
574   print*,'Debut phys_output_mod.F90'
575! Initialisations (Valeurs par defaut
576   levmax = (/ klev, klev, klev, klev, klev /)
577
578   phys_out_filenames(1) = 'histmth'
579   phys_out_filenames(2) = 'histday'
580   phys_out_filenames(3) = 'histhf'
581   phys_out_filenames(4) = 'histins'
582   phys_out_filenames(5) = 'histLES'
583
584   type_ecri(1) = 'ave(X)'
585   type_ecri(2) = 'ave(X)'
586   type_ecri(3) = 'ave(X)'
587   type_ecri(4) = 'inst(X)'
588   type_ecri(5) = 'inst(X)'
589
590   clef_files(1) = ok_mensuel
591   clef_files(2) = ok_journe
592   clef_files(3) = ok_hf
593   clef_files(4) = ok_instan
594   clef_files(5) = ok_LES
595
596   lev_files(1) = lev_histmth
597   lev_files(2) = lev_histday
598   lev_files(3) = lev_histhf
599   lev_files(4) = lev_histins
600   lev_files(5) = lev_histLES
601
602
603   ecrit_files(1) = ecrit_mth
604   ecrit_files(2) = ecrit_day
605   ecrit_files(3) = ecrit_hf
606   ecrit_files(4) = ecrit_ins
607   ecrit_files(5) = ecrit_LES
608 
609!! Lectures des parametres de sorties dans physiq.def
610
611   call getin('phys_out_regfkey',phys_out_regfkey)
612   call getin('phys_out_lonmin',phys_out_lonmin)
613   call getin('phys_out_lonmax',phys_out_lonmax)
614   call getin('phys_out_latmin',phys_out_latmin)
615   call getin('phys_out_latmax',phys_out_latmax)
616     phys_out_levmin(:)=levmin(:)
617   call getin('phys_out_levmin',levmin)
618     phys_out_levmax(:)=levmax(:)
619   call getin('phys_out_levmax',levmax)
620   call getin('phys_out_filenames',phys_out_filenames)
621     phys_out_filekeys(:)=clef_files(:)
622   call getin('phys_out_filekeys',clef_files)
623     phys_out_filelevels(:)=lev_files(:)
624   call getin('phys_out_filelevels',lev_files)
625   call getin('phys_out_filetimesteps',chtimestep)
626     phys_out_filetypes(:)=type_ecri(:)
627   call getin('phys_out_filetypes',type_ecri)
628
629   type_ecri_files(:)=type_ecri(:)
630
631   print*,'phys_out_lonmin=',phys_out_lonmin
632   print*,'phys_out_lonmax=',phys_out_lonmax
633   print*,'phys_out_latmin=',phys_out_latmin
634   print*,'phys_out_latmax=',phys_out_latmax
635   print*,'phys_out_filenames=',phys_out_filenames
636   print*,'phys_out_filetypes=',type_ecri
637   print*,'phys_out_filekeys=',clef_files
638   print*,'phys_out_filelevels=',lev_files
639
640!!!!!!!!!!!!!!!!!!!!!!! Boucle sur les fichiers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
641! Appel de histbeg et histvert pour creer le fichier et les niveaux verticaux !!
642! Appel des histbeg pour definir les variables (nom, moy ou inst, freq de sortie ..
643!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
644
645 zdtime = dtime         ! Frequence ou l on moyenne
646
647! Calcul des Ahyb, Bhyb et Alt
648         do k=1,klev
649          Ahyb(k)=(ap(k)+ap(k+1))/2.
650          Bhyb(k)=(bp(k)+bp(k+1))/2.
651          Alt(k)=log(preff/presnivs(k))*8.
652         enddo
653!          if(prt_level.ge.1) then
654           print*,'Ap Hybrid = ',Ahyb(1:klev)
655           print*,'Bp Hybrid = ',Bhyb(1:klev)
656           print*,'Alt approx des couches pour une haut d echelle de 8km = ',Alt(1:klev)
657!          endif
658 DO iff=1,nfiles
659
660    IF (clef_files(iff)) THEN
661
662      if ( chtimestep(iff).eq.'DefFreq' ) then
663! Par defaut ecrit_files = (ecrit_mensuel ecrit_jour ecrit_hf ...)*86400.
664        ecrit_files(iff)=ecrit_files(iff)*86400.
665      else
666        call convers_timesteps(chtimestep(iff),ecrit_files(iff))
667      endif
668       print*,'ecrit_files(',iff,')= ',ecrit_files(iff)
669
670      zoutm(iff) = ecrit_files(iff) ! Frequence ou l on ecrit en seconde
671
672      idayref = day_ref
673      CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
674
675!!!!!!!!!!!!!!!!! Traitement dans le cas ou l'on veut stocker sur un domaine limite !!
676!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
677     if (phys_out_regfkey(iff)) then
678
679        imin_ins=1
680        imax_ins=iim
681        jmin_ins=1
682        jmax_ins=jjmp1
683
684! correction abderr       
685        do i=1,iim
686           print*,'io_lon(i)=',io_lon(i)
687           if (io_lon(i).le.phys_out_lonmin(iff)) imin_ins=i
688           if (io_lon(i).le.phys_out_lonmax(iff)) imax_ins=i+1
689        enddo
690
691        do j=1,jjmp1
692            print*,'io_lat(j)=',io_lat(j)
693            if (io_lat(j).ge.phys_out_latmin(iff)) jmax_ins=j+1
694            if (io_lat(j).ge.phys_out_latmax(iff)) jmin_ins=j
695        enddo
696
697        print*,'On stoke le fichier histoire numero ',iff,' sur ', &
698         imin_ins,imax_ins,jmin_ins,jmax_ins
699         print*,'longitudes : ', &
700         io_lon(imin_ins),io_lon(imax_ins), &
701         'latitudes : ', &
702         io_lat(jmax_ins),io_lat(jmin_ins)
703
704 CALL histbeg(phys_out_filenames(iff),iim,io_lon,jjmp1,io_lat, &
705              imin_ins,imax_ins-imin_ins+1, &
706              jmin_ins,jmax_ins-jmin_ins+1, &
707              itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
708!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
709       else
710 CALL histbeg_phy(phys_out_filenames(iff),itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
711       endif
712 
713      CALL histvert(nid_files(iff), "presnivs", "Vertical levels", "mb", &
714           levmax(iff) - levmin(iff) + 1, &
715           presnivs(levmin(iff):levmax(iff))/100., nvertm(iff))
716
717!!!!!!!!!!!!! Traitement des champs 3D pour histhf !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
718!!!!!!!!!!!!!!! A Revoir plus tard !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
719!          IF (iff.eq.3.and.lev_files(iff).ge.4) THEN
720!          CALL histbeg_phy("histhf3d",itau_phy, &
721!     &                     zjulian, dtime, &
722!     &                     nhorim, nid_hf3d)
723
724!         CALL histvert(nid_hf3d, "presnivs", &
725!     &                 "Vertical levels", "mb", &
726!     &                 klev, presnivs/100., nvertm)
727!          ENDIF
728!
729!!!! Composentes de la coordonnee sigma-hybride
730   CALL histvert(nid_files(iff), "Ahyb","Ahyb comp of Hyb Cord ", "Pa", &
731                 levmax(iff) - levmin(iff) + 1,Ahyb,nvertap(iff))
732
733   CALL histvert(nid_files(iff), "Bhyb","Bhyb comp of Hyb Cord", " ", &
734                 levmax(iff) - levmin(iff) + 1,Bhyb,nvertbp(iff))
735
736   CALL histvert(nid_files(iff), "Alt","Height approx for scale heigh of 8km at levels", "Km", &
737                 levmax(iff) - levmin(iff) + 1,Alt,nvertAlt(iff))
738
739!   CALL histvert(nid_files(iff), "preff","Reference pressure", "Pa", &
740!                 1,preff,nvertp0(iff))
741!!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
742 CALL histdef2d(iff,o_phis%flag,o_phis%name,"Surface geop.height", "m2/s2")
743   type_ecri(1) = 'once'
744   type_ecri(2) = 'once'
745   type_ecri(3) = 'once'
746   type_ecri(4) = 'once'
747   type_ecri(5) = 'once'
748 CALL histdef2d(iff,o_aire%flag,o_aire%name,"Grid area", "-")
749 CALL histdef2d(iff,o_contfracATM%flag,o_contfracATM%name,"% sfce ter+lic", "-")
750   type_ecri(:) = type_ecri_files(:)
751
752!!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
753 CALL histdef2d(iff,o_contfracOR%flag,o_contfracOR%name,"% sfce terre OR", "-" )
754 CALL histdef2d(iff,o_aireTER%flag,o_aireTER%name,"Grid area CONT", "-" )
755 CALL histdef2d(iff,o_flat%flag,o_flat%name, "Latent heat flux", "W/m2")
756 CALL histdef2d(iff,o_slp%flag,o_slp%name, "Sea Level Pressure", "Pa" )
757 CALL histdef2d(iff,o_tsol%flag,o_tsol%name, "Surface Temperature", "K")
758 CALL histdef2d(iff,o_t2m%flag,o_t2m%name, "Temperature 2m", "K" )
759   type_ecri(1) = 't_min(X)'
760   type_ecri(2) = 't_min(X)'
761   type_ecri(3) = 't_min(X)'
762   type_ecri(4) = 't_min(X)'
763   type_ecri(5) = 't_min(X)'
764 CALL histdef2d(iff,o_t2m_min%flag,o_t2m_min%name, "Temp 2m min", "K" )
765   type_ecri(1) = 't_max(X)'
766   type_ecri(2) = 't_max(X)'
767   type_ecri(3) = 't_max(X)'
768   type_ecri(4) = 't_max(X)'
769   type_ecri(5) = 't_max(X)'
770 CALL histdef2d(iff,o_t2m_max%flag,o_t2m_max%name, "Temp 2m max", "K" )
771   type_ecri(:) = type_ecri_files(:)
772 CALL histdef2d(iff,o_wind10m%flag,o_wind10m%name, "10-m wind speed", "m/s")
773 CALL histdef2d(iff,o_wind10max%flag,o_wind10max%name, "10m wind speed max", "m/s")
774 CALL histdef2d(iff,o_sicf%flag,o_sicf%name, "Sea-ice fraction", "-" )
775 CALL histdef2d(iff,o_q2m%flag,o_q2m%name, "Specific humidity 2m", "kg/kg")
776 CALL histdef2d(iff,o_u10m%flag,o_u10m%name, "Vent zonal 10m", "m/s" )
777 CALL histdef2d(iff,o_v10m%flag,o_v10m%name, "Vent meridien 10m", "m/s")
778 CALL histdef2d(iff,o_psol%flag,o_psol%name, "Surface Pressure", "Pa" )
779 CALL histdef2d(iff,o_qsurf%flag,o_qsurf%name, "Surface Air humidity", "kg/kg")
780
781  if (.not. ok_veget) then
782 CALL histdef2d(iff,o_qsol%flag,o_qsol%name, "Soil watter content", "mm" )
783  endif
784
785 CALL histdef2d(iff,o_ndayrain%flag,o_ndayrain%name, "Number of dayrain(liq+sol)", "-")
786 CALL histdef2d(iff,o_precip%flag,o_precip%name, "Precip Totale liq+sol", "kg/(s*m2)" )
787 CALL histdef2d(iff,o_plul%flag,o_plul%name, "Large-scale Precip.", "kg/(s*m2)")
788 CALL histdef2d(iff,o_pluc%flag,o_pluc%name, "Convective Precip.", "kg/(s*m2)")
789 CALL histdef2d(iff,o_snow%flag,o_snow%name, "Snow fall", "kg/(s*m2)" )
790 CALL histdef2d(iff,o_msnow%flag,o_msnow%name, "Surface snow amount", "kg/m2" )
791 CALL histdef2d(iff,o_fsnow%flag,o_fsnow%name, "Surface snow area fraction", "-" )
792 CALL histdef2d(iff,o_evap%flag,o_evap%name, "Evaporat", "kg/(s*m2)" )
793 CALL histdef2d(iff,o_tops%flag,o_tops%name, "Solar rad. at TOA", "W/m2")
794 CALL histdef2d(iff,o_tops0%flag,o_tops0%name, "CS Solar rad. at TOA", "W/m2")
795 CALL histdef2d(iff,o_topl%flag,o_topl%name, "IR rad. at TOA", "W/m2" )
796 CALL histdef2d(iff,o_topl0%flag,o_topl0%name, "IR rad. at TOA", "W/m2")
797 CALL histdef2d(iff,o_SWupTOA%flag,o_SWupTOA%name, "SWup at TOA", "W/m2")
798 CALL histdef2d(iff,o_SWupTOAclr%flag,o_SWupTOAclr%name, "SWup clear sky at TOA", "W/m2")
799 CALL histdef2d(iff,o_SWdnTOA%flag,o_SWdnTOA%name, "SWdn at TOA", "W/m2" )
800 CALL histdef2d(iff,o_SWdnTOAclr%flag,o_SWdnTOAclr%name, "SWdn clear sky at TOA", "W/m2")
801 CALL histdef2d(iff,o_nettop%flag,o_nettop%name, "Net dn radiatif flux at TOA", "W/m2")
802 CALL histdef2d(iff,o_SWup200%flag,o_SWup200%name, "SWup at 200mb", "W/m2" )
803 CALL histdef2d(iff,o_SWup200clr%flag,o_SWup200clr%name, "SWup clear sky at 200mb", "W/m2")
804 CALL histdef2d(iff,o_SWdn200%flag,o_SWdn200%name, "SWdn at 200mb", "W/m2" )
805 CALL histdef2d(iff,o_SWdn200clr%flag,o_SWdn200clr%name, "SWdn clear sky at 200mb", "W/m2")
806 CALL histdef2d(iff,o_LWup200%flag,o_LWup200%name, "LWup at 200mb", "W/m2")
807 CALL histdef2d(iff,o_LWup200clr%flag,o_LWup200clr%name, "LWup clear sky at 200mb", "W/m2")
808 CALL histdef2d(iff,o_LWdn200%flag,o_LWdn200%name, "LWdn at 200mb", "W/m2")
809 CALL histdef2d(iff,o_LWdn200clr%flag,o_LWdn200clr%name, "LWdn clear sky at 200mb", "W/m2")
810 CALL histdef2d(iff,o_sols%flag,o_sols%name, "Solar rad. at surf.", "W/m2")
811 CALL histdef2d(iff,o_sols0%flag,o_sols0%name, "Solar rad. at surf.", "W/m2")
812 CALL histdef2d(iff,o_soll%flag,o_soll%name, "IR rad. at surface", "W/m2") 
813 CALL histdef2d(iff,o_radsol%flag,o_radsol%name, "Rayonnement au sol", "W/m2")
814 CALL histdef2d(iff,o_soll0%flag,o_soll0%name, "IR rad. at surface", "W/m2")
815 CALL histdef2d(iff,o_SWupSFC%flag,o_SWupSFC%name, "SWup at surface", "W/m2")
816 CALL histdef2d(iff,o_SWupSFCclr%flag,o_SWupSFCclr%name, "SWup clear sky at surface", "W/m2")
817 CALL histdef2d(iff,o_SWdnSFC%flag,o_SWdnSFC%name, "SWdn at surface", "W/m2")
818 CALL histdef2d(iff,o_SWdnSFCclr%flag,o_SWdnSFCclr%name, "SWdn clear sky at surface", "W/m2")
819 CALL histdef2d(iff,o_LWupSFC%flag,o_LWupSFC%name, "Upwd. IR rad. at surface", "W/m2")
820 CALL histdef2d(iff,o_LWdnSFC%flag,o_LWdnSFC%name, "Down. IR rad. at surface", "W/m2")
821 CALL histdef2d(iff,o_LWupSFCclr%flag,o_LWupSFCclr%name, "CS Upwd. IR rad. at surface", "W/m2")
822 CALL histdef2d(iff,o_LWdnSFCclr%flag,o_LWdnSFCclr%name, "Down. CS IR rad. at surface", "W/m2")
823 CALL histdef2d(iff,o_bils%flag,o_bils%name, "Surf. total heat flux", "W/m2")
824 CALL histdef2d(iff,o_sens%flag,o_sens%name, "Sensible heat flux", "W/m2")
825 CALL histdef2d(iff,o_fder%flag,o_fder%name, "Heat flux derivation", "W/m2")
826 CALL histdef2d(iff,o_ffonte%flag,o_ffonte%name, "Thermal flux for snow melting", "W/m2")
827 CALL histdef2d(iff,o_fqcalving%flag,o_fqcalving%name, "Ice Calving", "kg/m2/s")
828 CALL histdef2d(iff,o_fqfonte%flag,o_fqfonte%name, "Land ice melt", "kg/m2/s")
829
830 CALL histdef2d(iff,o_taux%flag,o_taux%name, "Zonal wind stress","Pa")
831 CALL histdef2d(iff,o_tauy%flag,o_tauy%name, "Meridional wind stress","Pa")
832
833     DO nsrf = 1, nbsrf
834 CALL histdef2d(iff,o_pourc_srf(nsrf)%flag,o_pourc_srf(nsrf)%name,"% "//clnsurf(nsrf),"%")
835 CALL histdef2d(iff,o_fract_srf(nsrf)%flag,o_fract_srf(nsrf)%name,"Fraction "//clnsurf(nsrf),"1")
836 CALL histdef2d(iff,o_taux_srf(nsrf)%flag,o_taux_srf(nsrf)%name,"Zonal wind stress"//clnsurf(nsrf),"Pa")
837 CALL histdef2d(iff,o_tauy_srf(nsrf)%flag,o_tauy_srf(nsrf)%name,"Meridional wind stress "//clnsurf(nsrf),"Pa")
838 CALL histdef2d(iff,o_tsol_srf(nsrf)%flag,o_tsol_srf(nsrf)%name,"Temperature "//clnsurf(nsrf),"K")
839 CALL histdef2d(iff,o_u10m_srf(nsrf)%flag,o_u10m_srf(nsrf)%name,"Vent Zonal 10m "//clnsurf(nsrf),"m/s")
840 CALL histdef2d(iff,o_evap_srf(nsrf)%flag,o_evap_srf(nsrf)%name,"evaporation at surface "//clnsurf(nsrf),"kg/(s*m2)")
841 CALL histdef2d(iff,o_v10m_srf(nsrf)%flag,o_v10m_srf(nsrf)%name,"Vent meredien 10m "//clnsurf(nsrf),"m/s")
842 CALL histdef2d(iff,o_t2m_srf(nsrf)%flag,o_t2m_srf(nsrf)%name,"Temp 2m "//clnsurf(nsrf),"K")
843 CALL histdef2d(iff,o_sens_srf(nsrf)%flag,o_sens_srf(nsrf)%name,"Sensible heat flux "//clnsurf(nsrf),"W/m2")
844 CALL histdef2d(iff,o_lat_srf(nsrf)%flag,o_lat_srf(nsrf)%name,"Latent heat flux "//clnsurf(nsrf),"W/m2")
845 CALL histdef2d(iff,o_flw_srf(nsrf)%flag,o_flw_srf(nsrf)%name,"LW "//clnsurf(nsrf),"W/m2")
846 CALL histdef2d(iff,o_fsw_srf(nsrf)%flag,o_fsw_srf(nsrf)%name,"SW "//clnsurf(nsrf),"W/m2")
847 CALL histdef2d(iff,o_wbils_srf(nsrf)%flag,o_wbils_srf(nsrf)%name,"Bilan sol "//clnsurf(nsrf),"W/m2" )
848 CALL histdef2d(iff,o_wbilo_srf(nsrf)%flag,o_wbilo_srf(nsrf)%name,"Bilan eau "//clnsurf(nsrf),"kg/(m2*s)")
849  if (iflag_pbl>1 .and. lev_files(iff).gt.10 ) then
850 CALL histdef2d(iff,o_tke_srf(nsrf)%flag,o_tke_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
851   type_ecri(1) = 't_max(X)'
852   type_ecri(2) = 't_max(X)'
853   type_ecri(3) = 't_max(X)'
854   type_ecri(4) = 't_max(X)'
855   type_ecri(5) = 't_max(X)'
856 CALL histdef2d(iff,o_tke_max_srf(nsrf)%flag,o_tke_max_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
857   type_ecri(:) = type_ecri_files(:)
858  endif
859 CALL histdef2d(iff,o_albe_srf(nsrf)%flag,o_albe_srf(nsrf)%name,"Albedo surf. "//clnsurf(nsrf),"-")
860 CALL histdef2d(iff,o_rugs_srf(nsrf)%flag,o_rugs_srf(nsrf)%name,"Latent heat flux "//clnsurf(nsrf),"W/m2")
861 CALL histdef2d(iff,o_ages_srf(nsrf)%flag,o_ages_srf(nsrf)%name,"Snow age", "day")
862END DO
863
864IF (new_aod .AND. (.NOT. aerosol_couple)) THEN
865  DO naero = 1, naero_spc
866  CALL histdef2d(iff,o_tausumaero(naero)%flag,o_tausumaero(naero)%name,"Aerosol Optical depth at 550 nm "//name_aero(naero),"1")
867  END DO
868ENDIF
869
870 IF (ok_ade) THEN
871  CALL histdef2d(iff,o_topswad%flag,o_topswad%name, "ADE at TOA", "W/m2")
872  CALL histdef2d(iff,o_solswad%flag,o_solswad%name, "ADE at SRF", "W/m2")
873
874 CALL histdef2d(iff,o_swtoaas_nat%flag,o_swtoaas_nat%name, "Natural aerosol radiative forcing all-sky at TOA", "W/m2")
875 CALL histdef2d(iff,o_swsrfas_nat%flag,o_swsrfas_nat%name, "Natural aerosol radiative forcing all-sky at SRF", "W/m2")
876 CALL histdef2d(iff,o_swtoacs_nat%flag,o_swtoacs_nat%name, "Natural aerosol radiative forcing clear-sky at TOA", "W/m2")
877 CALL histdef2d(iff,o_swsrfcs_nat%flag,o_swsrfcs_nat%name, "Natural aerosol radiative forcing clear-sky at SRF", "W/m2")
878
879 CALL histdef2d(iff,o_swtoaas_ant%flag,o_swtoaas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at TOA", "W/m2")
880 CALL histdef2d(iff,o_swsrfas_ant%flag,o_swsrfas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at SRF", "W/m2")
881 CALL histdef2d(iff,o_swtoacs_ant%flag,o_swtoacs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at TOA", "W/m2")
882 CALL histdef2d(iff,o_swsrfcs_ant%flag,o_swsrfcs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at SRF", "W/m2")
883
884 IF (.NOT. aerosol_couple) THEN
885 CALL histdef2d(iff,o_swtoacf_nat%flag,o_swtoacf_nat%name, "Natural aerosol impact on cloud radiative forcing at TOA", "W/m2")
886 CALL histdef2d(iff,o_swsrfcf_nat%flag,o_swsrfcf_nat%name, "Natural aerosol impact on cloud radiative forcing  at SRF", "W/m2")
887 CALL histdef2d(iff,o_swtoacf_ant%flag,o_swtoacf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at TOA", "W/m2")
888 CALL histdef2d(iff,o_swsrfcf_ant%flag,o_swsrfcf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at SRF", "W/m2")
889 CALL histdef2d(iff,o_swtoacf_zero%flag,o_swtoacf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at TOA", "W/m2")
890 CALL histdef2d(iff,o_swsrfcf_zero%flag,o_swsrfcf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at SRF", "W/m2")
891 ENDIF
892
893 ENDIF
894
895 IF (ok_aie) THEN
896  CALL histdef2d(iff,o_topswai%flag,o_topswai%name, "AIE at TOA", "W/m2")
897  CALL histdef2d(iff,o_solswai%flag,o_solswai%name, "AIE at SFR", "W/m2")
898 ENDIF
899
900
901 CALL histdef2d(iff,o_albs%flag,o_albs%name, "Surface albedo", "-")
902 CALL histdef2d(iff,o_albslw%flag,o_albslw%name, "Surface albedo LW", "-")
903 CALL histdef2d(iff,o_cdrm%flag,o_cdrm%name, "Momentum drag coef.", "-")
904 CALL histdef2d(iff,o_cdrh%flag,o_cdrh%name, "Heat drag coef.", "-" )
905 CALL histdef2d(iff,o_cldl%flag,o_cldl%name, "Low-level cloudiness", "-")
906 CALL histdef2d(iff,o_cldm%flag,o_cldm%name, "Mid-level cloudiness", "-")
907 CALL histdef2d(iff,o_cldh%flag,o_cldh%name, "High-level cloudiness", "-")
908 CALL histdef2d(iff,o_cldt%flag,o_cldt%name, "Total cloudiness", "-")
909 CALL histdef2d(iff,o_cldq%flag,o_cldq%name, "Cloud liquid water path", "kg/m2")
910 CALL histdef2d(iff,o_lwp%flag,o_lwp%name, "Cloud water path", "kg/m2")
911 CALL histdef2d(iff,o_iwp%flag,o_iwp%name, "Cloud ice water path", "kg/m2" )
912 CALL histdef2d(iff,o_ue%flag,o_ue%name, "Zonal energy transport", "-")
913 CALL histdef2d(iff,o_ve%flag,o_ve%name, "Merid energy transport", "-")
914 CALL histdef2d(iff,o_uq%flag,o_uq%name, "Zonal humidity transport", "-")
915 CALL histdef2d(iff,o_vq%flag,o_vq%name, "Merid humidity transport", "-")
916
917     IF(iflag_con.GE.3) THEN ! sb
918 CALL histdef2d(iff,o_cape%flag,o_cape%name, "Conv avlbl pot ener", "J/kg")
919 CALL histdef2d(iff,o_pbase%flag,o_pbase%name, "Cld base pressure", "mb")
920 CALL histdef2d(iff,o_ptop%flag,o_ptop%name, "Cld top pressure", "mb")
921 CALL histdef2d(iff,o_fbase%flag,o_fbase%name, "Cld base mass flux", "kg/m2/s")
922 CALL histdef2d(iff,o_prw%flag,o_prw%name, "Precipitable water", "kg/m2")
923   type_ecri(1) = 't_max(X)'
924   type_ecri(2) = 't_max(X)'
925   type_ecri(3) = 't_max(X)'
926   type_ecri(4) = 't_max(X)'
927   type_ecri(5) = 't_max(X)'
928 CALL histdef2d(iff,o_cape_max%flag,o_cape_max%name, "CAPE max.", "J/kg")
929   type_ecri(:) = type_ecri_files(:)
930 CALL histdef3d(iff,o_upwd%flag,o_upwd%name, "saturated updraft", "kg/m2/s")
931 CALL histdef3d(iff,o_Ma%flag,o_Ma%name, "undilute adiab updraft", "kg/m2/s")
932 CALL histdef3d(iff,o_dnwd%flag,o_dnwd%name, "saturated downdraft", "kg/m2/s")
933 CALL histdef3d(iff,o_dnwd0%flag,o_dnwd0%name, "unsat. downdraft", "kg/m2/s")
934 CALL histdef3d(iff,o_mc%flag,o_mc%name, "Convective mass flux", "kg/m2/s")
935   type_ecri(1) = 'inst(X)'
936   type_ecri(2) = 'inst(X)'
937   type_ecri(3) = 'inst(X)'
938   type_ecri(4) = 'inst(X)'
939   type_ecri(5) = 'inst(X)'
940 CALL histdef2d(iff,o_ftime_con%flag,o_ftime_con%name, "Fraction of time convection Occurs", " ")
941   type_ecri(:) = type_ecri_files(:)
942     ENDIF !iflag_con .GE. 3
943
944 CALL histdef2d(iff,o_s_pblh%flag,o_s_pblh%name, "Boundary Layer Height", "m")
945 CALL histdef2d(iff,o_s_pblt%flag,o_s_pblt%name, "t at Boundary Layer Height", "K")
946 CALL histdef2d(iff,o_s_lcl%flag,o_s_lcl%name, "Condensation level", "m")
947 CALL histdef2d(iff,o_s_capCL%flag,o_s_capCL%name, "Conv avlbl pot enerfor ABL", "J/m2" )
948 CALL histdef2d(iff,o_s_oliqCL%flag,o_s_oliqCL%name, "Liq Water in BL", "kg/m2")
949 CALL histdef2d(iff,o_s_cteiCL%flag,o_s_cteiCL%name, "Instability criteria(ABL)", "K")
950 CALL histdef2d(iff,o_s_therm%flag,o_s_therm%name, "Exces du thermique", "K")
951 CALL histdef2d(iff,o_s_trmb1%flag,o_s_trmb1%name, "deep_cape(HBTM2)", "J/m2")
952 CALL histdef2d(iff,o_s_trmb2%flag,o_s_trmb2%name, "inhibition (HBTM2)", "J/m2")
953 CALL histdef2d(iff,o_s_trmb3%flag,o_s_trmb3%name, "Point Omega (HBTM2)", "m")
954
955! Champs interpolles sur des niveaux de pression
956
957   type_ecri(1) = 'inst(X)'
958   type_ecri(2) = 'inst(X)'
959   type_ecri(3) = 'inst(X)'
960   type_ecri(4) = 'inst(X)'
961   type_ecri(5) = 'inst(X)'
962
963! Attention a reverifier
964
965        ilev=0       
966        DO k=1, nlevSTD
967!     IF(k.GE.2.AND.k.LE.12) bb2=clevSTD(k)
968     bb2=clevSTD(k)
969     IF(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")THEN
970      ilev=ilev+1
971      print*,'ilev k bb2 flag name ',ilev,k, bb2,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name
972 CALL histdef2d(iff,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name,"Zonal wind "//bb2//"mb", "m/s")
973 CALL histdef2d(iff,o_vSTDlevs(ilev)%flag,o_vSTDlevs(ilev)%name,"Meridional wind "//bb2//"mb", "m/s")
974 CALL histdef2d(iff,o_wSTDlevs(ilev)%flag,o_wSTDlevs(ilev)%name,"Vertical wind "//bb2//"mb", "Pa/s")
975 CALL histdef2d(iff,o_phiSTDlevs(ilev)%flag,o_phiSTDlevs(ilev)%name,"Geopotential "//bb2//"mb", "m")
976 CALL histdef2d(iff,o_qSTDlevs(ilev)%flag,o_qSTDlevs(ilev)%name,"Specific humidity "//bb2//"mb", "kg/kg" )
977 CALL histdef2d(iff,o_tSTDlevs(ilev)%flag,o_tSTDlevs(ilev)%name,"Temperature "//bb2//"mb", "K")
978     ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")
979       ENDDO
980   type_ecri(:) = type_ecri_files(:)
981
982 CALL histdef2d(iff,o_t_oce_sic%flag,o_t_oce_sic%name, "Temp mixte oce-sic", "K")
983
984 IF (type_ocean=='slab') &
985     CALL histdef2d(iff,o_slab_bils%flag, o_slab_bils%name,"Bilan au sol sur ocean slab", "W/m2")
986
987! Couplage conv-CL
988 IF (iflag_con.GE.3) THEN
989    IF (iflag_coupl.EQ.1) THEN
990 CALL histdef2d(iff,o_ale_bl%flag,o_ale_bl%name, "ALE BL", "m2/s2")
991 CALL histdef2d(iff,o_alp_bl%flag,o_alp_bl%name, "ALP BL", "m2/s2")
992    ENDIF
993 ENDIF !(iflag_con.GE.3)
994
995 CALL histdef2d(iff,o_weakinv%flag,o_weakinv%name, "Weak inversion", "-")
996 CALL histdef2d(iff,o_dthmin%flag,o_dthmin%name, "dTheta mini", "K/m")
997 CALL histdef2d(iff,o_rh2m%flag,o_rh2m%name, "Relative humidity at 2m", "%" )
998   type_ecri(1) = 't_min(X)'
999   type_ecri(2) = 't_min(X)'
1000   type_ecri(3) = 't_min(X)'
1001   type_ecri(4) = 't_min(X)'
1002   type_ecri(5) = 't_min(X)'
1003 CALL histdef2d(iff,o_rh2m_min%flag,o_rh2m_min%name, "Min Relative humidity at 2m", "%" )
1004   type_ecri(1) = 't_max(X)'
1005   type_ecri(2) = 't_max(X)'
1006   type_ecri(3) = 't_max(X)'
1007   type_ecri(4) = 't_max(X)'
1008   type_ecri(5) = 't_max(X)'
1009 CALL histdef2d(iff,o_rh2m_max%flag,o_rh2m_max%name, "Max Relative humidity at 2m", "%" )
1010   type_ecri(:) = type_ecri_files(:)
1011 CALL histdef2d(iff,o_qsat2m%flag,o_qsat2m%name, "Saturant humidity at 2m", "%")
1012 CALL histdef2d(iff,o_tpot%flag,o_tpot%name, "Surface air potential temperature", "K")
1013 CALL histdef2d(iff,o_tpote%flag,o_tpote%name, "Surface air equivalent potential temperature", "K")
1014 CALL histdef2d(iff,o_SWnetOR%flag,o_SWnetOR%name, "Sfce net SW radiation OR", "W/m2")
1015 CALL histdef2d(iff,o_SWdownOR%flag,o_SWdownOR%name, "Sfce incident SW radiation OR", "W/m2")
1016 CALL histdef2d(iff,o_LWdownOR%flag,o_LWdownOR%name, "Sfce incident LW radiation OR", "W/m2")
1017 CALL histdef2d(iff,o_snowl%flag,o_snowl%name, "Solid Large-scale Precip.", "kg/(m2*s)")
1018
1019 CALL histdef2d(iff,o_solldown%flag,o_solldown%name, "Down. IR rad. at surface", "W/m2")
1020 CALL histdef2d(iff,o_dtsvdfo%flag,o_dtsvdfo%name, "Boundary-layer dTs(o)", "K/s")
1021 CALL histdef2d(iff,o_dtsvdft%flag,o_dtsvdft%name, "Boundary-layer dTs(t)", "K/s")
1022 CALL histdef2d(iff,o_dtsvdfg%flag,o_dtsvdfg%name, "Boundary-layer dTs(g)", "K/s")
1023 CALL histdef2d(iff,o_dtsvdfi%flag,o_dtsvdfi%name, "Boundary-layer dTs(g)", "K/s")
1024 CALL histdef2d(iff,o_rugs%flag,o_rugs%name, "rugosity", "-" )
1025
1026! Champs 3D:
1027 CALL histdef3d(iff,o_lwcon%flag,o_lwcon%name, "Cloud liquid water content", "kg/kg")
1028 CALL histdef3d(iff,o_iwcon%flag,o_iwcon%name, "Cloud ice water content", "kg/kg")
1029 CALL histdef3d(iff,o_temp%flag,o_temp%name, "Air temperature", "K" )
1030 CALL histdef3d(iff,o_theta%flag,o_theta%name, "Potential air temperature", "K" )
1031 CALL histdef3d(iff,o_ovap%flag,o_ovap%name, "Specific humidity + dqphy", "kg/kg" )
1032 CALL histdef3d(iff,o_ovapinit%flag,o_ovapinit%name, "Specific humidity", "kg/kg" )
1033 CALL histdef3d(iff,o_geop%flag,o_geop%name, "Geopotential height", "m2/s2")
1034 CALL histdef3d(iff,o_vitu%flag,o_vitu%name, "Zonal wind", "m/s" )
1035 CALL histdef3d(iff,o_vitv%flag,o_vitv%name, "Meridional wind", "m/s" )
1036 CALL histdef3d(iff,o_vitw%flag,o_vitw%name, "Vertical wind", "Pa/s" )
1037 CALL histdef3d(iff,o_pres%flag,o_pres%name, "Air pressure", "Pa" )
1038 CALL histdef3d(iff,o_paprs%flag,o_paprs%name, "Air pressure Inter-Couches", "Pa" )
1039 CALL histdef3d(iff,o_rneb%flag,o_rneb%name, "Cloud fraction", "-")
1040 CALL histdef3d(iff,o_rnebcon%flag,o_rnebcon%name, "Convective Cloud Fraction", "-")
1041 CALL histdef3d(iff,o_rhum%flag,o_rhum%name, "Relative humidity", "-")
1042 CALL histdef3d(iff,o_ozone%flag,o_ozone%name, "Ozone mole fraction", "-")
1043 if (read_climoz == 2) &
1044      CALL histdef3d(iff,o_ozone_light%flag,o_ozone_light%name, &
1045      "Daylight ozone mole fraction", "-")
1046 CALL histdef3d(iff,o_dtphy%flag,o_dtphy%name, "Physics dT", "K/s")
1047 CALL histdef3d(iff,o_dqphy%flag,o_dqphy%name, "Physics dQ", "(kg/kg)/s")
1048 CALL histdef3d(iff,o_cldtau%flag,o_cldtau%name, "Cloud optical thickness", "1")
1049 CALL histdef3d(iff,o_cldemi%flag,o_cldemi%name, "Cloud optical emissivity", "1")
1050!IM: bug ?? dimensionnement variables (klon,klev+1) pmflxr, pmflxs, prfl, psfl
1051 CALL histdef3d(iff,o_pr_con_l%flag,o_pr_con_l%name, "Convective precipitation lic", " ")
1052 CALL histdef3d(iff,o_pr_con_i%flag,o_pr_con_i%name, "Convective precipitation ice", " ")
1053 CALL histdef3d(iff,o_pr_lsc_l%flag,o_pr_lsc_l%name, "Large scale precipitation lic", " ")
1054 CALL histdef3d(iff,o_pr_lsc_i%flag,o_pr_lsc_i%name, "Large scale precipitation ice", " ")
1055!Cloud droplet effective radius
1056 CALL histdef3d(iff,o_re%flag,o_re%name, "Cloud droplet effective radius","um")
1057 CALL histdef3d(iff,o_fl%flag,o_fl%name, "Denominator of Cloud droplet effective radius"," ")
1058!FH Sorties pour la couche limite
1059     if (iflag_pbl>1) then
1060 CALL histdef3d(iff,o_tke%flag,o_tke%name, "TKE", "m2/s2")
1061   type_ecri(1) = 't_max(X)'
1062   type_ecri(2) = 't_max(X)'
1063   type_ecri(3) = 't_max(X)'
1064   type_ecri(4) = 't_max(X)'
1065   type_ecri(5) = 't_max(X)'
1066 CALL histdef3d(iff,o_tke_max%flag,o_tke_max%name, "TKE max", "m2/s2")
1067   type_ecri(:) = type_ecri_files(:)
1068     endif
1069
1070 CALL histdef3d(iff,o_kz%flag,o_kz%name, "Kz melange", "m2/s")
1071   type_ecri(1) = 't_max(X)'
1072   type_ecri(2) = 't_max(X)'
1073   type_ecri(3) = 't_max(X)'
1074   type_ecri(4) = 't_max(X)'
1075   type_ecri(5) = 't_max(X)'
1076 CALL histdef3d(iff,o_kz_max%flag,o_kz_max%name, "Kz melange max", "m2/s" )
1077   type_ecri(:) = type_ecri_files(:)
1078 CALL histdef3d(iff,o_clwcon%flag,o_clwcon%name, "Convective Cloud Liquid water content", "kg/kg")
1079 CALL histdef3d(iff,o_dtdyn%flag,o_dtdyn%name, "Dynamics dT", "K/s")
1080 CALL histdef3d(iff,o_dqdyn%flag,o_dqdyn%name, "Dynamics dQ", "(kg/kg)/s")
1081 CALL histdef3d(iff,o_dudyn%flag,o_dudyn%name, "Dynamics dU", "m/s2")
1082 CALL histdef3d(iff,o_dvdyn%flag,o_dvdyn%name, "Dynamics dV", "m/s2")
1083 CALL histdef3d(iff,o_dtcon%flag,o_dtcon%name, "Convection dT", "K/s")
1084 CALL histdef3d(iff,o_ducon%flag,o_ducon%name, "Convection du", "m/s2")
1085 CALL histdef3d(iff,o_dqcon%flag,o_dqcon%name, "Convection dQ", "(kg/kg)/s")
1086
1087! Wakes
1088 IF(iflag_con.EQ.3) THEN
1089 IF (iflag_wake == 1) THEN
1090   CALL histdef2d(iff,o_ale_wk%flag,o_ale_wk%name, "ALE WK", "m2/s2")
1091   CALL histdef2d(iff,o_alp_wk%flag,o_alp_wk%name, "ALP WK", "m2/s2")
1092   CALL histdef2d(iff,o_ale%flag,o_ale%name, "ALE", "m2/s2")
1093   CALL histdef2d(iff,o_alp%flag,o_alp%name, "ALP", "W/m2")
1094   CALL histdef2d(iff,o_cin%flag,o_cin%name, "Convective INhibition", "m2/s2")
1095   CALL histdef2d(iff,o_wape%flag,o_WAPE%name, "WAPE", "m2/s2")
1096   CALL histdef2d(iff,o_wake_h%flag,o_wake_h%name, "wake_h", "-")
1097   CALL histdef2d(iff,o_wake_s%flag,o_wake_s%name, "wake_s", "-")
1098   CALL histdef3d(iff,o_dtwak%flag,o_dtwak%name, "Wake dT", "K/s")
1099   CALL histdef3d(iff,o_dqwak%flag,o_dqwak%name, "Wake dQ", "(kg/kg)/s")
1100   CALL histdef3d(iff,o_wake_deltat%flag,o_wake_deltat%name, "wake_deltat", " ")
1101   CALL histdef3d(iff,o_wake_deltaq%flag,o_wake_deltaq%name, "wake_deltaq", " ")
1102   CALL histdef3d(iff,o_wake_omg%flag,o_wake_omg%name, "wake_omg", " ")
1103 ENDIF
1104   CALL histdef3d(iff,o_Vprecip%flag,o_Vprecip%name, "precipitation vertical profile", "-")
1105   CALL histdef3d(iff,o_ftd%flag,o_ftd%name, "tend temp due aux descentes precip", "-")
1106   CALL histdef3d(iff,o_fqd%flag,o_fqd%name,"tend vap eau due aux descentes precip", "-")
1107 ENDIF !(iflag_con.EQ.3)
1108
1109 CALL histdef3d(iff,o_dtlsc%flag,o_dtlsc%name, "Condensation dT", "K/s")
1110 CALL histdef3d(iff,o_dtlschr%flag,o_dtlschr%name,"Large-scale condensational heating rate","K/s")
1111 CALL histdef3d(iff,o_dqlsc%flag,o_dqlsc%name, "Condensation dQ", "(kg/kg)/s")
1112 CALL histdef3d(iff,o_dtvdf%flag,o_dtvdf%name, "Boundary-layer dT", "K/s")
1113 CALL histdef3d(iff,o_dqvdf%flag,o_dqvdf%name, "Boundary-layer dQ", "(kg/kg)/s")
1114 CALL histdef3d(iff,o_dteva%flag,o_dteva%name, "Reevaporation dT", "K/s")
1115 CALL histdef3d(iff,o_dqeva%flag,o_dqeva%name, "Reevaporation dQ", "(kg/kg)/s")
1116 CALL histdef3d(iff,o_ptconv%flag,o_ptconv%name, "POINTS CONVECTIFS", " ")
1117 CALL histdef3d(iff,o_ratqs%flag,o_ratqs%name, "RATQS", " ")
1118 CALL histdef3d(iff,o_dtthe%flag,o_dtthe%name, "Dry adjust. dT", "K/s")
1119
1120if(iflag_thermals.gt.1) THEN
1121 CALL histdef3d(iff,o_f_th%flag,o_f_th%name, "Thermal plume mass flux", "K/s")
1122 CALL histdef3d(iff,o_e_th%flag,o_e_th%name,"Thermal plume entrainment","K/s")
1123 CALL histdef3d(iff,o_w_th%flag,o_w_th%name,"Thermal plume vertical velocity","m/s")
1124 CALL histdef3d(iff,o_lambda_th%flag,o_lambda_th%name,"Thermal plume vertical velocity","m/s")
1125 CALL histdef2d(iff,o_ftime_th%flag,o_ftime_th%name,"Fraction of time Shallow convection occurs"," ")
1126 CALL histdef3d(iff,o_q_th%flag,o_q_th%name, "Thermal plume total humidity", "kg/kg")
1127 CALL histdef3d(iff,o_a_th%flag,o_a_th%name, "Thermal plume fraction", "")
1128 CALL histdef3d(iff,o_d_th%flag,o_d_th%name, "Thermal plume detrainment", "K/s")
1129endif !iflag_thermals.gt.1
1130 CALL histdef2d(iff,o_f0_th%flag,o_f0_th%name, "Thermal closure mass flux", "K/s")
1131 CALL histdef2d(iff,o_zmax_th%flag,o_zmax_th%name, "Thermal plume height", "K/s")
1132 CALL histdef3d(iff,o_dqthe%flag,o_dqthe%name, "Dry adjust. dQ", "(kg/kg)/s")
1133 CALL histdef3d(iff,o_dtajs%flag,o_dtajs%name, "Dry adjust. dT", "K/s")
1134 CALL histdef3d(iff,o_dqajs%flag,o_dqajs%name, "Dry adjust. dQ", "(kg/kg)/s")
1135 CALL histdef3d(iff,o_dtswr%flag,o_dtswr%name, "SW radiation dT", "K/s")
1136 CALL histdef3d(iff,o_dtsw0%flag,o_dtsw0%name, "CS SW radiation dT", "K/s")
1137 CALL histdef3d(iff,o_dtlwr%flag,o_dtlwr%name, "LW radiation dT", "K/s")
1138 CALL histdef3d(iff,o_dtlw0%flag,o_dtlw0%name, "CS LW radiation dT", "K/s")
1139 CALL histdef3d(iff,o_dtec%flag,o_dtec%name, "Cinetic dissip dT", "K/s")
1140 CALL histdef3d(iff,o_duvdf%flag,o_duvdf%name, "Boundary-layer dU", "m/s2")
1141 CALL histdef3d(iff,o_dvvdf%flag,o_dvvdf%name, "Boundary-layer dV", "m/s2")
1142
1143     IF (ok_orodr) THEN
1144 CALL histdef3d(iff,o_duoro%flag,o_duoro%name, "Orography dU", "m/s2")
1145 CALL histdef3d(iff,o_dvoro%flag,o_dvoro%name, "Orography dV", "m/s2")
1146     ENDIF
1147
1148     IF (ok_orolf) THEN
1149 CALL histdef3d(iff,o_dulif%flag,o_dulif%name, "Orography dU", "m/s2")
1150 CALL histdef3d(iff,o_dvlif%flag,o_dvlif%name, "Orography dV", "m/s2")
1151     ENDIF
1152
1153      if (nqtot>=3) THEN
1154!Attention    DO iq=3,nqtot
1155    DO iq=3,4 
1156       iiq=niadv(iq)
1157! CALL histdef3d (iff, o_trac%flag,'o_'//tnom(iq)%name,ttext(iiq), "-" )
1158  CALL histdef3d (iff, o_trac(iq-2)%flag,o_trac(iq-2)%name,ttext(iiq), "-" )
1159    ENDDO
1160      endif
1161
1162        CALL histend(nid_files(iff))
1163
1164         ndex2d = 0
1165         ndex3d = 0
1166
1167         ENDIF ! clef_files
1168
1169         ENDDO !  iff
1170     print*,'Fin phys_output_mod.F90'
1171      end subroutine phys_output_open
1172
1173      SUBROUTINE histdef2d (iff,flag_var,nomvar,titrevar,unitvar)
1174     
1175       use ioipsl
1176       USE dimphy
1177       USE mod_phys_lmdz_para
1178
1179       IMPLICIT NONE
1180       
1181       include "dimensions.h"
1182       include "temps.h"
1183       include "indicesol.h"
1184       include "clesphys.h"
1185
1186       integer                          :: iff
1187       integer, dimension(nfiles)       :: flag_var
1188       character(len=20)                 :: nomvar
1189       character(len=*)                 :: titrevar
1190       character(len=*)                 :: unitvar
1191
1192       real zstophym
1193
1194       if (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') then
1195         zstophym=zoutm(iff)
1196       else
1197         zstophym=zdtime
1198       endif
1199
1200! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
1201       call conf_physoutputs(nomvar,flag_var)
1202       
1203       if ( flag_var(iff)<=lev_files(iff) ) then
1204 call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
1205               iim,jj_nb,nhorim(iff), 1,1,1, -99, 32, &
1206               type_ecri(iff), zstophym,zoutm(iff))               
1207       endif                     
1208      end subroutine histdef2d
1209
1210      SUBROUTINE histdef3d (iff,flag_var,nomvar,titrevar,unitvar)
1211
1212       use ioipsl
1213       USE dimphy
1214       USE mod_phys_lmdz_para
1215
1216       IMPLICIT NONE
1217
1218       include "dimensions.h"
1219       include "temps.h"
1220       include "indicesol.h"
1221       include "clesphys.h"
1222
1223       integer                          :: iff
1224       integer, dimension(nfiles)       :: flag_var
1225       character(len=20)                 :: nomvar
1226       character(len=*)                 :: titrevar
1227       character(len=*)                 :: unitvar
1228
1229       real zstophym
1230
1231! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
1232       call conf_physoutputs(nomvar,flag_var)
1233
1234       if (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') then
1235         zstophym=zoutm(iff)
1236       else
1237         zstophym=zdtime
1238       endif
1239
1240       if ( flag_var(iff)<=lev_files(iff) ) then
1241          call histdef (nid_files(iff), nomvar, titrevar, unitvar, &
1242               iim, jj_nb, nhorim(iff), klev, levmin(iff), &
1243               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, type_ecri(iff), &
1244               zstophym, zoutm(iff))
1245       endif
1246      end subroutine histdef3d
1247
1248      SUBROUTINE conf_physoutputs(nam_var,flag_var)
1249!!! Lecture des noms et niveau de sortie des variables dans output.def
1250!   en utilisant les routines getin de IOIPSL 
1251       use ioipsl
1252
1253       IMPLICIT NONE
1254
1255       include 'iniprint.h'
1256
1257       character(len=20)                :: nam_var
1258       integer, dimension(nfiles)      :: flag_var
1259
1260        IF(prt_level>10) WRITE(lunout,*)'Avant getin: nam_var flag_var ',nam_var,flag_var(:)
1261        call getin('flag_'//nam_var,flag_var)
1262        call getin('name_'//nam_var,nam_var)
1263        IF(prt_level>10) WRITE(lunout,*)'Apres getin: nam_var flag_var ',nam_var,flag_var(:)
1264
1265      END SUBROUTINE conf_physoutputs
1266
1267      SUBROUTINE convers_timesteps(str,timestep)
1268
1269        use ioipsl
1270
1271        IMPLICIT NONE
1272
1273        character(len=20)   :: str
1274        character(len=10)   :: type
1275        integer             :: ipos,il
1276        real                :: ttt,xxx,timestep,dayseconde
1277        parameter (dayseconde=86400.)
1278        include "temps.h"
1279        include "comconst.h"
1280
1281        ipos=scan(str,'0123456789.',.true.)
1282
1283        il=len_trim(str)
1284        print*,ipos,il
1285        read(str(1:ipos),*) ttt
1286        print*,ttt
1287        type=str(ipos+1:il)
1288
1289
1290        if ( il == ipos ) then
1291        type='day'
1292        endif
1293
1294        if ( type == 'day'.or.type == 'days'.or.type == 'jours'.or.type == 'jour' ) timestep = ttt * dayseconde
1295        if ( type == 'mounths'.or.type == 'mth'.or.type == 'mois' ) then
1296           print*,'annee_ref,day_ref mon_len',annee_ref,day_ref,ioget_mon_len(annee_ref,day_ref)
1297           timestep = ttt * dayseconde * ioget_mon_len(annee_ref,day_ref)
1298        endif
1299        if ( type == 'hours'.or.type == 'hr'.or.type == 'heurs') timestep = ttt * dayseconde / 24.
1300        if ( type == 'mn'.or.type == 'minutes'  ) timestep = ttt * 60.
1301        if ( type == 's'.or.type == 'sec'.or.type == 'secondes'   ) timestep = ttt
1302        if ( type == 'TS' ) timestep = dtphys
1303
1304        print*,'type =      ',type
1305        print*,'nb j/h/m =  ',ttt
1306        print*,'timestep(s)=',timestep
1307
1308        END SUBROUTINE convers_timesteps
1309
1310END MODULE phys_output_mod
1311
Note: See TracBrowser for help on using the repository browser.