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

Last change on this file since 1081 was 1081, checked in by lguez, 16 years ago

Corrected unit for "vitw" in the files "hist*.nc".

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