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

Last change on this file since 1040 was 1036, checked in by lmdzadmin, 16 years ago

Correction AI: aire et contfracATM : ecriture une fois (once)
Correction IM: ecriture meantaucld a la frequence d'appel du simulateur ISCCP
AI/IM

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 43.1 KB
Line 
1! Abderrahmane 12 2007
2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3!!! Ecreture des Sorties du modele dans les fichiers Netcdf :
4! histmth.nc : moyennes mensuelles
5! histday.nc : moyennes journalieres
6! histhf.nc  : moyennes toutes les 3 heures
7! histins.nc : valeurs instantanees
8!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9
10MODULE phys_output_mod
11
12  IMPLICIT NONE
13
14   integer, parameter                           :: nfiles = 4
15   logical, dimension(nfiles), save             :: clef_files
16   integer, dimension(nfiles), save             :: lev_files
17   integer, dimension(nfiles), save             :: nid_files
18
19   integer, dimension(nfiles), save             :: nhorim, nvertm
20   real, dimension(nfiles), save                :: zstophym, zoutm
21   CHARACTER(len=20), dimension(nfiles), save   :: type_ecri
22
23!   integer, save                     :: nid_hf3d
24
25!!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
26!                 entre [lonmin_reg,lonmax_reg] et [latmin_reg,latmax_reg]
27
28  logical, dimension(nfiles), save  :: ok_reglim         = (/ .false., .false., .false., .false. /)
29  real, dimension(nfiles), save     :: lonmin_reg        = (/ 0., -45., 0., 0. /)
30  real, dimension(nfiles), save     :: lonmax_reg        = (/ 90., 45., 90., 90. /)
31  real, dimension(nfiles), save     :: latmin_reg        = (/ 0., -45., 0., 0. /)
32  real, dimension(nfiles), save     :: latmax_reg        = (/ 90., 90., 90., 90. /)
33
34!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35!! Definition pour chaque variable du niveau d ecriture dans chaque fichier
36!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!/ histmth, histday, histhf, histins /)!!!!!!!!!!!!
37!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38
39!!! 1D
40  integer, dimension(nfiles) , save :: flag_phis         = (/ 1, 1, 10, 1 /)
41  integer, dimension(nfiles) , save :: flag_aire         = (/ 1, 1, 10,  1 /)
42  integer, dimension(nfiles) , save :: flag_contfracATM  = (/ 10, 1,  1, 10 /)
43  integer, dimension(nfiles) , save :: flag_contfracOR   = (/ 10, 1,  1, 10 /)
44  integer, dimension(nfiles) , save :: flag_aireTER      = (/ 10, 10, 1, 10 /)
45 
46!!! 2D
47  integer, dimension(nfiles) , save :: flag_flat         = (/ 10, 1, 10, 10 /)
48  integer, dimension(nfiles) , save :: flag_slp          = (/ 1, 1, 1, 10 /)
49  integer, dimension(nfiles) , save :: flag_tsol         = (/ 1, 1, 1, 1 /)
50  integer, dimension(nfiles) , save :: flag_t2m          = (/ 1, 1, 1, 1 /)
51  integer, dimension(nfiles) , save :: flag_t2m_min      = (/ 1, 1, 10, 10 /)
52  integer, dimension(nfiles) , save :: flag_t2m_max      = (/ 1, 1, 10, 10 /)
53  integer, dimension(nfiles) , save :: flag_t2m_sol      = (/ 10, 4, 10, 10 /)
54  integer, dimension(nfiles) , save :: flag_wind10m      = (/ 1, 1, 1, 10 /)
55  integer, dimension(nfiles) , save :: flag_wind10max    = (/ 10, 1, 10, 10 /)
56  integer, dimension(nfiles) , save :: flag_sicf         = (/ 1, 1, 10, 10 /)
57  integer, dimension(nfiles) , save :: flag_q2m          = (/ 1, 1, 1, 1 /)
58  integer, dimension(nfiles) , save :: flag_u10m         = (/ 1, 1, 1, 1 /)
59  integer, dimension(nfiles) , save :: flag_v10m         = (/ 1, 1, 1, 1 /)
60  integer, dimension(nfiles) , save :: flag_psol         = (/ 1, 1, 1, 1 /)
61  integer, dimension(nfiles) , save :: flag_qsurf        = (/ 1, 10, 10, 10 /)
62
63  integer, dimension(nfiles) , save :: flag_u10m_sol     = (/ 10, 4, 10, 10 /)
64  integer, dimension(nfiles) , save :: flag_v10m_sol     = (/ 10, 4, 10, 10 /)
65
66  integer, dimension(nfiles) , save :: flag_qsol         = (/ 1, 10, 10, 1 /)
67
68  integer, dimension(nfiles),save   :: flag_ndayrain     = (/ 1, 10, 10, 10 /)
69  integer, dimension(nfiles),save   :: flag_precip       = (/ 1, 1, 1, 1 /)
70  integer,  dimension(nfiles), save :: flag_plul         = (/ 1, 1, 1, 1 /)
71
72  integer, dimension(nfiles) , save :: flag_pluc         = (/ 1, 1, 1, 1 /)
73  integer, dimension(nfiles) , save :: flag_snow         = (/ 1, 1, 10, 1 /)
74  integer, dimension(nfiles) , save :: flag_evap         = (/ 1, 1, 10, 1 /)
75  integer, dimension(nfiles) , save :: flag_tops         = (/ 1, 1, 10, 10 /)
76  integer, dimension(nfiles) , save :: flag_tops0        = (/ 1, 5, 10, 10 /)
77  integer, dimension(nfiles) , save :: flag_topl         = (/ 1, 1, 10, 1 /)
78  integer, dimension(nfiles) , save :: flag_topl0        = (/ 1, 5, 10, 10 /)
79  integer, dimension(nfiles) , save :: flag_SWupTOA      = (/ 1, 4, 10, 10 /)
80  integer, dimension(nfiles) , save :: flag_SWupTOAclr   = (/ 1, 4, 10, 10 /)
81  integer, dimension(nfiles) , save :: flag_SWdnTOA      = (/ 1, 4, 10, 10 /)
82  integer, dimension(nfiles) , save :: flag_SWdnTOAclr   = (/ 1, 4, 10, 10 /)
83  integer, dimension(nfiles) , save :: flag_SWup200      = (/ 1, 10, 10, 10 /)
84  integer, dimension(nfiles) , save :: flag_SWup200clr   = (/ 10, 1, 10, 10 /)
85  integer, dimension(nfiles) , save :: flag_SWdn200      = (/ 1, 10, 10, 10 /)
86  integer, dimension(nfiles) , save :: flag_SWdn200clr   = (/ 10, 1, 10, 10 /)
87
88! arajouter
89!  integer, dimension(nfiles) , save :: flag_LWupTOA     = (/ 1, 4, 10, 10 /)
90!  integer, dimension(nfiles) , save :: flag_LWupTOAclr  = (/ 1, 4, 10, 10 /)
91!  integer, dimension(nfiles) , save :: flag_LWdnTOA     = (/ 1, 4, 10, 10 /)
92!  integer, dimension(nfiles) , save :: flag_LWdnTOAclr  = (/ 1, 4, 10, 10 /)
93
94  integer, dimension(nfiles) , save :: flag_LWup200      = (/ 1, 10, 10, 10 /)
95  integer, dimension(nfiles) , save :: flag_LWup200clr   = (/ 1, 10, 10, 10 /)
96  integer, dimension(nfiles) , save :: flag_LWdn200      = (/ 1, 10, 10, 10 /)
97  integer, dimension(nfiles) , save :: flag_LWdn200clr   = (/ 1, 10, 10, 10 /)
98  integer, dimension(nfiles) , save :: flag_sols         = (/ 1, 1, 10, 1 /)
99  integer, dimension(nfiles) , save :: flag_sols0        = (/ 1, 5, 10, 10 /)
100  integer, dimension(nfiles) , save :: flag_soll         = (/ 1, 1, 10, 1 /)
101  integer, dimension(nfiles) , save :: flag_soll0        = (/ 1, 5, 10, 10 /)
102  integer, dimension(nfiles) , save :: flag_radsol       = (/ 1, 1, 10, 10 /)
103  integer, dimension(nfiles) , save :: flag_SWupSFC      = (/ 1, 4, 10, 10 /)
104  integer, dimension(nfiles) , save :: flag_SWupSFCclr   = (/ 1, 4, 10, 10 /)
105  integer, dimension(nfiles) , save :: flag_SWdnSFC      = (/ 1, 1, 10, 10 /)
106  integer, dimension(nfiles) , save :: flag_SWdnSFCclr   = (/ 1, 4, 10, 10 /)
107  integer, dimension(nfiles) , save :: flag_LWupSFC      = (/ 1, 4, 10, 10 /)
108  integer, dimension(nfiles) , save :: flag_LWupSFCclr   = (/ 1, 4, 10, 10 /)
109  integer, dimension(nfiles) , save :: flag_LWdnSFC      = (/ 1, 4, 10, 10 /)
110  integer, dimension(nfiles) , save :: flag_LWdnSFCclr   = (/ 1, 4, 10, 10 /)
111  integer, dimension(nfiles) , save :: flag_bils         = (/ 1, 2, 10, 1 /)
112  integer, dimension(nfiles) , save :: flag_sens         = (/ 1, 1, 10, 1 /)
113  integer, dimension(nfiles) , save :: flag_fder         = (/ 1, 2, 10, 1 /)
114  integer, dimension(nfiles) , save :: flag_ffonte       = (/ 1, 10, 10, 10 /)
115  integer, dimension(nfiles) , save :: flag_fqcalving    = (/ 1, 10, 10, 10 /)
116  integer, dimension(nfiles) , save :: flag_fqfonte      = (/ 1, 10, 10, 10 /)
117
118  integer, dimension(nfiles) , save :: flag_taux_sol     = (/ 1, 4, 10, 1 /)
119  integer, dimension(nfiles) , save :: flag_tauy_sol     = (/ 1, 4, 10, 1 /)
120
121  integer, dimension(nfiles) , save :: flag_pourc_sol    = (/ 1, 4, 10, 1 /)
122  integer, dimension(nfiles) , save :: flag_fract_sol    = (/ 1, 4, 10, 1 /)
123  integer, dimension(nfiles) , save :: flag_tsol_sol     = (/ 1, 4, 10, 1 /)
124  integer, dimension(nfiles) , save :: flag_sens_sol     = (/ 1, 4, 10, 1 /)
125  integer, dimension(nfiles) , save :: flag_lat_sol      = (/ 1, 4, 10, 1 /)
126  integer, dimension(nfiles) , save :: flag_flw_sol      = (/ 1, 10, 10, 10 /)
127  integer, dimension(nfiles) , save :: flag_fsw_sol      = (/ 1, 10, 10, 10 /)
128  integer, dimension(nfiles) , save :: flag_wbils_sol    = (/ 1, 10, 10, 10 /)
129  integer, dimension(nfiles) , save :: flag_wbilo_sol    = (/ 1, 10, 10, 10 /)
130
131  integer, dimension(nfiles) , save :: flag_cdrm         = (/ 1, 10, 10, 1 /)
132  integer, dimension(nfiles) , save :: flag_cdrh         = (/ 1, 10, 10, 1 /)
133  integer, dimension(nfiles) , save :: flag_cldl         = (/ 1, 1, 10, 10 /)
134  integer, dimension(nfiles) , save :: flag_cldm         = (/ 1, 1, 10, 10 /)
135  integer, dimension(nfiles) , save :: flag_cldh         = (/ 1, 1, 10, 10 /)
136  integer, dimension(nfiles) , save :: flag_cldt         = (/ 1, 1, 2, 10 /)
137  integer, dimension(nfiles) , save :: flag_cldq         = (/ 1, 1, 10, 10 /)
138  integer, dimension(nfiles) , save :: flag_lwp          = (/ 1, 5, 10, 10 /)
139  integer, dimension(nfiles) , save :: flag_iwp          = (/ 1, 5, 10, 10 /)
140  integer, dimension(nfiles) , save :: flag_ue           = (/ 1, 10, 10, 10 /)
141  integer, dimension(nfiles) , save :: flag_ve           = (/ 1, 10, 10, 10 /)
142  integer, dimension(nfiles) , save :: flag_uq           = (/ 1, 10, 10, 10 /)
143  integer, dimension(nfiles) , save :: flag_vq           = (/ 1, 10, 10, 10 /)
144 
145  integer, dimension(nfiles) , save :: flag_cape         = (/ 1, 10, 10, 10 /)
146  integer, dimension(nfiles) , save :: flag_pbase        = (/ 1, 10, 10, 10 /)
147  integer, dimension(nfiles) , save :: flag_ptop         = (/ 1, 4, 10, 10 /)
148  integer, dimension(nfiles) , save :: flag_fbase        = (/ 1, 10, 10, 10 /)
149  integer, dimension(nfiles) , save :: flag_prw          = (/ 1, 1, 10, 10 /)
150
151  integer, dimension(nfiles) , save :: flag_s_pblh       = (/ 1, 10, 10, 1 /)
152  integer, dimension(nfiles) , save :: flag_s_pblt       = (/ 1, 10, 10, 1 /)
153  integer, dimension(nfiles) , save :: flag_s_lcl       = (/ 1, 10, 10, 1 /)
154  integer, dimension(nfiles) , save :: flag_s_capCL      = (/ 1, 10, 10, 1 /)
155  integer, dimension(nfiles) , save :: flag_s_oliqCL    = (/ 1, 10, 10, 1 /)
156  integer, dimension(nfiles) , save :: flag_s_cteiCL     = (/ 1, 10, 10, 1 /)
157  integer, dimension(nfiles) , save :: flag_s_therm      = (/ 1, 10, 10, 1 /)
158  integer, dimension(nfiles) , save :: flag_s_trmb1      = (/ 1, 10, 10, 1 /)
159  integer, dimension(nfiles) , save :: flag_s_trmb2      = (/ 1, 10, 10, 1 /)
160  integer, dimension(nfiles) , save :: flag_s_trmb3      = (/ 1, 10, 10, 1 /)
161
162  integer, dimension(nfiles) , save :: flag_slab_bils    = (/ 1, 1, 10, 10 /)
163
164  integer, dimension(nfiles) , save :: flag_ale_bl    = (/ 1, 1, 1, 1 /)
165  integer, dimension(nfiles) , save :: flag_alp_bl    = (/ 1, 1, 1, 1 /)
166  integer, dimension(nfiles) , save :: flag_ale_wk    = (/ 1, 1, 1, 1 /)
167  integer, dimension(nfiles) , save :: flag_alp_wk    = (/ 1, 1, 1, 1 /)
168
169  integer, dimension(nfiles) , save :: flag_ale       = (/ 1, 1, 1, 1 /)
170  integer, dimension(nfiles) , save :: flag_alp       = (/ 1, 1, 1, 1 /)
171  integer, dimension(nfiles) , save :: flag_cin       = (/ 1, 1, 1, 1 /)
172  integer, dimension(nfiles) , save :: flag_wape       = (/ 1, 1, 1, 1 /)
173
174
175! Champs interpolles sur des niveaux de pression ??? a faire correctement
176! if=1 on ecrit u v w phi sur 850 700 500 200 au niv 1
177! if=2 on ecrit w et ph 500 seulement au niv 1
178!        et u v sur 850 700 500 200
179! if=3 on ecrit ph a 500 seulement au niv 1
180!      on ecrit u v t q a 850 700 500 200 au niv 3
181!      on ecrit ph  a 500   au niv 3
182
183  integer, dimension(nfiles) , save :: flag_ulevsSTD     = (/ 1, 1, 3, 10 /)
184  integer, dimension(nfiles) , save :: flag_vlevsSTD     = (/ 1, 1, 3, 10 /)
185  integer, dimension(nfiles) , save :: flag_wlevsSTD     = (/ 1, 1, 10, 10 /)
186  integer, dimension(nfiles) , save :: flag_tlevsSTD     = (/ 10, 10, 3, 10 /)
187  integer, dimension(nfiles) , save :: flag_qlevsSTD     = (/ 10, 10, 3, 10 /)
188  integer, dimension(nfiles) , save :: flag_philevsSTD   = (/ 1, 1, 1, 10 /)
189
190  integer, dimension(nfiles) , save :: flag_t_oce_sic    = (/ 1, 10, 10, 10 /)
191
192  integer, dimension(nfiles) , save :: flag_weakinv      = (/ 10, 1, 10, 10 /)
193  integer, dimension(nfiles) , save :: flag_dthmin       = (/ 10, 1, 10, 10 /)
194  integer, dimension(nfiles) , save :: flag_u10_sol      = (/ 10, 4, 10, 10 /)
195  integer, dimension(nfiles) , save :: flag_v10_sol      = (/ 10, 4, 10, 10 /)
196  integer, dimension(nfiles) , save :: flag_meantaucld   = (/ 10, 5, 10, 10 /)
197  integer, dimension(nfiles) , save :: flag_cldtau       = (/ 10, 5, 10, 10 /)                     
198  integer, dimension(nfiles) , save :: flag_cldemi       = (/ 10, 5, 10, 10 /)
199  integer, dimension(nfiles) , save :: flag_rh2m         = (/ 10, 5, 10, 10 /)
200  integer, dimension(nfiles) , save :: flag_qsat2m       = (/ 10, 5, 10, 10 /)
201  integer, dimension(nfiles) , save :: flag_tpot         = (/ 10, 5, 10, 10 /)
202  integer, dimension(nfiles) , save :: flag_tpote        = (/ 10, 5, 10, 10 /)
203  integer, dimension(nfiles) , save :: flag_tke          = (/ 4, 10, 10, 10 /)
204  integer, dimension(nfiles) , save :: flag_tke_max      = (/ 4, 10, 10, 10 /)
205  integer, dimension(nfiles) , save :: flag_tke_sol      = (/ 10, 4, 10, 10 /)
206  integer, dimension(nfiles) , save :: flag_tke_max_sol  = (/ 10, 4, 10, 10 /)
207  integer, dimension(nfiles) , save :: flag_kz           = (/ 4, 10, 10, 10 /)
208  integer, dimension(nfiles) , save :: flag_kz_max       = (/ 4, 10, 10, 10 /)
209  integer, dimension(nfiles) , save :: flag_SWnetOR      = (/ 10, 10, 2, 10 /)
210  integer, dimension(nfiles) , save :: flag_SWdownOR     = (/ 10, 10, 2, 10 /)
211  integer, dimension(nfiles) , save :: flag_LWdownOR     = (/ 10, 10, 2, 10 /)
212
213  integer, dimension(nfiles) , save :: flag_snowl         = (/ 10, 1, 10, 10 /)
214  integer, dimension(nfiles) , save :: flag_cape_max      = (/ 10, 1, 10, 10 /)
215  integer, dimension(nfiles) , save :: flag_solldown      = (/ 10, 1, 10, 1 /)
216
217  integer, dimension(nfiles) , save :: flag_dtsvdfo       = (/ 10, 10, 10, 1 /)
218  integer, dimension(nfiles) , save :: flag_dtsvdft       = (/ 10, 10, 10, 1 /)
219  integer, dimension(nfiles) , save :: flag_dtsvdfg       = (/ 10, 10, 10, 1 /)
220  integer, dimension(nfiles) , save :: flag_dtsvdfi       = (/ 10, 10, 10, 1 /)
221  integer, dimension(nfiles) , save :: flag_rugs          = (/ 10, 10, 10, 1 /)
222
223!!!!!!!!!!!!!!!!!!!!!! 3D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
224  integer, dimension(nfiles) , save :: flag_lwcon        = (/ 2, 5, 10, 10 /)
225  integer, dimension(nfiles) , save :: flag_iwcon        = (/ 2, 5, 10, 10 /)
226  integer, dimension(nfiles) , save :: flag_temp         = (/ 2, 3, 4, 1 /)
227  integer, dimension(nfiles) , save :: flag_theta         = (/ 2, 3, 4, 1 /)
228  integer, dimension(nfiles) , save :: flag_ovap         = (/ 2, 3, 4, 1 /)
229  integer, dimension(nfiles) , save :: flag_wvapp        = (/ 2, 10, 10, 10 /)
230  integer, dimension(nfiles) , save :: flag_geop         = (/ 2, 3, 10, 1 /)
231  integer, dimension(nfiles) , save :: flag_vitu         = (/ 2, 3, 4, 1 /)
232  integer, dimension(nfiles) , save :: flag_vitv         = (/ 2, 3, 4, 1 /)
233  integer, dimension(nfiles) , save :: flag_vitw         = (/ 2, 3, 10, 10 /)
234  integer, dimension(nfiles) , save :: flag_pres         = (/ 2, 3, 10, 1 /)
235  integer, dimension(nfiles) , save :: flag_rneb         = (/ 2, 5, 10, 10 /)
236  integer, dimension(nfiles) , save :: flag_rnebcon      = (/ 2, 5, 10, 10 /)
237  integer, dimension(nfiles) , save :: flag_rhum         = (/ 2, 10, 10, 10 /)
238  integer, dimension(nfiles) , save :: flag_ozone        = (/ 2, 10, 10, 10 /)
239  integer, dimension(nfiles) , save :: flag_upwd         = (/ 2, 10, 10, 10 /)
240  integer, dimension(nfiles) , save :: flag_dtphy        = (/ 2, 10, 10, 10 /)
241  integer, dimension(nfiles) , save :: flag_dqphy        = (/ 2, 10, 10, 10 /)
242  integer, dimension(nfiles) , save :: flag_pr_con_l     = (/ 2, 10, 10, 10 /)
243  integer, dimension(nfiles) , save :: flag_pr_con_i     = (/ 2, 10, 10, 10 /)
244  integer, dimension(nfiles) , save :: flag_pr_lsc_l     = (/ 2, 10, 10, 10 /)
245  integer, dimension(nfiles) , save :: flag_pr_lsc_i     = (/ 2, 10, 10, 10 /)
246!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
247
248  integer, dimension(nfiles) , save :: flag_albe_sol     = (/ 3, 4, 10, 1 /)
249  integer, dimension(nfiles) , save :: flag_ages_sol     = (/ 3, 10, 10, 10 /)
250  integer, dimension(nfiles) , save :: flag_rugs_sol     = (/ 3, 4, 10, 1 /)
251
252  integer, dimension(nfiles) , save :: flag_albs         = (/ 3, 10, 10, 1 /)
253  integer, dimension(nfiles) , save :: flag_albslw       = (/ 3, 10, 10, 1 /)
254
255  integer, dimension(nfiles) , save :: flag_clwcon       = (/ 4, 10, 10, 10 /)
256  integer, dimension(nfiles) , save :: flag_Ma           = (/ 4, 10, 10, 10 /)
257  integer, dimension(nfiles) , save :: flag_dnwd         = (/ 4, 10, 10, 10 /)
258  integer, dimension(nfiles) , save :: flag_dnwd0        = (/ 4, 10, 10, 10 /)
259  integer, dimension(nfiles) , save :: flag_dtdyn        = (/ 4, 10, 10, 10 /)
260  integer, dimension(nfiles) , save :: flag_dqdyn        = (/ 4, 10, 10, 10 /)
261  integer, dimension(nfiles) , save :: flag_dtcon        = (/ 4, 5, 10, 10 /)
262  integer, dimension(nfiles) , save :: flag_ducon        = (/ 4, 10, 10, 10 /)
263  integer, dimension(nfiles) , save :: flag_dqcon        = (/ 4, 5, 10, 10 /)
264  integer, dimension(nfiles) , save :: flag_dtwak        = (/ 4, 5, 10, 10 /)
265  integer, dimension(nfiles) , save :: flag_dqwak        = (/ 4, 5, 10, 10 /)
266  integer, dimension(nfiles) , save :: flag_dtlsc        = (/ 4, 10, 10, 10 /)
267  integer, dimension(nfiles) , save :: flag_dtlschr      = (/ 4, 10, 10, 10 /)
268  integer, dimension(nfiles) , save :: flag_dqlsc        = (/ 4, 10, 10, 10 /)
269  integer, dimension(nfiles) , save :: flag_dtvdf        = (/ 4, 10, 10, 1 /)
270  integer, dimension(nfiles) , save :: flag_dqvdf        = (/ 4, 10, 10, 1 /)
271  integer, dimension(nfiles) , save :: flag_dteva        = (/ 4, 10, 10, 10 /)
272  integer, dimension(nfiles) , save :: flag_dqeva        = (/ 4, 10, 10, 10 /)
273  integer, dimension(nfiles) , save :: flag_ptconv       = (/ 4, 10, 10, 10 /)
274  integer, dimension(nfiles) , save :: flag_ratqs        = (/ 4, 10, 10, 10 /)
275  integer, dimension(nfiles) , save :: flag_dtthe        = (/ 4, 10, 10, 10 /)
276  integer, dimension(nfiles) , save :: flag_f_th        = (/ 4, 10, 10, 10 /)
277  integer, dimension(nfiles) , save :: flag_e_th        = (/ 4, 10, 10, 10 /)
278  integer, dimension(nfiles) , save :: flag_w_th        = (/ 4, 10, 10, 10 /)
279  integer, dimension(nfiles) , save :: flag_lambda_th        = (/ 4, 10, 10, 10 /)
280  integer, dimension(nfiles) , save :: flag_q_th        = (/ 4, 10, 10, 10 /)
281  integer, dimension(nfiles) , save :: flag_a_th        = (/ 4, 10, 10, 10 /)
282  integer, dimension(nfiles) , save :: flag_d_th        = (/ 4, 10, 10, 10 /)
283  integer, dimension(nfiles) , save :: flag_f0_th        = (/ 4, 10, 10, 10 /)
284  integer, dimension(nfiles) , save :: flag_zmax_th        = (/ 4, 10, 10, 10 /)
285  integer, dimension(nfiles) , save :: flag_dqthe        = (/ 4, 10, 10, 10 /)
286  integer, dimension(nfiles) , save :: flag_dtajs        = (/ 4, 10, 10, 10 /)
287  integer, dimension(nfiles) , save :: flag_dqajs        = (/ 4, 10, 10, 10 /)
288  integer, dimension(nfiles) , save :: flag_dtswr        = (/ 4, 10, 10, 10 /)
289  integer, dimension(nfiles) , save :: flag_dtsw0        = (/ 4, 10, 10, 10 /)
290  integer, dimension(nfiles) , save :: flag_dtlwr        = (/ 4, 10, 10, 10 /)
291  integer, dimension(nfiles) , save :: flag_dtlw0        = (/ 4, 10, 10, 10 /)
292  integer, dimension(nfiles) , save :: flag_dtec         = (/ 4, 10, 10, 10 /)
293  integer, dimension(nfiles) , save :: flag_duvdf        = (/ 4, 10, 10, 10 /)
294  integer, dimension(nfiles) , save :: flag_dvvdf        = (/ 4, 10, 10, 10 /)
295  integer, dimension(nfiles) , save :: flag_duoro        = (/ 4, 10, 10, 10 /)
296  integer, dimension(nfiles) , save :: flag_dvoro        = (/ 4, 10, 10, 10 /)
297  integer, dimension(nfiles) , save :: flag_dulif        = (/ 4, 10, 10, 10 /)
298  integer, dimension(nfiles) , save :: flag_dvlif        = (/ 4, 10, 10, 10 /)
299  integer, dimension(nfiles) , save :: flag_trac         = (/ 4, 10, 10, 10 /)
300
301    CONTAINS
302
303!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
304!!!!!!!!! Ouverture des fichier et definition des variable de sortie !!!!!!!!
305!! histbeg, histvert et histdef
306!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
307 
308  SUBROUTINE phys_output_open(jjmp1,nqmax,nlevSTD,clevSTD,nbteta, &
309                              ctetaSTD,dtime, presnivs, ok_veget, &
310                              ocean, iflag_pbl,ok_mensuel,ok_journe, &
311                              ok_hf,ok_instan, nid_fil)
312
313  USE iophy
314  USE dimphy
315  USE ioipsl
316  USE mod_phys_lmdz_para
317
318  IMPLICIT NONE
319  include "dimensions.h"
320  include "temps.h"
321  include "indicesol.h"
322  include "advtrac.h"
323  include "clesphys.h"
324  include "thermcell.h"
325
326  integer                               :: jjmp1, nqmax
327  integer                               :: nbteta, nlevSTD, radpas
328  logical                               :: ok_mensuel, ok_journe, ok_hf, ok_instan
329  real                                  :: dtime
330  integer                               :: idayref
331  real                                  :: zjulian
332  real, dimension(klev)                 :: presnivs
333  character(len=4), dimension(nlevSTD)  :: clevSTD
334  integer                               :: nsrf, k, iq, iiq, iff, i, j
335  logical                               :: ok_veget
336  integer                               :: iflag_pbl
337  CHARACTER(len=3)                      :: bb2
338  CHARACTER(len=2)                      :: bb3
339  character(len=6)                      :: ocean
340  CHARACTER(len=3)                      :: ctetaSTD(nbteta)
341  integer, dimension(nfiles)            :: nid_fil
342  real, dimension(nfiles)               :: ecrit_files
343  CHARACTER(len=20), dimension(nfiles)  :: name_files
344  INTEGER, dimension(iim*jjmp1)         ::  ndex2d
345  INTEGER, dimension(iim*jjmp1*klev)    :: ndex3d
346  integer                               :: imin_ins, imax_ins
347  integer                               :: jmin_ins, jmax_ins
348
349   name_files(1) = 'histmth'
350   name_files(2) = 'histday'
351   name_files(3) = 'histhf'
352   name_files(4) = 'histins'
353
354   type_ecri(1) = 'ave(X)'
355   type_ecri(2) = 'ave(X)'
356   type_ecri(3) = 'ave(X)'
357   type_ecri(4) = 'inst(X)'
358
359   clef_files(1) = ok_mensuel
360   clef_files(2) = ok_journe
361   clef_files(3) = ok_hf
362   clef_files(4) = ok_instan
363
364   lev_files(1) = lev_histmth
365   lev_files(2) = lev_histday
366   lev_files(3) = lev_histhf
367   lev_files(4) = 1
368
369   ecrit_files(1) = ecrit_mth
370   ecrit_files(2) = ecrit_day
371   ecrit_files(3) = ecrit_hf
372   ecrit_files(4) = ecrit_ins
373 
374!!!!!!!!!!!!!!!!!!!!!!! Boucle sur les fichiers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375! Appel de histbeg et histvert pour creer le fichier et les niveaux verticaux !!
376! Appel des histbeg pour definir les variables (nom, moy ou inst, freq de sortie ..
377!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
378
379 DO iff=1,nfiles
380
381    IF (clef_files(iff)) THEN
382     
383      zstophym(iff) = dtime         ! Frequence ou l on moyenne
384      zoutm(iff) = ecrit_files(iff) ! Frequence ou l on ecrit
385
386      idayref = day_ref
387      CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian)
388
389!!!!!!!!!!!!!!!!! Traitement dans le cas ou l'on veut stocker sur un domaine limite !!
390!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
391     if (ok_reglim(iff)) then
392
393        imin_ins=1
394        imax_ins=iim
395        jmin_ins=1
396        jmax_ins=jjmp1
397
398        do i=1,iim-1
399           print*,'io_lon(i)=',io_lon(i)
400           if (io_lon(i).le.lonmin_reg(iff)) imin_ins=i
401           if (io_lon(i).le.lonmax_reg(iff)) imax_ins=i
402        enddo
403
404        do j=1,jjmp1-1
405            print*,'io_lat(j)=',io_lat(j)
406            if (io_lat(j).ge.latmin_reg(iff)) jmax_ins=j+1
407            if (io_lat(j).ge.latmax_reg(iff)) jmin_ins=j
408        enddo
409
410         print*,'On stoke le fichier hist sur, ', &
411         imin_ins,imax_ins,jmin_ins,jmax_ins
412         print*,'On stoke le fichier instantanne sur, ', &
413         io_lon(imin_ins),io_lon(imax_ins), &
414         io_lat(jmin_ins),io_lat(jmax_ins)
415
416 CALL histbeg(name_files(iff),iim,io_lon,jjmp1,io_lat, &
417              imin_ins,imax_ins-imin_ins+1, &
418              jmin_ins,jmax_ins-jmin_ins+1, &
419              itau_phy,zjulian,dtime,nhorim(iff),nid_fil(iff))
420!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
421       else
422 CALL histbeg_phy(name_files(iff),itau_phy,zjulian,dtime,nhorim(iff),nid_fil(iff))
423       endif
424 
425      nid_files(iff)=nid_fil(iff)
426
427 CALL histvert(nid_files(iff),"presnivs","Vertical levels","mb",klev, presnivs/100., nvertm(iff))
428
429!!!!!!!!!!!!! Traitement des champs 3D pour histhf !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
430!!!!!!!!!!!!!!! A Revoir plus tard !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
431!          IF (iff.eq.3.and.lev_files(iff).ge.4) THEN
432!          CALL histbeg_phy("histhf3d",itau_phy, &
433!     &                     zjulian, dtime, &
434!     &                     nhorim, nid_hf3d)
435
436!         CALL histvert(nid_hf3d,"presnivs", &
437!     &                 "Vertical levels","mb", &
438!     &                 klev, presnivs/100., nvertm)
439!          ENDIF
440
441!!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
442 CALL histdef2d(iff,flag_phis,"phis","Surface geop.height","m2/s2")
443   type_ecri(1) = 'once'
444   type_ecri(2) = 'once'
445   type_ecri(3) = 'once'
446   type_ecri(4) = 'once'
447 CALL histdef2d(iff,flag_aire,"aire","Grid area","-")
448 CALL histdef2d(iff,flag_contfracATM,"contfracATM","% sfce ter+lic","-")
449   type_ecri(1) = 'ave(X)'
450   type_ecri(2) = 'ave(X)'
451   type_ecri(3) = 'ave(X)'
452   type_ecri(4) = 'inst(X)'
453
454!!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
455 CALL histdef2d(iff,flag_contfracOR,"contfracOR","% sfce terre OR","-" )
456 CALL histdef2d(iff,flag_aireTER,"aireTER","Grid area CONT","-" )
457 CALL histdef2d(iff,flag_flat,"flat","Latent heat flux","W/m2")
458 CALL histdef2d(iff,flag_slp,"slp","Sea Level Pressure", "Pa" )
459 CALL histdef2d(iff,flag_tsol,"tsol","Surface Temperature", "K")
460 CALL histdef2d( iff,flag_t2m,"t2m","Temperature 2m", "K" )
461 CALL histdef2d(iff,flag_t2m_min,"t2m_min","Temp 2m min", "K" )
462 CALL histdef2d(iff,flag_t2m_max,"t2m_max", "Temp 2m max", "K" )
463 CALL histdef2d(iff,flag_wind10m,"wind10m","10-m wind speed","m/s")
464 CALL histdef2d(iff,flag_wind10max,"wind10max","10m wind speed max","m/s")
465 CALL histdef2d(iff,flag_sicf,"sicf","Sea-ice fraction", "-" )
466 CALL histdef2d(iff,flag_q2m,"q2m","Specific humidity 2m", "kg/kg")
467 CALL histdef2d(iff,flag_u10m,"u10m","Vent zonal 10m", "m/s" )
468 CALL histdef2d(iff,flag_v10m,"v10m","Vent meridien 10m", "m/s")
469 CALL histdef2d(iff,flag_psol,"psol","Surface Pressure","Pa" )
470 CALL histdef2d(iff,flag_qsurf,"qsurf","Surface Air humidity", "kg/kg")
471
472  if (.not. ok_veget) then
473 CALL histdef2d(iff,flag_qsol,"qsol","Soil watter content", "mm" )
474  endif
475
476 CALL histdef2d(iff,flag_ndayrain,"ndayrain","Number of dayrain(liq+sol)","-")
477 CALL histdef2d(iff,flag_precip,"precip","Precip Totale liq+sol","kg/(s*m2)" )
478 CALL histdef2d(iff,flag_plul,"plul","Large-scale Precip.","kg/(s*m2)")
479 CALL histdef2d(iff,flag_pluc,"pluc","Convective Precip.","kg/(s*m2)")
480 CALL histdef2d(iff,flag_snow,"snow","Snow fall","kg/(s*m2)" )
481 CALL histdef2d(iff,flag_evap,"evap","Evaporat", "kg/(s*m2)" )
482 CALL histdef2d(iff,flag_tops,"tops","Solar rad. at TOA","W/m2")
483 CALL histdef2d(iff,flag_tops0,"tops0","CS Solar rad. at TOA", "W/m2")
484 CALL histdef2d(iff,flag_topl,"topl","IR rad. at TOA", "W/m2" )
485 CALL histdef2d(iff,flag_topl0,"topl0", "IR rad. at TOA","W/m2")
486 CALL histdef2d(iff,flag_SWupTOA,"SWupTOA","SWup at TOA","W/m2")
487 CALL histdef2d(iff,flag_SWupTOAclr,"SWupTOAclr","SWup clear sky at TOA","W/m2")
488 CALL histdef2d(iff,flag_SWdnTOA, "SWdnTOA","SWdn at TOA","W/m2" )
489 CALL histdef2d(iff,flag_SWdnTOAclr,"SWdnTOAclr","SWdn clear sky at TOA","W/m2")
490 CALL histdef2d(iff,flag_SWup200,"SWup200","SWup at 200mb","W/m2" )
491 CALL histdef2d(iff,flag_SWup200clr,"SWup200clr","SWup clear sky at 200mb","W/m2")
492 CALL histdef2d(iff,flag_SWdn200,"SWdn200","SWdn at 200mb","W/m2" )
493 CALL histdef2d(iff,flag_SWdn200clr,"SWdn200clr","SWdn clear sky at 200mb","W/m2")
494 CALL histdef2d(iff,flag_LWup200,"LWup200","LWup at 200mb","W/m2")
495 CALL histdef2d(iff,flag_LWup200clr, "LWup200clr","LWup clear sky at 200mb","W/m2")
496 CALL histdef2d(iff,flag_LWdn200,"LWdn200","LWdn at 200mb","W/m2")
497 CALL histdef2d(iff,flag_LWdn200clr, "LWdn200clr","LWdn clear sky at 200mb","W/m2")
498 CALL histdef2d(iff,flag_sols,"sols","Solar rad. at surf.","W/m2")
499 CALL histdef2d(iff,flag_sols0,"sols0","Solar rad. at surf.","W/m2")
500 CALL histdef2d(iff,flag_soll,"soll","IR rad. at surface","W/m2") 
501 CALL histdef2d(iff,flag_radsol,"radsol","Rayonnement au sol","W/m2")
502 CALL histdef2d(iff,flag_soll0,"soll0","IR rad. at surface","W/m2")
503 CALL histdef2d(iff,flag_SWupSFC,"SWupSFC","SWup at surface","W/m2")
504 CALL histdef2d(iff,flag_SWupSFCclr,"SWupSFCclr","SWup clear sky at surface","W/m2")
505 CALL histdef2d(iff,flag_SWdnSFC,"SWdnSFC","SWdn at surface","W/m2")
506 CALL histdef2d(iff,flag_SWdnSFCclr,"SWdnSFCclr","SWdn clear sky at surface","W/m2")
507 CALL histdef2d(iff,flag_LWupSFC,"LWupSFC","Upwd. IR rad. at surface","W/m2")
508 CALL histdef2d(iff,flag_LWdnSFC,"LWdnSFC","Down. IR rad. at surface","W/m2")
509 CALL histdef2d(iff,flag_LWupSFCclr,"LWupSFCclr","CS Upwd. IR rad. at surface","W/m2")
510 CALL histdef2d(iff,flag_LWdnSFCclr,"LWdnSFCclr","Down. CS IR rad. at surface","W/m2")
511 CALL histdef2d(iff,flag_bils,"bils","Surf. total heat flux","W/m2")
512 CALL histdef2d(iff,flag_sens,"sens","Sensible heat flux","W/m2")
513 CALL histdef2d(iff,flag_fder,"fder","Heat flux derivation","W/m2")
514 CALL histdef2d(iff,flag_ffonte,"ffonte","Thermal flux for snow melting","W/m2")
515 CALL histdef2d(iff,flag_fqcalving,"fqcalving","Ice Calving","kg/m2/s")
516 CALL histdef2d(iff,flag_fqfonte,"fqfonte","Land ice melt","kg/m2/s")
517
518     DO nsrf = 1, nbsrf
519 CALL histdef2d(iff,flag_pourc_sol,"pourc_"//clnsurf(nsrf),"% "//clnsurf(nsrf),"%")
520 CALL histdef2d(iff,flag_fract_sol,"fract_"//clnsurf(nsrf),"Fraction "//clnsurf(nsrf),"1")
521 CALL histdef2d(iff,flag_taux_sol,"taux_"//clnsurf(nsrf),"Zonal wind stress"//clnsurf(nsrf),"Pa")
522 CALL histdef2d(iff,flag_tauy_sol,"tauy_"//clnsurf(nsrf),"Meridional wind stress "//clnsurf(nsrf),"Pa")
523 CALL histdef2d(iff,flag_tsol_sol,"tsol_"//clnsurf(nsrf),"Temperature "//clnsurf(nsrf),"K")
524 CALL histdef2d(iff,flag_u10m_sol,"u10m_"//clnsurf(nsrf),"Vent Zonal 10m "//clnsurf(nsrf),"m/s")
525 CALL histdef2d(iff,flag_v10m_sol,"v10m_"//clnsurf(nsrf),"Vent meredien 10m "//clnsurf(nsrf),"m/s")
526 CALL histdef2d(iff,flag_t2m_sol,"t2m_"//clnsurf(nsrf),"Temp 2m "//clnsurf(nsrf),"K")
527 CALL histdef2d(iff,flag_sens_sol,"sens_"//clnsurf(nsrf),"Sensible heat flux "//clnsurf(nsrf),"W/m2")
528 CALL histdef2d(iff,flag_lat_sol,"lat_"//clnsurf(nsrf),"Latent heat flux "//clnsurf(nsrf),"W/m2")
529 CALL histdef2d(iff,flag_flw_sol,"flw_"//clnsurf(nsrf),"LW "//clnsurf(nsrf),"W/m2")
530 CALL histdef2d(iff,flag_fsw_sol,"fsw_"//clnsurf(nsrf),"SW "//clnsurf(nsrf),"W/m2")
531 CALL histdef2d(iff,flag_wbils_sol,"wbils_"//clnsurf(nsrf),"Bilan sol "//clnsurf(nsrf),"W/m2" )
532 CALL histdef2d(iff,flag_wbilo_sol,"wbilo_"//clnsurf(nsrf),"Bilan eau "//clnsurf(nsrf),"kg/(m2*s)")
533  if (iflag_pbl>1 .and. lev_files(iff).gt.10 ) then
534 CALL histdef2d(iff,flag_tke_sol,"tke_"//clnsurf(nsrf),"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
535 CALL histdef2d(iff,flag_tke_max_sol,"tke_max_"//clnsurf(nsrf),"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
536  endif
537 CALL histdef2d(iff,flag_albe_sol, "albe_"//clnsurf(nsrf),"Albedo surf. "//clnsurf(nsrf),"-")
538 CALL histdef2d(iff,flag_rugs_sol,"rugs_"//clnsurf(nsrf),"Latent heat flux "//clnsurf(nsrf),"W/m2")
539 CALL histdef2d(iff,flag_ages_sol,"ages_"//clnsurf(nsrf),"Snow age","day")
540     END DO
541
542 CALL histdef2d(iff,flag_albs,"albs","Surface albedo","-")
543 CALL histdef2d(iff,flag_albslw,"albslw","Surface albedo LW","-")
544 CALL histdef2d(iff,flag_cdrm,"cdrm","Momentum drag coef.", "-")
545 CALL histdef2d(iff,flag_cdrh,"cdrh","Heat drag coef.", "-" )
546 CALL histdef2d(iff,flag_cldl,"cldl","Low-level cloudiness", "-")
547 CALL histdef2d(iff,flag_cldm,"cldm","Mid-level cloudiness", "-")
548 CALL histdef2d(iff,flag_cldh,"cldh","High-level cloudiness", "-")
549 CALL histdef2d(iff,flag_cldt,"cldt","Total cloudiness","%")
550 CALL histdef2d(iff,flag_cldq,"cldq","Cloud liquid water path","kg/m2")
551 CALL histdef2d(iff,flag_lwp,"lwp","Cloud water path","kg/m2")
552 CALL histdef2d(iff,flag_iwp,"iwp","Cloud ice water path","kg/m2" )
553 CALL histdef2d(iff,flag_ue,"ue","Zonal energy transport","-")
554 CALL histdef2d(iff,flag_ve,"ve","Merid energy transport", "-")
555 CALL histdef2d(iff,flag_uq,"uq","Zonal humidity transport", "-")
556 CALL histdef2d(iff,flag_vq,"vq","Merid humidity transport", "-")
557
558     IF(iflag_con.GE.3) THEN ! sb
559 CALL histdef2d(iff,flag_cape,"cape","Conv avlbl pot ener","J/kg")
560 CALL histdef2d(iff,flag_pbase,"pbase","Cld base pressure", "mb")
561 CALL histdef2d(iff,flag_ptop,"ptop","Cld top pressure", "mb")
562 CALL histdef2d(iff,flag_fbase,"fbase","Cld base mass flux","kg/m2/s")
563 CALL histdef2d(iff,flag_prw,"prw","Precipitable water","kg/m2")
564     ENDIF !iflag_con .GE. 3
565
566 CALL histdef2d(iff,flag_s_pblh,"s_pblh","Boundary Layer Height","m")
567 CALL histdef2d(iff,flag_s_pblt,"s_pblt","t at Boundary Layer Height","K")
568 CALL histdef2d(iff,flag_s_lcl,"s_lcl","Condensation level","m")
569 CALL histdef2d(iff,flag_s_capCL,"s_capCL","Conv avlbl pot enerfor ABL", "J/m2" )
570 CALL histdef2d(iff,flag_s_oliqCL,"s_oliqCL","Liq Water in BL","kg/m2")
571 CALL histdef2d(iff,flag_s_cteiCL,"s_cteiCL","Instability criteria(ABL)","K")
572 CALL histdef2d(iff,flag_s_therm,"s_therm","Exces du thermique", "K")
573 CALL histdef2d(iff,flag_s_trmb1,"s_trmb1","deep_cape(HBTM2)","J/m2")
574 CALL histdef2d(iff,flag_s_trmb2,"s_trmb2","inhibition (HBTM2)","J/m2")
575 CALL histdef2d(iff,flag_s_trmb3,"s_trmb3","Point Omega (HBTM2)","m")
576
577! Champs interpolles sur des niveaux de pression
578! iif=1 on ecrit u v w phi sur 850 700 500 200 au niv 1
579! iif=2 on ecrit w et ph 500 seulement au niv 1
580!        et u v sur 850 700 500 200
581! iif=3 on ecrit ph a 500 seulement au niv 1
582!      on ecrit u v t q a 850 700 500 200 au niv 3
583
584        DO k=1, nlevSTD
585     IF(k.GE.2.AND.k.LE.12) bb2=clevSTD(k)
586     IF(k.GE.13.AND.k.LE.17) bb3=clevSTD(k)
587     IF(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200")THEN
588 CALL histdef2d(iff,flag_ulevsSTD,"u"//bb2,"Zonal wind "//bb2//"mb","m/s")
589 CALL histdef2d(iff,flag_vlevsSTD,"v"//bb2,"Meridional wind "//bb2//"mb","m/s")
590 CALL histdef2d(iff,flag_wlevsSTD,"w"//bb2,"Vertical wind "//bb2//"mb","m/s")
591 CALL histdef2d(iff,flag_philevsSTD,"phi"//bb2,"Geopotential "//bb2//"mb","m")
592 CALL histdef2d(iff,flag_qlevsSTD,"q"//bb2,"Specific humidity "//bb2//"mb","kg/kg" )
593 CALL histdef2d(iff,flag_tlevsSTD,"t"//bb2,"Temperature "//bb2//"mb","K")
594     ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR.
595       ENDDO
596
597 CALL histdef2d(iff,flag_t_oce_sic,"t_oce_sic","Temp mixte oce-sic","K")
598
599 IF (ocean=='slab') &
600      CALL histdef2d(iff,flag_slab_bils, "slab_wbils_oce","Bilan au sol sur ocean slab", "W/m2")
601
602 CALL histdef2d(iff,flag_ale_bl,"ale_bl","ALE BL","m2/s2")
603 CALL histdef2d(iff,flag_alp_bl,"alp_bl","ALP BL","m2/s2")
604 CALL histdef2d(iff,flag_ale_wk,"ale_wk","ALE WK","m2/s2")
605 CALL histdef2d(iff,flag_alp_wk,"alp_wk","ALP WK","m2/s2")
606
607 CALL histdef2d(iff,flag_ale,"ale","ALE","m2/s2")
608 CALL histdef2d(iff,flag_alp,"alp","ALP","W/m2")
609 CALL histdef2d(iff,flag_cin,"cin","Convective INhibition","m2/s2")
610 CALL histdef2d(iff,flag_wape,"WAPE","WAPE","m2/s2")
611
612 CALL histdef2d(iff,flag_weakinv, "weakinv","Weak inversion", "-")
613 CALL histdef2d(iff,flag_dthmin,"dthmin","dTheta mini", "K/m")
614 if (ok_isccp) then
615   CALL histdef2d(iff,flag_meantaucld,"meantaucld","ISCCP mean cloud optical thickness","1")
616 endif
617 CALL histdef2d(iff,flag_rh2m,"rh2m","Relative humidity at 2m", "%" )
618 CALL histdef2d(iff,flag_qsat2m,"qsat2m","Saturant humidity at 2m", "%")
619 CALL histdef2d(iff,flag_tpot,"tpot","Surface air potential temperature","K")
620 CALL histdef2d(iff,flag_tpote,"tpote","Surface air equivalent potential temperature","K")
621 CALL histdef2d(iff,flag_SWnetOR,"SWnetOR","Sfce net SW radiation OR", "W/m2")
622 CALL histdef2d(iff,flag_SWdownOR,"SWdownOR","Sfce incident SW radiation OR","W/m2")
623 CALL histdef2d(iff,flag_LWdownOR,"LWdownOR","Sfce incident LW radiation OR","W/m2")
624 CALL histdef2d(iff,flag_snowl,"snowl","Solid Large-scale Precip.","kg/(m2*s)")
625 CALL histdef2d(iff,flag_cape_max,"cape_max","CAPE max.", "J/kg")
626 CALL histdef2d(iff,flag_solldown,"solldown","Down. IR rad. at surface","W/m2")
627 CALL histdef2d(iff,flag_dtsvdfo,"dtsvdfo","Boundary-layer dTs(o)","K/s")
628 CALL histdef2d(iff,flag_dtsvdft,"dtsvdft","Boundary-layer dTs(t)","K/s")
629 CALL histdef2d(iff,flag_dtsvdfg,"dtsvdfg","Boundary-layer dTs(g)","K/s")
630 CALL histdef2d(iff,flag_dtsvdfi,"dtsvdfi","Boundary-layer dTs(g)","K/s")
631 CALL histdef2d(iff,flag_rugs,"rugs","rugosity", "-" )
632
633! Champs 3D:
634 CALL histdef3d(iff,flag_lwcon,"lwcon","Cloud liquid water content","kg/kg")
635 CALL histdef3d(iff,flag_iwcon,"iwcon","Cloud ice water content","kg/kg")
636 CALL histdef3d(iff,flag_temp,"temp","Air temperature","K" )
637 CALL histdef3d(iff,flag_theta,"theta","Potential air temperature","K" )
638 CALL histdef3d(iff,flag_ovap,"ovap","Specific humidity","kg/kg" )
639 CALL histdef3d(iff,flag_geop,"geop","Geopotential height","m2/s2")
640 CALL histdef3d(iff,flag_vitu,"vitu","Zonal wind", "m/s" )
641 CALL histdef3d(iff,flag_vitv,"vitv","Meridional wind","m/s" )
642 CALL histdef3d(iff,flag_vitw,"vitw","Vertical wind","m/s" )
643 CALL histdef3d(iff,flag_pres,"pres","Air pressure", "Pa" )
644 CALL histdef3d(iff,flag_rneb,"rneb","Cloud fraction","-")
645 CALL histdef3d(iff,flag_rnebcon,"rnebcon","Convective Cloud Fraction","-")
646 CALL histdef3d(iff,flag_rhum,"rhum","Relative humidity","-")
647 CALL histdef3d(iff,flag_ozone,"ozone","Ozone concentration", "ppmv")
648 CALL histdef3d(iff,flag_upwd,"upwd","saturated updraft", "kg/m2/s")
649 CALL histdef3d(iff,flag_dtphy,"dtphy","Physics dT","K/s")
650 CALL histdef3d(iff,flag_dqphy,"dqphy","Physics dQ", "(kg/kg)/s")
651 CALL histdef3d(iff,flag_cldtau,"cldtau","Cloud optical thickness","1")
652 CALL histdef3d(iff,flag_cldemi,"cldemi","Cloud optical emissivity","1")
653!IM: bug ?? dimensionnement variables (klon,klev+1) pmflxr, pmflxs, prfl, psfl
654! CALL histdef3d(iff,flag_pr_con_l,"pmflxr","Convective precipitation lic"," ")
655! CALL histdef3d(iff,flag_pr_con_i,"pmflxs","Convective precipitation ice"," ")
656! CALL histdef3d(iff,flag_pr_lsc_l,"prfl","Large scale precipitation lic"," ")
657! CALL histdef3d(iff,flag_pr_lsc_i,"psfl","Large scale precipitation ice"," ")
658
659!FH Sorties pour la couche limite
660     if (iflag_pbl>1) then
661 CALL histdef3d(iff,flag_tke,"tke","TKE","m2/s2")
662 CALL histdef3d(iff,flag_tke_max,"tke_max","TKE max","m2/s2")
663     endif
664
665 CALL histdef3d(iff,flag_kz,"kz","Kz melange","m2/s")
666 CALL histdef3d(iff,flag_kz_max,"kz_max","Kz melange max","m2/s" )
667 CALL histdef3d(iff,flag_clwcon,"clwcon","Convective Cloud Liquid water content", "kg/kg")
668 CALL histdef3d(iff,flag_Ma,"Ma","undilute adiab updraft","kg/m2/s")
669 CALL histdef3d(iff,flag_dnwd,"dnwd","saturated downdraft","kg/m2/s")
670 CALL histdef3d(iff,flag_dnwd0,"dnwd0","unsat. downdraft", "kg/m2/s")
671 CALL histdef3d(iff,flag_dtdyn,"dtdyn","Dynamics dT","K/s")
672 CALL histdef3d(iff,flag_dqdyn,"dqdyn","Dynamics dQ", "(kg/kg)/s")
673 CALL histdef3d(iff,flag_dtcon,"dtcon","Convection dT","K/s")
674 CALL histdef3d(iff,flag_ducon,"ducon","Convection du","m/s2")
675 CALL histdef3d(iff,flag_dqcon,"dqcon","Convection dQ", "(kg/kg)/s")
676 IF (iflag_wake == 1) THEN
677   CALL histdef3d(iff,flag_dtwak,"dtwak","Wake dT","K/s")
678   CALL histdef3d(iff,flag_dqwak,"dqwak","Wake dQ","(kg/kg)/s")
679 endif
680 CALL histdef3d(iff,flag_dtlsc,"dtlsc","Condensation dT", "K/s")
681 CALL histdef3d(iff,flag_dtlschr,"dtlschr","Large-scale condensational heating rate","K/s")
682 CALL histdef3d(iff,flag_dqlsc,"dqlsc","Condensation dQ","(kg/kg)/s")
683 CALL histdef3d(iff,flag_dtvdf,"dtvdf","Boundary-layer dT", "K/s")
684 CALL histdef3d(iff,flag_dqvdf,"dqvdf","Boundary-layer dQ","(kg/kg)/s")
685 CALL histdef3d(iff,flag_dteva,"dteva","Reevaporation dT", "K/s")
686 CALL histdef3d(iff,flag_dqeva,"dqeva","Reevaporation dQ","(kg/kg)/s")
687 CALL histdef3d(iff,flag_ptconv,"ptconv","POINTS CONVECTIFS"," ")
688 CALL histdef3d(iff,flag_ratqs,"ratqs", "RATQS"," ")
689 CALL histdef3d(iff,flag_dtthe,"dtthe","Dry adjust. dT", "K/s")
690
691if(iflag_thermals.gt.1) THEN
692 CALL histdef3d(iff,flag_f_th,"f_th","Thermal plume mass flux", "K/s")
693 CALL histdef3d(iff,flag_e_th,"e_th","Thermal plume entrainment", "K/s")
694 CALL histdef3d(iff,flag_w_th,"w_th","Thermal plume vertical velocity", "m/s")
695 CALL histdef3d(iff,flag_lambda_th,"lambda_th","Thermal plume vertical velocity", "m/s")
696 CALL histdef3d(iff,flag_q_th,"q_th","Thermal plume total humidity", "kg/kg")
697 CALL histdef3d(iff,flag_a_th,"a_th","Thermal plume fraction", "")
698 CALL histdef3d(iff,flag_d_th,"d_th","Thermal plume detrainment", "K/s")
699endif !iflag_thermals.gt.1
700 CALL histdef2d(iff,flag_f0_th,"f0_th","Thermal closure mass flux", "K/s")
701 CALL histdef2d(iff,flag_zmax_th,"zmax_th","Thermal plume height", "K/s")
702 CALL histdef3d(iff,flag_dqthe,"dqthe","Dry adjust. dQ","(kg/kg)/s")
703 CALL histdef3d(iff,flag_dtajs,"dtajs","Dry adjust. dT", "K/s")
704 CALL histdef3d(iff,flag_dqajs,"dqajs","Dry adjust. dQ","(kg/kg)/s")
705 CALL histdef3d(iff,flag_dtswr,"dtswr","SW radiation dT","K/s")
706 CALL histdef3d(iff,flag_dtsw0,"dtsw0","CS SW radiation dT","K/s")
707 CALL histdef3d(iff,flag_dtlwr,"dtlwr","LW radiation dT","K/s")
708 CALL histdef3d(iff,flag_dtlw0,"dtlw0", "CS LW radiation dT","K/s")
709 CALL histdef3d(iff,flag_dtec,"dtec","Cinetic dissip dT","K/s")
710 CALL histdef3d(iff,flag_duvdf,"duvdf","Boundary-layer dU","m/s2")
711 CALL histdef3d(iff,flag_dvvdf,"dvvdf","Boundary-layer dV", "m/s2")
712
713     IF (ok_orodr) THEN
714 CALL histdef3d(iff,flag_duoro,"duoro","Orography dU","m/s2")
715 CALL histdef3d(iff,flag_dvoro,"dvoro","Orography dV", "m/s2")
716     ENDIF
717
718     IF (ok_orolf) THEN
719 CALL histdef3d(iff,flag_dulif,"dulif","Orography dU","m/s2")
720 CALL histdef3d(iff,flag_dvlif,"dvlif","Orography dV", "m/s2")
721     ENDIF
722
723      if (nqmax>=3) THEN
724    DO iq=3,nqmax
725       iiq=niadv(iq)
726 CALL histdef3d ( iff, flag_trac, tnom(iq),ttext(iiq), "-" )
727    ENDDO
728      endif
729
730        CALL histend(nid_files(iff))
731
732         ndex2d = 0
733         ndex3d = 0
734
735         ENDIF ! clef_files
736
737         ENDDO !
738      end subroutine phys_output_open
739
740      SUBROUTINE histdef2d (iff,flag_var,nomvar,titrevar,unitvar)
741     
742       use ioipsl
743       USE dimphy
744       USE mod_phys_lmdz_para
745
746       IMPLICIT NONE
747       
748       include "dimensions.h"
749       include "temps.h"
750       include "indicesol.h"
751       include "advtrac.h"
752       include "clesphys.h"
753
754       integer                          :: iff
755       integer, dimension(nfiles)       :: flag_var
756       character(len=*)                 :: nomvar
757       character(len=*)                 :: titrevar
758       character(len=*)                 :: unitvar
759       
760       if ( flag_var(iff)<=lev_files(iff) ) then
761 call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
762               iim,jj_nb,nhorim(iff), 1,1,1, -99, 32, &
763               type_ecri(iff), zstophym(iff),zoutm(iff))               
764       endif                     
765      end subroutine histdef2d
766
767      SUBROUTINE histdef3d (iff,flag_var,nomvar,titrevar,unitvar)
768
769       use ioipsl
770       USE dimphy
771       USE mod_phys_lmdz_para
772
773       IMPLICIT NONE
774
775       include "dimensions.h"
776       include "temps.h"
777       include "indicesol.h"
778       include "advtrac.h"
779       include "clesphys.h"
780
781       integer                          :: iff
782       integer, dimension(nfiles)       :: flag_var
783       character(len=*)                 :: nomvar
784       character(len=*)                 :: titrevar
785       character(len=*)                 :: unitvar
786
787       if ( flag_var(iff)<=lev_files(iff) ) then
788 call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
789               iim,jj_nb,nhorim(iff), klev,1,klev,nvertm(iff), 32, &
790               type_ecri(iff), zstophym(iff),zoutm(iff))
791       endif
792      end subroutine histdef3d
793
794END MODULE phys_output_mod
795
Note: See TracBrowser for help on using the repository browser.