Changeset 1821 for LMDZ5/trunk


Ignore:
Timestamp:
Jul 30, 2013, 2:46:15 PM (11 years ago)
Author:
Ehouarn Millour
Message:

Le passage de définition est maintenant effectué automatiquement lors du premier appel d'écriture à phys_output_write.
UG
.................................................
The definition run is now automatically triggered by the first writing call to phys_output_write.
UG

Location:
LMDZ5/trunk/libf/phylmd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/phylmd/iophy.F90

    r1807 r1821  
    767767  ! On regarde si on est dans la phase de définition ou d'écriture:
    768768  IF(.NOT.vars_defined) THEN
    769 
     769!$OMP MASTER
    770770      !Si phase de définition.... on définit
    771771      DO iff=iff_beg, iff_end
     
    774774         ENDIF
    775775      ENDDO
     776!$OMP END MASTER
    776777  ELSE
    777778
     
    861862  IF(.NOT.vars_defined) THEN
    862863      !Si phase de définition.... on définit
     864!$OMP MASTER
    863865      DO iff=1, nfiles
    864866        IF (clef_files(iff)) THEN
     
    866868        ENDIF
    867869      ENDDO
     870!$OMP END MASTER
    868871  ELSE
    869872    !Et sinon on.... écrit
  • LMDZ5/trunk/libf/phylmd/phys_output_mod.F90

    r1813 r1821  
    387387    ENDDO !  iff
    388388
    389     ! ug On déclare les sorties avec un premier appel à phys_output_write:
    390     !    on utilise itap=0 pour signaler à histwrite qu'il s'agit du passage de définition
    391       CALL phys_output_write(0, pdtphys, paprs, pphis,               &
    392      &                  pplay, lmax_th, aerosol_couple,                 &
    393      &                  ok_ade, ok_aie, ivap, new_aod, ok_sync,         &
    394      &                  ptconv, read_climoz, clevSTD, ptconvth,         &
    395      &                  d_t, qx, d_qx, zmasse, flag_aerosol_strat)
    396 
    397     DO iff=1,nfiles
    398         IF (clef_files(iff)) THEN
    399           CALL histend(nid_files(iff))
    400 
    401           ndex2d = 0
    402           ndex3d = 0
    403 
    404         ENDIF ! clef_files
    405     ENDDO !  iff
    406389
    407390    ! Updated write frequencies due to phys_out_filetimesteps.
  • LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90

    r1816 r1821  
    6767    INTEGER, PARAMETER :: jjmp1=jjm+1-1/jjm
    6868    INTEGER :: itau_w
    69     INTEGER :: i, iff, iq, nsrf, k, ll, naero
     69    INTEGER :: i, iinit, iinitend=1, iff, iq, nsrf, k, ll, naero
    7070    REAL, DIMENSION (klon) :: zx_tmp_fi2d
    7171    REAL, DIMENSION (klon,klev) :: zx_tmp_fi3d, zpt_conv
     
    7676    REAL, PARAMETER :: dobson_u = 2.1415e-05 ! Dobson unit, in kg m-2
    7777
    78     IF(vars_defined) THEN
    79 ! On calcul le nouveau tau:
     78     ! On calcul le nouveau tau:
    8079     itau_w = itau_phy + itap + start_time * day_step / iphysiq
    81 ! On le donne à iophy pour que les histwrite y aient accès:
     80     ! On le donne à iophy pour que les histwrite y aient accès:
    8281     CALL set_itau_iophy(itau_w)
     82    IF(.NOT.vars_defined) THEN
     83        iinitend = 2
     84    ELSE
     85        iinitend = 1
    8386    ENDIF
    84 
     87   
     88! ug la boucle qui suit ne sert qu'une fois, pour l'initialisation, sinon il n'y a toujours qu'un seul passage:
     89DO iinit=1, iinitend
    8590! On procède à l'écriture ou à la définition des nombreuses variables:
    8691!!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    8893      CALL histwrite_phy(o_aire, airephy)
    8994
    90 IF (itap > 0) THEN
     95IF (vars_defined) THEN
    9196      DO i=1, klon
    9297       zx_tmp_fi2d(i)=pctsrf(i,is_ter)+pctsrf(i,is_lic)
     
    105110      CALL histwrite_phy(o_t2m_max, zt2m)
    106111
    107 IF (itap > 0) THEN
     112IF (vars_defined) THEN
    108113      DO i=1, klon
    109114       zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
     
    112117      CALL histwrite_phy(o_wind10m, zx_tmp_fi2d)
    113118
    114 IF (itap > 0) THEN
     119IF (vars_defined) THEN
    115120      DO i=1, klon
    116121       zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
     
    119124      CALL histwrite_phy(o_wind10max, zx_tmp_fi2d)
    120125
    121 IF (itap > 0) THEN
     126IF (vars_defined) THEN
    122127      DO i = 1, klon
    123128         zx_tmp_fi2d(i) = pctsrf(i,is_sic)
     
    130135      CALL histwrite_phy(o_v10m, zv10m)
    131136
    132 IF (itap > 0) THEN
     137IF (vars_defined) THEN
    133138      DO i = 1, klon
    134139         zx_tmp_fi2d(i) = paprs(i,1)
     
    143148ENDIF
    144149
    145 IF (itap > 0) THEN
     150IF (vars_defined) THEN
    146151       DO i = 1, klon
    147152         zx_tmp_fi2d(i) = rain_fall(i) + snow_fall(i)
     
    152157      CALL histwrite_phy(o_ndayrain, nday_rain)
    153158
    154 IF (itap > 0) THEN
     159IF (vars_defined) THEN
    155160       DO i = 1, klon
    156161         zx_tmp_fi2d(i) = rain_lsc(i) + snow_lsc(i)
     
    159164      CALL histwrite_phy(o_plul, zx_tmp_fi2d)
    160165
    161 IF (itap > 0) THEN
     166IF (vars_defined) THEN
    162167      DO i = 1, klon
    163168         zx_tmp_fi2d(i) = rain_con(i) + snow_con(i)
     
    174179      CALL histwrite_phy(o_topl0, toplw0)
    175180
    176 IF (itap > 0) THEN
     181IF (vars_defined) THEN
    177182      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, klevp1 )
    178183ENDIF
    179184      CALL histwrite_phy(o_SWupTOA, zx_tmp_fi2d)
    180185
    181 IF (itap > 0) THEN
     186IF (vars_defined) THEN
    182187      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, klevp1 )
    183188ENDIF
    184189      CALL histwrite_phy(o_SWupTOAclr, zx_tmp_fi2d)
    185190
    186 IF (itap > 0) THEN
     191IF (vars_defined) THEN
    187192      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, klevp1 )
    188193ENDIF
    189194      CALL histwrite_phy(o_SWdnTOA, zx_tmp_fi2d)
    190195
    191 IF (itap > 0) THEN
     196IF (vars_defined) THEN
    192197      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, klevp1 )
    193198ENDIF
    194199      CALL histwrite_phy(o_SWdnTOAclr, zx_tmp_fi2d)
    195200
    196 IF (itap > 0) THEN
     201IF (vars_defined) THEN
    197202      zx_tmp_fi2d(:) = topsw(:)-toplw(:)
    198203ENDIF
     
    212217      CALL histwrite_phy(o_soll0, sollw0)
    213218
    214 IF (itap > 0) THEN
     219IF (vars_defined) THEN
    215220      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, 1 )
    216221ENDIF
    217222      CALL histwrite_phy(o_SWupSFC, zx_tmp_fi2d)
    218223
    219 IF (itap > 0) THEN
     224IF (vars_defined) THEN
    220225      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, 1 )
    221226ENDIF
    222227      CALL histwrite_phy(o_SWupSFCclr, zx_tmp_fi2d)
    223228
    224 IF (itap > 0) THEN
     229IF (vars_defined) THEN
    225230      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, 1 )
    226231ENDIF
    227232      CALL histwrite_phy(o_SWdnSFC, zx_tmp_fi2d)
    228233
    229 IF (itap > 0) THEN
     234IF (vars_defined) THEN
    230235      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, 1 )
    231236ENDIF
    232237      CALL histwrite_phy(o_SWdnSFCclr, zx_tmp_fi2d)
    233238
    234 IF (itap > 0) THEN
     239IF (vars_defined) THEN
    235240      zx_tmp_fi2d(1:klon)=sollwdown(1:klon)-sollw(1:klon)
    236241ENDIF
     
    238243      CALL histwrite_phy(o_LWdnSFC, sollwdown)
    239244
    240 IF (itap > 0) THEN
     245IF (vars_defined) THEN
    241246       sollwdownclr(1:klon) = -1.*lwdn0(1:klon,1)
    242247      zx_tmp_fi2d(1:klon)=sollwdownclr(1:klon)-sollw0(1:klon)
     
    252257      CALL histwrite_phy(o_bils_enthalp, bils_enthalp)
    253258
    254 IF (itap > 0) THEN
     259IF (vars_defined) THEN
    255260      zx_tmp_fi2d(1:klon)=-1*sens(1:klon)
    256261ENDIF
     
    260265      CALL histwrite_phy(o_fqcalving, zxfqcalving)
    261266      CALL histwrite_phy(o_fqfonte, zxfqfonte)
    262 IF (itap > 0) THEN
     267IF (vars_defined) THEN
    263268      zx_tmp_fi2d=0.
    264269      DO nsrf=1,nbsrf
     
    268273      CALL histwrite_phy(o_taux, zx_tmp_fi2d)
    269274
    270 IF (itap > 0) THEN
     275IF (vars_defined) THEN
    271276      zx_tmp_fi2d=0.
    272277      DO nsrf=1,nbsrf
     
    278283
    279284         DO nsrf = 1, nbsrf
    280 IF (itap > 0)             zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)*100.
     285IF (vars_defined)             zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)*100.
    281286      CALL histwrite_phy(o_pourc_srf(nsrf), zx_tmp_fi2d)
    282 IF (itap > 0)           zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
     287IF (vars_defined)           zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
    283288      CALL histwrite_phy(o_fract_srf(nsrf), zx_tmp_fi2d)
    284 IF (itap > 0)         zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
     289IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
    285290      CALL histwrite_phy(o_taux_srf(nsrf), zx_tmp_fi2d)
    286 IF (itap > 0)         zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
     291IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
    287292      CALL histwrite_phy(o_tauy_srf(nsrf), zx_tmp_fi2d)
    288 IF (itap > 0)         zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
     293IF (vars_defined)         zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
    289294      CALL histwrite_phy(o_tsol_srf(nsrf), zx_tmp_fi2d)
    290 IF (itap > 0)         zx_tmp_fi2d(1 : klon) = evap_pot( 1 : klon, nsrf)
     295IF (vars_defined)         zx_tmp_fi2d(1 : klon) = evap_pot( 1 : klon, nsrf)
    291296      CALL histwrite_phy(o_evappot_srf(nsrf), zx_tmp_fi2d)
    292 IF (itap > 0)       zx_tmp_fi2d(1 : klon) = ustar(1 : klon, nsrf)
     297IF (vars_defined)       zx_tmp_fi2d(1 : klon) = ustar(1 : klon, nsrf)
    293298      CALL histwrite_phy(o_ustar_srf(nsrf), zx_tmp_fi2d)
    294 IF (itap > 0)       zx_tmp_fi2d(1 : klon) = u10m(1 : klon, nsrf)
     299IF (vars_defined)       zx_tmp_fi2d(1 : klon) = u10m(1 : klon, nsrf)
    295300      CALL histwrite_phy(o_u10m_srf(nsrf), zx_tmp_fi2d)
    296 IF (itap > 0)       zx_tmp_fi2d(1 : klon) = v10m(1 : klon, nsrf)
     301IF (vars_defined)       zx_tmp_fi2d(1 : klon) = v10m(1 : klon, nsrf)
    297302      CALL histwrite_phy(o_v10m_srf(nsrf), zx_tmp_fi2d)
    298 IF (itap > 0)       zx_tmp_fi2d(1 : klon) = t2m(1 : klon, nsrf)
     303IF (vars_defined)       zx_tmp_fi2d(1 : klon) = t2m(1 : klon, nsrf)
    299304      CALL histwrite_phy(o_t2m_srf(nsrf), zx_tmp_fi2d)
    300 IF (itap > 0)       zx_tmp_fi2d(1 : klon) = fevap(1 : klon, nsrf)
     305IF (vars_defined)       zx_tmp_fi2d(1 : klon) = fevap(1 : klon, nsrf)
    301306      CALL histwrite_phy(o_evap_srf(nsrf), zx_tmp_fi2d)
    302 IF (itap > 0)        zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
     307IF (vars_defined)        zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
    303308      CALL histwrite_phy(o_sens_srf(nsrf), zx_tmp_fi2d)
    304 IF (itap > 0)         zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
     309IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
    305310      CALL histwrite_phy(o_lat_srf(nsrf), zx_tmp_fi2d)
    306 IF (itap > 0)         zx_tmp_fi2d(1 : klon) = fsollw( 1 : klon, nsrf)
     311IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fsollw( 1 : klon, nsrf)
    307312      CALL histwrite_phy(o_flw_srf(nsrf), zx_tmp_fi2d)
    308 IF (itap > 0)         zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, nsrf)
     313IF (vars_defined)         zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, nsrf)
    309314      CALL histwrite_phy(o_fsw_srf(nsrf), zx_tmp_fi2d)
    310 IF (itap > 0)         zx_tmp_fi2d(1 : klon) = wfbils( 1 : klon, nsrf)
     315IF (vars_defined)         zx_tmp_fi2d(1 : klon) = wfbils( 1 : klon, nsrf)
    311316      CALL histwrite_phy(o_wbils_srf(nsrf), zx_tmp_fi2d)
    312 IF (itap > 0)         zx_tmp_fi2d(1 : klon) = wfbilo( 1 : klon, nsrf)
     317IF (vars_defined)         zx_tmp_fi2d(1 : klon) = wfbilo( 1 : klon, nsrf)
    313318      CALL histwrite_phy(o_wbilo_srf(nsrf), zx_tmp_fi2d)
    314319
     
    330335      CALL histwrite_phy(o_cldt, cldt)
    331336      CALL histwrite_phy(o_cldq, cldq)
    332 IF (itap > 0)       zx_tmp_fi2d(1:klon) = flwp(1:klon)
     337IF (vars_defined)       zx_tmp_fi2d(1:klon) = flwp(1:klon)
    333338      CALL histwrite_phy(o_lwp, zx_tmp_fi2d)
    334 IF (itap > 0)       zx_tmp_fi2d(1:klon) = fiwp(1:klon)
     339IF (vars_defined)       zx_tmp_fi2d(1:klon) = fiwp(1:klon)
    335340      CALL histwrite_phy(o_iwp, zx_tmp_fi2d)
    336341      CALL histwrite_phy(o_ue, ue)
     
    355360      CALL histwrite_phy(o_dnwd, dnwd)
    356361      CALL histwrite_phy(o_dnwd0, dnwd0)
    357 IF (itap > 0)         zx_tmp_fi2d=float(itau_con)/float(itap)
     362IF (vars_defined)         zx_tmp_fi2d=float(itau_con)/float(itap)
    358363      CALL histwrite_phy(o_ftime_con, zx_tmp_fi2d)
    359 IF (itap > 0) THEN
     364IF (vars_defined) THEN
    360365      IF(iflag_thermals>=1)THEN
    361366         zx_tmp_fi3d=dnwd+dnwd0+upwd+fm_therm(:,1:klev)
     
    425430
    426431
    427 IF (itap > 0) THEN
     432IF (vars_defined) THEN
    428433      DO i=1, klon
    429434       IF (pctsrf(i,is_oce).GT.epsfra.OR. &
     
    460465      CALL histwrite_phy(o_wake_deltaq, wake_deltaq)
    461466      CALL histwrite_phy(o_wake_omg, wake_omg)
    462 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_wake(1:klon,1:klev) &
     467IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_wake(1:klon,1:klev) &
    463468                                              /pdtphys
    464469      CALL histwrite_phy(o_dtwak, zx_tmp_fi3d)
    465 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_q_wake(1:klon,1:klev)/pdtphys
     470IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_wake(1:klon,1:klev)/pdtphys
    466471      CALL histwrite_phy(o_dqwak, zx_tmp_fi3d)
    467472      ENDIF ! iflag_wake>=1
     
    506511      CALL histwrite_phy(o_re, re)
    507512      CALL histwrite_phy(o_fl, fl)
    508 IF (itap > 0) THEN
     513IF (vars_defined) THEN
    509514      DO i=1, klon
    510515       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
     
    513518      CALL histwrite_phy(o_rh2m, zx_tmp_fi2d)
    514519
    515 IF (itap > 0) THEN
     520IF (vars_defined) THEN
    516521      DO i=1, klon
    517522       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
     
    520525      CALL histwrite_phy(o_rh2m_min, zx_tmp_fi2d)
    521526
    522 IF (itap > 0) THEN
     527IF (vars_defined) THEN
    523528      DO i=1, klon
    524529       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
     
    530535      CALL histwrite_phy(o_tpot, tpot)
    531536      CALL histwrite_phy(o_tpote, tpote)
    532 IF (itap > 0) zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, is_ter)
     537IF (vars_defined) zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, is_ter)
    533538      CALL histwrite_phy(o_SWnetOR,  zx_tmp_fi2d)
    534 IF (itap > 0) zx_tmp_fi2d(1:klon) = solsw(1:klon)/(1.-albsol1(1:klon))
     539IF (vars_defined) zx_tmp_fi2d(1:klon) = solsw(1:klon)/(1.-albsol1(1:klon))
    535540      CALL histwrite_phy(o_SWdownOR,  zx_tmp_fi2d)
    536541      CALL histwrite_phy(o_LWdownOR, sollwdown)
     
    632637      CALL histwrite_phy(o_pres, pplay)
    633638      CALL histwrite_phy(o_paprs, paprs(:,1:klev))
    634 IF (itap > 0) THEN
     639IF (vars_defined) THEN
    635640         DO i=1, klon
    636641          zx_tmp_fi3d1(i,1)= pphis(i)/RG
     
    649654!020611    $o_zfull%name,itau_w,zx_tmp_fi3d)
    650655
    651 IF (itap > 0)  THEN
     656IF (vars_defined)  THEN
    652657         DO i=1, klon
    653658          zx_tmp_fi3d(i,1)= pphis(i)/RG - ( &
     
    679684      CALL histwrite_phy(o_dqphy,  d_qx(:,:,ivap))
    680685        DO nsrf=1, nbsrf
    681 IF (itap > 0) zx_tmp_fi2d(1 : klon) = falb1( 1 : klon, nsrf)
     686IF (vars_defined) zx_tmp_fi2d(1 : klon) = falb1( 1 : klon, nsrf)
    682687      CALL histwrite_phy(o_albe_srf(nsrf), zx_tmp_fi2d)
    683 IF (itap > 0) zx_tmp_fi2d(1 : klon) = frugs( 1 : klon, nsrf)
     688IF (vars_defined) zx_tmp_fi2d(1 : klon) = frugs( 1 : klon, nsrf)
    684689      CALL histwrite_phy(o_rugs_srf(nsrf), zx_tmp_fi2d)
    685 IF (itap > 0) zx_tmp_fi2d(1 : klon) = agesno( 1 : klon, nsrf)
     690IF (vars_defined) zx_tmp_fi2d(1 : klon) = agesno( 1 : klon, nsrf)
    686691      CALL histwrite_phy(o_ages_srf(nsrf), zx_tmp_fi2d)
    687692        ENDDO !nsrf=1, nbsrf
     
    691696      if (iflag_pbl>1) then
    692697      zx_tmp_fi3d=0.
    693 IF (itap > 0) THEN
     698IF (vars_defined) THEN
    694699      do nsrf=1,nbsrf
    695700         do k=1,klev
     
    714719      CALL histwrite_phy(o_dvdyn, d_v_dyn)
    715720
    716 IF (itap > 0) THEN
     721IF (vars_defined) THEN
    717722      zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys
    718723ENDIF
    719724      CALL histwrite_phy(o_dtcon, zx_tmp_fi3d)
    720725      if(iflag_thermals.eq.1)then
    721 IF (itap > 0) THEN
     726IF (vars_defined) THEN
    722727      zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys + &
    723728                                 d_t_ajsb(1:klon,1:klev)/pdtphys
     
    725730      CALL histwrite_phy(o_tntc, zx_tmp_fi3d)
    726731      else if(iflag_thermals.gt.1.and.iflag_wake.EQ.1)then
    727 IF (itap > 0) THEN
     732IF (vars_defined) THEN
    728733      zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys + &
    729734                                 d_t_ajs(1:klon,1:klev)/pdtphys + &
     
    732737      CALL histwrite_phy(o_tntc, zx_tmp_fi3d)
    733738      endif
    734 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_u_con(1:klon,1:klev)/pdtphys
     739IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_u_con(1:klon,1:klev)/pdtphys
    735740      CALL histwrite_phy(o_ducon, zx_tmp_fi3d)
    736 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_v_con(1:klon,1:klev)/pdtphys
     741IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_v_con(1:klon,1:klev)/pdtphys
    737742      CALL histwrite_phy(o_dvcon, zx_tmp_fi3d)
    738 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
     743IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
    739744      CALL histwrite_phy(o_dqcon, zx_tmp_fi3d)
    740745
    741746      IF(iflag_thermals.EQ.1) THEN
    742 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
     747IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
    743748        CALL histwrite_phy(o_tnhusc, zx_tmp_fi3d)
    744749      ELSE IF(iflag_thermals.GT.1.AND.iflag_wake.EQ.1) THEN
    745 IF (itap > 0) THEN
     750IF (vars_defined) THEN
    746751         zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys + &
    747752                                     d_q_ajs(1:klon,1:klev)/pdtphys + &
     
    751756      ENDIF
    752757
    753 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_lsc(1:klon,1:klev)/pdtphys
     758IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_lsc(1:klon,1:klev)/pdtphys
    754759      CALL histwrite_phy(o_dtlsc, zx_tmp_fi3d)
    755 IF (itap > 0) zx_tmp_fi3d(1:klon, 1:klev)=(d_t_lsc(1:klon,1:klev)+ &
     760IF (vars_defined) zx_tmp_fi3d(1:klon, 1:klev)=(d_t_lsc(1:klon,1:klev)+ &
    756761                                 d_t_eva(1:klon,1:klev))/pdtphys
    757762      CALL histwrite_phy(o_dtlschr, zx_tmp_fi3d)
    758 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys
     763IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys
    759764      CALL histwrite_phy(o_dqlsc, zx_tmp_fi3d)
    760 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=beta_prec(1:klon,1:klev)
     765IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=beta_prec(1:klon,1:klev)
    761766      CALL histwrite_phy(o_beta_prec, zx_tmp_fi3d)
    762767!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    763768! Sorties specifiques a la separation thermiques/non thermiques
    764769       if (iflag_thermals>=1) then
    765 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_lscth(1:klon,1:klev)/pdtphys
     770IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_lscth(1:klon,1:klev)/pdtphys
    766771      CALL histwrite_phy(o_dtlscth, zx_tmp_fi3d)
    767 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_lscst(1:klon,1:klev)/pdtphys
     772IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_lscst(1:klon,1:klev)/pdtphys
    768773      CALL histwrite_phy(o_dtlscst, zx_tmp_fi3d)
    769 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_q_lscth(1:klon,1:klev)/pdtphys
     774IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_lscth(1:klon,1:klev)/pdtphys
    770775      CALL histwrite_phy(o_dqlscth, zx_tmp_fi3d)
    771 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_q_lscst(1:klon,1:klev)/pdtphys
     776IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_lscst(1:klon,1:klev)/pdtphys
    772777      CALL histwrite_phy(o_dqlscst, zx_tmp_fi3d)
    773778      CALL histwrite_phy(o_plulth, plul_th)
    774779      CALL histwrite_phy(o_plulst, plul_st)
    775 IF (itap > 0) THEN
     780IF (vars_defined) THEN
    776781      do k=1,klev
    777782      do i=1,klon
     
    785790ENDIF
    786791      CALL histwrite_phy(o_ptconvth, zx_tmp_fi3d)
    787 IF (itap > 0) THEN
     792IF (vars_defined) THEN
    788793      do i=1,klon
    789794           zx_tmp_fi2d(1:klon)=lmax_th(:)
     
    793798      endif ! iflag_thermals>=1
    794799!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    795 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_vdf(1:klon,1:klev)/pdtphys
     800IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_vdf(1:klon,1:klev)/pdtphys
    796801      CALL histwrite_phy(o_dtvdf, zx_tmp_fi3d)
    797 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_diss(1:klon,1:klev)/pdtphys
     802IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_diss(1:klon,1:klev)/pdtphys
    798803      CALL histwrite_phy(o_dtdis, zx_tmp_fi3d)
    799 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_q_vdf(1:klon,1:klev)/pdtphys
     804IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_vdf(1:klon,1:klev)/pdtphys
    800805      CALL histwrite_phy(o_dqvdf, zx_tmp_fi3d)
    801 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_eva(1:klon,1:klev)/pdtphys
     806IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_eva(1:klon,1:klev)/pdtphys
    802807      CALL histwrite_phy(o_dteva, zx_tmp_fi3d)
    803 IF (itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_q_eva(1:klon,1:klev)/pdtphys
     808IF (vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_eva(1:klon,1:klev)/pdtphys
    804809      CALL histwrite_phy(o_dqeva, zx_tmp_fi3d)
    805810      zpt_conv = 0.
     
    807812      CALL histwrite_phy(o_ptconv, zpt_conv)
    808813      CALL histwrite_phy(o_ratqs, ratqs)
    809 IF (itap > 0) THEN
     814IF (vars_defined) THEN
    810815      zx_tmp_fi3d(1:klon,1:klev)=d_t_ajs(1:klon,1:klev)/pdtphys - &
    811816                                 d_t_ajsb(1:klon,1:klev)/pdtphys
     
    824829      CALL histwrite_phy(o_f0_th, f0)
    825830      CALL histwrite_phy(o_zmax_th, zmax_th)
    826 IF (itap > 0) THEN
     831IF (vars_defined) THEN
    827832      zx_tmp_fi3d(1:klon,1:klev)=d_q_ajs(1:klon,1:klev)/pdtphys - &
    828833                                 d_q_ajsb(1:klon,1:klev)/pdtphys
     
    830835      CALL histwrite_phy(o_dqthe, zx_tmp_fi3d)
    831836      ENDIF !iflag_thermals
    832 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_ajsb(1:klon,1:klev)/pdtphys
     837IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_ajsb(1:klon,1:klev)/pdtphys
    833838      CALL histwrite_phy(o_dtajs, zx_tmp_fi3d)
    834 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_q_ajsb(1:klon,1:klev)/pdtphys
     839IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_q_ajsb(1:klon,1:klev)/pdtphys
    835840      CALL histwrite_phy(o_dqajs, zx_tmp_fi3d)
    836 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=heat(1:klon,1:klev)/RDAY
     841IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=heat(1:klon,1:klev)/RDAY
    837842      CALL histwrite_phy(o_dtswr, zx_tmp_fi3d)
    838 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=heat0(1:klon,1:klev)/RDAY
     843IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=heat0(1:klon,1:klev)/RDAY
    839844      CALL histwrite_phy(o_dtsw0, zx_tmp_fi3d)
    840 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=-1.*cool(1:klon,1:klev)/RDAY
     845IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=-1.*cool(1:klon,1:klev)/RDAY
    841846      CALL histwrite_phy(o_dtlwr, zx_tmp_fi3d)
    842 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=-1.*cool0(1:klon,1:klev)/RDAY
     847IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=-1.*cool0(1:klon,1:klev)/RDAY
    843848      CALL histwrite_phy(o_dtlw0, zx_tmp_fi3d)
    844 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_ec(1:klon,1:klev)/pdtphys
     849IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_ec(1:klon,1:klev)/pdtphys
    845850      CALL histwrite_phy(o_dtec, zx_tmp_fi3d)
    846 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_u_vdf(1:klon,1:klev)/pdtphys
     851IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_u_vdf(1:klon,1:klev)/pdtphys
    847852      CALL histwrite_phy(o_duvdf, zx_tmp_fi3d)
    848 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_v_vdf(1:klon,1:klev)/pdtphys
     853IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_v_vdf(1:klon,1:klev)/pdtphys
    849854      CALL histwrite_phy(o_dvvdf, zx_tmp_fi3d)
    850855       IF (ok_orodr) THEN
    851 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_u_oro(1:klon,1:klev)/pdtphys
     856IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_u_oro(1:klon,1:klev)/pdtphys
    852857      CALL histwrite_phy(o_duoro, zx_tmp_fi3d)
    853 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_v_oro(1:klon,1:klev)/pdtphys
     858IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_v_oro(1:klon,1:klev)/pdtphys
    854859      CALL histwrite_phy(o_dvoro, zx_tmp_fi3d)
    855 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_oro(1:klon,1:klev)/pdtphys
     860IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_oro(1:klon,1:klev)/pdtphys
    856861      CALL histwrite_phy(o_dtoro, zx_tmp_fi3d)
    857862       ENDIF
    858863        IF (ok_orolf) THEN
    859 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_u_lif(1:klon,1:klev)/pdtphys
     864IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_u_lif(1:klon,1:klev)/pdtphys
    860865      CALL histwrite_phy(o_dulif, zx_tmp_fi3d)
    861866       ENDIF
    862 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_v_lif(1:klon,1:klev)/pdtphys
     867IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_v_lif(1:klon,1:klev)/pdtphys
    863868      CALL histwrite_phy(o_dvlif, zx_tmp_fi3d)
    864869
    865 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_lif(1:klon,1:klev)/pdtphys
     870IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_lif(1:klon,1:klev)/pdtphys
    866871      CALL histwrite_phy(o_dtlif, zx_tmp_fi3d)
    867872
    868873       IF (ok_hines) THEN
    869 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_u_hin(1:klon,1:klev)/pdtphys
     874IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_u_hin(1:klon,1:klev)/pdtphys
    870875      CALL histwrite_phy(o_duhin, zx_tmp_fi3d)
    871 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_v_hin(1:klon,1:klev)/pdtphys
     876IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_v_hin(1:klon,1:klev)/pdtphys
    872877      CALL histwrite_phy(o_dvhin, zx_tmp_fi3d)
    873 IF(itap > 0) zx_tmp_fi3d(1:klon,1:klev)=d_t_hin(1:klon,1:klev)/pdtphys
     878IF(vars_defined) zx_tmp_fi3d(1:klon,1:klev)=d_t_hin(1:klon,1:klev)/pdtphys
    874879      CALL histwrite_phy(o_dthin, zx_tmp_fi3d)
    875880        ENDIF
     
    882887      CALL histwrite_phy(o_rlucs, lwup0)
    883888      CALL histwrite_phy(o_rldcs, lwdn0)
    884 IF(itap > 0) THEN
     889IF(vars_defined) THEN
    885890      zx_tmp_fi3d(1:klon,1:klev)=d_t(1:klon,1:klev)+ &
    886891      d_t_dyn(1:klon,1:klev)
    887892ENDIF
    888893      CALL histwrite_phy(o_tnt, zx_tmp_fi3d)
    889 IF(itap > 0) THEN
     894IF(vars_defined) THEN
    890895      zx_tmp_fi3d(1:klon,1:klev)=heat(1:klon,1:klev)/RDAY - &
    891896      cool(1:klon,1:klev)/RDAY
    892897ENDIF
    893898      CALL histwrite_phy(o_tntr, zx_tmp_fi3d)
    894 IF(itap > 0) THEN
     899IF(vars_defined) THEN
    895900      zx_tmp_fi3d(1:klon,1:klev)= (d_t_lsc(1:klon,1:klev)+ &
    896901                                   d_t_eva(1:klon,1:klev)+ &
     
    898903ENDIF
    899904      CALL histwrite_phy(o_tntscpbl, zx_tmp_fi3d)
    900 IF(itap > 0) THEN
     905IF(vars_defined) THEN
    901906      zx_tmp_fi3d(1:klon,1:klev)=d_qx(1:klon,1:klev,ivap)+ &
    902907      d_q_dyn(1:klon,1:klev)
    903908ENDIF
    904909      CALL histwrite_phy(o_tnhus, zx_tmp_fi3d)
    905 IF(itap > 0) THEN
     910IF(vars_defined) THEN
    906911      zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys+ &
    907912                                 d_q_eva(1:klon,1:klev)/pdtphys
     
    909914      CALL histwrite_phy(o_tnhusscpbl, zx_tmp_fi3d)
    910915      CALL histwrite_phy(o_evu, coefm(:,:,is_ave))
    911 IF(itap > 0) THEN
     916IF(vars_defined) THEN
    912917      zx_tmp_fi3d(1:klon,1:klev)=q_seri(1:klon,1:klev)+ &
    913918                                 ql_seri(1:klon,1:klev)
     
    915920      CALL histwrite_phy(o_h2o, zx_tmp_fi3d)
    916921       if (iflag_con >= 3) then
    917 IF(itap > 0) THEN
     922IF(vars_defined) THEN
    918923             zx_tmp_fi3d(1:klon,1:klev)=-1 * (dnwd(1:klon,1:klev)+ &
    919924                  dnwd0(1:klon,1:klev))
    920925ENDIF
    921926      CALL histwrite_phy(o_mcd, zx_tmp_fi3d)
    922 IF(itap > 0) THEN
     927IF(vars_defined) THEN
    923928             zx_tmp_fi3d(1:klon,1:klev)=upwd(1:klon,1:klev) + &
    924929                  dnwd(1:klon,1:klev)+ dnwd0(1:klon,1:klev)
     
    934939       RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR. &
    935940       RCFC12_per.NE.RCFC12_act) THEN
    936 IF(itap > 0) zx_tmp_fi2d(1 : klon) = swupp ( 1 : klon, klevp1 )
     941IF(vars_defined) zx_tmp_fi2d(1 : klon) = swupp ( 1 : klon, klevp1 )
    937942      CALL histwrite_phy(o_rsut4co2, zx_tmp_fi2d)
    938 IF(itap > 0) zx_tmp_fi2d(1 : klon) = lwupp ( 1 : klon, klevp1 )
     943IF(vars_defined) zx_tmp_fi2d(1 : klon) = lwupp ( 1 : klon, klevp1 )
    939944      CALL histwrite_phy(o_rlut4co2, zx_tmp_fi2d)
    940 IF(itap > 0) zx_tmp_fi2d(1 : klon) = swup0p ( 1 : klon, klevp1 )
     945IF(vars_defined) zx_tmp_fi2d(1 : klon) = swup0p ( 1 : klon, klevp1 )
    941946      CALL histwrite_phy(o_rsutcs4co2, zx_tmp_fi2d)
    942 IF(itap > 0) zx_tmp_fi2d(1 : klon) = lwup0p ( 1 : klon, klevp1 )
     947IF(vars_defined) zx_tmp_fi2d(1 : klon) = lwup0p ( 1 : klon, klevp1 )
    943948      CALL histwrite_phy(o_rlutcs4co2, zx_tmp_fi2d)
    944949      CALL histwrite_phy(o_rsu4co2, swupp)
     
    968973             CALL histwrite_phy(o_dtr_uscav(iq-2),d_tr_uscav(:,:,iq-2))
    969974         zx_tmp_fi2d=0.
    970 IF(itap > 0) THEN
     975IF(vars_defined) THEN
    971976         DO k=1,klev
    972977            zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*qx(:,k,iq)
     
    978983
    979984
     985        IF(.NOT.vars_defined) THEN
     986!$OMP MASTER
     987            DO iff=1,nfiles
     988                IF (clef_files(iff)) THEN
     989                  CALL histend(nid_files(iff))
     990                  ndex2d = 0
     991                  ndex3d = 0
     992
     993                ENDIF ! clef_files
     994            ENDDO !  iff
     995!$OMP END MASTER
     996!$OMP BARRIER
     997            vars_defined = .TRUE.
     998
     999
     1000        END IF
     1001
     1002    END DO
     1003
    9801004    IF(vars_defined) THEN
    9811005! On synchronise les fichiers pour IOIPSL
     1006!$OMP MASTER
    9821007      DO iff=1,nfiles
    9831008          IF (ok_sync .AND. clef_files(iff)) THEN
    984 !$OMP MASTER
    9851009              CALL histsync(nid_files(iff))
    986 !$OMP END MASTER
    9871010          ENDIF
    9881011      END DO
    989 
    990     ELSE
    991     vars_defined = .TRUE.
     1012!$OMP END MASTER
    9921013    ENDIF
    9931014
Note: See TracChangeset for help on using the changeset viewer.