Changeset 1539


Ignore:
Timestamp:
Jun 9, 2011, 12:13:33 AM (13 years ago)
Author:
musat
Message:

Ajouts CFMIP2/CMIP5

  • 6eme fichier de sortie "stations" histstn.nc qui necessite 2 fichiers (voir DefLists?): npCFMIP_param.data(_*) contenant le nombre de points (120 pour simulations AMIP, 73 pour aqua) pointlocations.txt(_*) contenant le numero, les coordonnees (lon,lat) et le nom de chaque station
  • flag LOGICAL dans tous les appels histwrite_phy pour pouvoir sortir le fichier histstn.nc

NB: 1) les flags de type phys_ que l'on met dans le physiq.def_L* pour ajouter plus de sorties

necessitent dorenavant 6 valeurs, la 6eme correspondant au fichier histstn.nc

2) par defaut le fichier histstn.nc ne sort pas; pour le sortir ajouter les lignes suivantes

dans physiq.def_L*

### Type de fichier : global (n) ou stations (y)
phys_out_filestations = n n n n n y

  • introduction de 2 jeux de flags pour les taux des GES; taux actuels avec suffixes _act, taux futurs avec "_per" avec 2 appels au rayonnement si taux "_per" different des taux "_act" (utiles pour diags. CFMIP 4CO2)
  • flags "betaCRF" pour calculs CRF pour experiences sensibilite proprietes optiques eau liquide nuageuse avec initialisations par defaut; sinon besoin de fichier beta_crf.data

Ajout flag LOGICAL lCOSP necessaire pour sortir un fichier stations
IM

Location:
LMDZ5/trunk/libf
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/cosp/phys_cosp.F90

    r1526 r1539  
    148148  integer                         :: itap,k,ip
    149149  real                            :: dtime,freq_cosp
     150  logical, parameter              :: lCOSP=.FALSE.
    150151
    151152!
  • LMDZ5/trunk/libf/cosp/write_histdayCOSP.h

    r1279 r1539  
    1010       if (cfg%Llidar_sim) then
    1111         if (cfg%Lcllcalipso) then
    12           CALL histwrite_phy(nid_day_cosp,"cllcalipso",itau_wcosp,stlidar%cldlayer(:,1))
     12          CALL histwrite_phy(nid_day_cosp,lCOSP,"cllcalipso", &
     13     itau_wcosp,stlidar%cldlayer(:,1))
    1314         endif
    1415         if (cfg%Lclhcalipso) then
    15           CALL histwrite_phy(nid_day_cosp,"clhcalipso",itau_wcosp,stlidar%cldlayer(:,3))
     16          CALL histwrite_phy(nid_day_cosp,lCOSP,"clhcalipso", &
     17     itau_wcosp,stlidar%cldlayer(:,3))
    1618         endif
    1719         if (cfg%Lclmcalipso) then
    18           CALL histwrite_phy(nid_day_cosp,"clmcalipso",itau_wcosp,stlidar%cldlayer(:,2))
     20          CALL histwrite_phy(nid_day_cosp,lCOSP,"clmcalipso", &
     21     itau_wcosp,stlidar%cldlayer(:,2))
    1922         endif
    2023         if (cfg%Lcltcalipso) then
    21           CALL histwrite_phy(nid_day_cosp,"cltcalipso",itau_wcosp,stlidar%cldlayer(:,4))
     24          CALL histwrite_phy(nid_day_cosp,lCOSP,"cltcalipso", &
     25     itau_wcosp,stlidar%cldlayer(:,4))
    2226         endif
    2327         if (cfg%Lclcalipso) then
    24           CALL histwrite_phy(nid_day_cosp,"clcalipso",itau_wcosp,stlidar%lidarcld)
     28          CALL histwrite_phy(nid_day_cosp,lCOSP,"clcalipso", &
     29     itau_wcosp,stlidar%lidarcld)
    2530         endif
    2631         if (cfg%Lcfad_lidarsr532) then
    2732           do ii=1,SR_BINS
    28             CALL histwrite_phy(nid_day_cosp,"cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
     33            CALL histwrite_phy(nid_day_cosp,lCOSP, &
     34     "cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
    2935           enddo
    3036         endif
    3137         if (cfg%Lparasol_refl) then
    32            CALL histwrite_phy(nid_day_cosp,"parasol_refl",itau_wcosp,stlidar%parasolrefl)
     38           CALL histwrite_phy(nid_day_cosp,lCOSP,"parasol_refl", &
     39     itau_wcosp,stlidar%parasolrefl)
    3340         endif
    3441         if (cfg%Latb532) then
    3542           do ii=1,Ncolumns
    36             CALL histwrite_phy(nid_day_cosp,"atb532_"//chcol(ii),itau_wcosp,sglidar%beta_tot(:,ii,:))
     43            CALL histwrite_phy(nid_day_cosp,lCOSP,"atb532_"//chcol(ii), &
     44     itau_wcosp,sglidar%beta_tot(:,ii,:))
    3745           enddo
    3846         endif
    3947         if (cfg%Lbeta_mol532) then
    40            CALL histwrite_phy(nid_day_cosp,"beta_mol532",itau_wcosp,sglidar%beta_mol)
     48           CALL histwrite_phy(nid_day_cosp,lCOSP,"beta_mol532", &
     49     itau_wcosp,sglidar%beta_mol)
    4150         endif
    4251        endif ! Lidar
     
    8493          if (cfg%Lclisccp2) then
    8594            do ii=1,7
    86               CALL histwrite_phy(nid_day_cosp,"clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
     95              CALL histwrite_phy(nid_day_cosp,lCOSP, &
     96     "clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
    8797            enddo
    8898          endif
    8999          if (cfg%Lboxtauisccp) then
    90              CALL histwrite_phy(nid_day_cosp,"boxtauisccp",itau_wcosp,isccp%boxtau)
     100             CALL histwrite_phy(nid_day_cosp,lCOSP,"boxtauisccp", &
     101     itau_wcosp,isccp%boxtau)
    91102          endif
    92103          if (cfg%Lboxptopisccp) then
    93              CALL histwrite_phy(nid_day_cosp,"boxptopisccp",itau_wcosp,isccp%boxptop)
     104             CALL histwrite_phy(nid_day_cosp,lCOSP,"boxptopisccp", &
     105     itau_wcosp,isccp%boxptop)
    94106          endif
    95107          if (cfg%Ltclisccp) then
    96              CALL histwrite_phy(nid_day_cosp,"tclisccp",itau_wcosp,isccp%totalcldarea)
     108             CALL histwrite_phy(nid_day_cosp,lCOSP,"tclisccp", &
     109     itau_wcosp,isccp%totalcldarea)
    97110          endif
    98111          if (cfg%Lctpisccp) then
    99              CALL histwrite_phy(nid_day_cosp,"ctpisccp",itau_wcosp,isccp%meanptop)
     112             CALL histwrite_phy(nid_day_cosp,lCOSP,"ctpisccp", &
     113     itau_wcosp,isccp%meanptop)
    100114          endif
    101115          if (cfg%Ltauisccp) then
    102              CALL histwrite_phy(nid_day_cosp,"tauisccp",itau_wcosp,isccp%meantaucld)
     116             CALL histwrite_phy(nid_day_cosp,lCOSP,"tauisccp", &
     117     itau_wcosp,isccp%meantaucld)
    103118          endif
    104119          if (cfg%Lalbisccp) then
    105              CALL histwrite_phy(nid_day_cosp,"albisccp",itau_wcosp,isccp%meanalbedocld)
     120             CALL histwrite_phy(nid_day_cosp,lCOSP,"albisccp", &
     121     itau_wcosp,isccp%meanalbedocld)
    106122          endif
    107123          if (cfg%Lmeantbisccp) then
    108              CALL histwrite_phy(nid_day_cosp,"meantbisccp",itau_wcosp,isccp%meantb)
     124             CALL histwrite_phy(nid_day_cosp,lCOSP,"meantbisccp", &
     125     itau_wcosp,isccp%meantb)
    109126          endif
    110127          if (cfg%Lmeantbclrisccp) then
    111              CALL histwrite_phy(nid_day_cosp,"meantbclrisccp",itau_wcosp,isccp%meantbclr)
     128             CALL histwrite_phy(nid_day_cosp,lCOSP,"meantbclrisccp", &
     129     itau_wcosp,isccp%meantbclr)
    112130          endif
    113131        endif ! Isccp
  • LMDZ5/trunk/libf/cosp/write_histhfCOSP.h

    r1279 r1539  
    1010       if (cfg%Llidar_sim) then
    1111         if (cfg%Lcllcalipso) then
    12           CALL histwrite_phy(nid_hf_cosp,"cllcalipso",itau_wcosp,stlidar%cldlayer(:,1))
     12          CALL histwrite_phy(nid_hf_cosp,lCOSP,"cllcalipso", &
     13     itau_wcosp,stlidar%cldlayer(:,1))
    1314         endif
    1415         if (cfg%Lclhcalipso) then
    15           CALL histwrite_phy(nid_hf_cosp,"clhcalipso",itau_wcosp,stlidar%cldlayer(:,3))
     16          CALL histwrite_phy(nid_hf_cosp,lCOSP,"clhcalipso", &
     17     itau_wcosp,stlidar%cldlayer(:,3))
    1618         endif
    1719         if (cfg%Lclmcalipso) then
    18           CALL histwrite_phy(nid_hf_cosp,"clmcalipso",itau_wcosp,stlidar%cldlayer(:,2))
     20          CALL histwrite_phy(nid_hf_cosp,lCOSP,"clmcalipso", &
     21     itau_wcosp,stlidar%cldlayer(:,2))
    1922         endif
    2023         if (cfg%Lcltcalipso) then
    21           CALL histwrite_phy(nid_hf_cosp,"cltcalipso",itau_wcosp,stlidar%cldlayer(:,4))
     24          CALL histwrite_phy(nid_hf_cosp,lCOSP,"cltcalipso", &
     25     itau_wcosp,stlidar%cldlayer(:,4))
    2226         endif
    2327         if (cfg%Lclcalipso) then
    24           CALL histwrite_phy(nid_hf_cosp,"clcalipso",itau_wcosp,stlidar%lidarcld)
     28          CALL histwrite_phy(nid_hf_cosp,lCOSP,"clcalipso", &
     29     itau_wcosp,stlidar%lidarcld)
    2530         endif
    2631         if (cfg%Lcfad_lidarsr532) then
    2732           do ii=1,SR_BINS
    28             CALL histwrite_phy(nid_hf_cosp,"cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
     33            CALL histwrite_phy(nid_hf_cosp,lCOSP, &
     34     "cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
    2935           enddo
    3036         endif
    3137         if (cfg%Lparasol_refl) then
    32            CALL histwrite_phy(nid_hf_cosp,"parasol_refl",itau_wcosp,stlidar%parasolrefl)
     38           CALL histwrite_phy(nid_hf_cosp,lCOSP,"parasol_refl", &
     39     itau_wcosp,stlidar%parasolrefl)
    3340         endif
    3441         if (cfg%Latb532) then
    3542           do ii=1,Ncolumns
    36             CALL histwrite_phy(nid_hf_cosp,"atb532_"//chcol(ii),itau_wcosp,sglidar%beta_tot(:,ii,:))
     43            CALL histwrite_phy(nid_hf_cosp,lCOSP,"atb532_"//chcol(ii), &
     44     itau_wcosp,sglidar%beta_tot(:,ii,:))
    3745           enddo
    3846         endif
    3947         if (cfg%Lbeta_mol532) then
    40            CALL histwrite_phy(nid_hf_cosp,"beta_mol532",itau_wcosp,sglidar%beta_mol)
     48           CALL histwrite_phy(nid_hf_cosp,lCOSP,"beta_mol532", &
     49     itau_wcosp,sglidar%beta_mol)
    4150         endif
    4251        endif ! Lidar
     
    8493          if (cfg%Lclisccp2) then
    8594            do ii=1,7
    86               CALL histwrite_phy(nid_hf_cosp,"clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
     95              CALL histwrite_phy(nid_hf_cosp,lCOSP, &
     96     "clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
    8797            enddo
    8898          endif
    8999          if (cfg%Lboxtauisccp) then
    90              CALL histwrite_phy(nid_hf_cosp,"boxtauisccp",itau_wcosp,isccp%boxtau)
     100             CALL histwrite_phy(nid_hf_cosp,lCOSP,"boxtauisccp", &
     101     itau_wcosp,isccp%boxtau)
    91102          endif
    92103          if (cfg%Lboxptopisccp) then
    93              CALL histwrite_phy(nid_hf_cosp,"boxptopisccp",itau_wcosp,isccp%boxptop)
     104             CALL histwrite_phy(nid_hf_cosp,lCOSP,"boxptopisccp", &
     105     itau_wcosp,isccp%boxptop)
    94106          endif
    95107          if (cfg%Ltclisccp) then
    96              CALL histwrite_phy(nid_hf_cosp,"tclisccp",itau_wcosp,isccp%totalcldarea)
     108             CALL histwrite_phy(nid_hf_cosp,lCOSP,"tclisccp", &
     109     itau_wcosp,isccp%totalcldarea)
    97110          endif
    98111          if (cfg%Lctpisccp) then
    99              CALL histwrite_phy(nid_hf_cosp,"ctpisccp",itau_wcosp,isccp%meanptop)
     112             CALL histwrite_phy(nid_hf_cosp,lCOSP,"ctpisccp", &
     113     itau_wcosp,isccp%meanptop)
    100114
    101115          endif
    102116          if (cfg%Ltauisccp) then
    103              CALL histwrite_phy(nid_hf_cosp,"tauisccp",itau_wcosp,isccp%meantaucld)
     117             CALL histwrite_phy(nid_hf_cosp,lCOSP,"tauisccp", &
     118     itau_wcosp,isccp%meantaucld)
    104119          endif
    105120          if (cfg%Lalbisccp) then
    106              CALL histwrite_phy(nid_hf_cosp,"albisccp",itau_wcosp,isccp%meanalbedocld)
     121             CALL histwrite_phy(nid_hf_cosp,lCOSP,"albisccp", &
     122     itau_wcosp,isccp%meanalbedocld)
    107123          endif
    108124          if (cfg%Lmeantbisccp) then
    109              CALL histwrite_phy(nid_hf_cosp,"meantbisccp",itau_wcosp,isccp%meantb)
     125             CALL histwrite_phy(nid_hf_cosp,lCOSP,"meantbisccp", &
     126     itau_wcosp,isccp%meantb)
    110127          endif
    111128          if (cfg%Lmeantbclrisccp) then
    112              CALL histwrite_phy(nid_hf_cosp,"meantbclrisccp",itau_wcosp,isccp%meantbclr)
     129             CALL histwrite_phy(nid_hf_cosp,lCOSP,"meantbclrisccp", &
     130     itau_wcosp,isccp%meantbclr)
    113131          endif
    114132        endif ! Isccp
  • LMDZ5/trunk/libf/cosp/write_histmthCOSP.h

    r1279 r1539  
    1010       if (cfg%Llidar_sim) then
    1111         if (cfg%Lcllcalipso) then
    12           CALL histwrite_phy(nid_mth_cosp,"cllcalipso",itau_wcosp,stlidar%cldlayer(:,1))
     12          CALL histwrite_phy(nid_mth_cosp,lCOSP,"cllcalipso",itau_wcosp, &
     13     stlidar%cldlayer(:,1))
    1314         endif
    1415         if (cfg%Lclhcalipso) then
    15           CALL histwrite_phy(nid_mth_cosp,"clhcalipso",itau_wcosp,stlidar%cldlayer(:,3))
     16          CALL histwrite_phy(nid_mth_cosp,lCOSP,"clhcalipso",itau_wcosp, &
     17     stlidar%cldlayer(:,3))
    1618         endif
    1719         if (cfg%Lclmcalipso) then
    18           CALL histwrite_phy(nid_mth_cosp,"clmcalipso",itau_wcosp,stlidar%cldlayer(:,2))
     20          CALL histwrite_phy(nid_mth_cosp,lCOSP,"clmcalipso",itau_wcosp, &
     21     stlidar%cldlayer(:,2))
    1922         endif
    2023         if (cfg%Lcltcalipso) then
    21           CALL histwrite_phy(nid_mth_cosp,"cltcalipso",itau_wcosp,stlidar%cldlayer(:,4))
     24          CALL histwrite_phy(nid_mth_cosp,lCOSP,"cltcalipso",itau_wcosp, &
     25     stlidar%cldlayer(:,4))
    2226         endif
    2327         if (cfg%Lclcalipso) then
    24           CALL histwrite_phy(nid_mth_cosp,"clcalipso",itau_wcosp,stlidar%lidarcld)
     28          CALL histwrite_phy(nid_mth_cosp,lCOSP,"clcalipso",itau_wcosp, &
     29     stlidar%lidarcld)
    2530         endif
    2631         if (cfg%Lcfad_lidarsr532) then
    2732           do ii=1,SR_BINS
    28             CALL histwrite_phy(nid_mth_cosp,"cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
     33            CALL histwrite_phy(nid_mth_cosp,lCOSP, &
     34     "cfad_lidarsr532_"//chcol(ii),itau_wcosp,stlidar%cfad_sr(:,ii,:))
    2935           enddo
    3036         endif
    3137         if (cfg%Lparasol_refl) then
    32            CALL histwrite_phy(nid_mth_cosp,"parasol_refl",itau_wcosp,stlidar%parasolrefl)
     38           CALL histwrite_phy(nid_mth_cosp,lCOSP,"parasol_refl", &
     39     itau_wcosp,stlidar%parasolrefl)
    3340         endif
    3441         if (cfg%Latb532) then
    3542           do ii=1,Ncolumns
    36             CALL histwrite_phy(nid_mth_cosp,"atb532_"//chcol(ii),itau_wcosp,sglidar%beta_tot(:,ii,:))
     43            CALL histwrite_phy(nid_mth_cosp,lCOSP, &
     44     "atb532_"//chcol(ii),itau_wcosp,sglidar%beta_tot(:,ii,:))
    3745           enddo
    3846         endif
    3947         if (cfg%Lbeta_mol532) then
    40            CALL histwrite_phy(nid_mth_cosp,"beta_mol532",itau_wcosp,sglidar%beta_mol)
     48           CALL histwrite_phy(nid_mth_cosp,lCOSP,"beta_mol532", &
     49     itau_wcosp,sglidar%beta_mol)
    4150         endif
    4251        endif ! Lidar
     
    8493          if (cfg%Lclisccp2) then
    8594            do ii=1,7
    86               CALL histwrite_phy(nid_mth_cosp,"clisccp2_"//chcol(ii),itau_wcosp,isccp%fq_isccp(:,ii,:))
     95              CALL histwrite_phy(nid_mth_cosp,lCOSP,"clisccp2_"//chcol(ii), &
     96     itau_wcosp,isccp%fq_isccp(:,ii,:))
    8797            enddo
    8898          endif
    8999          if (cfg%Lboxtauisccp) then
    90              CALL histwrite_phy(nid_mth_cosp,"boxtauisccp",itau_wcosp,isccp%boxtau)
     100             CALL histwrite_phy(nid_mth_cosp,lCOSP,"boxtauisccp", &
     101     itau_wcosp,isccp%boxtau)
    91102          endif
    92103          if (cfg%Lboxptopisccp) then
    93              CALL histwrite_phy(nid_mth_cosp,"boxptopisccp",itau_wcosp,isccp%boxptop)
     104             CALL histwrite_phy(nid_mth_cosp,lCOSP,"boxptopisccp", &
     105     itau_wcosp,isccp%boxptop)
    94106          endif
    95107          if (cfg%Ltclisccp) then
    96              CALL histwrite_phy(nid_mth_cosp,"tclisccp",itau_wcosp,isccp%totalcldarea)
     108             CALL histwrite_phy(nid_mth_cosp,lCOSP,"tclisccp", &
     109     itau_wcosp,isccp%totalcldarea)
    97110          endif
    98111          if (cfg%Lctpisccp) then
    99              CALL histwrite_phy(nid_mth_cosp,"ctpisccp",itau_wcosp,isccp%meanptop)
     112             CALL histwrite_phy(nid_mth_cosp,lCOSP,"ctpisccp", &
     113     itau_wcosp,isccp%meanptop)
    100114          endif
    101115          if (cfg%Ltauisccp) then
    102              CALL histwrite_phy(nid_mth_cosp,"tauisccp",itau_wcosp,isccp%meantaucld)
     116             CALL histwrite_phy(nid_mth_cosp,lCOSP,"tauisccp", &
     117     itau_wcosp,isccp%meantaucld)
    103118          endif
    104119          if (cfg%Lalbisccp) then
    105              CALL histwrite_phy(nid_mth_cosp,"albisccp",itau_wcosp,isccp%meanalbedocld)
     120             CALL histwrite_phy(nid_mth_cosp,lCOSP,"albisccp", &
     121     itau_wcosp,isccp%meanalbedocld)
    106122          endif
    107123          if (cfg%Lmeantbisccp) then
    108              CALL histwrite_phy(nid_mth_cosp,"meantbisccp",itau_wcosp,isccp%meantb)
     124             CALL histwrite_phy(nid_mth_cosp,lCOSP,"meantbisccp", &
     125     itau_wcosp,isccp%meantb)
    109126          endif
    110127          if (cfg%Lmeantbclrisccp) then
    111              CALL histwrite_phy(nid_mth_cosp,"meantbclrisccp",itau_wcosp,isccp%meantbclr)
     128             CALL histwrite_phy(nid_mth_cosp,lCOSP,"meantbclrisccp", &
     129     itau_wcosp,isccp%meantbclr)
    112130          endif
    113131        endif ! Isccp
  • LMDZ5/trunk/libf/phylmd/clesphys.h

    r1421 r1539  
    1515       REAL co2_ppm, co2_ppm0, solaire
    1616       REAL(kind=8) RCO2, RCH4, RN2O, RCFC11, RCFC12 
     17       REAL(kind=8) RCO2_act, RCH4_act, RN2O_act, RCFC11_act, RCFC12_act 
    1718       REAL(kind=8) CH4_ppb, N2O_ppb, CFC11_ppt, CFC12_ppt
     19!IM ajout CFMIP2/CMIP5
     20       REAL co2_ppm_per
     21       REAL(kind=8) RCO2_per,RCH4_per,RN2O_per,RCFC11_per,RCFC12_per
     22       REAL(kind=8) CH4_ppb_per,N2O_ppb_per,CFC11_ppt_per,CFC12_ppt_per
    1823
    1924!OM ---> correction du bilan d'eau global
     
    4954       INTEGER lev_histdayNMC
    5055       Integer lev_histins, lev_histLES 
    51 
    52 
    5356!IM ok_histNMC  : sortie fichiers niveaux de pression (histmthNMC, histdayNMC, histhfNMC)
    5457!IM freq_outNMC : frequences de sortie fichiers niveaux de pression (histmthNMC, histdayNMC, histhfNMC)
     
    5861       LOGICAL ok_histNMC(3)
    5962       REAL freq_outNMC(3) , freq_calNMC(3)
    60 
    6163       CHARACTER(len=4) type_run
    6264! aer_type: pour utiliser un fichier constant dans readaerosol
     
    7678       COMMON/clesphys/cycle_diurne, soil_model, new_oliq,              &
    7779     &     ok_orodr, ok_orolf, ok_limitvrai, nbapp_rad, iflag_con       &
    78      &     , co2_ppm, solaire, RCO2, RCH4, RN2O, RCFC11, RCFC12         &
     80     &     , co2_ppm, solaire                                           &
     81     &     , RCO2, RCH4, RN2O, RCFC11, RCFC12                           &
     82     &     , RCO2_act, RCH4_act, RN2O_act, RCFC11_act, RCFC12_act       &
     83     &     , RCO2_per, RCH4_per, RN2O_per, RCFC11_per, RCFC12_per       &
    7984     &     , CH4_ppb, N2O_ppb, CFC11_ppt, CFC12_ppt                     &
     85     &     , CH4_ppb_per, N2O_ppb_per, CFC11_ppt_per, CFC12_ppt_per     &
    8086     &     , top_height, overlap, cdmmax, cdhmax, ksta, ksta_ter        &
    8187     &     , ok_kzmin, fmagic, pmagic                                   &
    8288     &     , f_cdrag_ter,f_cdrag_oce,f_rugoro                           &
    8389     &     , lev_histhf, lev_histday, lev_histmth                       &
    84 
    8590     &     , lev_histins, lev_histLES, lev_histdayNMC                   &
    8691     &     , pasphys, ok_histNMC, freq_outNMC, freq_calNMC              &
  • LMDZ5/trunk/libf/phylmd/conf_phys.F90

    r1525 r1539  
    118118  real, save :: scut_omp, qqa1_omp, qqa2_omp, gammas_omp, Fmax_omp, alphas_omp
    119119
    120   REAL,SAVE :: R_ecc_omp,R_peri_omp,R_incl_omp,solaire_omp,co2_ppm_omp
    121   REAL,SAVE :: RCO2_omp,CH4_ppb_omp,RCH4_omp,N2O_ppb_omp,RN2O_omp,CFC11_ppt_omp
    122   REAL,SAVE :: RCFC11_omp,CFC12_ppt_omp,RCFC12_omp,epmax_omp
     120  REAL,SAVE :: R_ecc_omp,R_peri_omp,R_incl_omp,solaire_omp
     121  REAL,SAVE :: co2_ppm_omp, RCO2_omp, co2_ppm_per_omp, RCO2_per_omp
     122  REAL,SAVE :: CH4_ppb_omp, RCH4_omp, CH4_ppb_per_omp, RCH4_per_omp
     123  REAL,SAVE :: N2O_ppb_omp, RN2O_omp, N2O_ppb_per_omp, RN2O_per_omp
     124  REAL,SAVE :: CFC11_ppt_omp,RCFC11_omp,CFC11_ppt_per_omp,RCFC11_per_omp
     125  REAL,SAVE :: CFC12_ppt_omp,RCFC12_omp,CFC12_ppt_per_omp,RCFC12_per_omp
     126  REAL,SAVE :: epmax_omp
    123127  LOGICAL,SAVE :: ok_adj_ema_omp
    124128  INTEGER,SAVE :: iflag_clw_omp
     
    496500!OK call getin('RCFC12', RCFC12)
    497501
    498 
     502!ajout CFMIP begin
     503!!
     504!Config Key  = co2_ppm_per
     505!Config Desc = concentration du co2_ppm_per
     506!Config Def  = 348.
     507!Config Help =
     508!               
     509  co2_ppm_per_omp = co2_ppm_omp
     510  call getin('co2_ppm_per', co2_ppm_per_omp)
     511!!
     512!Config Key  = RCO2_per
     513!Config Desc = Concentration du CO2_per
     514!Config Def  = co2_ppm_per * 1.0e-06  * 44.011/28.97
     515!Config Def  = 348. * 1.0e-06  * 44.011/28.97
     516!Config Help =
     517!               
     518  RCO2_per_omp = co2_ppm_per_omp * 1.0e-06  * 44.011/28.97
     519
     520!Config Key  = RCH4_per
     521!Config Desc = Concentration du CH4_per
     522!Config Def  = 1.65E-06* 16.043/28.97
     523!Config Help =
     524!               
     525  zzz = CH4_ppb_omp
     526  call getin('CH4_ppb_per', zzz)
     527  CH4_ppb_per_omp = zzz
     528  RCH4_per_omp = CH4_ppb_per_omp * 1.0E-09 * 16.043/28.97
     529!!
     530!Config Key  = RN2O_per
     531!Config Desc = Concentration du N2O_per
     532!Config Def  = 306.E-09* 44.013/28.97
     533!Config Help =
     534!               
     535  zzz = N2O_ppb_omp
     536  call getin('N2O_ppb_per', zzz)
     537  N2O_ppb_per_omp = zzz
     538  RN2O_per_omp = N2O_ppb_per_omp * 1.0E-09 * 44.013/28.97
     539!!
     540!Config Key  = RCFC11_per
     541!Config Desc = Concentration du CFC11_per
     542!Config Def  = 280.E-12* 137.3686/28.97
     543!Config Help =
     544!               
     545  zzz = CFC11_ppt_omp
     546  call getin('CFC11_ppt_per',zzz)
     547  CFC11_ppt_per_omp = zzz
     548  RCFC11_per_omp=CFC11_ppt_per_omp* 1.0E-12 * 137.3686/28.97
     549!!
     550!Config Key  = RCFC12_per
     551!Config Desc = Concentration du CFC12_per
     552!Config Def  = 484.E-12* 120.9140/28.97
     553!Config Help =
     554!               
     555  zzz = CFC12_ppt_omp
     556  call getin('CFC12_ppt_per',zzz)
     557  CFC12_ppt_per_omp = zzz
     558  RCFC12_per_omp = CFC12_ppt_per_omp * 1.0E-12 * 120.9140/28.97
     559!ajout CFMIP end
    499560
    500561!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    14891550    CFC12_ppt = CFC12_ppt_omp
    14901551    RCFC12 = RCFC12_omp
    1491 
     1552    RCO2_act = RCO2
     1553    RCH4_act = RCH4
     1554    RN2O_act = RN2O
     1555    RCFC11_act = RCFC11
     1556    RCFC12_act = RCFC12
     1557    RCO2_per = RCO2_per_omp
     1558    RCH4_per = RCH4_per_omp
     1559    RN2O_per = RN2O_per_omp
     1560    RCFC11_per = RCFC11_per_omp
     1561    RCFC12_per = RCFC12_per_omp
     1562   
    14921563    cycle_diurne = cycle_diurne_omp
    14931564    soil_model = soil_model_omp
     
    16641735  write(numout,*)' Constante solaire =',solaire
    16651736  write(numout,*)' co2_ppm =',co2_ppm
    1666   write(numout,*)' RCO2 = ',RCO2
    1667   write(numout,*)' CH4_ppb =',CH4_ppb,' RCH4 = ',RCH4
    1668   write(numout,*)' N2O_ppb =',N2O_ppb,' RN2O =  ',RN2O
    1669   write(numout,*)' CFC11_ppt=',CFC11_ppt,' RCFC11 =  ',RCFC11
    1670   write(numout,*)' CFC12_ppt=',CFC12_ppt,' RCFC12 =  ',RCFC12
     1737  write(numout,*)' RCO2_act = ',RCO2_act
     1738  write(numout,*)' CH4_ppb =',CH4_ppb,' RCH4_act = ',RCH4_act
     1739  write(numout,*)' N2O_ppb =',N2O_ppb,' RN2O_act=  ',RN2O_act
     1740  write(numout,*)' CFC11_ppt=',CFC11_ppt,' RCFC11_act=  ',RCFC11_act
     1741  write(numout,*)' CFC12_ppt=',CFC12_ppt,' RCFC12_act=  ',RCFC12_act
     1742  write(numout,*)' RCO2_per = ',RCO2_per,' RCH4_per = ', RCH4_per
     1743  write(numout,*)' RN2O_per = ',RN2O_per,' RCFC11_per = ', RCFC11_per
     1744  write(numout,*)' RCFC12_per = ',RCFC12_per
    16711745  write(numout,*)' cvl_corr=', cvl_corr
    16721746  write(numout,*)'ok_lic_melt=', ok_lic_melt
  • LMDZ5/trunk/libf/phylmd/iophy.F90

    r1331 r1539  
    99  REAL,allocatable,dimension(:),save :: io_lon
    1010  INTEGER, save :: phys_domain_id
     11  INTEGER, save :: npstn
     12  INTEGER, allocatable, dimension(:), save :: nptabij
    1113 
    1214  INTERFACE histwrite_phy
    1315    MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy
     16  END INTERFACE
     17
     18  INTERFACE histbeg_phy_all
     19    MODULE PROCEDURE histbeg_phy,histbeg_phy_points
    1420  END INTERFACE
    1521
     
    144150 
    145151  end subroutine histbeg_phy
    146  
    147   subroutine histwrite2d_phy(nid,name,itau,field)
     152
     153  subroutine histbeg_phy_points(rlon,rlat,pim,tabij,ipt,jpt, &
     154             plon,plat,plon_bounds,plat_bounds, &
     155             nname,itau0,zjulian,dtime,nnhori,nnid_day)
     156  USE dimphy
     157  USE mod_phys_lmdz_para
     158  USE mod_grid_phy_lmdz
     159  use ioipsl
     160  use write_field
     161  implicit none
     162  include 'dimensions.h'
     163
     164    real,dimension(klon),intent(in) :: rlon
     165    real,dimension(klon),intent(in) :: rlat
     166    integer, intent(in) :: itau0
     167    real,intent(in) :: zjulian
     168    real,intent(in) :: dtime
     169    integer, intent(in) :: pim
     170    integer, intent(out) :: nnhori
     171    character(len=20), intent(in) :: nname
     172    INTEGER, intent(out) :: nnid_day
     173    integer :: i
     174    REAL,dimension(klon_glo)        :: rlat_glo
     175    REAL,dimension(klon_glo)        :: rlon_glo
     176    INTEGER, DIMENSION(pim), intent(in)  :: tabij
     177    REAL,dimension(pim), intent(in) :: plat, plon
     178    INTEGER,dimension(pim), intent(in) :: ipt, jpt
     179    REAL,dimension(pim,2), intent(out) :: plat_bounds, plon_bounds
     180
     181    INTEGER, SAVE :: tabprocbeg, tabprocend
     182!$OMP THREADPRIVATE(tabprocbeg, tabprocend)
     183    INTEGER :: ip
     184    INTEGER, PARAMETER :: nip=1
     185    INTEGER :: npproc
     186    REAL, allocatable, dimension(:) :: npplat, npplon
     187    REAL, allocatable, dimension(:,:) :: npplat_bounds, npplon_bounds
     188    INTEGER, PARAMETER :: jjmp1=jjm+1-1/jjm
     189    REAL, dimension(iim,jjmp1) :: zx_lon, zx_lat
     190
     191    CALL gather(rlat,rlat_glo)
     192    CALL bcast(rlat_glo)
     193    CALL gather(rlon,rlon_glo)
     194    CALL bcast(rlon_glo)
     195
     196!$OMP MASTER
     197    DO i=1,pim
     198
     199!    print*,'CFMIP_iophy i tabij lon lat',i,tabij(i),plon(i),plat(i)
     200
     201     plon_bounds(i,1)=rlon_glo(tabij(i)-1)
     202     plon_bounds(i,2)=rlon_glo(tabij(i)+1)
     203     if(plon_bounds(i,2).LE.0..AND.plon_bounds(i,1).GE.0.) THEN
     204      if(rlon_glo(tabij(i)).GE.0.) THEN
     205       plon_bounds(i,2)=-1*plon_bounds(i,2)
     206      endif
     207     endif
     208     if(plon_bounds(i,2).GE.0..AND.plon_bounds(i,1).LE.0.) THEN
     209      if(rlon_glo(tabij(i)).LE.0.) THEN
     210       plon_bounds(i,2)=-1*plon_bounds(i,2)
     211      endif
     212     endif
     213!
     214     IF ( tabij(i).LE.iim) THEN
     215      plat_bounds(i,1)=rlat_glo(tabij(i))
     216     ELSE
     217      plat_bounds(i,1)=rlat_glo(tabij(i)-iim)
     218     ENDIF
     219     plat_bounds(i,2)=rlat_glo(tabij(i)+iim)
     220!
     221!    print*,'CFMIP_iophy point i lon lon_bds',i,plon_bounds(i,1),rlon_glo(tabij(i)),plon_bounds(i,2)
     222!    print*,'CFMIP_iophy point i lat lat_bds',i,plat_bounds(i,1),rlat_glo(tabij(i)),plat_bounds(i,2)
     223!
     224    ENDDO
     225    if (is_sequential) then
     226
     227     npstn=pim
     228     IF(.NOT. ALLOCATED(nptabij)) THEN
     229      ALLOCATE(nptabij(pim))
     230     ENDIF
     231     DO i=1,pim
     232      nptabij(i)=tabij(i)
     233     ENDDO
     234
     235       CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlon_glo,zx_lon)
     236       if (iim.gt.1) then
     237       DO i = 1, iim
     238         zx_lon(i,1) = rlon_glo(i+1)
     239         zx_lon(i,jjmp1) = rlon_glo(i+1)
     240       ENDDO
     241       endif
     242       CALL gr_fi_ecrit(1,klon,iim,jjmp1,rlat_glo,zx_lat)
     243
     244    DO i=1,pim
     245!    print*,'CFMIP_iophy i tabij lon lat',i,tabij(i),plon(i),plat(i)
     246
     247     plon_bounds(i,1)=zx_lon(ipt(i)-1,jpt(i))
     248     plon_bounds(i,2)=zx_lon(ipt(i)+1,jpt(i))
     249
     250     if (ipt(i).EQ.1) then
     251      plon_bounds(i,1)=zx_lon(iim,jpt(i))
     252      plon_bounds(i,2)=360.+zx_lon(ipt(i)+1,jpt(i))
     253     endif
     254 
     255     if (ipt(i).EQ.iim) then
     256      plon_bounds(i,2)=360.+zx_lon(1,jpt(i))
     257     endif
     258
     259     plat_bounds(i,1)=zx_lat(ipt(i),jpt(i)-1)
     260     plat_bounds(i,2)=zx_lat(ipt(i),jpt(i)+1)
     261
     262     if (jpt(i).EQ.1) then
     263      plat_bounds(i,1)=zx_lat(ipt(i),1)+0.001
     264      plat_bounds(i,2)=zx_lat(ipt(i),1)-0.001
     265     endif
     266 
     267     if (jpt(i).EQ.jjmp1) then
     268      plat_bounds(i,1)=zx_lat(ipt(i),jjmp1)+0.001
     269      plat_bounds(i,2)=zx_lat(ipt(i),jjmp1)-0.001
     270     endif
     271!
     272!    print*,'CFMIP_iophy point i lon lon_bds',i,plon_bounds(i,1),rlon(tabij(i)),plon_bounds(i,2)
     273!    print*,'CFMIP_iophy point i lat lat_bds',i,plat_bounds(i,1),rlat(tabij(i)),plat_bounds(i,2)
     274!
     275    ENDDO
     276!    print*,'iophy is_sequential nname, nnhori, nnid_day=',trim(nname),nnhori,nnid_day
     277     call histbeg(nname,pim,plon,plon_bounds, &
     278                           plat,plat_bounds, &
     279                           itau0, zjulian, dtime, nnhori, nnid_day)
     280    else
     281     npproc=0
     282     DO ip=1, pim
     283      tabprocbeg=klon_mpi_begin
     284      tabprocend=klon_mpi_end
     285      IF(tabij(ip).GE.tabprocbeg.AND.tabij(ip).LE.tabprocend) THEN
     286       npproc=npproc+1
     287       npstn=npproc
     288      ENDIF
     289     ENDDO
     290!    print*,'CFMIP_iophy mpi_rank npstn',mpi_rank,npstn
     291     IF(.NOT. ALLOCATED(nptabij)) THEN
     292      ALLOCATE(nptabij(npstn))
     293      ALLOCATE(npplon(npstn), npplat(npstn))
     294      ALLOCATE(npplon_bounds(npstn,2), npplat_bounds(npstn,2))
     295     ENDIF
     296     npproc=0
     297     DO ip=1, pim
     298      IF(tabij(ip).GE.tabprocbeg.AND.tabij(ip).LE.tabprocend) THEN
     299       npproc=npproc+1
     300       nptabij(npproc)=tabij(ip)
     301!      print*,'mpi_rank npproc ip plon plat tabij=',mpi_rank,npproc,ip, &
     302!      plon(ip),plat(ip),tabij(ip)
     303       npplon(npproc)=plon(ip)
     304       npplat(npproc)=plat(ip)
     305       npplon_bounds(npproc,1)=plon_bounds(ip,1)
     306       npplon_bounds(npproc,2)=plon_bounds(ip,2)
     307       npplat_bounds(npproc,1)=plat_bounds(ip,1)
     308       npplat_bounds(npproc,2)=plat_bounds(ip,2)
     309!!!
     310!!! print qui sert a reordonner les points stations selon l'ordre CFMIP
     311!!! ne pas enlever
     312        print*,'iophy_mpi rank ip lon lat',mpi_rank,ip,plon(ip),plat(ip)
     313!!!
     314      ENDIF
     315     ENDDO
     316     call histbeg(nname,npstn,npplon,npplon_bounds, &
     317                            npplat,npplat_bounds, &
     318                            itau0,zjulian,dtime,nnhori,nnid_day,phys_domain_id)
     319    endif
     320!$OMP END MASTER
     321
     322  end subroutine histbeg_phy_points
     323 
     324  subroutine histwrite2d_phy(nid,lpoint,name,itau,field)
    148325  USE dimphy
    149326  USE mod_phys_lmdz_para
     
    153330   
    154331    integer,intent(in) :: nid
     332    logical,intent(in) :: lpoint
    155333    character*(*), intent(IN) :: name
    156334    integer, intent(in) :: itau
    157335    real,dimension(:),intent(in) :: field
    158336    REAL,dimension(klon_mpi) :: buffer_omp
    159     INTEGER :: index2d(iim*jj_nb)
     337    INTEGER, allocatable, dimension(:) :: index2d
    160338    REAL :: Field2d(iim,jj_nb)
     339
     340    integer :: ip
     341    real,allocatable,dimension(:) :: fieldok
    161342
    162343    IF (size(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first dimension not equal to klon',1)
     
    165346!$OMP MASTER
    166347    CALL grid1Dto2D_mpi(buffer_omp,Field2d)
    167     CALL histwrite(nid,name,itau,Field2d,iim*jj_nb,index2d)
     348    if(.NOT.lpoint) THEN
     349     ALLOCATE(index2d(iim*jj_nb))
     350     ALLOCATE(fieldok(iim*jj_nb))
     351     CALL histwrite(nid,name,itau,Field2d,iim*jj_nb,index2d)
     352    else
     353     ALLOCATE(fieldok(npstn))
     354     ALLOCATE(index2d(npstn))
     355
     356     if(is_sequential) then
     357!     klon_mpi_begin=1
     358!     klon_mpi_end=klon
     359      DO ip=1, npstn
     360       fieldok(ip)=buffer_omp(nptabij(ip))
     361      ENDDO
     362     else
     363      DO ip=1, npstn
     364!     print*,'histwrite2d is_sequential npstn ip name nptabij',npstn,ip,name,nptabij(ip)
     365       IF(nptabij(ip).GE.klon_mpi_begin.AND. &
     366          nptabij(ip).LE.klon_mpi_end) THEN
     367         fieldok(ip)=buffer_omp(nptabij(ip)-klon_mpi_begin+1)
     368       ENDIF
     369      ENDDO
     370     endif
     371     CALL histwrite(nid,name,itau,fieldok,npstn,index2d)
     372!
     373    endif
     374    deallocate(index2d)
     375    deallocate(fieldok)
    168376!$OMP END MASTER   
    169377  end subroutine histwrite2d_phy
    170378
    171 
    172  
    173   subroutine histwrite3d_phy(nid,name,itau,field)
     379  subroutine histwrite3d_phy(nid,lpoint,name,itau,field)
    174380  USE dimphy
    175381  USE mod_phys_lmdz_para
     
    180386   
    181387    integer,intent(in) :: nid
     388    logical,intent(in) :: lpoint
    182389    character*(*), intent(IN) :: name
    183390    integer, intent(in) :: itau
    184391    real,dimension(:,:),intent(in) :: field  ! --> field(klon,:)
    185392    REAL,dimension(klon_mpi,size(field,2)) :: buffer_omp
    186     INTEGER :: nlev
    187     INTEGER :: index3d(iim*jj_nb*size(field,2))
    188393    REAL :: Field3d(iim,jj_nb,size(field,2))
    189    
     394    INTEGER :: ip, n, nlev
     395    INTEGER, ALLOCATABLE, dimension(:) :: index3d
     396    real,allocatable, dimension(:,:) :: fieldok
     397
    190398    IF (size(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first dimension not equal to klon',1)
    191399    nlev=size(field,2)
    192    
     400
     401!   print*,'hist3d_phy mpi_rank npstn=',mpi_rank,npstn
     402
     403!   DO ip=1, npstn
     404!    print*,'hist3d_phy mpi_rank nptabij',mpi_rank,nptabij(ip)
     405!   ENDDO
     406
    193407    CALL Gather_omp(field,buffer_omp)
    194408!$OMP MASTER
    195409    CALL grid1Dto2D_mpi(buffer_omp,field3d)
    196     CALL histwrite(nid,name,itau,Field3d,iim*jj_nb*nlev,index3d)
     410    if(.NOT.lpoint) THEN
     411     ALLOCATE(index3d(iim*jj_nb*nlev))
     412     ALLOCATE(fieldok(iim*jj_nb,nlev))
     413     CALL histwrite(nid,name,itau,Field3d,iim*jj_nb*nlev,index3d)
     414    else
     415      nlev=size(field,2)
     416      ALLOCATE(index3d(npstn*nlev))
     417      ALLOCATE(fieldok(npstn,nlev))
     418
     419      if(is_sequential) then
     420!      klon_mpi_begin=1
     421!      klon_mpi_end=klon
     422       DO n=1, nlev
     423       DO ip=1, npstn
     424        fieldok(ip,n)=buffer_omp(nptabij(ip),n)
     425       ENDDO
     426       ENDDO
     427      else
     428       DO n=1, nlev
     429       DO ip=1, npstn
     430        IF(nptabij(ip).GE.klon_mpi_begin.AND. &
     431         nptabij(ip).LE.klon_mpi_end) THEN
     432         fieldok(ip,n)=buffer_omp(nptabij(ip)-klon_mpi_begin+1,n)
     433        ENDIF
     434       ENDDO
     435       ENDDO
     436      endif
     437      CALL histwrite(nid,name,itau,fieldok,npstn*nlev,index3d)
     438    endif
     439  deallocate(index3d)
     440  deallocate(fieldok)
    197441!$OMP END MASTER   
    198442  end subroutine histwrite3d_phy
    199443 
    200  
    201 
    202444end module iophy
  • LMDZ5/trunk/libf/phylmd/pbl_surface_mod.F90

    r1413 r1539  
    177177       zxtsol,    zxfluxlat, zt2m,     qsat2m,        &
    178178       d_t,       d_q,       d_u,      d_v,           &
    179        zcoefh,    slab_wfbils,                        &
     179       zcoefh,    zcoefm,    slab_wfbils,             &
    180180       qsol_d,    zq2m,      s_pblh,   s_plcl,        &
    181181       s_capCL,   s_oliqCL,  s_cteiCL, s_pblT,        &
     
    313313    REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: d_v        ! change in v speed
    314314    REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: zcoefh     ! coef for turbulent diffusion of T and Q, mean for each grid point
     315    REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: zcoefm     ! coef for turbulent diffusion of U and V (?), mean for each grid point
    315316
    316317! Output only for diagnostics
     
    547548    zcoefh(:,:) = 0.0
    548549    zcoefh(:,1) = 999999. ! zcoefh(:,k=1) should never be used
     550    zcoefm(:,:) = 0.0
     551    zcoefm(:,1) = 999999. !
    549552    ytsoil = 999999.
    550553
     
    971974             i = ni(j)
    972975             zcoefh(i,k) = zcoefh(i,k) + ycoefh(j,k)*ypct(j)
     976             zcoefm(i,k) = zcoefm(i,k) + ycoefm(j,k)*ypct(j)
    973977          END DO
    974978       END DO
  • LMDZ5/trunk/libf/phylmd/phys_local_var_mod.F90

    r1513 r1539  
    169169      !$OMP THREADPRIVATE(load_tmp7)
    170170
     171!IM ajout variables CFMIP2/CMIP5
     172      REAL,ALLOCATABLE,SAVE :: topswad_aerop(:), solswad_aerop(:)
     173!$OMP THREADPRIVATE(topswad_aerop, solswad_aerop)
     174      REAL,ALLOCATABLE,SAVE :: topswai_aerop(:), solswai_aerop(:)
     175!$OMP THREADPRIVATE(topswai_aerop, solswai_aerop)
     176      REAL,ALLOCATABLE,SAVE :: topswad0_aerop(:), solswad0_aerop(:)
     177!$OMP THREADPRIVATE(topswad0_aerop, solswad0_aerop)
     178      REAL,ALLOCATABLE,SAVE :: topsw_aerop(:,:), topsw0_aerop(:,:) 
     179!$OMP THREADPRIVATE(topsw_aerop, topsw0_aerop)
     180      REAL,ALLOCATABLE,SAVE :: solsw_aerop(:,:), solsw0_aerop(:,:)
     181!$OMP THREADPRIVATE(solsw_aerop, solsw0_aerop)
     182      REAL,ALLOCATABLE,SAVE :: topswcf_aerop(:,:), solswcf_aerop(:,:)
     183!$OMP THREADPRIVATE(topswcf_aerop, solswcf_aerop)
     184
    171185CONTAINS
    172186
     
    252266      allocate(load_tmp7(klon))
    253267
     268!IM ajout variables CFMIP2/CMIP5
     269      ALLOCATE(topswad_aerop(klon), solswad_aerop(klon))
     270      ALLOCATE(topswai_aerop(klon), solswai_aerop(klon))
     271      ALLOCATE(topswad0_aerop(klon), solswad0_aerop(klon))
     272      ALLOCATE(topsw_aerop(klon,naero_grp), topsw0_aerop(klon,naero_grp))
     273      ALLOCATE(solsw_aerop(klon,naero_grp), solsw0_aerop(klon,naero_grp))
     274      ALLOCATE(topswcf_aerop(klon,naero_grp), solswcf_aerop(klon,naero_grp))
     275
    254276END SUBROUTINE phys_local_var_init
    255277
     
    332354      deallocate(d_u_hin,d_v_hin,d_t_hin)
    333355
     356!IM ajout variables CFMIP2/CMIP5
     357      deallocate(topswad_aerop, solswad_aerop)
     358      deallocate(topswai_aerop, solswai_aerop)
     359      deallocate(topswad0_aerop, solswad0_aerop)
     360      deallocate(topsw_aerop, topsw0_aerop)
     361      deallocate(solsw_aerop, solsw0_aerop)
     362      deallocate(topswcf_aerop, solswcf_aerop)
     363
    334364END SUBROUTINE phys_local_var_end
    335365
  • LMDZ5/trunk/libf/phylmd/phys_output_mod.F90

    r1518 r1539  
    1717
    1818
    19    integer, parameter                           :: nfiles = 5
     19   integer, parameter                           :: nfiles = 6
    2020   logical, dimension(nfiles), save             :: clef_files
     21   logical, dimension(nfiles), save             :: clef_stations
    2122   integer, dimension(nfiles), save             :: lev_files
    2223   integer, dimension(nfiles), save             :: nid_files
    23 !!$OMP THREADPRIVATE(clef_files, lev_files,nid_files)
     24   integer, dimension(nfiles), save  :: nnid_files
     25!!$OMP THREADPRIVATE(clef_files, clef_stations, lev_files,nid_files,nnid_files)
     26   integer, dimension(nfiles), private, save :: nnhorim
    2427 
    2528   integer, dimension(nfiles), private, save :: nhorim, nvertm
     
    4245
    4346  TYPE ctrl_out
    44    integer,dimension(5) :: flag
     47   integer,dimension(6) :: flag
    4548   character(len=20)     :: name
    4649  END TYPE ctrl_out
     
    4851!!! Comosentes de la coordonnee sigma-hybride
    4952!!! Ap et Bp
    50   type(ctrl_out),save :: o_Ahyb         = ctrl_out((/ 1, 1, 1, 1, 1 /), 'Ap')
    51   type(ctrl_out),save :: o_Bhyb         = ctrl_out((/ 1, 1, 1, 1, 1 /), 'Bp')
    52   type(ctrl_out),save :: o_Alt          = ctrl_out((/ 1, 1, 1, 1, 1 /), 'Alt')
     53  type(ctrl_out),save :: o_Ahyb         = ctrl_out((/ 1, 1, 1, 1, 1, 1 /), 'Ap')
     54  type(ctrl_out),save :: o_Bhyb         = ctrl_out((/ 1, 1, 1, 1, 1, 1 /), 'Bp')
     55  type(ctrl_out),save :: o_Alt          = ctrl_out((/ 1, 1, 1, 1, 1, 1 /), 'Alt')
    5356
    5457!!! 1D
    55   type(ctrl_out),save :: o_phis         = ctrl_out((/ 1, 1, 10, 5, 1 /), 'phis')
    56   type(ctrl_out),save :: o_aire         = ctrl_out((/ 1, 1, 10,  10, 1 /),'aire')
    57   type(ctrl_out),save :: o_contfracATM  = ctrl_out((/ 10, 1,  1, 10, 10 /),'contfracATM')
    58   type(ctrl_out),save :: o_contfracOR   = ctrl_out((/ 10, 1,  1, 10, 10 /),'contfracOR')
    59   type(ctrl_out),save :: o_aireTER      = ctrl_out((/ 10, 10, 1, 10, 10 /),'aireTER')
     58  type(ctrl_out),save :: o_phis         = ctrl_out((/ 1, 1, 10, 5, 1, 1 /), 'phis')
     59  type(ctrl_out),save :: o_aire         = ctrl_out((/ 1, 1, 10,  10, 1, 1 /),'aire')
     60  type(ctrl_out),save :: o_contfracATM  = ctrl_out((/ 10, 1,  1, 10, 10, 10 /),'contfracATM')
     61  type(ctrl_out),save :: o_contfracOR   = ctrl_out((/ 10, 1,  1, 10, 10, 10 /),'contfracOR')
     62  type(ctrl_out),save :: o_aireTER      = ctrl_out((/ 10, 10, 1, 10, 10, 10 /),'aireTER')
    6063 
    6164!!! 2D
    62 
    63   type(ctrl_out),save :: o_flat         = ctrl_out((/ 5, 1, 10, 5, 1 /),'flat')
    64   type(ctrl_out),save :: o_slp          = ctrl_out((/ 1, 1, 1, 10, 1 /),'slp')
    65   type(ctrl_out),save :: o_tsol         = ctrl_out((/ 1, 1, 1, 5, 1 /),'tsol')
    66   type(ctrl_out),save :: o_t2m          = ctrl_out((/ 1, 1, 1, 5, 1 /),'t2m')
    67   type(ctrl_out),save :: o_t2m_min      = ctrl_out((/ 1, 1, 10, 10, 10 /),'t2m_min')
    68   type(ctrl_out),save :: o_t2m_max      = ctrl_out((/ 1, 1, 10, 10, 10 /),'t2m_max')
    69   type(ctrl_out),save,dimension(4) :: o_t2m_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_ter'), &
    70                                                  ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_lic'), &
    71                                                  ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_oce'), &
    72                                                  ctrl_out((/ 10, 4, 10, 10, 10 /),'t2m_sic') /)
    73 
    74   type(ctrl_out),save :: o_wind10m      = ctrl_out((/ 1, 1, 1, 10, 10 /),'wind10m')
    75   type(ctrl_out),save :: o_wind10max    = ctrl_out((/ 10, 1, 10, 10, 10 /),'wind10max')
    76   type(ctrl_out),save :: o_sicf         = ctrl_out((/ 1, 1, 10, 10, 10 /),'sicf')
    77   type(ctrl_out),save :: o_q2m          = ctrl_out((/ 1, 1, 1, 5, 1 /),'q2m')
    78   type(ctrl_out),save :: o_u10m         = ctrl_out((/ 1, 1, 1, 5, 1 /),'u10m')
    79   type(ctrl_out),save :: o_v10m         = ctrl_out((/ 1, 1, 1, 5, 1 /),'v10m')
    80   type(ctrl_out),save :: o_psol         = ctrl_out((/ 1, 1, 1, 5, 1 /),'psol')
    81   type(ctrl_out),save :: o_qsurf        = ctrl_out((/ 1, 10, 10, 10, 10 /),'qsurf')
    82 
    83   type(ctrl_out),save,dimension(4) :: o_u10m_srf     = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_ter'), &
    84                                               ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_lic'), &
    85                                               ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_oce'), &
    86                                               ctrl_out((/ 10, 4, 10, 10, 10 /),'u10m_sic') /)
    87 
    88   type(ctrl_out),save,dimension(4) :: o_v10m_srf     = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_ter'), &
    89                                               ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_lic'), &
    90                                               ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_oce'), &
    91                                               ctrl_out((/ 10, 4, 10, 10, 10 /),'v10m_sic') /)
    92 
    93   type(ctrl_out),save :: o_qsol         = ctrl_out((/ 1, 10, 10, 10, 10 /),'qsol')
    94 
    95   type(ctrl_out),save :: o_ndayrain     = ctrl_out((/ 1, 10, 10, 10, 10 /),'ndayrain')
    96   type(ctrl_out),save :: o_precip       = ctrl_out((/ 1, 1, 1, 5, 10 /),'precip')
    97   type(ctrl_out),save :: o_plul         = ctrl_out((/ 1, 1, 1, 10, 10 /),'plul')
    98 
    99   type(ctrl_out),save :: o_pluc         = ctrl_out((/ 1, 1, 1, 5, 10 /),'pluc')
    100   type(ctrl_out),save :: o_snow         = ctrl_out((/ 1, 1, 10, 5, 10 /),'snow')
    101   type(ctrl_out),save :: o_evap         = ctrl_out((/ 1, 1, 10, 10, 10 /),'evap')
    102   type(ctrl_out),save,dimension(4) :: o_evap_srf     = (/ ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_ter'), &
    103                                            ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_lic'), &
    104                                            ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_oce'), &
    105                                            ctrl_out((/ 1, 1, 10, 10, 10 /),'evap_sic') /)
    106   type(ctrl_out),save :: o_msnow       = ctrl_out((/ 1, 10, 10, 10, 10 /),'msnow')
    107   type(ctrl_out),save :: o_fsnow       = ctrl_out((/ 1, 10, 10, 10, 10 /),'fsnow')
    108 
    109   type(ctrl_out),save :: o_tops         = ctrl_out((/ 1, 1, 10, 10, 10 /),'tops')
    110   type(ctrl_out),save :: o_tops0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'tops0')
    111   type(ctrl_out),save :: o_topl         = ctrl_out((/ 1, 1, 10, 5, 10 /),'topl')
    112   type(ctrl_out),save :: o_topl0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'topl0')
    113   type(ctrl_out),save :: o_SWupTOA      = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWupTOA')
    114   type(ctrl_out),save :: o_SWupTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWupTOAclr')
    115   type(ctrl_out),save :: o_SWdnTOA      = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWdnTOA')
    116   type(ctrl_out),save :: o_SWdnTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWdnTOAclr')
    117   type(ctrl_out),save :: o_nettop       = ctrl_out((/ 1, 4, 10, 10, 10 /),'nettop')
    118 
    119   type(ctrl_out),save :: o_SWup200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'SWup200')
    120   type(ctrl_out),save :: o_SWup200clr   = ctrl_out((/ 10, 1, 10, 10, 10 /),'SWup200clr')
    121   type(ctrl_out),save :: o_SWdn200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'SWdn200')
    122   type(ctrl_out),save :: o_SWdn200clr   = ctrl_out((/ 10, 1, 10, 10, 10 /),'SWdn200clr')
     65  type(ctrl_out),save :: o_flat         = ctrl_out((/ 5, 1, 10, 10, 5, 10 /),'flat')
     66  type(ctrl_out),save :: o_slp          = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'slp')
     67  type(ctrl_out),save :: o_tsol         = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'tsol')
     68  type(ctrl_out),save :: o_t2m          = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'t2m')
     69  type(ctrl_out),save :: o_t2m_min      = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'t2m_min')
     70  type(ctrl_out),save :: o_t2m_max      = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'t2m_max')
     71  type(ctrl_out),save,dimension(4) :: o_t2m_srf      = (/ ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_ter'), &
     72                                                 ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_lic'), &
     73                                                 ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_oce'), &
     74                                                 ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'t2m_sic') /)
     75
     76  type(ctrl_out),save :: o_wind10m      = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'wind10m')
     77  type(ctrl_out),save :: o_wind10max    = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'wind10max')
     78  type(ctrl_out),save :: o_sicf         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'sicf')
     79  type(ctrl_out),save :: o_q2m          = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'q2m')
     80  type(ctrl_out),save :: o_u10m         = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'u10m')
     81  type(ctrl_out),save :: o_v10m         = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'v10m')
     82  type(ctrl_out),save :: o_psol         = ctrl_out((/ 1, 1, 1, 5, 10, 10 /),'psol')
     83  type(ctrl_out),save :: o_qsurf        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'qsurf')
     84
     85  type(ctrl_out),save,dimension(4) :: o_u10m_srf     = (/ ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_ter'), &
     86                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_lic'), &
     87                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_oce'), &
     88                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_sic') /)
     89
     90  type(ctrl_out),save,dimension(4) :: o_v10m_srf     = (/ ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_ter'), &
     91                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_lic'), &
     92                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_oce'), &
     93                                              ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_sic') /)
     94
     95  type(ctrl_out),save :: o_qsol         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'qsol')
     96
     97  type(ctrl_out),save :: o_ndayrain     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'ndayrain')
     98  type(ctrl_out),save :: o_precip       = ctrl_out((/ 1, 1, 1, 10, 5, 10 /),'precip')
     99  type(ctrl_out),save :: o_plul         = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'plul')
     100
     101  type(ctrl_out),save :: o_pluc         = ctrl_out((/ 1, 1, 1, 10, 5, 10 /),'pluc')
     102  type(ctrl_out),save :: o_snow         = ctrl_out((/ 1, 1, 10, 10, 5, 10 /),'snow')
     103  type(ctrl_out),save :: o_evap         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'evap')
     104  type(ctrl_out),save,dimension(4) :: o_evap_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_ter'), &
     105                                           ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_lic'), &
     106                                           ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_oce'), &
     107                                           ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_sic') /)
     108  type(ctrl_out),save :: o_msnow       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'msnow')
     109  type(ctrl_out),save :: o_fsnow       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsnow')
     110
     111  type(ctrl_out),save :: o_tops         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'tops')
     112  type(ctrl_out),save :: o_tops0        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'tops0')
     113  type(ctrl_out),save :: o_topl         = ctrl_out((/ 1, 1, 10, 5, 10, 10 /),'topl')
     114  type(ctrl_out),save :: o_topl0        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'topl0')
     115  type(ctrl_out),save :: o_SWupTOA      = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'SWupTOA')
     116  type(ctrl_out),save :: o_SWupTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'SWupTOAclr')
     117  type(ctrl_out),save :: o_SWdnTOA      = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'SWdnTOA')
     118  type(ctrl_out),save :: o_SWdnTOAclr   = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'SWdnTOAclr')
     119  type(ctrl_out),save :: o_nettop       = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'nettop')
     120
     121  type(ctrl_out),save :: o_SWup200      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'SWup200')
     122  type(ctrl_out),save :: o_SWup200clr   = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'SWup200clr')
     123  type(ctrl_out),save :: o_SWdn200      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'SWdn200')
     124  type(ctrl_out),save :: o_SWdn200clr   = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'SWdn200clr')
    123125
    124126! arajouter
    125 !  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWupTOA')
    126 !  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWupTOAclr')
    127 !  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWdnTOA')
    128 !  type(ctrl_out),save :: o_LWdnTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWdnTOAclr')
    129 
    130   type(ctrl_out),save :: o_LWup200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWup200')
    131   type(ctrl_out),save :: o_LWup200clr   = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWup200clr')
    132   type(ctrl_out),save :: o_LWdn200      = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWdn200')
    133   type(ctrl_out),save :: o_LWdn200clr   = ctrl_out((/ 1, 10, 10, 10, 10 /),'LWdn200clr')
    134   type(ctrl_out),save :: o_sols         = ctrl_out((/ 1, 1, 10, 10, 10 /),'sols')
    135   type(ctrl_out),save :: o_sols0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'sols0')
    136   type(ctrl_out),save :: o_soll         = ctrl_out((/ 1, 1, 10, 10, 10 /),'soll')
    137   type(ctrl_out),save :: o_soll0        = ctrl_out((/ 1, 5, 10, 10, 10 /),'soll0')
    138   type(ctrl_out),save :: o_radsol       = ctrl_out((/ 1, 1, 10, 10, 10 /),'radsol')
    139   type(ctrl_out),save :: o_SWupSFC      = ctrl_out((/ 1, 4, 10, 5, 10 /),'SWupSFC')
    140   type(ctrl_out),save :: o_SWupSFCclr   = ctrl_out((/ 1, 4, 10, 10, 10 /),'SWupSFCclr')
    141   type(ctrl_out),save :: o_SWdnSFC      = ctrl_out((/ 1, 1, 10, 5, 10 /),'SWdnSFC')
    142   type(ctrl_out),save :: o_SWdnSFCclr   = ctrl_out((/ 1, 4, 10, 5, 10 /),'SWdnSFCclr')
    143   type(ctrl_out),save :: o_LWupSFC      = ctrl_out((/ 1, 4, 10, 10, 10 /),'LWupSFC')
    144   type(ctrl_out),save :: o_LWupSFCclr   = ctrl_out((/ 1, 4, 10, 5, 10 /),'LWupSFCclr')
    145   type(ctrl_out),save :: o_LWdnSFC      = ctrl_out((/ 1, 4, 10, 5, 10 /),'LWdnSFC')
    146   type(ctrl_out),save :: o_LWdnSFCclr   = ctrl_out((/ 1, 4, 10, 5, 10 /),'LWdnSFCclr')
    147   type(ctrl_out),save :: o_bils         = ctrl_out((/ 1, 2, 10, 5, 10 /),'bils')
    148   type(ctrl_out),save :: o_sens         = ctrl_out((/ 1, 1, 10, 5, 10 /),'sens')
    149   type(ctrl_out),save :: o_fder         = ctrl_out((/ 1, 2, 10, 10, 10 /),'fder')
    150   type(ctrl_out),save :: o_ffonte       = ctrl_out((/ 1, 10, 10, 10, 10 /),'ffonte')
    151   type(ctrl_out),save :: o_fqcalving    = ctrl_out((/ 1, 10, 10, 10, 10 /),'fqcalving')
    152   type(ctrl_out),save :: o_fqfonte      = ctrl_out((/ 1, 10, 10, 10, 10 /),'fqfonte')
    153 
    154   type(ctrl_out),save :: o_taux         = ctrl_out((/ 1, 10, 10, 10, 10 /),'taux')
    155   type(ctrl_out),save :: o_tauy         = ctrl_out((/ 1, 10, 10, 10, 10 /),'tauy')
    156   type(ctrl_out),save,dimension(4) :: o_taux_srf     = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_ter'), &
    157                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_lic'), &
    158                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_oce'), &
    159                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'taux_sic') /)
    160 
    161   type(ctrl_out),save,dimension(4) :: o_tauy_srf     = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_ter'), &
    162                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_lic'), &
    163                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_oce'), &
    164                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'tauy_sic') /)
    165 
    166 
    167   type(ctrl_out),save,dimension(4) :: o_pourc_srf    = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_ter'), &
    168                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_lic'), &
    169                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_oce'), &
    170                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'pourc_sic') /)     
    171 
    172   type(ctrl_out),save,dimension(4) :: o_fract_srf    = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_ter'), &
    173                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_lic'), &
    174                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_oce'), &
    175                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'fract_sic') /)
    176 
    177   type(ctrl_out),save,dimension(4) :: o_tsol_srf     = (/ ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_ter'), &
    178                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_lic'), &
    179                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_oce'), &
    180                                                  ctrl_out((/ 1, 4, 10, 10, 10 /),'tsol_sic') /)
    181 
    182   type(ctrl_out),save,dimension(4) :: o_sens_srf     = (/ ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_ter'), &
    183                                                  ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_lic'), &
    184                                                  ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_oce'), &
    185                                                  ctrl_out((/ 1, 4, 10, 1, 10 /),'sens_sic') /)
    186 
    187   type(ctrl_out),save,dimension(4) :: o_lat_srf      = (/ ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_ter'), &
    188                                                  ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_lic'), &
    189                                                  ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_oce'), &
    190                                                  ctrl_out((/ 1, 4, 10, 1, 10 /),'lat_sic') /)
    191 
    192   type(ctrl_out),save,dimension(4) :: o_flw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_ter'), &
    193                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_lic'), &
    194                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_oce'), &
    195                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'flw_sic') /)
     127!  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOA')
     128!  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOAclr')
     129!  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOA')
     130!  type(ctrl_out),save :: o_LWdnTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOAclr')
     131
     132  type(ctrl_out),save :: o_LWup200      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'LWup200')
     133  type(ctrl_out),save :: o_LWup200clr   = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'LWup200clr')
     134  type(ctrl_out),save :: o_LWdn200      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'LWdn200')
     135  type(ctrl_out),save :: o_LWdn200clr   = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'LWdn200clr')
     136  type(ctrl_out),save :: o_sols         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'sols')
     137  type(ctrl_out),save :: o_sols0        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'sols0')
     138  type(ctrl_out),save :: o_soll         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'soll')
     139  type(ctrl_out),save :: o_soll0        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'soll0')
     140  type(ctrl_out),save :: o_radsol       = ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'radsol')
     141  type(ctrl_out),save :: o_SWupSFC      = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'SWupSFC')
     142  type(ctrl_out),save :: o_SWupSFCclr   = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'SWupSFCclr')
     143  type(ctrl_out),save :: o_SWdnSFC      = ctrl_out((/ 1, 1, 10, 10, 5, 10 /),'SWdnSFC')
     144  type(ctrl_out),save :: o_SWdnSFCclr   = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'SWdnSFCclr')
     145  type(ctrl_out),save :: o_LWupSFC      = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'LWupSFC')
     146  type(ctrl_out),save :: o_LWupSFCclr   = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'LWupSFCclr')
     147  type(ctrl_out),save :: o_LWdnSFC      = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'LWdnSFC')
     148  type(ctrl_out),save :: o_LWdnSFCclr   = ctrl_out((/ 1, 4, 10, 10, 5, 10 /),'LWdnSFCclr')
     149  type(ctrl_out),save :: o_bils         = ctrl_out((/ 1, 2, 10, 5, 10, 10 /),'bils')
     150  type(ctrl_out),save :: o_sens         = ctrl_out((/ 1, 1, 10, 10, 5, 10 /),'sens')
     151  type(ctrl_out),save :: o_fder         = ctrl_out((/ 1, 2, 10, 10, 10, 10 /),'fder')
     152  type(ctrl_out),save :: o_ffonte       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'ffonte')
     153  type(ctrl_out),save :: o_fqcalving    = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fqcalving')
     154  type(ctrl_out),save :: o_fqfonte      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fqfonte')
     155
     156  type(ctrl_out),save :: o_taux         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'taux')
     157  type(ctrl_out),save :: o_tauy         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'tauy')
     158  type(ctrl_out),save,dimension(4) :: o_taux_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_ter'), &
     159                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_lic'), &
     160                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_oce'), &
     161                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_sic') /)
     162
     163  type(ctrl_out),save,dimension(4) :: o_tauy_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_ter'), &
     164                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_lic'), &
     165                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_oce'), &
     166                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_sic') /)
     167
     168
     169  type(ctrl_out),save,dimension(4) :: o_pourc_srf    = (/ ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_ter'), &
     170                                                 ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_lic'), &
     171                                                 ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_oce'), &
     172                                                 ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_sic') /)     
     173
     174  type(ctrl_out),save,dimension(4) :: o_fract_srf    = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_ter'), &
     175                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_lic'), &
     176                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_oce'), &
     177                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_sic') /)
     178
     179  type(ctrl_out),save,dimension(4) :: o_tsol_srf     = (/ ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_ter'), &
     180                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_lic'), &
     181                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_oce'), &
     182                                                 ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_sic') /)
     183
     184  type(ctrl_out),save,dimension(4) :: o_sens_srf     = (/ ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_ter'), &
     185                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_lic'), &
     186                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_oce'), &
     187                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_sic') /)
     188
     189  type(ctrl_out),save,dimension(4) :: o_lat_srf      = (/ ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_ter'), &
     190                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_lic'), &
     191                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_oce'), &
     192                                                 ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_sic') /)
     193
     194  type(ctrl_out),save,dimension(4) :: o_flw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_ter'), &
     195                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_lic'), &
     196                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_oce'), &
     197                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_sic') /)
    196198                                                 
    197   type(ctrl_out),save,dimension(4) :: o_fsw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_ter'), &
    198                                                   ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_lic'), &
    199                                                   ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_oce'), &
    200                                                   ctrl_out((/ 1, 10, 10, 10, 10 /),'fsw_sic') /)
    201 
    202   type(ctrl_out),save,dimension(4) :: o_wbils_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_ter'), &
    203                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_lic'), &
    204                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_oce'), &
    205                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'wbils_sic') /)
    206 
    207   type(ctrl_out),save,dimension(4) :: o_wbilo_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_ter'), &
    208                                                      ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_lic'), &
    209                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_oce'), &
    210                                                  ctrl_out((/ 1, 10, 10, 10, 10 /),'wbilo_sic') /)
    211 
    212 
    213   type(ctrl_out),save :: o_cdrm         = ctrl_out((/ 1, 10, 10, 10, 10 /),'cdrm')
    214   type(ctrl_out),save :: o_cdrh         = ctrl_out((/ 1, 10, 10, 1, 10 /),'cdrh')
    215   type(ctrl_out),save :: o_cldl         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldl')
    216   type(ctrl_out),save :: o_cldm         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldm')
    217   type(ctrl_out),save :: o_cldh         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldh')
    218   type(ctrl_out),save :: o_cldt         = ctrl_out((/ 1, 1, 2, 5, 10 /),'cldt')
    219   type(ctrl_out),save :: o_cldq         = ctrl_out((/ 1, 1, 10, 10, 10 /),'cldq')
    220   type(ctrl_out),save :: o_lwp          = ctrl_out((/ 1, 5, 10, 10, 10 /),'lwp')
    221   type(ctrl_out),save :: o_iwp          = ctrl_out((/ 1, 5, 10, 10, 10 /),'iwp')
    222   type(ctrl_out),save :: o_ue           = ctrl_out((/ 1, 10, 10, 10, 10 /),'ue')
    223   type(ctrl_out),save :: o_ve           = ctrl_out((/ 1, 10, 10, 10, 10 /),'ve')
    224   type(ctrl_out),save :: o_uq           = ctrl_out((/ 1, 10, 10, 10, 10 /),'uq')
    225   type(ctrl_out),save :: o_vq           = ctrl_out((/ 1, 10, 10, 10, 10 /),'vq')
     199  type(ctrl_out),save,dimension(4) :: o_fsw_srf      = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_ter'), &
     200                                                  ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_lic'), &
     201                                                  ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_oce'), &
     202                                                  ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_sic') /)
     203
     204  type(ctrl_out),save,dimension(4) :: o_wbils_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_ter'), &
     205                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_lic'), &
     206                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_oce'), &
     207                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_sic') /)
     208
     209  type(ctrl_out),save,dimension(4) :: o_wbilo_srf    = (/ ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_ter'), &
     210                                                     ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_lic'), &
     211                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_oce'), &
     212                                                 ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_sic') /)
     213
     214
     215  type(ctrl_out),save :: o_cdrm         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'cdrm')
     216  type(ctrl_out),save :: o_cdrh         = ctrl_out((/ 1, 10, 10, 7, 10, 10 /),'cdrh')
     217  type(ctrl_out),save :: o_cldl         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'cldl')
     218  type(ctrl_out),save :: o_cldm         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'cldm')
     219  type(ctrl_out),save :: o_cldh         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'cldh')
     220  type(ctrl_out),save :: o_cldt         = ctrl_out((/ 1, 1, 2, 10, 5, 10 /),'cldt')
     221  type(ctrl_out),save :: o_cldq         = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'cldq')
     222  type(ctrl_out),save :: o_lwp          = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'lwp')
     223  type(ctrl_out),save :: o_iwp          = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'iwp')
     224  type(ctrl_out),save :: o_ue           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'ue')
     225  type(ctrl_out),save :: o_ve           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'ve')
     226  type(ctrl_out),save :: o_uq           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'uq')
     227  type(ctrl_out),save :: o_vq           = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'vq')
    226228 
    227   type(ctrl_out),save :: o_cape         = ctrl_out((/ 1, 10, 10, 10, 10 /),'cape')
    228   type(ctrl_out),save :: o_pbase        = ctrl_out((/ 1, 5, 10, 10, 10 /),'pbase')
    229   type(ctrl_out),save :: o_ptop         = ctrl_out((/ 1, 5, 10, 10, 10 /),'ptop')
    230   type(ctrl_out),save :: o_fbase        = ctrl_out((/ 1, 10, 10, 10, 10 /),'fbase')
    231   type(ctrl_out),save :: o_plcl        = ctrl_out((/ 1, 10, 10, 10, 10 /),'plcl')
    232   type(ctrl_out),save :: o_plfc        = ctrl_out((/ 1, 10, 10, 10, 10 /),'plfc')
    233   type(ctrl_out),save :: o_wbeff        = ctrl_out((/ 1, 10, 10, 10, 10 /),'wbeff')
    234   type(ctrl_out),save :: o_prw          = ctrl_out((/ 1, 1, 10, 10, 10 /),'prw')
    235 
    236   type(ctrl_out),save :: o_s_pblh       = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_pblh')
    237   type(ctrl_out),save :: o_s_pblt       = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_pblt')
    238   type(ctrl_out),save :: o_s_lcl        = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_lcl')
    239   type(ctrl_out),save :: o_s_capCL      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_capCL')
    240   type(ctrl_out),save :: o_s_oliqCL     = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_oliqCL')
    241   type(ctrl_out),save :: o_s_cteiCL     = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_cteiCL')
    242   type(ctrl_out),save :: o_s_therm      = ctrl_out((/ 1, 10, 10, 10, 1 /),'s_therm')
    243   type(ctrl_out),save :: o_s_trmb1      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_trmb1')
    244   type(ctrl_out),save :: o_s_trmb2      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_trmb2')
    245   type(ctrl_out),save :: o_s_trmb3      = ctrl_out((/ 1, 10, 10, 10, 10 /),'s_trmb3')
    246 
    247   type(ctrl_out),save :: o_slab_bils    = ctrl_out((/ 1, 1, 10, 10, 10 /),'slab_bils_oce')
    248 
    249   type(ctrl_out),save :: o_ale_bl       = ctrl_out((/ 1, 1, 1, 10, 10 /),'ale_bl')
    250   type(ctrl_out),save :: o_alp_bl       = ctrl_out((/ 1, 1, 1, 10, 10 /),'alp_bl')
    251   type(ctrl_out),save :: o_ale_wk       = ctrl_out((/ 1, 1, 1, 10, 10 /),'ale_wk')
    252   type(ctrl_out),save :: o_alp_wk       = ctrl_out((/ 1, 1, 1, 10, 10 /),'alp_wk')
    253 
    254   type(ctrl_out),save :: o_ale          = ctrl_out((/ 1, 1, 1, 10, 10 /),'ale')
    255   type(ctrl_out),save :: o_alp          = ctrl_out((/ 1, 1, 1, 10, 10 /),'alp')
    256   type(ctrl_out),save :: o_cin          = ctrl_out((/ 1, 1, 1, 10, 10 /),'cin')
    257   type(ctrl_out),save :: o_wape         = ctrl_out((/ 1, 1, 1, 10, 10 /),'wape')
     229  type(ctrl_out),save :: o_cape         = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'cape')
     230  type(ctrl_out),save :: o_pbase        = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'pbase')
     231  type(ctrl_out),save :: o_ptop         = ctrl_out((/ 1, 5, 10, 10, 10, 10 /),'ptop')
     232  type(ctrl_out),save :: o_fbase        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fbase')
     233  type(ctrl_out),save :: o_plcl        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'plcl')
     234  type(ctrl_out),save :: o_plfc        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'plfc')
     235  type(ctrl_out),save :: o_wbeff        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbeff')
     236  type(ctrl_out),save :: o_prw          = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'prw')
     237
     238  type(ctrl_out),save :: o_s_pblh       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_pblh')
     239  type(ctrl_out),save :: o_s_pblt       = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_pblt')
     240  type(ctrl_out),save :: o_s_lcl        = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_lcl')
     241  type(ctrl_out),save :: o_s_therm      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_therm')
     242!IM : Les champs suivants (s_capCL, s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
     243! type(ctrl_out),save :: o_s_capCL      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_capCL')
     244! type(ctrl_out),save :: o_s_oliqCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_oliqCL')
     245! type(ctrl_out),save :: o_s_cteiCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_cteiCL')
     246! type(ctrl_out),save :: o_s_trmb1      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb1')
     247! type(ctrl_out),save :: o_s_trmb2      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb2')
     248! type(ctrl_out),save :: o_s_trmb3      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb3')
     249
     250  type(ctrl_out),save :: o_slab_bils    = ctrl_out((/ 1, 1, 10, 10, 10, 10 /),'slab_bils_oce')
     251
     252  type(ctrl_out),save :: o_ale_bl       = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'ale_bl')
     253  type(ctrl_out),save :: o_alp_bl       = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'alp_bl')
     254  type(ctrl_out),save :: o_ale_wk       = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'ale_wk')
     255  type(ctrl_out),save :: o_alp_wk       = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'alp_wk')
     256
     257  type(ctrl_out),save :: o_ale          = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'ale')
     258  type(ctrl_out),save :: o_alp          = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'alp')
     259  type(ctrl_out),save :: o_cin          = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'cin')
     260  type(ctrl_out),save :: o_wape         = ctrl_out((/ 1, 1, 1, 10, 10, 10 /),'wape')
    258261
    259262
    260263! Champs interpolles sur des niveaux de pression ??? a faire correctement
    261264                                             
    262   type(ctrl_out),save,dimension(6) :: o_uSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'u850'), &
    263                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'u700'), &
    264                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'u500'), &
    265                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'u200'), &
    266                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'u50'), &
    267                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'u10') /)
     265  type(ctrl_out),save,dimension(7) :: o_uSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u850'), &
     266                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u700'), &
     267                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u500'), &
     268                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u200'), &
     269                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u100'), &
     270                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u50'), &
     271                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u10') /)
    268272                                                     
    269273
    270   type(ctrl_out),save,dimension(6) :: o_vSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'v850'), &
    271                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'v700'), &
    272                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'v500'), &
    273                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'v200'), &
    274                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'v50'), &
    275                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'v10') /)
    276 
    277   type(ctrl_out),save,dimension(6) :: o_wSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'w850'), &
    278                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'w700'), &
    279                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'w500'), &
    280                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'w200'), &
    281                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'w50'), &
    282                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'w10') /)
    283 
    284   type(ctrl_out),save,dimension(6) :: o_tSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'t850'), &
    285                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'t700'), &
    286                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'t500'), &
    287                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'t200'), &
    288                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'t50'), &
    289                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'t10') /)
    290 
    291   type(ctrl_out),save,dimension(6) :: o_qSTDlevs     = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'q850'), &
    292                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'q700'), &
    293                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'q500'), &
    294                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'q200'), &
    295                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'q50'), &
    296                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'q10') /)
    297 
    298   type(ctrl_out),save,dimension(6) :: o_zSTDlevs   = (/ ctrl_out((/ 1, 1, 3, 10, 10 /),'z850'), &
    299                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'z700'), &
    300                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'z500'), &
    301                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'z200'), &
    302                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'z50'), &
    303                                                      ctrl_out((/ 1, 1, 3, 10, 10 /),'z10') /)
    304 
    305 
    306   type(ctrl_out),save :: o_t_oce_sic    = ctrl_out((/ 1, 10, 10, 10, 10 /),'t_oce_sic')
    307 
    308   type(ctrl_out),save :: o_weakinv      = ctrl_out((/ 10, 1, 10, 10, 10 /),'weakinv')
    309   type(ctrl_out),save :: o_dthmin       = ctrl_out((/ 10, 1, 10, 10, 10 /),'dthmin')
    310   type(ctrl_out),save,dimension(4) :: o_u10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_ter'), &
    311                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_lic'), &
    312                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_oce'), &
    313                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'u10_sic') /)
    314 
    315   type(ctrl_out),save,dimension(4) :: o_v10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_ter'), &
    316                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_lic'), &
    317                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_oce'), &
    318                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'v10_sic') /)
    319 
    320   type(ctrl_out),save :: o_cldtau       = ctrl_out((/ 10, 5, 10, 10, 10 /),'cldtau')                     
    321   type(ctrl_out),save :: o_cldemi       = ctrl_out((/ 10, 5, 10, 10, 10 /),'cldemi')
    322   type(ctrl_out),save :: o_rh2m         = ctrl_out((/ 5, 5, 10, 10, 10 /),'rh2m')
    323   type(ctrl_out),save :: o_rh2m_min     = ctrl_out((/ 10, 5, 10, 10, 10 /),'rh2m_min')
    324   type(ctrl_out),save :: o_rh2m_max     = ctrl_out((/ 10, 5, 10, 10, 10 /),'rh2m_max')
    325   type(ctrl_out),save :: o_qsat2m       = ctrl_out((/ 10, 5, 10, 10, 10 /),'qsat2m')
    326   type(ctrl_out),save :: o_tpot         = ctrl_out((/ 10, 5, 10, 10, 10 /),'tpot')
    327   type(ctrl_out),save :: o_tpote        = ctrl_out((/ 10, 5, 10, 10, 10 /),'tpote')
    328   type(ctrl_out),save :: o_tke          = ctrl_out((/ 4, 10, 10, 10, 10 /),'tke ')
    329   type(ctrl_out),save :: o_tke_max      = ctrl_out((/ 4, 10, 10, 10, 10 /),'tke_max')
    330 
    331   type(ctrl_out),save,dimension(4) :: o_tke_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_ter'), &
    332                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_lic'), &
    333                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_oce'), &
    334                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_sic') /)
    335 
    336   type(ctrl_out),save,dimension(4) :: o_tke_max_srf  = (/ ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_ter'), &
    337                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_lic'), &
    338                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_oce'), &
    339                                                      ctrl_out((/ 10, 4, 10, 10, 10 /),'tke_max_sic') /)
    340 
    341   type(ctrl_out),save :: o_kz           = ctrl_out((/ 4, 10, 10, 10, 10 /),'kz')
    342   type(ctrl_out),save :: o_kz_max       = ctrl_out((/ 4, 10, 10, 10, 10 /),'kz_max')
    343   type(ctrl_out),save :: o_SWnetOR      = ctrl_out((/ 10, 10, 2, 10, 10 /),'SWnetOR')
    344   type(ctrl_out),save :: o_SWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10 /),'SWdownOR')
    345   type(ctrl_out),save :: o_LWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10 /),'LWdownOR')
    346 
    347   type(ctrl_out),save :: o_snowl        = ctrl_out((/ 10, 1, 10, 10, 10 /),'snowl')
    348   type(ctrl_out),save :: o_cape_max     = ctrl_out((/ 10, 1, 10, 10, 10 /),'cape_max')
    349   type(ctrl_out),save :: o_solldown     = ctrl_out((/ 10, 1, 10, 10, 10 /),'solldown')
    350 
    351   type(ctrl_out),save :: o_dtsvdfo      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdfo')
    352   type(ctrl_out),save :: o_dtsvdft      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdft')
    353   type(ctrl_out),save :: o_dtsvdfg      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdfg')
    354   type(ctrl_out),save :: o_dtsvdfi      = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtsvdfi')
    355   type(ctrl_out),save :: o_rugs         = ctrl_out((/ 10, 10, 10, 10, 10 /),'rugs')
    356 
    357   type(ctrl_out),save :: o_topswad      = ctrl_out((/ 2, 10, 10, 10, 10 /),'topswad')
    358   type(ctrl_out),save :: o_topswai      = ctrl_out((/ 2, 10, 10, 10, 10 /),'topswai')
    359   type(ctrl_out),save :: o_solswad      = ctrl_out((/ 2, 10, 10, 10, 10 /),'solswad')
    360   type(ctrl_out),save :: o_solswai      = ctrl_out((/ 2, 10, 10, 10, 10 /),'solswai')
    361 
    362   type(ctrl_out),save,dimension(10) :: o_tausumaero  = (/ ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_ASBCM'), &
    363                                                      ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_ASPOMM'), &
    364                                                      ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_ASSO4M'), &
    365                                                      ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_CSSO4M'), &
    366                                                      ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_SSSSM'), &
    367                                                      ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_ASSSM'), &
    368                                                      ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_CSSSM'), &
    369                                                      ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_CIDUSTM'), &
    370                                                      ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_AIBCM'), &
    371                                                      ctrl_out((/ 4, 4, 10, 10, 10 /),'OD550_AIPOMM') /)
    372 
    373   type(ctrl_out),save :: o_od550aer         = ctrl_out((/ 4, 4, 10, 10, 10 /),'od550aer')
    374   type(ctrl_out),save :: o_od865aer         = ctrl_out((/ 4, 4, 10, 10, 10 /),'od865aer')
    375   type(ctrl_out),save :: o_absvisaer        = ctrl_out((/ 4, 4, 10, 10, 10 /),'absvisaer')
    376   type(ctrl_out),save :: o_od550lt1aer      = ctrl_out((/ 4, 4, 10, 10, 10 /),'od550lt1aer')
    377 
    378   type(ctrl_out),save :: o_sconcso4         = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcso4')
    379   type(ctrl_out),save :: o_sconcoa          = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcoa')
    380   type(ctrl_out),save :: o_sconcbc          = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcbc')
    381   type(ctrl_out),save :: o_sconcss          = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcss')
    382   type(ctrl_out),save :: o_sconcdust        = ctrl_out((/ 4, 4, 10, 10, 10 /),'sconcdust')
    383   type(ctrl_out),save :: o_concso4          = ctrl_out((/ 4, 4, 10, 10, 10 /),'concso4')
    384   type(ctrl_out),save :: o_concoa           = ctrl_out((/ 4, 4, 10, 10, 10 /),'concoa')
    385   type(ctrl_out),save :: o_concbc           = ctrl_out((/ 4, 4, 10, 10, 10 /),'concbc')
    386   type(ctrl_out),save :: o_concss           = ctrl_out((/ 4, 4, 10, 10, 10 /),'concss')
    387   type(ctrl_out),save :: o_concdust         = ctrl_out((/ 4, 4, 10, 10, 10 /),'concdust')
    388   type(ctrl_out),save :: o_loadso4          = ctrl_out((/ 4, 4, 10, 10, 10 /),'loadso4')
    389   type(ctrl_out),save :: o_loadoa           = ctrl_out((/ 4, 4, 10, 10, 10 /),'loadoa')
    390   type(ctrl_out),save :: o_loadbc           = ctrl_out((/ 4, 4, 10, 10, 10 /),'loadbc')
    391   type(ctrl_out),save :: o_loadss           = ctrl_out((/ 4, 4, 10, 10, 10 /),'loadss')
    392   type(ctrl_out),save :: o_loaddust         = ctrl_out((/ 4, 4, 10, 10, 10 /),'loaddust')
    393 
    394 
    395   type(ctrl_out),save :: o_swtoaas_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoaas_nat')
    396   type(ctrl_out),save :: o_swsrfas_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfas_nat')
    397   type(ctrl_out),save :: o_swtoacs_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacs_nat')
    398   type(ctrl_out),save :: o_swsrfcs_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcs_nat')
    399 
    400   type(ctrl_out),save :: o_swtoaas_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoaas_ant')
    401   type(ctrl_out),save :: o_swsrfas_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfas_ant')
    402   type(ctrl_out),save :: o_swtoacs_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacs_ant')
    403   type(ctrl_out),save :: o_swsrfcs_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcs_ant')
    404   type(ctrl_out),save :: o_swtoacf_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacf_nat')
    405   type(ctrl_out),save :: o_swsrfcf_nat      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcf_nat')
    406   type(ctrl_out),save :: o_swtoacf_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacf_ant')
    407   type(ctrl_out),save :: o_swsrfcf_ant      = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcf_ant')
    408   type(ctrl_out),save :: o_swtoacf_zero     = ctrl_out((/ 4, 4, 10, 10, 10 /),'swtoacf_zero')
    409   type(ctrl_out),save :: o_swsrfcf_zero     = ctrl_out((/ 4, 4, 10, 10, 10 /),'swsrfcf_zero')
    410 
    411   type(ctrl_out),save :: o_cldncl          = ctrl_out((/ 4, 4, 10, 10, 10 /),'cldncl')
    412   type(ctrl_out),save :: o_reffclwtop      = ctrl_out((/ 4, 4, 10, 10, 10 /),'reffclwtop')
    413   type(ctrl_out),save :: o_cldnvi          = ctrl_out((/ 4, 4, 10, 10, 10 /),'cldnvi')
    414   type(ctrl_out),save :: o_lcc             = ctrl_out((/ 4, 4, 10, 10, 10 /),'lcc')
     274  type(ctrl_out),save,dimension(7) :: o_vSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v850'), &
     275                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v700'), &
     276                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v500'), &
     277                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v200'), &
     278                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v100'), &
     279                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v50'), &
     280                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v10') /)
     281
     282  type(ctrl_out),save,dimension(7) :: o_wSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w850'), &
     283                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w700'), &
     284                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w500'), &
     285                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w200'), &
     286                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w100'), &
     287                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w50'), &
     288                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w10') /)
     289
     290  type(ctrl_out),save,dimension(7) :: o_tSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t850'), &
     291                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t700'), &
     292                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t500'), &
     293                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t200'), &
     294                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t100'), &
     295                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t50'), &
     296                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t10') /)
     297
     298  type(ctrl_out),save,dimension(7) :: o_qSTDlevs     = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q850'), &
     299                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q700'), &
     300                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q500'), &
     301                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q200'), &
     302                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q100'), &
     303                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q50'), &
     304                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q10') /)
     305
     306  type(ctrl_out),save,dimension(7) :: o_zSTDlevs   = (/ ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z850'), &
     307                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z700'), &
     308                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z500'), &
     309                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z200'), &
     310                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z100'), &
     311                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z50'), &
     312                                                     ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z10') /)
     313
     314
     315  type(ctrl_out),save :: o_t_oce_sic    = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'t_oce_sic')
     316
     317  type(ctrl_out),save :: o_weakinv      = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'weakinv')
     318  type(ctrl_out),save :: o_dthmin       = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'dthmin')
     319  type(ctrl_out),save,dimension(4) :: o_u10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_ter'), &
     320                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_lic'), &
     321                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_oce'), &
     322                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_sic') /)
     323
     324  type(ctrl_out),save,dimension(4) :: o_v10_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_ter'), &
     325                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_lic'), &
     326                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_oce'), &
     327                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_sic') /)
     328
     329  type(ctrl_out),save :: o_cldtau       = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'cldtau')                     
     330  type(ctrl_out),save :: o_cldemi       = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'cldemi')
     331  type(ctrl_out),save :: o_rh2m         = ctrl_out((/ 5, 5, 10, 10, 10, 10 /),'rh2m')
     332  type(ctrl_out),save :: o_rh2m_min     = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'rh2m_min')
     333  type(ctrl_out),save :: o_rh2m_max     = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'rh2m_max')
     334  type(ctrl_out),save :: o_qsat2m       = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'qsat2m')
     335  type(ctrl_out),save :: o_tpot         = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'tpot')
     336  type(ctrl_out),save :: o_tpote        = ctrl_out((/ 10, 5, 10, 10, 10, 10 /),'tpote')
     337  type(ctrl_out),save :: o_tke          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tke ')
     338  type(ctrl_out),save :: o_tke_max      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tke_max')
     339
     340  type(ctrl_out),save,dimension(4) :: o_tke_srf      = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_ter'), &
     341                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_lic'), &
     342                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_oce'), &
     343                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_sic') /)
     344
     345  type(ctrl_out),save,dimension(4) :: o_tke_max_srf  = (/ ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_ter'), &
     346                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_lic'), &
     347                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_oce'), &
     348                                                     ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_sic') /)
     349
     350  type(ctrl_out),save :: o_kz           = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'kz')
     351  type(ctrl_out),save :: o_kz_max       = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'kz_max')
     352  type(ctrl_out),save :: o_SWnetOR      = ctrl_out((/ 10, 10, 2, 10, 10, 10 /),'SWnetOR')
     353  type(ctrl_out),save :: o_SWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10, 10 /),'SWdownOR')
     354  type(ctrl_out),save :: o_LWdownOR     = ctrl_out((/ 10, 10, 2, 10, 10, 10 /),'LWdownOR')
     355
     356  type(ctrl_out),save :: o_snowl        = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'snowl')
     357  type(ctrl_out),save :: o_cape_max     = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'cape_max')
     358  type(ctrl_out),save :: o_solldown     = ctrl_out((/ 10, 1, 10, 10, 10, 10 /),'solldown')
     359
     360  type(ctrl_out),save :: o_dtsvdfo      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtsvdfo')
     361  type(ctrl_out),save :: o_dtsvdft      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtsvdft')
     362  type(ctrl_out),save :: o_dtsvdfg      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtsvdfg')
     363  type(ctrl_out),save :: o_dtsvdfi      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtsvdfi')
     364  type(ctrl_out),save :: o_rugs         = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'rugs')
     365
     366  type(ctrl_out),save :: o_topswad      = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'topswad')
     367  type(ctrl_out),save :: o_topswai      = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'topswai')
     368  type(ctrl_out),save :: o_solswad      = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'solswad')
     369  type(ctrl_out),save :: o_solswai      = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'solswai')
     370
     371  type(ctrl_out),save,dimension(10) :: o_tausumaero  = (/ ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASBCM'), &
     372                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASPOMM'), &
     373                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSO4M'), &
     374                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSO4M'), &
     375                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_SSSSM'), &
     376                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSSM'), &
     377                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSSM'), &
     378                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CIDUSTM'), &
     379                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIBCM'), &
     380                                                     ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIPOMM') /)
     381
     382  type(ctrl_out),save :: o_od550aer     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'od550aer')
     383  type(ctrl_out),save :: o_od865aer     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'od865aer')
     384  type(ctrl_out),save :: o_absvisaer    = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'absvisaer')
     385  type(ctrl_out),save :: o_od550lt1aer  = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'od550lt1aer')
     386
     387  type(ctrl_out),save :: o_sconcso4     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcso4')
     388  type(ctrl_out),save :: o_sconcoa      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcoa')
     389  type(ctrl_out),save :: o_sconcbc      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcbc')
     390  type(ctrl_out),save :: o_sconcss      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcss')
     391  type(ctrl_out),save :: o_sconcdust    = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'sconcdust')
     392  type(ctrl_out),save :: o_concso4      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concso4')
     393  type(ctrl_out),save :: o_concoa       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concoa')
     394  type(ctrl_out),save :: o_concbc       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concbc')
     395  type(ctrl_out),save :: o_concss       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concss')
     396  type(ctrl_out),save :: o_concdust     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'concdust')
     397  type(ctrl_out),save :: o_loadso4      = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loadso4')
     398  type(ctrl_out),save :: o_loadoa       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loadoa')
     399  type(ctrl_out),save :: o_loadbc       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loadbc')
     400  type(ctrl_out),save :: o_loadss       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loadss')
     401  type(ctrl_out),save :: o_loaddust     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'loaddust')
     402
     403  type(ctrl_out),save :: o_swtoaas_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoaas_nat')
     404  type(ctrl_out),save :: o_swsrfas_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfas_nat')
     405  type(ctrl_out),save :: o_swtoacs_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacs_nat')
     406  type(ctrl_out),save :: o_swsrfcs_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcs_nat')
     407
     408  type(ctrl_out),save :: o_swtoaas_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoaas_ant')
     409  type(ctrl_out),save :: o_swsrfas_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfas_ant')
     410  type(ctrl_out),save :: o_swtoacs_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacs_ant')
     411  type(ctrl_out),save :: o_swsrfcs_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcs_ant')
     412
     413  type(ctrl_out),save :: o_swtoacf_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacf_nat')
     414  type(ctrl_out),save :: o_swsrfcf_nat  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcf_nat')
     415  type(ctrl_out),save :: o_swtoacf_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacf_ant')
     416  type(ctrl_out),save :: o_swsrfcf_ant  = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcf_ant')
     417  type(ctrl_out),save :: o_swtoacf_zero = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swtoacf_zero')
     418  type(ctrl_out),save :: o_swsrfcf_zero = ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'swsrfcf_zero')
     419
     420  type(ctrl_out),save :: o_cldncl       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'cldncl')
     421  type(ctrl_out),save :: o_reffclwtop   = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'reffclwtop')
     422  type(ctrl_out),save :: o_cldnvi       = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'cldnvi')
     423  type(ctrl_out),save :: o_lcc          = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'lcc')
    415424
    416425
    417426!!!!!!!!!!!!!!!!!!!!!! 3D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    418   type(ctrl_out),save :: o_ec550aer     = ctrl_out((/ 4,  4, 10, 10, 1 /),'ec550aer')
    419   type(ctrl_out),save :: o_lwcon        = ctrl_out((/ 2, 5, 10, 10, 1 /),'lwcon')
    420   type(ctrl_out),save :: o_iwcon        = ctrl_out((/ 2, 5, 10, 10, 10 /),'iwcon')
    421   type(ctrl_out),save :: o_temp         = ctrl_out((/ 2, 3, 4, 10, 1 /),'temp')
    422   type(ctrl_out),save :: o_theta        = ctrl_out((/ 2, 3, 4, 10, 1 /),'theta')
    423   type(ctrl_out),save :: o_ovap         = ctrl_out((/ 2, 3, 4, 10, 1 /),'ovap')
    424   type(ctrl_out),save :: o_ovapinit         = ctrl_out((/ 2, 3, 10, 10, 1 /),'ovapinit')
    425   type(ctrl_out),save :: o_wvapp        = ctrl_out((/ 2, 10, 10, 10, 10 /),'wvapp')
    426   type(ctrl_out),save :: o_geop         = ctrl_out((/ 2, 3, 10, 10, 1 /),'geop')
    427   type(ctrl_out),save :: o_vitu         = ctrl_out((/ 2, 3, 4, 5, 1 /),'vitu')
    428   type(ctrl_out),save :: o_vitv         = ctrl_out((/ 2, 3, 4, 5, 1 /),'vitv')
    429   type(ctrl_out),save :: o_vitw         = ctrl_out((/ 2, 3, 10, 5, 1 /),'vitw')
    430   type(ctrl_out),save :: o_pres         = ctrl_out((/ 2, 3, 10, 10, 1 /),'pres')
    431   type(ctrl_out),save :: o_paprs        = ctrl_out((/ 2, 3, 10, 10, 1 /),'paprs')
    432   type(ctrl_out),save :: o_mass        = ctrl_out((/ 2, 3, 10, 10, 1 /),'mass')
    433 
    434   type(ctrl_out),save :: o_rneb         = ctrl_out((/ 2, 5, 10, 10, 1 /),'rneb')
    435   type(ctrl_out),save :: o_rnebcon      = ctrl_out((/ 2, 5, 10, 10, 1 /),'rnebcon')
    436   type(ctrl_out),save :: o_rhum         = ctrl_out((/ 2, 5, 10, 10, 10 /),'rhum')
    437   type(ctrl_out),save :: o_ozone        = ctrl_out((/ 2, 10, 10, 10, 10 /),'ozone')
    438   type(ctrl_out),save :: o_ozone_light  = ctrl_out((/ 2, 10, 10, 10, 10 /),'ozone_daylight')
    439   type(ctrl_out),save :: o_upwd         = ctrl_out((/ 2, 10, 10, 10, 10 /),'upwd')
    440   type(ctrl_out),save :: o_dtphy        = ctrl_out((/ 2, 10, 10, 10, 10 /),'dtphy')
    441   type(ctrl_out),save :: o_dqphy        = ctrl_out((/ 2, 10, 10, 10, 10 /),'dqphy')
    442   type(ctrl_out),save :: o_pr_con_l     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_con_l')
    443   type(ctrl_out),save :: o_pr_con_i     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_con_i')
    444   type(ctrl_out),save :: o_pr_lsc_l     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_lsc_l')
    445   type(ctrl_out),save :: o_pr_lsc_i     = ctrl_out((/ 2, 10, 10, 10, 10 /),'pr_lsc_i')
    446   type(ctrl_out),save :: o_re           = ctrl_out((/ 5, 10, 10, 10, 10 /),'re')
    447   type(ctrl_out),save :: o_fl           = ctrl_out((/ 5, 10, 10, 10, 10 /),'fl')
    448   type(ctrl_out),save :: o_scdnc        =ctrl_out((/ 4,  4, 10, 10, 1 /),'scdnc')
    449   type(ctrl_out),save :: o_reffclws     =ctrl_out((/ 4,  4, 10, 10, 1 /),'reffclws')
    450   type(ctrl_out),save :: o_reffclwc     =ctrl_out((/ 4,  4, 10, 10, 1 /),'reffclwc')
    451   type(ctrl_out),save :: o_lcc3d        =ctrl_out((/ 4,  4, 10, 10, 1 /),'lcc3d')
    452   type(ctrl_out),save :: o_lcc3dcon     =ctrl_out((/ 4,  4, 10, 10, 1 /),'lcc3dcon')
    453   type(ctrl_out),save :: o_lcc3dstra    =ctrl_out((/ 4,  4, 10, 10, 1 /),'lcc3dstra')
     427  type(ctrl_out),save :: o_ec550aer     = ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'ec550aer')
     428  type(ctrl_out),save :: o_lwcon        = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'lwcon')
     429  type(ctrl_out),save :: o_iwcon        = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'iwcon')
     430  type(ctrl_out),save :: o_temp         = ctrl_out((/ 2, 3, 4, 10, 10, 10 /),'temp')
     431  type(ctrl_out),save :: o_theta        = ctrl_out((/ 2, 3, 4, 10, 10, 10 /),'theta')
     432  type(ctrl_out),save :: o_ovap         = ctrl_out((/ 2, 3, 4, 10, 10, 10 /),'ovap')
     433  type(ctrl_out),save :: o_ovapinit     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'ovapinit')
     434  type(ctrl_out),save :: o_wvapp        = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'wvapp')
     435  type(ctrl_out),save :: o_geop         = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'geop')
     436  type(ctrl_out),save :: o_vitu         = ctrl_out((/ 2, 3, 4, 6, 10, 10 /),'vitu')
     437  type(ctrl_out),save :: o_vitv         = ctrl_out((/ 2, 3, 4, 6, 10, 10 /),'vitv')
     438  type(ctrl_out),save :: o_vitw         = ctrl_out((/ 2, 3, 10, 6, 10, 10 /),'vitw')
     439  type(ctrl_out),save :: o_pres         = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'pres')
     440  type(ctrl_out),save :: o_paprs        = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'paprs')
     441  type(ctrl_out),save :: o_mass        = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'mass')
     442  type(ctrl_out),save :: o_zfull       = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'zfull')
     443  type(ctrl_out),save :: o_zhalf       = ctrl_out((/ 2, 3, 10, 10, 10, 10 /),'zhalf')
     444  type(ctrl_out),save :: o_rneb         = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'rneb')
     445  type(ctrl_out),save :: o_rnebcon      = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'rnebcon')
     446  type(ctrl_out),save :: o_rhum         = ctrl_out((/ 2, 5, 10, 10, 10, 10 /),'rhum')
     447  type(ctrl_out),save :: o_ozone        = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'ozone')
     448  type(ctrl_out),save :: o_ozone_light  = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'ozone_daylight')
     449  type(ctrl_out),save :: o_upwd         = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'upwd')
     450  type(ctrl_out),save :: o_dtphy        = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'dtphy')
     451  type(ctrl_out),save :: o_dqphy        = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'dqphy')
     452  type(ctrl_out),save :: o_pr_con_l     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'pr_con_l')
     453  type(ctrl_out),save :: o_pr_con_i     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'pr_con_i')
     454  type(ctrl_out),save :: o_pr_lsc_l     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'pr_lsc_l')
     455  type(ctrl_out),save :: o_pr_lsc_i     = ctrl_out((/ 2, 10, 10, 10, 10, 10 /),'pr_lsc_i')
     456  type(ctrl_out),save :: o_re           = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'re')
     457  type(ctrl_out),save :: o_fl           = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'fl')
     458  type(ctrl_out),save :: o_scdnc        = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'scdnc')
     459  type(ctrl_out),save :: o_reffclws     = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'reffclws')
     460  type(ctrl_out),save :: o_reffclwc     = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'reffclwc')
     461  type(ctrl_out),save :: o_lcc3d        = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'lcc3d')
     462  type(ctrl_out),save :: o_lcc3dcon     = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'lcc3dcon')
     463  type(ctrl_out),save :: o_lcc3dstra    = ctrl_out((/ 2,  6, 10, 10, 10, 10 /),'lcc3dstra')
    454464!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    455465
    456   type(ctrl_out),save,dimension(4) :: o_albe_srf     = (/ ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_ter'), &
    457                                                      ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_lic'), &
    458                                                      ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_oce'), &
    459                                                      ctrl_out((/ 3, 4, 10, 1, 10 /),'albe_sic') /)
    460 
    461   type(ctrl_out),save,dimension(4) :: o_ages_srf     = (/ ctrl_out((/ 10, 10, 10, 10, 10 /),'ages_ter'), &
    462                                                      ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_lic'), &
    463                                                      ctrl_out((/ 10, 10, 10, 10, 10 /),'ages_oce'), &
    464                                                      ctrl_out((/ 3, 10, 10, 10, 10 /),'ages_sic') /)
    465 
    466   type(ctrl_out),save,dimension(4) :: o_rugs_srf     = (/ ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_ter'), &
    467                                                      ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_lic'), &
    468                                                      ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_oce'), &
    469                                                      ctrl_out((/ 3, 4, 10, 10, 10 /),'rugs_sic') /)
    470 
    471   type(ctrl_out),save :: o_alb1         = ctrl_out((/ 3, 10, 10, 10, 10 /),'albs')
    472   type(ctrl_out),save :: o_alb2       = ctrl_out((/ 3, 10, 10, 10, 10 /),'albslw')
    473 
    474   type(ctrl_out),save :: o_clwcon       = ctrl_out((/ 4, 10, 10, 10, 10 /),'clwcon')
    475   type(ctrl_out),save :: o_Ma           = ctrl_out((/ 4, 10, 10, 10, 10 /),'Ma')
    476   type(ctrl_out),save :: o_dnwd         = ctrl_out((/ 4, 10, 10, 10, 10 /),'dnwd')
    477   type(ctrl_out),save :: o_dnwd0        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dnwd0')
    478   type(ctrl_out),save :: o_mc           = ctrl_out((/ 4, 10, 10, 10, 10 /),'mc')
    479   type(ctrl_out),save :: o_ftime_con    = ctrl_out((/ 4, 10, 10, 10, 10 /),'ftime_con')
    480   type(ctrl_out),save :: o_dtdyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dtdyn')
    481   type(ctrl_out),save :: o_dqdyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dqdyn')
    482   type(ctrl_out),save :: o_dudyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dudyn')  !AXC
    483   type(ctrl_out),save :: o_dvdyn        = ctrl_out((/ 4, 10, 10, 10, 1 /),'dvdyn')  !AXC
    484   type(ctrl_out),save :: o_dtcon        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dtcon')
    485   type(ctrl_out),save :: o_ducon        = ctrl_out((/ 4, 10, 10, 10, 10 /),'ducon')
    486   type(ctrl_out),save :: o_dqcon        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dqcon')
    487   type(ctrl_out),save :: o_dtwak        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dtwak')
    488   type(ctrl_out),save :: o_dqwak        = ctrl_out((/ 4, 5, 10, 10, 10 /),'dqwak')
    489   type(ctrl_out),save :: o_wake_h       = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_h')
    490   type(ctrl_out),save :: o_wake_s       = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_s')
    491   type(ctrl_out),save :: o_wake_deltat  = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_deltat')
    492   type(ctrl_out),save :: o_wake_deltaq  = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_deltaq')
    493   type(ctrl_out),save :: o_wake_omg     = ctrl_out((/ 4, 5, 10, 10, 10 /),'wake_omg')
    494   type(ctrl_out),save :: o_Vprecip      = ctrl_out((/ 10, 10, 10, 10, 10 /),'Vprecip')
    495   type(ctrl_out),save :: o_ftd          = ctrl_out((/ 4, 5, 10, 10, 10 /),'ftd')
    496   type(ctrl_out),save :: o_fqd          = ctrl_out((/ 4, 5, 10, 10, 10 /),'fqd')
    497   type(ctrl_out),save :: o_dtlsc        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlsc')
    498   type(ctrl_out),save :: o_dtlschr      = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlschr')
    499   type(ctrl_out),save :: o_dqlsc        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqlsc')
    500   type(ctrl_out),save :: o_dtvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtvdf')
    501   type(ctrl_out),save :: o_dqvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqvdf')
    502   type(ctrl_out),save :: o_dteva        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dteva')
    503   type(ctrl_out),save :: o_dqeva        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqeva')
     466  type(ctrl_out),save,dimension(4) :: o_albe_srf     = (/ ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_ter'), &
     467                                                     ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_lic'), &
     468                                                     ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_oce'), &
     469                                                     ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_sic') /)
     470
     471  type(ctrl_out),save,dimension(4) :: o_ages_srf     = (/ ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ages_ter'), &
     472                                                     ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_lic'), &
     473                                                     ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ages_oce'), &
     474                                                     ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_sic') /)
     475
     476  type(ctrl_out),save,dimension(4) :: o_rugs_srf     = (/ ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_ter'), &
     477                                                     ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_lic'), &
     478                                                     ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_oce'), &
     479                                                     ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_sic') /)
     480
     481  type(ctrl_out),save :: o_alb1         = ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'alb1')
     482  type(ctrl_out),save :: o_alb2       = ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'alb2')
     483
     484  type(ctrl_out),save :: o_clwcon       = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'clwcon')
     485  type(ctrl_out),save :: o_Ma           = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'Ma')
     486  type(ctrl_out),save :: o_dnwd         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dnwd')
     487  type(ctrl_out),save :: o_dnwd0        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dnwd0')
     488  type(ctrl_out),save :: o_mc           = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'mc')
     489  type(ctrl_out),save :: o_ftime_con    = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ftime_con')
     490  type(ctrl_out),save :: o_dtdyn        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtdyn')
     491  type(ctrl_out),save :: o_dqdyn        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqdyn')
     492  type(ctrl_out),save :: o_dudyn        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dudyn')  !AXC
     493  type(ctrl_out),save :: o_dvdyn        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvdyn')  !AXC
     494  type(ctrl_out),save :: o_dtcon        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtcon')
     495  type(ctrl_out),save :: o_ducon        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ducon')
     496  type(ctrl_out),save :: o_dqcon        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqcon')
     497  type(ctrl_out),save :: o_dtwak        = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'dtwak')
     498  type(ctrl_out),save :: o_dqwak        = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'dqwak')
     499  type(ctrl_out),save :: o_wake_h       = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_h')
     500  type(ctrl_out),save :: o_wake_s       = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_s')
     501  type(ctrl_out),save :: o_wake_deltat  = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_deltat')
     502  type(ctrl_out),save :: o_wake_deltaq  = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_deltaq')
     503  type(ctrl_out),save :: o_wake_omg     = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'wake_omg')
     504  type(ctrl_out),save :: o_Vprecip      = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'Vprecip')
     505  type(ctrl_out),save :: o_ftd          = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'ftd')
     506  type(ctrl_out),save :: o_fqd          = ctrl_out((/ 4, 5, 10, 10, 10, 10 /),'fqd')
     507  type(ctrl_out),save :: o_dtlsc        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlsc')
     508  type(ctrl_out),save :: o_dtlschr      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlschr')
     509  type(ctrl_out),save :: o_dqlsc        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqlsc')
     510  type(ctrl_out),save :: o_dtvdf        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtvdf')
     511  type(ctrl_out),save :: o_dqvdf        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqvdf')
     512  type(ctrl_out),save :: o_dteva        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dteva')
     513  type(ctrl_out),save :: o_dqeva        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqeva')
    504514
    505515!!!!!!!!!!!!!!!! Specifique thermiques
    506   type(ctrl_out),save :: o_dqlscth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'dqlscth')
    507   type(ctrl_out),save :: o_dqlscst        = ctrl_out((/ 10, 10, 10, 10, 10 /),'dqlscst')
    508   type(ctrl_out),save :: o_dtlscth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtlscth')
    509   type(ctrl_out),save :: o_dtlscst        = ctrl_out((/ 10, 10, 10, 10, 10 /),'dtlscst')
    510   type(ctrl_out),save :: o_plulth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'plulth')
    511   type(ctrl_out),save :: o_plulst        = ctrl_out((/ 10, 10, 10, 10, 10 /),'plulst')
    512   type(ctrl_out),save :: o_lmaxth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'lmaxth')
    513   type(ctrl_out),save :: o_ptconvth        = ctrl_out((/ 10, 10, 10, 10, 10 /),'ptconvth')
     516  type(ctrl_out),save :: o_dqlscth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dqlscth')
     517  type(ctrl_out),save :: o_dqlscst        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dqlscst')
     518  type(ctrl_out),save :: o_dtlscth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtlscth')
     519  type(ctrl_out),save :: o_dtlscst        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'dtlscst')
     520  type(ctrl_out),save :: o_plulth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'plulth')
     521  type(ctrl_out),save :: o_plulst        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'plulst')
     522  type(ctrl_out),save :: o_lmaxth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'lmaxth')
     523  type(ctrl_out),save :: o_ptconvth        = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ptconvth')
    514524!!!!!!!!!!!!!!!!!!!!!!!!
    515525
    516526
    517   type(ctrl_out),save :: o_ptconv       = ctrl_out((/ 4, 10, 10, 10, 10 /),'ptconv')
    518   type(ctrl_out),save :: o_ratqs        = ctrl_out((/ 4, 10, 10, 10, 10 /),'ratqs')
    519   type(ctrl_out),save :: o_dtthe        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtthe')
    520   type(ctrl_out),save :: o_f_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'f_th')
    521   type(ctrl_out),save :: o_e_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'e_th')
    522   type(ctrl_out),save :: o_w_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'w_th')
    523   type(ctrl_out),save :: o_lambda_th    = ctrl_out((/ 10, 10, 10, 10, 10 /),'lambda_th')
    524   type(ctrl_out),save :: o_ftime_th     = ctrl_out((/ 10, 10, 10, 10, 10 /),'ftime_th')
    525   type(ctrl_out),save :: o_q_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'q_th')
    526   type(ctrl_out),save :: o_a_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'a_th')
    527   type(ctrl_out),save :: o_d_th         = ctrl_out((/ 4, 10, 10, 10, 10 /),'d_th')
    528   type(ctrl_out),save :: o_f0_th        = ctrl_out((/ 4, 10, 10, 10, 10 /),'f0_th')
    529   type(ctrl_out),save :: o_zmax_th      = ctrl_out((/ 4, 10, 10, 10, 10 /),'zmax_th')
    530   type(ctrl_out),save :: o_dqthe        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqthe')
    531   type(ctrl_out),save :: o_dtajs        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtajs')
    532   type(ctrl_out),save :: o_dqajs        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dqajs')
    533   type(ctrl_out),save :: o_dtswr        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtswr')
    534   type(ctrl_out),save :: o_dtsw0        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtsw0')
    535   type(ctrl_out),save :: o_dtlwr        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlwr')
    536   type(ctrl_out),save :: o_dtlw0        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtlw0')
    537   type(ctrl_out),save :: o_dtec         = ctrl_out((/ 4, 10, 10, 10, 10 /),'dtec')
    538   type(ctrl_out),save :: o_duvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'duvdf')
    539   type(ctrl_out),save :: o_dvvdf        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvvdf')
    540   type(ctrl_out),save :: o_duoro        = ctrl_out((/ 4, 10, 10, 10, 10 /),'duoro')
    541   type(ctrl_out),save :: o_dvoro        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvoro')
    542   type(ctrl_out),save :: o_dulif        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dulif')
    543   type(ctrl_out),save :: o_dvlif        = ctrl_out((/ 4, 10, 10, 10, 10 /),'dvlif')
     527  type(ctrl_out),save :: o_ptconv       = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ptconv')
     528  type(ctrl_out),save :: o_ratqs        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ratqs')
     529  type(ctrl_out),save :: o_dtthe        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtthe')
     530  type(ctrl_out),save :: o_f_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'f_th')
     531  type(ctrl_out),save :: o_e_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'e_th')
     532  type(ctrl_out),save :: o_w_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'w_th')
     533  type(ctrl_out),save :: o_lambda_th    = ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'lambda_th')
     534  type(ctrl_out),save :: o_ftime_th     = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ftime_th')
     535  type(ctrl_out),save :: o_q_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'q_th')
     536  type(ctrl_out),save :: o_a_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'a_th')
     537  type(ctrl_out),save :: o_d_th         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'d_th')
     538  type(ctrl_out),save :: o_f0_th        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'f0_th')
     539  type(ctrl_out),save :: o_zmax_th      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'zmax_th')
     540  type(ctrl_out),save :: o_dqthe        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqthe')
     541  type(ctrl_out),save :: o_dtajs        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtajs')
     542  type(ctrl_out),save :: o_dqajs        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dqajs')
     543  type(ctrl_out),save :: o_dtswr        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtswr')
     544  type(ctrl_out),save :: o_dtsw0        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtsw0')
     545  type(ctrl_out),save :: o_dtlwr        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlwr')
     546  type(ctrl_out),save :: o_dtlw0        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlw0')
     547  type(ctrl_out),save :: o_dtec         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtec')
     548  type(ctrl_out),save :: o_duvdf        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'duvdf')
     549  type(ctrl_out),save :: o_dvvdf        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvvdf')
     550  type(ctrl_out),save :: o_duoro        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'duoro')
     551  type(ctrl_out),save :: o_dvoro        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvoro')
     552  type(ctrl_out),save :: o_dulif        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dulif')
     553  type(ctrl_out),save :: o_dvlif        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvlif')
     554  type(ctrl_out),save :: o_duhin        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'duhin')
     555  type(ctrl_out),save :: o_dvhin        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dvhin')
     556  type(ctrl_out),save :: o_dtoro        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtoro')
     557  type(ctrl_out),save :: o_dtlif        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dtlif')
     558  type(ctrl_out),save :: o_dthin        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dthin')
     559
    544560  type(ctrl_out),save,allocatable :: o_trac(:)
     561
     562  type(ctrl_out),save :: o_rsu        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rsu')
     563  type(ctrl_out),save :: o_rsd        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rsd')
     564  type(ctrl_out),save :: o_rlu        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rlu')
     565  type(ctrl_out),save :: o_rld        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rld')
     566  type(ctrl_out),save :: o_rsucs      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rsucs')
     567  type(ctrl_out),save :: o_rsdcs      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rsdcs')
     568  type(ctrl_out),save :: o_rlucs      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rlucs')
     569  type(ctrl_out),save :: o_rldcs      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'rldcs')
     570
     571  type(ctrl_out),save :: o_tnt          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tnt')
     572  type(ctrl_out),save :: o_tntc         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tntc')
     573  type(ctrl_out),save :: o_tntr        = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tntr')
     574  type(ctrl_out),save :: o_tntscpbl          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tntscpbl')
     575
     576  type(ctrl_out),save :: o_tnhus          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tnhus')
     577  type(ctrl_out),save :: o_tnhusc         = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tnhusc')
     578  type(ctrl_out),save :: o_tnhusscpbl     = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'tnhusscpbl')
     579
     580  type(ctrl_out),save :: o_evu          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'evu')
     581
     582  type(ctrl_out),save :: o_h2o          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'h2o')
     583
     584  type(ctrl_out),save :: o_mcd          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'mcd')
     585  type(ctrl_out),save :: o_dmc          = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'dmc')
     586  type(ctrl_out),save :: o_ref_liq      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ref_liq')
     587  type(ctrl_out),save :: o_ref_ice      = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),'ref_ice')
     588
     589  type(ctrl_out),save :: o_rsut4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsut4co2')
     590  type(ctrl_out),save :: o_rlut4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rlut4co2')
     591  type(ctrl_out),save :: o_rsutcs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsutcs4co2')
     592  type(ctrl_out),save :: o_rlutcs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rlutcs4co2')
     593
     594  type(ctrl_out),save :: o_rsu4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsu4co2')
     595  type(ctrl_out),save :: o_rlu4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rlu4co2')
     596  type(ctrl_out),save :: o_rsucs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsucs4co2')
     597  type(ctrl_out),save :: o_rlucs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rlucs4co2')
     598  type(ctrl_out),save :: o_rsd4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsd4co2')
     599  type(ctrl_out),save :: o_rld4co2     = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rld4co2')
     600  type(ctrl_out),save :: o_rsdcs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rsdcs4co2')
     601  type(ctrl_out),save :: o_rldcs4co2   = ctrl_out((/ 5, 10, 10, 10, 10, 10 /),'rldcs4co2')
     602
     603
    545604    CONTAINS
    546605
     
    550609!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    551610 
    552   SUBROUTINE phys_output_open(jjmp1,nlevSTD,clevSTD,nbteta, &
    553        ctetaSTD,dtime, ok_veget, &
     611  SUBROUTINE phys_output_open(rlon,rlat,pim,tabij,ipt,jpt,plon,plat, &
     612       jjmp1,nlevSTD,clevSTD,nbteta, &
     613       ctetaSTD, dtime, ok_veget, &
    554614       type_ocean, iflag_pbl,ok_mensuel,ok_journe, &
    555615       ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, read_climoz, &
     616       phys_out_filestations, &
    556617       new_aod, aerosol_couple)   
    557 
    558618
    559619  USE iophy
     
    571631  include "thermcell.h"
    572632  include "comvert.h"
     633
     634    real,dimension(klon),intent(in) :: rlon
     635    real,dimension(klon),intent(in) :: rlat
     636    integer, intent(in)             :: pim
     637    INTEGER, DIMENSION(pim)            :: tabij
     638    INTEGER,dimension(pim), intent(in) :: ipt, jpt
     639    REAL,dimension(pim), intent(in) :: plat, plon
     640    REAL,dimension(pim,2) :: plat_bounds, plon_bounds
    573641
    574642  integer                               :: jjmp1
     
    606674  integer, dimension(nfiles)            :: phys_out_filelevels
    607675  CHARACTER(len=20), dimension(nfiles)  :: type_ecri_files, phys_out_filetypes
    608   character(len=20), dimension(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq' /)
     676  character(len=20), dimension(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq', 'DefFreq' /)
    609677  logical, dimension(nfiles)            :: phys_out_filekeys
     678  logical, dimension(nfiles)            :: phys_out_filestations
    610679
    611680!!!!!!!!!! stockage dans une region limitee pour chaque fichier !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    612681!                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
    613682
    614   logical, dimension(nfiles), save  :: phys_out_regfkey       = (/ .false., .false., .false., .false., .false. /)
    615   real, dimension(nfiles), save     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180. /)
    616   real, dimension(nfiles), save     :: phys_out_lonmax        = (/ 180., 180., 180., 180., 180. /)
    617   real, dimension(nfiles), save     :: phys_out_latmin        = (/ -90., -90., -90., -90., -90. /)
    618   real, dimension(nfiles), save     :: phys_out_latmax        = (/ 90., 90., 90., 90., 90. /)
    619 
    620 !IM definition dynamique flag o_trac pour sortie traceurs
    621   INTEGER :: nq
    622   CHARACTER(len=8) :: solsym(nqtot)
     683  logical, dimension(nfiles), save  :: phys_out_regfkey       = (/ .false., .false., .false., .false., .false., .false. /)
     684  real, dimension(nfiles), save     :: phys_out_lonmin        = (/ -180., -180., -180., -180., -180., -180. /)
     685  real, dimension(nfiles), save     :: phys_out_lonmax        = (/ 180., 180., 180., 180., 180., 180. /)
     686  real, dimension(nfiles), save     :: phys_out_latmin        = (/ -90., -90., -90., -90., -90., -90. /)
     687  real, dimension(nfiles), save     :: phys_out_latmax        = (/ 90., 90., 90., 90., 90., 90. /)
    623688
    624689   print*,'Debut phys_output_mod.F90'
     
    627692   if (.not. allocated(o_trac)) ALLOCATE(o_trac(nqtot))
    628693
    629    levmax = (/ klev, klev, klev, klev, klev /)
     694   levmax = (/ klev, klev, klev, klev, klev, klev /)
    630695
    631696   phys_out_filenames(1) = 'histmth'
     
    634699   phys_out_filenames(4) = 'histins'
    635700   phys_out_filenames(5) = 'histLES'
     701   phys_out_filenames(6) = 'histstn'
    636702
    637703   type_ecri(1) = 'ave(X)'
     
    640706   type_ecri(4) = 'inst(X)'
    641707   type_ecri(5) = 'ave(X)'
     708   type_ecri(6) = 'inst(X)'
    642709
    643710   clef_files(1) = ok_mensuel
     
    646713   clef_files(4) = ok_instan
    647714   clef_files(5) = ok_LES
     715   clef_files(6) = ok_instan
     716
     717!sortir des fichiers "stations" si clef_stations(:)=.TRUE.
     718   clef_stations(1) = .FALSE.
     719   clef_stations(2) = .FALSE.
     720   clef_stations(3) = .FALSE.
     721   clef_stations(4) = .FALSE.
     722   clef_stations(5) = .FALSE.
     723   clef_stations(6) = .FALSE.
    648724
    649725   lev_files(1) = lev_histmth
     
    652728   lev_files(4) = lev_histins
    653729   lev_files(5) = lev_histLES
    654 
     730   lev_files(6) = lev_histins
    655731
    656732   ecrit_files(1) = ecrit_mth
     
    659735   ecrit_files(4) = ecrit_ins
    660736   ecrit_files(5) = ecrit_LES
     737   ecrit_files(6) = ecrit_ins
    661738 
    662739!! Lectures des parametres de sorties dans physiq.def
     
    674751     phys_out_filekeys(:)=clef_files(:)
    675752   call getin('phys_out_filekeys',clef_files)
     753     phys_out_filestations(:)=clef_stations(:)
     754   call getin('phys_out_filestations',clef_stations)
    676755     phys_out_filelevels(:)=lev_files(:)
    677756   call getin('phys_out_filelevels',lev_files)
     
    689768   print*,'phys_out_filetypes=',type_ecri
    690769   print*,'phys_out_filekeys=',clef_files
     770   print*,'phys_out_filestations=',clef_stations
    691771   print*,'phys_out_filelevels=',lev_files
    692772
     
    760840              itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
    761841!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     842!IM fichiers stations
     843     else if (clef_stations(iff)) THEN
     844
     845     print*,'phys_output_mod phys_out_filenames=',phys_out_filenames(iff)
     846
     847      call histbeg_phy_all(rlon,rlat,pim,tabij,ipt,jpt,plon,plat,plon_bounds,plat_bounds, &
     848                           phys_out_filenames(iff), &
     849                           itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
    762850       else
    763851 CALL histbeg_phy(phys_out_filenames(iff),itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
     
    793881!                 1,preff,nvertp0(iff))
    794882!!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    795  CALL histdef2d(iff,o_phis%flag,o_phis%name,"Surface geop.height", "m2/s2")
     883 IF (.NOT.clef_stations(iff)) THEN
     884!
     885!IM: there is no way to have one single value in a netcdf file
     886!
    796887   type_ecri(1) = 'once'
    797888   type_ecri(2) = 'once'
     
    799890   type_ecri(4) = 'once'
    800891   type_ecri(5) = 'once'
    801  CALL histdef2d(iff,o_aire%flag,o_aire%name,"Grid area", "-")
    802  CALL histdef2d(iff,o_contfracATM%flag,o_contfracATM%name,"% sfce ter+lic", "-")
     892   type_ecri(6) = 'once'
     893   CALL histdef2d(iff,clef_stations(iff),o_aire%flag,o_aire%name,"Grid area", "-")
     894   CALL histdef2d(iff,clef_stations(iff),o_contfracATM%flag,o_contfracATM%name,"% sfce ter+lic", "-")
     895 ENDIF
    803896   type_ecri(:) = type_ecri_files(:)
    804897
    805898!!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    806  CALL histdef2d(iff,o_contfracOR%flag,o_contfracOR%name,"% sfce terre OR", "-" )
    807  CALL histdef2d(iff,o_aireTER%flag,o_aireTER%name,"Grid area CONT", "-" )
    808  CALL histdef2d(iff,o_flat%flag,o_flat%name, "Latent heat flux", "W/m2")
    809  CALL histdef2d(iff,o_slp%flag,o_slp%name, "Sea Level Pressure", "Pa" )
    810  CALL histdef2d(iff,o_tsol%flag,o_tsol%name, "Surface Temperature", "K")
    811  CALL histdef2d(iff,o_t2m%flag,o_t2m%name, "Temperature 2m", "K" )
     899 CALL histdef2d(iff,clef_stations(iff),o_phis%flag,o_phis%name,"Surface geop.height", "m2/s2" )
     900 CALL histdef2d(iff,clef_stations(iff),o_contfracOR%flag,o_contfracOR%name,"% sfce terre OR", "-" )
     901 CALL histdef2d(iff,clef_stations(iff),o_aireTER%flag,o_aireTER%name,"Grid area CONT", "-" )
     902 CALL histdef2d(iff,clef_stations(iff),o_flat%flag,o_flat%name, "Latent heat flux", "W/m2")
     903 CALL histdef2d(iff,clef_stations(iff),o_slp%flag,o_slp%name, "Sea Level Pressure", "Pa" )
     904 CALL histdef2d(iff,clef_stations(iff),o_tsol%flag,o_tsol%name, "Surface Temperature", "K")
     905 CALL histdef2d(iff,clef_stations(iff),o_t2m%flag,o_t2m%name, "Temperature 2m", "K" )
     906  IF (.NOT.clef_stations(iff)) THEN
     907!
     908!IM: there is no way to have one single value in a netcdf file
     909!
    812910   type_ecri(1) = 't_min(X)'
    813911   type_ecri(2) = 't_min(X)'
     
    815913   type_ecri(4) = 't_min(X)'
    816914   type_ecri(5) = 't_min(X)'
    817  CALL histdef2d(iff,o_t2m_min%flag,o_t2m_min%name, "Temp 2m min", "K" )
     915   type_ecri(6) = 't_min(X)'
     916   CALL histdef2d(iff,clef_stations(iff),o_t2m_min%flag,o_t2m_min%name, "Temp 2m min", "K" )
    818917   type_ecri(1) = 't_max(X)'
    819918   type_ecri(2) = 't_max(X)'
     
    821920   type_ecri(4) = 't_max(X)'
    822921   type_ecri(5) = 't_max(X)'
    823  CALL histdef2d(iff,o_t2m_max%flag,o_t2m_max%name, "Temp 2m max", "K" )
     922   type_ecri(6) = 't_max(X)'
     923   CALL histdef2d(iff,clef_stations(iff),o_t2m_max%flag,o_t2m_max%name, "Temp 2m max", "K" )
     924  ENDIF
    824925   type_ecri(:) = type_ecri_files(:)
    825  CALL histdef2d(iff,o_wind10m%flag,o_wind10m%name, "10-m wind speed", "m/s")
    826  CALL histdef2d(iff,o_wind10max%flag,o_wind10max%name, "10m wind speed max", "m/s")
    827  CALL histdef2d(iff,o_sicf%flag,o_sicf%name, "Sea-ice fraction", "-" )
    828  CALL histdef2d(iff,o_q2m%flag,o_q2m%name, "Specific humidity 2m", "kg/kg")
    829  CALL histdef2d(iff,o_u10m%flag,o_u10m%name, "Vent zonal 10m", "m/s" )
    830  CALL histdef2d(iff,o_v10m%flag,o_v10m%name, "Vent meridien 10m", "m/s")
    831  CALL histdef2d(iff,o_psol%flag,o_psol%name, "Surface Pressure", "Pa" )
    832  CALL histdef2d(iff,o_qsurf%flag,o_qsurf%name, "Surface Air humidity", "kg/kg")
     926 CALL histdef2d(iff,clef_stations(iff),o_wind10m%flag,o_wind10m%name, "10-m wind speed", "m/s")
     927 CALL histdef2d(iff,clef_stations(iff),o_wind10max%flag,o_wind10max%name, "10m wind speed max", "m/s")
     928 CALL histdef2d(iff,clef_stations(iff),o_sicf%flag,o_sicf%name, "Sea-ice fraction", "-" )
     929 CALL histdef2d(iff,clef_stations(iff),o_q2m%flag,o_q2m%name, "Specific humidity 2m", "kg/kg")
     930 CALL histdef2d(iff,clef_stations(iff),o_u10m%flag,o_u10m%name, "Vent zonal 10m", "m/s" )
     931 CALL histdef2d(iff,clef_stations(iff),o_v10m%flag,o_v10m%name, "Vent meridien 10m", "m/s")
     932 CALL histdef2d(iff,clef_stations(iff),o_psol%flag,o_psol%name, "Surface Pressure", "Pa" )
     933 CALL histdef2d(iff,clef_stations(iff),o_qsurf%flag,o_qsurf%name, "Surface Air humidity", "kg/kg")
    833934
    834935  if (.not. ok_veget) then
    835  CALL histdef2d(iff,o_qsol%flag,o_qsol%name, "Soil watter content", "mm" )
     936 CALL histdef2d(iff,clef_stations(iff),o_qsol%flag,o_qsol%name, "Soil watter content", "mm" )
    836937  endif
    837938
    838  CALL histdef2d(iff,o_ndayrain%flag,o_ndayrain%name, "Number of dayrain(liq+sol)", "-")
    839  CALL histdef2d(iff,o_precip%flag,o_precip%name, "Precip Totale liq+sol", "kg/(s*m2)" )
    840  CALL histdef2d(iff,o_plul%flag,o_plul%name, "Large-scale Precip.", "kg/(s*m2)")
    841  CALL histdef2d(iff,o_pluc%flag,o_pluc%name, "Convective Precip.", "kg/(s*m2)")
    842  CALL histdef2d(iff,o_snow%flag,o_snow%name, "Snow fall", "kg/(s*m2)" )
    843  CALL histdef2d(iff,o_msnow%flag,o_msnow%name, "Surface snow amount", "kg/m2" )
    844  CALL histdef2d(iff,o_fsnow%flag,o_fsnow%name, "Surface snow area fraction", "-" )
    845  CALL histdef2d(iff,o_evap%flag,o_evap%name, "Evaporat", "kg/(s*m2)" )
    846  CALL histdef2d(iff,o_tops%flag,o_tops%name, "Solar rad. at TOA", "W/m2")
    847  CALL histdef2d(iff,o_tops0%flag,o_tops0%name, "CS Solar rad. at TOA", "W/m2")
    848  CALL histdef2d(iff,o_topl%flag,o_topl%name, "IR rad. at TOA", "W/m2" )
    849  CALL histdef2d(iff,o_topl0%flag,o_topl0%name, "IR rad. at TOA", "W/m2")
    850  CALL histdef2d(iff,o_SWupTOA%flag,o_SWupTOA%name, "SWup at TOA", "W/m2")
    851  CALL histdef2d(iff,o_SWupTOAclr%flag,o_SWupTOAclr%name, "SWup clear sky at TOA", "W/m2")
    852  CALL histdef2d(iff,o_SWdnTOA%flag,o_SWdnTOA%name, "SWdn at TOA", "W/m2" )
    853  CALL histdef2d(iff,o_SWdnTOAclr%flag,o_SWdnTOAclr%name, "SWdn clear sky at TOA", "W/m2")
    854  CALL histdef2d(iff,o_nettop%flag,o_nettop%name, "Net dn radiatif flux at TOA", "W/m2")
    855  CALL histdef2d(iff,o_SWup200%flag,o_SWup200%name, "SWup at 200mb", "W/m2" )
    856  CALL histdef2d(iff,o_SWup200clr%flag,o_SWup200clr%name, "SWup clear sky at 200mb", "W/m2")
    857  CALL histdef2d(iff,o_SWdn200%flag,o_SWdn200%name, "SWdn at 200mb", "W/m2" )
    858  CALL histdef2d(iff,o_SWdn200clr%flag,o_SWdn200clr%name, "SWdn clear sky at 200mb", "W/m2")
    859  CALL histdef2d(iff,o_LWup200%flag,o_LWup200%name, "LWup at 200mb", "W/m2")
    860  CALL histdef2d(iff,o_LWup200clr%flag,o_LWup200clr%name, "LWup clear sky at 200mb", "W/m2")
    861  CALL histdef2d(iff,o_LWdn200%flag,o_LWdn200%name, "LWdn at 200mb", "W/m2")
    862  CALL histdef2d(iff,o_LWdn200clr%flag,o_LWdn200clr%name, "LWdn clear sky at 200mb", "W/m2")
    863  CALL histdef2d(iff,o_sols%flag,o_sols%name, "Solar rad. at surf.", "W/m2")
    864  CALL histdef2d(iff,o_sols0%flag,o_sols0%name, "Solar rad. at surf.", "W/m2")
    865  CALL histdef2d(iff,o_soll%flag,o_soll%name, "IR rad. at surface", "W/m2") 
    866  CALL histdef2d(iff,o_radsol%flag,o_radsol%name, "Rayonnement au sol", "W/m2")
    867  CALL histdef2d(iff,o_soll0%flag,o_soll0%name, "IR rad. at surface", "W/m2")
    868  CALL histdef2d(iff,o_SWupSFC%flag,o_SWupSFC%name, "SWup at surface", "W/m2")
    869  CALL histdef2d(iff,o_SWupSFCclr%flag,o_SWupSFCclr%name, "SWup clear sky at surface", "W/m2")
    870  CALL histdef2d(iff,o_SWdnSFC%flag,o_SWdnSFC%name, "SWdn at surface", "W/m2")
    871  CALL histdef2d(iff,o_SWdnSFCclr%flag,o_SWdnSFCclr%name, "SWdn clear sky at surface", "W/m2")
    872  CALL histdef2d(iff,o_LWupSFC%flag,o_LWupSFC%name, "Upwd. IR rad. at surface", "W/m2")
    873  CALL histdef2d(iff,o_LWdnSFC%flag,o_LWdnSFC%name, "Down. IR rad. at surface", "W/m2")
    874  CALL histdef2d(iff,o_LWupSFCclr%flag,o_LWupSFCclr%name, "CS Upwd. IR rad. at surface", "W/m2")
    875  CALL histdef2d(iff,o_LWdnSFCclr%flag,o_LWdnSFCclr%name, "Down. CS IR rad. at surface", "W/m2")
    876  CALL histdef2d(iff,o_bils%flag,o_bils%name, "Surf. total heat flux", "W/m2")
    877  CALL histdef2d(iff,o_sens%flag,o_sens%name, "Sensible heat flux", "W/m2")
    878  CALL histdef2d(iff,o_fder%flag,o_fder%name, "Heat flux derivation", "W/m2")
    879  CALL histdef2d(iff,o_ffonte%flag,o_ffonte%name, "Thermal flux for snow melting", "W/m2")
    880  CALL histdef2d(iff,o_fqcalving%flag,o_fqcalving%name, "Ice Calving", "kg/m2/s")
    881  CALL histdef2d(iff,o_fqfonte%flag,o_fqfonte%name, "Land ice melt", "kg/m2/s")
    882 
    883  CALL histdef2d(iff,o_taux%flag,o_taux%name, "Zonal wind stress","Pa")
    884  CALL histdef2d(iff,o_tauy%flag,o_tauy%name, "Meridional wind stress","Pa")
     939 CALL histdef2d(iff,clef_stations(iff),o_ndayrain%flag,o_ndayrain%name, "Number of dayrain(liq+sol)", "-")
     940 CALL histdef2d(iff,clef_stations(iff),o_precip%flag,o_precip%name, "Precip Totale liq+sol", "kg/(s*m2)" )
     941 CALL histdef2d(iff,clef_stations(iff),o_plul%flag,o_plul%name, "Large-scale Precip.", "kg/(s*m2)")
     942 CALL histdef2d(iff,clef_stations(iff),o_pluc%flag,o_pluc%name, "Convective Precip.", "kg/(s*m2)")
     943 CALL histdef2d(iff,clef_stations(iff),o_snow%flag,o_snow%name, "Snow fall", "kg/(s*m2)" )
     944 CALL histdef2d(iff,clef_stations(iff),o_msnow%flag,o_msnow%name, "Surface snow amount", "kg/m2" )
     945 CALL histdef2d(iff,clef_stations(iff),o_fsnow%flag,o_fsnow%name, "Surface snow area fraction", "-" )
     946 CALL histdef2d(iff,clef_stations(iff),o_evap%flag,o_evap%name, "Evaporat", "kg/(s*m2)" )
     947 CALL histdef2d(iff,clef_stations(iff),o_tops%flag,o_tops%name, "Solar rad. at TOA", "W/m2")
     948 CALL histdef2d(iff,clef_stations(iff),o_tops0%flag,o_tops0%name, "CS Solar rad. at TOA", "W/m2")
     949 CALL histdef2d(iff,clef_stations(iff),o_topl%flag,o_topl%name, "IR rad. at TOA", "W/m2" )
     950 CALL histdef2d(iff,clef_stations(iff),o_topl0%flag,o_topl0%name, "IR rad. at TOA", "W/m2")
     951 CALL histdef2d(iff,clef_stations(iff),o_SWupTOA%flag,o_SWupTOA%name, "SWup at TOA", "W/m2")
     952 CALL histdef2d(iff,clef_stations(iff),o_SWupTOAclr%flag,o_SWupTOAclr%name, "SWup clear sky at TOA", "W/m2")
     953 CALL histdef2d(iff,clef_stations(iff),o_SWdnTOA%flag,o_SWdnTOA%name, "SWdn at TOA", "W/m2" )
     954 CALL histdef2d(iff,clef_stations(iff),o_SWdnTOAclr%flag,o_SWdnTOAclr%name, "SWdn clear sky at TOA", "W/m2")
     955 CALL histdef2d(iff,clef_stations(iff),o_nettop%flag,o_nettop%name, "Net dn radiatif flux at TOA", "W/m2")
     956 CALL histdef2d(iff,clef_stations(iff),o_SWup200%flag,o_SWup200%name, "SWup at 200mb", "W/m2" )
     957 CALL histdef2d(iff,clef_stations(iff),o_SWup200clr%flag,o_SWup200clr%name, "SWup clear sky at 200mb", "W/m2")
     958 CALL histdef2d(iff,clef_stations(iff),o_SWdn200%flag,o_SWdn200%name, "SWdn at 200mb", "W/m2" )
     959 CALL histdef2d(iff,clef_stations(iff),o_SWdn200clr%flag,o_SWdn200clr%name, "SWdn clear sky at 200mb", "W/m2")
     960 CALL histdef2d(iff,clef_stations(iff),o_LWup200%flag,o_LWup200%name, "LWup at 200mb", "W/m2")
     961 CALL histdef2d(iff,clef_stations(iff),o_LWup200clr%flag,o_LWup200clr%name, "LWup clear sky at 200mb", "W/m2")
     962 CALL histdef2d(iff,clef_stations(iff),o_LWdn200%flag,o_LWdn200%name, "LWdn at 200mb", "W/m2")
     963 CALL histdef2d(iff,clef_stations(iff),o_LWdn200clr%flag,o_LWdn200clr%name, "LWdn clear sky at 200mb", "W/m2")
     964 CALL histdef2d(iff,clef_stations(iff),o_sols%flag,o_sols%name, "Solar rad. at surf.", "W/m2")
     965 CALL histdef2d(iff,clef_stations(iff),o_sols0%flag,o_sols0%name, "Solar rad. at surf.", "W/m2")
     966 CALL histdef2d(iff,clef_stations(iff),o_soll%flag,o_soll%name, "IR rad. at surface", "W/m2") 
     967 CALL histdef2d(iff,clef_stations(iff),o_radsol%flag,o_radsol%name, "Rayonnement au sol", "W/m2")
     968 CALL histdef2d(iff,clef_stations(iff),o_soll0%flag,o_soll0%name, "IR rad. at surface", "W/m2")
     969 CALL histdef2d(iff,clef_stations(iff),o_SWupSFC%flag,o_SWupSFC%name, "SWup at surface", "W/m2")
     970 CALL histdef2d(iff,clef_stations(iff),o_SWupSFCclr%flag,o_SWupSFCclr%name, "SWup clear sky at surface", "W/m2")
     971 CALL histdef2d(iff,clef_stations(iff),o_SWdnSFC%flag,o_SWdnSFC%name, "SWdn at surface", "W/m2")
     972 CALL histdef2d(iff,clef_stations(iff),o_SWdnSFCclr%flag,o_SWdnSFCclr%name, "SWdn clear sky at surface", "W/m2")
     973 CALL histdef2d(iff,clef_stations(iff),o_LWupSFC%flag,o_LWupSFC%name, "Upwd. IR rad. at surface", "W/m2")
     974 CALL histdef2d(iff,clef_stations(iff),o_LWdnSFC%flag,o_LWdnSFC%name, "Down. IR rad. at surface", "W/m2")
     975 CALL histdef2d(iff,clef_stations(iff),o_LWupSFCclr%flag,o_LWupSFCclr%name, "CS Upwd. IR rad. at surface", "W/m2")
     976 CALL histdef2d(iff,clef_stations(iff),o_LWdnSFCclr%flag,o_LWdnSFCclr%name, "Down. CS IR rad. at surface", "W/m2")
     977 CALL histdef2d(iff,clef_stations(iff),o_bils%flag,o_bils%name, "Surf. total heat flux", "W/m2")
     978 CALL histdef2d(iff,clef_stations(iff),o_sens%flag,o_sens%name, "Sensible heat flux", "W/m2")
     979 CALL histdef2d(iff,clef_stations(iff),o_fder%flag,o_fder%name, "Heat flux derivation", "W/m2")
     980 CALL histdef2d(iff,clef_stations(iff),o_ffonte%flag,o_ffonte%name, "Thermal flux for snow melting", "W/m2")
     981 CALL histdef2d(iff,clef_stations(iff),o_fqcalving%flag,o_fqcalving%name, "Ice Calving", "kg/m2/s")
     982 CALL histdef2d(iff,clef_stations(iff),o_fqfonte%flag,o_fqfonte%name, "Land ice melt", "kg/m2/s")
     983
     984 CALL histdef2d(iff,clef_stations(iff),o_taux%flag,o_taux%name, "Zonal wind stress","Pa")
     985 CALL histdef2d(iff,clef_stations(iff),o_tauy%flag,o_tauy%name, "Meridional wind stress","Pa")
    885986
    886987     DO nsrf = 1, nbsrf
    887  CALL histdef2d(iff,o_pourc_srf(nsrf)%flag,o_pourc_srf(nsrf)%name,"% "//clnsurf(nsrf),"%")
    888  CALL histdef2d(iff,o_fract_srf(nsrf)%flag,o_fract_srf(nsrf)%name,"Fraction "//clnsurf(nsrf),"1")
    889  CALL histdef2d(iff,o_taux_srf(nsrf)%flag,o_taux_srf(nsrf)%name,"Zonal wind stress"//clnsurf(nsrf),"Pa")
    890  CALL histdef2d(iff,o_tauy_srf(nsrf)%flag,o_tauy_srf(nsrf)%name,"Meridional wind stress "//clnsurf(nsrf),"Pa")
    891  CALL histdef2d(iff,o_tsol_srf(nsrf)%flag,o_tsol_srf(nsrf)%name,"Temperature "//clnsurf(nsrf),"K")
    892  CALL histdef2d(iff,o_u10m_srf(nsrf)%flag,o_u10m_srf(nsrf)%name,"Vent Zonal 10m "//clnsurf(nsrf),"m/s")
    893  CALL histdef2d(iff,o_evap_srf(nsrf)%flag,o_evap_srf(nsrf)%name,"evaporation at surface "//clnsurf(nsrf),"kg/(s*m2)")
    894  CALL histdef2d(iff,o_v10m_srf(nsrf)%flag,o_v10m_srf(nsrf)%name,"Vent meredien 10m "//clnsurf(nsrf),"m/s")
    895  CALL histdef2d(iff,o_t2m_srf(nsrf)%flag,o_t2m_srf(nsrf)%name,"Temp 2m "//clnsurf(nsrf),"K")
    896  CALL histdef2d(iff,o_sens_srf(nsrf)%flag,o_sens_srf(nsrf)%name,"Sensible heat flux "//clnsurf(nsrf),"W/m2")
    897  CALL histdef2d(iff,o_lat_srf(nsrf)%flag,o_lat_srf(nsrf)%name,"Latent heat flux "//clnsurf(nsrf),"W/m2")
    898  CALL histdef2d(iff,o_flw_srf(nsrf)%flag,o_flw_srf(nsrf)%name,"LW "//clnsurf(nsrf),"W/m2")
    899  CALL histdef2d(iff,o_fsw_srf(nsrf)%flag,o_fsw_srf(nsrf)%name,"SW "//clnsurf(nsrf),"W/m2")
    900  CALL histdef2d(iff,o_wbils_srf(nsrf)%flag,o_wbils_srf(nsrf)%name,"Bilan sol "//clnsurf(nsrf),"W/m2" )
    901  CALL histdef2d(iff,o_wbilo_srf(nsrf)%flag,o_wbilo_srf(nsrf)%name,"Bilan eau "//clnsurf(nsrf),"kg/(m2*s)")
     988 CALL histdef2d(iff,clef_stations(iff),o_pourc_srf(nsrf)%flag,o_pourc_srf(nsrf)%name,"% "//clnsurf(nsrf),"%")
     989 CALL histdef2d(iff,clef_stations(iff),o_fract_srf(nsrf)%flag,o_fract_srf(nsrf)%name,"Fraction "//clnsurf(nsrf),"1")
     990 CALL histdef2d(iff,clef_stations(iff), &
     991o_taux_srf(nsrf)%flag,o_taux_srf(nsrf)%name,"Zonal wind stress"//clnsurf(nsrf),"Pa")
     992 CALL histdef2d(iff,clef_stations(iff), &
     993o_tauy_srf(nsrf)%flag,o_tauy_srf(nsrf)%name,"Meridional wind stress "//clnsurf(nsrf),"Pa")
     994 CALL histdef2d(iff,clef_stations(iff), &
     995o_tsol_srf(nsrf)%flag,o_tsol_srf(nsrf)%name,"Temperature "//clnsurf(nsrf),"K")
     996 CALL histdef2d(iff,clef_stations(iff), &
     997o_u10m_srf(nsrf)%flag,o_u10m_srf(nsrf)%name,"Vent Zonal 10m "//clnsurf(nsrf),"m/s")
     998 CALL histdef2d(iff,clef_stations(iff), &
     999o_evap_srf(nsrf)%flag,o_evap_srf(nsrf)%name,"evaporation at surface "//clnsurf(nsrf),"kg/(s*m2)")
     1000 CALL histdef2d(iff,clef_stations(iff), &
     1001o_v10m_srf(nsrf)%flag,o_v10m_srf(nsrf)%name,"Vent meredien 10m "//clnsurf(nsrf),"m/s")
     1002 CALL histdef2d(iff,clef_stations(iff), &
     1003o_t2m_srf(nsrf)%flag,o_t2m_srf(nsrf)%name,"Temp 2m "//clnsurf(nsrf),"K")
     1004 CALL histdef2d(iff,clef_stations(iff), &
     1005o_sens_srf(nsrf)%flag,o_sens_srf(nsrf)%name,"Sensible heat flux "//clnsurf(nsrf),"W/m2")
     1006 CALL histdef2d(iff,clef_stations(iff), &
     1007o_lat_srf(nsrf)%flag,o_lat_srf(nsrf)%name,"Latent heat flux "//clnsurf(nsrf),"W/m2")
     1008 CALL histdef2d(iff,clef_stations(iff), &
     1009o_flw_srf(nsrf)%flag,o_flw_srf(nsrf)%name,"LW "//clnsurf(nsrf),"W/m2")
     1010 CALL histdef2d(iff,clef_stations(iff), &
     1011o_fsw_srf(nsrf)%flag,o_fsw_srf(nsrf)%name,"SW "//clnsurf(nsrf),"W/m2")
     1012 CALL histdef2d(iff,clef_stations(iff), &
     1013o_wbils_srf(nsrf)%flag,o_wbils_srf(nsrf)%name,"Bilan sol "//clnsurf(nsrf),"W/m2" )
     1014 CALL histdef2d(iff,clef_stations(iff), &
     1015o_wbilo_srf(nsrf)%flag,o_wbilo_srf(nsrf)%name,"Bilan eau "//clnsurf(nsrf),"kg/(m2*s)")
    9021016  if (iflag_pbl>1 .and. lev_files(iff).gt.10 ) then
    903  CALL histdef2d(iff,o_tke_srf(nsrf)%flag,o_tke_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
     1017 CALL histdef2d(iff,clef_stations(iff), &
     1018o_tke_srf(nsrf)%flag,o_tke_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
     1019
     1020  IF (.NOT.clef_stations(iff)) THEN
     1021!
     1022!IM: there is no way to have one single value in a netcdf file
     1023!
    9041024   type_ecri(1) = 't_max(X)'
    9051025   type_ecri(2) = 't_max(X)'
     
    9071027   type_ecri(4) = 't_max(X)'
    9081028   type_ecri(5) = 't_max(X)'
    909  CALL histdef2d(iff,o_tke_max_srf(nsrf)%flag,o_tke_max_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
     1029   type_ecri(6) = 't_max(X)'
     1030  CALL histdef2d(iff,clef_stations(iff), &
     1031  o_tke_max_srf(nsrf)%flag,o_tke_max_srf(nsrf)%name,"Max Turb. Kinetic Energy "//clnsurf(nsrf),"-")
    9101032   type_ecri(:) = type_ecri_files(:)
     1033  ENDIF
     1034
    9111035  endif
    912  CALL histdef2d(iff,o_albe_srf(nsrf)%flag,o_albe_srf(nsrf)%name,"Albedo VIS surf. "//clnsurf(nsrf),"-")
    913  CALL histdef2d(iff,o_rugs_srf(nsrf)%flag,o_rugs_srf(nsrf)%name,"Surface roughness "//clnsurf(nsrf),"m")
    914  CALL histdef2d(iff,o_ages_srf(nsrf)%flag,o_ages_srf(nsrf)%name,"Snow age", "day")
     1036
     1037 CALL histdef2d(iff,clef_stations(iff), &
     1038o_albe_srf(nsrf)%flag,o_albe_srf(nsrf)%name,"Albedo VIS surf. "//clnsurf(nsrf),"-")
     1039 CALL histdef2d(iff,clef_stations(iff), &
     1040o_rugs_srf(nsrf)%flag,o_rugs_srf(nsrf)%name,"Surface roughness "//clnsurf(nsrf),"m")
     1041 CALL histdef2d(iff,clef_stations(iff), &
     1042o_ages_srf(nsrf)%flag,o_ages_srf(nsrf)%name,"Snow age", "day")
    9151043END DO
    9161044
     
    9181046 IF (ok_ade.OR.ok_aie) THEN
    9191047
    920   CALL histdef2d(iff,o_od550aer%flag,o_od550aer%name, "Total aerosol optical depth at 550nm", "-")
    921   CALL histdef2d(iff,o_od865aer%flag,o_od865aer%name, "Total aerosol optical depth at 870nm", "-")
    922   CALL histdef2d(iff,o_absvisaer%flag,o_absvisaer%name, "Absorption aerosol visible optical depth", "-")
    923   CALL histdef2d(iff,o_od550lt1aer%flag,o_od550lt1aer%name, "Fine mode optical depth", "-")
    924   CALL histdef2d(iff,o_sconcso4%flag,o_sconcso4%name,"Surface Concentration of Sulfate ","kg/m3")
    925   CALL histdef2d(iff,o_sconcoa%flag,o_sconcoa%name,"Surface Concentration of Organic Aerosol ","kg/m3")
    926   CALL histdef2d(iff,o_sconcbc%flag,o_sconcbc%name,"Surface Concentration of Black Carbon ","kg/m3")
    927   CALL histdef2d(iff,o_sconcss%flag,o_sconcss%name,"Surface Concentration of Sea Salt ","kg/m3")
    928   CALL histdef2d(iff,o_sconcdust%flag,o_sconcdust%name,"Surface Concentration of Dust ","kg/m3")
    929   CALL histdef3d(iff,o_concso4%flag,o_concso4%name,"Concentration of Sulfate ","kg/m3")
    930   CALL histdef3d(iff,o_concoa%flag,o_concoa%name,"Concentration of Organic Aerosol ","kg/m3")
    931   CALL histdef3d(iff,o_concbc%flag,o_concbc%name,"Concentration of Black Carbon ","kg/m3")
    932   CALL histdef3d(iff,o_concss%flag,o_concss%name,"Concentration of Sea Salt ","kg/m3")
    933   CALL histdef3d(iff,o_concdust%flag,o_concdust%name,"Concentration of Dust ","kg/m3")
    934   CALL histdef2d(iff,o_loadso4%flag,o_loadso4%name,"Column Load of Sulfate ","kg/m2")
    935   CALL histdef2d(iff,o_loadoa%flag,o_loadoa%name,"Column Load of Organic Aerosol ","kg/m2")
    936   CALL histdef2d(iff,o_loadbc%flag,o_loadbc%name,"Column Load of Black Carbon ","kg/m2")
    937   CALL histdef2d(iff,o_loadss%flag,o_loadss%name,"Column Load of Sea Salt ","kg/m2")
    938   CALL histdef2d(iff,o_loaddust%flag,o_loaddust%name,"Column Load of Dust ","kg/m2")
     1048  CALL histdef2d(iff,clef_stations(iff), &
     1049o_od550aer%flag,o_od550aer%name, "Total aerosol optical depth at 550nm", "-")
     1050  CALL histdef2d(iff,clef_stations(iff), &
     1051o_od865aer%flag,o_od865aer%name, "Total aerosol optical depth at 870nm", "-")
     1052  CALL histdef2d(iff,clef_stations(iff), &
     1053o_absvisaer%flag,o_absvisaer%name, "Absorption aerosol visible optical depth", "-")
     1054  CALL histdef2d(iff,clef_stations(iff), &
     1055o_od550lt1aer%flag,o_od550lt1aer%name, "Fine mode optical depth", "-")
     1056
     1057
     1058  CALL histdef2d(iff,clef_stations(iff), &
     1059o_sconcso4%flag,o_sconcso4%name,"Surface Concentration of Sulfate ","kg/m3")
     1060  CALL histdef2d(iff,clef_stations(iff), &
     1061o_sconcoa%flag,o_sconcoa%name,"Surface Concentration of Organic Aerosol ","kg/m3")
     1062  CALL histdef2d(iff,clef_stations(iff), &
     1063o_sconcbc%flag,o_sconcbc%name,"Surface Concentration of Black Carbon ","kg/m3")
     1064  CALL histdef2d(iff,clef_stations(iff), &
     1065o_sconcss%flag,o_sconcss%name,"Surface Concentration of Sea Salt ","kg/m3")
     1066  CALL histdef2d(iff,clef_stations(iff), &
     1067o_sconcdust%flag,o_sconcdust%name,"Surface Concentration of Dust ","kg/m3")
     1068  CALL histdef3d(iff,clef_stations(iff), &
     1069o_concso4%flag,o_concso4%name,"Concentration of Sulfate ","kg/m3")
     1070  CALL histdef3d(iff,clef_stations(iff), &
     1071o_concoa%flag,o_concoa%name,"Concentration of Organic Aerosol ","kg/m3")
     1072  CALL histdef3d(iff,clef_stations(iff), &
     1073o_concbc%flag,o_concbc%name,"Concentration of Black Carbon ","kg/m3")
     1074  CALL histdef3d(iff,clef_stations(iff), &
     1075o_concss%flag,o_concss%name,"Concentration of Sea Salt ","kg/m3")
     1076  CALL histdef3d(iff,clef_stations(iff), &
     1077o_concdust%flag,o_concdust%name,"Concentration of Dust ","kg/m3")
     1078  CALL histdef2d(iff,clef_stations(iff), &
     1079o_loadso4%flag,o_loadso4%name,"Column Load of Sulfate ","kg/m2")
     1080  CALL histdef2d(iff,clef_stations(iff), &
     1081o_loadoa%flag,o_loadoa%name,"Column Load of Organic Aerosol ","kg/m2")
     1082  CALL histdef2d(iff,clef_stations(iff), &
     1083o_loadbc%flag,o_loadbc%name,"Column Load of Black Carbon ","kg/m2")
     1084  CALL histdef2d(iff,clef_stations(iff), &
     1085o_loadss%flag,o_loadss%name,"Column Load of Sea Salt ","kg/m2")
     1086  CALL histdef2d(iff,clef_stations(iff), &
     1087o_loaddust%flag,o_loaddust%name,"Column Load of Dust ","kg/m2")
    9391088
    9401089  DO naero = 1, naero_spc
    941   CALL histdef2d(iff,o_tausumaero(naero)%flag,o_tausumaero(naero)%name,"Aerosol Optical depth at 550 nm "//name_aero(naero),"1")
     1090  CALL histdef2d(iff,clef_stations(iff), &
     1091o_tausumaero(naero)%flag,o_tausumaero(naero)%name,"Aerosol Optical depth at 550 nm "//name_aero(naero),"1")
    9421092  END DO
    9431093 ENDIF
     
    9451095
    9461096 IF (ok_ade) THEN
    947   CALL histdef2d(iff,o_topswad%flag,o_topswad%name, "ADE at TOA", "W/m2")
    948   CALL histdef2d(iff,o_solswad%flag,o_solswad%name, "ADE at SRF", "W/m2")
    949 
    950  CALL histdef2d(iff,o_swtoaas_nat%flag,o_swtoaas_nat%name, "Natural aerosol radiative forcing all-sky at TOA", "W/m2")
    951  CALL histdef2d(iff,o_swsrfas_nat%flag,o_swsrfas_nat%name, "Natural aerosol radiative forcing all-sky at SRF", "W/m2")
    952  CALL histdef2d(iff,o_swtoacs_nat%flag,o_swtoacs_nat%name, "Natural aerosol radiative forcing clear-sky at TOA", "W/m2")
    953  CALL histdef2d(iff,o_swsrfcs_nat%flag,o_swsrfcs_nat%name, "Natural aerosol radiative forcing clear-sky at SRF", "W/m2")
    954 
    955  CALL histdef2d(iff,o_swtoaas_ant%flag,o_swtoaas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at TOA", "W/m2")
    956  CALL histdef2d(iff,o_swsrfas_ant%flag,o_swsrfas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at SRF", "W/m2")
    957  CALL histdef2d(iff,o_swtoacs_ant%flag,o_swtoacs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at TOA", "W/m2")
    958  CALL histdef2d(iff,o_swsrfcs_ant%flag,o_swsrfcs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at SRF", "W/m2")
     1097  CALL histdef2d(iff,clef_stations(iff), &
     1098o_topswad%flag,o_topswad%name, "ADE at TOA", "W/m2")
     1099  CALL histdef2d(iff,clef_stations(iff), &
     1100o_solswad%flag,o_solswad%name, "ADE at SRF", "W/m2")
     1101
     1102 CALL histdef2d(iff,clef_stations(iff), &
     1103o_swtoaas_nat%flag,o_swtoaas_nat%name, "Natural aerosol radiative forcing all-sky at TOA", "W/m2")
     1104 CALL histdef2d(iff,clef_stations(iff), &
     1105o_swsrfas_nat%flag,o_swsrfas_nat%name, "Natural aerosol radiative forcing all-sky at SRF", "W/m2")
     1106 CALL histdef2d(iff,clef_stations(iff), &
     1107o_swtoacs_nat%flag,o_swtoacs_nat%name, "Natural aerosol radiative forcing clear-sky at TOA", "W/m2")
     1108 CALL histdef2d(iff,clef_stations(iff), &
     1109o_swsrfcs_nat%flag,o_swsrfcs_nat%name, "Natural aerosol radiative forcing clear-sky at SRF", "W/m2")
     1110
     1111 CALL histdef2d(iff,clef_stations(iff), &
     1112o_swtoaas_ant%flag,o_swtoaas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at TOA", "W/m2")
     1113 CALL histdef2d(iff,clef_stations(iff), &
     1114o_swsrfas_ant%flag,o_swsrfas_ant%name, "Anthropogenic aerosol radiative forcing all-sky at SRF", "W/m2")
     1115 CALL histdef2d(iff,clef_stations(iff), &
     1116o_swtoacs_ant%flag,o_swtoacs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at TOA", "W/m2")
     1117 CALL histdef2d(iff,clef_stations(iff), &
     1118o_swsrfcs_ant%flag,o_swsrfcs_ant%name, "Anthropogenic aerosol radiative forcing clear-sky at SRF", "W/m2")
    9591119
    9601120 IF (.NOT. aerosol_couple) THEN
    961  CALL histdef2d(iff,o_swtoacf_nat%flag,o_swtoacf_nat%name, "Natural aerosol impact on cloud radiative forcing at TOA", "W/m2")
    962  CALL histdef2d(iff,o_swsrfcf_nat%flag,o_swsrfcf_nat%name, "Natural aerosol impact on cloud radiative forcing  at SRF", "W/m2")
    963  CALL histdef2d(iff,o_swtoacf_ant%flag,o_swtoacf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at TOA", "W/m2")
    964  CALL histdef2d(iff,o_swsrfcf_ant%flag,o_swsrfcf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at SRF", "W/m2")
    965  CALL histdef2d(iff,o_swtoacf_zero%flag,o_swtoacf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at TOA", "W/m2")
    966  CALL histdef2d(iff,o_swsrfcf_zero%flag,o_swsrfcf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at SRF", "W/m2")
     1121 CALL histdef2d(iff,clef_stations(iff), &
     1122o_swtoacf_nat%flag,o_swtoacf_nat%name, "Natural aerosol impact on cloud radiative forcing at TOA", "W/m2")
     1123 CALL histdef2d(iff,clef_stations(iff), &
     1124o_swsrfcf_nat%flag,o_swsrfcf_nat%name, "Natural aerosol impact on cloud radiative forcing  at SRF", "W/m2")
     1125 CALL histdef2d(iff,clef_stations(iff), &
     1126o_swtoacf_ant%flag,o_swtoacf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at TOA", "W/m2")
     1127 CALL histdef2d(iff,clef_stations(iff), &
     1128o_swsrfcf_ant%flag,o_swsrfcf_ant%name, "Anthropogenic aerosol impact on cloud radiative forcing at SRF", "W/m2")
     1129 CALL histdef2d(iff,clef_stations(iff), &
     1130o_swtoacf_zero%flag,o_swtoacf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at TOA", "W/m2")
     1131 CALL histdef2d(iff,clef_stations(iff), &
     1132o_swsrfcf_zero%flag,o_swsrfcf_zero%name, "Cloud radiative forcing (allsky-clearsky fluxes) at SRF", "W/m2")
    9671133 ENDIF
    9681134
     
    9701136
    9711137 IF (ok_aie) THEN
    972   CALL histdef2d(iff,o_topswai%flag,o_topswai%name, "AIE at TOA", "W/m2")
    973   CALL histdef2d(iff,o_solswai%flag,o_solswai%name, "AIE at SFR", "W/m2")
     1138  CALL histdef2d(iff,clef_stations(iff), &
     1139o_topswai%flag,o_topswai%name, "AIE at TOA", "W/m2")
     1140  CALL histdef2d(iff,clef_stations(iff), &
     1141o_solswai%flag,o_solswai%name, "AIE at SFR", "W/m2")
    9741142!Cloud droplet number concentration
    975   CALL histdef3d(iff,o_scdnc%flag,o_scdnc%name, "Cloud droplet number concentration","m-3")
    976   CALL histdef2d(iff,o_cldncl%flag,o_cldncl%name, "CDNC at top of liquid water cloud", "m-3")
    977   CALL histdef3d(iff,o_reffclws%flag,o_reffclws%name, "Stratiform Cloud Droplet Effective Radius","m")
    978   CALL histdef3d(iff,o_reffclwc%flag,o_reffclwc%name, "Convective Cloud Droplet Effective Radius","m")
    979   CALL histdef2d(iff,o_cldnvi%flag,o_cldnvi%name, "Column Integrated Cloud Droplet Number", "m-2")
    980   CALL histdef3d(iff,o_lcc3d%flag,o_lcc3d%name, "Cloud liquid fraction","1")
    981   CALL histdef3d(iff,o_lcc3dcon%flag,o_lcc3dcon%name, "Convective cloud liquid fraction","1")
    982   CALL histdef3d(iff,o_lcc3dstra%flag,o_lcc3dstra%name, "Stratiform cloud liquid fraction","1")
    983   CALL histdef2d(iff,o_lcc%flag,o_lcc%name, "Cloud liquid fraction at top of cloud","1")
    984   CALL histdef2d(iff,o_reffclwtop%flag,o_reffclwtop%name, "Droplet effective radius at top of liquid water cloud", "m")
     1143  CALL histdef3d(iff,clef_stations(iff), &
     1144o_scdnc%flag,o_scdnc%name, "Cloud droplet number concentration","m-3")
     1145  CALL histdef2d(iff,clef_stations(iff), &
     1146o_cldncl%flag,o_cldncl%name, "CDNC at top of liquid water cloud", "m-3")
     1147  CALL histdef3d(iff,clef_stations(iff), &
     1148o_reffclws%flag,o_reffclws%name, "Stratiform Cloud Droplet Effective Radius (aerosol diags.)","m")
     1149  CALL histdef3d(iff,clef_stations(iff), &
     1150o_reffclwc%flag,o_reffclwc%name, "Convective Cloud Droplet Effective Radius (aerosol diags.)","m")
     1151  CALL histdef2d(iff,clef_stations(iff), &
     1152o_cldnvi%flag,o_cldnvi%name, "Column Integrated Cloud Droplet Number", "m-2")
     1153  CALL histdef3d(iff,clef_stations(iff), &
     1154o_lcc3d%flag,o_lcc3d%name, "Cloud liquid fraction","1")
     1155  CALL histdef3d(iff,clef_stations(iff), &
     1156o_lcc3dcon%flag,o_lcc3dcon%name, "Convective cloud liquid fraction","1")
     1157  CALL histdef3d(iff,clef_stations(iff), &
     1158o_lcc3dstra%flag,o_lcc3dstra%name, "Stratiform cloud liquid fraction","1")
     1159  CALL histdef2d(iff,clef_stations(iff), &
     1160o_lcc%flag,o_lcc%name, "Cloud liquid fraction at top of cloud","1")
     1161  CALL histdef2d(iff,clef_stations(iff), &
     1162o_reffclwtop%flag,o_reffclwtop%name, "Droplet effective radius at top of liquid water cloud", "m")
    9851163 ENDIF
    9861164
    9871165
    988  CALL histdef2d(iff,o_alb1%flag,o_alb1%name, "Surface VIS albedo", "-")
    989  CALL histdef2d(iff,o_alb2%flag,o_alb2%name, "Surface Near IR albedo", "-")
    990  CALL histdef2d(iff,o_cdrm%flag,o_cdrm%name, "Momentum drag coef.", "-")
    991  CALL histdef2d(iff,o_cdrh%flag,o_cdrh%name, "Heat drag coef.", "-" )
    992  CALL histdef2d(iff,o_cldl%flag,o_cldl%name, "Low-level cloudiness", "-")
    993  CALL histdef2d(iff,o_cldm%flag,o_cldm%name, "Mid-level cloudiness", "-")
    994  CALL histdef2d(iff,o_cldh%flag,o_cldh%name, "High-level cloudiness", "-")
    995  CALL histdef2d(iff,o_cldt%flag,o_cldt%name, "Total cloudiness", "-")
    996  CALL histdef2d(iff,o_cldq%flag,o_cldq%name, "Cloud liquid water path", "kg/m2")
    997  CALL histdef2d(iff,o_lwp%flag,o_lwp%name, "Cloud water path", "kg/m2")
    998  CALL histdef2d(iff,o_iwp%flag,o_iwp%name, "Cloud ice water path", "kg/m2" )
    999  CALL histdef2d(iff,o_ue%flag,o_ue%name, "Zonal energy transport", "-")
    1000  CALL histdef2d(iff,o_ve%flag,o_ve%name, "Merid energy transport", "-")
    1001  CALL histdef2d(iff,o_uq%flag,o_uq%name, "Zonal humidity transport", "-")
    1002  CALL histdef2d(iff,o_vq%flag,o_vq%name, "Merid humidity transport", "-")
     1166 CALL histdef2d(iff,clef_stations(iff), &
     1167o_alb1%flag,o_alb1%name, "Surface VIS albedo", "-")
     1168 CALL histdef2d(iff,clef_stations(iff), &
     1169o_alb2%flag,o_alb2%name, "Surface Near IR albedo", "-")
     1170 CALL histdef2d(iff,clef_stations(iff), &
     1171o_cdrm%flag,o_cdrm%name, "Momentum drag coef.", "-")
     1172 CALL histdef2d(iff,clef_stations(iff), &
     1173o_cdrh%flag,o_cdrh%name, "Heat drag coef.", "-" )
     1174 CALL histdef2d(iff,clef_stations(iff), &
     1175o_cldl%flag,o_cldl%name, "Low-level cloudiness", "-")
     1176 CALL histdef2d(iff,clef_stations(iff), &
     1177o_cldm%flag,o_cldm%name, "Mid-level cloudiness", "-")
     1178 CALL histdef2d(iff,clef_stations(iff), &
     1179o_cldh%flag,o_cldh%name, "High-level cloudiness", "-")
     1180 CALL histdef2d(iff,clef_stations(iff), &
     1181o_cldt%flag,o_cldt%name, "Total cloudiness", "-")
     1182 CALL histdef2d(iff,clef_stations(iff), &
     1183o_cldq%flag,o_cldq%name, "Cloud liquid water path", "kg/m2")
     1184 CALL histdef2d(iff,clef_stations(iff), &
     1185o_lwp%flag,o_lwp%name, "Cloud water path", "kg/m2")
     1186 CALL histdef2d(iff,clef_stations(iff), &
     1187o_iwp%flag,o_iwp%name, "Cloud ice water path", "kg/m2" )
     1188 CALL histdef2d(iff,clef_stations(iff), &
     1189o_ue%flag,o_ue%name, "Zonal energy transport", "-")
     1190 CALL histdef2d(iff,clef_stations(iff), &
     1191o_ve%flag,o_ve%name, "Merid energy transport", "-")
     1192 CALL histdef2d(iff,clef_stations(iff), &
     1193o_uq%flag,o_uq%name, "Zonal humidity transport", "-")
     1194 CALL histdef2d(iff,clef_stations(iff), &
     1195o_vq%flag,o_vq%name, "Merid humidity transport", "-")
    10031196
    10041197     IF(iflag_con.GE.3) THEN ! sb
    1005  CALL histdef2d(iff,o_cape%flag,o_cape%name, "Conv avlbl pot ener", "J/kg")
    1006  CALL histdef2d(iff,o_pbase%flag,o_pbase%name, "Cld base pressure", "Pa")
    1007  CALL histdef2d(iff,o_ptop%flag,o_ptop%name, "Cld top pressure", "Pa")
    1008  CALL histdef2d(iff,o_fbase%flag,o_fbase%name, "Cld base mass flux", "kg/m2/s")
    1009  CALL histdef2d(iff,o_plcl%flag,o_plcl%name, "Lifting Condensation Level", "hPa")
    1010  CALL histdef2d(iff,o_plfc%flag,o_plfc%name, "Level of Free Convection", "hPa")
    1011  CALL histdef2d(iff,o_wbeff%flag,o_wbeff%name, "Conv. updraft velocity at LFC", "m/s")
    1012  CALL histdef2d(iff,o_prw%flag,o_prw%name, "Precipitable water", "kg/m2")
     1198 CALL histdef2d(iff,clef_stations(iff), &
     1199o_cape%flag,o_cape%name, "Conv avlbl pot ener", "J/kg")
     1200 CALL histdef2d(iff,clef_stations(iff), &
     1201o_pbase%flag,o_pbase%name, "Cld base pressure", "Pa")
     1202 CALL histdef2d(iff,clef_stations(iff), &
     1203o_ptop%flag,o_ptop%name, "Cld top pressure", "Pa")
     1204 CALL histdef2d(iff,clef_stations(iff), &
     1205o_fbase%flag,o_fbase%name, "Cld base mass flux", "kg/m2/s")
     1206 CALL histdef2d(iff,clef_stations(iff), &
     1207o_plcl%flag,o_plcl%name, "Lifting Condensation Level", "hPa")
     1208 CALL histdef2d(iff,clef_stations(iff), &
     1209o_plfc%flag,o_plfc%name, "Level of Free Convection", "hPa")
     1210 CALL histdef2d(iff,clef_stations(iff), &
     1211o_wbeff%flag,o_wbeff%name, "Conv. updraft velocity at LFC", "m/s")
     1212 CALL histdef2d(iff,clef_stations(iff), &
     1213o_prw%flag,o_prw%name, "Precipitable water", "kg/m2")
     1214  IF (.NOT.clef_stations(iff)) THEN
     1215!
     1216!IM: there is no way to have one single value in a netcdf file
     1217!
     1218    type_ecri(1) = 't_max(X)'
     1219    type_ecri(2) = 't_max(X)'
     1220    type_ecri(3) = 't_max(X)'
     1221    type_ecri(4) = 't_max(X)'
     1222    type_ecri(5) = 't_max(X)'
     1223    type_ecri(6) = 't_max(X)'
     1224    CALL histdef2d(iff,clef_stations(iff), &
     1225  o_cape_max%flag,o_cape_max%name, "CAPE max.", "J/kg")
     1226  ENDIF
     1227   type_ecri(:) = type_ecri_files(:)
     1228 CALL histdef3d(iff,clef_stations(iff), &
     1229o_upwd%flag,o_upwd%name, "saturated updraft", "kg/m2/s")
     1230 CALL histdef3d(iff,clef_stations(iff), &
     1231o_Ma%flag,o_Ma%name, "undilute adiab updraft", "kg/m2/s")
     1232 CALL histdef3d(iff,clef_stations(iff), &
     1233o_dnwd%flag,o_dnwd%name, "saturated downdraft", "kg/m2/s")
     1234 CALL histdef3d(iff,clef_stations(iff), &
     1235o_dnwd0%flag,o_dnwd0%name, "unsat. downdraft", "kg/m2/s")
     1236 CALL histdef3d(iff,clef_stations(iff), &
     1237o_mc%flag,o_mc%name, "Convective mass flux", "kg/m2/s")
     1238   type_ecri(1) = 'inst(X)'
     1239   type_ecri(2) = 'inst(X)'
     1240   type_ecri(3) = 'inst(X)'
     1241   type_ecri(4) = 'inst(X)'
     1242   type_ecri(5) = 'inst(X)'
     1243   type_ecri(6) = 'inst(X)'
     1244 CALL histdef2d(iff,clef_stations(iff), &
     1245o_ftime_con%flag,o_ftime_con%name, "Fraction of time convection Occurs", " ")
     1246   type_ecri(:) = type_ecri_files(:)
     1247     ENDIF !iflag_con .GE. 3
     1248
     1249 CALL histdef2d(iff,clef_stations(iff), &
     1250o_s_pblh%flag,o_s_pblh%name, "Boundary Layer Height", "m")
     1251 CALL histdef2d(iff,clef_stations(iff), &
     1252o_s_pblt%flag,o_s_pblt%name, "t at Boundary Layer Height", "K")
     1253 CALL histdef2d(iff,clef_stations(iff), &
     1254o_s_lcl%flag,o_s_lcl%name, "Condensation level", "m")
     1255 CALL histdef2d(iff,clef_stations(iff), &
     1256o_s_therm%flag,o_s_therm%name, "Exces du thermique", "K")
     1257!IM : Les champs suivants (s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
     1258!CALL histdef2d(iff,clef_stations(iff), &
     1259!o_s_capCL%flag,o_s_capCL%name, "Conv avlbl pot enerfor ABL", "J/m2" )
     1260!CALL histdef2d(iff,clef_stations(iff), &
     1261!o_s_oliqCL%flag,o_s_oliqCL%name, "Liq Water in BL", "kg/m2")
     1262!CALL histdef2d(iff,clef_stations(iff), &
     1263!o_s_cteiCL%flag,o_s_cteiCL%name, "Instability criteria(ABL)", "K")
     1264!CALL histdef2d(iff,clef_stations(iff), &
     1265!o_s_trmb1%flag,o_s_trmb1%name, "deep_cape(HBTM2)", "J/m2")
     1266!CALL histdef2d(iff,clef_stations(iff), &
     1267!o_s_trmb2%flag,o_s_trmb2%name, "inhibition (HBTM2)", "J/m2")
     1268!CALL histdef2d(iff,clef_stations(iff), &
     1269!o_s_trmb3%flag,o_s_trmb3%name, "Point Omega (HBTM2)", "m")
     1270
     1271! Champs interpolles sur des niveaux de pression
     1272
     1273   type_ecri(1) = 'inst(X)'
     1274   type_ecri(2) = 'inst(X)'
     1275   type_ecri(3) = 'inst(X)'
     1276   type_ecri(4) = 'inst(X)'
     1277   type_ecri(5) = 'inst(X)'
     1278   type_ecri(6) = 'inst(X)'
     1279
     1280! Attention a reverifier
     1281
     1282        ilev=0       
     1283        DO k=1, nlevSTD
     1284     bb2=clevSTD(k)
     1285     IF(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200" &
     1286.OR.bb2.EQ."100".OR.bb2.EQ."50".OR.bb2.EQ."10")THEN
     1287      ilev=ilev+1
     1288!     print*,'ilev k bb2 flag name ',ilev,k, bb2,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name
     1289 CALL histdef2d(iff,clef_stations(iff), &
     1290o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name,"Zonal wind "//bb2//"hPa", "m/s")
     1291 CALL histdef2d(iff,clef_stations(iff), &
     1292o_vSTDlevs(ilev)%flag,o_vSTDlevs(ilev)%name,"Meridional wind "//bb2//"hPa", "m/s")
     1293 CALL histdef2d(iff,clef_stations(iff), &
     1294o_wSTDlevs(ilev)%flag,o_wSTDlevs(ilev)%name,"Vertical wind "//bb2//"hPa", "Pa/s")
     1295 CALL histdef2d(iff,clef_stations(iff), &
     1296o_zSTDlevs(ilev)%flag,o_zSTDlevs(ilev)%name,"Geopotential height "//bb2//"hPa", "m")
     1297 CALL histdef2d(iff,clef_stations(iff), &
     1298o_qSTDlevs(ilev)%flag,o_qSTDlevs(ilev)%name,"Specific humidity "//bb2//"hPa", "kg/kg" )
     1299 CALL histdef2d(iff,clef_stations(iff), &
     1300o_tSTDlevs(ilev)%flag,o_tSTDlevs(ilev)%name,"Temperature "//bb2//"hPa", "K")
     1301     ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")
     1302       ENDDO
     1303   type_ecri(:) = type_ecri_files(:)
     1304
     1305 CALL histdef2d(iff,clef_stations(iff), &
     1306o_t_oce_sic%flag,o_t_oce_sic%name, "Temp mixte oce-sic", "K")
     1307
     1308 IF (type_ocean=='slab') &
     1309     CALL histdef2d(iff,clef_stations(iff), &
     1310o_slab_bils%flag, o_slab_bils%name,"Bilan au sol sur ocean slab", "W/m2")
     1311
     1312! Couplage conv-CL
     1313 IF (iflag_con.GE.3) THEN
     1314    IF (iflag_coupl>=1) THEN
     1315 CALL histdef2d(iff,clef_stations(iff), &
     1316o_ale_bl%flag,o_ale_bl%name, "ALE BL", "m2/s2")
     1317 CALL histdef2d(iff,clef_stations(iff), &
     1318o_alp_bl%flag,o_alp_bl%name, "ALP BL", "m2/s2")
     1319    ENDIF
     1320 ENDIF !(iflag_con.GE.3)
     1321
     1322 CALL histdef2d(iff,clef_stations(iff), &
     1323o_weakinv%flag,o_weakinv%name, "Weak inversion", "-")
     1324 CALL histdef2d(iff,clef_stations(iff), &
     1325o_dthmin%flag,o_dthmin%name, "dTheta mini", "K/m")
     1326 CALL histdef2d(iff,clef_stations(iff), &
     1327o_rh2m%flag,o_rh2m%name, "Relative humidity at 2m", "%" )
     1328
     1329  IF (.NOT.clef_stations(iff)) THEN
     1330!
     1331!IM: there is no way to have one single value in a netcdf file
     1332!
     1333   type_ecri(1) = 't_min(X)'
     1334   type_ecri(2) = 't_min(X)'
     1335   type_ecri(3) = 't_min(X)'
     1336   type_ecri(4) = 't_min(X)'
     1337   type_ecri(5) = 't_min(X)'
     1338   type_ecri(6) = 't_min(X)'
     1339   CALL histdef2d(iff,clef_stations(iff),o_rh2m_min%flag,o_rh2m_min%name, "Min Relative humidity at 2m", "%" )
    10131340   type_ecri(1) = 't_max(X)'
    10141341   type_ecri(2) = 't_max(X)'
     
    10161343   type_ecri(4) = 't_max(X)'
    10171344   type_ecri(5) = 't_max(X)'
    1018  CALL histdef2d(iff,o_cape_max%flag,o_cape_max%name, "CAPE max.", "J/kg")
     1345   type_ecri(6) = 't_max(X)'
     1346   CALL histdef2d(iff,clef_stations(iff),o_rh2m_max%flag,o_rh2m_max%name, "Max Relative humidity at 2m", "%" )
     1347  ENDIF 
     1348
    10191349   type_ecri(:) = type_ecri_files(:)
    1020  CALL histdef3d(iff,o_upwd%flag,o_upwd%name, "saturated updraft", "kg/m2/s")
    1021  CALL histdef3d(iff,o_Ma%flag,o_Ma%name, "undilute adiab updraft", "kg/m2/s")
    1022  CALL histdef3d(iff,o_dnwd%flag,o_dnwd%name, "saturated downdraft", "kg/m2/s")
    1023  CALL histdef3d(iff,o_dnwd0%flag,o_dnwd0%name, "unsat. downdraft", "kg/m2/s")
    1024  CALL histdef3d(iff,o_mc%flag,o_mc%name, "Convective mass flux", "kg/m2/s")
    1025    type_ecri(1) = 'inst(X)'
    1026    type_ecri(2) = 'inst(X)'
    1027    type_ecri(3) = 'inst(X)'
    1028    type_ecri(4) = 'inst(X)'
    1029    type_ecri(5) = 'inst(X)'
    1030  CALL histdef2d(iff,o_ftime_con%flag,o_ftime_con%name, "Fraction of time convection Occurs", " ")
    1031    type_ecri(:) = type_ecri_files(:)
    1032      ENDIF !iflag_con .GE. 3
    1033 
    1034  CALL histdef2d(iff,o_s_pblh%flag,o_s_pblh%name, "Boundary Layer Height", "m")
    1035  CALL histdef2d(iff,o_s_pblt%flag,o_s_pblt%name, "t at Boundary Layer Height", "K")
    1036  CALL histdef2d(iff,o_s_lcl%flag,o_s_lcl%name, "Condensation level", "m")
    1037  CALL histdef2d(iff,o_s_therm%flag,o_s_therm%name, "Exces du thermique", "K")
    1038 !IM : Les champs suivants (s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
    1039 !CALL histdef2d(iff,o_s_capCL%flag,o_s_capCL%name, "Conv avlbl pot enerfor ABL", "J/m2" )
    1040 !CALL histdef2d(iff,o_s_oliqCL%flag,o_s_oliqCL%name, "Liq Water in BL", "kg/m2")
    1041 !CALL histdef2d(iff,o_s_cteiCL%flag,o_s_cteiCL%name, "Instability criteria(ABL)", "K")
    1042 !CALL histdef2d(iff,o_s_trmb1%flag,o_s_trmb1%name, "deep_cape(HBTM2)", "J/m2")
    1043 !CALL histdef2d(iff,o_s_trmb2%flag,o_s_trmb2%name, "inhibition (HBTM2)", "J/m2")
    1044 !CALL histdef2d(iff,o_s_trmb3%flag,o_s_trmb3%name, "Point Omega (HBTM2)", "m")
    1045 
    1046 ! Champs interpolles sur des niveaux de pression
    1047 
    1048    type_ecri(1) = 'inst(X)'
    1049    type_ecri(2) = 'inst(X)'
    1050    type_ecri(3) = 'inst(X)'
    1051    type_ecri(4) = 'inst(X)'
    1052    type_ecri(5) = 'inst(X)'
    1053 
    1054 ! Attention a reverifier
    1055 
    1056         ilev=0       
    1057         DO k=1, nlevSTD
    1058 !     IF(k.GE.2.AND.k.LE.12) bb2=clevSTD(k)
    1059      bb2=clevSTD(k)
    1060      IF(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")THEN
    1061       ilev=ilev+1
    1062       print*,'ilev k bb2 flag name ',ilev,k, bb2,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name
    1063  CALL histdef2d(iff,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name,"Zonal wind "//bb2//"hPa", "m/s")
    1064  CALL histdef2d(iff,o_vSTDlevs(ilev)%flag,o_vSTDlevs(ilev)%name,"Meridional wind "//bb2//"hPa", "m/s")
    1065  CALL histdef2d(iff,o_wSTDlevs(ilev)%flag,o_wSTDlevs(ilev)%name,"Vertical wind "//bb2//"hPa", "Pa/s")
    1066  CALL histdef2d(iff,o_zSTDlevs(ilev)%flag,o_zSTDlevs(ilev)%name,"Geopotential height "//bb2//"hPa", "m")
    1067  CALL histdef2d(iff,o_qSTDlevs(ilev)%flag,o_qSTDlevs(ilev)%name,"Specific humidity "//bb2//"hPa", "kg/kg" )
    1068  CALL histdef2d(iff,o_tSTDlevs(ilev)%flag,o_tSTDlevs(ilev)%name,"Temperature "//bb2//"hPa", "K")
    1069      ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")
    1070        ENDDO
    1071    type_ecri(:) = type_ecri_files(:)
    1072 
    1073  CALL histdef2d(iff,o_t_oce_sic%flag,o_t_oce_sic%name, "Temp mixte oce-sic", "K")
    1074 
    1075  IF (type_ocean=='slab') &
    1076      CALL histdef2d(iff,o_slab_bils%flag, o_slab_bils%name,"Bilan au sol sur ocean slab", "W/m2")
    1077 
    1078 ! Couplage conv-CL
    1079  IF (iflag_con.GE.3) THEN
    1080     IF (iflag_coupl>=1) THEN
    1081  CALL histdef2d(iff,o_ale_bl%flag,o_ale_bl%name, "ALE BL", "m2/s2")
    1082  CALL histdef2d(iff,o_alp_bl%flag,o_alp_bl%name, "ALP BL", "m2/s2")
    1083     ENDIF
    1084  ENDIF !(iflag_con.GE.3)
    1085 
    1086  CALL histdef2d(iff,o_weakinv%flag,o_weakinv%name, "Weak inversion", "-")
    1087  CALL histdef2d(iff,o_dthmin%flag,o_dthmin%name, "dTheta mini", "K/m")
    1088  CALL histdef2d(iff,o_rh2m%flag,o_rh2m%name, "Relative humidity at 2m", "%" )
    1089    type_ecri(1) = 't_min(X)'
    1090    type_ecri(2) = 't_min(X)'
    1091    type_ecri(3) = 't_min(X)'
    1092    type_ecri(4) = 't_min(X)'
    1093    type_ecri(5) = 't_min(X)'
    1094  CALL histdef2d(iff,o_rh2m_min%flag,o_rh2m_min%name, "Min Relative humidity at 2m", "%" )
     1350 CALL histdef2d(iff,clef_stations(iff),o_qsat2m%flag,o_qsat2m%name, "Saturant humidity at 2m", "%")
     1351 CALL histdef2d(iff,clef_stations(iff),o_tpot%flag,o_tpot%name, "Surface air potential temperature", "K")
     1352 CALL histdef2d(iff,clef_stations(iff), &
     1353o_tpote%flag,o_tpote%name, "Surface air equivalent potential temperature", "K")
     1354 CALL histdef2d(iff,clef_stations(iff),o_SWnetOR%flag,o_SWnetOR%name, "Sfce net SW radiation OR", "W/m2")
     1355 CALL histdef2d(iff,clef_stations(iff),o_SWdownOR%flag,o_SWdownOR%name, "Sfce incident SW radiation OR", "W/m2")
     1356 CALL histdef2d(iff,clef_stations(iff),o_LWdownOR%flag,o_LWdownOR%name, "Sfce incident LW radiation OR", "W/m2")
     1357 CALL histdef2d(iff,clef_stations(iff),o_snowl%flag,o_snowl%name, "Solid Large-scale Precip.", "kg/(m2*s)")
     1358
     1359 CALL histdef2d(iff,clef_stations(iff),o_solldown%flag,o_solldown%name, "Down. IR rad. at surface", "W/m2")
     1360 CALL histdef2d(iff,clef_stations(iff),o_dtsvdfo%flag,o_dtsvdfo%name, "Boundary-layer dTs(o)", "K/s")
     1361 CALL histdef2d(iff,clef_stations(iff),o_dtsvdft%flag,o_dtsvdft%name, "Boundary-layer dTs(t)", "K/s")
     1362 CALL histdef2d(iff,clef_stations(iff),o_dtsvdfg%flag,o_dtsvdfg%name, "Boundary-layer dTs(g)", "K/s")
     1363 CALL histdef2d(iff,clef_stations(iff),o_dtsvdfi%flag,o_dtsvdfi%name, "Boundary-layer dTs(g)", "K/s")
     1364 CALL histdef2d(iff,clef_stations(iff),o_rugs%flag,o_rugs%name, "rugosity", "-" )
     1365
     1366! Champs 3D:
     1367 CALL histdef3d(iff,clef_stations(iff),o_ec550aer%flag,o_ec550aer%name, "Extinction at 550nm", "m^-1")
     1368 CALL histdef3d(iff,clef_stations(iff),o_lwcon%flag,o_lwcon%name, "Cloud liquid water content", "kg/kg")
     1369 CALL histdef3d(iff,clef_stations(iff),o_iwcon%flag,o_iwcon%name, "Cloud ice water content", "kg/kg")
     1370 CALL histdef3d(iff,clef_stations(iff),o_temp%flag,o_temp%name, "Air temperature", "K" )
     1371 CALL histdef3d(iff,clef_stations(iff),o_theta%flag,o_theta%name, "Potential air temperature", "K" )
     1372 CALL histdef3d(iff,clef_stations(iff),o_ovap%flag,o_ovap%name, "Specific humidity", "kg/kg" )
     1373 CALL histdef3d(iff,clef_stations(iff), &
     1374o_ovapinit%flag,o_ovapinit%name, "Specific humidity (begin of timestep)", "kg/kg" )
     1375 CALL histdef3d(iff,clef_stations(iff), &
     1376o_geop%flag,o_geop%name, "Geopotential height", "m2/s2")
     1377 CALL histdef3d(iff,clef_stations(iff), &
     1378o_vitu%flag,o_vitu%name, "Zonal wind", "m/s" )
     1379 CALL histdef3d(iff,clef_stations(iff), &
     1380o_vitv%flag,o_vitv%name, "Meridional wind", "m/s" )
     1381 CALL histdef3d(iff,clef_stations(iff), &
     1382o_vitw%flag,o_vitw%name, "Vertical wind", "Pa/s" )
     1383 CALL histdef3d(iff,clef_stations(iff), &
     1384o_pres%flag,o_pres%name, "Air pressure", "Pa" )
     1385 CALL histdef3d(iff,clef_stations(iff), &
     1386o_paprs%flag,o_paprs%name, "Air pressure Inter-Couches", "Pa" )
     1387 CALL histdef3d(iff,clef_stations(iff), &
     1388o_mass%flag,o_mass%name, "Masse Couches", "kg/m2" )
     1389 CALL histdef3d(iff,clef_stations(iff), &
     1390o_zfull%flag,o_zfull%name, "Altitude of full pressure levels", "m" )
     1391 CALL histdef3d(iff,clef_stations(iff), &
     1392o_zhalf%flag,o_zhalf%name, "Altitude of half pressure levels", "m" )
     1393 CALL histdef3d(iff,clef_stations(iff), &
     1394o_rneb%flag,o_rneb%name, "Cloud fraction", "-")
     1395 CALL histdef3d(iff,clef_stations(iff), &
     1396o_rnebcon%flag,o_rnebcon%name, "Convective Cloud Fraction", "-")
     1397 CALL histdef3d(iff,clef_stations(iff), &
     1398o_rhum%flag,o_rhum%name, "Relative humidity", "-")
     1399 CALL histdef3d(iff,clef_stations(iff), &
     1400o_ozone%flag,o_ozone%name, "Ozone mole fraction", "-")
     1401 if (read_climoz == 2) &
     1402      CALL histdef3d(iff,clef_stations(iff), &
     1403o_ozone_light%flag,o_ozone_light%name, &
     1404      "Daylight ozone mole fraction", "-")
     1405 CALL histdef3d(iff,clef_stations(iff), &
     1406o_dtphy%flag,o_dtphy%name, "Physics dT", "K/s")
     1407 CALL histdef3d(iff,clef_stations(iff), &
     1408o_dqphy%flag,o_dqphy%name, "Physics dQ", "(kg/kg)/s")
     1409 CALL histdef3d(iff,clef_stations(iff), &
     1410o_cldtau%flag,o_cldtau%name, "Cloud optical thickness", "1")
     1411 CALL histdef3d(iff,clef_stations(iff), &
     1412o_cldemi%flag,o_cldemi%name, "Cloud optical emissivity", "1")
     1413!IM: bug ?? dimensionnement variables (klon,klev+1) pmflxr, pmflxs, prfl, psfl
     1414 CALL histdef3d(iff,clef_stations(iff), &
     1415o_pr_con_l%flag,o_pr_con_l%name, "Convective precipitation lic", " ")
     1416 CALL histdef3d(iff,clef_stations(iff), &
     1417o_pr_con_i%flag,o_pr_con_i%name, "Convective precipitation ice", " ")
     1418 CALL histdef3d(iff,clef_stations(iff), &
     1419o_pr_lsc_l%flag,o_pr_lsc_l%name, "Large scale precipitation lic", " ")
     1420 CALL histdef3d(iff,clef_stations(iff), &
     1421o_pr_lsc_i%flag,o_pr_lsc_i%name, "Large scale precipitation ice", " ")
     1422!Cloud droplet effective radius
     1423 CALL histdef3d(iff,clef_stations(iff), &
     1424o_re%flag,o_re%name, "Cloud droplet effective radius","um")
     1425 CALL histdef3d(iff,clef_stations(iff), &
     1426o_fl%flag,o_fl%name, "Denominator of Cloud droplet effective radius"," ")
     1427!FH Sorties pour la couche limite
     1428     if (iflag_pbl>1) then
     1429 CALL histdef3d(iff,clef_stations(iff), &
     1430o_tke%flag,o_tke%name, "TKE", "m2/s2")
     1431  IF (.NOT.clef_stations(iff)) THEN
     1432!
     1433!IM: there is no way to have one single value in a netcdf file
     1434!
    10951435   type_ecri(1) = 't_max(X)'
    10961436   type_ecri(2) = 't_max(X)'
     
    10981438   type_ecri(4) = 't_max(X)'
    10991439   type_ecri(5) = 't_max(X)'
    1100  CALL histdef2d(iff,o_rh2m_max%flag,o_rh2m_max%name, "Max Relative humidity at 2m", "%" )
     1440   type_ecri(6) = 't_max(X)'
     1441   CALL histdef3d(iff,clef_stations(iff), &
     1442  o_tke_max%flag,o_tke_max%name, "TKE max", "m2/s2")
     1443  ENDIF
    11011444   type_ecri(:) = type_ecri_files(:)
    1102  CALL histdef2d(iff,o_qsat2m%flag,o_qsat2m%name, "Saturant humidity at 2m", "%")
    1103  CALL histdef2d(iff,o_tpot%flag,o_tpot%name, "Surface air potential temperature", "K")
    1104  CALL histdef2d(iff,o_tpote%flag,o_tpote%name, "Surface air equivalent potential temperature", "K")
    1105  CALL histdef2d(iff,o_SWnetOR%flag,o_SWnetOR%name, "Sfce net SW radiation OR", "W/m2")
    1106  CALL histdef2d(iff,o_SWdownOR%flag,o_SWdownOR%name, "Sfce incident SW radiation OR", "W/m2")
    1107  CALL histdef2d(iff,o_LWdownOR%flag,o_LWdownOR%name, "Sfce incident LW radiation OR", "W/m2")
    1108  CALL histdef2d(iff,o_snowl%flag,o_snowl%name, "Solid Large-scale Precip.", "kg/(m2*s)")
    1109 
    1110  CALL histdef2d(iff,o_solldown%flag,o_solldown%name, "Down. IR rad. at surface", "W/m2")
    1111  CALL histdef2d(iff,o_dtsvdfo%flag,o_dtsvdfo%name, "Boundary-layer dTs(o)", "K/s")
    1112  CALL histdef2d(iff,o_dtsvdft%flag,o_dtsvdft%name, "Boundary-layer dTs(t)", "K/s")
    1113  CALL histdef2d(iff,o_dtsvdfg%flag,o_dtsvdfg%name, "Boundary-layer dTs(g)", "K/s")
    1114  CALL histdef2d(iff,o_dtsvdfi%flag,o_dtsvdfi%name, "Boundary-layer dTs(g)", "K/s")
    1115  CALL histdef2d(iff,o_rugs%flag,o_rugs%name, "rugosity", "-" )
    1116 
    1117 ! Champs 3D:
    1118  CALL histdef3d(iff,o_ec550aer%flag,o_ec550aer%name, "Extinction at 550nm", "m^-1")
    1119  CALL histdef3d(iff,o_lwcon%flag,o_lwcon%name, "Cloud liquid water content", "kg/kg")
    1120  CALL histdef3d(iff,o_iwcon%flag,o_iwcon%name, "Cloud ice water content", "kg/kg")
    1121  CALL histdef3d(iff,o_temp%flag,o_temp%name, "Air temperature", "K" )
    1122  CALL histdef3d(iff,o_theta%flag,o_theta%name, "Potential air temperature", "K" )
    1123  CALL histdef3d(iff,o_ovap%flag,o_ovap%name, "Specific humidity", "kg/kg" )
    1124  CALL histdef3d(iff,o_ovapinit%flag,o_ovapinit%name, "Specific humidity (begin of timestep)", "kg/kg" )
    1125  CALL histdef3d(iff,o_geop%flag,o_geop%name, "Geopotential height", "m2/s2")
    1126  CALL histdef3d(iff,o_vitu%flag,o_vitu%name, "Zonal wind", "m/s" )
    1127  CALL histdef3d(iff,o_vitv%flag,o_vitv%name, "Meridional wind", "m/s" )
    1128  CALL histdef3d(iff,o_vitw%flag,o_vitw%name, "Vertical wind", "Pa/s" )
    1129  CALL histdef3d(iff,o_pres%flag,o_pres%name, "Air pressure", "Pa" )
    1130  CALL histdef3d(iff,o_paprs%flag,o_paprs%name, "Air pressure Inter-Couches", "Pa" )
    1131  CALL histdef3d(iff,o_mass%flag,o_mass%name, "Masse Couches", "kg/m2" )
    1132  CALL histdef3d(iff,o_rneb%flag,o_rneb%name, "Cloud fraction", "-")
    1133  CALL histdef3d(iff,o_rnebcon%flag,o_rnebcon%name, "Convective Cloud Fraction", "-")
    1134  CALL histdef3d(iff,o_rhum%flag,o_rhum%name, "Relative humidity", "-")
    1135  CALL histdef3d(iff,o_ozone%flag,o_ozone%name, "Ozone mole fraction", "-")
    1136  if (read_climoz == 2) &
    1137       CALL histdef3d(iff,o_ozone_light%flag,o_ozone_light%name, &
    1138       "Daylight ozone mole fraction", "-")
    1139  CALL histdef3d(iff,o_dtphy%flag,o_dtphy%name, "Physics dT", "K/s")
    1140  CALL histdef3d(iff,o_dqphy%flag,o_dqphy%name, "Physics dQ", "(kg/kg)/s")
    1141  CALL histdef3d(iff,o_cldtau%flag,o_cldtau%name, "Cloud optical thickness", "1")
    1142  CALL histdef3d(iff,o_cldemi%flag,o_cldemi%name, "Cloud optical emissivity", "1")
    1143 !IM: bug ?? dimensionnement variables (klon,klev+1) pmflxr, pmflxs, prfl, psfl
    1144  CALL histdef3d(iff,o_pr_con_l%flag,o_pr_con_l%name, "Convective precipitation lic", " ")
    1145  CALL histdef3d(iff,o_pr_con_i%flag,o_pr_con_i%name, "Convective precipitation ice", " ")
    1146  CALL histdef3d(iff,o_pr_lsc_l%flag,o_pr_lsc_l%name, "Large scale precipitation lic", " ")
    1147  CALL histdef3d(iff,o_pr_lsc_i%flag,o_pr_lsc_i%name, "Large scale precipitation ice", " ")
    1148 !Cloud droplet effective radius
    1149  CALL histdef3d(iff,o_re%flag,o_re%name, "Cloud droplet effective radius","um")
    1150  CALL histdef3d(iff,o_fl%flag,o_fl%name, "Denominator of Cloud droplet effective radius"," ")
    1151 !FH Sorties pour la couche limite
    1152      if (iflag_pbl>1) then
    1153  CALL histdef3d(iff,o_tke%flag,o_tke%name, "TKE", "m2/s2")
     1445     endif
     1446
     1447 CALL histdef3d(iff,clef_stations(iff), &
     1448o_kz%flag,o_kz%name, "Kz melange", "m2/s")
     1449  IF (.NOT.clef_stations(iff)) THEN
     1450!
     1451!IM: there is no way to have one single value in a netcdf file
     1452!
    11541453   type_ecri(1) = 't_max(X)'
    11551454   type_ecri(2) = 't_max(X)'
     
    11571456   type_ecri(4) = 't_max(X)'
    11581457   type_ecri(5) = 't_max(X)'
    1159  CALL histdef3d(iff,o_tke_max%flag,o_tke_max%name, "TKE max", "m2/s2")
     1458   type_ecri(6) = 't_max(X)'
     1459   CALL histdef3d(iff,clef_stations(iff), &
     1460   o_kz_max%flag,o_kz_max%name, "Kz melange max", "m2/s" )
     1461  ENDIF
    11601462   type_ecri(:) = type_ecri_files(:)
    1161      endif
    1162 
    1163  CALL histdef3d(iff,o_kz%flag,o_kz%name, "Kz melange", "m2/s")
    1164    type_ecri(1) = 't_max(X)'
    1165    type_ecri(2) = 't_max(X)'
    1166    type_ecri(3) = 't_max(X)'
    1167    type_ecri(4) = 't_max(X)'
    1168    type_ecri(5) = 't_max(X)'
    1169  CALL histdef3d(iff,o_kz_max%flag,o_kz_max%name, "Kz melange max", "m2/s" )
    1170    type_ecri(:) = type_ecri_files(:)
    1171  CALL histdef3d(iff,o_clwcon%flag,o_clwcon%name, "Convective Cloud Liquid water content", "kg/kg")
    1172  CALL histdef3d(iff,o_dtdyn%flag,o_dtdyn%name, "Dynamics dT", "K/s")
    1173  CALL histdef3d(iff,o_dqdyn%flag,o_dqdyn%name, "Dynamics dQ", "(kg/kg)/s")
    1174  CALL histdef3d(iff,o_dudyn%flag,o_dudyn%name, "Dynamics dU", "m/s2")
    1175  CALL histdef3d(iff,o_dvdyn%flag,o_dvdyn%name, "Dynamics dV", "m/s2")
    1176  CALL histdef3d(iff,o_dtcon%flag,o_dtcon%name, "Convection dT", "K/s")
    1177  CALL histdef3d(iff,o_ducon%flag,o_ducon%name, "Convection du", "m/s2")
    1178  CALL histdef3d(iff,o_dqcon%flag,o_dqcon%name, "Convection dQ", "(kg/kg)/s")
     1463 CALL histdef3d(iff,clef_stations(iff), &
     1464o_clwcon%flag,o_clwcon%name, "Convective Cloud Liquid water content", "kg/kg")
     1465 CALL histdef3d(iff,clef_stations(iff), &
     1466o_dtdyn%flag,o_dtdyn%name, "Dynamics dT", "K/s")
     1467 CALL histdef3d(iff,clef_stations(iff), &
     1468o_dqdyn%flag,o_dqdyn%name, "Dynamics dQ", "(kg/kg)/s")
     1469 CALL histdef3d(iff,clef_stations(iff), &
     1470o_dudyn%flag,o_dudyn%name, "Dynamics dU", "m/s2")
     1471 CALL histdef3d(iff,clef_stations(iff), &
     1472o_dvdyn%flag,o_dvdyn%name, "Dynamics dV", "m/s2")
     1473 CALL histdef3d(iff,clef_stations(iff), &
     1474o_dtcon%flag,o_dtcon%name, "Convection dT", "K/s")
     1475 CALL histdef3d(iff,clef_stations(iff), &
     1476o_ducon%flag,o_ducon%name, "Convection du", "m/s2")
     1477 CALL histdef3d(iff,clef_stations(iff), &
     1478o_dqcon%flag,o_dqcon%name, "Convection dQ", "(kg/kg)/s")
    11791479
    11801480! Wakes
    11811481 IF(iflag_con.EQ.3) THEN
    11821482 IF (iflag_wake >= 1) THEN
    1183    CALL histdef2d(iff,o_ale_wk%flag,o_ale_wk%name, "ALE WK", "m2/s2")
    1184    CALL histdef2d(iff,o_alp_wk%flag,o_alp_wk%name, "ALP WK", "m2/s2")
    1185    CALL histdef2d(iff,o_ale%flag,o_ale%name, "ALE", "m2/s2")
    1186    CALL histdef2d(iff,o_alp%flag,o_alp%name, "ALP", "W/m2")
    1187    CALL histdef2d(iff,o_cin%flag,o_cin%name, "Convective INhibition", "m2/s2")
    1188    CALL histdef2d(iff,o_wape%flag,o_WAPE%name, "WAPE", "m2/s2")
    1189    CALL histdef2d(iff,o_wake_h%flag,o_wake_h%name, "wake_h", "-")
    1190    CALL histdef2d(iff,o_wake_s%flag,o_wake_s%name, "wake_s", "-")
    1191    CALL histdef3d(iff,o_dtwak%flag,o_dtwak%name, "Wake dT", "K/s")
    1192    CALL histdef3d(iff,o_dqwak%flag,o_dqwak%name, "Wake dQ", "(kg/kg)/s")
    1193    CALL histdef3d(iff,o_wake_deltat%flag,o_wake_deltat%name, "wake_deltat", " ")
    1194    CALL histdef3d(iff,o_wake_deltaq%flag,o_wake_deltaq%name, "wake_deltaq", " ")
    1195    CALL histdef3d(iff,o_wake_omg%flag,o_wake_omg%name, "wake_omg", " ")
     1483   CALL histdef2d(iff,clef_stations(iff), &
     1484o_ale_wk%flag,o_ale_wk%name, "ALE WK", "m2/s2")
     1485   CALL histdef2d(iff,clef_stations(iff), &
     1486o_alp_wk%flag,o_alp_wk%name, "ALP WK", "m2/s2")
     1487   CALL histdef2d(iff,clef_stations(iff), &
     1488o_ale%flag,o_ale%name, "ALE", "m2/s2")
     1489   CALL histdef2d(iff,clef_stations(iff), &
     1490o_alp%flag,o_alp%name, "ALP", "W/m2")
     1491   CALL histdef2d(iff,clef_stations(iff),o_cin%flag,o_cin%name, "Convective INhibition", "m2/s2")
     1492   CALL histdef2d(iff,clef_stations(iff),o_wape%flag,o_WAPE%name, "WAPE", "m2/s2")
     1493   CALL histdef2d(iff,clef_stations(iff),o_wake_h%flag,o_wake_h%name, "wake_h", "-")
     1494   CALL histdef2d(iff,clef_stations(iff),o_wake_s%flag,o_wake_s%name, "wake_s", "-")
     1495   CALL histdef3d(iff,clef_stations(iff),o_dtwak%flag,o_dtwak%name, "Wake dT", "K/s")
     1496   CALL histdef3d(iff,clef_stations(iff),o_dqwak%flag,o_dqwak%name, "Wake dQ", "(kg/kg)/s")
     1497   CALL histdef3d(iff,clef_stations(iff),o_wake_deltat%flag,o_wake_deltat%name, "wake_deltat", " ")
     1498   CALL histdef3d(iff,clef_stations(iff),o_wake_deltaq%flag,o_wake_deltaq%name, "wake_deltaq", " ")
     1499   CALL histdef3d(iff,clef_stations(iff),o_wake_omg%flag,o_wake_omg%name, "wake_omg", " ")
    11961500 ENDIF
    1197    CALL histdef3d(iff,o_Vprecip%flag,o_Vprecip%name, "precipitation vertical profile", "-")
    1198    CALL histdef3d(iff,o_ftd%flag,o_ftd%name, "tend temp due aux descentes precip", "-")
    1199    CALL histdef3d(iff,o_fqd%flag,o_fqd%name,"tend vap eau due aux descentes precip", "-")
     1501   CALL histdef3d(iff,clef_stations(iff),o_Vprecip%flag,o_Vprecip%name, "precipitation vertical profile", "-")
     1502   CALL histdef3d(iff,clef_stations(iff),o_ftd%flag,o_ftd%name, "tend temp due aux descentes precip", "-")
     1503   CALL histdef3d(iff,clef_stations(iff),o_fqd%flag,o_fqd%name,"tend vap eau due aux descentes precip", "-")
    12001504 ENDIF !(iflag_con.EQ.3)
    12011505
    1202  CALL histdef3d(iff,o_dtlsc%flag,o_dtlsc%name, "Condensation dT", "K/s")
    1203  CALL histdef3d(iff,o_dtlschr%flag,o_dtlschr%name,"Large-scale condensational heating rate","K/s")
    1204  CALL histdef3d(iff,o_dqlsc%flag,o_dqlsc%name, "Condensation dQ", "(kg/kg)/s")
    1205  CALL histdef3d(iff,o_dtvdf%flag,o_dtvdf%name, "Boundary-layer dT", "K/s")
    1206  CALL histdef3d(iff,o_dqvdf%flag,o_dqvdf%name, "Boundary-layer dQ", "(kg/kg)/s")
    1207  CALL histdef3d(iff,o_dteva%flag,o_dteva%name, "Reevaporation dT", "K/s")
    1208  CALL histdef3d(iff,o_dqeva%flag,o_dqeva%name, "Reevaporation dQ", "(kg/kg)/s")
    1209  CALL histdef3d(iff,o_ptconv%flag,o_ptconv%name, "POINTS CONVECTIFS", " ")
    1210  CALL histdef3d(iff,o_ratqs%flag,o_ratqs%name, "RATQS", " ")
    1211  CALL histdef3d(iff,o_dtthe%flag,o_dtthe%name, "Dry adjust. dT", "K/s")
     1506 CALL histdef3d(iff,clef_stations(iff),o_dtlsc%flag,o_dtlsc%name, "Condensation dT", "K/s")
     1507 CALL histdef3d(iff,clef_stations(iff),o_dtlschr%flag,o_dtlschr%name,"Large-scale condensational heating rate","K/s")
     1508 CALL histdef3d(iff,clef_stations(iff),o_dqlsc%flag,o_dqlsc%name, "Condensation dQ", "(kg/kg)/s")
     1509 CALL histdef3d(iff,clef_stations(iff),o_dtvdf%flag,o_dtvdf%name, "Boundary-layer dT", "K/s")
     1510 CALL histdef3d(iff,clef_stations(iff),o_dqvdf%flag,o_dqvdf%name, "Boundary-layer dQ", "(kg/kg)/s")
     1511 CALL histdef3d(iff,clef_stations(iff),o_dteva%flag,o_dteva%name, "Reevaporation dT", "K/s")
     1512 CALL histdef3d(iff,clef_stations(iff),o_dqeva%flag,o_dqeva%name, "Reevaporation dQ", "(kg/kg)/s")
     1513 CALL histdef3d(iff,clef_stations(iff),o_ptconv%flag,o_ptconv%name, "POINTS CONVECTIFS", " ")
     1514 CALL histdef3d(iff,clef_stations(iff),o_ratqs%flag,o_ratqs%name, "RATQS", " ")
     1515 CALL histdef3d(iff,clef_stations(iff),o_dtthe%flag,o_dtthe%name, "Thermal dT", "K/s")
    12121516
    12131517if(iflag_thermals.gt.1) THEN
    1214  CALL histdef3d(iff,o_dqlscth%flag,o_dqlscth%name, "dQ therm.", "(kg/kg)/s")
    1215  CALL histdef3d(iff,o_dqlscst%flag,o_dqlscst%name, "dQ strat.", "(kg/kg)/s")
    1216  CALL histdef3d(iff,o_dtlscth%flag,o_dtlscth%name, "dQ therm.", "K/s")
    1217  CALL histdef3d(iff,o_dtlscst%flag,o_dtlscst%name, "dQ strat.", "K/s")
    1218  CALL histdef2d(iff,o_plulth%flag,o_plulth%name, "Rainfall therm.", "K/s")
    1219  CALL histdef2d(iff,o_plulst%flag,o_plulst%name, "Rainfall strat.", "K/s")
    1220  CALL histdef2d(iff,o_lmaxth%flag,o_lmaxth%name, "Upper level thermals", "")
    1221  CALL histdef3d(iff,o_ptconvth%flag,o_ptconvth%name, "POINTS CONVECTIFS therm.", " ")
    1222  CALL histdef3d(iff,o_f_th%flag,o_f_th%name, "Thermal plume mass flux", "K/s")
    1223  CALL histdef3d(iff,o_e_th%flag,o_e_th%name,"Thermal plume entrainment","K/s")
    1224  CALL histdef3d(iff,o_w_th%flag,o_w_th%name,"Thermal plume vertical velocity","m/s")
    1225  CALL histdef3d(iff,o_lambda_th%flag,o_lambda_th%name,"Thermal plume vertical velocity","m/s")
    1226  CALL histdef2d(iff,o_ftime_th%flag,o_ftime_th%name,"Fraction of time Shallow convection occurs"," ")
    1227  CALL histdef3d(iff,o_q_th%flag,o_q_th%name, "Thermal plume total humidity", "kg/kg")
    1228  CALL histdef3d(iff,o_a_th%flag,o_a_th%name, "Thermal plume fraction", "")
    1229  CALL histdef3d(iff,o_d_th%flag,o_d_th%name, "Thermal plume detrainment", "K/s")
    1230 !IM endif !iflag_thermals.gt.1
    1231  CALL histdef2d(iff,o_f0_th%flag,o_f0_th%name, "Thermal closure mass flux", "K/s")
    1232  CALL histdef2d(iff,o_zmax_th%flag,o_zmax_th%name, "Thermal plume height", "K/s")
    1233  CALL histdef3d(iff,o_dqthe%flag,o_dqthe%name, "Dry adjust. dQ", "(kg/kg)/s")
     1518 CALL histdef3d(iff,clef_stations(iff),o_dqlscth%flag,o_dqlscth%name, "dQ therm.", "(kg/kg)/s")
     1519 CALL histdef3d(iff,clef_stations(iff),o_dqlscst%flag,o_dqlscst%name, "dQ strat.", "(kg/kg)/s")
     1520 CALL histdef3d(iff,clef_stations(iff),o_dtlscth%flag,o_dtlscth%name, "dQ therm.", "K/s")
     1521 CALL histdef3d(iff,clef_stations(iff),o_dtlscst%flag,o_dtlscst%name, "dQ strat.", "K/s")
     1522 CALL histdef2d(iff,clef_stations(iff),o_plulth%flag,o_plulth%name, "Rainfall therm.", "K/s")
     1523 CALL histdef2d(iff,clef_stations(iff),o_plulst%flag,o_plulst%name, "Rainfall strat.", "K/s")
     1524 CALL histdef2d(iff,clef_stations(iff),o_lmaxth%flag,o_lmaxth%name, "Upper level thermals", "")
     1525 CALL histdef3d(iff,clef_stations(iff),o_ptconvth%flag,o_ptconvth%name, "POINTS CONVECTIFS therm.", " ")
     1526 CALL histdef3d(iff,clef_stations(iff),o_f_th%flag,o_f_th%name, "Thermal plume mass flux", "kg/(m2*s)")
     1527 CALL histdef3d(iff,clef_stations(iff),o_e_th%flag,o_e_th%name,"Thermal plume entrainment","K/s")
     1528 CALL histdef3d(iff,clef_stations(iff),o_w_th%flag,o_w_th%name,"Thermal plume vertical velocity","m/s")
     1529 CALL histdef3d(iff,clef_stations(iff), &
     1530o_lambda_th%flag,o_lambda_th%name,"Thermal plume vertical velocity","m/s")
     1531 CALL histdef2d(iff,clef_stations(iff), &
     1532o_ftime_th%flag,o_ftime_th%name,"Fraction of time Shallow convection occurs"," ")
     1533 CALL histdef3d(iff,clef_stations(iff), &
     1534o_q_th%flag,o_q_th%name, "Thermal plume total humidity", "kg/kg")
     1535 CALL histdef3d(iff,clef_stations(iff), &
     1536o_a_th%flag,o_a_th%name, "Thermal plume fraction", "")
     1537 CALL histdef3d(iff,clef_stations(iff), &
     1538o_d_th%flag,o_d_th%name, "Thermal plume detrainment", "K/s")
     1539
     1540 CALL histdef2d(iff,clef_stations(iff), &
     1541o_f0_th%flag,o_f0_th%name, "Thermal closure mass flux", "K/s")
     1542 CALL histdef2d(iff,clef_stations(iff), &
     1543o_zmax_th%flag,o_zmax_th%name, "Thermal plume height", "K/s")
     1544 CALL histdef3d(iff,clef_stations(iff), &
     1545o_dqthe%flag,o_dqthe%name, "Thermal dQ", "(kg/kg)/s")
    12341546endif !iflag_thermals.gt.1
    1235  CALL histdef3d(iff,o_dtajs%flag,o_dtajs%name, "Dry adjust. dT", "K/s")
    1236  CALL histdef3d(iff,o_dqajs%flag,o_dqajs%name, "Dry adjust. dQ", "(kg/kg)/s")
    1237  CALL histdef3d(iff,o_dtswr%flag,o_dtswr%name, "SW radiation dT", "K/s")
    1238  CALL histdef3d(iff,o_dtsw0%flag,o_dtsw0%name, "CS SW radiation dT", "K/s")
    1239  CALL histdef3d(iff,o_dtlwr%flag,o_dtlwr%name, "LW radiation dT", "K/s")
    1240  CALL histdef3d(iff,o_dtlw0%flag,o_dtlw0%name, "CS LW radiation dT", "K/s")
    1241  CALL histdef3d(iff,o_dtec%flag,o_dtec%name, "Cinetic dissip dT", "K/s")
    1242  CALL histdef3d(iff,o_duvdf%flag,o_duvdf%name, "Boundary-layer dU", "m/s2")
    1243  CALL histdef3d(iff,o_dvvdf%flag,o_dvvdf%name, "Boundary-layer dV", "m/s2")
     1547 CALL histdef3d(iff,clef_stations(iff), &
     1548o_dtajs%flag,o_dtajs%name, "Dry adjust. dT", "K/s")
     1549 CALL histdef3d(iff,clef_stations(iff), &
     1550o_dqajs%flag,o_dqajs%name, "Dry adjust. dQ", "(kg/kg)/s")
     1551 CALL histdef3d(iff,clef_stations(iff), &
     1552o_dtswr%flag,o_dtswr%name, "SW radiation dT", "K/s")
     1553 CALL histdef3d(iff,clef_stations(iff), &
     1554o_dtsw0%flag,o_dtsw0%name, "CS SW radiation dT", "K/s")
     1555 CALL histdef3d(iff,clef_stations(iff), &
     1556o_dtlwr%flag,o_dtlwr%name, "LW radiation dT", "K/s")
     1557 CALL histdef3d(iff,clef_stations(iff), &
     1558o_dtlw0%flag,o_dtlw0%name, "CS LW radiation dT", "K/s")
     1559 CALL histdef3d(iff,clef_stations(iff), &
     1560o_dtec%flag,o_dtec%name, "Cinetic dissip dT", "K/s")
     1561 CALL histdef3d(iff,clef_stations(iff), &
     1562o_duvdf%flag,o_duvdf%name, "Boundary-layer dU", "m/s2")
     1563 CALL histdef3d(iff,clef_stations(iff), &
     1564o_dvvdf%flag,o_dvvdf%name, "Boundary-layer dV", "m/s2")
    12441565
    12451566     IF (ok_orodr) THEN
    1246  CALL histdef3d(iff,o_duoro%flag,o_duoro%name, "Orography dU", "m/s2")
    1247  CALL histdef3d(iff,o_dvoro%flag,o_dvoro%name, "Orography dV", "m/s2")
     1567 CALL histdef3d(iff,clef_stations(iff), &
     1568o_duoro%flag,o_duoro%name, "Orography dU", "m/s2")
     1569 CALL histdef3d(iff,clef_stations(iff), &
     1570o_dvoro%flag,o_dvoro%name, "Orography dV", "m/s2")
     1571 CALL histdef3d(iff,clef_stations(iff), &
     1572o_dtoro%flag,o_dtoro%name, "Orography dT", "K/s")
    12481573     ENDIF
    12491574
    12501575     IF (ok_orolf) THEN
    1251  CALL histdef3d(iff,o_dulif%flag,o_dulif%name, "Orography dU", "m/s2")
    1252  CALL histdef3d(iff,o_dvlif%flag,o_dvlif%name, "Orography dV", "m/s2")
     1576 CALL histdef3d(iff,clef_stations(iff), &
     1577o_dulif%flag,o_dulif%name, "Orography dU", "m/s2")
     1578 CALL histdef3d(iff,clef_stations(iff), &
     1579o_dvlif%flag,o_dvlif%name, "Orography dV", "m/s2")
     1580 CALL histdef3d(iff,clef_stations(iff), &
     1581o_dtlif%flag,o_dtlif%name, "Orography dT", "K/s")
    12531582     ENDIF
     1583
     1584     IF (ok_hines) then
     1585 CALL histdef3d(iff,clef_stations(iff), &
     1586o_duhin%flag,o_duhin%name, "Hines GWD dU", "m/s2")
     1587 CALL histdef3d(iff,clef_stations(iff), &
     1588o_dvhin%flag,o_dvhin%name, "Hines GWD dV", "m/s2")
     1589
     1590 CALL histdef3d(iff,clef_stations(iff), &
     1591o_dthin%flag,o_dthin%name, "Hines GWD dT", "K/s")
     1592     ENDIF
     1593
     1594 CALL histdef3d(iff,clef_stations(iff), &
     1595o_rsu%flag,o_rsu%name, "SW upward radiation", "W m-2")
     1596 CALL histdef3d(iff,clef_stations(iff), &
     1597o_rsd%flag,o_rsd%name, "SW downward radiation", "W m-2")
     1598 CALL histdef3d(iff,clef_stations(iff), &
     1599o_rlu%flag,o_rlu%name, "LW upward radiation", "W m-2")
     1600 CALL histdef3d(iff,clef_stations(iff), &
     1601o_rld%flag,o_rld%name, "LW downward radiation", "W m-2")
     1602
     1603 CALL histdef3d(iff,clef_stations(iff), &
     1604o_rsucs%flag,o_rsucs%name, "SW CS upward radiation", "W m-2")
     1605 CALL histdef3d(iff,clef_stations(iff), &
     1606o_rsdcs%flag,o_rsdcs%name, "SW CS downward radiation", "W m-2")
     1607 CALL histdef3d(iff,clef_stations(iff), &
     1608o_rlucs%flag,o_rlucs%name, "LW CS upward radiation", "W m-2")
     1609 CALL histdef3d(iff,clef_stations(iff), &
     1610o_rldcs%flag,o_rldcs%name, "LW CS downward radiation", "W m-2")
     1611 
     1612 CALL histdef3d(iff,clef_stations(iff), &
     1613o_tnt%flag,o_tnt%name, "Tendency of air temperature", "K s-1")
     1614
     1615 CALL histdef3d(iff,clef_stations(iff), &
     1616o_tntc%flag,o_tntc%name, "Tendency of air temperature due to Moist Convection", &
     1617"K s-1")
     1618
     1619 CALL histdef3d(iff,clef_stations(iff), &
     1620o_tntr%flag,o_tntr%name, "Air temperature tendency due to Radiative heating", &
     1621"K s-1")
     1622
     1623 CALL histdef3d(iff,clef_stations(iff), &
     1624o_tntscpbl%flag,o_tntscpbl%name, "Air temperature tendency due to St cloud and precipitation and BL mixing", &
     1625"K s-1")
     1626
     1627 CALL histdef3d(iff,clef_stations(iff), &
     1628o_tnhus%flag,o_tnhus%name, "Tendency of specific humidity", "s-1")
     1629
     1630 CALL histdef3d(iff,clef_stations(iff), &
     1631o_tnhusc%flag,o_tnhusc%name, "Tendency of specific humidity due to convection", "s-1")
     1632
     1633 CALL histdef3d(iff,clef_stations(iff), &
     1634o_tnhusscpbl%flag,o_tnhusscpbl%name, "Tendency of Specific humidity due to ST cl, precip and BL mixing", &
     1635"s-1")
     1636
     1637 CALL histdef3d(iff,clef_stations(iff), &
     1638o_evu%flag,o_evu%name, "Eddy viscosity coefficient for Momentum Variables", "m2 s-1")
     1639
     1640 CALL histdef3d(iff,clef_stations(iff), &
     1641o_h2o%flag,o_h2o%name, "Mass Fraction of Water", "1")
     1642
     1643 CALL histdef3d(iff,clef_stations(iff), &
     1644o_mcd%flag,o_mcd%name, "Downdraft COnvective Mass Flux", "kg/(m2*s)")
     1645
     1646 CALL histdef3d(iff,clef_stations(iff), &
     1647o_dmc%flag,o_dmc%name, "Deep COnvective Mass Flux", "kg/(m2*s)")
     1648
     1649 CALL histdef3d(iff,clef_stations(iff), &
     1650o_ref_liq%flag,o_ref_liq%name, "Effective radius of convective cloud liquid water particle", "m")
     1651
     1652 CALL histdef3d(iff,clef_stations(iff), &
     1653o_ref_ice%flag,o_ref_ice%name, "Effective radius of startiform cloud ice particle", "m")
     1654
     1655   if (RCO2_per.NE.RCO2_act.OR.RCH4_per.NE.RCH4_act.OR. &
     1656    RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR. &
     1657    RCFC12_per.NE.RCFC12_act) THEN
     1658
     1659 CALL histdef2d(iff,clef_stations(iff),o_rsut4co2%flag,o_rsut4co2%name, &
     1660 "TOA Out SW in 4xCO2 atmosphere", "W/m2")
     1661CALL histdef2d(iff,clef_stations(iff),o_rlut4co2%flag,o_rlut4co2%name, &
     1662"TOA Out LW in 4xCO2 atmosphere", "W/m2")
     1663CALL histdef2d(iff,clef_stations(iff),o_rsutcs4co2%flag,o_rsutcs4co2%name, &
     1664"TOA Out CS SW in 4xCO2 atmosphere", "W/m2")
     1665CALL histdef2d(iff,clef_stations(iff),o_rlutcs4co2%flag,o_rlutcs4co2%name, &
     1666"TOA Out CS LW in 4xCO2 atmosphere", "W/m2")
     1667
     1668CALL histdef3d(iff,clef_stations(iff),o_rsu4co2%flag,o_rsu4co2%name, &
     1669"Upwelling SW 4xCO2 atmosphere", "W/m2")
     1670CALL histdef3d(iff,clef_stations(iff),o_rlu4co2%flag,o_rlu4co2%name, &
     1671"Upwelling LW 4xCO2 atmosphere", "W/m2")
     1672CALL histdef3d(iff,clef_stations(iff),o_rsucs4co2%flag,o_rsucs4co2%name, &
     1673"Upwelling CS SW 4xCO2 atmosphere", "W/m2")
     1674CALL histdef3d(iff,clef_stations(iff),o_rlucs4co2%flag,o_rlucs4co2%name, &
     1675"Upwelling CS LW 4xCO2 atmosphere", "W/m2")
     1676
     1677 CALL histdef3d(iff,clef_stations(iff),o_rsd4co2%flag,o_rsd4co2%name, &
     1678 "Downwelling SW 4xCO2 atmosphere", "W/m2")
     1679 CALL histdef3d(iff,clef_stations(iff),o_rld4co2%flag,o_rld4co2%name, &
     1680"Downwelling LW 4xCO2 atmosphere", "W/m2")
     1681 CALL histdef3d(iff,clef_stations(iff),o_rsdcs4co2%flag,o_rsdcs4co2%name, &
     1682"Downwelling CS SW 4xCO2 atmosphere", "W/m2")
     1683 CALL histdef3d(iff,clef_stations(iff),o_rldcs4co2%flag,o_rldcs4co2%name, &
     1684"Downwelling CS LW 4xCO2 atmosphere", "W/m2")
     1685
     1686   endif
    12541687
    12551688
     
    12571690     DO iq=3,nqtot 
    12581691       iiq=niadv(iq)
    1259        o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1 /),tname(iiq))
    1260        CALL histdef3d (iff, o_trac(iq-2)%flag,o_trac(iq-2)%name,'Tracer '//ttext(iiq), "-" )
     1692       o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1, 10 /),tname(iiq))
     1693       CALL histdef3d (iff,clef_stations(iff), &
     1694 o_trac(iq-2)%flag,o_trac(iq-2)%name,'Tracer '//ttext(iiq), "-" )
    12611695     ENDDO
    12621696    ENDIF
     
    12731707      end subroutine phys_output_open
    12741708
    1275       SUBROUTINE histdef2d (iff,flag_var,nomvar,titrevar,unitvar)
     1709      SUBROUTINE histdef2d (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
    12761710     
    12771711       use ioipsl
    12781712       USE dimphy
    12791713       USE mod_phys_lmdz_para
     1714       USE iophy
    12801715
    12811716       IMPLICIT NONE
     
    12871722
    12881723       integer                          :: iff
     1724       logical                          :: lpoint
    12891725       integer, dimension(nfiles)       :: flag_var
    12901726       character(len=20)                 :: nomvar
     
    13021738! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
    13031739       call conf_physoutputs(nomvar,flag_var)
    1304        
     1740     
     1741       if(.NOT.lpoint) THEN 
    13051742       if ( flag_var(iff)<=lev_files(iff) ) then
    13061743 call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
     
    13081745               type_ecri(iff), zstophym,zoutm(iff))               
    13091746       endif                     
     1747       else
     1748       if ( flag_var(iff)<=lev_files(iff) ) then
     1749 call histdef (nid_files(iff),nomvar,titrevar,unitvar, &
     1750               npstn,1,nhorim(iff), 1,1,1, -99, 32, &
     1751               type_ecri(iff), zstophym,zoutm(iff))               
     1752       endif                     
     1753       endif                     
    13101754      end subroutine histdef2d
    13111755
    1312       SUBROUTINE histdef3d (iff,flag_var,nomvar,titrevar,unitvar)
     1756      SUBROUTINE histdef3d (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
    13131757
    13141758       use ioipsl
    13151759       USE dimphy
    13161760       USE mod_phys_lmdz_para
     1761       USE iophy
    13171762
    13181763       IMPLICIT NONE
     
    13241769
    13251770       integer                          :: iff
     1771       logical                          :: lpoint
    13261772       integer, dimension(nfiles)       :: flag_var
    13271773       character(len=20)                 :: nomvar
     
    13401786       endif
    13411787
     1788       if(.NOT.lpoint) THEN
    13421789       if ( flag_var(iff)<=lev_files(iff) ) then
    13431790          call histdef (nid_files(iff), nomvar, titrevar, unitvar, &
     
    13451792               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, type_ecri(iff), &
    13461793               zstophym, zoutm(iff))
     1794       endif
     1795       else
     1796       if ( flag_var(iff)<=lev_files(iff) ) then
     1797          call histdef (nid_files(iff), nomvar, titrevar, unitvar, &
     1798               npstn,1,nhorim(iff), klev, levmin(iff), &
     1799               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, &
     1800               type_ecri(iff), zstophym,zoutm(iff))
     1801       endif
    13471802       endif
    13481803      end subroutine histdef3d
  • LMDZ5/trunk/libf/phylmd/phys_output_write.h

    r1518 r1539  
    99!!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1010       IF (o_phis%flag(iff)<=lev_files(iff)) THEN
    11          CALL histwrite_phy(nid_files(iff),
    12      $                      o_phis%name,itau_w,pphis)
    13        ENDIF
    14 
     11      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     12     $                  o_phis%name,itau_w,pphis)
     13       ENDIF
     14
     15       IF (.NOT.clef_stations(iff)) THEN
    1516       IF (o_aire%flag(iff)<=lev_files(iff)) THEN
    16        CALL histwrite_phy(nid_files(iff),o_aire%name,itau_w,airephy)
     17       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     18     $o_aire%name,itau_w,airephy)
    1719       ENDIF
    1820
     
    2123       zx_tmp_fi2d(i)=pctsrf(i,is_ter)+pctsrf(i,is_lic)
    2224      ENDDO
    23       CALL histwrite_phy(nid_files(iff),
     25      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    2426     $             o_contfracATM%name,itau_w,zx_tmp_fi2d)
    2527       ENDIF
     28       ENDIF
    2629
    2730       IF (o_contfracOR%flag(iff)<=lev_files(iff)) THEN
    28       CALL histwrite_phy(nid_files(iff),o_contfracOR%name,itau_w,
    29      $                   pctsrf(:,is_ter))
     31      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     32     $                  o_contfracOR%name,itau_w,pctsrf(:,is_ter))
    3033       ENDIF
    3134
    3235       IF (o_aireTER%flag(iff)<=lev_files(iff)) THEN
    33       CALL histwrite_phy(nid_files(iff),
     36      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    3437     $                  o_aireTER%name,itau_w,paire_ter)
    3538       ENDIF
     
    3841
    3942       IF (o_flat%flag(iff)<=lev_files(iff)) THEN
    40       CALL histwrite_phy(nid_files(iff),o_flat%name,itau_w,zxfluxlat)
     43      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     44     $                  o_flat%name,itau_w,zxfluxlat)
    4145       ENDIF
    4246
    4347       IF (o_slp%flag(iff)<=lev_files(iff)) THEN
    44       CALL histwrite_phy(nid_files(iff),o_slp%name,itau_w,slp)
     48      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     49     $                  o_slp%name,itau_w,slp)
    4550       ENDIF
    4651
    4752       IF (o_tsol%flag(iff)<=lev_files(iff)) THEN
    48       CALL histwrite_phy(nid_files(iff),o_tsol%name,itau_w,zxtsol)
     53      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     54     $                  o_tsol%name,itau_w,zxtsol)
    4955       ENDIF
    5056
    5157       IF (o_t2m%flag(iff)<=lev_files(iff)) THEN
    52       CALL histwrite_phy(nid_files(iff),o_t2m%name,itau_w,zt2m)
    53        ENDIF
    54 
     58      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     59     $                  o_t2m%name,itau_w,zt2m)
     60       ENDIF
     61
     62      IF (.NOT.clef_stations(iff)) THEN
    5563       IF (o_t2m_min%flag(iff)<=lev_files(iff)) THEN
    56       CALL histwrite_phy(nid_files(iff),o_t2m_min%name,itau_w,zt2m)
     64      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     65     $o_t2m_min%name,itau_w,zt2m)
    5766       ENDIF
    5867
    5968       IF (o_t2m_max%flag(iff)<=lev_files(iff)) THEN
    60       CALL histwrite_phy(nid_files(iff),o_t2m_max%name,itau_w,zt2m)
     69      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     70     $o_t2m_max%name,itau_w,zt2m)
     71       ENDIF
    6172       ENDIF
    6273
     
    6576       zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
    6677      ENDDO
    67       CALL histwrite_phy(nid_files(iff),
     78      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    6879     s                  o_wind10m%name,itau_w,zx_tmp_fi2d)
    6980       ENDIF
    7081
     82      IF (.NOT.clef_stations(iff)) THEN
    7183       IF (o_wind10max%flag(iff)<=lev_files(iff)) THEN
    7284      DO i=1, klon
    7385       zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
    7486      ENDDO
    75       CALL histwrite_phy(nid_files(iff),o_wind10max%name,
    76      $                   itau_w,zx_tmp_fi2d)
    77        ENDIF
     87      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     88     $o_wind10max%name,itau_w,zx_tmp_fi2d)
     89       ENDIF
     90      ENDIF
    7891
    7992       IF (o_sicf%flag(iff)<=lev_files(iff)) THEN
     
    8194         zx_tmp_fi2d(i) = pctsrf(i,is_sic)
    8295      ENDDO
    83       CALL histwrite_phy(nid_files(iff),
     96      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    8497     $                   o_sicf%name,itau_w,zx_tmp_fi2d)
    8598       ENDIF
    8699
    87100       IF (o_q2m%flag(iff)<=lev_files(iff)) THEN
    88       CALL histwrite_phy(nid_files(iff),o_q2m%name,itau_w,zq2m)
     101      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     102     $o_q2m%name,itau_w,zq2m)
    89103       ENDIF
    90104
    91105       IF (o_u10m%flag(iff)<=lev_files(iff)) THEN
    92       CALL histwrite_phy(nid_files(iff),o_u10m%name,itau_w,zu10m)
     106      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     107     $o_u10m%name,itau_w,zu10m)
    93108       ENDIF
    94109
    95110       IF (o_v10m%flag(iff)<=lev_files(iff)) THEN
    96       CALL histwrite_phy(nid_files(iff),o_v10m%name,itau_w,zv10m)
     111      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     112     $o_v10m%name,itau_w,zv10m)
    97113       ENDIF
    98114
     
    101117         zx_tmp_fi2d(i) = paprs(i,1)
    102118      ENDDO
    103       CALL histwrite_phy(nid_files(iff),
     119      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    104120     s                   o_psol%name,itau_w,zx_tmp_fi2d)
    105121       ENDIF
    106122
    107123       IF (o_mass%flag(iff)<=lev_files(iff)) THEN
    108       CALL histwrite_phy(nid_files(iff),o_mass%name,itau_w,zmasse)
     124      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     125     s                   o_mass%name,itau_w,zmasse)
    109126        ENDIF
    110127
    111128
    112129       IF (o_qsurf%flag(iff)<=lev_files(iff)) THEN
    113       CALL histwrite_phy(nid_files(iff),o_qsurf%name,itau_w,zxqsurf)
     130      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     131     $o_qsurf%name,itau_w,zxqsurf)
    114132       ENDIF
    115133
    116134       if (.not. ok_veget) then
    117135         IF (o_qsol%flag(iff)<=lev_files(iff)) THEN
    118         CALL histwrite_phy(nid_files(iff),o_qsol%name,itau_w,qsol)
     136        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     137     $o_qsol%name,itau_w,qsol)
    119138         ENDIF
    120139       endif
     
    124143         zx_tmp_fi2d(i) = rain_fall(i) + snow_fall(i)
    125144       ENDDO
    126       CALL histwrite_phy(nid_files(iff),o_precip%name,
    127      s                   itau_w,zx_tmp_fi2d)
     145      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     146     $o_precip%name,itau_w,zx_tmp_fi2d)
    128147      ENDIF
    129148
    130149       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)
     150      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     151     $o_ndayrain%name,itau_w,nday_rain)
    133152       ENDIF
    134153
     
    137156         zx_tmp_fi2d(i) = rain_lsc(i) + snow_lsc(i)
    138157       ENDDO
    139       CALL histwrite_phy(nid_files(iff),o_plul%name,itau_w,zx_tmp_fi2d)
     158      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     159     $o_plul%name,itau_w,zx_tmp_fi2d)
    140160      ENDIF
    141161
     
    144164         zx_tmp_fi2d(i) = rain_con(i) + snow_con(i)
    145165      ENDDO
    146       CALL histwrite_phy(nid_files(iff),o_pluc%name,itau_w,zx_tmp_fi2d)
     166      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     167     $o_pluc%name,itau_w,zx_tmp_fi2d)
    147168      ENDIF
    148169
    149170       IF (o_snow%flag(iff)<=lev_files(iff)) THEN
    150       CALL histwrite_phy(nid_files(iff),o_snow%name,itau_w,snow_fall)
     171      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     172     $o_snow%name,itau_w,snow_fall)
    151173       ENDIF
    152174
    153175       IF (o_msnow%flag(iff)<=lev_files(iff)) THEN
    154       CALL histwrite_phy(nid_files(iff),o_msnow%name,itau_w,snow_o)
     176      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     177     $o_msnow%name,itau_w,snow_o)
    155178       ENDIF
    156179
    157180       IF (o_fsnow%flag(iff)<=lev_files(iff)) THEN
    158       CALL histwrite_phy(nid_files(iff),o_fsnow%name,itau_w,zfra_o)
     181      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     182     $o_fsnow%name,itau_w,zfra_o)
    159183       ENDIF
    160184
    161185       IF (o_evap%flag(iff)<=lev_files(iff)) THEN
    162       CALL histwrite_phy(nid_files(iff),o_evap%name,itau_w,evap)
     186      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     187     $o_evap%name,itau_w,evap)
    163188       ENDIF
    164189
    165190       IF (o_tops%flag(iff)<=lev_files(iff)) THEN
    166       CALL histwrite_phy(nid_files(iff),o_tops%name,itau_w,topsw)
     191      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     192     $o_tops%name,itau_w,topsw)
    167193       ENDIF
    168194
    169195       IF (o_tops0%flag(iff)<=lev_files(iff)) THEN
    170       CALL histwrite_phy(nid_files(iff),o_tops0%name,itau_w,topsw0)
     196      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     197     $o_tops0%name,itau_w,topsw0)
    171198       ENDIF
    172199
    173200       IF (o_topl%flag(iff)<=lev_files(iff)) THEN
    174       CALL histwrite_phy(nid_files(iff),o_topl%name,itau_w,toplw)
     201      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     202     $o_topl%name,itau_w,toplw)
    175203       ENDIF
    176204
    177205       IF (o_topl0%flag(iff)<=lev_files(iff)) THEN
    178       CALL histwrite_phy(nid_files(iff),o_topl0%name,itau_w,toplw0)
     206      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     207     $o_topl0%name,itau_w,toplw0)
    179208       ENDIF
    180209
    181210       IF (o_SWupTOA%flag(iff)<=lev_files(iff)) THEN
    182211      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, klevp1 )
    183       CALL histwrite_phy(nid_files(iff),o_SWupTOA%name,
    184      s                     itau_w,zx_tmp_fi2d)
     212      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     213     $o_SWupTOA%name,itau_w,zx_tmp_fi2d)
    185214       ENDIF
    186215
    187216       IF (o_SWupTOAclr%flag(iff)<=lev_files(iff)) THEN
    188217      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, klevp1 )
    189       CALL histwrite_phy(nid_files(iff),
     218      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    190219     $                  o_SWupTOAclr%name,itau_w,zx_tmp_fi2d)
    191220       ENDIF
     
    193222       IF (o_SWdnTOA%flag(iff)<=lev_files(iff)) THEN
    194223      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, klevp1 )
    195       CALL histwrite_phy(nid_files(iff),
     224      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    196225     s                  o_SWdnTOA%name,itau_w,zx_tmp_fi2d)
    197226       ENDIF
     
    199228       IF (o_SWdnTOAclr%flag(iff)<=lev_files(iff)) THEN
    200229      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, klevp1 )
    201       CALL histwrite_phy(nid_files(iff),
     230      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    202231     $                  o_SWdnTOAclr%name,itau_w,zx_tmp_fi2d)
    203232       ENDIF
     
    205234       IF (o_nettop%flag(iff)<=lev_files(iff)) THEN
    206235      zx_tmp_fi2d(:) = topsw(:)-toplw(:)
    207       CALL histwrite_phy(nid_files(iff),
     236      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    208237     $                  o_nettop%name,itau_w,zx_tmp_fi2d)
    209238       ENDIF
    210239
    211240       IF (o_SWup200%flag(iff)<=lev_files(iff)) THEN
    212       CALL histwrite_phy(nid_files(iff),o_SWup200%name,itau_w,SWup200)
     241      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     242     $o_SWup200%name,itau_w,SWup200)
    213243       ENDIF
    214244
    215245       IF (o_SWup200clr%flag(iff)<=lev_files(iff)) THEN
    216       CALL histwrite_phy(nid_files(iff),
     246      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    217247     s                   o_SWup200clr%name,itau_w,SWup200clr)
    218248       ENDIF
    219249
    220250       IF (o_SWdn200%flag(iff)<=lev_files(iff)) THEN
    221       CALL histwrite_phy(nid_files(iff),o_SWdn200%name,itau_w,SWdn200)
     251      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     252     $o_SWdn200%name,itau_w,SWdn200)
    222253       ENDIF
    223254
    224255       IF (o_SWdn200clr%flag(iff)<=lev_files(iff)) THEN
    225       CALL histwrite_phy(nid_files(iff),
     256      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    226257     s                o_SWdn200clr%name,itau_w,SWdn200clr)
    227258       ENDIF
    228259
    229260       IF (o_LWup200%flag(iff)<=lev_files(iff)) THEN
    230       CALL histwrite_phy(nid_files(iff),o_LWup200%name,itau_w,LWup200)
     261      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     262     $o_LWup200%name,itau_w,LWup200)
    231263       ENDIF
    232264
    233265       IF (o_LWup200clr%flag(iff)<=lev_files(iff)) THEN
    234       CALL histwrite_phy(nid_files(iff),
     266      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    235267     s                   o_LWup200clr%name,itau_w,LWup200clr)
    236268       ENDIF
    237269
    238270       IF (o_LWdn200%flag(iff)<=lev_files(iff)) THEN
    239       CALL histwrite_phy(nid_files(iff),
     271      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    240272     s                   o_LWdn200%name,itau_w,LWdn200)
    241273       ENDIF
    242274
    243275       IF (o_LWdn200clr%flag(iff)<=lev_files(iff)) THEN
    244       CALL histwrite_phy(nid_files(iff),
     276      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    245277     s                  o_LWdn200clr%name,itau_w,LWdn200clr)
    246278       ENDIF
    247279
    248280       IF (o_sols%flag(iff)<=lev_files(iff)) THEN
    249       CALL histwrite_phy(nid_files(iff),o_sols%name,itau_w,solsw)
     281      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     282     $o_sols%name,itau_w,solsw)
    250283       ENDIF
    251284
    252285       IF (o_sols0%flag(iff)<=lev_files(iff)) THEN
    253       CALL histwrite_phy(nid_files(iff),o_sols0%name,itau_w,solsw0)
     286      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     287     $o_sols0%name,itau_w,solsw0)
    254288       ENDIF
    255289
    256290       IF (o_soll%flag(iff)<=lev_files(iff)) THEN
    257       CALL histwrite_phy(nid_files(iff),o_soll%name,itau_w,sollw)
     291      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     292     $o_soll%name,itau_w,sollw)
    258293       ENDIF
    259294
    260295       IF (o_radsol%flag(iff)<=lev_files(iff)) THEN
    261       CALL histwrite_phy(nid_files(iff),o_radsol%name,itau_w,radsol)
     296      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     297     $o_radsol%name,itau_w,radsol)
    262298       ENDIF
    263299
    264300       IF (o_soll0%flag(iff)<=lev_files(iff)) THEN
    265       CALL histwrite_phy(nid_files(iff),o_soll0%name,itau_w,sollw0)
     301      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     302     $o_soll0%name,itau_w,sollw0)
    266303       ENDIF
    267304
    268305       IF (o_SWupSFC%flag(iff)<=lev_files(iff)) THEN
    269306      zx_tmp_fi2d(1 : klon) = swup ( 1 : klon, 1 )
    270       CALL histwrite_phy(nid_files(iff),
     307      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    271308     s               o_SWupSFC%name,itau_w,zx_tmp_fi2d)
    272309       ENDIF
     
    274311       IF (o_SWupSFCclr%flag(iff)<=lev_files(iff)) THEN
    275312      zx_tmp_fi2d(1 : klon) = swup0 ( 1 : klon, 1 )
    276       CALL histwrite_phy(nid_files(iff),
     313      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    277314     $                   o_SWupSFCclr%name,itau_w,zx_tmp_fi2d)
    278315       ENDIF
     
    280317       IF (o_SWdnSFC%flag(iff)<=lev_files(iff)) THEN
    281318      zx_tmp_fi2d(1 : klon) = swdn ( 1 : klon, 1 )
    282       CALL histwrite_phy(nid_files(iff),
     319      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    283320     $                   o_SWdnSFC%name,itau_w,zx_tmp_fi2d)
    284321       ENDIF
     
    286323       IF (o_SWdnSFCclr%flag(iff)<=lev_files(iff)) THEN
    287324      zx_tmp_fi2d(1 : klon) = swdn0 ( 1 : klon, 1 )
    288       CALL histwrite_phy(nid_files(iff),
     325      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    289326     $                  o_SWdnSFCclr%name,itau_w,zx_tmp_fi2d)
    290327       ENDIF
     
    292329       IF (o_LWupSFC%flag(iff)<=lev_files(iff)) THEN
    293330      zx_tmp_fi2d(1:klon)=sollwdown(1:klon)-sollw(1:klon)
    294       CALL histwrite_phy(nid_files(iff),
     331      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    295332     $                    o_LWupSFC%name,itau_w,zx_tmp_fi2d)
    296333       ENDIF
    297334
    298335       IF (o_LWdnSFC%flag(iff)<=lev_files(iff)) THEN
    299       CALL histwrite_phy(nid_files(iff),
     336      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    300337     $                   o_LWdnSFC%name,itau_w,sollwdown)
    301338       ENDIF
     
    304341       IF (o_LWupSFCclr%flag(iff)<=lev_files(iff)) THEN
    305342      zx_tmp_fi2d(1:klon)=sollwdownclr(1:klon)-sollw0(1:klon)
    306       CALL histwrite_phy(nid_files(iff),
     343      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    307344     $                   o_LWupSFCclr%name,itau_w,zx_tmp_fi2d)
    308345       ENDIF
    309346
    310347       IF (o_LWdnSFCclr%flag(iff)<=lev_files(iff)) THEN
    311       CALL histwrite_phy(nid_files(iff),
     348      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    312349     $                   o_LWdnSFCclr%name,itau_w,sollwdownclr)
    313350       ENDIF
    314351
    315352       IF (o_bils%flag(iff)<=lev_files(iff)) THEN
    316       CALL histwrite_phy(nid_files(iff),o_bils%name,itau_w,bils)
     353      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     354     $o_bils%name,itau_w,bils)
    317355       ENDIF
    318356
    319357       IF (o_sens%flag(iff)<=lev_files(iff)) THEN
    320358      zx_tmp_fi2d(1:klon)=-1*sens(1:klon)
    321       CALL histwrite_phy(nid_files(iff),o_sens%name,itau_w,zx_tmp_fi2d)
     359      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     360     $o_sens%name,itau_w,zx_tmp_fi2d)
    322361       ENDIF
    323362
    324363       IF (o_fder%flag(iff)<=lev_files(iff)) THEN
    325       CALL histwrite_phy(nid_files(iff),o_fder%name,itau_w,fder)
     364      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     365     $o_fder%name,itau_w,fder)
    326366       ENDIF
    327367
    328368       IF (o_ffonte%flag(iff)<=lev_files(iff)) THEN
    329        CALL histwrite_phy(nid_files(iff),o_ffonte%name,itau_w,zxffonte)
     369       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     370     $o_ffonte%name,itau_w,zxffonte)
    330371       ENDIF
    331372
    332373       IF (o_fqcalving%flag(iff)<=lev_files(iff)) THEN
    333        CALL histwrite_phy(nid_files(iff),
     374       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    334375     $                    o_fqcalving%name,itau_w,zxfqcalving)
    335376       ENDIF
    336377
    337378       IF (o_fqfonte%flag(iff)<=lev_files(iff)) THEN
    338        CALL histwrite_phy(nid_files(iff),
     379       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    339380     $                   o_fqfonte%name,itau_w,zxfqfonte)
    340381       ENDIF
     
    345386          zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+pctsrf(:,nsrf)*fluxu(:,1,nsrf)
    346387         enddo
    347          CALL histwrite_phy(nid_files(iff),
     388         CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    348389     $                   o_taux%name,itau_w,zx_tmp_fi2d)
    349390       ENDIF
     
    354395          zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+pctsrf(:,nsrf)*fluxv(:,1,nsrf)
    355396         enddo
    356          CALL histwrite_phy(nid_files(iff),
     397         CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    357398     $                   o_tauy%name,itau_w,zx_tmp_fi2d)
    358399       ENDIF
     
    363404            zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)*100.
    364405            CALL histwrite_phy(nid_files(iff),
     406     $                     clef_stations(iff),
    365407     $                     o_pourc_srf(nsrf)%name,itau_w,
    366408     $                     zx_tmp_fi2d)
     
    369411          IF (o_fract_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    370412          zx_tmp_fi2d(1 : klon) = pctsrf( 1 : klon, nsrf)
    371           CALL histwrite_phy(nid_files(iff),
     413          CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    372414     $                  o_fract_srf(nsrf)%name,itau_w,
    373415     $                  zx_tmp_fi2d)
     
    377419        IF (o_taux_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    378420        zx_tmp_fi2d(1 : klon) = fluxu( 1 : klon, 1, nsrf)
    379         CALL histwrite_phy(nid_files(iff),
     421        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    380422     $                     o_taux_srf(nsrf)%name,itau_w,
    381423     $                     zx_tmp_fi2d)
     
    384426        IF (o_tauy_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN           
    385427        zx_tmp_fi2d(1 : klon) = fluxv( 1 : klon, 1, nsrf)
    386         CALL histwrite_phy(nid_files(iff),
     428        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    387429     $                    o_tauy_srf(nsrf)%name,itau_w,
    388430     $                    zx_tmp_fi2d)
     
    391433        IF (o_tsol_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    392434        zx_tmp_fi2d(1 : klon) = ftsol( 1 : klon, nsrf)
    393         CALL histwrite_phy(nid_files(iff),
     435        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    394436     $                   o_tsol_srf(nsrf)%name,itau_w,
    395437     $      zx_tmp_fi2d)
     
    398440      IF (o_u10m_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    399441      zx_tmp_fi2d(1 : klon) = u10m(1 : klon, nsrf)
    400       CALL histwrite_phy(nid_files(iff),o_u10m_srf(nsrf)%name,
     442      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     443     $o_u10m_srf(nsrf)%name,
    401444     $                 itau_w,zx_tmp_fi2d)
    402445      ENDIF
     
    404447      IF (o_v10m_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    405448      zx_tmp_fi2d(1 : klon) = v10m(1 : klon, nsrf)
    406       CALL histwrite_phy(nid_files(iff),o_v10m_srf(nsrf)%name,
     449      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     450     $o_v10m_srf(nsrf)%name,
    407451     $              itau_w,zx_tmp_fi2d)
    408452      ENDIF
     
    410454      IF (o_t2m_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    411455      zx_tmp_fi2d(1 : klon) = t2m(1 : klon, nsrf)
    412       CALL histwrite_phy(nid_files(iff),o_t2m_srf(nsrf)%name,
     456      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     457     $o_t2m_srf(nsrf)%name,
    413458     $           itau_w,zx_tmp_fi2d)
    414459      ENDIF
     
    416461      IF (o_evap_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    417462      zx_tmp_fi2d(1 : klon) = fevap(1 : klon, nsrf)
    418       CALL histwrite_phy(nid_files(iff),o_evap_srf(nsrf)%name,
     463      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     464     $o_evap_srf(nsrf)%name,
    419465     $           itau_w,zx_tmp_fi2d)
    420466      ENDIF
     
    422468       IF (o_sens_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    423469       zx_tmp_fi2d(1 : klon) = fluxt( 1 : klon, 1, nsrf)
    424        CALL histwrite_phy(nid_files(iff),
     470       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    425471     $                    o_sens_srf(nsrf)%name,itau_w,
    426472     $      zx_tmp_fi2d)
     
    429475        IF (o_lat_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    430476        zx_tmp_fi2d(1 : klon) = fluxlat( 1 : klon, nsrf)
    431         CALL histwrite_phy(nid_files(iff),
     477        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    432478     $                 o_lat_srf(nsrf)%name,itau_w,
    433479     $                                   zx_tmp_fi2d)
     
    436482        IF (o_flw_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    437483        zx_tmp_fi2d(1 : klon) = fsollw( 1 : klon, nsrf)
    438         CALL histwrite_phy(nid_files(iff),
     484        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    439485     $                     o_flw_srf(nsrf)%name,itau_w,
    440486     $      zx_tmp_fi2d)
     
    443489        IF (o_fsw_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    444490        zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, nsrf)
    445         CALL histwrite_phy(nid_files(iff),
     491        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    446492     $                   o_fsw_srf(nsrf)%name,itau_w,
    447493     $      zx_tmp_fi2d)
     
    450496        IF (o_wbils_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    451497        zx_tmp_fi2d(1 : klon) = wfbils( 1 : klon, nsrf)
    452         CALL histwrite_phy(nid_files(iff),
     498        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    453499     $                   o_wbils_srf(nsrf)%name,itau_w,
    454500     $      zx_tmp_fi2d)
     
    457503        IF (o_wbilo_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    458504        zx_tmp_fi2d(1 : klon) = wfbilo( 1 : klon, nsrf)
    459         CALL histwrite_phy(nid_files(iff),
     505        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    460506     $                    o_wbilo_srf(nsrf)%name,itau_w,
    461507     $      zx_tmp_fi2d)
     
    464510       if (iflag_pbl>1 .and. lev_histday.gt.10 ) then
    465511        IF (o_tke_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    466         CALL histwrite_phy(nid_files(iff),
     512        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    467513     $                   o_tke_srf(nsrf)%name,itau_w,
    468514     $                    pbl_tke(:,1:klev,nsrf))
    469515       ENDIF
    470516
     517      IF (.NOT.clef_stations(iff)) THEN
    471518        IF (o_tke_max_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    472         CALL histwrite_phy(nid_files(iff),
     519        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    473520     $                    o_tke_max_srf(nsrf)%name,itau_w,
    474521     $      pbl_tke(:,1:klev,nsrf))
    475522        ENDIF
     523      ENDIF
    476524       endif
    477525      ENDDO
    478526
    479527        IF (o_cdrm%flag(iff)<=lev_files(iff)) THEN
    480       CALL histwrite_phy(nid_files(iff),o_cdrm%name,itau_w,cdragm)
     528      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     529     $o_cdrm%name,itau_w,cdragm)
    481530        ENDIF
    482531
    483532        IF (o_cdrh%flag(iff)<=lev_files(iff)) THEN
    484       CALL histwrite_phy(nid_files(iff),o_cdrh%name,itau_w,cdragh)
     533      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     534     $o_cdrh%name,itau_w,cdragh)
    485535        ENDIF
    486536
    487537        IF (o_cldl%flag(iff)<=lev_files(iff)) THEN
    488       CALL histwrite_phy(nid_files(iff),o_cldl%name,itau_w,cldl)
     538      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     539     $o_cldl%name,itau_w,cldl)
    489540        ENDIF
    490541
    491542        IF (o_cldm%flag(iff)<=lev_files(iff)) THEN
    492       CALL histwrite_phy(nid_files(iff),o_cldm%name,itau_w,cldm)
     543      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     544     $o_cldm%name,itau_w,cldm)
    493545        ENDIF
    494546
    495547        IF (o_cldh%flag(iff)<=lev_files(iff)) THEN
    496       CALL histwrite_phy(nid_files(iff),o_cldh%name,itau_w,cldh)
     548      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     549     $o_cldh%name,itau_w,cldh)
    497550        ENDIF
    498551
    499552        IF (o_cldt%flag(iff)<=lev_files(iff)) THEN
    500       CALL histwrite_phy(nid_files(iff),o_cldt%name,
     553      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     554     $o_cldt%name,
    501555     &                   itau_w,cldt)
    502556        ENDIF
    503557
    504558        IF (o_cldq%flag(iff)<=lev_files(iff)) THEN
    505       CALL histwrite_phy(nid_files(iff),o_cldq%name,itau_w,cldq)
     559      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     560     $o_cldq%name,itau_w,cldq)
    506561        ENDIF
    507562
    508563        IF (o_lwp%flag(iff)<=lev_files(iff)) THEN
    509564      zx_tmp_fi2d(1:klon) = flwp(1:klon)
    510       CALL histwrite_phy(nid_files(iff),
     565      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    511566     s                   o_lwp%name,itau_w,zx_tmp_fi2d)
    512567        ENDIF
     
    514569        IF (o_iwp%flag(iff)<=lev_files(iff)) THEN
    515570      zx_tmp_fi2d(1:klon) = fiwp(1:klon)
    516       CALL histwrite_phy(nid_files(iff),
     571      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    517572     s                    o_iwp%name,itau_w,zx_tmp_fi2d)
    518573        ENDIF
    519574
    520575        IF (o_ue%flag(iff)<=lev_files(iff)) THEN
    521       CALL histwrite_phy(nid_files(iff),o_ue%name,itau_w,ue)
     576      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     577     $o_ue%name,itau_w,ue)
    522578        ENDIF
    523579
    524580        IF (o_ve%flag(iff)<=lev_files(iff)) THEN
    525       CALL histwrite_phy(nid_files(iff),o_ve%name,itau_w,ve)
     581      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     582     $o_ve%name,itau_w,ve)
    526583        ENDIF
    527584
    528585        IF (o_uq%flag(iff)<=lev_files(iff)) THEN
    529       CALL histwrite_phy(nid_files(iff),o_uq%name,itau_w,uq)
     586      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     587     $o_uq%name,itau_w,uq)
    530588        ENDIF
    531589
    532590        IF (o_vq%flag(iff)<=lev_files(iff)) THEN
    533       CALL histwrite_phy(nid_files(iff),o_vq%name,itau_w,vq)
     591      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     592     $o_vq%name,itau_w,vq)
    534593        ENDIF
    535594
    536595      IF(iflag_con.GE.3) THEN ! sb
    537596        IF (o_cape%flag(iff)<=lev_files(iff)) THEN
    538       CALL histwrite_phy(nid_files(iff),o_cape%name,itau_w,cape)
     597      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     598     $o_cape%name,itau_w,cape)
    539599        ENDIF
    540600
    541601        IF (o_pbase%flag(iff)<=lev_files(iff)) THEN
    542       CALL histwrite_phy(nid_files(iff),o_pbase%name,itau_w,ema_pcb)
     602      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     603     $o_pbase%name,itau_w,ema_pcb)
    543604        ENDIF
    544605
    545606        IF (o_ptop%flag(iff)<=lev_files(iff)) THEN
    546       CALL histwrite_phy(nid_files(iff),o_ptop%name,itau_w,ema_pct)
     607      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     608     $o_ptop%name,itau_w,ema_pct)
    547609        ENDIF
    548610
    549611        IF (o_fbase%flag(iff)<=lev_files(iff)) THEN
    550       CALL histwrite_phy(nid_files(iff),o_fbase%name,itau_w,ema_cbmf)
     612      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     613     $o_fbase%name,itau_w,ema_cbmf)
    551614        ENDIF
    552615
    553616        IF (o_plcl%flag(iff)<=lev_files(iff)) THEN
    554       CALL histwrite_phy(nid_files(iff),o_plcl%name,itau_w,plcl)
     617      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     618     $o_plcl%name,itau_w,plcl)
    555619        ENDIF
    556620
    557621        IF (o_plfc%flag(iff)<=lev_files(iff)) THEN
    558       CALL histwrite_phy(nid_files(iff),o_plfc%name,itau_w,plfc)
     622      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     623     $o_plfc%name,itau_w,plfc)
    559624        ENDIF
    560625
    561626        IF (o_wbeff%flag(iff)<=lev_files(iff)) THEN
    562       CALL histwrite_phy(nid_files(iff),o_wbeff%name,itau_w,wbeff)
     627      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     628     $o_wbeff%name,itau_w,wbeff)
    563629        ENDIF
    564630
    565631
    566632        IF (o_prw%flag(iff)<=lev_files(iff)) THEN
    567       CALL histwrite_phy(nid_files(iff),o_prw%name,itau_w,prw)
    568         ENDIF
    569 
     633      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     634     $o_prw%name,itau_w,prw)
     635        ENDIF
     636
     637      IF (.NOT.clef_stations(iff)) THEN
    570638      IF (o_cape_max%flag(iff)<=lev_files(iff)) THEN
    571       CALL histwrite_phy(nid_files(iff),o_cape_max%name,itau_w,cape)
     639      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     640     $o_cape_max%name,itau_w,cape)
     641      ENDIF
    572642      ENDIF
    573643
    574644       IF (o_upwd%flag(iff)<=lev_files(iff)) THEN
    575       CALL histwrite_phy(nid_files(iff),o_upwd%name,itau_w,upwd)
     645      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     646     $o_upwd%name,itau_w,upwd)
    576647       ENDIF
    577648
    578649       IF (o_Ma%flag(iff)<=lev_files(iff)) THEN
    579       CALL histwrite_phy(nid_files(iff),o_Ma%name,itau_w,Ma)
     650      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     651     $o_Ma%name,itau_w,Ma)
    580652       ENDIF
    581653
    582654       IF (o_dnwd%flag(iff)<=lev_files(iff)) THEN
    583       CALL histwrite_phy(nid_files(iff),o_dnwd%name,itau_w,dnwd)
     655      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     656     $o_dnwd%name,itau_w,dnwd)
    584657       ENDIF
    585658
    586659       IF (o_dnwd0%flag(iff)<=lev_files(iff)) THEN
    587       CALL histwrite_phy(nid_files(iff),o_dnwd0%name,itau_w,dnwd0)
     660      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     661     $o_dnwd0%name,itau_w,dnwd0)
    588662       ENDIF
    589663
    590664       IF (o_ftime_con%flag(iff)<=lev_files(iff)) THEN
    591665        zx_tmp_fi2d=float(itau_con)/float(itap)
    592       CALL histwrite_phy(nid_files(iff),o_ftime_con%name,
     666      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     667     $o_ftime_con%name,
    593668     s                   itau_w,zx_tmp_fi2d)
    594669       ENDIF
     
    600675         zx_tmp_fi3d=dnwd+dnwd0+upwd
    601676        endif
    602       CALL histwrite_phy(nid_files(iff),o_mc%name,itau_w,zx_tmp_fi3d)
     677      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     678     $o_mc%name,itau_w,zx_tmp_fi3d)
    603679       ENDIF
    604680     
     
    606682
    607683        IF (o_s_pblh%flag(iff)<=lev_files(iff)) THEN
    608       CALL histwrite_phy(nid_files(iff),o_s_pblh%name,itau_w,s_pblh)
     684      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     685     $o_s_pblh%name,itau_w,s_pblh)
    609686        ENDIF
    610687
    611688        IF (o_s_pblt%flag(iff)<=lev_files(iff)) THEN
    612       CALL histwrite_phy(nid_files(iff),o_s_pblt%name,itau_w,s_pblt)
     689      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     690     $o_s_pblt%name,itau_w,s_pblt)
    613691        ENDIF
    614692
    615693        IF (o_s_lcl%flag(iff)<=lev_files(iff)) THEN
    616       CALL histwrite_phy(nid_files(iff),o_s_lcl%name,itau_w,s_lcl)
     694      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     695     $o_s_lcl%name,itau_w,s_lcl)
    617696        ENDIF
    618697
    619698        IF (o_s_therm%flag(iff)<=lev_files(iff)) THEN
    620       CALL histwrite_phy(nid_files(iff),o_s_therm%name,itau_w,s_therm)
     699      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     700     $o_s_therm%name,itau_w,s_therm)
    621701        ENDIF
    622702
    623703!IM : Les champs suivants (s_capCL, s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
    624704!       IF (o_s_capCL%flag(iff)<=lev_files(iff)) THEN
    625 !     CALL histwrite_phy(nid_files(iff),o_s_capCL%name,itau_w,s_capCL)
     705!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     706!    $o_s_capCL%name,itau_w,s_capCL)
    626707!       ENDIF
    627708
    628709!       IF (o_s_oliqCL%flag(iff)<=lev_files(iff)) THEN
    629 !     CALL histwrite_phy(nid_files(iff),o_s_oliqCL%name,itau_w,s_oliqCL)
     710!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     711!    $o_s_oliqCL%name,itau_w,s_oliqCL)
    630712!       ENDIF
    631713
    632714!       IF (o_s_cteiCL%flag(iff)<=lev_files(iff)) THEN
    633 !     CALL histwrite_phy(nid_files(iff),o_s_cteiCL%name,itau_w,s_cteiCL)
     715!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     716!    $o_s_cteiCL%name,itau_w,s_cteiCL)
    634717!       ENDIF
    635718
    636719!       IF (o_s_trmb1%flag(iff)<=lev_files(iff)) THEN
    637 !     CALL histwrite_phy(nid_files(iff),o_s_trmb1%name,itau_w,s_trmb1)
     720!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     721!    $o_s_trmb1%name,itau_w,s_trmb1)
    638722!       ENDIF
    639723
    640724!       IF (o_s_trmb2%flag(iff)<=lev_files(iff)) THEN
    641 !     CALL histwrite_phy(nid_files(iff),o_s_trmb2%name,itau_w,s_trmb2)
     725!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     726!    $o_s_trmb2%name,itau_w,s_trmb2)
    642727!       ENDIF
    643728
    644729!       IF (o_s_trmb3%flag(iff)<=lev_files(iff)) THEN
    645 !     CALL histwrite_phy(nid_files(iff),o_s_trmb3%name,itau_w,s_trmb3)
     730!     CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     731!    $o_s_trmb3%name,itau_w,s_trmb3)
    646732!       ENDIF
    647733
     
    650736        ll=0
    651737        DO k=1, nlevSTD
    652 !         IF(k.GE.2.AND.k.LE.12) bb2=clevSTD(k)
    653 !         IF(k.GE.13.AND.k.LE.17) bb3=clevSTD(k)
    654738         bb2=clevSTD(k)
    655739         IF(bb2.EQ."850".OR.bb2.EQ."700".OR.
    656740     $      bb2.EQ."500".OR.bb2.EQ."200".OR.
     741     $      bb2.EQ."100".OR.
    657742     $      bb2.EQ."50".OR.bb2.EQ."10") THEN
    658743
     
    660745          ll=ll+1
    661746       IF (o_uSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
    662        CALL histwrite_phy(nid_files(iff),o_uSTDlevs(ll)%name,
     747       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     748     $o_uSTDlevs(ll)%name,
    663749     &                    itau_w,uwriteSTD(:,k,iff))
    664750       ENDIF
    665751
    666752       IF (o_vSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
    667       CALL histwrite_phy(nid_files(iff),o_vSTDlevs(ll)%name, 
     753      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     754     $o_vSTDlevs(ll)%name, 
    668755     &                   itau_w,vwriteSTD(:,k,iff))
    669756       ENDIF
    670757
    671758       IF (o_wSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
    672       CALL histwrite_phy(nid_files(iff),o_wSTDlevs(ll)%name,
     759      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     760     $o_wSTDlevs(ll)%name,
    673761     &                    itau_w,wwriteSTD(:,k,iff))
    674762       ENDIF
    675763
    676764       IF (o_zSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
    677       CALL histwrite_phy(nid_files(iff),o_zSTDlevs(ll)%name,
     765      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     766     $o_zSTDlevs(ll)%name,
    678767     &               itau_w,phiwriteSTD(:,k,iff))
    679768       ENDIF
    680769
    681770       IF (o_qSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
    682       CALL histwrite_phy(nid_files(iff),o_qSTDlevs(ll)%name,
     771      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     772     $o_qSTDlevs(ll)%name,
    683773     &                   itau_w, qwriteSTD(:,k,iff))
    684774       ENDIF
    685775
    686776       IF (o_tSTDlevs(ll)%flag(iff)<=lev_files(iff)) THEN
    687       CALL histwrite_phy(nid_files(iff),o_tSTDlevs(ll)%name,
     777      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     778     $o_tSTDlevs(ll)%name,
    688779     &                   itau_w, twriteSTD(:,k,iff))
    689780       ENDIF
     
    703794       ENDIF
    704795      ENDDO
    705       CALL histwrite_phy(nid_files(iff),
     796      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    706797     s                   o_t_oce_sic%name,itau_w,zx_tmp_fi2d)
    707798      ENDIF
     
    711802      IF (iflag_coupl>=1) THEN
    712803       IF (o_ale_bl%flag(iff)<=lev_files(iff)) THEN
    713        CALL histwrite_phy(nid_files(iff),o_ale_bl%name,itau_w,ale_bl)
     804       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     805     $o_ale_bl%name,itau_w,ale_bl)
    714806       ENDIF
    715807       IF (o_alp_bl%flag(iff)<=lev_files(iff)) THEN
    716        CALL histwrite_phy(nid_files(iff),o_alp_bl%name,itau_w,alp_bl)
     808       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     809     $o_alp_bl%name,itau_w,alp_bl)
    717810       ENDIF
    718811      ENDIF !iflag_coupl>=1
     
    723816      IF (iflag_wake>=1) THEN
    724817       IF (o_ale_wk%flag(iff)<=lev_files(iff)) THEN
    725        CALL histwrite_phy(nid_files(iff),o_ale_wk%name,itau_w,ale_wake)
     818       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     819     $o_ale_wk%name,itau_w,ale_wake)
    726820       ENDIF
    727821       IF (o_alp_wk%flag(iff)<=lev_files(iff)) THEN
    728        CALL histwrite_phy(nid_files(iff),o_alp_wk%name,itau_w,alp_wake)
     822       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     823     $o_alp_wk%name,itau_w,alp_wake)
    729824       ENDIF
    730825
    731826       IF (o_ale%flag(iff)<=lev_files(iff)) THEN
    732        CALL histwrite_phy(nid_files(iff),o_ale%name,itau_w,ale)
     827       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     828     $o_ale%name,itau_w,ale)
    733829       ENDIF
    734830       IF (o_alp%flag(iff)<=lev_files(iff)) THEN
    735        CALL histwrite_phy(nid_files(iff),o_alp%name,itau_w,alp)
     831       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     832     $o_alp%name,itau_w,alp)
    736833       ENDIF
    737834       IF (o_cin%flag(iff)<=lev_files(iff)) THEN
    738        CALL histwrite_phy(nid_files(iff),o_cin%name,itau_w,cin)
     835       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     836     $o_cin%name,itau_w,cin)
    739837       ENDIF
    740838       IF (o_wape%flag(iff)<=lev_files(iff)) THEN
    741        CALL histwrite_phy(nid_files(iff),o_WAPE%name,itau_w,wake_pe)
     839       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     840     $o_WAPE%name,itau_w,wake_pe)
    742841       ENDIF
    743842       IF (o_wake_h%flag(iff)<=lev_files(iff)) THEN
    744       CALL histwrite_phy(nid_files(iff),o_wake_h%name,itau_w,wake_h)
     843      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     844     $o_wake_h%name,itau_w,wake_h)
    745845       ENDIF
    746846
    747847       IF (o_wake_s%flag(iff)<=lev_files(iff)) THEN
    748       CALL histwrite_phy(nid_files(iff),o_wake_s%name,itau_w,wake_s)
     848      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     849     $o_wake_s%name,itau_w,wake_s)
    749850       ENDIF
    750851
    751852        IF (o_wake_deltat%flag(iff)<=lev_files(iff)) THEN
    752        CALL histwrite_phy(nid_files(iff),o_wake_deltat%name,
     853       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     854     $o_wake_deltat%name,
    753855     $                     itau_w,wake_deltat)
    754856        ENDIF
    755857
    756858        IF (o_wake_deltaq%flag(iff)<=lev_files(iff)) THEN
    757        CALL histwrite_phy(nid_files(iff),o_wake_deltaq%name,
     859       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     860     $o_wake_deltaq%name,
    758861     $                    itau_w,wake_deltaq)
    759862        ENDIF
    760863
    761864        IF (o_wake_omg%flag(iff)<=lev_files(iff)) THEN
    762        CALL histwrite_phy(nid_files(iff),
     865       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    763866     s                    o_wake_omg%name,itau_w,wake_omg)
    764867        ENDIF
     
    768871     &                                        /pdtphys
    769872           CALL histwrite_phy(nid_files(iff),
     873     $clef_stations(iff),
    770874     &                       o_dtwak%name,itau_w,zx_tmp_fi3d)
    771875         ENDIF
     
    773877        IF (o_dqwak%flag(iff)<=lev_files(iff)) THEN
    774878        zx_tmp_fi3d(1:klon,1:klev)=d_q_wake(1:klon,1:klev)/pdtphys
    775         CALL histwrite_phy(nid_files(iff),
     879        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    776880     &                     o_dqwak%name,itau_w,zx_tmp_fi3d)
    777881        ENDIF
     
    779883
    780884        IF (o_Vprecip%flag(iff)<=lev_files(iff)) THEN
    781        CALL histwrite_phy(nid_files(iff),o_Vprecip%name,itau_w,Vprecip)
     885       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     886     $o_Vprecip%name,itau_w,Vprecip)
    782887        ENDIF
    783888
    784889        IF (o_ftd%flag(iff)<=lev_files(iff)) THEN
    785        CALL histwrite_phy(nid_files(iff),o_ftd%name,itau_w,ftd)
     890       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     891     $o_ftd%name,itau_w,ftd)
    786892        ENDIF
    787893
    788894        IF (o_fqd%flag(iff)<=lev_files(iff)) THEN
    789        CALL histwrite_phy(nid_files(iff),o_fqd%name,itau_w,fqd)
     895       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     896     $o_fqd%name,itau_w,fqd)
    790897        ENDIF
    791898      ENDIF !(iflag_con.EQ.3)
     
    794901      IF ( o_slab_bils%flag(iff)<=lev_files(iff))
    795902     $     CALL histwrite_phy(
    796      $     nid_files(iff),o_slab_bils%name,itau_w,slab_wfbils)
     903     $     nid_files(iff),clef_stations(iff),
     904     $o_slab_bils%name,itau_w,slab_wfbils)
    797905
    798906      ENDIF !type_ocean == force/slab
    799907
    800908      IF (o_weakinv%flag(iff)<=lev_files(iff)) THEN
    801       CALL histwrite_phy(nid_files(iff),
     909      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    802910     s                  o_weakinv%name,itau_w,weak_inversion)
    803911      ENDIF
    804912
    805913      IF (o_dthmin%flag(iff)<=lev_files(iff)) THEN
    806       CALL histwrite_phy(nid_files(iff),o_dthmin%name,itau_w,dthmin)
     914      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     915     $o_dthmin%name,itau_w,dthmin)
    807916      ENDIF
    808917
    809918       IF (o_cldtau%flag(iff)<=lev_files(iff)) THEN
    810        CALL histwrite_phy(nid_files(iff),o_cldtau%name,itau_w,cldtau)
     919       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     920     $o_cldtau%name,itau_w,cldtau)
    811921       ENDIF
    812922
    813923       IF (o_cldemi%flag(iff)<=lev_files(iff)) THEN
    814        CALL histwrite_phy(nid_files(iff),o_cldemi%name,itau_w,cldemi)
     924       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     925     $o_cldemi%name,itau_w,cldemi)
    815926       ENDIF
    816927
    817928      IF (o_pr_con_l%flag(iff)<=lev_files(iff)) THEN
    818       CALL histwrite_phy(nid_files(iff),
     929      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    819930     s         o_pr_con_l%name,itau_w,pmflxr(:,1:klev))
    820931      ENDIF
    821932
    822933      IF (o_pr_con_i%flag(iff)<=lev_files(iff)) THEN
    823       CALL histwrite_phy(nid_files(iff),
     934      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    824935     s         o_pr_con_i%name,itau_w,pmflxs(:,1:klev))
    825936      ENDIF
    826937
    827938      IF (o_pr_lsc_l%flag(iff)<=lev_files(iff)) THEN
    828       CALL histwrite_phy(nid_files(iff),
     939      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    829940     s        o_pr_lsc_l%name,itau_w,prfl(:,1:klev))
    830941      ENDIF
    831942
    832943      IF (o_pr_lsc_i%flag(iff)<=lev_files(iff)) THEN
    833       CALL histwrite_phy(nid_files(iff),
     944      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    834945     s        o_pr_lsc_i%name,itau_w,psfl(:,1:klev))
    835946      ENDIF
    836947
    837948      IF (o_re%flag(iff)<=lev_files(iff)) THEN
    838       CALL histwrite_phy(nid_files(iff),o_re%name,itau_w,re)
     949      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     950     $o_re%name,itau_w,re)
    839951      ENDIF
    840952
    841953      IF (o_fl%flag(iff)<=lev_files(iff)) THEN
    842       CALL histwrite_phy(nid_files(iff),o_fl%name,itau_w,fl)
     954      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     955     $o_fl%name,itau_w,fl)
    843956      ENDIF
    844957
     
    849962       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
    850963      ENDDO
    851       CALL histwrite_phy(nid_files(iff),o_rh2m%name,itau_w,zx_tmp_fi2d)
    852       ENDIF
    853 
     964      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     965     $o_rh2m%name,itau_w,zx_tmp_fi2d)
     966      ENDIF
     967
     968      IF (.NOT.clef_stations(iff)) THEN
    854969      IF (o_rh2m_min%flag(iff)<=lev_files(iff)) THEN
    855970      DO i=1, klon
    856971       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
    857972      ENDDO
    858       CALL histwrite_phy(nid_files(iff),o_rh2m_min%name,
     973      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     974     $o_rh2m_min%name,
    859975     s               itau_w,zx_tmp_fi2d)
    860976      ENDIF
     
    864980       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
    865981      ENDDO
    866       CALL histwrite_phy(nid_files(iff),o_rh2m_max%name,
     982      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     983     $o_rh2m_max%name,
    867984     s              itau_w,zx_tmp_fi2d)
    868985      ENDIF
     986      ENDIF
    869987
    870988
    871989      IF (o_qsat2m%flag(iff)<=lev_files(iff)) THEN
    872       CALL histwrite_phy(nid_files(iff),o_qsat2m%name,itau_w,qsat2m)
     990      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     991     $o_qsat2m%name,itau_w,qsat2m)
    873992      ENDIF
    874993
    875994      IF (o_tpot%flag(iff)<=lev_files(iff)) THEN
    876       CALL histwrite_phy(nid_files(iff),o_tpot%name,itau_w,tpot)
     995      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     996     $o_tpot%name,itau_w,tpot)
    877997      ENDIF
    878998
    879999       IF (o_tpote%flag(iff)<=lev_files(iff)) THEN
    880       CALL histwrite_phy(nid_files(iff),o_tpote%name,itau_w,tpote)
     1000      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1001     $o_tpote%name,itau_w,tpote)
    8811002       ENDIF
    8821003
    8831004      IF (o_SWnetOR%flag(iff)<=lev_files(iff)) THEN
    8841005      zx_tmp_fi2d(1 : klon) = fsolsw( 1 : klon, is_ter)
    885       CALL histwrite_phy(nid_files(iff),
     1006      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    8861007     s                   o_SWnetOR%name,itau_w, zx_tmp_fi2d)
    8871008      ENDIF
     
    8891010      IF (o_SWdownOR%flag(iff)<=lev_files(iff)) THEN
    8901011      zx_tmp_fi2d(1:klon) = solsw(1:klon)/(1.-albsol1(1:klon))
    891       CALL histwrite_phy(nid_files(iff),
     1012      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    8921013     s                   o_SWdownOR%name,itau_w, zx_tmp_fi2d)
    8931014      ENDIF
    8941015
    8951016      IF (o_LWdownOR%flag(iff)<=lev_files(iff)) THEN
    896       CALL histwrite_phy(nid_files(iff),
     1017      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    8971018     s                  o_LWdownOR%name,itau_w,sollwdown)
    8981019      ENDIF
    8991020
    9001021      IF (o_snowl%flag(iff)<=lev_files(iff)) THEN
    901       CALL histwrite_phy(nid_files(iff),o_snowl%name,itau_w,snow_lsc)
     1022      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1023     $o_snowl%name,itau_w,snow_lsc)
    9021024      ENDIF
    9031025
    9041026      IF (o_solldown%flag(iff)<=lev_files(iff)) THEN
    905       CALL histwrite_phy(nid_files(iff),
     1027      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    9061028     s                   o_solldown%name,itau_w,sollwdown)
    9071029      ENDIF
    9081030
    9091031      IF (o_dtsvdfo%flag(iff)<=lev_files(iff)) THEN
    910       CALL histwrite_phy(nid_files(iff),
     1032      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    9111033     s                 o_dtsvdfo%name,itau_w,d_ts(:,is_oce))
    9121034      ENDIF
    9131035
    9141036      IF (o_dtsvdft%flag(iff)<=lev_files(iff)) THEN
    915       CALL histwrite_phy(nid_files(iff),
     1037      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    9161038     s                   o_dtsvdft%name,itau_w,d_ts(:,is_ter))
    9171039      ENDIF
    9181040
    9191041       IF (o_dtsvdfg%flag(iff)<=lev_files(iff)) THEN
    920         CALL histwrite_phy(nid_files(iff),
     1042        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    9211043     $                   o_dtsvdfg%name,itau_w, d_ts(:,is_lic))
    9221044       ENDIF
    9231045
    9241046       IF (o_dtsvdfi%flag(iff)<=lev_files(iff)) THEN
    925       CALL histwrite_phy(nid_files(iff),
     1047      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    9261048     s                   o_dtsvdfi%name,itau_w,d_ts(:,is_sic))
    9271049       ENDIF
    9281050
    9291051       IF (o_rugs%flag(iff)<=lev_files(iff)) THEN
    930       CALL histwrite_phy(nid_files(iff),o_rugs%name,itau_w,zxrugs)
     1052      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1053     $o_rugs%name,itau_w,zxrugs)
    9311054       ENDIF
    9321055
     
    9361059
    9371060          IF (o_od550aer%flag(iff)<=lev_files(iff)) THEN
    938              CALL histwrite_phy(nid_files(iff),o_od550aer%name,itau_w,
     1061             CALL histwrite_phy(nid_files(iff),
     1062     $clef_stations(iff),
     1063     $o_od550aer%name,itau_w,
    9391064     $            od550aer)
    9401065          ENDIF
    9411066          IF (o_od865aer%flag(iff)<=lev_files(iff)) THEN
    942              CALL histwrite_phy(nid_files(iff),o_od865aer%name,itau_w,
     1067             CALL histwrite_phy(nid_files(iff),
     1068     $clef_stations(iff),
     1069     $o_od865aer%name,itau_w,
    9431070     $            od865aer)
    9441071          ENDIF
    9451072          IF (o_absvisaer%flag(iff)<=lev_files(iff)) THEN
    946              CALL histwrite_phy(nid_files(iff),o_absvisaer%name,itau_w,
     1073             CALL histwrite_phy(nid_files(iff),
     1074     $clef_stations(iff),
     1075     $o_absvisaer%name,itau_w,
    9471076     $            absvisaer)
    9481077          ENDIF
    9491078          IF (o_od550lt1aer%flag(iff)<=lev_files(iff)) THEN
    950             CALL histwrite_phy(nid_files(iff),o_od550lt1aer%name,itau_w,
     1079            CALL histwrite_phy(nid_files(iff),
     1080     $clef_stations(iff),
     1081     $o_od550lt1aer%name,itau_w,
    9511082     $            od550lt1aer)
    9521083          ENDIF
    9531084
    9541085          IF (o_sconcso4%flag(iff)<=lev_files(iff)) THEN
    955               CALL histwrite_phy(nid_files(iff),o_sconcso4%name,itau_w,
     1086              CALL histwrite_phy(nid_files(iff),
     1087     $clef_stations(iff),
     1088     $o_sconcso4%name,itau_w,
    9561089     $            sconcso4)
    9571090          ENDIF
    9581091          IF (o_sconcoa%flag(iff)<=lev_files(iff)) THEN
    959               CALL histwrite_phy(nid_files(iff),o_sconcoa%name,itau_w,
     1092              CALL histwrite_phy(nid_files(iff),
     1093     $clef_stations(iff),
     1094     $o_sconcoa%name,itau_w,
    9601095     $            sconcoa)
    9611096          ENDIF
    9621097          IF (o_sconcbc%flag(iff)<=lev_files(iff)) THEN
    963               CALL histwrite_phy(nid_files(iff),o_sconcbc%name,itau_w,
     1098              CALL histwrite_phy(nid_files(iff),
     1099     $clef_stations(iff),
     1100     $o_sconcbc%name,itau_w,
    9641101     $            sconcbc)
    9651102          ENDIF
    9661103          IF (o_sconcss%flag(iff)<=lev_files(iff)) THEN
    967               CALL histwrite_phy(nid_files(iff),o_sconcss%name,itau_w,
     1104              CALL histwrite_phy(nid_files(iff),
     1105     $clef_stations(iff),
     1106     $o_sconcss%name,itau_w,
    9681107     $            sconcss)
    9691108          ENDIF
    9701109          IF (o_sconcdust%flag(iff)<=lev_files(iff)) THEN
    971               CALL histwrite_phy(nid_files(iff),o_sconcdust%name,itau_w,
     1110              CALL histwrite_phy(nid_files(iff),
     1111     $clef_stations(iff),
     1112     $o_sconcdust%name,itau_w,
    9721113     $            sconcdust)
    9731114          ENDIF
    9741115         
    9751116          IF (o_concso4%flag(iff)<=lev_files(iff)) THEN
    976               CALL histwrite_phy(nid_files(iff),o_concso4%name,itau_w,
     1117              CALL histwrite_phy(nid_files(iff),
     1118     $clef_stations(iff),
     1119     $o_concso4%name,itau_w,
    9771120     $            concso4)
    9781121          ENDIF
    9791122          IF (o_concoa%flag(iff)<=lev_files(iff)) THEN
    980               CALL histwrite_phy(nid_files(iff),o_concoa%name,itau_w,
     1123              CALL histwrite_phy(nid_files(iff),
     1124     $clef_stations(iff),
     1125     $o_concoa%name,itau_w,
    9811126     $            concoa)
    9821127          ENDIF
    9831128          IF (o_concbc%flag(iff)<=lev_files(iff)) THEN
    984               CALL histwrite_phy(nid_files(iff),o_concbc%name,itau_w,
     1129              CALL histwrite_phy(nid_files(iff),
     1130     $clef_stations(iff),
     1131     $o_concbc%name,itau_w,
    9851132     $            concbc)
    9861133          ENDIF
    9871134          IF (o_concss%flag(iff)<=lev_files(iff)) THEN
    988               CALL histwrite_phy(nid_files(iff),o_concss%name,itau_w,
     1135              CALL histwrite_phy(nid_files(iff),
     1136     $clef_stations(iff),
     1137     $o_concss%name,itau_w,
    9891138     $            concss)
    9901139          ENDIF
    9911140          IF (o_concdust%flag(iff)<=lev_files(iff)) THEN
    992               CALL histwrite_phy(nid_files(iff),o_concdust%name,itau_w,
     1141              CALL histwrite_phy(nid_files(iff),
     1142     $clef_stations(iff),
     1143     $o_concdust%name,itau_w,
    9931144     $            concdust)
    9941145          ENDIF
    9951146         
    9961147          IF (o_loadso4%flag(iff)<=lev_files(iff)) THEN
    997               CALL histwrite_phy(nid_files(iff),o_loadso4%name,itau_w,
     1148              CALL histwrite_phy(nid_files(iff),
     1149     $clef_stations(iff),
     1150     $o_loadso4%name,itau_w,
    9981151     $            loadso4)
    9991152          ENDIF
    10001153          IF (o_loadoa%flag(iff)<=lev_files(iff)) THEN
    1001               CALL histwrite_phy(nid_files(iff),o_loadoa%name,itau_w,
     1154              CALL histwrite_phy(nid_files(iff),
     1155     $clef_stations(iff),
     1156     $o_loadoa%name,itau_w,
    10021157     $            loadoa)
    10031158          ENDIF
    10041159          IF (o_loadbc%flag(iff)<=lev_files(iff)) THEN
    1005               CALL histwrite_phy(nid_files(iff),o_loadbc%name,itau_w,
     1160              CALL histwrite_phy(nid_files(iff),
     1161     $clef_stations(iff),
     1162     $o_loadbc%name,itau_w,
    10061163     $            loadbc)
    10071164          ENDIF
    10081165          IF (o_loadss%flag(iff)<=lev_files(iff)) THEN
    1009               CALL histwrite_phy(nid_files(iff),o_loadss%name,itau_w,
     1166              CALL histwrite_phy(nid_files(iff),
     1167     $clef_stations(iff),
     1168     $o_loadss%name,itau_w,
    10101169     $            loadss)
    10111170          ENDIF
    10121171          IF (o_loaddust%flag(iff)<=lev_files(iff)) THEN
    1013               CALL histwrite_phy(nid_files(iff),o_loaddust%name,itau_w,
     1172              CALL histwrite_phy(nid_files(iff),
     1173     $clef_stations(iff),
     1174     $o_loaddust%name,itau_w,
    10141175     $            loaddust)
    10151176          ENDIF
     
    10181179            IF (o_tausumaero(naero)%flag(iff)<=lev_files(iff)) THEN
    10191180                CALL histwrite_phy(nid_files(iff),
     1181     $clef_stations(iff),
    10201182     $              o_tausumaero(naero)%name,itau_w,
    10211183     $              tausum_aero(:,2,naero) )
     
    10271189       IF (ok_ade) THEN
    10281190          IF (o_topswad%flag(iff)<=lev_files(iff)) THEN
    1029              CALL histwrite_phy(nid_files(iff),o_topswad%name,itau_w,
     1191             CALL histwrite_phy(nid_files(iff),
     1192     $clef_stations(iff),
     1193     $o_topswad%name,itau_w,
    10301194     $            topswad_aero)
    10311195          ENDIF
    10321196          IF (o_solswad%flag(iff)<=lev_files(iff)) THEN
    1033              CALL histwrite_phy(nid_files(iff),o_solswad%name,itau_w,
     1197             CALL histwrite_phy(nid_files(iff),
     1198     $clef_stations(iff),
     1199     $o_solswad%name,itau_w,
    10341200     $            solswad_aero)
    10351201          ENDIF
     
    10381204        if (new_aod) then             
    10391205        IF (o_swtoaas_nat%flag(iff)<=lev_files(iff)) THEN
    1040         CALL histwrite_phy(nid_files(iff),o_swtoaas_nat%name,itau_w,
     1206        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1207     $o_swtoaas_nat%name,itau_w,
    10411208     $      topsw_aero(:,1))
    10421209        ENDIF
    10431210
    10441211        IF (o_swsrfas_nat%flag(iff)<=lev_files(iff)) THEN
    1045         CALL histwrite_phy(nid_files(iff),o_swsrfas_nat%name,itau_w,
     1212        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1213     $o_swsrfas_nat%name,itau_w,
    10461214     $      solsw_aero(:,1))
    10471215        ENDIF
    10481216
    10491217        IF (o_swtoacs_nat%flag(iff)<=lev_files(iff)) THEN
    1050         CALL histwrite_phy(nid_files(iff),o_swtoacs_nat%name,itau_w,
     1218        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1219     $o_swtoacs_nat%name,itau_w,
    10511220     $      topsw0_aero(:,1))
    10521221        ENDIF
    10531222
    10541223        IF (o_swsrfcs_nat%flag(iff)<=lev_files(iff)) THEN
    1055         CALL histwrite_phy(nid_files(iff),o_swsrfcs_nat%name,itau_w,
     1224        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1225     $o_swsrfcs_nat%name,itau_w,
    10561226     $      solsw0_aero(:,1))
    10571227        ENDIF
     
    10591229!ant
    10601230        IF (o_swtoaas_ant%flag(iff)<=lev_files(iff)) THEN
    1061         CALL histwrite_phy(nid_files(iff),o_swtoaas_ant%name,itau_w,
     1231        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1232     $o_swtoaas_ant%name,itau_w,
    10621233     $      topsw_aero(:,2))
    10631234        ENDIF
    10641235
    10651236        IF (o_swsrfas_ant%flag(iff)<=lev_files(iff)) THEN
    1066         CALL histwrite_phy(nid_files(iff),o_swsrfas_ant%name,itau_w,
     1237        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1238     $o_swsrfas_ant%name,itau_w,
    10671239     $      solsw_aero(:,2))
    10681240        ENDIF
    10691241
    10701242        IF (o_swtoacs_ant%flag(iff)<=lev_files(iff)) THEN
    1071         CALL histwrite_phy(nid_files(iff),o_swtoacs_ant%name,itau_w,
     1243        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1244     $o_swtoacs_ant%name,itau_w,
    10721245     $      topsw0_aero(:,2))
    10731246        ENDIF
    10741247
    10751248        IF (o_swsrfcs_ant%flag(iff)<=lev_files(iff)) THEN
    1076         CALL histwrite_phy(nid_files(iff),o_swsrfcs_ant%name,itau_w,
     1249        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1250     $o_swsrfcs_ant%name,itau_w,
    10771251     $      solsw0_aero(:,2))
    10781252        ENDIF
     
    10821256        if (.not. aerosol_couple) then
    10831257        IF (o_swtoacf_nat%flag(iff)<=lev_files(iff)) THEN
    1084         CALL histwrite_phy(nid_files(iff),o_swtoacf_nat%name,itau_w,
     1258        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1259     $o_swtoacf_nat%name,itau_w,
    10851260     $      topswcf_aero(:,1))
    10861261        ENDIF
    10871262
    10881263        IF (o_swsrfcf_nat%flag(iff)<=lev_files(iff)) THEN
    1089         CALL histwrite_phy(nid_files(iff),o_swsrfcf_nat%name,itau_w,
     1264        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1265     $o_swsrfcf_nat%name,itau_w,
    10901266     $      solswcf_aero(:,1))
    10911267        ENDIF
    10921268
    10931269        IF (o_swtoacf_ant%flag(iff)<=lev_files(iff)) THEN
    1094         CALL histwrite_phy(nid_files(iff),o_swtoacf_ant%name,itau_w,
     1270        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1271     $o_swtoacf_ant%name,itau_w,
    10951272     $      topswcf_aero(:,2))
    10961273        ENDIF
    10971274
    10981275        IF (o_swsrfcf_ant%flag(iff)<=lev_files(iff)) THEN
    1099         CALL histwrite_phy(nid_files(iff),o_swsrfcf_ant%name,itau_w,
     1276        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1277     $o_swsrfcf_ant%name,itau_w,
    11001278     $      solswcf_aero(:,2))
    11011279        ENDIF
    11021280
    11031281        IF (o_swtoacf_zero%flag(iff)<=lev_files(iff)) THEN
    1104         CALL histwrite_phy(nid_files(iff),o_swtoacf_zero%name,itau_w,
     1282        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1283     $o_swtoacf_zero%name,itau_w,
    11051284     $      topswcf_aero(:,3))
    11061285        ENDIF
    11071286
    11081287        IF (o_swsrfcf_zero%flag(iff)<=lev_files(iff)) THEN
    1109         CALL histwrite_phy(nid_files(iff),o_swsrfcf_zero%name,itau_w,
     1288        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1289     $o_swsrfcf_zero%name,itau_w,
    11101290     $      solswcf_aero(:,3))
    11111291        ENDIF
     
    11191299       IF (ok_aie) THEN
    11201300          IF (o_topswai%flag(iff)<=lev_files(iff)) THEN
    1121              CALL histwrite_phy(nid_files(iff),o_topswai%name,itau_w,
     1301             CALL histwrite_phy(nid_files(iff),
     1302     $clef_stations(iff),
     1303     $o_topswai%name,itau_w,
    11221304     $            topswai_aero)
    11231305          ENDIF
    11241306          IF (o_solswai%flag(iff)<=lev_files(iff)) THEN
    1125              CALL histwrite_phy(nid_files(iff),o_solswai%name,itau_w,
     1307             CALL histwrite_phy(nid_files(iff),
     1308     $clef_stations(iff),
     1309     $o_solswai%name,itau_w,
    11261310     $            solswai_aero)
    11271311          ENDIF
    11281312          IF (o_scdnc%flag(iff)<=lev_files(iff)) THEN
    1129              CALL histwrite_phy(nid_files(iff),o_scdnc%name,itau_w,
     1313             CALL histwrite_phy(nid_files(iff),
     1314     $clef_stations(iff),
     1315     $o_scdnc%name,itau_w,
    11301316     $            scdnc)
    11311317          ENDIF
    11321318          IF (o_cldncl%flag(iff)<=lev_files(iff)) THEN
    1133              CALL histwrite_phy(nid_files(iff),o_cldncl%name,itau_w,
     1319             CALL histwrite_phy(nid_files(iff),
     1320     $clef_stations(iff),
     1321     $o_cldncl%name,itau_w,
    11341322     $            cldncl)
    11351323          ENDIF
    1136           IF (o_reffclws%flag(iff)<=lev_files(iff)) THEN
    1137              CALL histwrite_phy(nid_files(iff),o_reffclws%name,itau_w,
     1324         IF (o_reffclws%flag(iff)<=lev_files(iff)) THEN
     1325            CALL histwrite_phy(nid_files(iff),
     1326     $clef_stations(iff),
     1327     $o_reffclws%name,itau_w,
    11381328     $            reffclws)
    1139           ENDIF
    1140           IF (o_reffclwc%flag(iff)<=lev_files(iff)) THEN
    1141              CALL histwrite_phy(nid_files(iff),o_reffclwc%name,itau_w,
     1329         ENDIF
     1330         IF (o_reffclwc%flag(iff)<=lev_files(iff)) THEN
     1331            CALL histwrite_phy(nid_files(iff),
     1332     $clef_stations(iff),
     1333     $o_reffclwc%name,itau_w,
    11421334     $            reffclwc)
    1143           ENDIF
     1335         ENDIF
    11441336          IF (o_cldnvi%flag(iff)<=lev_files(iff)) THEN
    1145              CALL histwrite_phy(nid_files(iff),o_cldnvi%name,itau_w,
     1337             CALL histwrite_phy(nid_files(iff),
     1338     $clef_stations(iff),
     1339     $o_cldnvi%name,itau_w,
    11461340     $            cldnvi)
    11471341          ENDIF
    11481342          IF (o_lcc%flag(iff)<=lev_files(iff)) THEN
    1149              CALL histwrite_phy(nid_files(iff),o_lcc%name,itau_w,
     1343             CALL histwrite_phy(nid_files(iff),
     1344     $clef_stations(iff),
     1345     $o_lcc%name,itau_w,
    11501346     $            lcc)
    11511347          ENDIF
    11521348          IF (o_lcc3d%flag(iff)<=lev_files(iff)) THEN
    1153              CALL histwrite_phy(nid_files(iff),o_lcc3d%name,itau_w,
     1349             CALL histwrite_phy(nid_files(iff),
     1350     $clef_stations(iff),
     1351     $o_lcc3d%name,itau_w,
    11541352     $            lcc3d)
    11551353          ENDIF
    11561354          IF (o_lcc3dcon%flag(iff)<=lev_files(iff)) THEN
    1157              CALL histwrite_phy(nid_files(iff),o_lcc3dcon%name,itau_w,
     1355             CALL histwrite_phy(nid_files(iff),
     1356     $clef_stations(iff),
     1357     $o_lcc3dcon%name,itau_w,
    11581358     $            lcc3dcon)
    11591359          ENDIF
    11601360          IF (o_lcc3dstra%flag(iff)<=lev_files(iff)) THEN
    1161              CALL histwrite_phy(nid_files(iff),o_lcc3dstra%name,itau_w,
     1361             CALL histwrite_phy(nid_files(iff),
     1362     $clef_stations(iff),
     1363     $o_lcc3dstra%name,itau_w,
    11621364     $            lcc3dstra)
    11631365          ENDIF
    11641366          IF (o_reffclwtop%flag(iff)<=lev_files(iff)) THEN
    1165              CALL histwrite_phy(nid_files(iff),o_reffclwtop%name,itau_w,
     1367             CALL histwrite_phy(nid_files(iff),
     1368     $clef_stations(iff),
     1369     $o_reffclwtop%name,itau_w,
    11661370     $            reffclwtop)
    11671371          ENDIF
     
    11711375       IF (ok_ade .OR. ok_aie) then
    11721376          IF (o_ec550aer%flag(iff)<=lev_files(iff)) THEN
    1173              CALL histwrite_phy(nid_files(iff),o_ec550aer%name,itau_w,
     1377             CALL histwrite_phy(nid_files(iff),
     1378     $clef_stations(iff),
     1379     $o_ec550aer%name,itau_w,
    11741380     &            ec550aer)
    11751381          ENDIF
     
    11771383
    11781384       IF (o_lwcon%flag(iff)<=lev_files(iff)) THEN
    1179       CALL histwrite_phy(nid_files(iff),o_lwcon%name,itau_w,flwc)
     1385      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1386     $o_lwcon%name,itau_w,flwc)
    11801387       ENDIF
    11811388
    11821389       IF (o_iwcon%flag(iff)<=lev_files(iff)) THEN
    1183       CALL histwrite_phy(nid_files(iff),o_iwcon%name,itau_w,fiwc)
     1390      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1391     $o_iwcon%name,itau_w,fiwc)
    11841392       ENDIF
    11851393
    11861394       IF (o_temp%flag(iff)<=lev_files(iff)) THEN
    1187       CALL histwrite_phy(nid_files(iff),o_temp%name,itau_w,t_seri)
     1395      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1396     $o_temp%name,itau_w,t_seri)
    11881397       ENDIF
    11891398
    11901399       IF (o_theta%flag(iff)<=lev_files(iff)) THEN
    1191       CALL histwrite_phy(nid_files(iff),o_theta%name,itau_w,theta)
     1400      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1401     $o_theta%name,itau_w,theta)
    11921402       ENDIF
    11931403
    11941404       IF (o_ovapinit%flag(iff)<=lev_files(iff)) THEN
    1195       CALL histwrite_phy(nid_files(iff),o_ovapinit%name,itau_w,
     1405      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1406     $o_ovapinit%name,itau_w,
    11961407     $ qx(:,:,ivap))
    11971408       ENDIF
    11981409
    11991410       IF (o_ovap%flag(iff)<=lev_files(iff)) THEN
    1200       CALL histwrite_phy(nid_files(iff),
     1411      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    12011412     $                   o_ovap%name,itau_w,q_seri)
    12021413       ENDIF
    12031414
    12041415       IF (o_geop%flag(iff)<=lev_files(iff)) THEN
    1205       CALL histwrite_phy(nid_files(iff),o_geop%name,itau_w,zphi)
     1416      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1417     $o_geop%name,itau_w,zphi)
    12061418       ENDIF
    12071419
    12081420       IF (o_vitu%flag(iff)<=lev_files(iff)) THEN
    1209       CALL histwrite_phy(nid_files(iff),o_vitu%name,itau_w,u_seri)
     1421      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1422     $o_vitu%name,itau_w,u_seri)
    12101423       ENDIF
    12111424
    12121425       IF (o_vitv%flag(iff)<=lev_files(iff)) THEN
    1213       CALL histwrite_phy(nid_files(iff),o_vitv%name,itau_w,v_seri)
     1426      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1427     $o_vitv%name,itau_w,v_seri)
    12141428       ENDIF
    12151429
    12161430       IF (o_vitw%flag(iff)<=lev_files(iff)) THEN
    1217       CALL histwrite_phy(nid_files(iff),o_vitw%name,itau_w,omega)
     1431      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1432     $o_vitw%name,itau_w,omega)
    12181433       ENDIF
    12191434
    12201435        IF (o_pres%flag(iff)<=lev_files(iff)) THEN
    1221       CALL histwrite_phy(nid_files(iff),o_pres%name,itau_w,pplay)
     1436      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1437     $o_pres%name,itau_w,pplay)
    12221438        ENDIF
    12231439
    12241440        IF (o_paprs%flag(iff)<=lev_files(iff)) THEN
    1225       CALL histwrite_phy(nid_files(iff),o_paprs%name,
     1441      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1442     $o_paprs%name,
    12261443     s                    itau_w,paprs(:,1:klev))
    12271444        ENDIF
    12281445
     1446        IF (o_zfull%flag(iff)<=lev_files(iff)) THEN
     1447         DO i=1, klon
     1448          zx_tmp_fi3d1(i,1)= pphis(i)/RG
     1449!020611   zx_tmp_fi3d(i,1)= pphis(i)/RG
     1450         ENDDO
     1451         DO k=1, klev
     1452!020611        DO k=1, klev-1
     1453         DO i=1, klon
     1454!020611         zx_tmp_fi3d(i,k+1)= zx_tmp_fi3d(i,k) - (t_seri(i,k) *RD *
     1455          zx_tmp_fi3d1(i,k+1)= zx_tmp_fi3d1(i,k) - (t_seri(i,k) *RD *
     1456     $    (paprs(i,k+1) - paprs(i,k))) / ( pplay(i,k) * RG )
     1457         ENDDO
     1458         ENDDO
     1459      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1460     $o_zfull%name,itau_w,zx_tmp_fi3d1(:,2:klevp1))
     1461!020611    $o_zfull%name,itau_w,zx_tmp_fi3d)
     1462        ENDIF
     1463
     1464        IF (o_zhalf%flag(iff)<=lev_files(iff)) THEN
     1465         DO i=1, klon
     1466          zx_tmp_fi3d(i,1)= pphis(i)/RG - (
     1467     $    (t_seri(i,1)+zxtsol(i))/2. *RD *
     1468     $    (pplay(i,1) - paprs(i,1)))/( (paprs(i,1)+pplay(i,1))/2. * RG)
     1469         ENDDO
     1470         DO k=1, klev-1
     1471         DO i=1, klon
     1472          zx_tmp_fi3d(i,k+1)= zx_tmp_fi3d(i,k) - (
     1473     $    (t_seri(i,k)+t_seri(i,k+1))/2. *RD *
     1474     $    (pplay(i,k+1) - pplay(i,k))) / ( paprs(i,k) * RG )
     1475         ENDDO
     1476         ENDDO
     1477      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1478     $o_zhalf%name,itau_w,zx_tmp_fi3d)
     1479        ENDIF
     1480
    12291481       IF (o_rneb%flag(iff)<=lev_files(iff)) THEN
    1230       CALL histwrite_phy(nid_files(iff),o_rneb%name,itau_w,cldfra)
     1482      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1483     $o_rneb%name,itau_w,cldfra)
    12311484       ENDIF
    12321485
    12331486       IF (o_rnebcon%flag(iff)<=lev_files(iff)) THEN
    1234       CALL histwrite_phy(nid_files(iff),o_rnebcon%name,itau_w,rnebcon)
     1487      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1488     $o_rnebcon%name,itau_w,rnebcon)
    12351489       ENDIF
    12361490
    12371491       IF (o_rhum%flag(iff)<=lev_files(iff)) THEN
    1238       CALL histwrite_phy(nid_files(iff),o_rhum%name,itau_w,zx_rh)
     1492      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1493     $o_rhum%name,itau_w,zx_rh)
    12391494       ENDIF
    12401495
    12411496      IF (o_ozone%flag(iff)<=lev_files(iff)) THEN
    1242          CALL histwrite_phy(nid_files(iff), o_ozone%name, itau_w,
     1497         CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1498     $o_ozone%name, itau_w,
    12431499     $        wo(:, :, 1) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
    12441500      ENDIF
     
    12461502      IF (o_ozone_light%flag(iff)<=lev_files(iff) .and.
    12471503     $     read_climoz == 2) THEN
    1248          CALL histwrite_phy(nid_files(iff), o_ozone_light%name, itau_w,
     1504         CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1505     $o_ozone_light%name, itau_w,
    12491506     $        wo(:, :, 2) * dobson_u * 1e3 / zmasse / rmo3 * rmd)
    12501507      ENDIF
    12511508
    12521509       IF (o_dtphy%flag(iff)<=lev_files(iff)) THEN
    1253       CALL histwrite_phy(nid_files(iff),o_dtphy%name,itau_w,d_t)
     1510      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1511     $o_dtphy%name,itau_w,d_t)
    12541512       ENDIF
    12551513
    12561514       IF (o_dqphy%flag(iff)<=lev_files(iff)) THEN
    1257       CALL histwrite_phy(nid_files(iff),
     1515      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    12581516     s                  o_dqphy%name,itau_w, d_qx(:,:,ivap))
    12591517       ENDIF
     
    12621520        IF (o_albe_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    12631521        zx_tmp_fi2d(1 : klon) = falb1( 1 : klon, nsrf)
    1264         CALL histwrite_phy(nid_files(iff),
     1522        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    12651523     s                    o_albe_srf(nsrf)%name,itau_w,
    12661524     $                     zx_tmp_fi2d)
     
    12691527        IF (o_rugs_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN 
    12701528        zx_tmp_fi2d(1 : klon) = frugs( 1 : klon, nsrf)
    1271         CALL histwrite_phy(nid_files(iff),
     1529        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    12721530     s                     o_rugs_srf(nsrf)%name,itau_w,
    12731531     $      zx_tmp_fi2d)
     
    12761534        IF (o_ages_srf(nsrf)%flag(iff)<=lev_files(iff)) THEN
    12771535        zx_tmp_fi2d(1 : klon) = agesno( 1 : klon, nsrf)
    1278         CALL histwrite_phy(nid_files(iff),
     1536        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    12791537     s                     o_ages_srf(nsrf)%name,itau_w
    12801538     $    ,zx_tmp_fi2d)
     
    12831541
    12841542       IF (o_alb1%flag(iff)<=lev_files(iff)) THEN
    1285       CALL histwrite_phy(nid_files(iff),o_alb1%name,itau_w,albsol1)
     1543      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1544     $o_alb1%name,itau_w,albsol1)
    12861545       ENDIF
    12871546
    12881547       IF (o_alb2%flag(iff)<=lev_files(iff)) THEN
    1289       CALL histwrite_phy(nid_files(iff),o_alb2%name,itau_w,albsol2)
     1548      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1549     $o_alb2%name,itau_w,albsol2)
    12901550       ENDIF
    12911551
     
    13001560      enddo
    13011561       IF (o_tke%flag(iff)<=lev_files(iff)) THEN
    1302       CALL histwrite_phy(nid_files(iff),o_tke%name,itau_w,zx_tmp_fi3d)
    1303        ENDIF
    1304 
     1562      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1563     $o_tke%name,itau_w,zx_tmp_fi3d)
     1564       ENDIF
     1565
     1566      IF (.NOT.clef_stations(iff)) THEN
    13051567       IF (o_tke_max%flag(iff)<=lev_files(iff)) THEN
    1306       CALL histwrite_phy(nid_files(iff),
     1568      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    13071569     s                   o_tke_max%name,itau_w,zx_tmp_fi3d)
    13081570       ENDIF
     1571      ENDIF
    13091572      endif
    13101573
    13111574       IF (o_kz%flag(iff)<=lev_files(iff)) THEN
    1312       CALL histwrite_phy(nid_files(iff),o_kz%name,itau_w,coefh)
    1313        ENDIF
    1314 
     1575      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1576     $o_kz%name,itau_w,coefh)
     1577       ENDIF
     1578
     1579      IF (.NOT.clef_stations(iff)) THEN
    13151580       IF (o_kz_max%flag(iff)<=lev_files(iff)) THEN
    1316       CALL histwrite_phy(nid_files(iff),o_kz_max%name,itau_w,coefh)
    1317        ENDIF
     1581      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1582     $o_kz_max%name,itau_w,coefh)
     1583       ENDIF
     1584      ENDIF
    13181585
    13191586       IF (o_clwcon%flag(iff)<=lev_files(iff)) THEN
    1320       CALL histwrite_phy(nid_files(iff),o_clwcon%name,itau_w,clwcon0)
     1587      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1588     $o_clwcon%name,itau_w,clwcon0)
    13211589       ENDIF
    13221590
    13231591       IF (o_dtdyn%flag(iff)<=lev_files(iff)) THEN
    1324       CALL histwrite_phy(nid_files(iff),o_dtdyn%name,itau_w,d_t_dyn)
     1592      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1593     $o_dtdyn%name,itau_w,d_t_dyn)
    13251594       ENDIF
    13261595
    13271596       IF (o_dqdyn%flag(iff)<=lev_files(iff)) THEN
    1328       CALL histwrite_phy(nid_files(iff),o_dqdyn%name,itau_w,d_q_dyn)
     1597      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1598     $o_dqdyn%name,itau_w,d_q_dyn)
    13291599       ENDIF
    13301600
    13311601       IF (o_dudyn%flag(iff)<=lev_files(iff)) THEN
    1332       CALL histwrite_phy(nid_files(iff),o_dudyn%name,itau_w,d_u_dyn)
     1602      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1603     $o_dudyn%name,itau_w,d_u_dyn)
    13331604       ENDIF                                                   
    13341605
    13351606       IF (o_dvdyn%flag(iff)<=lev_files(iff)) THEN                 
    1336       CALL histwrite_phy(nid_files(iff),o_dvdyn%name,itau_w,d_v_dyn) 
     1607      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1608     $o_dvdyn%name,itau_w,d_v_dyn) 
    13371609       ENDIF                                                     
    13381610
    13391611       IF (o_dtcon%flag(iff)<=lev_files(iff)) THEN
    13401612      zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys
    1341       CALL histwrite_phy(nid_files(iff),o_dtcon%name,itau_w,zx_tmp_fi3d)
    1342        ENDIF
     1613      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1614     $o_dtcon%name,itau_w,zx_tmp_fi3d)
     1615      ENDIF                                                     
     1616
     1617      if(iflag_thermals.eq.1)then
     1618      IF (o_tntc%flag(iff)<=lev_files(iff)) THEN
     1619      zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys +
     1620     $                           d_t_ajsb(1:klon,1:klev)/pdtphys
     1621      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1622     $o_tntc%name,itau_w,zx_tmp_fi3d)
     1623      ENDIF
     1624      else if(iflag_thermals.gt.1.and.iflag_wake.EQ.1)then
     1625      IF (o_tntc%flag(iff)<=lev_files(iff)) THEN
     1626      zx_tmp_fi3d(1:klon,1:klev)=d_t_con(1:klon,1:klev)/pdtphys +
     1627     $                           d_t_ajs(1:klon,1:klev)/pdtphys +
     1628     $                           d_t_wake(1:klon,1:klev)/pdtphys
     1629      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1630     $o_tntc%name,itau_w,zx_tmp_fi3d)
     1631      ENDIF
     1632      endif
    13431633
    13441634       IF (o_ducon%flag(iff)<=lev_files(iff)) THEN
    13451635      zx_tmp_fi3d(1:klon,1:klev)=d_u_con(1:klon,1:klev)/pdtphys
    1346       CALL histwrite_phy(nid_files(iff),o_ducon%name,itau_w,zx_tmp_fi3d)
     1636      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1637     $o_ducon%name,itau_w,zx_tmp_fi3d)
    13471638       ENDIF
    13481639
    13491640       IF (o_dqcon%flag(iff)<=lev_files(iff)) THEN
    13501641      zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
    1351       CALL histwrite_phy(nid_files(iff),o_dqcon%name,itau_w,zx_tmp_fi3d)
    1352        ENDIF
     1642      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1643     $o_dqcon%name,itau_w,zx_tmp_fi3d)
     1644       ENDIF
     1645
     1646      if(iflag_thermals.eq.1)then
     1647       IF (o_tnhusc%flag(iff)<=lev_files(iff)) THEN
     1648      zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
     1649      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1650     $o_tnhusc%name,itau_w,zx_tmp_fi3d)
     1651       ENDIF
     1652      else if(iflag_thermals.gt.1.and.iflag_wake.EQ.1)then
     1653      IF (o_tnhusc%flag(iff)<=lev_files(iff)) THEN
     1654      zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys +
     1655     $                           d_q_ajs(1:klon,1:klev)/pdtphys +
     1656     $                           d_q_wake(1:klon,1:klev)/pdtphys
     1657      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1658     $o_tnhusc%name,itau_w,zx_tmp_fi3d)
     1659      ENDIF
     1660      endif
    13531661
    13541662       IF (o_dtlsc%flag(iff)<=lev_files(iff)) THEN
    13551663      zx_tmp_fi3d(1:klon,1:klev)=d_t_lsc(1:klon,1:klev)/pdtphys
    1356       CALL histwrite_phy(nid_files(iff),o_dtlsc%name,itau_w,zx_tmp_fi3d)
     1664      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1665     $o_dtlsc%name,itau_w,zx_tmp_fi3d)
    13571666       ENDIF
    13581667
     
    13601669      zx_tmp_fi3d(1:klon, 1:klev)=(d_t_lsc(1:klon,1:klev)+
    13611670     $                           d_t_eva(1:klon,1:klev))/pdtphys
    1362       CALL histwrite_phy(nid_files(iff),
     1671      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    13631672     s                   o_dtlschr%name,itau_w,zx_tmp_fi3d)
    13641673       ENDIF
     
    13661675       IF (o_dqlsc%flag(iff)<=lev_files(iff)) THEN
    13671676      zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys
    1368       CALL histwrite_phy(nid_files(iff),o_dqlsc%name,itau_w,zx_tmp_fi3d)
     1677      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1678     $o_dqlsc%name,itau_w,zx_tmp_fi3d)
    13691679       ENDIF
    13701680
     
    13761686      zx_tmp_fi3d(1:klon,1:klev)=d_t_lscth(1:klon,1:klev)/pdtphys
    13771687      CALL
    1378      s histwrite_phy(nid_files(iff),o_dtlscth%name,itau_w,zx_tmp_fi3d)
     1688     s histwrite_phy(nid_files(iff),clef_stations(iff),
     1689     $o_dtlscth%name,itau_w,zx_tmp_fi3d)
    13791690       ENDIF
    13801691
     
    13821693      zx_tmp_fi3d(1:klon,1:klev)=d_t_lscst(1:klon,1:klev)/pdtphys
    13831694      CALL
    1384      s histwrite_phy(nid_files(iff),o_dtlscst%name,itau_w,zx_tmp_fi3d)
     1695     s histwrite_phy(nid_files(iff),clef_stations(iff),
     1696     $o_dtlscst%name,itau_w,zx_tmp_fi3d)
    13851697       ENDIF
    13861698
     
    13881700      zx_tmp_fi3d(1:klon,1:klev)=d_q_lscth(1:klon,1:klev)/pdtphys
    13891701      CALL
    1390      s histwrite_phy(nid_files(iff),o_dqlscth%name,itau_w,zx_tmp_fi3d)
     1702     s histwrite_phy(nid_files(iff),clef_stations(iff),
     1703     $o_dqlscth%name,itau_w,zx_tmp_fi3d)
    13911704       ENDIF
    13921705
     
    13941707      zx_tmp_fi3d(1:klon,1:klev)=d_q_lscst(1:klon,1:klev)/pdtphys
    13951708      CALL
    1396      s histwrite_phy(nid_files(iff),o_dqlscst%name,itau_w,zx_tmp_fi3d)
     1709     s histwrite_phy(nid_files(iff),clef_stations(iff),
     1710     $o_dqlscst%name,itau_w,zx_tmp_fi3d)
    13971711       ENDIF
    13981712
    13991713       IF (o_plulth%flag(iff)<=lev_files(iff)) THEN
    1400       CALL histwrite_phy(nid_files(iff),o_plulth%name,itau_w,plul_th)
     1714      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1715     $o_plulth%name,itau_w,plul_th)
    14011716       ENDIF
    14021717
    14031718       IF (o_plulst%flag(iff)<=lev_files(iff)) THEN
    1404       CALL histwrite_phy(nid_files(iff),o_plulst%name,itau_w,plul_st)
     1719      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1720     $o_plulst%name,itau_w,plul_st)
    14051721       ENDIF
    14061722
     
    14161732       IF (o_ptconvth%flag(iff)<=lev_files(iff)) THEN
    14171733      CALL
    1418      s  histwrite_phy(nid_files(iff),o_ptconvth%name,itau_w,zx_tmp_fi3d)
     1734     s  histwrite_phy(nid_files(iff),clef_stations(iff),
     1735     $o_ptconvth%name,itau_w,zx_tmp_fi3d)
    14191736       ENDIF
    14201737
     
    14241741       IF (o_ptconvth%flag(iff)<=lev_files(iff)) THEN
    14251742      CALL
    1426      s histwrite_phy(nid_files(iff),o_lmaxth%name,itau_w,zx_tmp_fi2d)
     1743     s histwrite_phy(nid_files(iff),clef_stations(iff),
     1744     $o_lmaxth%name,itau_w,zx_tmp_fi2d)
    14271745       ENDIF
    14281746
     
    14331751       IF (o_dtvdf%flag(iff)<=lev_files(iff)) THEN
    14341752      zx_tmp_fi3d(1:klon,1:klev)=d_t_vdf(1:klon,1:klev)/pdtphys
    1435       CALL histwrite_phy(nid_files(iff),o_dtvdf%name,itau_w,zx_tmp_fi3d)
     1753      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1754     $o_dtvdf%name,itau_w,zx_tmp_fi3d)
    14361755       ENDIF
    14371756
    14381757       IF (o_dqvdf%flag(iff)<=lev_files(iff)) THEN
    14391758      zx_tmp_fi3d(1:klon,1:klev)=d_q_vdf(1:klon,1:klev)/pdtphys
    1440       CALL histwrite_phy(nid_files(iff),o_dqvdf%name,itau_w,zx_tmp_fi3d)
     1759      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1760     $o_dqvdf%name,itau_w,zx_tmp_fi3d)
    14411761       ENDIF
    14421762
    14431763       IF (o_dteva%flag(iff)<=lev_files(iff)) THEN
    14441764      zx_tmp_fi3d(1:klon,1:klev)=d_t_eva(1:klon,1:klev)/pdtphys
    1445       CALL histwrite_phy(nid_files(iff),o_dteva%name,itau_w,zx_tmp_fi3d)
     1765      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1766     $o_dteva%name,itau_w,zx_tmp_fi3d)
    14461767       ENDIF
    14471768
    14481769       IF (o_dqeva%flag(iff)<=lev_files(iff)) THEN
    14491770      zx_tmp_fi3d(1:klon,1:klev)=d_q_eva(1:klon,1:klev)/pdtphys
    1450       CALL histwrite_phy(nid_files(iff),o_dqeva%name,itau_w,zx_tmp_fi3d)
     1771      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1772     $o_dqeva%name,itau_w,zx_tmp_fi3d)
    14511773       ENDIF
    14521774
     
    14541776      zpt_conv = 0.
    14551777      where (ptconv) zpt_conv = 1.
    1456       CALL histwrite_phy(nid_files(iff),o_ptconv%name,itau_w,zpt_conv)
     1778      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1779     $o_ptconv%name,itau_w,zpt_conv)
    14571780       ENDIF
    14581781
    14591782       IF (o_ratqs%flag(iff)<=lev_files(iff)) THEN
    1460       CALL histwrite_phy(nid_files(iff),o_ratqs%name,itau_w,ratqs)
     1783      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1784     $o_ratqs%name,itau_w,ratqs)
    14611785       ENDIF
    14621786
    14631787       IF (o_dtthe%flag(iff)<=lev_files(iff)) THEN
    1464       zx_tmp_fi3d(1:klon,1:klev)=d_t_ajs(1:klon,1:klev)/pdtphys
    1465       CALL histwrite_phy(nid_files(iff),o_dtthe%name,itau_w,zx_tmp_fi3d)
     1788      zx_tmp_fi3d(1:klon,1:klev)=d_t_ajs(1:klon,1:klev)/pdtphys -
     1789     $                           d_t_ajsb(1:klon,1:klev)/pdtphys
     1790      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1791     $o_dtthe%name,itau_w,zx_tmp_fi3d)
    14661792       ENDIF
    14671793
     
    14701796! Pour l instant 0 a y reflichir pour les thermiques
    14711797         zx_tmp_fi2d=0.
    1472         CALL histwrite_phy(nid_files(iff),o_ftime_th%name,
     1798        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1799     $o_ftime_th%name,
    14731800     s                     itau_w,zx_tmp_fi2d)
    14741801        ENDIF
    14751802
    14761803        IF (o_f_th%flag(iff)<=lev_files(iff)) THEN
    1477         CALL histwrite_phy(nid_files(iff),o_f_th%name,itau_w,fm_therm)
     1804        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1805     $o_f_th%name,itau_w,fm_therm)
    14781806        ENDIF
    14791807
    14801808        IF (o_e_th%flag(iff)<=lev_files(iff)) THEN
    1481         CALL histwrite_phy(nid_files(iff),o_e_th%name,itau_w,entr_therm)
     1809        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1810     $o_e_th%name,itau_w,entr_therm)
    14821811        ENDIF
    14831812
    14841813        IF (o_w_th%flag(iff)<=lev_files(iff)) THEN
    1485         CALL histwrite_phy(nid_files(iff),o_w_th%name,itau_w,zw2)
     1814        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1815     $o_w_th%name,itau_w,zw2)
    14861816        ENDIF
    14871817
    14881818        IF (o_q_th%flag(iff)<=lev_files(iff)) THEN
    1489         CALL histwrite_phy(nid_files(iff),o_q_th%name,itau_w,zqasc)
     1819        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1820     $o_q_th%name,itau_w,zqasc)
    14901821        ENDIF
    14911822
    14921823        IF (o_lambda_th%flag(iff)<=lev_files(iff)) THEN
    1493         CALL histwrite_phy(nid_files(iff),
     1824        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    14941825     s                     o_lambda_th%name,itau_w,lambda_th)
    14951826        ENDIF
    14961827
    14971828        IF (o_a_th%flag(iff)<=lev_files(iff)) THEN
    1498         CALL histwrite_phy(nid_files(iff),o_a_th%name,itau_w,fraca)
     1829        CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1830     $o_a_th%name,itau_w,fraca)
    14991831        ENDIF
    15001832
    15011833       IF (o_d_th%flag(iff)<=lev_files(iff)) THEN
    1502        CALL histwrite_phy(nid_files(iff),o_d_th%name,itau_w,detr_therm)
    1503        ENDIF
    1504 
     1834       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1835     $o_d_th%name,itau_w,detr_therm)
     1836       ENDIF
    15051837
    15061838       IF (o_f0_th%flag(iff)<=lev_files(iff)) THEN
    1507       CALL histwrite_phy(nid_files(iff),o_f0_th%name,itau_w,f0)
     1839      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1840     $o_f0_th%name,itau_w,f0)
    15081841       ENDIF
    15091842
    15101843       IF (o_zmax_th%flag(iff)<=lev_files(iff)) THEN
    1511        CALL histwrite_phy(nid_files(iff),o_zmax_th%name,itau_w,zmax_th)
     1844       CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1845     $o_zmax_th%name,itau_w,zmax_th)
    15121846       ENDIF
    15131847
    15141848       IF (o_dqthe%flag(iff)<=lev_files(iff)) THEN
    1515       zx_tmp_fi3d(1:klon,1:klev)=d_q_ajs(1:klon,1:klev)/pdtphys
    1516       CALL histwrite_phy(nid_files(iff),o_dqthe%name,itau_w,zx_tmp_fi3d)
     1849      zx_tmp_fi3d(1:klon,1:klev)=d_q_ajs(1:klon,1:klev)/pdtphys -
     1850     $                           d_q_ajsb(1:klon,1:klev)/pdtphys
     1851      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1852     $o_dqthe%name,itau_w,zx_tmp_fi3d)
    15171853       ENDIF
    15181854
     
    15211857       IF (o_dtajs%flag(iff)<=lev_files(iff)) THEN
    15221858      zx_tmp_fi3d(1:klon,1:klev)=d_t_ajsb(1:klon,1:klev)/pdtphys
    1523       CALL histwrite_phy(nid_files(iff),o_dtajs%name,itau_w,zx_tmp_fi3d)
     1859      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1860     $o_dtajs%name,itau_w,zx_tmp_fi3d)
    15241861       ENDIF
    15251862
    15261863       IF (o_dqajs%flag(iff)<=lev_files(iff)) THEN
    15271864      zx_tmp_fi3d(1:klon,1:klev)=d_q_ajsb(1:klon,1:klev)/pdtphys
    1528       CALL histwrite_phy(nid_files(iff),o_dqajs%name,itau_w,zx_tmp_fi3d)
     1865      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1866     $o_dqajs%name,itau_w,zx_tmp_fi3d)
    15291867       ENDIF
    15301868
    15311869       IF (o_dtswr%flag(iff)<=lev_files(iff)) THEN
    15321870      zx_tmp_fi3d(1:klon,1:klev)=heat(1:klon,1:klev)/RDAY
    1533       CALL histwrite_phy(nid_files(iff),o_dtswr%name,itau_w,zx_tmp_fi3d)
     1871      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1872     $o_dtswr%name,itau_w,zx_tmp_fi3d)
    15341873       ENDIF
    15351874
    15361875       IF (o_dtsw0%flag(iff)<=lev_files(iff)) THEN
    15371876      zx_tmp_fi3d(1:klon,1:klev)=heat0(1:klon,1:klev)/RDAY
    1538       CALL histwrite_phy(nid_files(iff),o_dtsw0%name,itau_w,zx_tmp_fi3d)
     1877      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1878     $o_dtsw0%name,itau_w,zx_tmp_fi3d)
    15391879       ENDIF
    15401880
    15411881       IF (o_dtlwr%flag(iff)<=lev_files(iff)) THEN
    15421882      zx_tmp_fi3d(1:klon,1:klev)=-1.*cool(1:klon,1:klev)/RDAY
    1543       CALL histwrite_phy(nid_files(iff),o_dtlwr%name,itau_w,zx_tmp_fi3d)
     1883      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1884     $o_dtlwr%name,itau_w,zx_tmp_fi3d)
    15441885       ENDIF
    15451886
    15461887       IF (o_dtlw0%flag(iff)<=lev_files(iff)) THEN
    15471888      zx_tmp_fi3d(1:klon,1:klev)=-1.*cool0(1:klon,1:klev)/RDAY
    1548       CALL histwrite_phy(nid_files(iff),o_dtlw0%name,itau_w,zx_tmp_fi3d)
     1889      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1890     $o_dtlw0%name,itau_w,zx_tmp_fi3d)
    15491891       ENDIF
    15501892
    15511893       IF (o_dtec%flag(iff)<=lev_files(iff)) THEN
    15521894      zx_tmp_fi3d(1:klon,1:klev)=d_t_ec(1:klon,1:klev)
    1553       CALL histwrite_phy(nid_files(iff),o_dtec%name,itau_w,zx_tmp_fi3d)
     1895      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1896     $o_dtec%name,itau_w,zx_tmp_fi3d)
    15541897       ENDIF
    15551898
    15561899       IF (o_duvdf%flag(iff)<=lev_files(iff)) THEN
    15571900      zx_tmp_fi3d(1:klon,1:klev)=d_u_vdf(1:klon,1:klev)/pdtphys
    1558       CALL histwrite_phy(nid_files(iff),o_duvdf%name,itau_w,zx_tmp_fi3d)
     1901      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1902     $o_duvdf%name,itau_w,zx_tmp_fi3d)
    15591903       ENDIF
    15601904
    15611905       IF (o_dvvdf%flag(iff)<=lev_files(iff)) THEN
    15621906      zx_tmp_fi3d(1:klon,1:klev)=d_v_vdf(1:klon,1:klev)/pdtphys
    1563       CALL histwrite_phy(nid_files(iff),o_dvvdf%name,itau_w,zx_tmp_fi3d)
     1907      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1908     $o_dvvdf%name,itau_w,zx_tmp_fi3d)
    15641909       ENDIF
    15651910
     
    15671912      IF (o_duoro%flag(iff)<=lev_files(iff)) THEN
    15681913      zx_tmp_fi3d(1:klon,1:klev)=d_u_oro(1:klon,1:klev)/pdtphys
    1569       CALL histwrite_phy(nid_files(iff),o_duoro%name,itau_w,zx_tmp_fi3d)
     1914      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1915     $o_duoro%name,itau_w,zx_tmp_fi3d)
    15701916       ENDIF
    15711917
    15721918      IF (o_dvoro%flag(iff)<=lev_files(iff)) THEN
    15731919      zx_tmp_fi3d(1:klon,1:klev)=d_v_oro(1:klon,1:klev)/pdtphys
    1574       CALL histwrite_phy(nid_files(iff),o_dvoro%name,itau_w,zx_tmp_fi3d)
     1920      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1921     $o_dvoro%name,itau_w,zx_tmp_fi3d)
     1922      ENDIF
     1923
     1924      IF (o_dtoro%flag(iff)<=lev_files(iff)) THEN
     1925      zx_tmp_fi3d(1:klon,1:klev)=d_t_oro(1:klon,1:klev)/pdtphys
     1926      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1927     $o_dtoro%name,itau_w,zx_tmp_fi3d)
    15751928      ENDIF
    15761929       ENDIF
     
    15791932       IF (o_dulif%flag(iff)<=lev_files(iff)) THEN
    15801933      zx_tmp_fi3d(1:klon,1:klev)=d_u_lif(1:klon,1:klev)/pdtphys
    1581       CALL histwrite_phy(nid_files(iff),o_dulif%name,itau_w,zx_tmp_fi3d)
     1934      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1935     $o_dulif%name,itau_w,zx_tmp_fi3d)
    15821936       ENDIF
    15831937
    15841938        IF (o_dvlif%flag(iff)<=lev_files(iff)) THEN
    15851939      zx_tmp_fi3d(1:klon,1:klev)=d_v_lif(1:klon,1:klev)/pdtphys
    1586       CALL histwrite_phy(nid_files(iff),o_dvlif%name,itau_w,zx_tmp_fi3d)
    1587        ENDIF
    1588         ENDIF
     1940      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1941     $o_dvlif%name,itau_w,zx_tmp_fi3d)
     1942       ENDIF
     1943
     1944        IF (o_dtlif%flag(iff)<=lev_files(iff)) THEN
     1945      zx_tmp_fi3d(1:klon,1:klev)=d_t_lif(1:klon,1:klev)/pdtphys
     1946      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1947     $o_dtlif%name,itau_w,zx_tmp_fi3d)
     1948       ENDIF
     1949        ENDIF
     1950
     1951       IF (ok_hines) THEN
     1952       IF (o_duhin%flag(iff)<=lev_files(iff)) THEN
     1953      zx_tmp_fi3d(1:klon,1:klev)=d_u_hin(1:klon,1:klev)/pdtphys
     1954      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1955     $o_duhin%name,itau_w,zx_tmp_fi3d)
     1956       ENDIF
     1957
     1958
     1959        IF (o_dvhin%flag(iff)<=lev_files(iff)) THEN
     1960      zx_tmp_fi3d(1:klon,1:klev)=d_v_hin(1:klon,1:klev)/pdtphys
     1961      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1962     $o_dvhin%name,itau_w,zx_tmp_fi3d)
     1963       ENDIF
     1964
     1965        IF (o_dthin%flag(iff)<=lev_files(iff)) THEN
     1966      zx_tmp_fi3d(1:klon,1:klev)=d_t_hin(1:klon,1:klev)/pdtphys
     1967      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1968     $o_dthin%name,itau_w,zx_tmp_fi3d)
     1969       ENDIF
     1970        ENDIF
     1971
     1972       IF (o_rsu%flag(iff)<=lev_files(iff)) THEN
     1973      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1974     $o_rsu%name,itau_w,swup)
     1975       ENDIF
     1976       IF (o_rsd%flag(iff)<=lev_files(iff)) THEN
     1977      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1978     $o_rsd%name,itau_w,swdn)
     1979       ENDIF
     1980       IF (o_rlu%flag(iff)<=lev_files(iff)) THEN
     1981      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1982     $o_rlu%name,itau_w,lwup)
     1983       ENDIF
     1984       IF (o_rld%flag(iff)<=lev_files(iff)) THEN
     1985      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1986     $o_rld%name,itau_w,lwdn)
     1987       ENDIF
     1988
     1989       IF (o_rsucs%flag(iff)<=lev_files(iff)) THEN
     1990      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1991     $o_rsucs%name,itau_w,swup0)
     1992       ENDIF
     1993       IF (o_rsdcs%flag(iff)<=lev_files(iff)) THEN
     1994      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1995     $o_rsdcs%name,itau_w,swdn0)
     1996       ENDIF
     1997       IF (o_rlucs%flag(iff)<=lev_files(iff)) THEN
     1998      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     1999     $o_rlucs%name,itau_w,lwup0)
     2000       ENDIF
     2001       IF (o_rldcs%flag(iff)<=lev_files(iff)) THEN
     2002      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2003     $o_rldcs%name,itau_w,lwdn0)
     2004       ENDIF
     2005
     2006       IF (o_tnt%flag(iff)<=lev_files(iff)) THEN
     2007      zx_tmp_fi3d(1:klon,1:klev)=d_t(1:klon,1:klev)+
     2008     $d_t_dyn(1:klon,1:klev)
     2009      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2010     $o_tnt%name,itau_w,zx_tmp_fi3d)
     2011       ENDIF
     2012
     2013       IF (o_tntr%flag(iff)<=lev_files(iff)) THEN
     2014      zx_tmp_fi3d(1:klon,1:klev)=heat(1:klon,1:klev)/RDAY -
     2015     $cool(1:klon,1:klev)/RDAY
     2016      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2017     $o_tntr%name,itau_w,zx_tmp_fi3d)
     2018       ENDIF
     2019
     2020       IF (o_tntscpbl%flag(iff)<=lev_files(iff)) THEN
     2021      zx_tmp_fi3d(1:klon,1:klev)= (d_t_lsc(1:klon,1:klev)+
     2022     $                             d_t_eva(1:klon,1:klev)+
     2023     $                             d_t_vdf(1:klon,1:klev))/pdtphys
     2024      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2025     $o_tntscpbl%name,itau_w,zx_tmp_fi3d)
     2026       ENDIF
     2027
     2028       IF (o_tnhus%flag(iff)<=lev_files(iff)) THEN
     2029      zx_tmp_fi3d(1:klon,1:klev)=d_qx(1:klon,1:klev,ivap)+
     2030     $d_q_dyn(1:klon,1:klev)
     2031      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2032     $o_tnhus%name,itau_w,zx_tmp_fi3d)
     2033       ENDIF
     2034
     2035       IF (o_tnhusscpbl%flag(iff)<=lev_files(iff)) THEN
     2036      zx_tmp_fi3d(1:klon,1:klev)=d_q_lsc(1:klon,1:klev)/pdtphys+
     2037     $                           d_q_eva(1:klon,1:klev)/pdtphys
     2038      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2039     $o_tnhusscpbl%name,itau_w,zx_tmp_fi3d)
     2040       ENDIF
     2041
     2042       IF (o_evu%flag(iff)<=lev_files(iff)) THEN
     2043      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2044     $o_evu%name,itau_w,coefm)
     2045       ENDIF
     2046
     2047       IF (o_h2o%flag(iff)<=lev_files(iff)) THEN
     2048      zx_tmp_fi3d(1:klon,1:klev)=q_seri(1:klon,1:klev)+
     2049     $                           ql_seri(1:klon,1:klev)
     2050      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2051     $o_h2o%name,itau_w,zx_tmp_fi3d)
     2052       ENDIF
     2053
     2054       IF (o_mcd%flag(iff)<=lev_files(iff)) THEN
     2055      zx_tmp_fi3d(1:klon,1:klev)=-1 * (dnwd(1:klon,1:klev)+
     2056     $                                 dnwd0(1:klon,1:klev))
     2057      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2058     $o_mcd%name,itau_w,zx_tmp_fi3d)
     2059       ENDIF
     2060
     2061       IF (o_dmc%flag(iff)<=lev_files(iff)) THEN
     2062      zx_tmp_fi3d(1:klon,1:klev)=upwd(1:klon,1:klev) +
     2063     $  dnwd(1:klon,1:klev)+ dnwd0(1:klon,1:klev)
     2064      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2065     $o_dmc%name,itau_w,zx_tmp_fi3d)
     2066       ENDIF
     2067
     2068       IF (o_ref_liq%flag(iff)<=lev_files(iff)) THEN
     2069      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2070     $o_ref_liq%name,itau_w,ref_liq)
     2071       ENDIF
     2072
     2073       IF (o_ref_ice%flag(iff)<=lev_files(iff)) THEN
     2074      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2075     $o_ref_ice%name,itau_w,ref_ice)
     2076       ENDIF
     2077
     2078      if (RCO2_per.NE.RCO2_act.OR.RCH4_per.NE.RCH4_act.OR.
     2079     $ RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR.
     2080     $ RCFC12_per.NE.RCFC12_act) THEN
     2081
     2082       IF (o_rsut4co2%flag(iff)<=lev_files(iff)) THEN
     2083      zx_tmp_fi2d(1 : klon) = swupp ( 1 : klon, klevp1 )
     2084      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2085     $o_rsut4co2%name,itau_w,zx_tmp_fi2d)
     2086       ENDIF
     2087
     2088       IF (o_rlut4co2%flag(iff)<=lev_files(iff)) THEN
     2089      zx_tmp_fi2d(1 : klon) = lwupp ( 1 : klon, klevp1 )
     2090      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2091     $o_rlut4co2%name,itau_w,zx_tmp_fi2d)
     2092       ENDIF
     2093
     2094       IF (o_rsutcs4co2%flag(iff)<=lev_files(iff)) THEN
     2095      zx_tmp_fi2d(1 : klon) = swup0p ( 1 : klon, klevp1 )
     2096      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2097     $o_rsutcs4co2%name,itau_w,zx_tmp_fi2d)
     2098       ENDIF
     2099
     2100       IF (o_rlutcs4co2%flag(iff)<=lev_files(iff)) THEN
     2101      zx_tmp_fi2d(1 : klon) = lwup0p ( 1 : klon, klevp1 )
     2102      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2103     $o_rlutcs4co2%name,itau_w,zx_tmp_fi2d)
     2104       ENDIF
     2105
     2106       IF (o_rsu4co2%flag(iff)<=lev_files(iff)) THEN
     2107      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2108     $o_rsu4co2%name,itau_w,swupp)
     2109       ENDIF
     2110
     2111       IF (o_rlu4co2%flag(iff)<=lev_files(iff)) THEN
     2112      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2113     $o_rlu4co2%name,itau_w,lwupp)
     2114       ENDIF
     2115
     2116       IF (o_rsucs4co2%flag(iff)<=lev_files(iff)) THEN
     2117      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2118     $o_rsucs4co2%name,itau_w,swup0p)
     2119       ENDIF
     2120
     2121       IF (o_rlucs4co2%flag(iff)<=lev_files(iff)) THEN
     2122      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2123     $o_rlucs4co2%name,itau_w,lwup0p)
     2124       ENDIF
     2125
     2126       IF (o_rsd4co2%flag(iff)<=lev_files(iff)) THEN
     2127      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2128     $o_rsd4co2%name,itau_w,swdnp)
     2129       ENDIF
     2130
     2131       IF (o_rld4co2%flag(iff)<=lev_files(iff)) THEN
     2132      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2133     $o_rld4co2%name,itau_w,lwdnp)
     2134       ENDIF
     2135
     2136       IF (o_rsdcs4co2%flag(iff)<=lev_files(iff)) THEN
     2137      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2138     $o_rsdcs4co2%name,itau_w,swdn0p)
     2139       ENDIF
     2140
     2141       IF (o_rldcs4co2%flag(iff)<=lev_files(iff)) THEN
     2142      CALL histwrite_phy(nid_files(iff),clef_stations(iff),
     2143     $o_rldcs4co2%name,itau_w,lwdn0p)
     2144       ENDIF
     2145
     2146      endif
    15892147
    15902148        if (nqtot.GE.3) THEN
    15912149         DO iq=3,nqtot
    15922150       IF (o_trac(iq-2)%flag(iff)<=lev_files(iff)) THEN
    1593          CALL histwrite_phy(nid_files(iff),
     2151         CALL histwrite_phy(nid_files(iff),clef_stations(iff),
    15942152     s                  o_trac(iq-2)%name,itau_w,qx(:,:,iq))
    15952153       ENDIF
     
    15992157      if (ok_sync) then
    16002158c$OMP MASTER
    1601         call histsync(nid_files(iff))
     2159      call histsync(nid_files(iff))
    16022160c$OMP END MASTER
    16032161      endif
  • LMDZ5/trunk/libf/phylmd/phys_state_var_mod.F90

    r1403 r1539  
    280280      REAL,ALLOCATABLE,SAVE :: albpla(:)
    281281!$OMP THREADPRIVATE(albpla)
     282
     283!IM ajout variables CFMIP2/CMIP5
     284      REAL,ALLOCATABLE,SAVE :: heatp(:,:), coolp(:,:)
     285!$OMP THREADPRIVATE(heatp, coolp)
     286      REAL,ALLOCATABLE,SAVE :: heat0p(:,:), cool0p(:,:)
     287!$OMP THREADPRIVATE(heat0p, cool0p)
     288      REAL,ALLOCATABLE,SAVE :: radsolp(:), topswp(:), toplwp(:)
     289!$OMP THREADPRIVATE(radsolp, topswp, toplwp)
     290      REAL,ALLOCATABLE,SAVE :: albplap(:)
     291!$OMP THREADPRIVATE(albplap)
     292      REAL,ALLOCATABLE,SAVE :: solswp(:), sollwp(:)
     293!$OMP THREADPRIVATE(solswp, sollwp)
     294      REAL,ALLOCATABLE,SAVE :: sollwdownp(:)
     295!$OMP THREADPRIVATE(sollwdownp)
     296      REAL,ALLOCATABLE,SAVE :: topsw0p(:),toplw0p(:)
     297      REAL,ALLOCATABLE,SAVE :: solsw0p(:),sollw0p(:)
     298!$OMP THREADPRIVATE(topsw0p,toplw0p,solsw0p,sollw0p)
     299      REAL,ALLOCATABLE,SAVE :: lwdn0p(:,:), lwdnp(:,:)
     300      REAL,ALLOCATABLE,SAVE :: lwup0p(:,:), lwupp(:,:)
     301!$OMP THREADPRIVATE(lwdn0p, lwdnp, lwup0p, lwupp)
     302      REAL,ALLOCATABLE,SAVE :: swdn0p(:,:), swdnp(:,:)
     303      REAL,ALLOCATABLE,SAVE :: swup0p(:,:), swupp(:,:)
     304!$OMP THREADPRIVATE(swdn0p, swdnp, swup0p, swupp)
     305
    282306! pbase : cloud base pressure
    283307! bbase : cloud base buoyancy
     
    446470      ALLOCATE(topsw0(klon),toplw0(klon),solsw0(klon),sollw0(klon))
    447471      ALLOCATE(albpla(klon))
     472!IM ajout variables CFMIP2/CMIP5
     473      ALLOCATE(heatp(klon,klev), coolp(klon,klev))
     474      ALLOCATE(heat0p(klon,klev), cool0p(klon,klev))
     475      ALLOCATE(radsolp(klon), topswp(klon), toplwp(klon))
     476      ALLOCATE(albplap(klon))
     477      ALLOCATE(solswp(klon), sollwp(klon))
     478      ALLOCATE(sollwdownp(klon))
     479      ALLOCATE(topsw0p(klon),toplw0p(klon))
     480      ALLOCATE(solsw0p(klon),sollw0p(klon))
     481      ALLOCATE(lwdn0p(klon,klevp1), lwdnp(klon,klevp1))
     482      ALLOCATE(lwup0p(klon,klevp1), lwupp(klon,klevp1))
     483      ALLOCATE(swdn0p(klon,klevp1), swdnp(klon,klevp1))
     484      ALLOCATE(swup0p(klon,klevp1), swupp(klon,klevp1))
     485
    448486      ALLOCATE(cape(klon))
    449487      ALLOCATE(pbase(klon),bbase(klon))
     
    539577      deallocate(topsw0,toplw0,solsw0,sollw0)
    540578      deallocate(albpla)
     579!IM ajout variables CFMIP2/CMIP5
     580      deallocate(heatp, coolp)
     581      deallocate(heat0p, cool0p)
     582      deallocate(radsolp, topswp, toplwp)
     583      deallocate(albplap)
     584      deallocate(solswp, sollwp)
     585      deallocate(sollwdownp)
     586      deallocate(topsw0p,toplw0p)
     587      deallocate(solsw0p,sollw0p)
     588      deallocate(lwdn0p, lwdnp)
     589      deallocate(lwup0p, lwupp)
     590      deallocate(swdn0p, swdnp)
     591      deallocate(swup0p, swupp)
    541592      deallocate(cape)
    542593      deallocate(pbase,bbase)
  • LMDZ5/trunk/libf/phylmd/physiq.F

    r1538 r1539  
    4444
    4545
     46!IM stations CFMIP
     47      USE CFMIP_point_locations
    4648      IMPLICIT none
    4749c======================================================================
     
    699701cAA
    700702      REAL coefh(klon,klev)     ! coef d'echange pour phytrac, valable pour 2<=k<=klev
     703      REAL coefm(klon,klev)     ! coef d'echange pour U, V
    701704      REAL u1(klon)             ! vents dans la premiere couche U
    702705      REAL v1(klon)             ! vents dans la premiere couche V
     
    10111014      REAL zx_tmp_fi2d(klon)      ! variable temporaire grille physique
    10121015      REAL zx_tmp_fi3d(klon,klev) ! variable temporaire pour champs 3D
     1016      REAL zx_tmp_fi3d1(klon,klev+1) !variable temporaire pour champs 3D (kelvp1)
    10131017c#ifdef histNMC
    10141018cym   A voir plus tard !!!!
     
    10411045      REAL ue_lay(klon,klev) ! transport zonal de l'energie a chaque niveau vert.
    10421046      REAL uq_lay(klon,klev) ! transport zonal de l'eau a chaque niveau vert.
    1043 c
    1044 cIM 280405 END
    10451047c
    10461048      INTEGER nhori, nvert, nvert1, nvert3
     
    11881190      REAL grain(1), gtsol(1), gt2m(1), gprw(1)
    11891191
     1192cIM stations CFMIP
     1193      INTEGER, SAVE :: nCFMIP
     1194c$OMP THREADPRIVATE(nCFMIP)
     1195      INTEGER, PARAMETER :: npCFMIP=120
     1196      INTEGER, ALLOCATABLE, SAVE :: tabCFMIP(:)
     1197      REAL, ALLOCATABLE, SAVE :: lonCFMIP(:), latCFMIP(:)
     1198c$OMP THREADPRIVATE(tabCFMIP, lonCFMIP, latCFMIP)
     1199      INTEGER, ALLOCATABLE, SAVE :: tabijGCM(:)
     1200      REAL, ALLOCATABLE, SAVE :: lonGCM(:), latGCM(:)
     1201c$OMP THREADPRIVATE(tabijGCM, lonGCM, latGCM)
     1202      INTEGER, ALLOCATABLE, SAVE :: iGCM(:), jGCM(:)
     1203c$OMP THREADPRIVATE(iGCM, jGCM)
     1204      logical, dimension(nfiles)            :: phys_out_filestations
     1205      logical, parameter :: lNMC=.FALSE.
     1206
     1207cIM betaCRF
     1208      REAL, SAVE :: pfree, beta_pbl, beta_free
     1209c$OMP THREADPRIVATE(pfree, beta_pbl, beta_free)
     1210      REAL, SAVE :: lon1_beta,  lon2_beta, lat1_beta, lat2_beta
     1211c$OMP THREADPRIVATE(lon1_beta,  lon2_beta, lat1_beta, lat2_beta)
     1212      LOGICAL, SAVE :: mskocean_beta
     1213c$OMP THREADPRIVATE(mskocean_beta)
     1214      REAL, dimension(klon, klev) :: beta       ! facteur sur cldtaurad et cldemirad pour evaluer les retros liees aux CRF
     1215      REAL, dimension(klon, klev) :: cldtaurad  ! epaisseur optique pour radlwsw,COSP
     1216      REAL, dimension(klon, klev) :: cldemirad  ! emissivite pour radlwsw,COSP
     1217
    11901218cIM for NMC files
    11911219      missing_val=nf90_fill_real
     
    14721500
    14731501c================================================================================
    1474 
     1502cIM stations CFMIP
     1503      nCFMIP=npCFMIP
     1504      OPEN(98,file='npCFMIP_param.data',status='old',
     1505     $          form='formatted',err=999)
     1506      READ(98,*,end=998) nCFMIP
     1507998   CONTINUE
     1508      CLOSE(98)
     1509      CONTINUE
     1510      IF(nCFMIP.GT.npCFMIP) THEN
     1511       print*,'nCFMIP > npCFMIP : augmenter npCFMIP et recompiler'
     1512       CALL abort
     1513      else
     1514       print*,'physiq npCFMIP=',npCFMIP,'nCFMIP=',nCFMIP
     1515      ENDIF
     1516c
     1517      ALLOCATE(tabCFMIP(nCFMIP))
     1518      ALLOCATE(lonCFMIP(nCFMIP), latCFMIP(nCFMIP))
     1519      ALLOCATE(tabijGCM(nCFMIP))
     1520      ALLOCATE(lonGCM(nCFMIP), latGCM(nCFMIP))
     1521      ALLOCATE(iGCM(nCFMIP), jGCM(nCFMIP))
     1522c
     1523c lecture des nCFMIP stations CFMIP, de leur numero
     1524c et des coordonnees geographiques lonCFMIP, latCFMIP
     1525c
     1526         CALL read_CFMIP_point_locations(nCFMIP, tabCFMIP,
     1527     $lonCFMIP, latCFMIP)
     1528c
     1529c identification des
     1530c 1) coordonnees lonGCM, latGCM des points CFMIP dans la grille de LMDZ
     1531c 2) indices points tabijGCM de la grille physique 1d sur klon points
     1532c 3) indices iGCM, jGCM de la grille physique 2d
     1533c
     1534         CALL LMDZ_CFMIP_point_locations(nCFMIP, lonCFMIP, latCFMIP,
     1535     $tabijGCM, lonGCM, latGCM, iGCM, jGCM)
     1536c
     1537999      CONTINUE
    14751538         ENDIF !debut
    1476 
     1539 
    14771540           DO i=1,klon
    14781541             rugoro(i) = f_rugoro * MAX(1.0e-05, zstd(i)*zsig(i)/2.0)
     
    15121575     .                   lmt_pas
    15131576c
    1514 cIM 030306 END
    1515 
    15161577      capemaxcels = 't_max(X)'
    15171578      t2mincels = 't_min(X)'
     
    15301591
    15311592c$OMP MASTER
    1532        call phys_output_open(jjmp1,nlevSTD,clevSTD,nbteta,
    1533      &                        ctetaSTD,dtime,ok_veget,
    1534      &                        type_ocean,iflag_pbl,ok_mensuel,ok_journe,
    1535      &                        ok_hf,ok_instan,ok_LES,ok_ade,ok_aie,
    1536      &                        read_climoz, new_aod, aerosol_couple
     1593       call phys_output_open(rlon,rlat,nCFMIP,tabijGCM,
     1594     &                       iGCM,jGCM,lonGCM,latGCM,
     1595     &                       jjmp1,nlevSTD,clevSTD,
     1596     &                       nbteta, ctetaSTD, dtime,ok_veget,
     1597     &                       type_ocean,iflag_pbl,ok_mensuel,ok_journe,
     1598     &                       ok_hf,ok_instan,ok_LES,ok_ade,ok_aie,
     1599     &                       read_climoz, phys_out_filestations,
     1600     &                       new_aod, aerosol_couple
    15371601     &                        )
    15381602c$OMP END MASTER
     
    15551619#endif
    15561620
    1557 cIM 250308bad guide        ecrit_hf2mth = 30*1/ecrit_hf
    15581621         ecrit_hf2mth = ecrit_mth/ecrit_hf
    15591622
     
    15681631         ecrit_reg = ecrit_reg * un_jour
    15691632         ecrit_tra = ecrit_tra * un_jour
    1570          ecrit_ISCCP = ecrit_ISCCP * un_jour
    15711633         ecrit_LES = ecrit_LES * un_jour
    15721634c
     
    15741636     .   ecrit_hf,ecrit_day,ecrit_mth,ecrit_reg,ecrit_tra,ecrit_ISCCP,
    15751637     .   ecrit_hf2mth
    1576 cIM 030306 END
    1577 
    15781638
    15791639cXXXPB Positionner date0 pour initialisation de ORCHIDEE
     
    16331693      END IF
    16341694C$omp end single
     1695c
     1696cIM betaCRF
     1697      pfree=70000. !Pa
     1698      beta_pbl=1.
     1699      beta_free=1.
     1700      lon1_beta=-180.
     1701      lon2_beta=+180.
     1702      lat1_beta=90.
     1703      lat2_beta=-90.
     1704      mskocean_beta=.FALSE.
     1705
     1706      OPEN(99,file='beta_crf.data',status='old',
     1707     $          form='formatted',err=9999)
     1708      READ(99,*,end=9998) pfree
     1709      READ(99,*,end=9998) beta_pbl
     1710      READ(99,*,end=9998) beta_free
     1711      READ(99,*,end=9998) lon1_beta
     1712      READ(99,*,end=9998) lon2_beta
     1713      READ(99,*,end=9998) lat1_beta
     1714      READ(99,*,end=9998) lat2_beta
     1715      READ(99,*,end=9998) mskocean_beta
     17169998  Continue
     1717      CLOSE(99)
     17189999  Continue
     1719      WRITE(*,*)'pfree=',pfree
     1720      WRITE(*,*)'beta_pbl=',beta_pbl
     1721      WRITE(*,*)'beta_free=',beta_free
     1722      WRITE(*,*)'lon1_beta=',lon1_beta
     1723      WRITE(*,*)'lon2_beta=',lon2_beta
     1724      WRITE(*,*)'lat1_beta=',lat1_beta
     1725      WRITE(*,*)'lat2_beta=',lat2_beta
     1726      WRITE(*,*)'mskocean_beta=',mskocean_beta
    16351727      ENDIF
    16361728!
     
    19492041     s     zxtsol,    zxfluxlat, zt2m,    qsat2m,
    19502042     s     d_t_vdf,   d_q_vdf,   d_u_vdf, d_v_vdf,
    1951      s     coefh,     slab_wfbils,               
     2043     s     coefh,     coefm,     slab_wfbils,               
    19522044     d     qsol,      zq2m,      s_pblh,  s_lcl,
    19532045     d     s_capCL,   s_oliqCL,  s_cteiCL,s_pblT,
     
    19652057! ajout des tendances de la diffusion turbulente
    19662058      CALL add_phys_tend(d_u_vdf,d_v_vdf,d_t_vdf,d_q_vdf,dql0,'vdf')
    1967 
    19682059!-----------------------------------------------------------------------------------------
    19692060
     
    21032194            enddo
    21042195         enddo
    2105 
    21062196     
    21072197cc--   Calcul de l'energie disponible ALE (J/kg) et de la puissance disponible ALP (W/m2)
     
    25242614
    25252615
    2526 
    25272616c  Ajustement sec
    25282617c  ==============
     
    27402829
    27412830
    2742 
    27432831c
    27442832c Appeler le processus de condensation a grande echelle
     
    28732961     &        tausum_aero, tau3d_aero)
    28742962      ELSE
    2875 cIM 170310 BEG
    28762963         tausum_aero(:,:,:) = 0.
    2877 cIM 170310 END
    28782964         tau_aero(:,:,:,:) = 0.
    28792965         piz_aero(:,:,:,:) = 0.
     
    31493235      endif
    31503236c
     3237cIM betaCRF
     3238c
     3239      cldtaurad = cldtau
     3240      cldemirad = cldemi
     3241c
     3242      if(lon1_beta.EQ.-180..AND.lon2_beta.EQ.180..AND.
     3243     $lat1_beta.EQ.90..AND.lat2_beta.EQ.-90.) THEN
     3244c
     3245c global
     3246c
     3247       DO k=1, klev
     3248       DO i=1, klon
     3249        if (pplay(i,k).GE.pfree) THEN
     3250         beta(i,k) = beta_pbl
     3251        else
     3252         beta(i,k) = beta_free
     3253        endif
     3254        if (mskocean_beta) THEN
     3255         beta(i,k) = beta(i,k) * pctsrf(i,is_oce)
     3256        endif
     3257        cldtaurad(i,k) = cldtau(i,k) * beta(i,k)
     3258        cldemirad(i,k) = cldemi(i,k) * beta(i,k)
     3259       ENDDO
     3260       ENDDO
     3261c
     3262      else
     3263c
     3264c regional
     3265c
     3266       DO k=1, klev
     3267       DO i=1,klon
     3268c
     3269        if (rlon(i).ge.lon1_beta.AND.rlon(i).le.lon2_beta.AND.
     3270     $      rlat(i).le.lat1_beta.AND.rlat(i).ge.lat2_beta) THEN
     3271         if (pplay(i,k).GE.pfree) THEN
     3272          beta(i,k) = beta_pbl
     3273         else
     3274          beta(i,k) = beta_free
     3275         endif
     3276         if (mskocean_beta) THEN
     3277          beta(i,k) = beta(i,k) * pctsrf(i,is_oce)
     3278         endif
     3279        cldtaurad(i,k) = cldtau(i,k) * beta(i,k)
     3280        cldemirad(i,k) = cldemi(i,k) * beta(i,k)
     3281        endif
     3282c
     3283       ENDDO
     3284       ENDDO
     3285c
     3286      endif
     3287c
    31513288c Appeler le rayonnement mais calculer tout d'abord l'albedo du sol.
    31523289c
     
    31773314     e        paprs, pplay,zxtsol,albsol1, albsol2, t_seri,q_seri,
    31783315     e        wo(:, :, 1),
    3179      e        cldfra, cldemi, cldtau,
     3316     e        cldfra, cldemirad, cldtaurad,
    31803317     s        heat,heat0,cool,cool0,radsol,albpla,
    31813318     s        topsw,toplw,solsw,sollw,
     
    31953332#endif
    31963333      ELSE
    3197 
     3334c
     3335cIM calcul radiatif pour le cas actuel
     3336c
     3337       RCO2 = RCO2_act
     3338       RCH4 = RCH4_act
     3339       RN2O = RN2O_act
     3340       RCFC11 = RCFC11_act
     3341       RCFC12 = RCFC12_act
     3342c
    31983343         CALL radlwsw
    31993344     e        (dist, rmu0, fract,
    32003345     e        paprs, pplay,zxtsol,albsol1, albsol2,
    32013346     e        t_seri,q_seri,wo,
    3202      e        cldfra, cldemi, cldtau,
     3347     e        cldfra, cldemirad, cldtaurad,
    32033348     e        ok_ade, ok_aie,
    32043349     e        tau_aero, piz_aero, cg_aero,
     
    32183363     o        topswcf_aero, solswcf_aero)
    32193364         
    3220 
     3365c
     3366cIM 2eme calcul radiatif pour le cas perturbe ou au moins un
     3367cIM des taux doit etre different du taux actuel
     3368cIM Par defaut on a les taux perturbes egaux aux taux actuels
     3369c
     3370       if (RCO2_per.NE.RCO2_act.OR.RCH4_per.NE.RCH4_act.OR.
     3371     $RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR.
     3372     $RCFC12_per.NE.RCFC12_act) THEN
     3373c
     3374       RCO2 = RCO2_per
     3375       RCH4 = RCH4_per
     3376       RN2O = RN2O_per
     3377       RCFC11 = RCFC11_per
     3378       RCFC12 = RCFC12_per
     3379c
     3380         CALL radlwsw
     3381     e        (dist, rmu0, fract,
     3382     e        paprs, pplay,zxtsol,albsol1, albsol2,
     3383     e        t_seri,q_seri,wo,
     3384     e        cldfra, cldemi, cldtau,
     3385     e        ok_ade, ok_aie,
     3386     e        tau_aero, piz_aero, cg_aero,
     3387     e        cldtaupi,new_aod,
     3388     e        zqsat, flwc, fiwc,
     3389     s        heatp,heat0p,coolp,cool0p,radsolp,albplap,
     3390     s        topswp,toplwp,solswp,sollwp,
     3391     s        sollwdownp,
     3392     s        topsw0p,toplw0p,solsw0p,sollw0p,
     3393     s        lwdn0p, lwdnp, lwup0p, lwupp,
     3394     s        swdn0p, swdnp, swup0p, swupp,
     3395     s        topswad_aerop, solswad_aerop,
     3396     s        topswai_aerop, solswai_aerop,
     3397     o        topswad0_aerop, solswad0_aerop,
     3398     o        topsw_aerop, topsw0_aerop,
     3399     o        solsw_aerop, solsw0_aerop,
     3400     o        topswcf_aerop, solswcf_aerop)
     3401       endif
     3402c
    32213403      ENDIF ! aerosol_couple
    32223404      itaprad = 0
     
    33843566c
    33853567c  ajout des tendances
    3386         CALL add_phys_tend(d_u_hin,d_v_hin,d_t_hin,dq0,dql0,'lif')
     3568        CALL add_phys_tend(d_u_hin,d_v_hin,d_t_hin,dq0,dql0,'hin')
    33873569
    33883570      ENDIF
     
    33973579        call writefield_phy('v_seri',v_seri,llm)
    33983580        call writefield_phy('t_seri',t_seri,llm)
    3399         call writefield_phy('q_seri',q_seri,llm)
     3581        call writefield_phy('q_seri',q_seri,llm)
    34003582      endif
    34013583
     
    34653647     $                   prfl(:,1:klev),psfl(:,1:klev),
    34663648     $                   pmflxr(:,1:klev),pmflxs(:,1:klev),
    3467      $                   mr_ozone,cldtau, cldemi)
     3649     $                   mr_ozone,cldtaurad, cldemirad)
    34683650
    34693651!     L          calipso2D,calipso3D,cfadlidar,parasolrefl,atb,betamol,
     
    36163798c
    36173799cIM initialisation 5eme fichier de sortie
    3618 cIM ajoute 5eme niveau 170310 BEG
    36193800      twriteSTD(:,:,5)=tlevSTD(:,:)
    36203801      qwriteSTD(:,:,5)=qlevSTD(:,:)
     
    36243805      vwriteSTD(:,:,5)=vlevSTD(:,:)
    36253806      wwriteSTD(:,:,5)=wlevSTD(:,:)
     3807c
     3808cIM initialisation 6eme fichier de sortie
     3809      twriteSTD(:,:,6)=tlevSTD(:,:)
     3810      qwriteSTD(:,:,6)=qlevSTD(:,:)
     3811      rhwriteSTD(:,:,6)=rhlevSTD(:,:)
     3812      phiwriteSTD(:,:,6)=philevSTD(:,:)
     3813      uwriteSTD(:,:,6)=ulevSTD(:,:)
     3814      vwriteSTD(:,:,6)=vlevSTD(:,:)
     3815      wwriteSTD(:,:,6)=wlevSTD(:,:)
    36263816cIM for NMC files
    36273817      DO n=1, nlevSTD3
  • LMDZ5/trunk/libf/phylmd/phystokenc.F90

    r1454 r1539  
    125125  LOGICAL ok_sync
    126126  CHARACTER(len=12) :: nvar
     127  logical, parameter :: lstokenc=.FALSE.
    127128!
    128129!======================================================================
     
    164165     
    165166     ! Write field phis and aire only once
    166      CALL histwrite_phy(physid,"phis",itap,pphis)
    167      CALL histwrite_phy(physid,"aire",itap,paire)
    168      CALL histwrite_phy(physid,"longitudes",itap,rlon)
    169      CALL histwrite_phy(physid,"latitudes",itap,rlat)
     167     CALL histwrite_phy(physid,lstokenc,"phis",itap,pphis)
     168     CALL histwrite_phy(physid,lstokenc,"aire",itap,paire)
     169     CALL histwrite_phy(physid,lstokenc,"longitudes",itap,rlon)
     170     CALL histwrite_phy(physid,lstokenc,"latitudes",itap,rlat)
    170171
    171172  END IF
     
    288289
    289290     ! write fields
    290      CALL histwrite_phy(physid,"t",itap,t)
    291      CALL histwrite_phy(physid,"mfu",itap,mfu)
    292      CALL histwrite_phy(physid,"mfd",itap,mfd)
    293      CALL histwrite_phy(physid,"en_u",itap,en_u)
    294      CALL histwrite_phy(physid,"de_u",itap,de_u)
    295      CALL histwrite_phy(physid,"en_d",itap,en_d)
    296      CALL histwrite_phy(physid,"de_d",itap,de_d)
    297      CALL histwrite_phy(physid,"coefh",itap,coefh)     
    298      CALL histwrite_phy(physid,"fm_th",itap,fm_therm)
    299      CALL histwrite_phy(physid,"en_th",itap,entr_therm)
    300      CALL histwrite_phy(physid,"frac_impa",itap,frac_impa)
    301      CALL histwrite_phy(physid,"frac_nucl",itap,frac_nucl)
    302      CALL histwrite_phy(physid,"pyu1",itap,pyu1)
    303      CALL histwrite_phy(physid,"pyv1",itap,pyv1)
    304      CALL histwrite_phy(physid,"ftsol1",itap,pftsol(:,1))
    305      CALL histwrite_phy(physid,"ftsol2",itap,pftsol(:,2))
    306      CALL histwrite_phy(physid,"ftsol3",itap,pftsol(:,3))
    307      CALL histwrite_phy(physid,"ftsol4",itap,pftsol(:,4))
    308      CALL histwrite_phy(physid,"psrf1",itap,ppsrf(:,1))
    309      CALL histwrite_phy(physid,"psrf2",itap,ppsrf(:,2))
    310      CALL histwrite_phy(physid,"psrf3",itap,ppsrf(:,3))
    311      CALL histwrite_phy(physid,"psrf4",itap,ppsrf(:,4))
    312      CALL histwrite_phy(physid,"sh",itap,sh)
    313      CALL histwrite_phy(physid,"da",itap,da)
    314      CALL histwrite_phy(physid,"mp",itap,mp)
    315      CALL histwrite_phy(physid,"upwd",itap,upwd)
    316      CALL histwrite_phy(physid,"dnwd",itap,dnwd)
     291     CALL histwrite_phy(physid,lstokenc,"t",itap,t)
     292     CALL histwrite_phy(physid,lstokenc,"mfu",itap,mfu)
     293     CALL histwrite_phy(physid,lstokenc,"mfd",itap,mfd)
     294     CALL histwrite_phy(physid,lstokenc,"en_u",itap,en_u)
     295     CALL histwrite_phy(physid,lstokenc,"de_u",itap,de_u)
     296     CALL histwrite_phy(physid,lstokenc,"en_d",itap,en_d)
     297     CALL histwrite_phy(physid,lstokenc,"de_d",itap,de_d)
     298     CALL histwrite_phy(physid,lstokenc,"coefh",itap,coefh)     
     299     CALL histwrite_phy(physid,lstokenc,"fm_th",itap,fm_therm)
     300     CALL histwrite_phy(physid,lstokenc,"en_th",itap,entr_therm)
     301     CALL histwrite_phy(physid,lstokenc,"frac_impa",itap,frac_impa)
     302     CALL histwrite_phy(physid,lstokenc,"frac_nucl",itap,frac_nucl)
     303     CALL histwrite_phy(physid,lstokenc,"pyu1",itap,pyu1)
     304     CALL histwrite_phy(physid,lstokenc,"pyv1",itap,pyv1)
     305     CALL histwrite_phy(physid,lstokenc,"ftsol1",itap,pftsol(:,1))
     306     CALL histwrite_phy(physid,lstokenc,"ftsol2",itap,pftsol(:,2))
     307     CALL histwrite_phy(physid,lstokenc,"ftsol3",itap,pftsol(:,3))
     308     CALL histwrite_phy(physid,lstokenc,"ftsol4",itap,pftsol(:,4))
     309     CALL histwrite_phy(physid,lstokenc,"psrf1",itap,ppsrf(:,1))
     310     CALL histwrite_phy(physid,lstokenc,"psrf2",itap,ppsrf(:,2))
     311     CALL histwrite_phy(physid,lstokenc,"psrf3",itap,ppsrf(:,3))
     312     CALL histwrite_phy(physid,lstokenc,"psrf4",itap,ppsrf(:,4))
     313     CALL histwrite_phy(physid,lstokenc,"sh",itap,sh)
     314     CALL histwrite_phy(physid,lstokenc,"da",itap,da)
     315     CALL histwrite_phy(physid,lstokenc,"mp",itap,mp)
     316     CALL histwrite_phy(physid,lstokenc,"upwd",itap,upwd)
     317     CALL histwrite_phy(physid,lstokenc,"dnwd",itap,dnwd)
    317318
    318319
     
    328329        nvar='phi_lev'//trim(nvar)
    329330       
    330         CALL histwrite_phy(physid,nvar,itap,phi(:,:,k))
     331        CALL histwrite_phy(physid,lstokenc,nvar,itap,phi(:,:,k))
    331332     END DO
    332333     
  • LMDZ5/trunk/libf/phylmd/write_histdayNMC.h

    r1374 r1539  
    1515ccc
    1616      IF(lev_histdayNMC.EQ.nlevSTD) THEN
    17        CALL histwrite_phy(nid_daynmc,"tnondef",itau_w,tnondef(:,:,2))
    18        CALL histwrite_phy(nid_daynmc,"ta",itau_w,twriteSTD(:,:,2))
    19        CALL histwrite_phy(nid_daynmc,"zg",itau_w,phiwriteSTD(:,:,2))
    20        CALL histwrite_phy(nid_daynmc,"hus",itau_w,qwriteSTD(:,:,2))
    21        CALL histwrite_phy(nid_daynmc,"hur",itau_w,rhwriteSTD(:,:,2))
    22        CALL histwrite_phy(nid_daynmc,"ua",itau_w,uwriteSTD(:,:,2))
    23        CALL histwrite_phy(nid_daynmc,"va",itau_w,vwriteSTD(:,:,2))
    24        CALL histwrite_phy(nid_daynmc,"wap",itau_w,wwriteSTD(:,:,2))
     17       CALL histwrite_phy(nid_daynmc,lNMC,"tnondef",itau_w,
     18     $tnondef(:,:,2))
     19       CALL histwrite_phy(nid_daynmc,lNMC,"ta",itau_w,
     20     $twriteSTD(:,:,2))
     21       CALL histwrite_phy(nid_daynmc,lNMC,"zg",itau_w,
     22     $phiwriteSTD(:,:,2))
     23       CALL histwrite_phy(nid_daynmc,lNMC,"hus",itau_w,
     24     $qwriteSTD(:,:,2))
     25       CALL histwrite_phy(nid_daynmc,lNMC,"hur",itau_w,
     26     $rhwriteSTD(:,:,2))
     27       CALL histwrite_phy(nid_daynmc,lNMC,"ua",itau_w,
     28     $uwriteSTD(:,:,2))
     29       CALL histwrite_phy(nid_daynmc,lNMC,"va",itau_w,
     30     $vwriteSTD(:,:,2))
     31       CALL histwrite_phy(nid_daynmc,lNMC,"wap",itau_w,
     32     $wwriteSTD(:,:,2))
    2533      ELSE IF(lev_histdayNMC.EQ.nlevSTD8) THEN
    26        CALL histwrite_phy(nid_daynmc,"tnondef",itau_w,tnondefSTD8)
    27        CALL histwrite_phy(nid_daynmc,"ta",itau_w,twriteSTD8)
    28        CALL histwrite_phy(nid_daynmc,"zg",itau_w,phiwriteSTD8)
    29        CALL histwrite_phy(nid_daynmc,"hus",itau_w,qwriteSTD8)
    30        CALL histwrite_phy(nid_daynmc,"hur",itau_w,rhwriteSTD8)
    31        CALL histwrite_phy(nid_daynmc,"ua",itau_w,uwriteSTD8)
    32        CALL histwrite_phy(nid_daynmc,"va",itau_w,vwriteSTD8)
    33        CALL histwrite_phy(nid_daynmc,"wap",itau_w,wwriteSTD8)
     34       CALL histwrite_phy(nid_daynmc,lNMC,"tnondef",itau_w,
     35     $tnondefSTD8)
     36       CALL histwrite_phy(nid_daynmc,lNMC,"ta",itau_w,
     37     $twriteSTD8)
     38       CALL histwrite_phy(nid_daynmc,lNMC,"zg",itau_w,
     39     $phiwriteSTD8)
     40       CALL histwrite_phy(nid_daynmc,lNMC,"hus",itau_w,
     41     $qwriteSTD8)
     42       CALL histwrite_phy(nid_daynmc,lNMC,"hur",itau_w,
     43     $rhwriteSTD8)
     44       CALL histwrite_phy(nid_daynmc,lNMC,"ua",itau_w,
     45     $uwriteSTD8)
     46       CALL histwrite_phy(nid_daynmc,lNMC,"va",itau_w,
     47     $vwriteSTD8)
     48       CALL histwrite_phy(nid_daynmc,lNMC,"wap",itau_w,
     49     $wwriteSTD8)
    3450      ENDIF
    3551c
  • LMDZ5/trunk/libf/phylmd/write_histhfNMC.h

    r1398 r1539  
    1414c nout=3 : in=pdtphys,    out=hf
    1515ccc
    16        CALL histwrite_phy(nid_hfnmc,"tnondef",itau_w,tnondef(:,:,3))
     16      CALL histwrite_phy(nid_hfnmc,lNMC,"tnondef",itau_w,
     17     $tnondef(:,:,3))
    1718c
    18        CALL histwrite_phy(nid_hfnmc,"ta",itau_w,twriteSTD3)
     19       CALL histwrite_phy(nid_hfnmc,lNMC,"ta",itau_w,
     20     $twriteSTD3)
    1921c
    20        CALL histwrite_phy(nid_hfnmc,"zg",itau_w,phiwriteSTD3)
     22       CALL histwrite_phy(nid_hfnmc,lNMC,"zg",itau_w,
     23     $phiwriteSTD3)
    2124c
    22        CALL histwrite_phy(nid_hfnmc,"hus",itau_w,qwriteSTD3)
     25       CALL histwrite_phy(nid_hfnmc,lNMC,"hus",itau_w,
     26     $qwriteSTD3)
    2327c
    24        CALL histwrite_phy(nid_hfnmc,"hur",itau_w,rhwriteSTD3)
     28       CALL histwrite_phy(nid_hfnmc,lNMC,"hur",itau_w,
     29     $rhwriteSTD3)
    2530c
    26        CALL histwrite_phy(nid_hfnmc,"ua",itau_w,uwriteSTD3)
     31       CALL histwrite_phy(nid_hfnmc,lNMC,"ua",itau_w,
     32     $uwriteSTD3)
    2733c
    28        CALL histwrite_phy(nid_hfnmc,"va",itau_w,vwriteSTD3)
     34       CALL histwrite_phy(nid_hfnmc,lNMC,"va",itau_w,
     35     $vwriteSTD3)
    2936c
    30        CALL histwrite_phy(nid_hfnmc,"wap",itau_w,wwriteSTD3)
     37       CALL histwrite_phy(nid_hfnmc,lNMC,"wap",itau_w,
     38     $wwriteSTD3)
     39c
     40       IF (1.EQ.0) THEN
    3141c
    3242       DO k=1, nlevSTD
     
    4050       ENDDO !k=1, nlevSTD
    4151c
    42        CALL histwrite_phy(nid_hfnmc,"psbg",itau_w,zx_tmp_fiNC)
     52       CALL histwrite_phy(nid_hfnmc,lNMC,"psbg",itau_w,
     53     $zx_tmp_fiNC)
    4354c
    44        CALL histwrite_phy(nid_hfnmc,"uv",itau_w,uvsumSTD(:,:,3))
     55       CALL histwrite_phy(nid_hfnmc,lNMC,"uv",itau_w,
     56     $uvsumSTD(:,:,3))
    4557c
    46        CALL histwrite_phy(nid_hfnmc,"vq",itau_w,vqsumSTD(:,:,3))
     58       CALL histwrite_phy(nid_hfnmc,lNMC,"vq",itau_w,
     59     $vqsumSTD(:,:,3))
    4760c
    48        CALL histwrite_phy(nid_hfnmc,"vT",itau_w,vTsumSTD(:,:,3))
     61       CALL histwrite_phy(nid_hfnmc,lNMC,"vT",itau_w,
     62     $vTsumSTD(:,:,3))
    4963c
    50        CALL histwrite_phy(nid_hfnmc,"wq",itau_w,wqsumSTD(:,:,3))
     64       CALL histwrite_phy(nid_hfnmc,lNMC,"wq",itau_w,
     65     $wqsumSTD(:,:,3))
    5166c
    52        CALL histwrite_phy(nid_hfnmc,"vphi",itau_w,vphisumSTD(:,:,3))
     67      CALL histwrite_phy(nid_hfnmc,lNMC,"vphi",itau_w,
     68     $vphisumSTD(:,:,3))
    5369c
    54        CALL histwrite_phy(nid_hfnmc,"wT",itau_w,wTsumSTD(:,:,3))
     70       CALL histwrite_phy(nid_hfnmc,lNMC,"wT",itau_w,
     71     $wTsumSTD(:,:,3))
    5572c
    56        CALL histwrite_phy(nid_hfnmc,"uxu",itau_w,u2sumSTD(:,:,3))
     73       CALL histwrite_phy(nid_hfnmc,lNMC,"uxu",itau_w,
     74     $u2sumSTD(:,:,3))
    5775c
    58        CALL histwrite_phy(nid_hfnmc,"vxv",itau_w,v2sumSTD(:,:,3))
     76       CALL histwrite_phy(nid_hfnmc,lNMC,"vxv",itau_w,
     77     $v2sumSTD(:,:,3))
    5978c
    60        CALL histwrite_phy(nid_hfnmc,"TxT",itau_w,T2sumSTD(:,:,3))
     79       CALL histwrite_phy(nid_hfnmc,lNMC,"TxT",itau_w,
     80     $T2sumSTD(:,:,3))
    6181c
    62 c     ENDIF !type_run
     82       ENDIF !(1.EQ.0) THEN
    6383c
    6484      if (ok_sync) then
  • LMDZ5/trunk/libf/phylmd/write_histmthNMC.h

    r1403 r1539  
    1414c nout=3 : in=pdtphys,    out=hf
    1515ccc
    16        CALL histwrite_phy(nid_mthnmc,"tnondef",itau_w,tnondef(:,:,1))
     16      CALL histwrite_phy(nid_mthnmc,lNMC,"tnondef",itau_w,
     17     $tnondef(:,:,1))
    1718c
    18        CALL histwrite_phy(nid_mthnmc,"ta",itau_w,twriteSTD(:,:,1))
     19      CALL histwrite_phy(nid_mthnmc,lNMC,"ta",itau_w,
     20     $twriteSTD(:,:,1))
    1921c
    20        CALL histwrite_phy(nid_mthnmc,"zg",itau_w,phiwriteSTD(:,:,1))
     22      CALL histwrite_phy(nid_mthnmc,lNMC,"zg",itau_w,
     23     $phiwriteSTD(:,:,1))
    2124c
    22        CALL histwrite_phy(nid_mthnmc,"hus",itau_w,qwriteSTD(:,:,1))
     25       CALL histwrite_phy(nid_mthnmc,lNMC,"hus",itau_w,
     26     $qwriteSTD(:,:,1))
    2327c
    24        CALL histwrite_phy(nid_mthnmc,"hur",itau_w,rhwriteSTD(:,:,1))
     28       CALL histwrite_phy(nid_mthnmc,lNMC,"hur",itau_w,
     29     $rhwriteSTD(:,:,1))
    2530c
    26        CALL histwrite_phy(nid_mthnmc,"ua",itau_w,uwriteSTD(:,:,1))
     31       CALL histwrite_phy(nid_mthnmc,lNMC,"ua",itau_w,
     32     $uwriteSTD(:,:,1))
    2733c
    28        CALL histwrite_phy(nid_mthnmc,"va",itau_w,vwriteSTD(:,:,1))
     34       CALL histwrite_phy(nid_mthnmc,lNMC,"va",itau_w,
     35     $vwriteSTD(:,:,1))
    2936c
    30        CALL histwrite_phy(nid_mthnmc,"wap",itau_w,wwriteSTD(:,:,1))
     37       CALL histwrite_phy(nid_mthnmc,lNMC,"wap",itau_w,
     38     $wwriteSTD(:,:,1))
    3139c
    3240       DO k=1, nlevSTD
     
    4048       ENDDO !k=1, nlevSTD
    4149c
    42        CALL histwrite_phy(nid_mthnmc,"psbg",itau_w,zx_tmp_fiNC)
     50      CALL histwrite_phy(nid_mthnmc,lNMC,"psbg",itau_w,
     51     $zx_tmp_fiNC)
    4352c
    44        CALL histwrite_phy(nid_mthnmc,"uv",itau_w,uvsumSTD(:,:,1))
     53      CALL histwrite_phy(nid_mthnmc,lNMC,"uv",itau_w,
     54     $uvsumSTD(:,:,1))
    4555c
    46        CALL histwrite_phy(nid_mthnmc,"vq",itau_w,vqsumSTD(:,:,1))
     56      CALL histwrite_phy(nid_mthnmc,lNMC,"vq",itau_w,
     57     $vqsumSTD(:,:,1))
    4758c
    48        CALL histwrite_phy(nid_mthnmc,"vT",itau_w,vTsumSTD(:,:,1))
     59      CALL histwrite_phy(nid_mthnmc,lNMC,"vT",itau_w,
     60     $vTsumSTD(:,:,1))
    4961c
    50        CALL histwrite_phy(nid_mthnmc,"wq",itau_w,wqsumSTD(:,:,1))
     62      CALL histwrite_phy(nid_mthnmc,lNMC,"wq",itau_w,
     63     $wqsumSTD(:,:,1))
    5164c
    52        CALL histwrite_phy(nid_mthnmc,"vphi",itau_w,vphisumSTD(:,:,1))
     65      CALL histwrite_phy(nid_mthnmc,lNMC,"vphi",itau_w,
     66     $vphisumSTD(:,:,1))
    5367c
    54        CALL histwrite_phy(nid_mthnmc,"wT",itau_w,wTsumSTD(:,:,1))
     68       CALL histwrite_phy(nid_mthnmc,lNMC,"wT",itau_w,
     69     $wTsumSTD(:,:,1))
    5570c
    56        CALL histwrite_phy(nid_mthnmc,"uxu",itau_w,u2sumSTD(:,:,1))
     71       CALL histwrite_phy(nid_mthnmc,lNMC,"uxu",itau_w,
     72     $u2sumSTD(:,:,1))
    5773c
    58        CALL histwrite_phy(nid_mthnmc,"vxv",itau_w,v2sumSTD(:,:,1))
     74       CALL histwrite_phy(nid_mthnmc,lNMC,"vxv",itau_w,
     75     $v2sumSTD(:,:,1))
    5976c
    60        CALL histwrite_phy(nid_mthnmc,"TxT",itau_w,T2sumSTD(:,:,1))
     77       CALL histwrite_phy(nid_mthnmc,lNMC,"TxT",itau_w,
     78     $T2sumSTD(:,:,1))
    6179c
    6280       DO k=1, nlevSTD
     
    6987        ENDDO
    7088       ENDDO !k=1, nlevSTD
    71        CALL histwrite_phy(nid_mthnmc,"tro3",itau_w,
     89       CALL histwrite_phy(nid_mthnmc,lNMC,"tro3",itau_w,
    7290     $ zx_tmp_fiNC)
    7391c
     
    83101       ENDDO !k=1, nlevSTD
    84102c
    85         CALL histwrite_phy(nid_mthnmc,"tro3_daylight",itau_w,
    86      $  zx_tmp_fiNC)
     103        CALL histwrite_phy(nid_mthnmc,lNMC,"tro3_daylight",
     104     $itau_w, zx_tmp_fiNC)
    87105       endif
    88106c
Note: See TracChangeset for help on using the changeset viewer.