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

Last change on this file since 965 was 964, checked in by Laurent Fairhead, 16 years ago

Sorties de certaines variables que quand elles sont bien activees
LF

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