source: LMDZ5/branches/LMDZ5V2.0-dev/libf/phylmd/phys_output_write.h @ 5423

Last change on this file since 5423 was 1491, checked in by musat, 14 years ago

Couplage Thermiques/Emanuel? seulement si T<0 avec iflag_coupl==2 (FH)
Correction bug initialisation ptconvth (FH/JYG)
Correction dimensions tableau paprs_glo definition ZPM1R pour le 1D (JYG)
IM

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 52.2 KB
RevLine 
[907]1      itau_w = itau_phy + itap
2
3      DO iff=1,nfiles
4
5       IF (clef_files(iff)) THEN
6             ndex2d = 0
7             ndex3d = 0
8
9!!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[1146]10       IF (o_phis%flag(iff)<=lev_files(iff)) THEN
[907]11         CALL histwrite_phy(nid_files(iff),
[1146]12     $                      o_phis%name,itau_w,pphis)
[907]13       ENDIF
14
[1146]15       IF (o_aire%flag(iff)<=lev_files(iff)) THEN
16       CALL histwrite_phy(nid_files(iff),o_aire%name,itau_w,airephy)
[907]17       ENDIF
18
[1146]19       IF (o_contfracATM%flag(iff)<=lev_files(iff)) THEN
[907]20      DO i=1, klon
21       zx_tmp_fi2d(i)=pctsrf(i,is_ter)+pctsrf(i,is_lic)
22      ENDDO
23      CALL histwrite_phy(nid_files(iff),
[1146]24     $             o_contfracATM%name,itau_w,zx_tmp_fi2d)
[907]25       ENDIF
26
[1146]27       IF (o_contfracOR%flag(iff)<=lev_files(iff)) THEN
28      CALL histwrite_phy(nid_files(iff),o_contfracOR%name,itau_w,
[996]29     $                   pctsrf(:,is_ter))
[907]30       ENDIF
31
[1146]32       IF (o_aireTER%flag(iff)<=lev_files(iff)) THEN
[907]33      CALL histwrite_phy(nid_files(iff),
[1146]34     $                  o_aireTER%name,itau_w,paire_ter)
[907]35       ENDIF
36
37!!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38
[1146]39       IF (o_flat%flag(iff)<=lev_files(iff)) THEN
40      CALL histwrite_phy(nid_files(iff),o_flat%name,itau_w,zxfluxlat)
[907]41       ENDIF
42
[1146]43       IF (o_slp%flag(iff)<=lev_files(iff)) THEN
44      CALL histwrite_phy(nid_files(iff),o_slp%name,itau_w,slp)
[907]45       ENDIF
46
[1146]47       IF (o_tsol%flag(iff)<=lev_files(iff)) THEN
48      CALL histwrite_phy(nid_files(iff),o_tsol%name,itau_w,zxtsol)
[907]49       ENDIF
50
[1146]51       IF (o_t2m%flag(iff)<=lev_files(iff)) THEN
52      CALL histwrite_phy(nid_files(iff),o_t2m%name,itau_w,zt2m)
[907]53       ENDIF
54
[1146]55       IF (o_t2m_min%flag(iff)<=lev_files(iff)) THEN
56      CALL histwrite_phy(nid_files(iff),o_t2m_min%name,itau_w,zt2m)
[907]57       ENDIF
58
[1146]59       IF (o_t2m_max%flag(iff)<=lev_files(iff)) THEN
60      CALL histwrite_phy(nid_files(iff),o_t2m_max%name,itau_w,zt2m)
[907]61       ENDIF
62
[1146]63       IF (o_wind10m%flag(iff)<=lev_files(iff)) THEN
[907]64      DO i=1, klon
65       zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
66      ENDDO
[1146]67      CALL histwrite_phy(nid_files(iff),
68     s                  o_wind10m%name,itau_w,zx_tmp_fi2d)
[907]69       ENDIF
70
[1146]71       IF (o_wind10max%flag(iff)<=lev_files(iff)) THEN
[907]72      DO i=1, klon
73       zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
74      ENDDO
[1146]75      CALL histwrite_phy(nid_files(iff),o_wind10max%name, 
[907]76     $                   itau_w,zx_tmp_fi2d)
77       ENDIF
78
[1146]79       IF (o_sicf%flag(iff)<=lev_files(iff)) THEN
[907]80      DO i = 1, klon
81         zx_tmp_fi2d(i) = pctsrf(i,is_sic)
82      ENDDO
[1146]83      CALL histwrite_phy(nid_files(iff),
84     $                   o_sicf%name,itau_w,zx_tmp_fi2d)
[907]85       ENDIF
86
[1146]87       IF (o_q2m%flag(iff)<=lev_files(iff)) THEN
88      CALL histwrite_phy(nid_files(iff),o_q2m%name,itau_w,zq2m)
[907]89       ENDIF
90
[1146]91       IF (o_u10m%flag(iff)<=lev_files(iff)) THEN
92      CALL histwrite_phy(nid_files(iff),o_u10m%name,itau_w,zu10m)
[907]93       ENDIF
94
[1146]95       IF (o_v10m%flag(iff)<=lev_files(iff)) THEN
96      CALL histwrite_phy(nid_files(iff),o_v10m%name,itau_w,zv10m)
[907]97       ENDIF
98
[1146]99       IF (o_psol%flag(iff)<=lev_files(iff)) THEN
[907]100      DO i = 1, klon
101         zx_tmp_fi2d(i) = paprs(i,1)
102      ENDDO
[1146]103      CALL histwrite_phy(nid_files(iff),
104     s                   o_psol%name,itau_w,zx_tmp_fi2d)
[907]105       ENDIF
106
[1473]107       IF (o_mass%flag(iff)<=lev_files(iff)) THEN
108      CALL histwrite_phy(nid_files(iff),o_mass%name,itau_w,zmasse)
109        ENDIF
110
111
[1146]112       IF (o_qsurf%flag(iff)<=lev_files(iff)) THEN
113      CALL histwrite_phy(nid_files(iff),o_qsurf%name,itau_w,zxqsurf)
[907]114       ENDIF
115
116       if (.not. ok_veget) then
[1146]117         IF (o_qsol%flag(iff)<=lev_files(iff)) THEN
118        CALL histwrite_phy(nid_files(iff),o_qsol%name,itau_w,qsol)
[907]119         ENDIF
120       endif
121
[1146]122      IF (o_precip%flag(iff)<=lev_files(iff)) THEN
[907]123       DO i = 1, klon
124         zx_tmp_fi2d(i) = rain_fall(i) + snow_fall(i)
125       ENDDO
[1146]126      CALL histwrite_phy(nid_files(iff),o_precip%name,
127     s                   itau_w,zx_tmp_fi2d)
[907]128      ENDIF
129
[1146]130       IF (o_ndayrain%flag(iff)<=lev_files(iff)) THEN
131      CALL histwrite_phy(nid_files(iff),o_ndayrain%name,
132     s                   itau_w,nday_rain)
[907]133       ENDIF
134
[1146]135      IF (o_plul%flag(iff)<=lev_files(iff)) THEN
[907]136       DO i = 1, klon
137         zx_tmp_fi2d(i) = rain_lsc(i) + snow_lsc(i)
138       ENDDO
[1146]139      CALL histwrite_phy(nid_files(iff),o_plul%name,itau_w,zx_tmp_fi2d)
[907]140      ENDIF
141
[1146]142      IF (o_pluc%flag(iff)<=lev_files(iff)) THEN
[907]143      DO i = 1, klon
144         zx_tmp_fi2d(i) = rain_con(i) + snow_con(i)
145      ENDDO
[1146]146      CALL histwrite_phy(nid_files(iff),o_pluc%name,itau_w,zx_tmp_fi2d)
[907]147      ENDIF
148
[1146]149       IF (o_snow%flag(iff)<=lev_files(iff)) THEN
150      CALL histwrite_phy(nid_files(iff),o_snow%name,itau_w,snow_fall)
[907]151       ENDIF
152
[1334]153       IF (o_msnow%flag(iff)<=lev_files(iff)) THEN
154      CALL histwrite_phy(nid_files(iff),o_msnow%name,itau_w,snow_o)
155       ENDIF
156
157       IF (o_fsnow%flag(iff)<=lev_files(iff)) THEN
158      CALL histwrite_phy(nid_files(iff),o_fsnow%name,itau_w,zfra_o)
159       ENDIF
160
[1146]161       IF (o_evap%flag(iff)<=lev_files(iff)) THEN
162      CALL histwrite_phy(nid_files(iff),o_evap%name,itau_w,evap)
[907]163       ENDIF
164
[1146]165       IF (o_tops%flag(iff)<=lev_files(iff)) THEN
166      CALL histwrite_phy(nid_files(iff),o_tops%name,itau_w,topsw)
[907]167       ENDIF
168
[1146]169       IF (o_tops0%flag(iff)<=lev_files(iff)) THEN
170      CALL histwrite_phy(nid_files(iff),o_tops0%name,itau_w,topsw0)
[907]171       ENDIF
172
[1146]173       IF (o_topl%flag(iff)<=lev_files(iff)) THEN
174      CALL histwrite_phy(nid_files(iff),o_topl%name,itau_w,toplw)
[907]175       ENDIF
176
[1146]177       IF (o_topl0%flag(iff)<=lev_files(iff)) THEN
178      CALL histwrite_phy(nid_files(iff),o_topl0%name,itau_w,toplw0)
[907]179       ENDIF
180
[1146]181       IF (o_SWupTOA%flag(iff)<=lev_files(iff)) THEN
[907]182      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, klevp1 )
[1146]183      CALL histwrite_phy(nid_files(iff),o_SWupTOA%name,
184     s                     itau_w,zx_tmp_fi2d)
[907]185       ENDIF
186
[1146]187       IF (o_SWupTOAclr%flag(iff)<=lev_files(iff)) THEN
[907]188      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, klevp1 )
189      CALL histwrite_phy(nid_files(iff), 
[1146]190     $                  o_SWupTOAclr%name,itau_w,zx_tmp_fi2d)
[907]191       ENDIF
192
[1146]193       IF (o_SWdnTOA%flag(iff)<=lev_files(iff)) THEN
[907]194      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, klevp1 )
[1146]195      CALL histwrite_phy(nid_files(iff),
196     s                  o_SWdnTOA%name,itau_w,zx_tmp_fi2d)
[907]197       ENDIF
198
[1146]199       IF (o_SWdnTOAclr%flag(iff)<=lev_files(iff)) THEN
[907]200      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, klevp1 )
201      CALL histwrite_phy(nid_files(iff), 
[1146]202     $                  o_SWdnTOAclr%name,itau_w,zx_tmp_fi2d)
[907]203       ENDIF
204
[1334]205       IF (o_nettop%flag(iff)<=lev_files(iff)) THEN
206      zx_tmp_fi2d(:) = topsw(:)-toplw(:)
207      CALL histwrite_phy(nid_files(iff),
208     $                  o_nettop%name,itau_w,zx_tmp_fi2d)
209       ENDIF
210
[1146]211       IF (o_SWup200%flag(iff)<=lev_files(iff)) THEN
212      CALL histwrite_phy(nid_files(iff),o_SWup200%name,itau_w,SWup200)
[907]213       ENDIF
214
[1146]215       IF (o_SWup200clr%flag(iff)<=lev_files(iff)) THEN
216      CALL histwrite_phy(nid_files(iff),
217     s                   o_SWup200clr%name,itau_w,SWup200clr)
[907]218       ENDIF
219
[1146]220       IF (o_SWdn200%flag(iff)<=lev_files(iff)) THEN
221      CALL histwrite_phy(nid_files(iff),o_SWdn200%name,itau_w,SWdn200)
[907]222       ENDIF
223
[1146]224       IF (o_SWdn200clr%flag(iff)<=lev_files(iff)) THEN
225      CALL histwrite_phy(nid_files(iff),
226     s                o_SWdn200clr%name,itau_w,SWdn200clr)
[907]227       ENDIF
228
[1146]229       IF (o_LWup200%flag(iff)<=lev_files(iff)) THEN
230      CALL histwrite_phy(nid_files(iff),o_LWup200%name,itau_w,LWup200)
[907]231       ENDIF
232
[1146]233       IF (o_LWup200clr%flag(iff)<=lev_files(iff)) THEN
234      CALL histwrite_phy(nid_files(iff),
235     s                   o_LWup200clr%name,itau_w,LWup200clr)
[907]236       ENDIF
237
[1146]238       IF (o_LWdn200%flag(iff)<=lev_files(iff)) THEN
239      CALL histwrite_phy(nid_files(iff),
[1279]240     s                   o_LWdn200%name,itau_w,LWdn200)
[907]241       ENDIF
242
[1146]243       IF (o_LWdn200clr%flag(iff)<=lev_files(iff)) THEN
244      CALL histwrite_phy(nid_files(iff),
[1279]245     s                  o_LWdn200clr%name,itau_w,LWdn200clr)
[907]246       ENDIF
247
[1146]248       IF (o_sols%flag(iff)<=lev_files(iff)) THEN
249      CALL histwrite_phy(nid_files(iff),o_sols%name,itau_w,solsw)
[907]250       ENDIF
251
[1146]252       IF (o_sols0%flag(iff)<=lev_files(iff)) THEN
253      CALL histwrite_phy(nid_files(iff),o_sols0%name,itau_w,solsw0)
[907]254       ENDIF
255
[1146]256       IF (o_soll%flag(iff)<=lev_files(iff)) THEN
257      CALL histwrite_phy(nid_files(iff),o_soll%name,itau_w,sollw)
[907]258       ENDIF
259
[1146]260       IF (o_radsol%flag(iff)<=lev_files(iff)) THEN
261      CALL histwrite_phy(nid_files(iff),o_radsol%name,itau_w,radsol)
[907]262       ENDIF
263
[1146]264       IF (o_soll0%flag(iff)<=lev_files(iff)) THEN
265      CALL histwrite_phy(nid_files(iff),o_soll0%name,itau_w,sollw0)
[907]266       ENDIF
267
[1146]268       IF (o_SWupSFC%flag(iff)<=lev_files(iff)) THEN
[907]269      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, 1 )
[1146]270      CALL histwrite_phy(nid_files(iff),
271     s               o_SWupSFC%name,itau_w,zx_tmp_fi2d)
[907]272       ENDIF
273
[1146]274       IF (o_SWupSFCclr%flag(iff)<=lev_files(iff)) THEN
[907]275      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, 1 )
276      CALL histwrite_phy(nid_files(iff), 
[1146]277     $                   o_SWupSFCclr%name,itau_w,zx_tmp_fi2d)
[907]278       ENDIF
279
[1146]280       IF (o_SWdnSFC%flag(iff)<=lev_files(iff)) THEN
[907]281      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, 1 )
282      CALL histwrite_phy(nid_files(iff), 
[1146]283     $                   o_SWdnSFC%name,itau_w,zx_tmp_fi2d)
[907]284       ENDIF
285
[1146]286       IF (o_SWdnSFCclr%flag(iff)<=lev_files(iff)) THEN
[907]287      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, 1 )
288      CALL histwrite_phy(nid_files(iff), 
[1146]289     $                  o_SWdnSFCclr%name,itau_w,zx_tmp_fi2d)
[907]290       ENDIF
291
[1146]292       IF (o_LWupSFC%flag(iff)<=lev_files(iff)) THEN
[907]293      zx_tmp_fi2d(1:klon)=sollwdown(1:klon)-sollw(1:klon)
294      CALL histwrite_phy(nid_files(iff),
[1146]295     $                    o_LWupSFC%name,itau_w,zx_tmp_fi2d)
[907]296       ENDIF
297
[1146]298       IF (o_LWdnSFC%flag(iff)<=lev_files(iff)) THEN
[907]299      CALL histwrite_phy(nid_files(iff),
[1146]300     $                   o_LWdnSFC%name,itau_w,sollwdown)
[907]301       ENDIF
302
[958]303       sollwdownclr(1:klon) = -1.*lwdn0(1:klon,1)
[1146]304       IF (o_LWupSFCclr%flag(iff)<=lev_files(iff)) THEN
[907]305      zx_tmp_fi2d(1:klon)=sollwdownclr(1:klon)-sollw0(1:klon)
306      CALL histwrite_phy(nid_files(iff),
[1146]307     $                   o_LWupSFCclr%name,itau_w,zx_tmp_fi2d)
[907]308       ENDIF
309
[1146]310       IF (o_LWdnSFCclr%flag(iff)<=lev_files(iff)) THEN
[907]311      CALL histwrite_phy(nid_files(iff),
[1146]312     $                   o_LWdnSFCclr%name,itau_w,sollwdownclr)
[907]313       ENDIF
314
[1146]315       IF (o_bils%flag(iff)<=lev_files(iff)) THEN
316      CALL histwrite_phy(nid_files(iff),o_bils%name,itau_w,bils)
[907]317       ENDIF
318
[1146]319       IF (o_sens%flag(iff)<=lev_files(iff)) THEN
[907]320      zx_tmp_fi2d(1:klon)=-1*sens(1:klon)
[1146]321      CALL histwrite_phy(nid_files(iff),o_sens%name,itau_w,zx_tmp_fi2d)
[907]322       ENDIF
323
[1146]324       IF (o_fder%flag(iff)<=lev_files(iff)) THEN
325      CALL histwrite_phy(nid_files(iff),o_fder%name,itau_w,fder)
[907]326       ENDIF
327
[1146]328       IF (o_ffonte%flag(iff)<=lev_files(iff)) THEN
329       CALL histwrite_phy(nid_files(iff),o_ffonte%name,itau_w,zxffonte)
[907]330       ENDIF
331
[1146]332       IF (o_fqcalving%flag(iff)<=lev_files(iff)) THEN
[907]333       CALL histwrite_phy(nid_files(iff),
[1146]334     $                    o_fqcalving%name,itau_w,zxfqcalving)
[907]335       ENDIF
336
[1146]337       IF (o_fqfonte%flag(iff)<=lev_files(iff)) THEN
[907]338       CALL histwrite_phy(nid_files(iff),
[1146]339     $                   o_fqfonte%name,itau_w,zxfqfonte)
[907]340       ENDIF
341
[1334]342       IF (o_taux%flag(iff)<=lev_files(iff)) THEN
343         zx_tmp_fi2d=0.
344         do nsrf=1,nbsrf
345          zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+pctsrf(:,nsrf)*fluxu(:,1,nsrf)
346         enddo
347         CALL histwrite_phy(nid_files(iff),
348     $                   o_taux%name,itau_w,zx_tmp_fi2d)
349       ENDIF
350
351       IF (o_tauy%flag(iff)<=lev_files(iff)) THEN
352         zx_tmp_fi2d=0.
353         do nsrf=1,nbsrf
354          zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+pctsrf(:,nsrf)*fluxv(:,1,nsrf)
355         enddo
356         CALL histwrite_phy(nid_files(iff),
357     $                   o_tauy%name,itau_w,zx_tmp_fi2d)
358       ENDIF
359
[907]360         DO nsrf = 1, nbsrf
[1146]361!           IF(nsrf.GE.2) THEN
362            IF (o_pourc_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]363            zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)*100.
364            CALL histwrite_phy(nid_files(iff),
[1146]365     $                     o_pourc_srf(nsrf)%name,itau_w,
[907]366     $                     zx_tmp_fi2d)
367            ENDIF
368
[1146]369          IF (o_fract_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]370          zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
371          CALL histwrite_phy(nid_files(iff),
[1146]372     $                  o_fract_srf(nsrf)%name,itau_w,
373     $                  zx_tmp_fi2d)
[907]374          ENDIF
[1146]375!         ENDIF !nsrf.GT.2
[907]376
[1146]377        IF (o_taux_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]378        zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
379        CALL histwrite_phy(nid_files(iff),
[1146]380     $                     o_taux_srf(nsrf)%name,itau_w,
381     $                     zx_tmp_fi2d)
[907]382        ENDIF
383
[1146]384        IF (o_tauy_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN           
[907]385        zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
386        CALL histwrite_phy(nid_files(iff),
[1146]387     $                    o_tauy_srf(nsrf)%name,itau_w,
388     $                    zx_tmp_fi2d)
[907]389        ENDIF
390
[1146]391        IF (o_tsol_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]392        zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
393        CALL histwrite_phy(nid_files(iff),
[1146]394     $                   o_tsol_srf(nsrf)%name,itau_w,
[907]395     $      zx_tmp_fi2d)
396        ENDIF
397
[1146]398      IF (o_u10m_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]399      zx_tmp_fi2d(1 : klon) = u10m(1 : klon, nsrf)
[1146]400      CALL histwrite_phy(nid_files(iff),o_u10m_srf(nsrf)%name,
[907]401     $                 itau_w,zx_tmp_fi2d)
402      ENDIF
403
[1146]404      IF (o_v10m_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]405      zx_tmp_fi2d(1 : klon) = v10m(1 : klon, nsrf)
[1146]406      CALL histwrite_phy(nid_files(iff),o_v10m_srf(nsrf)%name,
[907]407     $              itau_w,zx_tmp_fi2d)
408      ENDIF
409 
[1146]410      IF (o_t2m_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]411      zx_tmp_fi2d(1 : klon) = t2m(1 : klon, nsrf)
[1146]412      CALL histwrite_phy(nid_files(iff),o_t2m_srf(nsrf)%name,
[907]413     $           itau_w,zx_tmp_fi2d)
414      ENDIF
415
[1334]416      IF (o_evap_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
417      zx_tmp_fi2d(1 : klon) = fevap(1 : klon, nsrf)
418      CALL histwrite_phy(nid_files(iff),o_evap_srf(nsrf)%name,
419     $           itau_w,zx_tmp_fi2d)
420      ENDIF
421
[1146]422       IF (o_sens_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]423       zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
424       CALL histwrite_phy(nid_files(iff),
[1146]425     $                    o_sens_srf(nsrf)%name,itau_w,
[907]426     $      zx_tmp_fi2d)
427       ENDIF
428
[1146]429        IF (o_lat_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]430        zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
431        CALL histwrite_phy(nid_files(iff),
[1146]432     $                 o_lat_srf(nsrf)%name,itau_w,
[907]433     $                                   zx_tmp_fi2d)
434          ENDIF
435
[1146]436        IF (o_flw_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]437        zx_tmp_fi2d(1 : klon) = fsollw( 1 : klon, nsrf)
438        CALL histwrite_phy(nid_files(iff),
[1146]439     $                     o_flw_srf(nsrf)%name,itau_w,
[907]440     $      zx_tmp_fi2d)
441        ENDIF
442
[1146]443        IF (o_fsw_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]444        zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, nsrf)
445        CALL histwrite_phy(nid_files(iff),
[1146]446     $                   o_fsw_srf(nsrf)%name,itau_w,
[907]447     $      zx_tmp_fi2d)
448        ENDIF
449
[1146]450        IF (o_wbils_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]451        zx_tmp_fi2d(1 : klon) = wfbils( 1 : klon, nsrf)
452        CALL histwrite_phy(nid_files(iff),
[1146]453     $                   o_wbils_srf(nsrf)%name,itau_w,
[907]454     $      zx_tmp_fi2d)
455        ENDIF
456
[1146]457        IF (o_wbilo_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]458        zx_tmp_fi2d(1 : klon) = wfbilo( 1 : klon, nsrf)
459        CALL histwrite_phy(nid_files(iff),
[1146]460     $                    o_wbilo_srf(nsrf)%name,itau_w,
[907]461     $      zx_tmp_fi2d)
462        ENDIF
463
464       if (iflag_pbl>1 .and. lev_histday.gt.10 ) then
[1146]465        IF (o_tke_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]466        CALL histwrite_phy(nid_files(iff),
[1146]467     $                   o_tke_srf(nsrf)%name,itau_w,
468     $                    pbl_tke(:,1:klev,nsrf))
[907]469       ENDIF
470
[1146]471        IF (o_tke_max_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]472        CALL histwrite_phy(nid_files(iff),
[1146]473     $                    o_tke_max_srf(nsrf)%name,itau_w,
[907]474     $      pbl_tke(:,1:klev,nsrf))
475        ENDIF
476       endif
477      ENDDO
478
[1146]479        IF (o_cdrm%flag(iff)<=lev_files(iff)) THEN
480      CALL histwrite_phy(nid_files(iff),o_cdrm%name,itau_w,cdragm)
[907]481        ENDIF
482
[1146]483        IF (o_cdrh%flag(iff)<=lev_files(iff)) THEN
484      CALL histwrite_phy(nid_files(iff),o_cdrh%name,itau_w,cdragh)
[907]485        ENDIF
486
[1146]487        IF (o_cldl%flag(iff)<=lev_files(iff)) THEN
488      CALL histwrite_phy(nid_files(iff),o_cldl%name,itau_w,cldl)
[907]489        ENDIF
490
[1146]491        IF (o_cldm%flag(iff)<=lev_files(iff)) THEN
492      CALL histwrite_phy(nid_files(iff),o_cldm%name,itau_w,cldm)
[907]493        ENDIF
494
[1146]495        IF (o_cldh%flag(iff)<=lev_files(iff)) THEN
496      CALL histwrite_phy(nid_files(iff),o_cldh%name,itau_w,cldh)
[907]497        ENDIF
498
[1146]499        IF (o_cldt%flag(iff)<=lev_files(iff)) THEN
500      CALL histwrite_phy(nid_files(iff),o_cldt%name, 
[1285]501     &                   itau_w,cldt)
[907]502        ENDIF
503
[1146]504        IF (o_cldq%flag(iff)<=lev_files(iff)) THEN
505      CALL histwrite_phy(nid_files(iff),o_cldq%name,itau_w,cldq)
[907]506        ENDIF
507
[1146]508        IF (o_lwp%flag(iff)<=lev_files(iff)) THEN
[907]509      zx_tmp_fi2d(1:klon) = flwp(1:klon)
[1146]510      CALL histwrite_phy(nid_files(iff),
511     s                   o_lwp%name,itau_w,zx_tmp_fi2d)
[907]512        ENDIF
513
[1146]514        IF (o_iwp%flag(iff)<=lev_files(iff)) THEN
[907]515      zx_tmp_fi2d(1:klon) = fiwp(1:klon)
[1146]516      CALL histwrite_phy(nid_files(iff),
517     s                    o_iwp%name,itau_w,zx_tmp_fi2d)
[907]518        ENDIF
519
[1146]520        IF (o_ue%flag(iff)<=lev_files(iff)) THEN
521      CALL histwrite_phy(nid_files(iff),o_ue%name,itau_w,ue)
[907]522        ENDIF
523
[1146]524        IF (o_ve%flag(iff)<=lev_files(iff)) THEN
525      CALL histwrite_phy(nid_files(iff),o_ve%name,itau_w,ve)
[907]526        ENDIF
527
[1146]528        IF (o_uq%flag(iff)<=lev_files(iff)) THEN
529      CALL histwrite_phy(nid_files(iff),o_uq%name,itau_w,uq)
[907]530        ENDIF
531
[1146]532        IF (o_vq%flag(iff)<=lev_files(iff)) THEN
533      CALL histwrite_phy(nid_files(iff),o_vq%name,itau_w,vq)
[907]534        ENDIF
535
536      IF(iflag_con.GE.3) THEN ! sb
[1146]537        IF (o_cape%flag(iff)<=lev_files(iff)) THEN
538      CALL histwrite_phy(nid_files(iff),o_cape%name,itau_w,cape)
[907]539        ENDIF
540
[1146]541        IF (o_pbase%flag(iff)<=lev_files(iff)) THEN
[1334]542      CALL histwrite_phy(nid_files(iff),o_pbase%name,itau_w,ema_pcb)
[907]543        ENDIF
544
[1146]545        IF (o_ptop%flag(iff)<=lev_files(iff)) THEN
546      CALL histwrite_phy(nid_files(iff),o_ptop%name,itau_w,ema_pct)
[907]547        ENDIF
548
[1146]549        IF (o_fbase%flag(iff)<=lev_files(iff)) THEN
550      CALL histwrite_phy(nid_files(iff),o_fbase%name,itau_w,ema_cbmf)
[907]551        ENDIF
552
[1146]553        IF (o_prw%flag(iff)<=lev_files(iff)) THEN
554      CALL histwrite_phy(nid_files(iff),o_prw%name,itau_w,prw)
[907]555        ENDIF
[1100]556
[1146]557      IF (o_cape_max%flag(iff)<=lev_files(iff)) THEN
558      CALL histwrite_phy(nid_files(iff),o_cape_max%name,itau_w,cape)
[1100]559      ENDIF
560
[1146]561       IF (o_upwd%flag(iff)<=lev_files(iff)) THEN
562      CALL histwrite_phy(nid_files(iff),o_upwd%name,itau_w,upwd)
563       ENDIF
564
565       IF (o_Ma%flag(iff)<=lev_files(iff)) THEN
566      CALL histwrite_phy(nid_files(iff),o_Ma%name,itau_w,Ma)
567       ENDIF
568
569       IF (o_dnwd%flag(iff)<=lev_files(iff)) THEN
570      CALL histwrite_phy(nid_files(iff),o_dnwd%name,itau_w,dnwd)
571       ENDIF
572
573       IF (o_dnwd0%flag(iff)<=lev_files(iff)) THEN
574      CALL histwrite_phy(nid_files(iff),o_dnwd0%name,itau_w,dnwd0)
575       ENDIF
576
[1334]577       IF (o_ftime_con%flag(iff)<=lev_files(iff)) THEN
578        zx_tmp_fi2d=float(itau_con)/float(itap)
579      CALL histwrite_phy(nid_files(iff),o_ftime_con%name,
580     s                   itau_w,zx_tmp_fi2d)
581       ENDIF
582
583       IF (o_mc%flag(iff)<=lev_files(iff)) THEN
584        if(iflag_thermals.gt.1)then
585         zx_tmp_fi3d=dnwd+dnwd0+upwd+fm_therm
586        else
587         zx_tmp_fi3d=dnwd+dnwd0+upwd
588        endif
589      CALL histwrite_phy(nid_files(iff),o_mc%name,itau_w,zx_tmp_fi3d)
590       ENDIF
591     
[907]592      ENDIF !iflag_con .GE. 3
593
[1146]594        IF (o_s_pblh%flag(iff)<=lev_files(iff)) THEN
595      CALL histwrite_phy(nid_files(iff),o_s_pblh%name,itau_w,s_pblh)
[907]596        ENDIF
597
[1146]598        IF (o_s_pblt%flag(iff)<=lev_files(iff)) THEN
599      CALL histwrite_phy(nid_files(iff),o_s_pblt%name,itau_w,s_pblt)
[907]600        ENDIF
601
[1146]602        IF (o_s_lcl%flag(iff)<=lev_files(iff)) THEN
603      CALL histwrite_phy(nid_files(iff),o_s_lcl%name,itau_w,s_lcl)
[907]604        ENDIF
605
[1398]606        IF (o_s_therm%flag(iff)<=lev_files(iff)) THEN
607      CALL histwrite_phy(nid_files(iff),o_s_therm%name,itau_w,s_therm)
[907]608        ENDIF
609
[1398]610!IM : Les champs suivants (s_capCL, s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
611!       IF (o_s_capCL%flag(iff)<=lev_files(iff)) THEN
612!     CALL histwrite_phy(nid_files(iff),o_s_capCL%name,itau_w,s_capCL)
613!       ENDIF
[907]614
[1398]615!       IF (o_s_oliqCL%flag(iff)<=lev_files(iff)) THEN
616!     CALL histwrite_phy(nid_files(iff),o_s_oliqCL%name,itau_w,s_oliqCL)
617!       ENDIF
[907]618
[1398]619!       IF (o_s_cteiCL%flag(iff)<=lev_files(iff)) THEN
620!     CALL histwrite_phy(nid_files(iff),o_s_cteiCL%name,itau_w,s_cteiCL)
621!       ENDIF
[907]622
[1398]623!       IF (o_s_trmb1%flag(iff)<=lev_files(iff)) THEN
624!     CALL histwrite_phy(nid_files(iff),o_s_trmb1%name,itau_w,s_trmb1)
625!       ENDIF
[907]626
[1398]627!       IF (o_s_trmb2%flag(iff)<=lev_files(iff)) THEN
628!     CALL histwrite_phy(nid_files(iff),o_s_trmb2%name,itau_w,s_trmb2)
629!       ENDIF
[907]630
[1398]631!       IF (o_s_trmb3%flag(iff)<=lev_files(iff)) THEN
632!     CALL histwrite_phy(nid_files(iff),o_s_trmb3%name,itau_w,s_trmb3)
633!       ENDIF
[907]634
635! Champs interpolles sur des niveaux de pression
636
[1146]637        ll=0
[907]638        DO k=1, nlevSTD
[1279]639!         IF(k.GE.2.AND.k.LE.12) bb2=clevSTD(k)
640!         IF(k.GE.13.AND.k.LE.17) bb3=clevSTD(k)
641         bb2=clevSTD(k) 
[907]642         IF(bb2.EQ."850".OR.bb2.EQ."700".OR.
[1279]643     $      bb2.EQ."500".OR.bb2.EQ."200".OR.
644     $      bb2.EQ."50".OR.bb2.EQ."10") THEN
[907]645
646! a refaire correctement !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[1146]647          ll=ll+1
648       IF (o_uSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
649       CALL histwrite_phy(nid_files(iff),o_uSTDlevs(ll)%name,
650     &                    itau_w,uwriteSTD(:,k,iff))
[907]651       ENDIF
652
[1146]653       IF (o_vSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
654      CALL histwrite_phy(nid_files(iff),o_vSTDlevs(ll)%name, 
655     &                   itau_w,vwriteSTD(:,k,iff))
[907]656       ENDIF
657
[1146]658       IF (o_wSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
659      CALL histwrite_phy(nid_files(iff),o_wSTDlevs(ll)%name,
660     &                    itau_w,wwriteSTD(:,k,iff))
[907]661       ENDIF
662
[1398]663       IF (o_zSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
664      CALL histwrite_phy(nid_files(iff),o_zSTDlevs(ll)%name,
[1055]665     &               itau_w,phiwriteSTD(:,k,iff))
[907]666       ENDIF
667
[1146]668       IF (o_qSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
669      CALL histwrite_phy(nid_files(iff),o_qSTDlevs(ll)%name,
670     &                   itau_w, qwriteSTD(:,k,iff))
[907]671       ENDIF
672
[1146]673       IF (o_tSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
674      CALL histwrite_phy(nid_files(iff),o_tSTDlevs(ll)%name,
675     &                   itau_w, twriteSTD(:,k,iff))
[907]676       ENDIF
677
678       ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR.
679       ENDDO
680
[1146]681      IF (o_t_oce_sic%flag(iff)<=lev_files(iff)) THEN
[907]682      DO i=1, klon
683       IF (pctsrf(i,is_oce).GT.epsfra.OR.
684     $     pctsrf(i,is_sic).GT.epsfra) THEN
685        zx_tmp_fi2d(i) = (ftsol(i, is_oce) * pctsrf(i,is_oce)+
686     $                   ftsol(i, is_sic) * pctsrf(i,is_sic))/
687     $                   (pctsrf(i,is_oce)+pctsrf(i,is_sic))
688       ELSE
689        zx_tmp_fi2d(i) = 273.15
690       ENDIF
691      ENDDO
[1146]692      CALL histwrite_phy(nid_files(iff),
693     s                   o_t_oce_sic%name,itau_w,zx_tmp_fi2d)
[907]694      ENDIF
695
[1146]696! Couplage convection-couche limite
697      IF (iflag_con.GE.3) THEN
[1491]698      IF (iflag_coupl>=1) THEN
[1146]699       IF (o_ale_bl%flag(iff)<=lev_files(iff)) THEN
700       CALL histwrite_phy(nid_files(iff),o_ale_bl%name,itau_w,ale_bl)
[951]701       ENDIF
[1146]702       IF (o_alp_bl%flag(iff)<=lev_files(iff)) THEN
703       CALL histwrite_phy(nid_files(iff),o_alp_bl%name,itau_w,alp_bl)
[951]704       ENDIF
[1491]705      ENDIF !iflag_coupl>=1
[1146]706      ENDIF !(iflag_con.GE.3)
[951]707
[1146]708! Wakes
709      IF (iflag_con.EQ.3) THEN
[951]710      IF (iflag_wake.EQ.1) THEN
[1146]711       IF (o_ale_wk%flag(iff)<=lev_files(iff)) THEN
712       CALL histwrite_phy(nid_files(iff),o_ale_wk%name,itau_w,ale_wake)
[951]713       ENDIF
[1146]714       IF (o_alp_wk%flag(iff)<=lev_files(iff)) THEN
715       CALL histwrite_phy(nid_files(iff),o_alp_wk%name,itau_w,alp_wake)
[951]716       ENDIF
[973]717
[1146]718       IF (o_ale%flag(iff)<=lev_files(iff)) THEN
719       CALL histwrite_phy(nid_files(iff),o_ale%name,itau_w,ale)
[973]720       ENDIF
[1146]721       IF (o_alp%flag(iff)<=lev_files(iff)) THEN
722       CALL histwrite_phy(nid_files(iff),o_alp%name,itau_w,alp)
[1063]723       ENDIF
[1146]724       IF (o_cin%flag(iff)<=lev_files(iff)) THEN
725       CALL histwrite_phy(nid_files(iff),o_cin%name,itau_w,cin)
726       ENDIF
727       IF (o_wape%flag(iff)<=lev_files(iff)) THEN
728       CALL histwrite_phy(nid_files(iff),o_WAPE%name,itau_w,wake_pe)
729       ENDIF
730       IF (o_wake_h%flag(iff)<=lev_files(iff)) THEN
731      CALL histwrite_phy(nid_files(iff),o_wake_h%name,itau_w,wake_h)
732       ENDIF
[1063]733
[1146]734       IF (o_wake_s%flag(iff)<=lev_files(iff)) THEN
735      CALL histwrite_phy(nid_files(iff),o_wake_s%name,itau_w,wake_s)
[1063]736       ENDIF
737
[1146]738        IF (o_wake_deltat%flag(iff)<=lev_files(iff)) THEN
739       CALL histwrite_phy(nid_files(iff),o_wake_deltat%name,
[1063]740     $                     itau_w,wake_deltat)
741        ENDIF
742
[1146]743        IF (o_wake_deltaq%flag(iff)<=lev_files(iff)) THEN
744       CALL histwrite_phy(nid_files(iff),o_wake_deltaq%name,
[1063]745     $                    itau_w,wake_deltaq)
746        ENDIF
747
[1146]748        IF (o_wake_omg%flag(iff)<=lev_files(iff)) THEN
749       CALL histwrite_phy(nid_files(iff),
750     s                    o_wake_omg%name,itau_w,wake_omg)
[1063]751        ENDIF
[1146]752
753         IF (o_dtwak%flag(iff)<=lev_files(iff)) THEN
754           zx_tmp_fi3d(1:klon,1:klev)=d_t_wake(1:klon,1:klev)
[1100]755     &                                        /pdtphys
[1146]756           CALL histwrite_phy(nid_files(iff),
757     &                       o_dtwak%name,itau_w,zx_tmp_fi3d)
758         ENDIF
759
760        IF (o_dqwak%flag(iff)<=lev_files(iff)) THEN
761        zx_tmp_fi3d(1:klon,1:klev)=d_q_wake(1:klon,1:klev)/pdtphys
762        CALL histwrite_phy(nid_files(iff),
763     &                     o_dqwak%name,itau_w,zx_tmp_fi3d)
[1100]764        ENDIF
[1146]765      ENDIF ! iflag_wake.EQ.1
[1063]766
[1146]767        IF (o_Vprecip%flag(iff)<=lev_files(iff)) THEN
768       CALL histwrite_phy(nid_files(iff),o_Vprecip%name,itau_w,Vprecip)
[1063]769        ENDIF
770
[1146]771        IF (o_ftd%flag(iff)<=lev_files(iff)) THEN
772       CALL histwrite_phy(nid_files(iff),o_ftd%name,itau_w,ftd)
[1063]773        ENDIF
774
[1146]775        IF (o_fqd%flag(iff)<=lev_files(iff)) THEN
776       CALL histwrite_phy(nid_files(iff),o_fqd%name,itau_w,fqd)
[1063]777        ENDIF
[1100]778      ENDIF !(iflag_con.EQ.3) 
[996]779 
[1146]780      IF (type_ocean=='slab ') THEN
781      IF ( o_slab_bils%flag(iff)<=lev_files(iff)) 
[996]782     $     CALL histwrite_phy(
[1146]783     $     nid_files(iff),o_slab_bils%name,itau_w,slab_wfbils)
[907]784
[996]785      ENDIF !type_ocean == force/slab
[907]786
[1146]787      IF (o_weakinv%flag(iff)<=lev_files(iff)) THEN
788      CALL histwrite_phy(nid_files(iff),
789     s                  o_weakinv%name,itau_w,weak_inversion)
[907]790      ENDIF
791
[1146]792      IF (o_dthmin%flag(iff)<=lev_files(iff)) THEN
793      CALL histwrite_phy(nid_files(iff),o_dthmin%name,itau_w,dthmin)
[907]794      ENDIF
795
[1146]796       IF (o_cldtau%flag(iff)<=lev_files(iff)) THEN
797       CALL histwrite_phy(nid_files(iff),o_cldtau%name,itau_w,cldtau)
[907]798       ENDIF
799
[1146]800       IF (o_cldemi%flag(iff)<=lev_files(iff)) THEN
801       CALL histwrite_phy(nid_files(iff),o_cldemi%name,itau_w,cldemi)
[907]802       ENDIF
803
[1279]804      IF (o_pr_con_l%flag(iff)<=lev_files(iff)) THEN
805      CALL histwrite_phy(nid_files(iff),
806     s         o_pr_con_l%name,itau_w,pmflxr(:,1:klev))
807      ENDIF
[929]808
[1279]809      IF (o_pr_con_i%flag(iff)<=lev_files(iff)) THEN
810      CALL histwrite_phy(nid_files(iff),
811     s         o_pr_con_i%name,itau_w,pmflxs(:,1:klev))
812      ENDIF
[929]813
[1279]814      IF (o_pr_lsc_l%flag(iff)<=lev_files(iff)) THEN
815      CALL histwrite_phy(nid_files(iff),
816     s        o_pr_lsc_l%name,itau_w,prfl(:,1:klev))
817      ENDIF
[929]818
[1279]819      IF (o_pr_lsc_i%flag(iff)<=lev_files(iff)) THEN
820      CALL histwrite_phy(nid_files(iff),
821     s        o_pr_lsc_i%name,itau_w,psfl(:,1:klev))
822      ENDIF
[929]823
[1284]824      IF (o_re%flag(iff)<=lev_files(iff)) THEN
825      CALL histwrite_phy(nid_files(iff),o_re%name,itau_w,re)
826      ENDIF
[1279]827
[1284]828      IF (o_fl%flag(iff)<=lev_files(iff)) THEN
829      CALL histwrite_phy(nid_files(iff),o_fl%name,itau_w,fl)
830      ENDIF
831
832
833
[1146]834      IF (o_rh2m%flag(iff)<=lev_files(iff)) THEN
[907]835      DO i=1, klon
836       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
837      ENDDO
[1146]838      CALL histwrite_phy(nid_files(iff),o_rh2m%name,itau_w,zx_tmp_fi2d)
[907]839      ENDIF
840
[1334]841      IF (o_rh2m_min%flag(iff)<=lev_files(iff)) THEN
842      DO i=1, klon
843       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
844      ENDDO
845      CALL histwrite_phy(nid_files(iff),o_rh2m_min%name,
846     s               itau_w,zx_tmp_fi2d)
847      ENDIF
848
849      IF (o_rh2m_max%flag(iff)<=lev_files(iff)) THEN
850      DO i=1, klon
851       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
852      ENDDO
853      CALL histwrite_phy(nid_files(iff),o_rh2m_max%name,
854     s              itau_w,zx_tmp_fi2d)
855      ENDIF
856
857
[1146]858      IF (o_qsat2m%flag(iff)<=lev_files(iff)) THEN
859      CALL histwrite_phy(nid_files(iff),o_qsat2m%name,itau_w,qsat2m)
[907]860      ENDIF
861
[1146]862      IF (o_tpot%flag(iff)<=lev_files(iff)) THEN
863      CALL histwrite_phy(nid_files(iff),o_tpot%name,itau_w,tpot)
[907]864      ENDIF
865
[1146]866       IF (o_tpote%flag(iff)<=lev_files(iff)) THEN
867      CALL histwrite_phy(nid_files(iff),o_tpote%name,itau_w,tpote)
[907]868       ENDIF
869
[1146]870      IF (o_SWnetOR%flag(iff)<=lev_files(iff)) THEN
[907]871      zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, is_ter)
[1146]872      CALL histwrite_phy(nid_files(iff),
873     s                   o_SWnetOR%name,itau_w, zx_tmp_fi2d)
[907]874      ENDIF
875
[1146]876      IF (o_SWdownOR%flag(iff)<=lev_files(iff)) THEN
[907]877      zx_tmp_fi2d(1:klon) = solsw(1:klon)/(1.-albsol1(1:klon))
[1146]878      CALL histwrite_phy(nid_files(iff),
879     s                   o_SWdownOR%name,itau_w, zx_tmp_fi2d)
[907]880      ENDIF
881
[1146]882      IF (o_LWdownOR%flag(iff)<=lev_files(iff)) THEN
883      CALL histwrite_phy(nid_files(iff),
884     s                  o_LWdownOR%name,itau_w,sollwdown)
[907]885      ENDIF
886
[1146]887      IF (o_snowl%flag(iff)<=lev_files(iff)) THEN
888      CALL histwrite_phy(nid_files(iff),o_snowl%name,itau_w,snow_lsc)
[907]889      ENDIF
890
[1146]891      IF (o_solldown%flag(iff)<=lev_files(iff)) THEN
892      CALL histwrite_phy(nid_files(iff),
893     s                   o_solldown%name,itau_w,sollwdown)
[907]894      ENDIF
895
[1146]896      IF (o_dtsvdfo%flag(iff)<=lev_files(iff)) THEN
897      CALL histwrite_phy(nid_files(iff),
898     s                 o_dtsvdfo%name,itau_w,d_ts(:,is_oce))
[907]899      ENDIF
900
[1146]901      IF (o_dtsvdft%flag(iff)<=lev_files(iff)) THEN
902      CALL histwrite_phy(nid_files(iff),
903     s                   o_dtsvdft%name,itau_w,d_ts(:,is_ter))
[907]904      ENDIF
905
[1146]906       IF (o_dtsvdfg%flag(iff)<=lev_files(iff)) THEN
[907]907        CALL histwrite_phy(nid_files(iff),
[1146]908     $                   o_dtsvdfg%name,itau_w, d_ts(:,is_lic))
[907]909       ENDIF
910
[1146]911       IF (o_dtsvdfi%flag(iff)<=lev_files(iff)) THEN
912      CALL histwrite_phy(nid_files(iff),
913     s                   o_dtsvdfi%name,itau_w,d_ts(:,is_sic))
[907]914       ENDIF
915
[1146]916       IF (o_rugs%flag(iff)<=lev_files(iff)) THEN
917      CALL histwrite_phy(nid_files(iff),o_rugs%name,itau_w,zxrugs)
[907]918       ENDIF
919
[1279]920! OD550 per species
921      IF (new_aod .and. (.not. aerosol_couple)) THEN
[1345]922          IF (ok_ade.OR.ok_aie) THEN
[1337]923
924          IF (o_od550aer%flag(iff)<=lev_files(iff)) THEN
925             CALL histwrite_phy(nid_files(iff),o_od550aer%name,itau_w,
926     $            od550aer)
927          ENDIF
928          IF (o_od865aer%flag(iff)<=lev_files(iff)) THEN
929             CALL histwrite_phy(nid_files(iff),o_od865aer%name,itau_w,
930     $            od865aer)
931          ENDIF
932          IF (o_absvisaer%flag(iff)<=lev_files(iff)) THEN
933             CALL histwrite_phy(nid_files(iff),o_absvisaer%name,itau_w,
934     $            absvisaer)
935          ENDIF
936          IF (o_od550lt1aer%flag(iff)<=lev_files(iff)) THEN
937            CALL histwrite_phy(nid_files(iff),o_od550lt1aer%name,itau_w,
938     $            od550lt1aer)
939          ENDIF
940
[1345]941          IF (o_sconcso4%flag(iff)<=lev_files(iff)) THEN
942              CALL histwrite_phy(nid_files(iff),o_sconcso4%name,itau_w,
943     $            sconcso4)
[1279]944          ENDIF
[1345]945          IF (o_sconcoa%flag(iff)<=lev_files(iff)) THEN
946              CALL histwrite_phy(nid_files(iff),o_sconcoa%name,itau_w,
947     $            sconcoa)
948          ENDIF
949          IF (o_sconcbc%flag(iff)<=lev_files(iff)) THEN
950              CALL histwrite_phy(nid_files(iff),o_sconcbc%name,itau_w,
951     $            sconcbc)
952          ENDIF
953          IF (o_sconcss%flag(iff)<=lev_files(iff)) THEN
954              CALL histwrite_phy(nid_files(iff),o_sconcss%name,itau_w,
955     $            sconcss)
956          ENDIF
957          IF (o_sconcdust%flag(iff)<=lev_files(iff)) THEN
958              CALL histwrite_phy(nid_files(iff),o_sconcdust%name,itau_w,
959     $            sconcdust)
960          ENDIF
961         
962          IF (o_concso4%flag(iff)<=lev_files(iff)) THEN
963              CALL histwrite_phy(nid_files(iff),o_concso4%name,itau_w,
964     $            concso4)
965          ENDIF
966          IF (o_concoa%flag(iff)<=lev_files(iff)) THEN
967              CALL histwrite_phy(nid_files(iff),o_concoa%name,itau_w,
968     $            concoa)
969          ENDIF
970          IF (o_concbc%flag(iff)<=lev_files(iff)) THEN
971              CALL histwrite_phy(nid_files(iff),o_concbc%name,itau_w,
972     $            concbc)
973          ENDIF
974          IF (o_concss%flag(iff)<=lev_files(iff)) THEN
975              CALL histwrite_phy(nid_files(iff),o_concss%name,itau_w,
976     $            concss)
977          ENDIF
978          IF (o_concdust%flag(iff)<=lev_files(iff)) THEN
979              CALL histwrite_phy(nid_files(iff),o_concdust%name,itau_w,
980     $            concdust)
981          ENDIF
982         
983          IF (o_loadso4%flag(iff)<=lev_files(iff)) THEN
984              CALL histwrite_phy(nid_files(iff),o_loadso4%name,itau_w,
985     $            loadso4)
986          ENDIF
987          IF (o_loadoa%flag(iff)<=lev_files(iff)) THEN
988              CALL histwrite_phy(nid_files(iff),o_loadoa%name,itau_w,
989     $            loadoa)
990          ENDIF
991          IF (o_loadbc%flag(iff)<=lev_files(iff)) THEN
992              CALL histwrite_phy(nid_files(iff),o_loadbc%name,itau_w,
993     $            loadbc)
994          ENDIF
995          IF (o_loadss%flag(iff)<=lev_files(iff)) THEN
996              CALL histwrite_phy(nid_files(iff),o_loadss%name,itau_w,
997     $            loadss)
998          ENDIF
999          IF (o_loaddust%flag(iff)<=lev_files(iff)) THEN
1000              CALL histwrite_phy(nid_files(iff),o_loaddust%name,itau_w,
1001     $            loaddust)
1002          ENDIF
1003         
1004          DO naero = 1, naero_spc
1005            IF (o_tausumaero(naero)%flag(iff)<=lev_files(iff)) THEN
1006                CALL histwrite_phy(nid_files(iff),
1007     $              o_tausumaero(naero)%name,itau_w,
1008     $              tausum_aero(:,2,naero) )
1009            ENDIF
1010          END DO
1011          endif
[1279]1012      ENDIF
[1345]1013     
[1146]1014       IF (ok_ade) THEN
[1279]1015          IF (o_topswad%flag(iff)<=lev_files(iff)) THEN
1016             CALL histwrite_phy(nid_files(iff),o_topswad%name,itau_w,
1017     $            topswad_aero)
1018          ENDIF
1019          IF (o_solswad%flag(iff)<=lev_files(iff)) THEN
1020             CALL histwrite_phy(nid_files(iff),o_solswad%name,itau_w,
1021     $            solswad_aero)
1022          ENDIF
1023
1024!====MS forcing diagnostics
1025        if (new_aod) then             
1026        IF (o_swtoaas_nat%flag(iff)<=lev_files(iff)) THEN
1027        CALL histwrite_phy(nid_files(iff),o_swtoaas_nat%name,itau_w,
1028     $      topsw_aero(:,1))
[1146]1029        ENDIF
[1279]1030
1031        IF (o_swsrfas_nat%flag(iff)<=lev_files(iff)) THEN
1032        CALL histwrite_phy(nid_files(iff),o_swsrfas_nat%name,itau_w,
1033     $      solsw_aero(:,1))
[1146]1034        ENDIF
1035
[1279]1036        IF (o_swtoacs_nat%flag(iff)<=lev_files(iff)) THEN
1037        CALL histwrite_phy(nid_files(iff),o_swtoacs_nat%name,itau_w,
1038     $      topsw0_aero(:,1))
[1146]1039        ENDIF
[1279]1040
1041        IF (o_swsrfcs_nat%flag(iff)<=lev_files(iff)) THEN
1042        CALL histwrite_phy(nid_files(iff),o_swsrfcs_nat%name,itau_w,
1043     $      solsw0_aero(:,1))
[1146]1044        ENDIF
[1279]1045 
1046!ant
1047        IF (o_swtoaas_ant%flag(iff)<=lev_files(iff)) THEN
1048        CALL histwrite_phy(nid_files(iff),o_swtoaas_ant%name,itau_w,
1049     $      topsw_aero(:,2))
1050        ENDIF
1051
1052        IF (o_swsrfas_ant%flag(iff)<=lev_files(iff)) THEN
1053        CALL histwrite_phy(nid_files(iff),o_swsrfas_ant%name,itau_w,
1054     $      solsw_aero(:,2))
1055        ENDIF
1056
1057        IF (o_swtoacs_ant%flag(iff)<=lev_files(iff)) THEN
1058        CALL histwrite_phy(nid_files(iff),o_swtoacs_ant%name,itau_w,
1059     $      topsw0_aero(:,2))
1060        ENDIF
1061
1062        IF (o_swsrfcs_ant%flag(iff)<=lev_files(iff)) THEN
1063        CALL histwrite_phy(nid_files(iff),o_swsrfcs_ant%name,itau_w,
1064     $      solsw0_aero(:,2))
1065        ENDIF
1066
1067!cf
1068
1069        if (.not. aerosol_couple) then
1070        IF (o_swtoacf_nat%flag(iff)<=lev_files(iff)) THEN
1071        CALL histwrite_phy(nid_files(iff),o_swtoacf_nat%name,itau_w,
1072     $      topswcf_aero(:,1))
1073        ENDIF
1074
1075        IF (o_swsrfcf_nat%flag(iff)<=lev_files(iff)) THEN
1076        CALL histwrite_phy(nid_files(iff),o_swsrfcf_nat%name,itau_w,
1077     $      solswcf_aero(:,1))
1078        ENDIF
1079
1080        IF (o_swtoacf_ant%flag(iff)<=lev_files(iff)) THEN
1081        CALL histwrite_phy(nid_files(iff),o_swtoacf_ant%name,itau_w,
1082     $      topswcf_aero(:,2))
1083        ENDIF
1084
1085        IF (o_swsrfcf_ant%flag(iff)<=lev_files(iff)) THEN
1086        CALL histwrite_phy(nid_files(iff),o_swsrfcf_ant%name,itau_w,
1087     $      solswcf_aero(:,2))
1088        ENDIF
1089
1090        IF (o_swtoacf_zero%flag(iff)<=lev_files(iff)) THEN
1091        CALL histwrite_phy(nid_files(iff),o_swtoacf_zero%name,itau_w,
1092     $      topswcf_aero(:,3))
1093        ENDIF
1094
1095        IF (o_swsrfcf_zero%flag(iff)<=lev_files(iff)) THEN
1096        CALL histwrite_phy(nid_files(iff),o_swsrfcf_zero%name,itau_w,
1097     $      solswcf_aero(:,3))
1098        ENDIF
1099        endif
1100
1101        endif ! new_aod
1102!====MS forcing diagnostics
1103
[1146]1104       ENDIF
1105
[1279]1106       IF (ok_aie) THEN
1107          IF (o_topswai%flag(iff)<=lev_files(iff)) THEN
1108             CALL histwrite_phy(nid_files(iff),o_topswai%name,itau_w,
1109     $            topswai_aero)
1110          ENDIF
1111          IF (o_solswai%flag(iff)<=lev_files(iff)) THEN
1112             CALL histwrite_phy(nid_files(iff),o_solswai%name,itau_w,
1113     $            solswai_aero)
1114          ENDIF
[1337]1115          IF (o_scdnc%flag(iff)<=lev_files(iff)) THEN
1116             CALL histwrite_phy(nid_files(iff),o_scdnc%name,itau_w,
1117     $            scdnc)
1118          ENDIF
1119          IF (o_cldncl%flag(iff)<=lev_files(iff)) THEN
1120             CALL histwrite_phy(nid_files(iff),o_cldncl%name,itau_w,
1121     $            cldncl)
1122          ENDIF
1123          IF (o_reffclws%flag(iff)<=lev_files(iff)) THEN
1124             CALL histwrite_phy(nid_files(iff),o_reffclws%name,itau_w,
1125     $            reffclws)
1126          ENDIF
1127          IF (o_reffclwc%flag(iff)<=lev_files(iff)) THEN
1128             CALL histwrite_phy(nid_files(iff),o_reffclwc%name,itau_w,
1129     $            reffclwc)
1130          ENDIF
1131          IF (o_cldnvi%flag(iff)<=lev_files(iff)) THEN
1132             CALL histwrite_phy(nid_files(iff),o_cldnvi%name,itau_w,
1133     $            cldnvi)
1134          ENDIF
1135          IF (o_lcc%flag(iff)<=lev_files(iff)) THEN
1136             CALL histwrite_phy(nid_files(iff),o_lcc%name,itau_w,
1137     $            lcc)
1138          ENDIF
1139          IF (o_lcc3d%flag(iff)<=lev_files(iff)) THEN
1140             CALL histwrite_phy(nid_files(iff),o_lcc3d%name,itau_w,
1141     $            lcc3d)
1142          ENDIF
1143          IF (o_lcc3dcon%flag(iff)<=lev_files(iff)) THEN
1144             CALL histwrite_phy(nid_files(iff),o_lcc3dcon%name,itau_w,
1145     $            lcc3dcon)
1146          ENDIF
1147          IF (o_lcc3dstra%flag(iff)<=lev_files(iff)) THEN
1148             CALL histwrite_phy(nid_files(iff),o_lcc3dstra%name,itau_w,
1149     $            lcc3dstra)
1150          ENDIF
1151          IF (o_reffclwtop%flag(iff)<=lev_files(iff)) THEN
1152             CALL histwrite_phy(nid_files(iff),o_reffclwtop%name,itau_w,
1153     $            reffclwtop)
1154          ENDIF
[1279]1155       ENDIF
1156
[907]1157! Champs 3D:
[1364]1158       IF (ok_ade .OR. ok_aie) then
1159          IF (o_ec550aer%flag(iff)<=lev_files(iff)) THEN
[1367]1160             CALL histwrite_phy(nid_files(iff),o_ec550aer%name,itau_w,
1161     &            ec550aer)
[1364]1162          ENDIF
[1337]1163       ENDIF
1164
[1146]1165       IF (o_lwcon%flag(iff)<=lev_files(iff)) THEN
1166      CALL histwrite_phy(nid_files(iff),o_lwcon%name,itau_w,flwc)
[907]1167       ENDIF
1168
[1146]1169       IF (o_iwcon%flag(iff)<=lev_files(iff)) THEN
1170      CALL histwrite_phy(nid_files(iff),o_iwcon%name,itau_w,fiwc)
[907]1171       ENDIF
1172
[1146]1173       IF (o_temp%flag(iff)<=lev_files(iff)) THEN
1174      CALL histwrite_phy(nid_files(iff),o_temp%name,itau_w,t_seri)
[907]1175       ENDIF
1176
[1146]1177       IF (o_theta%flag(iff)<=lev_files(iff)) THEN
1178      CALL histwrite_phy(nid_files(iff),o_theta%name,itau_w,theta)
[945]1179       ENDIF
1180
[1398]1181       IF (o_ovapinit%flag(iff)<=lev_files(iff)) THEN
1182      CALL histwrite_phy(nid_files(iff),o_ovapinit%name,itau_w,
1183     $ qx(:,:,ivap))
[907]1184       ENDIF
1185
[1398]1186       IF (o_ovap%flag(iff)<=lev_files(iff)) THEN
[1146]1187      CALL histwrite_phy(nid_files(iff),
[1398]1188     $                   o_ovap%name,itau_w,q_seri)
[907]1189       ENDIF
1190
[1146]1191       IF (o_geop%flag(iff)<=lev_files(iff)) THEN
1192      CALL histwrite_phy(nid_files(iff),o_geop%name,itau_w,zphi)
[907]1193       ENDIF
1194
[1146]1195       IF (o_vitu%flag(iff)<=lev_files(iff)) THEN
1196      CALL histwrite_phy(nid_files(iff),o_vitu%name,itau_w,u_seri)
[907]1197       ENDIF
1198
[1146]1199       IF (o_vitv%flag(iff)<=lev_files(iff)) THEN
1200      CALL histwrite_phy(nid_files(iff),o_vitv%name,itau_w,v_seri)
[907]1201       ENDIF
1202
[1146]1203       IF (o_vitw%flag(iff)<=lev_files(iff)) THEN
1204      CALL histwrite_phy(nid_files(iff),o_vitw%name,itau_w,omega)
1205       ENDIF
1206
1207        IF (o_pres%flag(iff)<=lev_files(iff)) THEN
1208      CALL histwrite_phy(nid_files(iff),o_pres%name,itau_w,pplay)
[907]1209        ENDIF
1210
[1334]1211        IF (o_paprs%flag(iff)<=lev_files(iff)) THEN
1212      CALL histwrite_phy(nid_files(iff),o_paprs%name,
1213     s                    itau_w,paprs(:,1:klev))
1214        ENDIF
1215
[1146]1216       IF (o_rneb%flag(iff)<=lev_files(iff)) THEN
1217      CALL histwrite_phy(nid_files(iff),o_rneb%name,itau_w,cldfra)
[907]1218       ENDIF
1219
[1146]1220       IF (o_rnebcon%flag(iff)<=lev_files(iff)) THEN
1221      CALL histwrite_phy(nid_files(iff),o_rnebcon%name,itau_w,rnebcon)
[907]1222       ENDIF
1223
[1146]1224       IF (o_rhum%flag(iff)<=lev_files(iff)) THEN
1225      CALL histwrite_phy(nid_files(iff),o_rhum%name,itau_w,zx_rh)
[907]1226       ENDIF
1227
[1146]1228      IF (o_ozone%flag(iff)<=lev_files(iff)) THEN
[1279]1229         CALL histwrite_phy(nid_files(iff), o_ozone%name, itau_w,
1230     $        wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
[907]1231      ENDIF
1232
[1279]1233      IF (o_ozone_light%flag(iff)<=lev_files(iff) .and.
1234     $     read_climoz == 2) THEN
1235         CALL histwrite_phy(nid_files(iff), o_ozone_light%name, itau_w,
1236     $        wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
1237      ENDIF
1238
[1146]1239       IF (o_dtphy%flag(iff)<=lev_files(iff)) THEN
1240      CALL histwrite_phy(nid_files(iff),o_dtphy%name,itau_w,d_t)
[907]1241       ENDIF
1242
[1146]1243       IF (o_dqphy%flag(iff)<=lev_files(iff)) THEN
1244      CALL histwrite_phy(nid_files(iff),
1245     s                  o_dqphy%name,itau_w, d_qx(:,:,ivap))
[907]1246       ENDIF
1247
1248        DO nsrf=1, nbsrf
[1146]1249        IF (o_albe_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]1250        zx_tmp_fi2d(1 : klon) = falb1( 1 : klon, nsrf)
[1146]1251        CALL histwrite_phy(nid_files(iff),
1252     s                    o_albe_srf(nsrf)%name,itau_w,
1253     $                     zx_tmp_fi2d)
[907]1254        ENDIF
1255
[1146]1256        IF (o_rugs_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN 
[907]1257        zx_tmp_fi2d(1 : klon) = frugs( 1 : klon, nsrf)
[1146]1258        CALL histwrite_phy(nid_files(iff),
1259     s                     o_rugs_srf(nsrf)%name,itau_w,
[907]1260     $      zx_tmp_fi2d)
1261        ENDIF
1262
[1146]1263        IF (o_ages_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
[907]1264        zx_tmp_fi2d(1 : klon) = agesno( 1 : klon, nsrf)
[1146]1265        CALL histwrite_phy(nid_files(iff),
1266     s                     o_ages_srf(nsrf)%name,itau_w
[907]1267     $    ,zx_tmp_fi2d)
1268        ENDIF
1269        ENDDO !nsrf=1, nbsrf
1270
[1398]1271       IF (o_alb1%flag(iff)<=lev_files(iff)) THEN
1272      CALL histwrite_phy(nid_files(iff),o_alb1%name,itau_w,albsol1)
[907]1273       ENDIF
1274
[1398]1275       IF (o_alb2%flag(iff)<=lev_files(iff)) THEN
1276      CALL histwrite_phy(nid_files(iff),o_alb2%name,itau_w,albsol2)
[907]1277       ENDIF
1278
1279!FH Sorties pour la couche limite
1280      if (iflag_pbl>1) then
1281      zx_tmp_fi3d=0.
1282      do nsrf=1,nbsrf
1283         do k=1,klev
1284          zx_tmp_fi3d(:,k)=zx_tmp_fi3d(:,k)
1285     $    +pctsrf(:,nsrf)*pbl_tke(:,k,nsrf)
1286         enddo
1287      enddo
[1146]1288       IF (o_tke%flag(iff)<=lev_files(iff)) THEN
1289      CALL histwrite_phy(nid_files(iff),o_tke%name,itau_w,zx_tmp_fi3d)
[907]1290       ENDIF
1291
[1146]1292       IF (o_tke_max%flag(iff)<=lev_files(iff)) THEN
1293      CALL histwrite_phy(nid_files(iff),
1294     s                   o_tke_max%name,itau_w,zx_tmp_fi3d)
[907]1295       ENDIF
1296      endif
1297
[1146]1298       IF (o_kz%flag(iff)<=lev_files(iff)) THEN
1299      CALL histwrite_phy(nid_files(iff),o_kz%name,itau_w,coefh)
[907]1300       ENDIF
1301
[1146]1302       IF (o_kz_max%flag(iff)<=lev_files(iff)) THEN
1303      CALL histwrite_phy(nid_files(iff),o_kz_max%name,itau_w,coefh)
[907]1304       ENDIF
1305
[1146]1306       IF (o_clwcon%flag(iff)<=lev_files(iff)) THEN
1307      CALL histwrite_phy(nid_files(iff),o_clwcon%name,itau_w,clwcon0)
[907]1308       ENDIF
1309
[1146]1310       IF (o_dtdyn%flag(iff)<=lev_files(iff)) THEN
1311      CALL histwrite_phy(nid_files(iff),o_dtdyn%name,itau_w,d_t_dyn)
[907]1312       ENDIF
1313
[1146]1314       IF (o_dqdyn%flag(iff)<=lev_files(iff)) THEN
1315      CALL histwrite_phy(nid_files(iff),o_dqdyn%name,itau_w,d_q_dyn)
[907]1316       ENDIF
1317
[1146]1318       IF (o_dudyn%flag(iff)<=lev_files(iff)) THEN
1319      CALL histwrite_phy(nid_files(iff),o_dudyn%name,itau_w,d_u_dyn)
[1054]1320       ENDIF                                                   
1321
[1146]1322       IF (o_dvdyn%flag(iff)<=lev_files(iff)) THEN                 
1323      CALL histwrite_phy(nid_files(iff),o_dvdyn%name,itau_w,d_v_dyn) 
[1054]1324       ENDIF                                                     
1325
[1146]1326       IF (o_dtcon%flag(iff)<=lev_files(iff)) THEN
[907]1327      zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys
[1146]1328      CALL histwrite_phy(nid_files(iff),o_dtcon%name,itau_w,zx_tmp_fi3d)
[907]1329       ENDIF
1330
[1146]1331       IF (o_ducon%flag(iff)<=lev_files(iff)) THEN
[907]1332      zx_tmp_fi3d(1:klon,1:klev)=d_u_con(1:klon,1:klev)/pdtphys
[1146]1333      CALL histwrite_phy(nid_files(iff),o_ducon%name,itau_w,zx_tmp_fi3d)
[907]1334       ENDIF
1335
[1146]1336       IF (o_dqcon%flag(iff)<=lev_files(iff)) THEN
[907]1337      zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
[1146]1338      CALL histwrite_phy(nid_files(iff),o_dqcon%name,itau_w,zx_tmp_fi3d)
[907]1339       ENDIF
1340
[1146]1341       IF (o_dtlsc%flag(iff)<=lev_files(iff)) THEN
[907]1342      zx_tmp_fi3d(1:klon,1:klev)=d_t_lsc(1:klon,1:klev)/pdtphys
[1146]1343      CALL histwrite_phy(nid_files(iff),o_dtlsc%name,itau_w,zx_tmp_fi3d)
[907]1344       ENDIF
1345
[1146]1346       IF (o_dtlschr%flag(iff)<=lev_files(iff)) THEN
[907]1347      zx_tmp_fi3d(1:klon, 1:klev)=(d_t_lsc(1:klon,1:klev)+
1348     $                           d_t_eva(1:klon,1:klev))/pdtphys
[1146]1349      CALL histwrite_phy(nid_files(iff),
1350     s                   o_dtlschr%name,itau_w,zx_tmp_fi3d)
[907]1351       ENDIF
1352
[1146]1353       IF (o_dqlsc%flag(iff)<=lev_files(iff)) THEN
[907]1354      zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys
[1146]1355      CALL histwrite_phy(nid_files(iff),o_dqlsc%name,itau_w,zx_tmp_fi3d)
[907]1356       ENDIF
1357
[1146]1358       IF (o_dtvdf%flag(iff)<=lev_files(iff)) THEN
[907]1359      zx_tmp_fi3d(1:klon,1:klev)=d_t_vdf(1:klon,1:klev)/pdtphys
[1146]1360      CALL histwrite_phy(nid_files(iff),o_dtvdf%name,itau_w,zx_tmp_fi3d)
[907]1361       ENDIF
1362
[1146]1363       IF (o_dqvdf%flag(iff)<=lev_files(iff)) THEN
[907]1364      zx_tmp_fi3d(1:klon,1:klev)=d_q_vdf(1:klon,1:klev)/pdtphys
[1146]1365      CALL histwrite_phy(nid_files(iff),o_dqvdf%name,itau_w,zx_tmp_fi3d)
[907]1366       ENDIF
1367
[1146]1368       IF (o_dteva%flag(iff)<=lev_files(iff)) THEN
[907]1369      zx_tmp_fi3d(1:klon,1:klev)=d_t_eva(1:klon,1:klev)/pdtphys
[1146]1370      CALL histwrite_phy(nid_files(iff),o_dteva%name,itau_w,zx_tmp_fi3d)
[907]1371       ENDIF
1372
[1146]1373       IF (o_dqeva%flag(iff)<=lev_files(iff)) THEN
[907]1374      zx_tmp_fi3d(1:klon,1:klev)=d_q_eva(1:klon,1:klev)/pdtphys
[1146]1375      CALL histwrite_phy(nid_files(iff),o_dqeva%name,itau_w,zx_tmp_fi3d)
[907]1376       ENDIF
1377
[1146]1378       IF (o_ptconv%flag(iff)<=lev_files(iff)) THEN
[907]1379      zpt_conv = 0.
1380      where (ptconv) zpt_conv = 1.
[1146]1381      CALL histwrite_phy(nid_files(iff),o_ptconv%name,itau_w,zpt_conv)
[907]1382       ENDIF
1383
[1146]1384       IF (o_ratqs%flag(iff)<=lev_files(iff)) THEN
1385      CALL histwrite_phy(nid_files(iff),o_ratqs%name,itau_w,ratqs)
[907]1386       ENDIF
1387
[1146]1388       IF (o_dtthe%flag(iff)<=lev_files(iff)) THEN
[907]1389      zx_tmp_fi3d(1:klon,1:klev)=d_t_ajs(1:klon,1:klev)/pdtphys
[1146]1390      CALL histwrite_phy(nid_files(iff),o_dtthe%name,itau_w,zx_tmp_fi3d)
[907]1391       ENDIF
1392
[1036]1393       IF (iflag_thermals.gt.1) THEN
[1334]1394        IF (o_ftime_th%flag(iff)<=lev_files(iff)) THEN
1395! Pour l instant 0 a y reflichir pour les thermiques
1396         zx_tmp_fi2d=0. 
1397        CALL histwrite_phy(nid_files(iff),o_ftime_th%name,
1398     s                     itau_w,zx_tmp_fi2d)
1399        ENDIF
1400
[1146]1401        IF (o_f_th%flag(iff)<=lev_files(iff)) THEN
1402        CALL histwrite_phy(nid_files(iff),o_f_th%name,itau_w,fm_therm)
[951]1403        ENDIF
[945]1404
[1146]1405        IF (o_e_th%flag(iff)<=lev_files(iff)) THEN
1406        CALL histwrite_phy(nid_files(iff),o_e_th%name,itau_w,entr_therm)
[951]1407        ENDIF
[945]1408
[1146]1409        IF (o_w_th%flag(iff)<=lev_files(iff)) THEN
1410        CALL histwrite_phy(nid_files(iff),o_w_th%name,itau_w,zw2)
[1028]1411        ENDIF
1412
[1146]1413        IF (o_q_th%flag(iff)<=lev_files(iff)) THEN
1414        CALL histwrite_phy(nid_files(iff),o_q_th%name,itau_w,zqasc)
[1028]1415        ENDIF
1416
[1146]1417        IF (o_lambda_th%flag(iff)<=lev_files(iff)) THEN
1418        CALL histwrite_phy(nid_files(iff),
1419     s                     o_lambda_th%name,itau_w,lambda_th)
[1028]1420        ENDIF
1421
[1146]1422        IF (o_a_th%flag(iff)<=lev_files(iff)) THEN
1423        CALL histwrite_phy(nid_files(iff),o_a_th%name,itau_w,fraca)
[1028]1424        ENDIF
1425
[1146]1426       IF (o_d_th%flag(iff)<=lev_files(iff)) THEN
1427       CALL histwrite_phy(nid_files(iff),o_d_th%name,itau_w,detr_therm)
[1028]1428       ENDIF
1429
[945]1430
[1146]1431       IF (o_f0_th%flag(iff)<=lev_files(iff)) THEN
1432      CALL histwrite_phy(nid_files(iff),o_f0_th%name,itau_w,f0)
[945]1433       ENDIF
1434
[1146]1435       IF (o_f0_th%flag(iff)<=lev_files(iff)) THEN
1436      CALL histwrite_phy(nid_files(iff),o_zmax_th%name,itau_w,zmax0)
[945]1437       ENDIF
1438
[1146]1439       IF (o_dqthe%flag(iff)<=lev_files(iff)) THEN
[907]1440      zx_tmp_fi3d(1:klon,1:klev)=d_q_ajs(1:klon,1:klev)/pdtphys
[1146]1441      CALL histwrite_phy(nid_files(iff),o_dqthe%name,itau_w,zx_tmp_fi3d)
[907]1442       ENDIF
1443
[1398]1444      ENDIF !iflag_thermals
1445
[1146]1446       IF (o_dtajs%flag(iff)<=lev_files(iff)) THEN
[907]1447      zx_tmp_fi3d(1:klon,1:klev)=d_t_ajsb(1:klon,1:klev)/pdtphys
[1146]1448      CALL histwrite_phy(nid_files(iff),o_dtajs%name,itau_w,zx_tmp_fi3d)
[907]1449       ENDIF
1450
[1146]1451       IF (o_dqajs%flag(iff)<=lev_files(iff)) THEN
[907]1452      zx_tmp_fi3d(1:klon,1:klev)=d_q_ajsb(1:klon,1:klev)/pdtphys
[1146]1453      CALL histwrite_phy(nid_files(iff),o_dqajs%name,itau_w,zx_tmp_fi3d)
[907]1454       ENDIF
1455
[1146]1456       IF (o_dtswr%flag(iff)<=lev_files(iff)) THEN
[907]1457      zx_tmp_fi3d(1:klon,1:klev)=heat(1:klon,1:klev)/RDAY
[1146]1458      CALL histwrite_phy(nid_files(iff),o_dtswr%name,itau_w,zx_tmp_fi3d)
[907]1459       ENDIF
1460
[1146]1461       IF (o_dtsw0%flag(iff)<=lev_files(iff)) THEN
[907]1462      zx_tmp_fi3d(1:klon,1:klev)=heat0(1:klon,1:klev)/RDAY
[1146]1463      CALL histwrite_phy(nid_files(iff),o_dtsw0%name,itau_w,zx_tmp_fi3d)
[907]1464       ENDIF
1465
[1146]1466       IF (o_dtlwr%flag(iff)<=lev_files(iff)) THEN
[907]1467      zx_tmp_fi3d(1:klon,1:klev)=-1.*cool(1:klon,1:klev)/RDAY
[1146]1468      CALL histwrite_phy(nid_files(iff),o_dtlwr%name,itau_w,zx_tmp_fi3d)
[907]1469       ENDIF
1470
[1146]1471       IF (o_dtlw0%flag(iff)<=lev_files(iff)) THEN
[907]1472      zx_tmp_fi3d(1:klon,1:klev)=-1.*cool0(1:klon,1:klev)/RDAY
[1146]1473      CALL histwrite_phy(nid_files(iff),o_dtlw0%name,itau_w,zx_tmp_fi3d)
[907]1474       ENDIF
1475
[1146]1476       IF (o_dtec%flag(iff)<=lev_files(iff)) THEN
[907]1477      zx_tmp_fi3d(1:klon,1:klev)=d_t_ec(1:klon,1:klev)
[1146]1478      CALL histwrite_phy(nid_files(iff),o_dtec%name,itau_w,zx_tmp_fi3d)
[907]1479       ENDIF
1480
[1146]1481       IF (o_duvdf%flag(iff)<=lev_files(iff)) THEN
[907]1482      zx_tmp_fi3d(1:klon,1:klev)=d_u_vdf(1:klon,1:klev)/pdtphys
[1146]1483      CALL histwrite_phy(nid_files(iff),o_duvdf%name,itau_w,zx_tmp_fi3d)
[907]1484       ENDIF
1485
[1146]1486       IF (o_dvvdf%flag(iff)<=lev_files(iff)) THEN
[907]1487      zx_tmp_fi3d(1:klon,1:klev)=d_v_vdf(1:klon,1:klev)/pdtphys
[1146]1488      CALL histwrite_phy(nid_files(iff),o_dvvdf%name,itau_w,zx_tmp_fi3d)
[907]1489       ENDIF
1490
1491       IF (ok_orodr) THEN
[1146]1492      IF (o_duoro%flag(iff)<=lev_files(iff)) THEN
[907]1493      zx_tmp_fi3d(1:klon,1:klev)=d_u_oro(1:klon,1:klev)/pdtphys
[1146]1494      CALL histwrite_phy(nid_files(iff),o_duoro%name,itau_w,zx_tmp_fi3d)
[907]1495       ENDIF
1496
[1146]1497      IF (o_dvoro%flag(iff)<=lev_files(iff)) THEN
[907]1498      zx_tmp_fi3d(1:klon,1:klev)=d_v_oro(1:klon,1:klev)/pdtphys
[1146]1499      CALL histwrite_phy(nid_files(iff),o_dvoro%name,itau_w,zx_tmp_fi3d)
[907]1500      ENDIF
1501       ENDIF
1502
1503        IF (ok_orolf) THEN
[1146]1504       IF (o_dulif%flag(iff)<=lev_files(iff)) THEN
[907]1505      zx_tmp_fi3d(1:klon,1:klev)=d_u_lif(1:klon,1:klev)/pdtphys
[1146]1506      CALL histwrite_phy(nid_files(iff),o_dulif%name,itau_w,zx_tmp_fi3d)
[907]1507       ENDIF
1508
[1146]1509        IF (o_dvlif%flag(iff)<=lev_files(iff)) THEN
[907]1510      zx_tmp_fi3d(1:klon,1:klev)=d_v_lif(1:klon,1:klev)/pdtphys
[1146]1511      CALL histwrite_phy(nid_files(iff),o_dvlif%name,itau_w,zx_tmp_fi3d)
[907]1512       ENDIF
1513        ENDIF
1514
[1403]1515        if (nqtot.GE.3) THEN
1516         DO iq=3,nqtot
[1146]1517       IF (o_trac(iq-2)%flag(iff)<=lev_files(iff)) THEN
1518         CALL histwrite_phy(nid_files(iff),
1519     s                  o_trac(iq-2)%name,itau_w,qx(:,:,iq))
1520       ENDIF
[1403]1521         ENDDO
1522        endif
[907]1523
1524      if (ok_sync) then
1525c$OMP MASTER
1526        call histsync(nid_files(iff))
1527c$OMP END MASTER
1528      endif
1529
1530       ENDIF ! clef_files
1531
1532      ENDDO ! iff=1,nfiles
Note: See TracBrowser for help on using the repository browser.