Ignore:
Timestamp:
Sep 11, 2013, 11:45:01 AM (11 years ago)
Author:
Laurent Fairhead
Message:

Création d'une nouvelle testing:

merge des modifications du trunk entre r1796 et r1860


New testing version

merged modifications between r1796 and r1860 from the trunk

i.e.
svn merge -r1796:1860 http://svn.lmd.jussieu.fr/LMDZ/LMDZ5/trunk

Location:
LMDZ5/branches/testing
Files:
14 deleted
229 edited
20 copied

Legend:

Unmodified
Added
Removed
  • LMDZ5/branches/testing

  • LMDZ5/branches/testing/arch/arch-X64_ADA.fcm

    r1795 r1864  
    1111%MPI_FFLAGS
    1212%OMP_FFLAGS          -openmp
    13 %BASE_LD             -shared-intel  -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -L/smplocal/pub/FFTW/3.3.3_dyn/lib -lfftw3 -Wl,-rpath=/smplocal/pub/NetCDF/4.1.3/lib:/smplocal/pub/HDF5/1.8.9/seq/lib:/smplocal/pub/FFTW/3.3.3_dyn/lib
     13%BASE_LD             -L/smplocal/pub/FFTW/3.3.3_dyn/lib -lfftw3 -shared-intel  -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -Wl,-rpath=/smplocal/pub/NetCDF/4.1.3/lib:/smplocal/pub/HDF5/1.8.9/seq/lib:/smplocal/pub/FFTW/3.3.3_dyn/lib
    1414%MPI_LD
    1515%OMP_LD              -openmp
  • LMDZ5/branches/testing/arch/arch-gfortran.fcm

    r1492 r1864  
    44%MAKE                make
    55%FPP_FLAGS           -P -traditional
    6 %FPP_DEF             PLOUF
    7 %BASE_FFLAGS         -c
     6%FPP_DEF             NC_DOUBLE
     7%BASE_FFLAGS         -c -fdefault-real-8
    88%PROD_FFLAGS         -O3
    99%DEV_FFLAGS          -O
  • LMDZ5/branches/testing/arch/arch-gfortran.path

    r1492 r1864  
    1 NETCDF_LIBDIR=...
    2 NETCDF_INCDIR=...
    3 IOIPSL_INCDIR=...
    4 IOIPSL_LIBDIR=...
    5 ORCH_INCDIR=...
    6 ORCH_LIBDIR=...
     1NETCDF_LIBDIR="-L/usr/local/lib -lnetcdf"
     2NETCDF_INCDIR=-I/usr/local/include
     3IOIPSL_INCDIR=$LMDGCM/../../lib
     4IOIPSL_LIBDIR=$LMDGCM/../../lib
     5ORCH_INCDIR=$LMDGCM/../../lib
     6ORCH_LIBDIR=$LMDGCM/../../lib
  • LMDZ5/branches/testing/bld.cfg

    r1664 r1864  
    3030src::ext_src %EXT_SRC
    3131
    32 bld::lib::dyn      %DYN
    33 bld::lib::phys     %PHYS
    34 bld::lib::grid      grid
    35 bld::lib::filtrez   filtrez
    36 bld::lib::bibio     bibio
    37 bld::lib::cosp      cosp
    38 bld::lib: ext_src   ext_src
    39 
     32bld::lib            lmdz
    4033
    4134bld::outfile_ext::exe    %SUFF_NAME.e
    42 bld::target              lib%{DYN}.a lib%{PHYS}.a libgrid.a libfiltrez.a libbibio.a libcosp.a libext_src.a
     35bld::target              liblmdz.a
    4336bld::target              %EXEC%SUFF_NAME.e
    44 bld::exe_dep             %{DYN} %{PHYS} grid filtrez bibio cosp ext_src
     37bld::exe_dep             
    4538
    4639
     
    6457
    6558
     59# Example of how to set specific compiling options for a specific file
     60# -> this can be including in the arch.opt file
    6661#bld::tool::fflags::phys::readaerosol         %BASE_FFLAGS %PROD_FFLAGS  %INCDIR -C hopt -pi auto
    67 #bld::tool::fflags::phys::aeropt_2bands       %BASE_FFLAGS %PROD_FFLAGS  %INCDIR
    68 #bld::tool::fflags::phys::radiation_AR4       %BASE_FFLAGS %PROD_FFLAGS1 %INCDIR -C hopt -Wf,-O,extendreorder
    69 #bld::tool::fflags::phys::radiation_AR4_param %BASE_FFLAGS %PROD_FFLAGS1 %INCDIR -C hopt -f3
    70 #bld::tool::fflags::phys::fisrtilp            %BASE_FFLAGS %PROD_FFLAGS  %INCDIR -C hopt
    71 #bld::tool::fflags::phys::cv30_routines       %BASE_FFLAGS %PROD_FFLAGS  %INCDIR -Wf,-O,extendreorder
    72 #bld::tool::fflags::phys::cvltr               %BASE_FFLAGS %PROD_FFLAGS  %INCDIR -C hopt
    73 #bld::tool::fflags::phys::clouds_gno          %BASE_FFLAGS %PROD_FFLAGS  %INCDIR -C hopt
    74 #bld::tool::fflags::dyn::vlsplt_p             %BASE_FFLAGS %PROD_FFLAGS  %INCDIR -C hopt
    75 #bld::tool::fflags::dyn::groupeun_p           %BASE_FFLAGS %PROD_FFLAGS  %INCDIR -C hopt
    7662
    7763
     
    9581bld::excl_dep        use::mod_prism_get_proto
    9682bld::excl_dep        use::mod_prism_put_proto
    97 bld::excl_dep        use::mkl_dfti
    9883
    9984# Don't generate interface files
  • LMDZ5/branches/testing/build_gcm

    r1752 r1864  
    2929fi
    3030
     31job=1
    3132dirname="" #path to where the fcm command will be found
    3233if (( $# >= 1 )) ; then
     
    3940  # add a trailing "/" to $dirname
    4041  dirname=${dirname}"/"
     42  shift;
    4143fi
    4244
    4345# run "fcm build" command
    44 ${dirname}fcm build
     46${dirname}fcm build $*
    4547
    4648# cleanup
  • LMDZ5/branches/testing/create_make_gcm

    r1750 r1864  
    4242echo 'LIBF    = $(GCM)/libf'
    4343if [ "$CRAY" = '0' ] ; then
    44 #   echo 'LIBO    = $(GCM)/libo/$(MACHINE)'
    4544   echo 'LIBO    = $(LIBOGCM)/$(MACHINE)'
    4645else
    4746   echo 'LIBO    = $(GCM)/libo'
    4847fi
    49 #echo 'LOCAL_DIR=$(GCM)'
    50 #echo $localdir
    5148echo "LOCAL_DIR=`echo $localdir`"
    5249echo 'BIBIO    = $(LIBF)/bibio'
     
    180177            strj=`echo $stri | tr [A-Z] [a-z]`
    181178            str2=""
    182             for dirinc in filtrez bibio grid dyn3d $diri $diri/*/ ; do
     179            for dirinc in filtrez bibio grid dyn3d phydev $diri $diri/*/ ; do
    183180# Recherche dans l'ordre hierarchique inverse car seule la derniere
    184181# ligne est conservee
     182               if [ $dirinc = phydev ] ; then
     183                   dirstr='$(PHYS)'
     184                   libstr='phy$(PHYS)'
     185               else
     186                   dirstr=$dirinc
     187                   libstr=$dirinc
     188               fi
    185189               if [ -f $dirinc/$stri ] ; then
    186                   str2='$(LIBF)/'$dirinc/$stri
     190                  str2='$(LIBF)/'$dirstr/$stri
    187191               elif [ -f $dirinc/$strj ] ; then
    188                   str2='$(LIBF)/'$dirinc/$stri
     192                  str2='$(LIBF)/'$dirstr/$stri
    189193               elif [ -f $dirinc/$strj.F90 ]  || [ -f $dirinc/$strj.F ]  ; then
    190                   strlib=`echo $dirinc | awk -F/ ' { print $1 } '`
     194                  strlib=`echo $libstr | awk -F/ ' { print $1 } '`
    191195                  str2='$(LIBO)/lib'$strlib'.a('$strj'.o)'
    192196               fi
  • LMDZ5/branches/testing/libf/dyn3d/abort_gcm.F

    r1425 r1864  
    1212      USE ioipsl_getincom
    1313#endif
     14
     15#ifdef CPP_XIOS
     16    ! ug Pour les sorties XIOS
     17      USE wxios
     18#endif
     19
    1420#include "iniprint.h"
    1521 
     
    2733
    2834      write(lunout,*) 'in abort_gcm'
     35
     36#ifdef CPP_XIOS
     37    !Fermeture propre de XIOS
     38      CALL wxios_close()
     39#endif
     40
    2941#ifdef CPP_IOIPSL
    3042      call histclo
  • LMDZ5/branches/testing/libf/dyn3d/advtrac.F90

    r1549 r1864  
    203203     if (countcfl==day_step) then
    204204        do l=1,llm
    205            write(lunout,*) 'L, CFLmax ' &
    206                 ,l,maxval(cflx(:,l)),maxval(cfly(:,l)),maxval(cflz(:,l))
     205           write(lunout,*) 'L, CFL[xyz]max:', l, cflxmax(l), cflymax(l), &
     206                cflzmax(l)
    207207        enddo
    208208        countcfl=0
  • LMDZ5/branches/testing/libf/dyn3d/gcm.F

    r1795 r1864  
    1111! if not using IOIPSL, we still need to use (a local version of) getin
    1212      USE ioipsl_getincom
     13#endif
     14
     15
     16#ifdef CPP_XIOS
     17    ! ug Pour les sorties XIOS
     18        USE wxios
    1319#endif
    1420
     
    179185!      CALL defrun( 99, .TRUE. , clesphy0 )
    180186!#endif
     187
     188!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     189! Initialisation de XIOS
     190!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     191
     192#ifdef CPP_XIOS
     193        CALL wxios_init("LMDZ")
     194#endif
     195
    181196
    182197!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  • LMDZ5/branches/testing/libf/dyn3dmem/abort_gcm.F

    r1795 r1864  
    1212      USE ioipsl_getincom
    1313#endif
    14       USE parallel
     14      USE parallel_lmdz
    1515#include "iniprint.h"
    1616 
  • LMDZ5/branches/testing/libf/dyn3dmem/addfi_loc.F

    r1707 r1864  
    55     S          pucov, pvcov, pteta, pq   , pps ,
    66     S          pdufi, pdvfi, pdhfi,pdqfi, pdpfi  )
    7       USE parallel
     7      USE parallel_lmdz
    88      USE infotrac, ONLY : nqtot
    99      USE control_mod, ONLY : planet_type
  • LMDZ5/branches/testing/libf/dyn3dmem/advect_new_loc.F

    r1669 r1864  
    44      SUBROUTINE advect_new_loc(ucov,vcov,teta,w,massebx,masseby,
    55     &                        du,dv,dteta)
    6       USE parallel
     6      USE parallel_lmdz
    77      USE write_field_loc
    88      USE advect_new_mod
  • LMDZ5/branches/testing/libf/dyn3dmem/advect_new_mod.F90

    r1669 r1864  
    1515  SUBROUTINE advect_new_allocate
    1616  USE bands
    17   USE allocate_field
    18   USE parallel
    19   USE dimensions
     17  USE allocate_field_mod
     18  USE parallel_lmdz
     19  USE dimensions_mod
    2020  IMPLICIT NONE
    2121  TYPE(distrib),POINTER :: d
     
    3636 
    3737  SUBROUTINE advect_new_switch_caldyn(dist)
    38   USE allocate_field
     38  USE allocate_field_mod
    3939  USE bands
    40   USE parallel
     40  USE parallel_lmdz
    4141  IMPLICIT NONE
    4242    TYPE(distrib),INTENT(IN) :: dist
  • LMDZ5/branches/testing/libf/dyn3dmem/advtrac_loc.F

    r1707 r1864  
    1717c            M.A Filiberti (04/2002)
    1818c
    19       USE parallel
     19      USE parallel_lmdz
    2020      USE Write_Field_loc
    2121      USE Write_Field
     
    7979      DATA dum/.true./
    8080      integer ijb,ije,ijbu,ijbv,ijeu,ijev,j
    81       type(Request) :: testRequest
     81      type(Request),SAVE :: testRequest
     82!$OMP THREADPRIVATE(testRequest)
    8283
    8384c  test sur l'eventuelle creation de valeurs negatives de la masse
  • LMDZ5/branches/testing/libf/dyn3dmem/advtrac_mod.F90

    r1669 r1864  
    77  SUBROUTINE advtrac_allocate
    88  USE bands
    9   USE allocate_field
    10   USE parallel
     9  USE allocate_field_mod
     10  USE parallel_lmdz
    1111  USE infotrac
    1212  USE vlspltgen_mod
     
    2222 
    2323  SUBROUTINE advtrac_switch_vanleer(dist)
    24   USE allocate_field
     24  USE allocate_field_mod
    2525  USE bands
    26   USE parallel
     26  USE parallel_lmdz
    2727  USE vlspltgen_mod
    2828  IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/bands.F90

    r1707 r1864  
    33!
    44  module Bands
    5   USE parallel
     5  USE parallel_lmdz
    66    integer, parameter :: bands_caldyn=1
    77    integer, parameter :: bands_vanleer=2
     
    2727 
    2828  subroutine AllocateBands
    29     use parallel
     29    USE parallel_lmdz
    3030    implicit none
    3131   
     
    4141 
    4242  subroutine Read_distrib
    43     use parallel
     43    USE parallel_lmdz
    4444    implicit none
    4545
     
    104104   
    105105   SUBROUTINE  Set_Bands
    106      USE parallel
     106     USE parallel_lmdz
    107107#ifdef CPP_PHYS
    108108! Ehouarn: what follows is only related to // physics
     
    168168    subroutine AdjustBands_caldyn(new_dist)
    169169      use times
    170       use parallel
     170      USE parallel_lmdz
    171171      implicit none
    172172      TYPE(distrib),INTENT(INOUT) :: new_dist
     
    235235    subroutine AdjustBands_vanleer(new_dist)
    236236      use times
    237       use parallel
     237      USE parallel_lmdz
    238238      implicit none
    239239      TYPE(distrib),INTENT(INOUT) :: new_dist
     
    304304    subroutine AdjustBands_dissip(new_dist)
    305305      use times
    306       use parallel
     306      USE parallel_lmdz
    307307      implicit none
    308308      TYPE(distrib),INTENT(INOUT) :: new_dist
     
    377377      USE mod_phys_lmdz_para, only : klon_mpi_para_nb
    378378#endif
    379       USE parallel
     379      USE parallel_lmdz
    380380      implicit none
    381381
     
    428428
    429429    subroutine WriteBands
    430     USE parallel
     430    USE parallel_lmdz
    431431    implicit none
    432432    include "dimensions.h"
  • LMDZ5/branches/testing/libf/dyn3dmem/bernoui_loc.F

    r1669 r1864  
    11      SUBROUTINE bernoui_loc (ngrid,nlay,pphi,pecin,pbern)
    2       USE parallel
     2      USE parallel_lmdz
    33      USE mod_filtreg_p
    44      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/bilan_dyn_loc.F

    r1707 r1864  
    1313      USE IOIPSL
    1414#endif
    15       USE parallel
     15      USE parallel_lmdz
    1616      USE mod_hallo
    1717      use misc_mod
     
    157157      real,SAVE,ALLOCATABLE :: rlong(:),rlatg(:)
    158158      integer :: jjb,jje,jjn,ijb,ije
    159       type(Request) :: Req
     159      type(Request),SAVE :: Req
     160!$OMP THREADPRIVATE(Req)
    160161
    161162! definition du domaine d'ecriture pour le rebuild
  • LMDZ5/branches/testing/libf/dyn3dmem/caladvtrac_loc.F

    r1707 r1864  
    77     *                   p ,masse, dq ,  teta,
    88     *                   flxw, pk, iapptrac)
    9       USE parallel
     9      USE parallel_lmdz
    1010      USE infotrac, ONLY : nqtot
    1111      USE control_mod, ONLY : iapp_tracvl,planet_type
     
    5353      INTEGER ::  ijb,ije,ijbu,ijbv,ijeu,ijev,j
    5454      INTEGER :: ij,l
    55       TYPE(Request) :: Request_vanleer
    56 
     55      TYPE(Request),SAVE :: Request_vanleer
     56!$OMP THREADPRIVATE(Request_vanleer)
    5757
    5858           
     
    122122c     1. calcul de w
    123123c     2. groupement des mailles pres du pole.
    124         pbarvg(:,:)=-1
    125         pbarvg_adv(:,:)=-2
     124
    126125        CALL groupe_loc( massem, pbaruc,pbarvc, pbarug,pbarvg,wg )
    127         flxw(ijb:ije,1:llm)=wg(ijb:ije,1:llm)/REAL(iapp_tracvl)
     126
     127c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)     
     128      DO l=1,llm
     129        flxw(ijb:ije,l)=wg(ijb:ije,l)/REAL(iapp_tracvl)
     130      ENDDO
     131c$OMP ENDDO NOWAIT
    128132
    129133#ifdef DEBUG_IO   
  • LMDZ5/branches/testing/libf/dyn3dmem/caladvtrac_mod.F90

    r1669 r1864  
    2121  SUBROUTINE caladvtrac_allocate
    2222  USE bands
    23   USE allocate_field
    24   USE parallel
     23  USE allocate_field_mod
     24  USE parallel_lmdz
    2525  USE infotrac
    2626  USE advtrac_mod, ONLY : advtrac_allocate
     
    5555 
    5656  SUBROUTINE caladvtrac_switch_caldyn(dist)
    57   USE allocate_field
     57  USE allocate_field_mod
    5858  USE bands
    59   USE parallel
     59  USE parallel_lmdz
    6060  USE groupe_mod
    6161  IMPLICIT NONE
     
    7474 
    7575  SUBROUTINE caladvtrac_switch_vanleer(dist)
    76   USE allocate_field
     76  USE allocate_field_mod
    7777  USE bands
    78   USE parallel
     78  USE parallel_lmdz
    7979  USE advtrac_mod, ONLY : advtrac_switch_vanleer
    8080  IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/caldyn_loc.F

    r1669 r1864  
    1010     $ (itau,ucov,vcov,teta,ps,masse,pk,pkf,phis ,
    1111     $  phi,conser,du,dv,dteta,dp,w,pbaru,pbarv,time )
    12       USE parallel
     12      USE parallel_lmdz
    1313      USE Write_Field_loc
    1414      USE caldyn_mod
  • LMDZ5/branches/testing/libf/dyn3dmem/caldyn_mod.F90

    r1669 r1864  
    2020  SUBROUTINE caldyn_allocate
    2121  USE bands
    22   USE allocate_field
    23   USE parallel
    24   USE dimensions
     22  USE allocate_field_mod
     23  USE parallel_lmdz
     24  USE dimensions_mod
    2525  USE advect_new_mod,ONLY : advect_new_allocate
    2626  IMPLICIT NONE
     
    4747 
    4848  SUBROUTINE caldyn_switch_caldyn(dist)
    49   USE allocate_field
     49  USE allocate_field_mod
    5050  USE bands
    51   USE parallel
     51  USE parallel_lmdz
    5252  USE advect_new_mod,ONLY : advect_new_switch_caldyn
    5353  IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/calfis_loc.F

    r1795 r1864  
    3737      USE IOPHY
    3838#endif
    39       USE parallel, ONLY : omp_chunk, using_mpi,jjb_u,jje_u,jjb_v,jje_v
     39      USE parallel_lmdz,ONLY:omp_chunk,using_mpi,jjb_u,jje_u,jjb_v,jje_v
    4040      USE Write_Field
    4141      Use Write_field_p
  • LMDZ5/branches/testing/libf/dyn3dmem/call_calfis_mod.F90

    r1795 r1864  
    3636  SUBROUTINE call_calfis_allocate
    3737  USE bands
    38   USE allocate_field
    39   USE parallel
    40   USE dimensions
     38  USE allocate_field_mod
     39  USE parallel_lmdz
     40  USE dimensions_mod
    4141  USE infotrac
    4242  IMPLICIT NONE
     
    7474  SUBROUTINE call_calfis(itau,lafin,clesphy0,ucov_dyn,vcov_dyn,teta_dyn,masse_dyn,ps_dyn, &
    7575                         phis_dyn,q_dyn,flxw_dyn)
    76   USE dimensions
    77   USE parallel
     76  USE dimensions_mod
     77  USE parallel_lmdz
    7878  USE times
    7979  USE mod_hallo
     
    111111    REAL :: jD_cur, jH_cur
    112112    CHARACTER(LEN=15) :: ztit
    113     TYPE(Request) :: Request_physic
     113    TYPE(Request),SAVE :: Request_physic
     114!$OMP THREADPRIVATE(Request_physic )
    114115    INTEGER :: ijb,ije,l,j
    115116   
     
    378379    IF (ip_ebil_dyn.ge.1 ) THEN
    379380      ztit='bil phys'
    380       CALL diagedyn(ztit,2,1,1,dtphys,ucov, vcov , ps, p ,pk , teta , q(:,:,1), q(:,:,2))
     381!      CALL diagedyn(ztit,2,1,1,dtphys,ucov, vcov , ps, p ,pk , teta , q(:,:,1), q(:,:,2))
     382      write(lunout,*)"call_calfis: diagedyn disabled in dyn3dmem !!"
    381383    ENDIF
    382384
  • LMDZ5/branches/testing/libf/dyn3dmem/call_dissip_mod.F90

    r1707 r1864  
    2222  SUBROUTINE call_dissip_allocate
    2323  USE bands
    24   USE allocate_field
    25   USE parallel
    26   USE dimensions
     24  USE allocate_field_mod
     25  USE parallel_lmdz
     26  USE dimensions_mod
    2727  USE dissip_mod, ONLY : dissip_allocate
    2828  IMPLICIT NONE
     
    5050 
    5151  SUBROUTINE call_dissip_switch_dissip(dist)
    52   USE allocate_field
     52  USE allocate_field_mod
    5353  USE bands
    54   USE parallel
     54  USE parallel_lmdz
    5555  USE dissip_mod, ONLY : dissip_switch_dissip
    5656  IMPLICIT NONE
     
    7878 
    7979  SUBROUTINE call_dissip(ucov_dyn,vcov_dyn,teta_dyn,p_dyn,pk_dyn,ps_dyn)
    80   USE dimensions
    81   USE parallel
     80  USE dimensions_mod
     81  USE parallel_lmdz
    8282  USE times
    8383  USE mod_hallo
     
    9898    REAL  SSUM
    9999    LOGICAL,PARAMETER :: dissip_conservative=.TRUE.
    100     TYPE(Request) :: Request_dissip
    101    
     100    TYPE(Request),SAVE :: Request_dissip
     101!$OMP THREADPRIVATE(Request_dissip )   
    102102    INTEGER :: ij,l,ijb,ije
    103103 
  • LMDZ5/branches/testing/libf/dyn3dmem/ce0l.F90

    r1795 r1864  
    2222  USE mod_const_mpi
    2323  USE infotrac
    24   USE parallel, ONLY: finalize_parallel
     24  USE parallel_lmdz, ONLY: finalize_parallel 
    2525  USE indice_sol_mod
    2626
  • LMDZ5/branches/testing/libf/dyn3dmem/conf_gcm.F

    r1795 r1864  
    1717      use mod_filtre_fft_loc, ONLY : use_filtre_fft_loc=>use_filtre_fft
    1818      use mod_hallo, ONLY : use_mpi_alloc
    19       use parallel, ONLY : omp_chunk
    2019      USE infotrac, ONLY : type_trac
    2120      use assert_m, only: assert
     
    908907      use_mpi_alloc=.FALSE.
    909908      CALL getin('use_mpi_alloc',use_mpi_alloc)
    910 
    911 !Config  Key  = omp_chunk
    912 !Config  Desc = taille des blocs openmp
    913 !Config  Def  = 1
    914 !Config  Help = defini la taille des packets d'it�ration openmp
    915 !Config         distribu�e � chaque t�che lors de l'entr�e dans une
    916 !Config         boucle parall�lis�e
    917  
    918       omp_chunk=1
    919       CALL getin('omp_chunk',omp_chunk)
    920909
    921910!Config key = ok_strato
     
    1006995      write(lunout,*)' use_filtre_fft = ', use_filtre_fft
    1007996      write(lunout,*)' use_mpi_alloc = ', use_mpi_alloc
    1008       write(lunout,*)' omp_chunk = ', omp_chunk
    1009997      write(lunout,*)' ok_strato = ', ok_strato
    1010998      write(lunout,*)' ok_gradsfile = ', ok_gradsfile
  • LMDZ5/branches/testing/libf/dyn3dmem/convflu_loc.F

    r1669 r1864  
    1515c     nbniv   est le nombre de niveaux vert. de  xflu et de yflu .
    1616c
    17       USE parallel
     17      USE parallel_lmdz
    1818      IMPLICIT NONE
    1919c
  • LMDZ5/branches/testing/libf/dyn3dmem/convmas1_loc.F

    r1669 r1864  
    11      SUBROUTINE convmas1_loc (pbaru, pbarv, convm )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      USE mod_filtreg_p
    55      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/convmas2_loc.F

    r1669 r1864  
    11      SUBROUTINE convmas2_loc ( convm )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      IMPLICIT NONE
    55
  • LMDZ5/branches/testing/libf/dyn3dmem/convmas_loc.F

    r1669 r1864  
    11      SUBROUTINE convmas_loc (pbaru, pbarv, convm )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      USE mod_filtreg_p
    55      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/covcont_loc.F

    r1669 r1864  
    11      SUBROUTINE covcont_loc (klevel,ucov, vcov, ucont, vcont )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44
  • LMDZ5/branches/testing/libf/dyn3dmem/covnat_loc.F

    r1669 r1864  
    33!
    44      SUBROUTINE covnat_loc(klevel,ucov, vcov, unat, vnat )
    5       USE parallel
     5      USE parallel_lmdz
    66      IMPLICIT NONE
    77
  • LMDZ5/branches/testing/libf/dyn3dmem/dimensions_mod.F90

    r1669 r1864  
    1 MODULE dimensions
     1MODULE dimensions_mod
    22  INCLUDE 'dimensions.h'
    33  INCLUDE 'paramet.h'
    4 END MODULE dimensions
     4END MODULE dimensions_mod
  • LMDZ5/branches/testing/libf/dyn3dmem/dissip_loc.F

    r1669 r1864  
    11      SUBROUTINE dissip_loc( vcov,ucov,teta,p, dv,du,dh )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      USE write_field_loc
    55      USE dissip_mod
     
    5656!$OMP THREADPRIVATE(first)
    5757
    58       PRINT *,"----> calldissip"
    5958      IF (first) THEN
    6059        CALL dissip_allocate
  • LMDZ5/branches/testing/libf/dyn3dmem/dissip_mod.F90

    r1669 r1864  
    77  SUBROUTINE dissip_allocate
    88  USE bands
    9   USE allocate_field
    10   USE parallel
    11   USE dimensions
     9  USE allocate_field_mod
     10  USE parallel_lmdz
     11  USE dimensions_mod
    1212  USE gradiv2_mod, ONLY : gradiv2_allocate
    1313  USE nxgraro2_mod, ONLY : nxgraro2_allocate
     
    2323 
    2424  SUBROUTINE dissip_switch_dissip(dist)
    25   USE allocate_field
     25  USE allocate_field_mod
    2626  USE bands
    27   USE parallel
     27  USE parallel_lmdz
    2828  USE gradiv2_mod,ONLY : gradiv2_switch_dissip
    2929  USE nxgraro2_mod,ONLY : nxgraro2_switch_dissip
  • LMDZ5/branches/testing/libf/dyn3dmem/diverg_gam_loc.F

    r1669 r1864  
    99c              x et y  etant des composantes covariantes   ...
    1010c  *********************************************************************
    11       USE parallel
     11      USE parallel_lmdz
    1212      IMPLICIT NONE
    1313c
  • LMDZ5/branches/testing/libf/dyn3dmem/diverg_p.F

    r1669 r1864  
    88c              x et y  etant des composantes covariantes   ...
    99c  *********************************************************************
    10       USE parallel
     10      USE parallel_lmdz
    1111      IMPLICIT NONE
    1212c
  • LMDZ5/branches/testing/libf/dyn3dmem/divergf_loc.F

    r1669 r1864  
    88c              x et y  etant des composantes covariantes   ...
    99c  *********************************************************************
    10       USE PARALLEL
     10      USE parallel_lmdz
    1111      USE mod_filtreg_p
    1212      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/divgrad2_loc.F

    r1669 r1864  
    1010c         divgra     est  un argument  de sortie pour le s-prg
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      USE times
    1414      USE mod_hallo
     
    3131      INTEGER  l,ij,iter,lh
    3232c    ...................................................................
    33       Type(Request) :: request_dissip
     33      Type(Request),SAVE :: request_dissip
     34!$OMP THREADPRIVATE(request_dissip)
    3435      INTEGER ijb,ije
    3536
  • LMDZ5/branches/testing/libf/dyn3dmem/divgrad2_mod.F90

    r1669 r1864  
    77  SUBROUTINE divgrad2_allocate
    88  USE bands
    9   USE allocate_field
    10   USE parallel
    11   USE dimensions
     9  USE allocate_field_mod
     10  USE parallel_lmdz
     11  USE dimensions_mod
    1212  IMPLICIT NONE
    1313    TYPE(distrib),POINTER :: d
     
    2020 
    2121  SUBROUTINE divgrad2_switch_dissip(dist)
    22   USE allocate_field
     22  USE allocate_field_mod
    2323  USE bands
    24   USE parallel
     24  USE parallel_lmdz
    2525  IMPLICIT NONE
    2626    TYPE(distrib),INTENT(IN) :: dist
  • LMDZ5/branches/testing/libf/dyn3dmem/dteta1_loc.F

    r1669 r1864  
    11      SUBROUTINE dteta1_loc ( teta, pbaru, pbarv, dteta)
    2       USE parallel
     2      USE parallel_lmdz
    33      USE write_field_p
    44      USE mod_filtreg_p
  • LMDZ5/branches/testing/libf/dyn3dmem/dudv1_loc.F

    r1669 r1864  
    11      SUBROUTINE dudv1_loc ( vorpot, pbaru, pbarv, du, dv )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44c
  • LMDZ5/branches/testing/libf/dyn3dmem/dudv2_loc.F

    r1669 r1864  
    11      SUBROUTINE dudv2_loc ( teta, pkf, bern, du, dv  )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44c
  • LMDZ5/branches/testing/libf/dyn3dmem/dynetat0_loc.F

    r1707 r1864  
    66      USE infotrac
    77      use control_mod, only : planet_type
    8       USE parallel
     8      USE parallel_lmdz
    99      IMPLICIT NONE
    1010
  • LMDZ5/branches/testing/libf/dyn3dmem/dynredem_loc.F

    r1707 r1864  
    77      USE IOIPSL
    88#endif
    9       USE parallel
     9      USE parallel_lmdz
    1010      USE mod_hallo
    1111      USE infotrac
     
    528528      SUBROUTINE dynredem1_loc(fichnom,time,
    529529     .                     vcov,ucov,teta,q,masse,ps)
    530       USE parallel
     530      USE parallel_lmdz
    531531      USE mod_hallo
    532532      USE infotrac
  • LMDZ5/branches/testing/libf/dyn3dmem/dynredem_mod.F90

    r1707 r1864  
    77
    88  SUBROUTINE dynredem_write_u(ncid,id,var,ll)
    9   USE dimensions
    10   USE parallel
     9  USE dimensions_mod
     10  USE parallel_lmdz
    1111  USE mod_hallo
    1212  IMPLICIT NONE
     
    7272     
    7373  SUBROUTINE dynredem_write_v(ncid,id,var,ll)
    74   USE dimensions
    75   USE parallel
     74  USE dimensions_mod
     75  USE parallel_lmdz
    7676  USE mod_hallo
    7777  IMPLICIT NONE
     
    137137
    138138  SUBROUTINE dynredem_read_u(ncid,id,var,ll)
    139   USE dimensions
    140   USE parallel
     139  USE dimensions_mod
     140  USE parallel_lmdz
    141141  USE mod_hallo
    142142  IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/enercin_loc.F

    r1669 r1864  
    11      SUBROUTINE enercin_loc ( vcov, ucov, vcont, ucont, ecin )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44
  • LMDZ5/branches/testing/libf/dyn3dmem/exner_hyb_loc.F

    r1707 r1864  
    2929c
    3030c
    31       USE parallel
     31      USE parallel_lmdz
    3232      USE mod_filtreg_p
    3333      USE write_field_loc
  • LMDZ5/branches/testing/libf/dyn3dmem/exner_milieu_loc.F

    r1795 r1864  
    2626c    ( voir note de Fr.Hourdin )  ,
    2727c
    28       USE parallel
     28      USE parallel_lmdz
    2929      USE mod_filtreg_p
    3030      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/filtreg_p.F

    r1707 r1864  
    33      SUBROUTINE filtreg_p ( champ, ibeg, iend, nlat, nbniv,
    44     &     ifiltre, iaire, griscal ,iter)
    5       USE Parallel, only : OMP_CHUNK
     5      USE parallel_lmdz, only : OMP_CHUNK
    66      USE mod_filtre_fft
    77      USE timer_filtre
  • LMDZ5/branches/testing/libf/dyn3dmem/flumass_loc.F

    r1669 r1864  
    11      SUBROUTINE flumass_loc(massebx,masseby,vcont,ucont,pbaru,pbarv)
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44
  • LMDZ5/branches/testing/libf/dyn3dmem/friction_loc.F

    r1707 r1864  
    44c=======================================================================
    55      SUBROUTINE friction_loc(ucov,vcov,pdt)
    6       USE parallel
     6      USE parallel_lmdz
    77      USE control_mod
    88#ifdef CPP_IOIPSL
  • LMDZ5/branches/testing/libf/dyn3dmem/gcm.F

    r1795 r1864  
    1111
    1212      USE mod_const_mpi, ONLY: init_const_mpi
    13       USE parallel
     13      USE parallel_lmdz
    1414      USE infotrac
    1515      USE mod_interface_dyn_phys
  • LMDZ5/branches/testing/libf/dyn3dmem/geopot_loc.F

    r1669 r1864  
    11      SUBROUTINE geopot_loc ( ngrid, teta, pk, pks, phis, phi )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44     
  • LMDZ5/branches/testing/libf/dyn3dmem/getparam.F90

    r1669 r1864  
    1818CONTAINS
    1919  SUBROUTINE ini_getparam(fichier)
    20   USE parallel
     20  USE parallel_lmdz
    2121    !
    2222    IMPLICIT NONE
     
    2828
    2929  SUBROUTINE fin_getparam
    30   USE parallel
     30  USE parallel_lmdz
    3131    !
    3232    IMPLICIT NONE
     
    3737
    3838  SUBROUTINE getparamr(TARGET,def_val,ret_val,comment)
    39   USE parallel
     39  USE parallel_lmdz
    4040    !
    4141    IMPLICIT NONE
     
    6363
    6464  SUBROUTINE getparami(TARGET,def_val,ret_val,comment)
    65   USE parallel
     65  USE parallel_lmdz
    6666    !
    6767    IMPLICIT NONE
     
    9090
    9191  SUBROUTINE getparaml(TARGET,def_val,ret_val,comment)
    92   USE parallel
     92  USE parallel_lmdz
    9393    !
    9494    IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/gr_dyn_fi_p.F

    r1707 r1864  
    77      USE mod_interface_dyn_phys
    88      USE dimphy
    9       USE PARALLEL
     9      USE parallel_lmdz
    1010      IMPLICIT NONE
    1111c=======================================================================
  • LMDZ5/branches/testing/libf/dyn3dmem/gr_fi_dyn_p.F

    r1707 r1864  
    77      USE mod_interface_dyn_phys
    88      USE dimphy
    9       use parallel
     9      USE parallel_lmdz
    1010      IMPLICIT NONE
    1111c=======================================================================
  • LMDZ5/branches/testing/libf/dyn3dmem/gr_u_scal_loc.F

    r1669 r1864  
    2525c
    2626c=======================================================================
    27       USE parallel
     27      USE parallel_lmdz
    2828      IMPLICIT NONE
    2929c-----------------------------------------------------------------------
  • LMDZ5/branches/testing/libf/dyn3dmem/gr_v_scal_loc.F

    r1669 r1864  
    2525c
    2626c=======================================================================
    27       USE parallel
     27      USE parallel_lmdz
    2828      IMPLICIT NONE
    2929c-----------------------------------------------------------------------
  • LMDZ5/branches/testing/libf/dyn3dmem/grad_loc.F

    r1669 r1864  
    1010c       pgx  et  pgy    sont des arguments de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      IMPLICIT NONE
    1414c
  • LMDZ5/branches/testing/libf/dyn3dmem/grad_p.F

    r1669 r1864  
    1010c       pgx  et  pgy    sont des arguments de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      IMPLICIT NONE
    1414c
  • LMDZ5/branches/testing/libf/dyn3dmem/gradiv2_loc.F

    r1669 r1864  
    1313c
    1414c
    15       USE parallel
     15      USE parallel_lmdz
    1616      USE times
    1717      USE Write_field_p
     
    3838      INTEGER l,ij,iter,ld
    3939      INTEGER :: ijb,ije,jjb,jje
    40       Type(Request)  :: request_dissip
    41      
     40      Type(Request),SAVE  :: request_dissip
     41!$OMP THREADPRIVATE(request_dissip)     
    4242c    ........................................................
    4343c
  • LMDZ5/branches/testing/libf/dyn3dmem/gradiv2_mod.F90

    r1669 r1864  
    99  SUBROUTINE gradiv2_allocate
    1010  USE bands
    11   USE allocate_field
    12   USE parallel
    13   USE dimensions
     11  USE allocate_field_mod
     12  USE parallel_lmdz
     13  USE dimensions_mod
    1414  IMPLICIT NONE
    1515    TYPE(distrib),POINTER :: d
     
    2424 
    2525  SUBROUTINE gradiv2_switch_dissip(dist)
    26   USE allocate_field
     26  USE allocate_field_mod
    2727  USE bands
    28   USE parallel
     28  USE parallel_lmdz
    2929  IMPLICIT NONE
    3030    TYPE(distrib),INTENT(IN) :: dist
  • LMDZ5/branches/testing/libf/dyn3dmem/groupe_loc.F

    r1669 r1864  
    11      subroutine groupe_loc(pext,pbaru,pbarv,pbarum,pbarvm,wm)
    2       USE parallel
     2      USE parallel_lmdz
    33      USE Write_field_loc
    44      USE groupe_mod
  • LMDZ5/branches/testing/libf/dyn3dmem/groupe_mod.F90

    r1669 r1864  
    88  SUBROUTINE groupe_allocate
    99  USE bands
    10   USE allocate_field
    11   USE parallel
     10  USE allocate_field_mod
     11  USE parallel_lmdz
    1212  USE infotrac
    1313  USE advtrac_mod, ONLY : advtrac_allocate
     
    2525 
    2626  SUBROUTINE groupe_switch_caldyn(dist)
    27   USE allocate_field
     27  USE allocate_field_mod
    2828  USE bands
    29   USE parallel
     29  USE parallel_lmdz
    3030  IMPLICIT NONE
    3131    TYPE(distrib),INTENT(IN) :: dist
  • LMDZ5/branches/testing/libf/dyn3dmem/groupeun_loc.F

    r1669 r1864  
    11      SUBROUTINE groupeun_loc(jjmax,llmax,sb,se,jjb,jje,q)
    2       USE parallel
     2      USE parallel_lmdz
    33      USE Write_Field_p
    44      IMPLICIT NONE
     
    135135      SUBROUTINE init_groupeun_loc(airen_tab, aires_tab)
    136136
    137       USE parallel
     137      USE parallel_lmdz
    138138      IMPLICIT NONE
    139139
  • LMDZ5/branches/testing/libf/dyn3dmem/guide_loc_mod.F90

    r1750 r1864  
    1212  USE Write_Field_loc
    1313  use netcdf, only: nf90_nowrite, nf90_open, nf90_inq_varid, nf90_close
    14   USE parallel
     14  USE parallel_lmdz
    1515  USE pres2lev_mod
    1616
     
    293293!=======================================================================
    294294  SUBROUTINE guide_main(itau,ucov,vcov,teta,q,masse,ps)
    295     use parallel
     295    USE parallel_lmdz
    296296    USE control_mod
     297    USE write_field_loc
    297298   
    298299    IMPLICIT NONE
     
    313314!$OMP THREADPRIVATE(first)
    314315    LOGICAL       :: f_out ! sortie guidage
    315     REAL, DIMENSION (ijb_u:ije_u,llm) :: f_add ! var aux: champ de guidage
     316    REAL, ALLOCATABLE, SAVE, DIMENSION (:,:) :: f_addu ! var aux: champ de guidage
     317    REAL, ALLOCATABLE, SAVE, DIMENSION (:,:) :: f_addv ! var aux: champ de guidage
    316318    ! Variables pour fonction Exner (P milieu couche)
    317     REAL, DIMENSION (iip1,jjb_u:jje_u,llm)    :: pk, pkf
    318     REAL, DIMENSION (iip1,jjb_u:jje_u,llm)    :: alpha, beta
    319     REAL, DIMENSION (iip1,jjb_u:jje_u)        :: pks   
     319    REAL, ALLOCATABLE, SAVE, DIMENSION (:,:,:)    :: pk, pkf
     320    REAL, ALLOCATABLE, SAVE, DIMENSION (:,:,:)    :: alpha, beta
     321    REAL, ALLOCATABLE, SAVE, DIMENSION (:,:)        :: pks   
    320322    REAL                               :: unskap
    321     REAL, DIMENSION (ijb_u:ije_u,llmp1)    :: p ! besoin si guide_P
     323    REAL, ALLOCATABLE, SAVE, DIMENSION (:,:)    :: p ! besoin si guide_P
    322324    ! Compteurs temps:
    323325    INTEGER, SAVE :: step_rea,count_no_rea,itau_test ! lecture guidage
     
    329331   
    330332    INTEGER       :: i,j,l
    331    
     333      
    332334!$OMP MASTER   
    333335    ijbu=ij_begin ; ijeu=ij_end ; ijnu=ijeu-ijbu+1 
     
    358360        first=.FALSE.
    359361!$OMP MASTER
     362        ALLOCATE(f_addu(ijb_u:ije_u,llm) )
     363        ALLOCATE(f_addv(ijb_v:ije_v,llm) )
     364        ALLOCATE(pk(iip1,jjb_u:jje_u,llm)  )
     365        ALLOCATE(pkf(iip1,jjb_u:jje_u,llm)  )
     366        ALLOCATE(alpha(iip1,jjb_u:jje_u,llm)  )
     367        ALLOCATE(beta(iip1,jjb_u:jje_u,llm)  )
     368        ALLOCATE(pks(iip1,jjb_u:jje_u)  )
     369        ALLOCATE(p(ijb_u:ije_u,llmp1) )
    360370        CALL guide_init
    361371!$OMP END MASTER
     
    367377        factt=dtvr*iperiod/daysec
    368378!$OMP MASTER
    369         call tau2alpha(3,iip1,jjnb_v ,factt,tau_min_v,tau_max_v,alpha_v)
    370         call tau2alpha(2,iip1,jjnb_u,factt,tau_min_u,tau_max_u,alpha_u)
    371         call tau2alpha(1,iip1,jjnb_u,factt,tau_min_T,tau_max_T,alpha_T)
    372         call tau2alpha(1,iip1,jjnb_u,factt,tau_min_P,tau_max_P,alpha_P)
    373         call tau2alpha(1,iip1,jjnb_u,factt,tau_min_Q,tau_max_Q,alpha_Q)
     379        call tau2alpha(3, iip1, jjb_v, jje_v, factt, tau_min_v, tau_max_v, alpha_v)
     380        call tau2alpha(2, iip1, jjb_u, jje_u, factt, tau_min_u, tau_max_u, alpha_u)
     381        call tau2alpha(1, iip1, jjb_u, jje_u, factt, tau_min_T, tau_max_T, alpha_T)
     382        call tau2alpha(1, iip1, jjb_u, jje_u, factt, tau_min_P, tau_max_P, alpha_P)
     383        call tau2alpha(1, iip1, jjb_u, jje_u, factt, tau_min_Q, tau_max_Q, alpha_Q)
    374384! correction de rappel dans couche limite
    375385        if (guide_BL) then
     
    381391        endif
    382392!$OMP END MASTER
     393!$OMP BARRIER
    383394! ini_anal: etat initial egal au guidage       
    384395        IF (ini_anal) THEN
    385396            CALL guide_interp(ps,teta)
    386             IF (guide_u) ucov(ijbu:ijeu,:)=ugui2(ijbu:ijeu,:)
    387             IF (guide_v) vcov(ijbv:ijev,:)=ugui2(ijbv:ijev,:)
    388             IF (guide_T) teta(ijbu:ijeu,:)=tgui2(ijbu:ijeu,:)
    389             IF (guide_Q) q(ijbu:ijeu,:)=qgui2(ijbu:ijeu,:)
     397!$OMP DO           
     398            DO l=1,llm
     399              IF (guide_u) ucov(ijbu:ijeu,l)=ugui2(ijbu:ijeu,l)
     400              IF (guide_v) vcov(ijbv:ijev,l)=ugui2(ijbv:ijev,l)
     401              IF (guide_T) teta(ijbu:ijeu,l)=tgui2(ijbu:ijeu,l)
     402              IF (guide_Q) q(ijbu:ijeu,l)=qgui2(ijbu:ijeu,l)
     403            ENDDO
     404           
    390405            IF (guide_P) THEN
     406!$OMP MASTER
    391407                ps(ijbu:ijeu)=psgui2(ijbu:ijeu)
     408!$OMP END MASTER
     409!$OMP BARRIER
    392410                CALL pression_loc(ijnb_u,ap,bp,ps,p)
    393411                CALL massdair_loc(p,masse)
     412!$OMP BARRIER
    394413            ENDIF
    395414            RETURN
     
    398417        IF (guide_u) THEN
    399418!+tard            CALL writefield_u('unat',unat1)
    400             CALL writefield_u('ucov',ucov)
     419!            CALL writefield_u('ucov',ucov)
    401420        ENDIF
    402421        IF (guide_T) THEN
    403422!+tard            CALL writefield_p('tnat',tnat1)
    404             CALL writefield_u('teta',teta)
     423!            CALL writefield_u('teta',teta)
    405424        ENDIF
    406425
     
    424443              stop
    425444          ELSE
     445!$OMP MASTER
    426446              IF (guide_v) vnat1(:,jjbv:jjev,:)=vnat2(:,jjbv:jjev,:)
    427447              IF (guide_u) unat1(:,jjbu:jjeu,:)=unat2(:,jjbu:jjeu,:)
     
    430450              IF (guide_plevs.EQ.2) pnat1(:,jjbu:jjeu,:)=pnat2(:,jjbu:jjeu,:)
    431451              IF (guide_P.OR.guide_plevs.EQ.1) psnat1(:,jjbu:jjeu)=psnat2(:,jjbu:jjeu)
     452!$OMP END MASTER
     453!$OMP BARRIER
    432454              step_rea=step_rea+1
    433455              itau_test=itau
     
    435457                    'apres ',count_no_rea,' non lectures'
    436458              IF (guide_2D) THEN
     459!$OMP MASTER
    437460                  CALL guide_read2D(step_rea)
     461!$OMP END MASTER
     462!$OMP BARRIER
    438463              ELSE
     464!$OMP MASTER
    439465                  CALL guide_read(step_rea)
     466!$OMP END MASTER
     467!$OMP BARRIER
    440468              ENDIF
    441469              count_no_rea=0
     
    460488    ENDIF
    461489
    462 !-----------------------------------------------------------------------
     490!    CALL WriteField_u('ucov_guide',ucov)
     491!    CALL WriteField_v('vcov_guide',vcov)
     492!    CALL WriteField_u('teta_guide',teta)
     493!    CALL WriteField_u('masse_guide',masse)
     494   
     495   
     496        !-----------------------------------------------------------------------
    463497!   Ajout des champs de guidage
    464498!-----------------------------------------------------------------------
     
    473507          CALL exner_milieu_loc(ip1jmp1,ps,p,beta,pks,pk,pkf)
    474508        endif
     509!$OMP BARRIER       
    475510        unskap=1./kappa
     511!$OMP DO
    476512        DO l = 1, llm
    477513            DO j=jjbu,jjeu
     
    481517            ENDDO
    482518        ENDDO
     519!$OMP MASTER
    483520        CALL guide_out("P",jjp1,llm,p,1.)
     521!$OMP END MASTER
     522!$OMP BARRIER
    484523    ENDIF
    485524   
    486525    if (guide_u) then
    487526        if (guide_add) then
    488            f_add(ijbu:ijeu,:)=(1.-tau)*ugui1(ijbu:ijeu,:)+tau*ugui2(ijbu:ijeu,:)
     527!$OMP DO
     528          DO l=1,llm
     529           f_addu(ijbu:ijeu,l)=(1.-tau)*ugui1(ijbu:ijeu,l)+tau*ugui2(ijbu:ijeu,l)
     530          ENDDO
    489531        else
    490            f_add(ijbu:ijeu,:)=(1.-tau)*ugui1(ijbu:ijeu,:)+tau*ugui2(ijbu:ijeu,:)-ucov(ijbu:ijeu,:)
     532!$OMP DO
     533          DO l=1,llm
     534           f_addu(ijbu:ijeu,l)=(1.-tau)*ugui1(ijbu:ijeu,l)+tau*ugui2(ijbu:ijeu,l)-ucov(ijbu:ijeu,l)
     535          ENDDO
    491536        endif
    492 
    493         if (guide_zon) CALL guide_zonave_u(1,llm,f_add)
    494         CALL guide_addfield_u(llm,f_add,alpha_u)
    495         IF (f_out) CALL guide_out("U",jjp1,llm,f_add(:,:),factt)
    496         ucov(ijbu:ijeu,:)=ucov(ijbu:ijeu,:)+f_add(ijbu:ijeu,:)
     537   
     538!        CALL WriteField_u('f_addu',f_addu)
     539
     540        if (guide_zon) CALL guide_zonave_u(1,llm,f_addu)
     541        CALL guide_addfield_u(llm,f_addu,alpha_u)
     542!        CALL WriteField_u('f_addu',f_addu)
     543!        CALL WriteField_u('alpha_u',alpha_u)
     544!$OMP MASTER
     545        IF (f_out) CALL guide_out("U",jjp1,llm,f_addu(:,:),factt)
     546!$OMP END MASTER
     547!$OMP BARRIER
     548
     549!$OMP DO
     550        DO l=1,llm
     551          ucov(ijbu:ijeu,l)=ucov(ijbu:ijeu,l)+f_addu(ijbu:ijeu,l)
     552        ENDDO
     553
    497554    endif
    498555
    499556    if (guide_T) then
    500557        if (guide_add) then
    501            f_add(ijbu:ijeu,:)=(1.-tau)*tgui1(ijbu:ijeu,:)+tau*tgui2(ijbu:ijeu,:)
     558!$OMP DO
     559          DO l=1,llm
     560            f_addu(ijbu:ijeu,l)=(1.-tau)*tgui1(ijbu:ijeu,l)+tau*tgui2(ijbu:ijeu,l)
     561          ENDDO
    502562        else
    503            f_add(ijbu:ijeu,:)=(1.-tau)*tgui1(ijbu:ijeu,:)+tau*tgui2(ijbu:ijeu,:)-teta(ijbu:ijeu,:)
     563!$OMP DO
     564          DO l=1,llm
     565           f_addu(ijbu:ijeu,l)=(1.-tau)*tgui1(ijbu:ijeu,l)+tau*tgui2(ijbu:ijeu,l)-teta(ijbu:ijeu,l)
     566          ENDDO
    504567        endif
    505         if (guide_zon) CALL guide_zonave_u(2,llm,f_add)
    506         CALL guide_addfield_u(llm,f_add,alpha_T)
    507         IF (f_out) CALL guide_out("T",jjp1,llm,f_add(:,:),factt)
    508         teta(ijbu:ijeu,:)=teta(ijbu:ijeu,:)+f_add(ijbu:ijeu,:)
     568        if (guide_zon) CALL guide_zonave_u(2,llm,f_addu)
     569        CALL guide_addfield_u(llm,f_addu,alpha_T)
     570!$OMP MASTER
     571        IF (f_out) CALL guide_out("T",jjp1,llm,f_addu(:,:),factt)
     572!$OMP END MASTER
     573!$OMP BARRIER
     574!$OMP DO
     575        DO l=1,llm
     576          teta(ijbu:ijeu,l)=teta(ijbu:ijeu,l)+f_addu(ijbu:ijeu,l)
     577        ENDDO
    509578    endif
    510579
    511580    if (guide_P) then
    512581        if (guide_add) then
    513            f_add(ijbu:ijeu,1)=(1.-tau)*psgui1(ijbu:ijeu)+tau*psgui2(ijbu:ijeu)
     582!$OMP MASTER
     583            f_addu(ijbu:ijeu,1)=(1.-tau)*psgui1(ijbu:ijeu)+tau*psgui2(ijbu:ijeu)
     584!$OMP END MASTER
     585!$OMP BARRIER
    514586        else
    515            f_add(ijbu:ijeu,1)=(1.-tau)*psgui1(ijbu:ijeu)+tau*psgui2(ijbu:ijeu)-ps(ijbu:ijeu)
     587!$OMP MASTER
     588            f_addu(ijbu:ijeu,1)=(1.-tau)*psgui1(ijbu:ijeu)+tau*psgui2(ijbu:ijeu)-ps(ijbu:ijeu)
     589!$OMP END MASTER
     590!$OMP BARRIER
    516591        endif
    517         if (guide_zon) CALL guide_zonave_u(2,1,f_add(ijb_u:ije_u,1))
    518         CALL guide_addfield_u(1,f_add(ijb_u:ije_u,1),alpha_P)
    519         IF (f_out) CALL guide_out("SP",jjp1,1,f_add(1:ip1jmp1,1),factt)
    520         ps(ijbu:ijeu)=ps(ijbu:ijeu)+f_add(ijbu:ijeu,1)
     592        if (guide_zon) CALL guide_zonave_u(2,1,f_addu(ijb_u:ije_u,1))
     593        CALL guide_addfield_u(1,f_addu(ijb_u:ije_u,1),alpha_P)
     594!$OMP MASTER
     595        IF (f_out) CALL guide_out("SP",jjp1,1,f_addu(1:ip1jmp1,1),factt)
     596!$OMP END MASTER
     597!$OMP BARRIER
     598!$OMP MASTER
     599        ps(ijbu:ijeu)=ps(ijbu:ijeu)+f_addu(ijbu:ijeu,1)
     600!$OMP END MASTER
     601!$OMP BARRIER
    521602        CALL pression_loc(ijnb_u,ap,bp,ps,p)
    522603        CALL massdair_loc(p,masse)
     604!$OMP BARRIER
    523605    endif
    524606
    525607    if (guide_Q) then
    526608        if (guide_add) then
    527            f_add(ijbu:ijeu,:)=(1.-tau)*qgui1(ijbu:ijeu,:)+tau*qgui2(ijbu:ijeu,:)
     609!$OMP DO
     610          DO l=1,llm
     611            f_addu(ijbu:ijeu,l)=(1.-tau)*qgui1(ijbu:ijeu,l)+tau*qgui2(ijbu:ijeu,l)
     612          ENDDO
    528613        else
    529            f_add(ijbu:ijeu,:)=(1.-tau)*qgui1(ijbu:ijeu,:)+tau*qgui2(ijbu:ijeu,:)-q(ijbu:ijeu,:)
     614!$OMP DO
     615          DO l=1,llm
     616            f_addu(ijbu:ijeu,l)=(1.-tau)*qgui1(ijbu:ijeu,l)+tau*qgui2(ijbu:ijeu,l)-q(ijbu:ijeu,l)
     617          ENDDO
    530618        endif
    531         if (guide_zon) CALL guide_zonave_u(2,llm,f_add)
    532         CALL guide_addfield_u(llm,f_add,alpha_Q)
    533         IF (f_out) CALL guide_out("Q",jjp1,llm,f_add(:,:),factt)
    534         q(ijbu:ijeu,:)=q(ijbu:ijeu,:)+f_add(ijbu:ijeu,:)
     619        if (guide_zon) CALL guide_zonave_u(2,llm,f_addu)
     620        CALL guide_addfield_u(llm,f_addu,alpha_Q)
     621!$OMP MASTER
     622        IF (f_out) CALL guide_out("Q",jjp1,llm,f_addu(:,:),factt)
     623!$OMP END MASTER
     624!$OMP BARRIER
     625
     626!$OMP DO
     627        DO l=1,llm
     628          q(ijbu:ijeu,l)=q(ijbu:ijeu,l)+f_addu(ijbu:ijeu,l)
     629        ENDDO
    535630    endif
    536631
    537632    if (guide_v) then
    538633        if (guide_add) then
    539            f_add(ijbv:ijev,:)=(1.-tau)*vgui1(ijbv:ijev,:)+tau*vgui2(ijbv:ijev,:)
     634!$OMP DO
     635          DO l=1,llm
     636             f_addv(ijbv:ijev,l)=(1.-tau)*vgui1(ijbv:ijev,l)+tau*vgui2(ijbv:ijev,l)
     637          ENDDO
     638
    540639        else
    541            f_add(ijbv:ijev,:)=(1.-tau)*vgui1(ijbv:ijev,:)+tau*vgui2(ijbv:ijev,:)-vcov(ijbv:ijev,:)
     640!$OMP DO
     641          DO l=1,llm
     642            f_addv(ijbv:ijev,l)=(1.-tau)*vgui1(ijbv:ijev,l)+tau*vgui2(ijbv:ijev,l)-vcov(ijbv:ijev,l)
     643          ENDDO
     644
    542645        endif
     646!        CALL WriteField_v('f_addv',f_addv)       
     647   
     648        if (guide_zon) CALL guide_zonave_v(2,jjm,llm,f_addv(ijb_v:ije_v,:))
     649!        CALL WriteField_v('f_addv',f_addv)       
    543650       
    544         if (guide_zon) CALL guide_zonave_v(2,jjm,llm,f_add(ijb_v:ije_v,:))
    545         CALL guide_addfield_v(llm,f_add(ijb_v:ije_v,:),alpha_v)
    546         IF (f_out) CALL guide_out("V",jjm,llm,f_add(1:ip1jm,:),factt)
    547         vcov(ijbv:ijev,:)=vcov(ijbv:ijev,:)+f_add(ijbv:ijev,:)
     651        CALL guide_addfield_v(llm,f_addv(ijb_v:ije_v,:),alpha_v)
     652!        CALL WriteField_v('f_addv',f_addv)       
     653!        CALL WriteField_v('alpha_v',alpha_v)       
     654!$OMP MASTER
     655        IF (f_out) CALL guide_out("V",jjm,llm,f_addv(1:ip1jm,:),factt)
     656!$OMP END MASTER
     657!$OMP BARRIER
     658!        CALL WriteField_v('f_addv',f_addv)       
     659
     660!$OMP DO
     661        DO l=1,llm
     662          vcov(ijbv:ijev,l)=vcov(ijbv:ijev,l)+f_addv(ijbv:ijev,l)
     663        ENDDO
    548664    endif
     665
     666!    CALL WriteField_u('ucov_guide',ucov)
     667!    CALL WriteField_v('vcov_guide',vcov)
     668!    CALL WriteField_u('teta_guide',teta)
     669!    CALL WriteField_u('masse_guide',masse)
    549670
    550671  END SUBROUTINE guide_main
     
    566687    INTEGER :: l
    567688
     689!$OMP DO
    568690    DO l=1,vsize
    569691      field(ijbu:ijeu,l)=alpha(ijbu:ijeu)*field(ijbu:ijeu,l)*alpha_pcor(l)
     
    588710    INTEGER :: l
    589711
     712!$OMP DO
    590713    DO l=1,vsize
    591714      field(ijbv:ijev,l)=alpha(ijbv:ijev)*field(ijbv:ijev,l)*alpha_pcor(l)
     
    612735    ! Local variables
    613736    LOGICAL, SAVE                :: first=.TRUE.
     737!$OMP THREADPRIVATE(first)
     738
    614739    INTEGER, DIMENSION (2), SAVE :: imin, imax ! averaging domain
     740!$OMP THREADPRIVATE(imin,imax)   
    615741    INTEGER                      :: i,j,l,ij
    616742    REAL, DIMENSION (iip1)       :: lond       ! longitude in Deg.
     
    636762    ENDIF
    637763
    638     fieldm=0.
    639    
     764   
     765!$OMP DO
    640766      DO l=1,vsize
     767        fieldm(:,l)=0.
    641768      ! Compute zonal average
    642769
     
    680807    ! Local variables
    681808    LOGICAL, SAVE                :: first=.TRUE.
     809!$OMP THREADPRIVATE(first)
    682810    INTEGER, DIMENSION (2), SAVE :: imin, imax ! averaging domain
     811!$OMP THREADPRIVATE(imin, imax)
    683812    INTEGER                      :: i,j,l,ij
    684813    REAL, DIMENSION (iip1)       :: lond       ! longitude in Deg.
     
    704833    ENDIF
    705834
    706     fieldm=0.
    707    
     835!$OMP DO
    708836      DO l=1,vsize
    709837      ! Compute zonal average
     838          fieldm(:,l)=0.
    710839          DO j=jjbv,jjev
    711840              DO i=imin(typ),imax(typ)
     
    729858!=======================================================================
    730859  SUBROUTINE guide_interp(psi,teta)
    731   USE parallel
     860  USE parallel_lmdz
    732861  USE mod_hallo
    733862  USE Bands
     
    744873
    745874  LOGICAL, SAVE                      :: first=.TRUE.
     875!$OMP THREADPRIVATE(first)
    746876  ! Variables pour niveaux pression:
    747   REAL, DIMENSION (iip1,jjb_u:jje_u,nlevnc) :: plnc1,plnc2 !niveaux pression guidage
    748   REAL, DIMENSION (iip1,jjb_u:jje_u,llm)    :: plunc,plsnc !niveaux pression modele
    749   REAL, DIMENSION (iip1,jjb_v:jje_v,llm)     :: plvnc       !niveaux pression modele
    750   REAL, DIMENSION (iip1,jjb_u:jje_u,llmp1)  :: p           ! pression intercouches
    751   REAL, DIMENSION (iip1,jjb_u:jje_u,llm)    :: pls, pext   ! var intermediaire
    752   REAL, DIMENSION (iip1,jjb_u:jje_u,llm)    :: pbarx
    753   REAL, DIMENSION (iip1,jjb_v:jje_v,llm)     :: pbary
     877  REAL, ALLOCATABLE, SAVE, DIMENSION (:,:,:) :: plnc1,plnc2 !niveaux pression guidage
     878  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:)    :: plunc,plsnc !niveaux pression modele
     879  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:)     :: plvnc       !niveaux pression modele
     880  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:)  :: p           ! pression intercouches
     881  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:)    :: pls, pext   ! var intermediaire
     882  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:)    :: pbarx
     883  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:)     :: pbary
    754884  ! Variables pour fonction Exner (P milieu couche)
    755   REAL, DIMENSION (iip1,jjb_u:jje_u,llm)    :: pk, pkf
    756   REAL, DIMENSION (iip1,jjb_u:jje_u,llm)    :: alpha, beta
    757   REAL, DIMENSION (iip1,jjb_u:jje_u)        :: pks   
     885  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:)    :: pk, pkf
     886  REAL, ALLOCATABLE, SAVE, DIMENSION (:,:,:)    :: alpha, beta
     887  REAL ,ALLOCATABLE, SAVE, DIMENSION (:,:)        :: pks   
    758888  REAL                               :: unskap
    759889  ! Pression de vapeur saturante
    760   REAL, DIMENSION (ijb_u:ije_u,llm)      :: qsat
     890  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:)      :: qsat
    761891  !Variables intermediaires interpolation
    762   REAL, DIMENSION (iip1,jjb_u:jje_u,llm)    :: zu1,zu2
    763   REAL, DIMENSION (iip1,jjb_v:jje_v,llm)     :: zv1,zv2
     892  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:)    :: zu1,zu2
     893  REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:)     :: zv1,zv2
    764894 
    765895  INTEGER                            :: i,j,l,ij
    766   TYPE(Request) :: Req 
    767 
     896  TYPE(Request),SAVE :: Req 
     897!$OMP THREADPRIVATE(Req)
    768898    print *,'Guide: conversion variables guidage'
    769899! -----------------------------------------------------------------
    770900! Calcul des niveaux de pression champs guidage (pour T et Q)
    771901! -----------------------------------------------------------------
     902    IF (first) THEN
     903!$OMP MASTER
     904      ALLOCATE(plnc1(iip1,jjb_u:jje_u,nlevnc) )   
     905      ALLOCATE(plnc2(iip1,jjb_u:jje_u,nlevnc) )   
     906      ALLOCATE(plunc(iip1,jjb_u:jje_u,llm) )   
     907      ALLOCATE(plsnc(iip1,jjb_u:jje_u,llm) )   
     908      ALLOCATE(plvnc(iip1,jjb_v:jje_v,llm) )   
     909      ALLOCATE(p(iip1,jjb_u:jje_u,llmp1) )   
     910      ALLOCATE(pls(iip1,jjb_u:jje_u,llm) )   
     911      ALLOCATE(pext(iip1,jjb_u:jje_u,llm) )   
     912      ALLOCATE(pbarx(iip1,jjb_u:jje_u,llm) )   
     913      ALLOCATE(pbary(iip1,jjb_v:jje_v,llm) )   
     914      ALLOCATE(pk(iip1,jjb_u:jje_u,llm) )   
     915      ALLOCATE(pkf(iip1,jjb_u:jje_u,llm)  )   
     916      ALLOCATE(alpha(iip1,jjb_u:jje_u,llm) )   
     917      ALLOCATE(beta(iip1,jjb_u:jje_u,llm) )   
     918      ALLOCATE(pks (iip1,jjb_u:jje_u) )   
     919      ALLOCATE(qsat(ijb_u:ije_u,llm) )   
     920      ALLOCATE(zu1(iip1,jjb_u:jje_u,llm) )   
     921      ALLOCATE(zu2(iip1,jjb_u:jje_u,llm) )   
     922      ALLOCATE(zv1(iip1,jjb_v:jje_v,llm) )   
     923      ALLOCATE(zv2(iip1,jjb_v:jje_v,llm) )
     924!$OMP END MASTER
     925!$OMP BARRIER
     926    ENDIF       
     927
     928   
     929   
     930   
    772931    IF (guide_plevs.EQ.0) THEN
     932!$OMP DO
    773933        DO l=1,nlevnc
    774934            DO j=jjbu,jjeu
     
    783943    if (first) then
    784944        first=.FALSE.
     945!$OMP MASTER
    785946        print*,'Guide: verification ordre niveaux verticaux'
    786947        print*,'LMDZ :'
     
    815976            enddo
    816977        endif
     978!$OMP END MASTER
    817979    endif
    818980   
     
    823985!    ....  Calcul de pls , pression au milieu des couches ,en Pascals
    824986    IF (guide_plevs.EQ.1) THEN
     987!$OMP DO
    825988        DO l=1,llm
    826989            DO j=jjbu,jjeu
     
    8381001        endif
    8391002        unskap=1./kappa
     1003!$OMP BARRIER
     1004!$OMP DO
    8401005        DO l = 1, llm
    8411006            DO j=jjbu,jjeu
     
    8481013
    8491014!   calcul des pressions pour les grilles u et v
     1015!$OMP DO
    8501016    do l=1,llm
    8511017        do j=jjbu,jjeu
     
    8581024     CALL Register_Hallo_u(pext,llm,1,2,2,1,Req)
    8591025     CALL SendRequest(Req)
     1026!$OMP BARRIER
    8601027     CALL WaitRequest(Req)
     1028!$OMP BARRIER
    8611029
    8621030    call massbar_loc(pext, pbarx, pbary )
     1031!$OMP BARRIER
     1032!$OMP DO
    8631033    do l=1,llm
    8641034        do j=jjbu,jjeu
     
    8691039        enddo
    8701040    enddo
     1041!$OMP DO
    8711042    do l=1,llm
    8721043        do j=jjbv,jjev
     
    8821053! -----------------------------------------------------------------
    8831054    if (guide_P) then
     1055!$OMP MASTER
    8841056        do j=jjbu,jjeu
    8851057            do i=1,iim
     
    8911063            psgui2(iip1*j)=psnat2(1,j)
    8921064        enddo
     1065!$OMP END MASTER
     1066!$OMP BARRIER
    8931067    endif
    8941068
     
    8961070        ! Calcul des nouvelles valeurs des niveaux de pression du guidage
    8971071        IF (guide_plevs.EQ.1) THEN
     1072!$OMP DO
    8981073            DO l=1,nlevnc
    8991074                DO j=jjbu,jjeu
     
    9051080            ENDDO
    9061081        ELSE IF (guide_plevs.EQ.2) THEN
     1082!$OMP DO
    9071083            DO l=1,nlevnc
    9081084                DO j=jjbu,jjeu
     
    9161092
    9171093        ! Interpolation verticale
     1094!$OMP MASTER
    9181095        CALL pres2lev(tnat1(:,jjbu:jjeu,:),zu1(:,jjbu:jjeu,:),nlevnc,llm,           &
    9191096                    plnc1(:,jjbu:jjeu,:),plsnc(:,jjbu:jjeu,:),iip1,jjnu,invert_p)
    9201097        CALL pres2lev(tnat2(:,jjbu:jjeu,:),zu2(:,jjbu:jjeu,:),nlevnc,llm,           &
    9211098                    plnc2(:,jjbu:jjeu,:),plsnc(:,jjbu:jjeu,:),iip1,jjnu,invert_p)
    922 
     1099!$OMP END MASTER
     1100!$OMP BARRIER
    9231101        ! Conversion en variables GCM
     1102!$OMP DO
    9241103        do l=1,llm
    9251104            do j=jjbu,jjeu
     
    9581137        ! Calcul des nouvelles valeurs des niveaux de pression du guidage
    9591138        IF (guide_plevs.EQ.1) THEN
     1139!$OMP DO
    9601140            DO l=1,nlevnc
    9611141                DO j=jjbu,jjeu
     
    9671147            ENDDO
    9681148        ELSE IF (guide_plevs.EQ.2) THEN
     1149!$OMP DO
    9691150            DO l=1,nlevnc
    9701151                DO j=jjbu,jjeu
     
    9781159
    9791160        ! Interpolation verticale
     1161!$OMP MASTER
    9801162        CALL pres2lev(qnat1(:,jjbu:jjeu,:),zu1(:,jjbu:jjeu,:),nlevnc,llm,             &
    9811163                      plnc1(:,jjbu:jjeu,:),plsnc(:,jjbu:jjeu,:),iip1,jjnu,invert_p)
    9821164        CALL pres2lev(qnat2(:,jjbu:jjeu,:),zu2(:,jjbu:jjeu,:),nlevnc,llm,             &
    9831165                      plnc2(:,jjbu:jjeu,:),plsnc(:,jjbu:jjeu,:),iip1,jjnu,invert_p)
     1166!$OMP END MASTER
     1167!$OMP BARRIER
    9841168
    9851169        ! Conversion en variables GCM
    9861170        ! On suppose qu'on a la bonne variable dans le fichier de guidage:
    9871171        ! Hum.Rel si guide_hr, Hum.Spec. sinon.
     1172!$OMP DO
    9881173        do l=1,llm
    9891174            do j=jjbu,jjeu
     
    10101195        enddo
    10111196        IF (guide_hr) THEN
    1012             CALL q_sat(iip1*jjnu*llm,teta(:,jjbu:jjeu,:)*pk(:,jjbu:jjeu,:)/cpp,       &
    1013                        plsnc(:,jjbu:jjeu,:),qsat(ijbu:ijeu,:))
    1014             qgui1(ijbu:ijeu,:)=qgui1(ijbu:ijeu,:)*qsat(ijbu:ijeu,:)*0.01 !hum. rel. en %
    1015             qgui2(ijbu:ijeu,:)=qgui2(ijbu:ijeu,:)*qsat(ijbu:ijeu,:)*0.01
     1197!$OMP DO
     1198          do l=1,llm
     1199            CALL q_sat(iip1*jjnu,teta(:,jjbu:jjeu,l)*pk(:,jjbu:jjeu,l)/cpp,       &
     1200                       plsnc(:,jjbu:jjeu,l),qsat(ijbu:ijeu,l))
     1201            qgui1(ijbu:ijeu,l)=qgui1(ijbu:ijeu,l)*qsat(ijbu:ijeu,l)*0.01 !hum. rel. en %
     1202            qgui2(ijbu:ijeu,l)=qgui2(ijbu:ijeu,l)*qsat(ijbu:ijeu,l)*0.01
     1203          enddo
     1204
    10161205        ENDIF
    10171206    ENDIF
     
    10201209        ! Calcul des nouvelles valeurs des niveaux de pression du guidage
    10211210        IF (guide_plevs.EQ.1) THEN
     1211!$OMP DO
    10221212            DO l=1,nlevnc
    10231213                DO j=jjbu,jjeu
     
    10331223            ENDDO
    10341224        ELSE IF (guide_plevs.EQ.2) THEN
     1225!$OMP DO
    10351226            DO l=1,nlevnc
    10361227                DO j=jjbu,jjeu
     
    10481239       
    10491240        ! Interpolation verticale
     1241!$OMP MASTER
    10501242        CALL pres2lev(unat1(:,jjbu:jjeu,:),zu1(:,jjbu:jjeu,:),nlevnc,llm,            &
    10511243                      plnc1(:,jjbu:jjeu,:),plunc(:,jjbu:jjeu,:),iip1,jjnu,invert_p)
    10521244        CALL pres2lev(unat2(:,jjbu:jjeu,:),zu2(:,jjbu:jjeu,:),nlevnc,llm,            &
    10531245                      plnc2(:,jjbu:jjeu,:),plunc(:,jjbu:jjeu,:),iip1,jjnu,invert_p)
     1246!$OMP END MASTER
     1247!$OMP BARRIER
    10541248
    10551249        ! Conversion en variables GCM
     1250!$OMP DO
    10561251        do l=1,llm
    10571252            do j=jjbu,jjeu
     
    10851280         CALL Register_Hallo_u(psnat2,1,1,2,2,1,Req)
    10861281         CALL SendRequest(Req)
     1282!$OMP BARRIER
    10871283         CALL WaitRequest(Req)
     1284!$OMP BARRIER
     1285!$OMP DO
    10881286            DO l=1,nlevnc
    10891287                DO j=jjbv,jjev
     
    11001298         CALL Register_Hallo_u(pnat2,llm,1,2,2,1,Req)
    11011299         CALL SendRequest(Req)
     1300!$OMP BARRIER
    11021301         CALL WaitRequest(Req)
     1302!$OMP BARRIER
     1303!$OMP DO
    11031304            DO l=1,nlevnc
    11041305                DO j=jjbv,jjev
     
    11131314        ENDIF
    11141315        ! Interpolation verticale
     1316
     1317!$OMP MASTER
    11151318        CALL pres2lev(vnat1(:,jjbv:jjev,:),zv1(:,jjbv:jjev,:),nlevnc,llm,             &
    11161319                      plnc1(:,jjbv:jjev,:),plvnc(:,jjbv:jjev,:),iip1,jjnv,invert_p)
    11171320        CALL pres2lev(vnat2(:,jjbv:jjev,:),zv2(:,jjbv:jjev,:),nlevnc,llm,             &
    11181321                      plnc2(:,jjbv:jjev,:),plvnc(:,jjbv:jjev,:),iip1,jjnv,invert_p)
     1322!$OMP END MASTER
     1323!$OMP BARRIER
    11191324        ! Conversion en variables GCM
     1325!$OMP DO
    11201326        do l=1,llm
    11211327            do j=jjbv,jjev
     
    11351341
    11361342!=======================================================================
    1137   SUBROUTINE tau2alpha(typ,pim,pjm,factt,taumin,taumax,alpha)
     1343  SUBROUTINE tau2alpha(typ,pim,jjb,jje,factt,taumin,taumax,alpha)
    11381344
    11391345! Calcul des constantes de rappel alpha (=1/tau)
     
    11491355! input arguments :
    11501356    INTEGER, INTENT(IN) :: typ    ! u(2),v(3), ou scalaire(1)
    1151     INTEGER, INTENT(IN) :: pim,pjm ! dimensions en lat, lon
     1357    INTEGER, INTENT(IN) :: pim ! dimensions en lon
     1358    INTEGER, INTENT(IN) :: jjb,jje ! dimensions en lat
    11521359    REAL, INTENT(IN)    :: factt   ! pas de temps en fraction de jour
    11531360    REAL, INTENT(IN)    :: taumin,taumax
    11541361! output arguments:
    1155     REAL, DIMENSION(pim,pjm), INTENT(OUT) :: alpha
     1362    REAL, DIMENSION(pim,jjb:jje), INTENT(OUT) :: alpha
    11561363 
    11571364!  local variables:
     
    11751382!-----------------------------------------------------------------------
    11761383        IF (guide_reg) THEN
    1177             do j=1,pjm
     1384            do j=jjb,jje
    11781385                do i=1,pim
    11791386                    if (typ.eq.2) then
     
    12711478        ENDIF !first
    12721479
    1273         do j=1,pjm
     1480        do j=jjb,jje
    12741481            do i=1,pim
    12751482                if (typ.eq.1) then
     
    12971504            enddo
    12981505        enddo
     1506   
    12991507    ENDIF ! guide_reg
    13001508
     
    17671975!=======================================================================
    17681976  SUBROUTINE guide_out(varname,hsize,vsize,field,factt)
    1769     USE parallel
     1977    USE parallel_lmdz
    17701978    IMPLICIT NONE
    17711979
  • LMDZ5/branches/testing/libf/dyn3dmem/iniacademic_loc.F90

    r1795 r1864  
    77  USE infotrac, ONLY : nqtot
    88  USE control_mod, ONLY: day_step,planet_type
    9   USE parallel
     9  USE parallel_lmdz
    1010#ifdef CPP_IOIPSL
    1111  USE IOIPSL
  • LMDZ5/branches/testing/libf/dyn3dmem/initdynav_loc.F

    r1669 r1864  
    88       USE IOIPSL
    99#endif
    10        use parallel
     10       USE parallel_lmdz
    1111       use Write_field
    1212       use misc_mod
  • LMDZ5/branches/testing/libf/dyn3dmem/initfluxsto_p.F

    r1707 r1864  
    1010       USE IOIPSL
    1111#endif
    12        use parallel
     12       USE parallel_lmdz
    1313       use Write_field
    1414       use misc_mod
  • LMDZ5/branches/testing/libf/dyn3dmem/inithist_loc.F

    r1669 r1864  
    88       USE IOIPSL
    99#endif
    10        use parallel
     10       USE parallel_lmdz
    1111       use Write_field
    1212       use misc_mod
  • LMDZ5/branches/testing/libf/dyn3dmem/integrd_loc.F

    r1707 r1864  
    55     $  (  nq,vcovm1,ucovm1,tetam1,psm1,massem1,
    66     $     dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps0,masse,phis) !,finvmaold)
    7       USE parallel
     7      USE parallel_lmdz
    88      USE control_mod
    99      USE mod_filtreg_p
  • LMDZ5/branches/testing/libf/dyn3dmem/integrd_mod.F90

    r1669 r1864  
    1111  SUBROUTINE integrd_allocate
    1212  USE bands
    13   USE allocate_field
    14   USE parallel
    15   USE dimensions
     13  USE allocate_field_mod
     14  USE parallel_lmdz
     15  USE dimensions_mod
    1616  USE advect_new_mod,ONLY : advect_new_allocate
    1717  IMPLICIT NONE
     
    2828 
    2929  SUBROUTINE integrd_switch_caldyn(dist)
    30   USE allocate_field
     30  USE allocate_field_mod
    3131  USE bands
    32   USE parallel
     32  USE parallel_lmdz
    3333  IMPLICIT NONE
    3434    TYPE(distrib),INTENT(IN) :: dist
  • LMDZ5/branches/testing/libf/dyn3dmem/laplacien_gam_loc.F

    r1669 r1864  
    1111c      divgra     est  un argument  de sortie pour le s-prog
    1212c
    13       USE parallel
     13      USE parallel_lmdz
    1414      IMPLICIT NONE
    1515c
  • LMDZ5/branches/testing/libf/dyn3dmem/laplacien_loc.F

    r1669 r1864  
    99c      divgra     est  un argument  de sortie pour le s-prog
    1010c
    11       USE parallel
     11      USE parallel_lmdz
    1212      USE mod_filtreg_p
    1313      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/laplacien_rot_loc.F

    r1669 r1864  
    1010c      rotout           est  un argument  de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      USE mod_filtreg_p
    1414      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/laplacien_rotgam_loc.F

    r1669 r1864  
    99c      divgra     est  un argument  de sortie pour le s-prog
    1010c
    11       USE parallel
     11      USE parallel_lmdz
    1212      IMPLICIT NONE
    1313c
  • LMDZ5/branches/testing/libf/dyn3dmem/leapfrog_loc.F

    r1795 r1864  
    1313
    1414       USE misc_mod
    15        USE parallel
     15       USE parallel_lmdz
    1616       USE times
    1717       USE mod_hallo
     
    2727       USE mod_filtreg_p
    2828       USE write_field_loc
    29        USE allocate_field
     29       USE allocate_field_mod
    3030       USE call_dissip_mod, ONLY : call_dissip
    3131       USE call_calfis_mod, ONLY : call_calfis
     
    307307#ifdef CPP_IOIPSL
    308308      if (ok_guide) then
    309 !$OMP MASTER
    310309        call guide_main(itau,ucov,vcov,teta,q,masse,ps)
    311 !$OMP END MASTER
    312310!$OMP BARRIER
    313311      endif
     
    451449      IF (ok_start_timer) THEN
    452450        CALL InitTime
    453 !        ok_start_timer=.FALSE.
    454         ok_start_timer=.TRUE.
     451        ok_start_timer=.FALSE.
    455452      ENDIF     
    456453c$OMP END MASTER     
     
    626623      True_itau=True_itau+1
    627624
    628 c$OMP MASTER     
    629       PRINT *,"---> itau=",itau,"  True_itau=",True_itau
    630 c$OMP END MASTER
    631 
    632625c$OMP MASTER
    633626      IF (prt_level>9) THEN
     
    10881081
    10891082      IF(iflag_phys.EQ.2) THEN ! "Newtonian" case
     1083c$OMP MASTER
     1084         if (FirstPhysic) then
     1085           ok_start_timer=.TRUE.
     1086           FirstPhysic=.false.
     1087         endif
     1088c$OMP END MASTER
     1089
     1090
    10901091c   Calcul academique de la physique = Rappel Newtonien + fritcion
    10911092c   --------------------------------------------------------------
     
    13901391c$OMP MASTER
    13911392            call allgather_timer_average
    1392 
     1393      call barrier
    13931394      if (mpi_rank==0) then
    13941395       
     
    14261427       
    14271428      endif 
    1428      
     1429      CALL barrier
    14291430      print *,'Taille du Buffer MPI (REAL*8)',MaxBufferSize
    14301431      print *,'Taille du Buffer MPI utilise (REAL*8)',MaxBufferSize_Used
  • LMDZ5/branches/testing/libf/dyn3dmem/leapfrog_mod.F90

    r1669 r1864  
    3939  SUBROUTINE leapfrog_allocate
    4040  USE bands
    41   USE allocate_field
    42   USE parallel
    43   USE dimensions
     41  USE allocate_field_mod
     42  USE parallel_lmdz
     43  USE dimensions_mod
    4444  USE infotrac
    4545  USE caldyn_mod,ONLY : caldyn_allocate
     
    9494 
    9595  SUBROUTINE leapfrog_switch_caldyn(dist)
    96   USE allocate_field
     96  USE allocate_field_mod
    9797  USE bands
    98   USE parallel
     98  USE parallel_lmdz
    9999  USE caldyn_mod,ONLY : caldyn_switch_caldyn
    100100  USE integrd_mod,ONLY : integrd_switch_caldyn
     
    143143 
    144144  SUBROUTINE leapfrog_switch_dissip(dist)
    145   USE allocate_field
     145  USE allocate_field_mod
    146146  USE bands
    147   USE parallel
     147  USE parallel_lmdz
    148148  USE call_dissip_mod,ONLY : call_dissip_switch_dissip
    149149  IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/massbar_loc.F

    r1669 r1864  
    1313c     
    1414c
    15       USE parallel
     15      USE parallel_lmdz
    1616      IMPLICIT NONE
    1717c
  • LMDZ5/branches/testing/libf/dyn3dmem/massbarxy_loc.F

    r1669 r1864  
    11      SUBROUTINE massbarxy_loc(  masse, massebxy )
    2       USE parallel
     2      USE parallel_lmdz
    33      implicit none
    44c **********************************************************************
  • LMDZ5/branches/testing/libf/dyn3dmem/massdair_loc.F

    r1669 r1864  
    11      SUBROUTINE massdair_loc( p, masse )
    2       USE parallel
     2      USE parallel_lmdz
    33c
    44c *********************************************************************
  • LMDZ5/branches/testing/libf/dyn3dmem/mod_const_mpi.F90

    r1707 r1864  
    2222    INCLUDE 'mpif.h'
    2323#endif
     24
    2425    INTEGER             :: ierr
    2526    INTEGER             :: comp_id
     
    5152 
    5253  SUBROUTINE Init_mpi
     54#ifdef CPP_XIOS
     55    USE wxios
     56#endif
    5357  IMPLICIT NONE
    5458#ifdef CPP_MPI
     
    7074      COMM_LMDZ=MPI_COMM_WORLD
    7175      MPI_REAL_LMDZ=MPI_REAL8
     76!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     77! Initialisation de XIOS
     78!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     79#ifdef CPP_XIOS
     80      CALL wxios_init("LMDZ", outcom=COMM_LMDZ)
     81#endif
    7282!$OMP END MASTER
     83#else
     84#ifdef CPP_XIOS
     85!$OMP MASTER
     86      CALL wxios_init("LMDZ")
     87!$OMP END MASTER
     88#endif
    7389#endif
    7490
  • LMDZ5/branches/testing/libf/dyn3dmem/mod_filtreg_p.F

    r1707 r1864  
    55      SUBROUTINE filtreg_p ( champ,jjb,jje, ibeg, iend, nlat, nbniv,
    66     &     ifiltre, iaire, griscal ,iter)
    7       USE Parallel, only : OMP_CHUNK
     7      USE parallel_lmdz, only : OMP_CHUNK
    88      USE mod_filtre_fft_loc
    99      USE timer_filtre
     
    216216     &                    champ_fft(1,j,1), iip1*(jje-jjb+1))
    217217#else
    218                      champ_fft(:,j,:)=
    219      &                    matmul(matrinvn(:,:,j),champ_loc(:iim,j,:))
     218                     champ_fft(:,j,1:nbniv_loc)=
     219     &                    matmul(matrinvn(:,:,j),
     220     &                    champ_loc(:iim,j,1:nbniv_loc))
    220221#endif
    221222                  ENDDO
     
    229230     &                    champ_fft(1,j,1), iip1*(jje-jjb+1))
    230231#else
    231                      champ_fft(:,j,:)=
    232      &                    matmul(matriceun(:,:,j),champ_loc(:iim,j,:))
     232                     champ_fft(:,j,1:nbniv_loc)=
     233     &                    matmul(matriceun(:,:,j),
     234     &                           champ_loc(:iim,j,1:nbniv_loc))
    233235#endif
    234236                  ENDDO
     
    242244     &                    champ_fft(1,j,1), iip1*(jje-jjb+1))
    243245#else
    244                      champ_fft(:,j,:)=
    245      &                    matmul(matricevn(:,:,j),champ_loc(:iim,j,:))
     246                     champ_fft(:,j,1:nbniv_loc)=
     247     &                    matmul(matricevn(:,:,j),           
     248     &                           champ_loc(:iim,j,1:nbniv_loc))
    246249#endif
    247250                  ENDDO
     
    259262     &                    champ_fft(1,j,1), iip1*(jje-jjb+1))
    260263#else
    261                      champ_fft(:,j,:)=
     264                     champ_fft(:,j,1:nbniv_loc)=
    262265     &                    matmul(matrinvs(:,:,j-jfiltsu+1),
    263      &                           champ_loc(:iim,j,:))
     266     &                           champ_loc(:iim,j,1:nbniv_loc))
    264267#endif
    265268                  ENDDO
     
    274277     &                    champ_fft(1,j,1), iip1*(jje-jjb+1))
    275278#else
    276                      champ_fft(:,j,:)=
     279                     champ_fft(:,j,1:nbniv_loc)=
    277280     &                    matmul(matriceus(:,:,j-jfiltsu+1),
    278      &                           champ_loc(:iim,j,:))
     281     &                           champ_loc(:iim,j,1:nbniv_loc))
    279282#endif
    280283                  ENDDO
     
    289292     &                    champ_fft(1,j,1), iip1*(jje-jjb+1))
    290293#else
    291                      champ_fft(:,j,:)=
     294                     champ_fft(:,j,1:nbniv_loc)=
    292295     &                    matmul(matricevs(:,:,j-jfiltsv+1),
    293      &                           champ_loc(:iim,j,:))
     296     &                           champ_loc(:iim,j,1:nbniv_loc))
    294297#endif
    295298                  ENDDO
     
    308311               ll_nb = 0
    309312c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
    310                DO l = 1, nbniv_loc
     313               DO l = 1, nbniv
    311314                  ll_nb = ll_nb + 1
    312315                  DO j = jdfil,jffil
     
    324327               ll_nb = 0
    325328c$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
    326                DO l = 1, nbniv_loc
     329               DO l = 1, nbniv
    327330                  ll_nb = ll_nb + 1
    328331                  DO j = jdfil,jffil
  • LMDZ5/branches/testing/libf/dyn3dmem/mod_hallo.F90

    r1669 r1864  
    11module mod_Hallo
    2 USE parallel
     2USE parallel_lmdz
    33implicit none
    44  logical,save :: use_mpi_alloc
    5   integer, parameter :: MaxRequest=200
    65  integer, parameter :: MaxProc=512
    7   integer, parameter :: MaxBufferSize=1024*1024*100
     6  integer, parameter :: DefaultMaxBufferSize=1024*1024*100
     7  integer, SAVE :: MaxBufferSize=0
    88  integer, parameter :: ListSize=1000
    99 
     
    2828  type request_SR
    2929    integer :: NbRequest=0
     30    integer :: NbRequestMax=0
    3031    integer :: BufferSize
    3132    integer :: Pos
    3233    integer :: Index
    33     type(Hallo),dimension(MaxRequest) :: Hallo
     34    type(Hallo), POINTER :: Hallo(:)
    3435    integer :: MSG_Request
    3536  end type request_SR
     
    6364
    6465  subroutine Init_mod_hallo
    65   USE dimensions
     66  USE dimensions_mod
     67  USE IOIPSL
    6668    implicit none
    6769    integer :: jj_nb_gather(0:mpi_size-1)
     
    7072    Buffer_Pos(Index_Pos)=1
    7173    MaxBufferSize_Used=0
    72 
     74!$OMP MASTER     
     75    MaxBufferSize=DefaultMaxBufferSize
     76    CALL getin("mpi_buffer_size",MaxBufferSize)
     77!$OMP END MASTER
     78!$OMP BARRIER
     79   
    7380    IF (use_mpi_alloc .AND. using_mpi) THEN
    7481      CALL create_global_mpi_buffer
     
    7784    ENDIF
    7885     
     86!$OMP MASTER     
    7987     jj_nb_gather(:)=0
    8088     jj_nb_gather(0)=jjp1
    8189     
    8290     CALL create_distrib(jj_nb_gather,distrib_gather)
     91!$OMP END MASTER
     92!$OMP BARRIER
    8393
    8494  end subroutine init_mod_hallo
     
    176186 
    177187 
    178   subroutine Init_Hallo(Field,Stride,NbLevel,offset,size,NewHallo)
     188  subroutine New_Hallo(Field,Stride,NbLevel,offset,size,Ptr_request)
    179189    integer :: Stride
    180190    integer :: NbLevel
     
    182192    integer :: offset
    183193    real, dimension(Stride,NbLevel),target :: Field
    184     type(Hallo) :: NewHallo
    185    
     194    type(request_SR),pointer :: Ptr_request
     195    type(Hallo),POINTER :: NewHallos(:),HalloSwitch(:), NewHallo
     196   
     197    Ptr_Request%NbRequest=Ptr_Request%NbRequest+1
     198    IF(Ptr_Request%NbRequestMax==0) THEN
     199       Ptr_Request%NbRequestMax=10
     200       ALLOCATE(Ptr_Request%Hallo(Ptr_Request%NbRequestMax))
     201    ELSE IF ( Ptr_Request%NbRequest > Ptr_Request%NbRequestMax) THEN
     202      Ptr_Request%NbRequestMax=INT(Ptr_Request%NbRequestMax*1.2)
     203      ALLOCATE(NewHallos(Ptr_Request%NbRequestMax))
     204      NewHallos(1:Ptr_Request%NbRequest-1)=Ptr_Request%hallo(1:Ptr_Request%NbRequest-1)
     205      HalloSwitch=>Ptr_Request%hallo
     206      Ptr_Request%hallo=>NewHallos
     207      DEALLOCATE(HalloSwitch)
     208    ENDIF
     209   
     210    NewHallo=>Ptr_Request%hallo(Ptr_Request%NbRequest)
     211         
    186212    NewHallo%Field=>Field
    187213    NewHallo%Stride=Stride
     
    190216    NewHallo%offset=offset
    191217   
    192    
    193   end subroutine Init_Hallo
     218  end subroutine New_Hallo
    194219 
    195220  subroutine Register_SendField(Field,ij,ll,offset,size,target,a_request)
    196   USE dimensions
     221  USE dimensions_mod
    197222  implicit none
    198223
     
    204229
    205230      Ptr_Request=>a_request%RequestSend(target)
    206       Ptr_Request%NbRequest=Ptr_Request%NbRequest+1
    207       if (Ptr_Request%NbRequest>=MaxRequest) then
    208         print *,'STOP :: La taille de MaxRequest dans mod_hallo.F90 est trop petite !!!!'
    209         stop
    210       endif     
    211       call Init_Hallo(Field,ij,ll,offset,size,Ptr_request%Hallo(Ptr_Request%NbRequest))
     231
     232      call New_Hallo(Field,ij,ll,offset,size,Ptr_request)
    212233     
    213234   end subroutine Register_SendField     
    214235     
    215236  subroutine Register_RecvField(Field,ij,ll,offset,size,target,a_request)
    216   USE dimensions
     237  USE dimensions_mod
    217238  implicit none
    218239
     
    224245
    225246      Ptr_Request=>a_request%RequestRecv(target)
    226       Ptr_Request%NbRequest=Ptr_Request%NbRequest+1
    227      
    228       if (Ptr_Request%NbRequest>=MaxRequest) then
    229         print *,'STOP :: La taille de MaxRequest dans mod_hallo.F90 est trop petite !!!!'
    230         stop
    231       endif   
    232247           
    233       call Init_Hallo(Field,ij,ll,offset,size,Ptr_request%Hallo(Ptr_Request%NbRequest))
     248      call New_Hallo(Field,ij,ll,offset,size,Ptr_request)
    234249
    235250     
     
    237252 
    238253  subroutine Register_SwapField(FieldS,FieldR,ij,ll,jj_Nb_New,a_request)
    239   USE dimensions
     254  USE dimensions_mod
    240255      implicit none
    241256
     
    285300 
    286301  subroutine Register_SwapFieldHallo(FieldS,FieldR,ij,ll,jj_Nb_New,Up,Down,a_request)
    287   USE dimensions
     302  USE dimensions_mod
    288303 
    289304      implicit none
     
    338353
    339354  SUBROUTINE Register_SwapField1d_u(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    340   USE parallel
    341   USE dimensions
     355  USE parallel_lmdz
     356  USE dimensions_mod
    342357      IMPLICIT NONE
    343358   
     
    369384
    370385  SUBROUTINE Register_SwapField2d_u1d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    371   USE parallel
    372   USE dimensions
     386  USE parallel_lmdz
     387  USE dimensions_mod
    373388    IMPLICIT NONE
    374389   
     
    403418
    404419  SUBROUTINE Register_SwapField3d_u(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    405   USE parallel
    406   USE dimensions
     420  USE parallel_lmdz
     421  USE dimensions_mod
    407422      IMPLICIT NONE
    408423   
     
    438453
    439454 SUBROUTINE Register_SwapField1d_u2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    440   USE parallel
    441   USE dimensions
     455  USE parallel_lmdz
     456  USE dimensions_mod
    442457
    443458      IMPLICIT NONE
     
    470485
    471486  SUBROUTINE Register_SwapField2d_u2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    472   USE parallel
    473   USE dimensions
     487  USE parallel_lmdz
     488  USE dimensions_mod
    474489
    475490      IMPLICIT NONE
     
    505520
    506521  SUBROUTINE Register_SwapField3d_u2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    507   USE parallel
    508   USE dimensions
     522  USE parallel_lmdz
     523  USE dimensions_mod
    509524      IMPLICIT NONE
    510525   
     
    544559
    545560  SUBROUTINE Register_SwapField1d_v(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    546   USE parallel
    547   USE dimensions
     561  USE parallel_lmdz
     562  USE dimensions_mod
    548563      IMPLICIT NONE
    549564   
     
    575590
    576591  SUBROUTINE Register_SwapField2d_v1d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    577   USE parallel
    578   USE dimensions
     592  USE parallel_lmdz
     593  USE dimensions_mod
    579594      IMPLICIT NONE
    580595   
     
    609624
    610625  SUBROUTINE Register_SwapField3d_v(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    611   USE parallel
    612   USE dimensions
     626  USE parallel_lmdz
     627  USE dimensions_mod
    613628      IMPLICIT NONE
    614629   
     
    645660
    646661  SUBROUTINE Register_SwapField1d_v2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    647   USE parallel
    648   USE dimensions
     662  USE parallel_lmdz
     663  USE dimensions_mod
    649664      IMPLICIT NONE
    650665   
     
    676691
    677692  SUBROUTINE Register_SwapField2d_v2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    678   USE parallel
    679   USE dimensions
     693  USE parallel_lmdz
     694  USE dimensions_mod
    680695      IMPLICIT NONE
    681696   
     
    710725
    711726  SUBROUTINE Register_SwapField3d_v2d(FieldS,FieldR,new_dist,a_request,old_dist,up,down)
    712   USE parallel
    713   USE dimensions
     727  USE parallel_lmdz
     728  USE dimensions_mod
    714729      IMPLICIT NONE
    715730   
     
    745760
    746761  SUBROUTINE Register_SwapField_gen_u(FieldS,FieldR,ll,old_dist,new_dist,Up,Down,a_request)
    747   USE parallel
    748   USE dimensions
     762  USE parallel_lmdz
     763  USE dimensions_mod
    749764      IMPLICIT NONE
    750765   
     
    787802!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)           
    788803        DO l=1,ll
    789           FieldR(ijb:ije,:)=FieldS(ijb:ije,:)             
     804          FieldR(ijb:ije,l)=FieldS(ijb:ije,l)             
    790805        ENDDO
    791806!$OMP END DO NOWAIT
     
    798813
    799814  SUBROUTINE Register_SwapField_gen_v(FieldS,FieldR,ll,old_dist,new_dist,Up,Down,a_request)
    800   USE parallel
    801   USE dimensions
     815  USE parallel_lmdz
     816  USE dimensions_mod
    802817    IMPLICIT NONE
    803818   
     
    858873 
    859874  subroutine Register_Hallo(Field,ij,ll,RUp,Rdown,SUp,SDown,a_request)
    860   USE dimensions
     875  USE dimensions_mod
    861876      implicit none
    862877
     
    925940
    926941  subroutine Register_Hallo_u(Field,ll,RUp,Rdown,SUp,SDown,a_request)
    927   USE dimensions
     942  USE dimensions_mod
    928943      implicit none
    929944#ifdef CPP_MPI
     
    9901005
    9911006  subroutine Register_Hallo_v(Field,ll,RUp,Rdown,SUp,SDown,a_request)
    992   USE dimensions
     1007  USE dimensions_mod
    9931008      implicit none
    9941009#ifdef CPP_MPI
     
    10551070   
    10561071    subroutine SendRequest(a_Request)
    1057     USE dimensions
     1072    USE dimensions_mod
    10581073      implicit none
    10591074
     
    11791194   
    11801195   subroutine WaitRequest(a_Request)
    1181    USE dimensions
     1196   USE dimensions_mod
    11821197   implicit none
    11831198   
     
    12731288     
    12741289   subroutine WaitSendRequest(a_Request)
    1275    USE dimensions
     1290   USE dimensions_mod
    12761291   implicit none
    12771292   
     
    13291344   
    13301345   subroutine WaitRecvRequest(a_Request)
    1331    USE dimensions
     1346   USE dimensions_mod
    13321347   implicit none
    13331348   
     
    14101425   
    14111426    subroutine CopyField(FieldS,FieldR,ij,ll,jj_Nb_New)
    1412     USE dimensions
     1427    USE dimensions_mod
    14131428 
    14141429      implicit none
     
    14481463
    14491464  subroutine CopyFieldHallo(FieldS,FieldR,ij,ll,jj_Nb_New,Up,Down)
    1450   USE dimensions
     1465  USE dimensions_mod
    14511466 
    14521467      implicit none
     
    14881503
    14891504   subroutine Gather_field_u(field_loc,field_glo,ll)
    1490    USE dimensions
     1505   USE dimensions_mod
    14911506   implicit none
    14921507     integer :: ll
     
    15111526       
    15121527   subroutine Gather_field_v(field_loc,field_glo,ll)
    1513    USE dimensions
     1528   USE dimensions_mod
    15141529   implicit none
    15151530     integer :: ll
     
    15391554     
    15401555   subroutine Scatter_field_u(field_glo,field_loc,ll)
    1541    USE dimensions
     1556   USE dimensions_mod
    15421557   implicit none
    15431558     integer :: ll
     
    15731588
    15741589   subroutine Scatter_field_v(field_glo,field_loc,ll)
    1575    USE dimensions
     1590   USE dimensions_mod
    15761591   implicit none
    15771592     integer :: ll
  • LMDZ5/branches/testing/libf/dyn3dmem/nxgrad_gam_loc.F

    r1669 r1864  
    99c       x  et y    sont des arguments de sortie pour le s-prog
    1010c
    11       USE parallel
     11      USE parallel_lmdz
    1212     
    1313      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/nxgrad_loc.F

    r1669 r1864  
    99c       x  et y    sont des arguments de sortie pour le s-prog
    1010c
    11       USE parallel
     11      USE parallel_lmdz
    1212      IMPLICIT NONE
    1313c
  • LMDZ5/branches/testing/libf/dyn3dmem/nxgraro2_loc.F

    r1669 r1864  
    1313c
    1414      USE write_Field_p
    15       USE parallel
     15      USE parallel_lmdz
    1616      USE times
    1717      USE mod_hallo
     
    3434      REAL  signe, nugradrs
    3535      INTEGER l,ij,iter,lr
    36       Type(Request) :: Request_dissip
     36      Type(Request),SAVE :: Request_dissip
     37!$OMP THREADPRIVATE(Request_dissip)
    3738c    ........................................................
    3839c
  • LMDZ5/branches/testing/libf/dyn3dmem/nxgraro2_mod.F90

    r1669 r1864  
    99  SUBROUTINE nxgraro2_allocate
    1010  USE bands
    11   USE allocate_field
    12   USE parallel
    13   USE dimensions
     11  USE allocate_field_mod
     12  USE parallel_lmdz
     13  USE dimensions_mod
    1414  IMPLICIT NONE
    1515    TYPE(distrib),POINTER :: d
     
    2424 
    2525  SUBROUTINE nxgraro2_switch_dissip(dist)
    26   USE allocate_field
     26  USE allocate_field_mod
    2727  USE bands
    28   USE parallel
     28  USE parallel_lmdz
    2929  IMPLICIT NONE
    3030    TYPE(distrib),INTENT(IN) :: dist
  • LMDZ5/branches/testing/libf/dyn3dmem/nxgrarot_p.F

    r1669 r1864  
    1313c
    1414c
    15       USE parallel
     15      USE parallel_lmdz
    1616      USE times
    1717      USE write_field_p
  • LMDZ5/branches/testing/libf/dyn3dmem/pression_loc.F

    r1669 r1864  
    11      SUBROUTINE pression_loc( ngrid, ap, bp, ps, p )
    2       USE parallel
     2      USE parallel_lmdz
    33c
    44
  • LMDZ5/branches/testing/libf/dyn3dmem/qminimum_loc.F

    r1669 r1864  
    11      SUBROUTINE qminimum_loc( q,nq,deltap )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT none
    44c
  • LMDZ5/branches/testing/libf/dyn3dmem/rotat_nfil_loc.F

    r1669 r1864  
    1010c        rot          est  un argument  de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      IMPLICIT NONE
    1414c
  • LMDZ5/branches/testing/libf/dyn3dmem/rotat_p.F

    r1669 r1864  
    1010c        rot          est  un argument  de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      IMPLICIT NONE
    1414c
  • LMDZ5/branches/testing/libf/dyn3dmem/rotatf_loc.F

    r1669 r1864  
    1010c        rot          est  un argument  de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      USE mod_filtreg_p
    1414      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/sw_case_williamson91_6_loc.F

    r1795 r1864  
    2626c
    2727c=======================================================================
    28       USE parallel
     28      USE parallel_lmdz
    2929
    3030      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/times.F90

    r1669 r1864  
    2525 
    2626  subroutine init_timer
    27     use parallel
     27    USE parallel_lmdz
    2828    implicit none
    2929#include "dimensions.h"
     
    101101
    102102  subroutine stop_timer(no_timer)
    103     use parallel
     103    USE parallel_lmdz
    104104    implicit none
    105105    integer :: no_timer
     
    136136   
    137137  subroutine allgather_timer
    138     use parallel
     138    USE parallel_lmdz
    139139    implicit none
    140140#ifdef CPP_MPI   
     
    171171 
    172172  subroutine allgather_timer_average
    173     use parallel
     173    USE parallel_lmdz
    174174    implicit none
    175175#ifdef CPP_MPI
  • LMDZ5/branches/testing/libf/dyn3dmem/top_bound_loc.F

    r1795 r1864  
    33!
    44      SUBROUTINE top_bound_loc(vcov,ucov,teta,masse,dt)
    5       USE parallel
     5      USE parallel_lmdz
    66      IMPLICIT NONE
    77c
  • LMDZ5/branches/testing/libf/dyn3dmem/tourpot_loc.F

    r1669 r1864  
    11      SUBROUTINE tourpot_loc ( vcov, ucov, massebxy, vorpot )
    2       USE parallel
     2      USE parallel_lmdz
    33      USE mod_filtreg_p
    44      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/vitvert_loc.F

    r1669 r1864  
    11      SUBROUTINE vitvert_loc ( convm , w )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      IMPLICIT NONE
    55
  • LMDZ5/branches/testing/libf/dyn3dmem/vlsplt_loc.F

    r1707 r1864  
    1313c
    1414c   --------------------------------------------------------------------
    15       USE Parallel
     15      USE parallel_lmdz
    1616      IMPLICIT NONE
    1717c
     
    348348c
    349349c   --------------------------------------------------------------------
    350       USE parallel
     350      USE parallel_lmdz
    351351      IMPLICIT NONE
    352352c
     
    737737c
    738738c   --------------------------------------------------------------------
    739       USE Parallel
     739      USE parallel_lmdz
    740740      USE vlz_mod
    741741      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/vlspltgen_loc.F

    r1669 r1864  
    2323c     pk exner au milieu des couches necessaire pour calculer Qsat
    2424c   --------------------------------------------------------------------
    25       USE parallel
     25      USE parallel_lmdz
    2626      USE mod_hallo
    2727      USE Write_Field_loc
     
    6767      LOGICAL, SAVE :: firstcall=.TRUE.
    6868!$OMP THREADPRIVATE(firstcall)
    69       type(request) :: MyRequest1
    70       type(request) :: MyRequest2
    71 
     69      type(request),SAVE :: MyRequest1
     70!$OMP THREADPRIVATE(MyRequest1)
     71      type(request),SAVE :: MyRequest2
     72!$OMP THREADPRIVATE(MyRequest2)
    7273c    fonction psat(T)
    7374
  • LMDZ5/branches/testing/libf/dyn3dmem/vlspltgen_mod.F90

    r1669 r1864  
    1212  SUBROUTINE vlspltgen_allocate
    1313  USE bands
    14   USE allocate_field
    15   USE parallel
     14  USE allocate_field_mod
     15  USE parallel_lmdz
    1616  USE infotrac
    1717  USE vlz_mod,ONLY : vlz_allocate
     
    3434 
    3535  SUBROUTINE vlspltgen_switch_vanleer(dist)
    36   USE allocate_field
     36  USE allocate_field_mod
    3737  USE bands
    38   USE parallel
     38  USE parallel_lmdz
    3939  USE vlz_mod,ONLY : vlz_switch_vanleer
    4040  IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dmem/vlspltqs_loc.F

    r1707 r1864  
    88c
    99c   --------------------------------------------------------------------
    10       USE parallel
     10      USE parallel_lmdz
    1111      IMPLICIT NONE
    1212c
     
    360360c
    361361c   --------------------------------------------------------------------
    362       USE parallel
     362      USE parallel_lmdz
    363363      IMPLICIT NONE
    364364c
  • LMDZ5/branches/testing/libf/dyn3dmem/vlz_mod.F90

    r1669 r1864  
    1010  SUBROUTINE vlz_allocate
    1111  USE bands
    12   USE allocate_field
    13   USE parallel
     12  USE allocate_field_mod
     13  USE parallel_lmdz
    1414  USE infotrac
    15   USE dimensions
     15  USE dimensions_mod
    1616  IMPLICIT NONE
    1717  TYPE(distrib),POINTER :: d
     
    2626 
    2727  SUBROUTINE vlz_switch_vanleer(dist)
    28   USE allocate_field
     28  USE allocate_field_mod
    2929  USE bands
    30   USE parallel
     30  USE parallel_lmdz
    3131  IMPLICIT NONE
    3232    TYPE(distrib),INTENT(IN) :: dist
  • LMDZ5/branches/testing/libf/dyn3dmem/write_field_loc.F90

    r1669 r1864  
    3434
    3535   SUBROUTINE write_field_u_gen(name,Field,ll)
    36     USE parallel
     36    USE parallel_lmdz
    3737    USE write_field
    3838    USE mod_hallo
     
    4545    real, allocatable,SAVE :: New_Field(:,:,:)
    4646    integer,dimension(0:mpi_size-1) :: jj_nb_master
    47     type(Request) :: Request_write
     47    type(Request),SAVE :: Request_write
     48!$OMP THREADPRIVATE(Request_write)
    4849    integer :: ll,i
    4950   
     
    6162      New_Field(:,jj_begin:jj_end,i)=reshape(Field(ij_begin:ij_end,i),(/iip1,jj_nb/))
    6263    ENDDO
    63    
     64!$OMP BARRIER   
    6465    call Register_SwapField(new_field,new_field,ip1jmp1,ll,jj_Nb_master,Request_write)
    6566    call SendRequest(Request_write)
     
    9899
    99100   SUBROUTINE write_field_v_gen(name,Field,ll)
    100     USE parallel
     101    USE parallel_lmdz
    101102    USE write_field
    102103    USE mod_hallo
     
    109110    real, allocatable,SAVE :: New_Field(:,:,:)
    110111    integer,dimension(0:mpi_size-1) :: jj_nb_master
    111     type(Request) :: Request_write
     112    type(Request),SAVE :: Request_write
     113!$OMP THREADPRIVATE(Request_write)   
    112114    integer :: ll,i,jje,ije,jjn
    113115   
     
    136138      New_Field(:,jj_begin:jje,i)=reshape(Field(ij_begin:ije,i),(/iip1,jjn/))
    137139    ENDDO
    138    
     140!$OMP BARRIER   
    139141    call Register_SwapField(new_field,new_field,ip1jm,ll,jj_Nb_master,Request_write)
    140142    call SendRequest(Request_write)
  • LMDZ5/branches/testing/libf/dyn3dmem/write_field_p.F90

    r1669 r1864  
    99 
    1010  subroutine write_field1D_p(name,Field)
    11     USE parallel
     11    USE parallel_lmdz
    1212    USE write_field
    1313    implicit none
     
    3030
    3131  subroutine write_field2D_p(name,Field)
    32     USE parallel
     32    USE parallel_lmdz
    3333    USE write_field
    3434    implicit none
     
    5151 
    5252  subroutine write_field3D_p(name,Field)
    53     USE parallel
     53    USE parallel_lmdz
    5454    USE write_field
    5555    implicit none
  • LMDZ5/branches/testing/libf/dyn3dmem/writedynav_loc.F

    r1669 r1864  
    99      USE ioipsl
    1010#endif
    11       USE parallel
     11      USE parallel_lmdz
    1212      USE misc_mod
    1313      USE infotrac, ONLY : nqtot, ttext
  • LMDZ5/branches/testing/libf/dyn3dmem/writehist_loc.F

    r1669 r1864  
    99      USE ioipsl
    1010#endif
    11       USE parallel
     11      USE parallel_lmdz
    1212      USE misc_mod
    1313      USE infotrac, ONLY : nqtot, ttext
  • LMDZ5/branches/testing/libf/dyn3dpar/abort_gcm.F

    r1795 r1864  
    1212      USE ioipsl_getincom
    1313#endif
    14       USE parallel
     14      USE parallel_lmdz
     15
     16
     17
     18
    1519#include "iniprint.h"
    1620 
     
    3741c$OMP END MASTER
    3842#endif
     43
     44
     45
    3946c     call histclo(2)
    4047c     call histclo(3)
  • LMDZ5/branches/testing/libf/dyn3dpar/addfi_p.F

    r1454 r1864  
    55     S          pucov, pvcov, pteta, pq   , pps ,
    66     S          pdufi, pdvfi, pdhfi,pdqfi, pdpfi  )
    7       USE parallel
     7      USE parallel_lmdz
    88      USE infotrac, ONLY : nqtot
    99      USE control_mod, ONLY : planet_type
  • LMDZ5/branches/testing/libf/dyn3dpar/advect_new_p.F

    r774 r1864  
    44      SUBROUTINE advect_new_p(ucov,vcov,teta,w,massebx,masseby,
    55     &                        du,dv,dteta)
    6       USE parallel
     6      USE parallel_lmdz
    77      USE write_field_p
    88      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dpar/advect_p.F

    r774 r1864  
    33!
    44      SUBROUTINE advect_p(ucov,vcov,teta,w,massebx,masseby,du,dv,dteta)
    5       USE parallel
     5      USE parallel_lmdz
    66      USE write_field_p
    77      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dpar/advtrac_p.F90

    r1549 r1864  
    1010  !            M.A Filiberti (04/2002)
    1111  !
    12   USE parallel
     12  USE parallel_lmdz
    1313  USE Write_Field_p
    1414  USE Bands
     
    460460
    461461        CALL qminimum_p( q, 2, finmasse )
     462     endif ! of if (planet_type=="earth")
    462463
    463464        !------------------------------------------------------------------
     
    466467        !          iadvtr=0
    467468
    468         !$OMP MASTER
    469         call VTe(VTadvection)
    470         call stop_timer(timer_vanleer)
    471         call VTb(VThallo)
    472         !$OMP END MASTER
    473 
    474         do j=1,nqtot
    475            call Register_SwapFieldHallo(q(1,1,j),q(1,1,j),ip1jmp1,llm, &
    476                 jj_nb_caldyn,0,0,Request_vanleer)
    477         enddo
    478 
    479         call Register_SwapFieldHallo(flxw,flxw,ip1jmp1,llm, &
     469      !$OMP MASTER
     470      call VTe(VTadvection)
     471      call stop_timer(timer_vanleer)
     472      call VTb(VThallo)
     473     !$OMP END MASTER
     474
     475      do j=1,nqtot
     476        call Register_SwapFieldHallo(q(1,1,j),q(1,1,j),ip1jmp1,llm, &
    480477             jj_nb_caldyn,0,0,Request_vanleer)
    481 
    482         call SendRequest(Request_vanleer)
    483         !$OMP BARRIER
    484         call WaitRequest(Request_vanleer)     
    485 
    486         !$OMP BARRIER
    487         !$OMP MASTER
    488         call SetDistrib(jj_nb_caldyn)
    489         call VTe(VThallo)
    490         call resume_timer(timer_caldyn)
     478      enddo
     479
     480      call Register_SwapFieldHallo(flxw,flxw,ip1jmp1,llm, &
     481             jj_nb_caldyn,0,0,Request_vanleer)
     482
     483      call SendRequest(Request_vanleer)
     484      !$OMP BARRIER
     485      call WaitRequest(Request_vanleer)     
     486
     487 !$OMP BARRIER
     488 !$OMP MASTER
     489      call SetDistrib(jj_nb_caldyn)
     490      call VTe(VThallo)
     491      call resume_timer(timer_caldyn)
    491492 !$OMP END MASTER
    492493 !$OMP BARRIER 
    493494        iadvtr=0
    494      endif ! of if (planet_type=="earth")
    495495  ENDIF ! if iadvtr.EQ.iapp_tracvl
    496496
  • LMDZ5/branches/testing/libf/dyn3dpar/bands.F90

    r1665 r1864  
    1919 
    2020  subroutine AllocateBands
    21     use parallel
     21    USE parallel_lmdz
    2222    implicit none
    2323   
     
    3333 
    3434  subroutine Read_distrib
    35     use parallel
     35    USE parallel_lmdz
    3636    implicit none
    3737
     
    9292   
    9393   SUBROUTINE  Set_Bands
    94      USE parallel
     94     USE parallel_lmdz
    9595#ifdef CPP_PHYS
    9696! Ehouarn: what follows is only related to // physics
     
    134134    subroutine AdjustBands_caldyn
    135135      use times
    136       use parallel
     136      USE parallel_lmdz
    137137      implicit none
    138138
     
    199199    subroutine AdjustBands_vanleer
    200200      use times
    201       use parallel
     201      USE parallel_lmdz
    202202      implicit none
    203203
     
    265265    subroutine AdjustBands_dissip
    266266      use times
    267       use parallel
     267      USE parallel_lmdz
    268268      implicit none
    269269
     
    335335      USE mod_phys_lmdz_para, only : klon_mpi_para_nb
    336336#endif
    337       USE parallel
     337      USE parallel_lmdz
    338338      implicit none
    339339
     
    385385
    386386    subroutine WriteBands
    387     USE parallel
     387    USE parallel_lmdz
    388388    implicit none
    389389    include "dimensions.h"
  • LMDZ5/branches/testing/libf/dyn3dpar/bernoui_p.F

    r764 r1864  
    11      SUBROUTINE bernoui_p (ngrid,nlay,pphi,pecin,pbern)
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44
  • LMDZ5/branches/testing/libf/dyn3dpar/bilan_dyn_p.F

    r1550 r1864  
    1313      USE IOIPSL
    1414#endif
    15       USE parallel
     15      USE parallel_lmdz
    1616      USE mod_hallo
    1717      use misc_mod
  • LMDZ5/branches/testing/libf/dyn3dpar/caladvtrac_p.F

    r1454 r1864  
    77     *                   p ,masse, dq ,  teta,
    88     *                   flxw, pk, iapptrac)
    9       USE parallel
     9      USE parallel_lmdz
    1010      USE infotrac, ONLY : nqtot
    1111      USE control_mod, ONLY : iapp_tracvl,planet_type
  • LMDZ5/branches/testing/libf/dyn3dpar/caldyn_p.F

    r764 r1864  
    1010     $ (itau,ucov,vcov,teta,ps,masse,pk,pkf,phis ,
    1111     $  phi,conser,du,dv,dteta,dp,w,pbaru,pbarv,time )
    12       USE parallel
     12      USE parallel_lmdz
    1313      USE Write_Field_p
    1414     
  • LMDZ5/branches/testing/libf/dyn3dpar/calfis_p.F

    r1707 r1864  
    3434      USE IOPHY
    3535#endif
    36       USE parallel, ONLY : omp_chunk, using_mpi
     36      USE parallel_lmdz, ONLY : omp_chunk, using_mpi
    3737      USE Write_Field
    3838      Use Write_field_p
  • LMDZ5/branches/testing/libf/dyn3dpar/ce0l.F90

    r1795 r1864  
    2222  USE mod_const_mpi
    2323  USE infotrac
    24   USE parallel, ONLY: finalize_parallel
     24  USE parallel_lmdz, ONLY: finalize_parallel
    2525  USE indice_sol_mod
    2626
  • LMDZ5/branches/testing/libf/dyn3dpar/conf_gcm.F

    r1795 r1864  
    1616      use mod_filtre_fft, ONLY : use_filtre_fft
    1717      use mod_hallo, ONLY : use_mpi_alloc
    18       use parallel, ONLY : omp_chunk
    1918      USE infotrac, ONLY : type_trac
    2019      use assert_m, only: assert
     
    906905      use_mpi_alloc=.FALSE.
    907906      CALL getin('use_mpi_alloc',use_mpi_alloc)
    908 
    909 !Config  Key  = omp_chunk
    910 !Config  Desc = taille des blocs openmp
    911 !Config  Def  = 1
    912 !Config  Help = defini la taille des packets d'it�ration openmp
    913 !Config         distribu�e � chaque t�che lors de l'entr�e dans une
    914 !Config         boucle parall�lis�e
    915  
    916       omp_chunk=1
    917       CALL getin('omp_chunk',omp_chunk)
    918907
    919908!Config key = ok_strato
     
    1004993      write(lunout,*)' use_filtre_fft = ', use_filtre_fft
    1005994      write(lunout,*)' use_mpi_alloc = ', use_mpi_alloc
    1006       write(lunout,*)' omp_chunk = ', omp_chunk
    1007995      write(lunout,*)' ok_strato = ', ok_strato
    1008996      write(lunout,*)' ok_gradsfile = ', ok_gradsfile
  • LMDZ5/branches/testing/libf/dyn3dpar/convflu_p.F

    r764 r1864  
    1515c     nbniv   est le nombre de niveaux vert. de  xflu et de yflu .
    1616c
    17       USE parallel
     17      USE parallel_lmdz
    1818      IMPLICIT NONE
    1919c
  • LMDZ5/branches/testing/libf/dyn3dpar/convmas1_p.F

    r763 r1864  
    11      SUBROUTINE convmas1_p (pbaru, pbarv, convm )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      IMPLICIT NONE
    55
  • LMDZ5/branches/testing/libf/dyn3dpar/convmas2_p.F

    r763 r1864  
    11      SUBROUTINE convmas2_p ( convm )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      IMPLICIT NONE
    55
  • LMDZ5/branches/testing/libf/dyn3dpar/convmas_p.F

    r764 r1864  
    11      SUBROUTINE convmas_p (pbaru, pbarv, convm )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      IMPLICIT NONE
    55
  • LMDZ5/branches/testing/libf/dyn3dpar/covcont_p.F

    r764 r1864  
    11      SUBROUTINE covcont_p (klevel,ucov, vcov, ucont, vcont )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44
  • LMDZ5/branches/testing/libf/dyn3dpar/covnat_p.F

    r1146 r1864  
    33!
    44      SUBROUTINE covnat_p(klevel,ucov, vcov, unat, vnat )
    5       USE parallel
     5      USE parallel_lmdz
    66      IMPLICIT NONE
    77
  • LMDZ5/branches/testing/libf/dyn3dpar/dissip_p.F

    r985 r1864  
    11      SUBROUTINE dissip_p( vcov,ucov,teta,p, dv,du,dh )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      USE write_field_p
    55      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dpar/diverg_gam_p.F

    r764 r1864  
    99c              x et y  etant des composantes covariantes   ...
    1010c  *********************************************************************
    11       USE parallel
     11      USE parallel_lmdz
    1212      IMPLICIT NONE
    1313c
  • LMDZ5/branches/testing/libf/dyn3dpar/diverg_p.F

    r764 r1864  
    88c              x et y  etant des composantes covariantes   ...
    99c  *********************************************************************
    10       USE parallel
     10      USE parallel_lmdz
    1111      IMPLICIT NONE
    1212c
  • LMDZ5/branches/testing/libf/dyn3dpar/divergf_p.F

    r764 r1864  
    88c              x et y  etant des composantes covariantes   ...
    99c  *********************************************************************
    10       USE PARALLEL
     10      USE parallel_lmdz
    1111      IMPLICIT NONE
    1212c
  • LMDZ5/branches/testing/libf/dyn3dpar/divgrad2_p.F

    r985 r1864  
    1010c         divgra     est  un argument  de sortie pour le s-prg
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      USE times
    1414      USE mod_hallo
  • LMDZ5/branches/testing/libf/dyn3dpar/divgrad_p.F

    r764 r1864  
    11      SUBROUTINE divgrad_p (klevel,h, lh, divgra_out )
    2       USE parallel
     2      USE parallel_lmdz
    33      USE times
    44      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dpar/dteta1_p.F

    r764 r1864  
    11      SUBROUTINE dteta1_p ( teta, pbaru, pbarv, dteta)
    2       USE parallel
     2      USE parallel_lmdz
    33      USE write_field_p
    44      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dpar/dudv1_p.F

    r764 r1864  
    11      SUBROUTINE dudv1_p ( vorpot, pbaru, pbarv, du, dv )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44c
  • LMDZ5/branches/testing/libf/dyn3dpar/dudv2_p.F

    r764 r1864  
    11      SUBROUTINE dudv2_p ( teta, pkf, bern, du, dv  )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44c
  • LMDZ5/branches/testing/libf/dyn3dpar/dynredem_p.F

    r1669 r1864  
    77      USE IOIPSL
    88#endif
    9       USE parallel
     9      USE parallel_lmdz
    1010      USE infotrac
    1111      use netcdf95, only: NF95_PUT_VAR
     
    467467      SUBROUTINE dynredem1_p(fichnom,time,
    468468     .                     vcov,ucov,teta,q,masse,ps)
    469       USE parallel
     469      USE parallel_lmdz
    470470      USE infotrac
    471471      USE control_mod
  • LMDZ5/branches/testing/libf/dyn3dpar/enercin_p.F

    r764 r1864  
    11      SUBROUTINE enercin_p ( vcov, ucov, vcont, ucont, ecin )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44
  • LMDZ5/branches/testing/libf/dyn3dpar/exner_hyb_p.F

    r1665 r1864  
    2929c
    3030c
    31       USE parallel
     31      USE parallel_lmdz
    3232      IMPLICIT NONE
    3333c
  • LMDZ5/branches/testing/libf/dyn3dpar/exner_milieu_p.F

    r1665 r1864  
    2626c    ( voir note de Fr.Hourdin )  ,
    2727c
    28       USE parallel
     28      USE parallel_lmdz
    2929      IMPLICIT NONE
    3030c
  • LMDZ5/branches/testing/libf/dyn3dpar/filtreg_p.F

    r1707 r1864  
    33      SUBROUTINE filtreg_p ( champ, ibeg, iend, nlat, nbniv,
    44     &     ifiltre, iaire, griscal ,iter)
    5       USE Parallel, only : OMP_CHUNK
     5      USE parallel_lmdz, only : OMP_CHUNK
    66      USE mod_filtre_fft
    77      USE timer_filtre
  • LMDZ5/branches/testing/libf/dyn3dpar/flumass_p.F

    r764 r1864  
    11      SUBROUTINE flumass_p(massebx,masseby, vcont, ucont, pbaru, pbarv)
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44
  • LMDZ5/branches/testing/libf/dyn3dpar/fluxstokenc_p.F

    r1454 r1864  
    88
    99       USE IOIPSL
    10        USE parallel
     10       USE parallel_lmdz
    1111       USE misc_mod
    1212       USE mod_hallo
  • LMDZ5/branches/testing/libf/dyn3dpar/friction_p.F

    r1492 r1864  
    44c=======================================================================
    55      SUBROUTINE friction_p(ucov,vcov,pdt)
    6       USE parallel
     6      USE parallel_lmdz
    77      USE control_mod
    88#ifdef CPP_IOIPSL
  • LMDZ5/branches/testing/libf/dyn3dpar/gcm.F

    r1795 r1864  
    1010#endif
    1111
     12
    1213      USE mod_const_mpi, ONLY: init_const_mpi
    13       USE parallel
     14      USE parallel_lmdz
    1415      USE infotrac
    1516      USE mod_interface_dyn_phys
     
    186187c   Initialisation partie parallele
    187188c------------------------------------
     189
    188190      CALL init_const_mpi
    189 
    190191      call init_parallel
    191192      call ini_getparam("out.def")
     
    213214c$OMP END PARALLEL
    214215#endif
     216
     217!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     218! Initialisation de XIOS
     219!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     220
    215221
    216222c-----------------------------------------------------------------------
  • LMDZ5/branches/testing/libf/dyn3dpar/geopot_p.F

    r630 r1864  
    11      SUBROUTINE geopot_p ( ngrid, teta, pk, pks, phis, phi )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44     
  • LMDZ5/branches/testing/libf/dyn3dpar/getparam.F90

    r1279 r1864  
    1818CONTAINS
    1919  SUBROUTINE ini_getparam(fichier)
    20   USE parallel
     20  USE parallel_lmdz
    2121    !
    2222    IMPLICIT NONE
     
    2828
    2929  SUBROUTINE fin_getparam
    30   USE parallel
     30  USE parallel_lmdz
    3131    !
    3232    IMPLICIT NONE
     
    3737
    3838  SUBROUTINE getparamr(TARGET,def_val,ret_val,comment)
    39   USE parallel
     39  USE parallel_lmdz
    4040    !
    4141    IMPLICIT NONE
     
    6363
    6464  SUBROUTINE getparami(TARGET,def_val,ret_val,comment)
    65   USE parallel
     65  USE parallel_lmdz
    6666    !
    6767    IMPLICIT NONE
     
    9090
    9191  SUBROUTINE getparaml(TARGET,def_val,ret_val,comment)
    92   USE parallel
     92  USE parallel_lmdz
    9393    !
    9494    IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dpar/gr_dyn_fi_p.F

    r1665 r1864  
    77      USE mod_interface_dyn_phys
    88      USE dimphy
    9       USE PARALLEL
     9      USE parallel_lmdz
    1010      IMPLICIT NONE
    1111c=======================================================================
  • LMDZ5/branches/testing/libf/dyn3dpar/gr_fi_dyn_p.F

    r1665 r1864  
    77      USE mod_interface_dyn_phys
    88      USE dimphy
    9       use parallel
     9      USE parallel_lmdz
    1010      IMPLICIT NONE
    1111c=======================================================================
  • LMDZ5/branches/testing/libf/dyn3dpar/gr_u_scal_p.F

    r1000 r1864  
    2525c
    2626c=======================================================================
    27       USE parallel
     27      USE parallel_lmdz
    2828      IMPLICIT NONE
    2929c-----------------------------------------------------------------------
  • LMDZ5/branches/testing/libf/dyn3dpar/gr_v_scal_p.F

    r985 r1864  
    2525c
    2626c=======================================================================
    27       USE parallel
     27      USE parallel_lmdz
    2828      IMPLICIT NONE
    2929c-----------------------------------------------------------------------
  • LMDZ5/branches/testing/libf/dyn3dpar/grad_p.F

    r764 r1864  
    1010c       pgx  et  pgy    sont des arguments de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      IMPLICIT NONE
    1414c
  • LMDZ5/branches/testing/libf/dyn3dpar/gradiv2_p.F

    r985 r1864  
    1313c
    1414c
    15       USE parallel
     15      USE parallel_lmdz
    1616      USE times
    1717      USE Write_field_p
  • LMDZ5/branches/testing/libf/dyn3dpar/gradiv_p.F

    r764 r1864  
    1414c
    1515c     
    16       USE parallel
     16      USE parallel_lmdz
    1717      USE times
    1818      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dpar/groupe_p.F

    r1707 r1864  
    11      subroutine groupe_p(pext,pbaru,pbarv,pbarum,pbarvm,wm)
    2       USE parallel
     2      USE parallel_lmdz
    33      implicit none
    44
  • LMDZ5/branches/testing/libf/dyn3dpar/groupeun_p.F

    r1279 r1864  
    11      SUBROUTINE groupeun_p(jjmax,llmax,jjb,jje,q)
    2       USE parallel
     2      USE parallel_lmdz
    33      USE Write_Field_p
    44      IMPLICIT NONE
     
    135135      SUBROUTINE INIT_GROUPEUN_P(airen_tab, aires_tab)
    136136
    137       USE parallel
     137      USE parallel_lmdz
    138138      IMPLICIT NONE
    139139
  • LMDZ5/branches/testing/libf/dyn3dpar/guide_p_mod.F90

    r1750 r1864  
    292292!=======================================================================
    293293  SUBROUTINE guide_main(itau,ucov,vcov,teta,q,masse,ps)
    294     use parallel
     294    USE parallel_lmdz
    295295    USE control_mod
    296296   
     
    653653!=======================================================================
    654654  SUBROUTINE guide_interp(psi,teta)
    655   USE parallel
     655  USE parallel_lmdz
    656656  USE mod_hallo
    657657  USE Bands
     
    16361636!=======================================================================
    16371637  SUBROUTINE guide_out(varname,hsize,vsize,field,factt)
    1638     USE parallel
     1638    USE parallel_lmdz
    16391639    IMPLICIT NONE
    16401640
  • LMDZ5/branches/testing/libf/dyn3dpar/initdynav_p.F

    r1279 r1864  
    88       USE IOIPSL
    99#endif
    10        use parallel
     10       USE parallel_lmdz
    1111       use Write_field
    1212       use misc_mod
  • LMDZ5/branches/testing/libf/dyn3dpar/initfluxsto_p.F

    r1454 r1864  
    1010       USE IOIPSL
    1111#endif
    12        use parallel
     12       USE parallel_lmdz
    1313       use Write_field
    1414       use misc_mod
  • LMDZ5/branches/testing/libf/dyn3dpar/inithist_p.F

    r1279 r1864  
    99       USE IOIPSL
    1010#endif
    11        use parallel
     11       USE parallel_lmdz
    1212       use Write_field
    1313       use misc_mod
  • LMDZ5/branches/testing/libf/dyn3dpar/integrd_p.F

    r1665 r1864  
    55     $  (  nq,vcovm1,ucovm1,tetam1,psm1,massem1,
    66     $     dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps0,masse,phis) !,finvmaold)
    7       USE parallel
     7      USE parallel_lmdz
    88      USE control_mod, only : planet_type
    99      IMPLICIT NONE
  • LMDZ5/branches/testing/libf/dyn3dpar/laplacien_gam_p.F

    r764 r1864  
    1111c      divgra     est  un argument  de sortie pour le s-prog
    1212c
    13       USE parallel
     13      USE parallel_lmdz
    1414      IMPLICIT NONE
    1515c
  • LMDZ5/branches/testing/libf/dyn3dpar/laplacien_p.F

    r764 r1864  
    99c      divgra     est  un argument  de sortie pour le s-prog
    1010c
    11       USE parallel
     11      USE parallel_lmdz
    1212      IMPLICIT NONE
    1313c
  • LMDZ5/branches/testing/libf/dyn3dpar/laplacien_rot_p.F

    r764 r1864  
    1010c      rotout           est  un argument  de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      IMPLICIT NONE
    1414c
  • LMDZ5/branches/testing/libf/dyn3dpar/laplacien_rotgam_p.F

    r764 r1864  
    99c      divgra     est  un argument  de sortie pour le s-prog
    1010c
    11       USE parallel
     11      USE parallel_lmdz
    1212      IMPLICIT NONE
    1313c
  • LMDZ5/branches/testing/libf/dyn3dpar/leapfrog_p.F

    r1795 r1864  
    99
    1010       USE misc_mod
    11        USE parallel
     11       USE parallel_lmdz
    1212       USE times
    1313       USE mod_hallo
     
    994994!   Academic case : Simple friction and Newtonan relaxation
    995995!   -------------------------------------------------------
     996c$OMP MASTER
     997         if (FirstPhysic) then
     998           ok_start_timer=.TRUE.
     999           FirstPhysic=.false.
     1000         endif
     1001c$OMP END MASTER
     1002
    9961003       ijb=ij_begin
    9971004       ije=ij_end
  • LMDZ5/branches/testing/libf/dyn3dpar/massbar_p.F

    r764 r1864  
    1313c     
    1414c
    15       USE parallel
     15      USE parallel_lmdz
    1616      IMPLICIT NONE
    1717c
  • LMDZ5/branches/testing/libf/dyn3dpar/massbarxy_p.F

    r764 r1864  
    11      SUBROUTINE massbarxy_p(  masse, massebxy )
    2       USE parallel
     2      USE parallel_lmdz
    33      implicit none
    44c **********************************************************************
  • LMDZ5/branches/testing/libf/dyn3dpar/massdair_p.F

    r764 r1864  
    11      SUBROUTINE massdair_p( p, masse )
    2       USE parallel
     2      USE parallel_lmdz
    33c
    44c *********************************************************************
  • LMDZ5/branches/testing/libf/dyn3dpar/mod_const_mpi.F90

    r1707 r1864  
    5151 
    5252  SUBROUTINE Init_mpi
     53#ifdef CPP_XIOS
     54    USE wxios
     55#endif
    5356  IMPLICIT NONE
    5457#ifdef CPP_MPI
     
    7073      COMM_LMDZ=MPI_COMM_WORLD
    7174      MPI_REAL_LMDZ=MPI_REAL8
     75
     76    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     77    ! Initialisation de XIOS
     78    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     79#ifdef CPP_XIOS
     80      CALL wxios_init("LMDZ", outcom=COMM_LMDZ)
     81#endif
     82!$OMP END MASTER
     83#else
     84#ifdef CPP_XIOS
     85!$OMP MASTER
     86      CALL wxios_init("LMDZ")
    7287!$OMP END MASTER
    7388#endif
    74 
     89#endif
    7590   END SUBROUTINE Init_mpi
    7691   
  • LMDZ5/branches/testing/libf/dyn3dpar/mod_hallo.F90

    r1000 r1864  
    11module mod_Hallo
    2 USE parallel
     2USE parallel_lmdz
    33implicit none
    44  logical,save :: use_mpi_alloc
  • LMDZ5/branches/testing/libf/dyn3dpar/nxgrad_gam_p.F

    r764 r1864  
    99c       x  et y    sont des arguments de sortie pour le s-prog
    1010c
    11       USE parallel
     11      USE parallel_lmdz
    1212      IMPLICIT NONE
    1313c
  • LMDZ5/branches/testing/libf/dyn3dpar/nxgrad_p.F

    r764 r1864  
    99c       x  et y    sont des arguments de sortie pour le s-prog
    1010c
    11       USE parallel
     11      USE parallel_lmdz
    1212      IMPLICIT NONE
    1313c
  • LMDZ5/branches/testing/libf/dyn3dpar/nxgraro2_p.F

    r985 r1864  
    1313c
    1414      USE write_Field_p
    15       USE parallel
     15      USE parallel_lmdz
    1616      USE times
    1717      USE mod_hallo
  • LMDZ5/branches/testing/libf/dyn3dpar/nxgrarot_p.F

    r764 r1864  
    1313c
    1414c
    15       USE parallel
     15      USE parallel_lmdz
    1616      USE times
    1717      USE write_field_p
  • LMDZ5/branches/testing/libf/dyn3dpar/pression_p.F

    r764 r1864  
    11      SUBROUTINE pression_p( ngrid, ap, bp, ps, p )
    2       USE parallel
     2      USE parallel_lmdz
    33c
    44
  • LMDZ5/branches/testing/libf/dyn3dpar/qminimum_p.F

    r1146 r1864  
    11      SUBROUTINE qminimum_p( q,nq,deltap )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT none
    44c
  • LMDZ5/branches/testing/libf/dyn3dpar/rotat_nfil_p.F

    r764 r1864  
    1010c        rot          est  un argument  de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      IMPLICIT NONE
    1414c
  • LMDZ5/branches/testing/libf/dyn3dpar/rotat_p.F

    r764 r1864  
    1010c        rot          est  un argument  de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      IMPLICIT NONE
    1414c
  • LMDZ5/branches/testing/libf/dyn3dpar/rotatf_p.F

    r764 r1864  
    1010c        rot          est  un argument  de sortie pour le s-prog
    1111c
    12       USE parallel
     12      USE parallel_lmdz
    1313      IMPLICIT NONE
    1414c
  • LMDZ5/branches/testing/libf/dyn3dpar/times.F90

    r1146 r1864  
    2525 
    2626  subroutine init_timer
    27     use parallel
     27    USE parallel_lmdz
    2828    implicit none
    2929#include "dimensions.h"
     
    101101
    102102  subroutine stop_timer(no_timer)
    103     use parallel
     103    USE parallel_lmdz
    104104    implicit none
    105105    integer :: no_timer
     
    136136   
    137137  subroutine allgather_timer
    138     use parallel
     138    USE parallel_lmdz
    139139    implicit none
    140140#ifdef CPP_MPI   
     
    171171 
    172172  subroutine allgather_timer_average
    173     use parallel
     173    USE parallel_lmdz
    174174    implicit none
    175175#ifdef CPP_MPI
  • LMDZ5/branches/testing/libf/dyn3dpar/top_bound_p.F

    r1795 r1864  
    33!
    44      SUBROUTINE top_bound_p(vcov,ucov,teta,masse,dt)
    5       USE parallel
     5      USE parallel_lmdz
    66      IMPLICIT NONE
    77c
  • LMDZ5/branches/testing/libf/dyn3dpar/tourpot_p.F

    r764 r1864  
    11      SUBROUTINE tourpot_p ( vcov, ucov, massebxy, vorpot )
    2       USE parallel
     2      USE parallel_lmdz
    33      IMPLICIT NONE
    44
  • LMDZ5/branches/testing/libf/dyn3dpar/vitvert_p.F

    r764 r1864  
    11      SUBROUTINE vitvert_p ( convm , w )
    22c
    3       USE parallel
     3      USE parallel_lmdz
    44      IMPLICIT NONE
    55
  • LMDZ5/branches/testing/libf/dyn3dpar/vlsplt_p.F

    r1520 r1864  
    1818c
    1919c   --------------------------------------------------------------------
    20       USE parallel
     20      USE parallel_lmdz
    2121      USE mod_hallo
    2222      USE Vampir
     
    203203c
    204204c   --------------------------------------------------------------------
    205       USE Parallel
     205      USE parallel_lmdz
    206206      IMPLICIT NONE
    207207c
     
    538538c
    539539c   --------------------------------------------------------------------
    540       USE parallel
     540      USE parallel_lmdz
    541541      IMPLICIT NONE
    542542c
     
    927927c
    928928c   --------------------------------------------------------------------
    929       USE Parallel
     929      USE parallel_lmdz
    930930      IMPLICIT NONE
    931931c
  • LMDZ5/branches/testing/libf/dyn3dpar/vlspltgen_p.F

    r1146 r1864  
    2222c     pk exner au milieu des couches necessaire pour calculer Qsat
    2323c   --------------------------------------------------------------------
    24       USE parallel
     24      USE parallel_lmdz
    2525      USE mod_hallo
    2626      USE Write_Field_p
  • LMDZ5/branches/testing/libf/dyn3dpar/vlspltqs_p.F

    r1520 r1864  
    2222c     pk exner au milieu des couches necessaire pour calculer Qsat
    2323c   --------------------------------------------------------------------
    24       USE parallel
     24      USE parallel_lmdz
    2525      USE mod_hallo
    2626      USE VAMPIR
     
    231231c
    232232c   --------------------------------------------------------------------
    233       USE parallel
     233      USE parallel_lmdz
    234234      IMPLICIT NONE
    235235c
     
    583583c
    584584c   --------------------------------------------------------------------
    585       USE parallel
     585      USE parallel_lmdz
    586586      IMPLICIT NONE
    587587c
  • LMDZ5/branches/testing/libf/dyn3dpar/write_field_p.F90

    r763 r1864  
    99 
    1010  subroutine write_field1D_p(name,Field)
    11     USE parallel
     11    USE parallel_lmdz
    1212    USE write_field
    1313    implicit none
     
    3030
    3131  subroutine write_field2D_p(name,Field)
    32     USE parallel
     32    USE parallel_lmdz
    3333    USE write_field
    3434    implicit none
     
    5151 
    5252  subroutine write_field3D_p(name,Field)
    53     USE parallel
     53    USE parallel_lmdz
    5454    USE write_field
    5555    implicit none
  • LMDZ5/branches/testing/libf/dyn3dpar/writedynav_p.F

    r1279 r1864  
    99      USE ioipsl
    1010#endif
    11       USE parallel
     11      USE parallel_lmdz
    1212      USE misc_mod
    1313      USE infotrac
  • LMDZ5/branches/testing/libf/dyn3dpar/writehist_p.F

    r1279 r1864  
    99      USE ioipsl
    1010#endif
    11       USE parallel
     11      USE parallel_lmdz
    1212      USE misc_mod
    1313      USE infotrac
  • LMDZ5/branches/testing/libf/filtrez/filtreg_mod.F90

    r1707 r1864  
    1010
    1111  SUBROUTINE inifilr
     12#ifdef CPP_PARA
    1213  USE mod_filtre_fft, ONLY : use_filtre_fft,Init_filtre_fft
    1314  USE mod_filtre_fft_loc, ONLY : Init_filtre_fft_loc=>Init_filtre_fft    !
     15#endif
    1416    !    ... H. Upadhyaya, O.Sharma   ...
    1517    !
     
    538540    ENDDO ! of DO j = jfiltsu, jjm
    539541
     542#ifdef CPP_PARA
    540543    IF (use_filtre_fft) THEN
    541544       CALL Init_filtre_fft(coefilu,modfrstu,jfiltnu,jfiltsu,  &
     
    544547                           coefilv,modfrstv,jfiltnv,jfiltsv)
    545548    ENDIF
    546 
     549#endif
    547550    !   ...................................................................
    548551
  • LMDZ5/branches/testing/libf/filtrez/mod_filtre_fft.F90

    r1403 r1864  
    118118    USE mod_fft
    119119#ifdef CPP_PARA
    120     USE parallel,ONLY : OMP_CHUNK
     120    USE parallel_lmdz,ONLY : OMP_CHUNK
    121121#endif
    122122    IMPLICIT NONE
     
    179179    USE mod_fft
    180180#ifdef CPP_PARA
    181     USE parallel,ONLY : OMP_CHUNK
     181    USE parallel_lmdz,ONLY : OMP_CHUNK
    182182#endif
    183183    IMPLICIT NONE
     
    241241    USE mod_fft
    242242#ifdef CPP_PARA
    243     USE parallel,ONLY : OMP_CHUNK
     243    USE parallel_lmdz,ONLY : OMP_CHUNK
    244244#endif
    245245    IMPLICIT NONE
  • LMDZ5/branches/testing/libf/filtrez/mod_filtre_fft_loc.F90

    r1707 r1864  
    107107    USE mod_fft
    108108#ifdef CPP_PARA
    109     USE parallel,ONLY : OMP_CHUNK
     109    USE parallel_lmdz,ONLY : OMP_CHUNK
    110110#endif
    111111    IMPLICIT NONE
     
    187187    USE mod_fft
    188188#ifdef CPP_PARA
    189     USE parallel,ONLY : OMP_CHUNK
     189    USE parallel_lmdz,ONLY : OMP_CHUNK
    190190#endif
    191191    IMPLICIT NONE
     
    250250    USE mod_fft
    251251#ifdef CPP_PARA
    252     USE parallel,ONLY : OMP_CHUNK
     252    USE parallel_lmdz,ONLY : OMP_CHUNK
    253253#endif
    254254    IMPLICIT NONE
  • LMDZ5/branches/testing/libf/phy1d/lmdz1d.F

    r1795 r1864  
    632632        zval=0.
    633633        zthe=0.
    634         ema_work1=0.
    635         ema_work2=0.
     634        sig1=0.
     635        w01=0.
     636        u_ancien(1,:)=u(:)
     637        v_ancien(1,:)=v(:)
    636638 
    637639!------------------------------------------------------------------------
     
    645647! agesno(:,nsrf),zmea,zstd,zsig,zgam,zthe,zpic,zval,rugoro
    646648! t_ancien,q_ancien,frugs(:,is_oce),clwcon(:,1),rnebcon(:,1),ratqs(:,1)
    647 ! run_off_lic_0,pbl_tke(:,1:klev,nsrf),zmax0,f0,ema_work1,ema_work2
     649! run_off_lic_0,pbl_tke(:,1:klev,nsrf),zmax0,f0,sig1,w01
    648650! wake_deltat,wake_deltaq,wake_s,wake_cstar,wake_fip
    649651!------------------------------------------------------------------------
  • LMDZ5/branches/testing/libf/phydev/physiq.F90

    r1795 r1864  
    1919      USE mod_phys_lmdz_para, only : jj_nb
    2020      USE phys_state_var_mod, only : phys_state_var_init
     21
     22#ifdef CPP_XIOS
     23      USE wxios
     24#endif
    2125
    2226      IMPLICIT none
     
    101105  dtime=pdtphys
    102106  call histbeg_phy("histins.nc",itau0,zjulian,dtime,nhori,nid_hist)
     107
     108
     109
    103110!$OMP MASTER
     111
     112
     113
    104114  ! define vertical coordinate
    105115  call histvert(nid_hist,"presnivs","Vertical levels","Pa",klev, &
     
    120130  ! end definition sequence
    121131  call histend(nid_hist)
     132
     133!XIOS
     134#ifdef CPP_XIOS
     135    ! Déclaration de l'axe vertical du fichier:   
     136    !CALL wxios_add_vaxis("presnivs", "histins", klev, presnivs)
     137
     138    !Déclaration du pas de temps:
     139    !CALL wxios_set_timestep(dtime)
     140
     141    !Finalisation du contexte:
     142    !CALL wxios_closedef()
     143#endif
    122144!$OMP END MASTER
    123145endif ! of if (debut)
     
    154176endif
    155177
     178!XIOS
     179#ifdef CPP_XIOS
     180!$OMP MASTER
     181    !On incrémente le pas de temps XIOS
     182    !CALL wxios_update_calendar(itau)
     183
     184    !Et on écrit, avec la routine histwrite dédiée:
     185    !CALL histwrite_phy("temperature",t)
     186    !CALL histwrite_phy("u",u)
     187    !CALL histwrite_phy("v",v)
     188    !CALL histwrite_phy("ps",paprs(:,1))
     189!$OMP END MASTER
     190#endif
     191
    156192! if lastcall, then it is time to write "restartphy.nc" file
    157193if (lafin) then
  • LMDZ5/branches/testing/libf/phylmd/clesphys.h

    r1795 r1864  
    6161       REAL pasphys
    6262       LOGICAL ok_histNMC(3)
     63       INTEGER levout_histNMC(3)
    6364       REAL freq_outNMC(3) , freq_calNMC(3)
    6465       CHARACTER(len=4) type_run
     
    7374       REAL freq_COSP
    7475       LOGICAL :: ok_cosp,ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP
    75        INTEGER :: ip_ebil_phy, iflag_rrtm
     76       INTEGER :: ip_ebil_phy, iflag_rrtm, iflag_ice_thermo
    7677       LOGICAL :: ok_strato
    7778       LOGICAL :: ok_hines
     
    9192     &     , f_cdrag_ter,f_cdrag_oce,f_rugoro                           &
    9293     &     , lev_histhf, lev_histday, lev_histmth                       &
    93      &     , lev_histins, lev_histLES, lev_histdayNMC                   &
     94     &     , lev_histins, lev_histLES, lev_histdayNMC, levout_histNMC   &
    9495     &     , pasphys, ok_histNMC, freq_outNMC, freq_calNMC              &
    9596     &     , type_run, ok_isccp, ok_regdyn, ok_cosp                     &
     
    101102     &     , ok_lic_melt, cvl_corr, aer_type                            &
    102103     &     , qsol0, iflag_rrtm, ok_strato,ok_hines,ecrit_LES            &
    103      &     , co2_ppm0
     104     &     , co2_ppm0, iflag_ice_thermo
    104105     
    105106       save /clesphys/
  • LMDZ5/branches/testing/libf/phylmd/concvl.F

    r1795 r1864  
    1       SUBROUTINE concvl (iflag_con,iflag_clos,
     1      SUBROUTINE concvl (iflag_clos,
    22     .             dtime,paprs,pplay,
    33     .             t,q,t_wake,q_wake,s_wake,u,v,tra,ntra,
    4      .             ALE,ALP,work1,work2,
     4     .             ALE,ALP,sig1,w01,
    55     .             d_t,d_q,d_u,d_v,d_tra,
    66     .             rain, snow, kbas, ktop, sigd,
     
    7070c======================================================================
    7171c
     72
     73#include "clesphys.h"
    7274#include "dimensions.h"
    7375c
    74        INTEGER iflag_con,iflag_clos
     76       INTEGER iflag_clos
    7577c
    7678       REAL dtime, paprs(klon,klev+1),pplay(klon,klev)
     
    8082       REAL tra(klon,klev,nbtr)
    8183       INTEGER ntra
    82        REAL work1(klon,klev),work2(klon,klev),ptop2(klon)
     84       REAL sig1(klon,klev),w01(klon,klev),ptop2(klon)
    8385       REAL pmflxr(klon,klev+1),pmflxs(klon,klev+1)
    8486       REAL ALE(klon),ALP(klon)
     
    354356      if (iflag_con.eq.30) then
    355357
    356       print *, '-> cv_driver'      !jyg
     358!      print *, '-> cv_driver'      !jyg
    357359      CALL cv_driver(klon,klev,klevp1,ntra,iflag_con,
    358360     :              t,q,qs,u,v,tra,
    359361     $              em_p,em_ph,iflag,
    360362     $              d_t,d_q,d_u,d_v,d_tra,rain,
    361      $              Vprecip,cbmf,work1,work2,                  !jyg
     363     $              Vprecip,cbmf,sig1,w01,                  !jyg
    362364     $              kbas,ktop,
    363365     $              dtime,Ma,upwd,dnwd,dnwdbis,qcondc,wd,cape,
     
    365367     $              evap,ep,epmlmMm,eplaMm,                    !RomP
    366368     $              wdtrainA,wdtrainM)                         !RomP
    367       print *, 'cv_driver ->'      !jyg
     369!      print *, 'cv_driver ->'      !jyg
    368370c
    369371      DO i = 1,klon
     
    376378      nloc=klon
    377379      CALL cva_driver(klon,klev,klev+1,ntra,nloc,
    378      $              iflag_con,iflag_mix,iflag_clos,dtime,
     380     $              iflag_con,iflag_mix,iflag_ice_thermo,
     381     $              iflag_clos,dtime,
    379382     :              t,q,qs,t_wake,q_wake,qs_wake,s_wake,u,v,tra,
    380383     $              em_p,em_ph,
     
    382385     .              em_sig1feed,em_sig2feed,em_wght,
    383386     .              iflag,d_t,d_q,d_u,d_v,d_tra,rain,kbas,ktop,
    384      $              cbmf,plcl,plfc,wbeff,work1,work2,ptop2,sigd,
     387     $              cbmf,plcl,plfc,wbeff,sig1,w01,ptop2,sigd,
    385388     $              Ma,mip,Vprecip,upwd,dnwd,dnwdbis,qcondc,wd,
    386389     $              cape,cin,tvp,
  • LMDZ5/branches/testing/libf/phylmd/conf_phys_m.F90

    r1795 r1864  
    141141  LOGICAL,SAVE :: reevap_ice_omp
    142142  INTEGER,SAVE :: iflag_pdf_omp
     143  INTEGER,SAVE :: iflag_ice_thermo_omp
    143144  REAL,SAVE :: rad_froid_omp, rad_chau1_omp, rad_chau2_omp
    144145  REAL,SAVE :: t_glace_min_omp, t_glace_max_omp
     
    155156  Integer, save :: lev_histins_omp, lev_histLES_omp
    156157  INTEGER, SAVE :: lev_histdayNMC_omp
     158  INTEGER, SAVE :: levout_histNMC_omp(3)
    157159  LOGICAL, SAVE :: ok_histNMC_omp(3)
    158160  REAL, SAVE :: freq_outNMC_omp(3), freq_calNMC_omp(3)
     
    966968  call getin('t_glace_max',t_glace_max_omp)
    967969
     970!
     971!Config Key  = iflag_ice_thermo
     972!Config Desc = 
     973!Config Def  = 0
     974!Config Help =
     975!
     976  iflag_ice_thermo_omp = 0
     977  call getin('iflag_ice_thermo',iflag_ice_thermo_omp)
     978
    968979!Config Key  = rei_min
    969980!Config Desc = 
     
    12671278  lev_histLES_omp = 1
    12681279  call getin('lev_histLES',lev_histLES_omp)
    1269 !
     1280! 
    12701281!Config Key  = lev_histdayNMC
    12711282!Config Desc =
     
    12751286  lev_histdayNMC_omp = 8
    12761287  call getin('lev_histdayNMC',lev_histdayNMC_omp)
     1288!
     1289!Config Key  = levout_histNMC
     1290!Config Desc =
     1291!Config Def  = 5
     1292!Config Help =
     1293!
     1294  levout_histNMC_omp(1) = 5
     1295  levout_histNMC_omp(2) = 5
     1296  levout_histNMC_omp(3) = 5
     1297  call getin('levout_histNMC',levout_histNMC_omp)
    12771298!
    12781299!histNMC BEG
     
    12961317!Config Help =
    12971318!
    1298 ! freq_outNMC_omp(1) = 2592000.
    12991319  freq_outNMC_omp(1) = mth_len*86400.
    13001320  freq_outNMC_omp(2) = 86400.
     
    16841704    t_glace_min = t_glace_min_omp
    16851705    t_glace_max = t_glace_max_omp
     1706    iflag_ice_thermo = iflag_ice_thermo_omp
    16861707    rei_min = rei_min_omp
    16871708    rei_max = rei_max_omp
     
    17021723    lev_histLES = lev_histLES_omp
    17031724    lev_histdayNMC = lev_histdayNMC_omp
     1725    levout_histNMC = levout_histNMC_omp
    17041726    ok_histNMC(:) = ok_histNMC_omp(:)
    17051727    freq_outNMC(:) = freq_outNMC_omp(:)
     
    19001922  write(lunout,*)' t_glace_min = ',t_glace_min
    19011923  write(lunout,*)' t_glace_max = ',t_glace_max
     1924  write(lunout,*)' iflag_ice_thermo = ',iflag_ice_thermo
    19021925  write(lunout,*)' rei_min = ',rei_min
    19031926  write(lunout,*)' rei_max = ',rei_max
     
    19251948  write(lunout,*)' lev_histLES = ',lev_histLES
    19261949  write(lunout,*)' lev_histdayNMC = ',lev_histdayNMC
     1950  write(lunout,*)' levout_histNMC = ',levout_histNMC
    19271951  write(lunout,*)' ok_histNMC = ',ok_histNMC
    19281952  write(lunout,*)' freq_outNMC = ',freq_outNMC
  • LMDZ5/branches/testing/libf/phylmd/cv3_routines.F

    r1795 r1864  
    143143
    144144      SUBROUTINE cv3_prelim(len,nd,ndp1,t,q,p,ph
    145      :                    ,lv,cpn,tv,gz,h,hm,th)
     145     :                    ,lv,lf,cpn,tv,gz,h,hm,th)
    146146      implicit none
    147147
     
    157157
    158158c outputs:
    159       real lv(len,nd), cpn(len,nd), tv(len,nd)
     159      real lv(len,nd), lf(len,nd), cpn(len,nd), tv(len,nd)
    160160      real gz(len,nd), h(len,nd), hm(len,nd)
    161161      real th(len,nd)
     
    178178cdebug          lv(i,k)= lv0-clmcpv*(t(i,k)-t0)
    179179          lv(i,k)= lv0-clmcpv*(t(i,k)-273.15)
     180          lf(i,k)= lf0-clmci*(t(i,k)-273.15)
    180181          cpn(i,k)=cpd*(1.0-q(i,k))+cpv*q(i,k)
    181182          cpx(i,k)=cpd*(1.0-q(i,k))+cl*q(i,k)
     
    918919      end
    919920
     921      SUBROUTINE Icefrac(t,clw,qi,nl,len)
     922      implicit none
     923
     924
     925cJAM--------------------------------------------------------------------
     926C    Calcul de la quantité d'eau sous forme de glace
     927C--------------------------------------------------------------------
     928      Real qi(len,nl)
     929      Real t(len,nl), clw(len,nl)
     930      Real fracg
     931      Integer nl, len, k, i
     932
     933      do k=3, nl
     934           do i = 1, len
     935           if (t(i,k).gt.263.15) then
     936           qi(i,k)=0.
     937           else
     938           if (t(i,k).lt.243.15) then
     939           qi(i,k)=clw(i,k)
     940           else
     941           fracg=(263.15-t(i,k))/20
     942           qi(i,k)=clw(i,k)*fracg
     943           endif
     944           endif
     945C           print*,t(i,k),qi(i,k),'temp,testglace'
     946           enddo
     947       enddo
     948
     949      return
     950
     951      end
     952
    920953      SUBROUTINE cv3_undilute2(nloc,ncum,nd,icb,icbs,nk
    921954     :                       ,tnk,qnk,gznk,hnk,t,q,qs,gz
    922      :                       ,p,h,tv,lv,pbase,buoybase,plcl
    923      o                       ,inb,tp,tvp,clw,hp,ep,sigp,buoy)
     955     :                       ,p,h,tv,lv,lf,pbase,buoybase,plcl
     956     o                       ,inb,tp,tvp,clw,hp,ep,sigp,buoy,frac)
    924957      implicit none
    925958
     
    945978#include "cv3param.h"
    946979#include "conema3.h"
     980#include "cvflag.h"
    947981
    948982c inputs:
    949       integer ncum, nd, nloc
     983      integer ncum, nd, nloc, j
    950984      integer icb(nloc), icbs(nloc), nk(nloc)
    951985      real t(nloc,nd), q(nloc,nd), qs(nloc,nd), gz(nloc,nd)
     
    953987      real tnk(nloc), qnk(nloc), gznk(nloc)
    954988      real hnk(nloc)
    955       real lv(nloc,nd), tv(nloc,nd), h(nloc,nd)
     989      real lv(nloc,nd), lf(nloc,nd), tv(nloc,nd), h(nloc,nd)
    956990      real pbase(nloc), buoybase(nloc), plcl(nloc)
    957991
     
    964998c local variables:
    965999      integer i, k
    966       real tg,qg,ahg,alv,s,tc,es,denom,rg,tca,elacrit
    967       real by, defrac, pden
     1000       real tg,qg,ahg,alv,alf,s,tc,es,esi,denom,rg,tca,elacrit
     1001      real als
     1002      real qsat_new,snew, qi(nloc,nd)
     1003      real by, defrac, pden, tbis
    9681004      real ah0(nloc), cape(nloc), capem(nloc), byp(nloc)
     1005      real frac(nloc,nd)
    9691006      logical lcape(nloc)
    9701007      integer iposit(nloc)
     1008      Real fracg
    9711009
    9721010!=====================================================================
     
    9781016       ep(i,k)=0.0
    9791017       sigp(i,k)=spfac
     1018       qi(i,k)=0.
    9801019 160  continue
    9811020 170  continue
     
    10601099
    10611100c convect3: no approximation:
    1062            tp(i,k)=(ah0(i)-gz(i,k)-alv*qg)/(cpd+(cl-cpd)*qnk(i))
    1063 
     1101           if (cvflag_ice) then
     1102              tp(i,k)=Max(0.,(ah0(i)-gz(i,k)-alv*qg)
     1103     &                /(cpd+(cl-cpd)*qnk(i)))
     1104           else
     1105              tp(i,k)=(ah0(i)-gz(i,k)-alv*qg)/(cpd+(cl-cpd)*qnk(i))
     1106           endif
     1107c         
    10641108               clw(i,k)=qnk(i)-qg
    10651109               clw(i,k)=max(0.0,clw(i,k))
     
    10681112c convect3: (qg utilise au lieu du vrai mixing ratio rg):
    10691113               tvp(i,k)=tp(i,k)*(1.+qg/eps-qnk(i)) ! whole thing
     1114               if (cvflag_ice) then
     1115               if(clw(i,k).lt.1.e-11) then
     1116               tp(i,k)=tv(i,k)
     1117               tvp(i,k)=tv(i,k)
     1118               endif
     1119               endif
    10701120            endif
     1121
     1122        if (cvflag_ice) then
     1123cCR:attention boucle en klon dans Icefrac         
     1124c          Call Icefrac(t,clw,qi,nl,nloc)
     1125           if (t(i,k).gt.263.15) then
     1126           qi(i,k)=0.
     1127           else
     1128           if (t(i,k).lt.243.15) then
     1129           qi(i,k)=clw(i,k)
     1130           else
     1131           fracg=(263.15-t(i,k))/20
     1132           qi(i,k)=clw(i,k)*fracg
     1133           endif
     1134           endif     
     1135cCR: fin test     
     1136          if(t(i,k).lt.263.15) then
     1137cCR: on commente les calculs d'Arnaud car division par zero
     1138cnouveau calcul propose par JYG
     1139c           alv=lv0-clmcpv*(t(i,k)-273.15)
     1140c           alf=lf0-clmci*(t(i,k)-273.15)
     1141c           tg=tp(i,k)
     1142c           tc=tp(i,k)-273.15
     1143c           denom=243.5+tc
     1144c             do j=1,3
     1145ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     1146c         il faudra que esi vienne en argument de la convection
     1147ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     1148c             tbis=t(i,k)+(tp(i,k)-tg)
     1149c             esi=exp(23.33086-(6111.72784/tbis)
     1150c     :               +0.15215*log(tbis))
     1151c             qsat_new=eps*esi/(p(i,k)-esi*(1.-eps))
     1152c             snew=cpd*(1.-qnk(i))+cl*qnk(i)+alv*alv*qsat_new/
     1153c     :                               (rrv*tbis*tbis)
     1154c             snew=1./snew
     1155c             print*,esi,qsat_new,snew,'esi,qsat,snew'
     1156c             tp(i,k)=tg+(alf*qi(i,k)+alv*qg*(1.-(esi/es)))*snew
     1157c             print*,k,tp(i,k),qnk(i),'avec glace'
     1158c             print*,'tpNAN',tg,alf,qi(i,k),alv,qg,esi,es,snew
     1159c             enddo
     1160
     1161           alv=lv0-clmcpv*(t(i,k)-273.15)
     1162           alf=lf0+clmci*(t(i,k)-273.15)
     1163           als=alf+alv
     1164           tg=tp(i,k)
     1165           tp(i,k) = t(i,k)
     1166           do j=1,3
     1167             esi=exp(23.33086-(6111.72784/tp(i,k))
     1168     :               +0.15215*log(tp(i,k)))
     1169             qsat_new=eps*esi/(p(i,k)-esi*(1.-eps))
     1170             snew=cpd*(1.-qnk(i))+cl*qnk(i)+alv*als*qsat_new/
     1171     :                               (rrv*tp(i,k)*tp(i,k))
     1172             snew=1./snew
     1173cc             print*,esi,qsat_new,snew,'esi,qsat,snew'
     1174             tp(i,k)=tp(i,k)+
     1175     :         ( (cpd*(1.-qnk(i))+cl*qnk(i))*(tg-tp(i,k)) +
     1176     :         alv*(qg-qsat_new) + alf*qi(i,k) )*snew
     1177c             print*,k,tp(i,k),qsat_new,qnk(i),qi(i,k),
     1178c     :             'k,tp,q,qt,qi avec glace'
     1179           enddo
     1180
     1181cCR:reprise du code AJ
     1182           clw(i,k)=qnk(i)-qsat_new
     1183           clw(i,k)=max(0.0,clw(i,k))
     1184           tvp(i,k)=Max(0.,tp(i,k)*(1.+qsat_new/eps-qnk(i)))
     1185c           print*,tvp(i,k),'tvp'
     1186          endif
     1187          if(clw(i,k).lt.1.e-11) then
     1188           tp(i,k)=tv(i,k)
     1189           tvp(i,k)=tv(i,k)
     1190          endif
     1191        endif  ! (cvflag_ice)
     1192
    10711193  290     continue
    10721194  300   continue
     
    13031425        do 590 i=1,ncum
    13041426        if((k.ge.icb(i)).and.(k.le.inb(i)))then
     1427
     1428          if (cvflag_ice) then
     1429          frac(i,k)=1.-(t(i,k)-243.15)/(263.15-243.15)
     1430          frac(i,k)=min(max(frac(i,k),0.0),1.0)
     1431          hp(i,k)=hnk(i)+(lv(i,k)+(cpd-cpv)*t(i,k)+frac(i,k)*lf(i,k))
     1432     :            *ep(i,k)*clw(i,k)
     1433
     1434          else
    13051435          hp(i,k)=hnk(i)+(lv(i,k)+(cpd-cpv)*t(i,k))*ep(i,k)*clw(i,k)
     1436          endif
     1437
    13061438        endif
    13071439 590    continue
     
    15551687
    15561688      SUBROUTINE cv3_mixing(nloc,ncum,nd,na,ntra,icb,nk,inb
    1557      :                    ,ph,t,rr,rs,u,v,tra,h,lv,qnk
     1689     :                    ,ph,t,rr,rs,u,v,tra,h,lv,lf,frac,qnk
    15581690     :                    ,unk,vnk,hp,tv,tvp,ep,clw,m,sig
    15591691     :   ,ment,qent,uent,vent,nent,sij,elij,ments,qents,traent)
     
    15671699#include "cvthermo.h"
    15681700#include "cv3param.h"
     1701#include "cvflag.h"
    15691702
    15701703c inputs:
     
    15781711      real tra(nloc,nd,ntra) ! input of convect3
    15791712      real lv(nloc,na), h(nloc,na), hp(nloc,na)
     1713      real lf(nloc,na), frac(nloc,na)
    15801714      real tv(nloc,na), tvp(nloc,na), ep(nloc,na), clw(nloc,na)
    15811715      real m(nloc,na)        ! input of convect3
     
    16591793          rti=qnk(il)-ep(il,i)*clw(il,i)
    16601794          bf2=1.+lv(il,j)*lv(il,j)*rs(il,j)/(rrv*t(il,j)*t(il,j)*cpd)
     1795
     1796
     1797          if (cvflag_ice) then
     1798c          print*,cvflag_ice,'cvflag_ice dans do 700'
     1799          if (t(il,j).le.263.15) then
     1800          bf2=1.+(lf(il,j)+lv(il,j))*(lv(il,j)+frac(il,j)
     1801     :          *lf(il,j))*rs(il,j)/(rrv*t(il,j)*t(il,j)*cpd)
     1802          endif
     1803          endif
     1804
    16611805          anum=h(il,j)-hp(il,i)+(cpv-cpd)*t(il,j)*(rti-rr(il,j))
    16621806          denom=h(il,i)-hp(il,i)+(cpd-cpv)*(rr(il,i)-rti)*t(il,j)
     
    16711815          if((stemp.lt.0.0.or.stemp.gt.1.0.or.altem.gt.cwat)
    16721816     :                 .and.j.gt.i)then
     1817
     1818          if (cvflag_ice) then
     1819          anum=anum-(lv(il,j)+frac(il,j)*lf(il,j))*(rti-rs(il,j)
     1820     :          -cwat*bf2)
     1821          denom=denom+(lv(il,j)+frac(il,j)*lf(il,j))*(rr(il,i)-rti)
     1822          else
    16731823           anum=anum-lv(il,j)*(rti-rs(il,j)-cwat*bf2)
    16741824           denom=denom+lv(il,j)*(rr(il,i)-rti)
     1825          endif
     1826
    16751827           if(abs(denom).lt.0.01)denom=0.01
    16761828           sij(il,i,j)=anum/denom
     
    17801932        lwork(il)=(nent(il,i).ne.0)
    17811933        qp=qnk(il)-ep(il,i)*clw(il,i)
     1934
     1935        if(cvflag_ice) then
     1936
     1937        anum=h(il,i)-hp(il,i)-(lv(il,i)+frac(il,i)*lf(il,i))*
     1938     :       (qp-rs(il,i))+(cpv-cpd)*t(il,i)*(qp-rr(il,i))
     1939        denom=h(il,i)-hp(il,i)+(lv(il,i)+frac(il,i)*lf(il,i))*
     1940     :        (rr(il,i)-qp)+(cpd-cpv)*t(il,i)*(rr(il,i)-qp)
     1941        else
     1942
    17821943        anum=h(il,i)-hp(il,i)-lv(il,i)*(qp-rs(il,i))
    17831944     :           +(cpv-cpd)*t(il,i)*(qp-rr(il,i))
    17841945        denom=h(il,i)-hp(il,i)+lv(il,i)*(rr(il,i)-qp)
    17851946     :           +(cpd-cpv)*t(il,i)*(rr(il,i)-qp)
     1947        endif
     1948
    17861949        if(abs(denom).lt.0.01)denom=0.01
    17871950        scrit(il)=anum/denom
     
    19482111      SUBROUTINE cv3_unsat(nloc,ncum,nd,na,ntra,icb,inb,iflag
    19492112     :              ,t,rr,rs,gz,u,v,tra,p,ph
    1950      :              ,th,tv,lv,cpn,ep,sigp,clw
     2113     :              ,th,tv,lv,lf,cpn,ep,sigp,clw
    19512114     :              ,m,ment,elij,delt,plcl,coef_clos
    1952      o              ,mp,rp,up,vp,trap,wt,water,evap,b,sigd
     2115     o              ,mp,rp,up,vp,trap,wt,water,evap,fondue,ice
     2116     :              ,faci,b,sigd
    19532117     o              ,wdtrainA,wdtrainM)                                ! RomP
    19542118      implicit none
     
    19692133      real ep(nloc,na), sigp(nloc,na), clw(nloc,na)
    19702134      real th(nloc,na),tv(nloc,na),lv(nloc,na),cpn(nloc,na)
     2135      real lf(nloc,na)
    19712136      real m(nloc,na), ment(nloc,na,na), elij(nloc,na,na)
    19722137      real coef_clos(nloc)
     
    19782143      real mp(nloc,na), rp(nloc,na), up(nloc,na), vp(nloc,na)
    19792144      real water(nloc,na), evap(nloc,na), wt(nloc,na)
     2145      real ice(nloc,na), fondue(nloc,na),faci(nloc,na)
    19802146      real trap(nloc,na,ntra)
    19812147      real b(nloc,na), sigd(nloc)
     
    19882154c local variables
    19892155      integer i,j,k,il,num1,ndp1
    1990       real tinv, delti
     2156      real tinv, delti, coef
    19912157      real awat, afac, afac1, afac2, bfac
    1992       real pr1, pr2, sigt, b6, c6, revap, delth
     2158      real pr1, pr2, sigt, b6, c6, d6, e6, f6, revap, delth
    19932159      real amfac, amp2, xf, tf, fac2, ur, sru, fac, d, af, bf
    1994       real ampmax
     2160      real ampmax, thaw
    19952161      real tevap(nloc)
    1996       real lvcp(nloc,na)
     2162      real lvcp(nloc,na),lfcp(nloc,na)
    19972163      real h(nloc,na),hm(nloc,na)
     2164      real frac(nloc,na)
     2165      real fraci(nloc,na),prec(nloc,na)
    19982166      real wdtrain(nloc)
    19992167      logical lwork(nloc),mplus(nloc)
     
    20152183          wt(il,i)=0.001
    20162184          water(il,i)=0.0
     2185          frac(il,i)=0.0
     2186          faci(il,i)=0.0
     2187          fraci(il,i)=0.0
     2188          ice(il,i)=0.0
     2189          prec(il,i)=0.0
     2190          fondue(il,i)=0.0
    20172191          evap(il,i)=0.0
    20182192          b(il,i)=0.0
    20192193          lvcp(il,i)=lv(il,i)/cpn(il,i)
     2194          lfcp(il,i)=lf(il,i)/cpn(il,i)
    20202195         enddo
    20212196        enddo
     
    21152290      wt(il,i)=45.0
    21162291
     2292      if (cvflag_ice) then
     2293      frac(il,inb(il)) = 1. -(t(il,inb(il))-243.15)/(263.15-243.15)
     2294      frac(il,inb(il)) = min(max(frac(il,inb(il)),0.),1.)
     2295      fraci(il,inb(il)) = frac(il,inb(il))
     2296      else
     2297      continue
     2298      endif
     2299
    21172300      if(i.lt.inb(il))then
     2301
     2302      if (cvflag_ice) then
     2303      thaw = (t(il,i)-273.15)/(275.15-273.15)
     2304      thaw = min(max(thaw,0.0),1.0)
     2305      frac(il,i)=frac(il,i)*(1.-thaw)
     2306      else
     2307      continue
     2308      endif
     2309
    21182310       rp(il,i)=rp(il,i+1)
    21192311     :       +(cpd*(t(il,i+1)-t(il,i))+gz(il,i+1)-gz(il,i))/lv(il,i)
    21202312       rp(il,i)=0.5*(rp(il,i)+rr(il,i))
    21212313      endif
     2314      fraci(il,i)=1.-(t(il,i)-243.15)/(263.15-243.15)
     2315      fraci(il,i)=min(max(fraci(il,i),0.0),1.0)
    21222316      rp(il,i)=max(rp(il,i),0.0)
    21232317      rp(il,i)=amin1(rp(il,i),rs(il,i))
     
    21262320      if(i.eq.1)then
    21272321       afac=p(il,1)*(rs(il,1)-rp(il,1))/(1.0e4+2000.0*p(il,1)*rs(il,1))
     2322       if (cvflag_ice) then
     2323       afac1=p(il,i)*(rs(il,1)-rp(il,1))/(1.0e4+2000.0*p(il,1)*rs(il,1))
     2324       endif
    21282325      else
    21292326       rp(il,i-1)=rp(il,i)
     
    21612358c       b6 = bfac*100.*sigd(il)*(ph(il,i)-ph(il,i+1))*sigt*afac
    21622359c       c6 = water(il,i+1) + wdtrain(il)*bfac
     2360c       c6 = prec(il,i+1) + wdtrain(il)*bfac
    21632361c        revap=0.5*(-b6+sqrt(b6*b6+4.*c6))
    21642362c        evap(il,i)=sigt*afac*revap
    21652363c        water(il,i)=revap*revap
     2364c        prec(il,i)=revap*revap
    21662365cc        print *,' i,b6,c6,revap,evap(il,i),water(il,i),wdtrain(il) ',
    21672366cc     $            i,b6,c6,revap,evap(il,i),water(il,i),wdtrain(il)
     
    21692368c
    21702369c--------retour à la formulation originale d'Emanuel.
     2370       if (cvflag_ice) then
     2371
     2372c      b6=bfac*50.*sigd(il)*(ph(il,i)-ph(il,i+1))*sigt*afac
     2373c      c6=prec(il,i+1)+bfac*wdtrain(il)
     2374c     :    -50.*sigd(il)*bfac*(ph(il,i)-ph(il,i+1))*evap(il,i+1)
     2375c      if(c6.gt.0.0)then
     2376c       revap=0.5*(-b6+sqrt(b6*b6+4.*c6))
     2377c
     2378cJAM  Attention: evap=sigt*E
     2379c     Modification: evap devient l'évaporation en milieu de couche
     2380c     car nécessaire dans cv3_yield
     2381c     Du coup, il faut modifier pas mal d'équations...
     2382c     et l'expression de afac qui devient afac1
     2383c     revap=sqrt((prec(i+1)+prec(i))/2)
     2384
     2385      b6=bfac*50.*sigd(il)*(ph(il,i)-ph(il,i+1))*sigt*afac1
     2386      c6=prec(il,i+1)+0.5*bfac*wdtrain(il)
     2387c      print *,'bfac,sigd(il),sigt,afac1 ',bfac,sigd(il),sigt,afac1
     2388c      print *,'prec(il,i+1),wdtrain(il) ',prec(il,i+1),wdtrain(il)
     2389c      print *,'b6,c6,b6*b6+4.*c6 ',b6,c6,b6*b6+4.*c6
     2390      if (c6 .gt. b6*b6+1.e-20) then
     2391       revap=2.*c6/(b6+sqrt(b6*b6+4.*c6))
     2392      else
     2393       revap=(-b6+sqrt(b6*b6+4.*c6))/2.
     2394      endif
     2395      prec(il,i)=Max(0.,2.*revap*revap-prec(il,i+1))
     2396c      print*,prec(il,i),'neige'
     2397
     2398cjyg    Dans sa formulation originale, Emanuel calcule l'evaporation par:
     2399cc             evap(il,i)=sigt*afac*revap
     2400c     ce qui n'est pas correct. Dans cv_routines, la formulation a été modifiee.
     2401c     Ici,l'evaporation evap est simplement calculee par l'equation de
     2402c     conservation.
     2403c       prec(il,i)=revap*revap
     2404c      else
     2405cjyg----   Correction : si c6 <= 0, water(il,i)=0.
     2406c       prec(il,i)=0.
     2407c      endif
     2408
     2409cjyg---   Dans tous les cas, evaporation = [tt ce qui entre dans la couche i]
     2410c                                    moins [tt ce qui sort de la couche i]
     2411c       print *, 'evap avec ice'
     2412       evap(il,i)=
     2413     :       (wdtrain(il)+sigd(il)*wt(il,i)*(prec(il,i+1)-prec(il,i)))
     2414     :                 /(sigd(il)*(ph(il,i)-ph(il,i+1))*100.)
     2415
     2416      d6=bfac*wdtrain(il)-100.*sigd(il)*bfac*(ph(il,i)-ph(il,i+1))
     2417     :   *evap(il,i)
     2418      e6=bfac*wdtrain(il)
     2419      f6=-100.*sigd(il)*bfac*(ph(il,i)-ph(il,i+1))*
     2420     :   evap(il,i)
     2421
     2422      thaw=(t(il,i)-273.15)/(275.15-273.15)
     2423      thaw=min(max(thaw,0.0),1.0)
     2424      water(il,i)=water(il,i+1)+(1-fraci(il,i))*d6
     2425      water(il,i)=max(water(il,i),0.)
     2426      ice(il,i)=ice(il,i+1)+fraci(il,i)*d6
     2427      ice(il,i)=max(ice(il,i),0.)
     2428      fondue(il,i)=ice(il,i)*thaw
     2429      water(il,i)=water(il,i)+fondue(il,i)
     2430      ice(il,i)=ice(il,i)-fondue(il,i)
     2431
     2432      if(water(il,i)+ice(il,i).lt.1.e-30)then
     2433      faci(il,i)=0.
     2434      else
     2435      faci(il,i)=ice(il,i)/(water(il,i)+ice(il,i))
     2436      endif
     2437
     2438c      water(il,i)=water(il,i+1)+(1.-fraci(il,i))*e6+(1.-faci(il,i))*f6
     2439c      water(il,i)=max(water(il,i),0.)
     2440c      ice(il,i)=ice(il,i+1)+fraci(il,i)*e6+faci(il,i)*f6
     2441c      ice(il,i)=max(ice(il,i),0.)
     2442c      fondue(il,i)=ice(il,i)*thaw
     2443c      water(il,i)=water(il,i)+fondue(il,i)
     2444c      ice(il,i)=ice(il,i)-fondue(il,i)
     2445c
     2446c      if((water(il,i)+ice(il,i)).lt.1.e-30)then
     2447c       faci(il,i)=0.
     2448c      else
     2449c       faci(il,i)=ice(il,i)/(water(il,i)+ice(il,i))
     2450c      endif
     2451
     2452      else
    21712453      b6=bfac*50.*sigd(il)*(ph(il,i)-ph(il,i+1))*sigt*afac
    21722454      c6=water(il,i+1)+bfac*wdtrain(il)
     
    21742456      if(c6.gt.0.0)then
    21752457       revap=0.5*(-b6+sqrt(b6*b6+4.*c6))
    2176 cjyg    Dans sa formulation originale, Emanuel calcule l'evaporation par:
    2177 cc             evap(il,i)=sigt*afac*revap
    2178 c     ce qui n'est pas correct. Dans cv_routines, la formulation a été modifiee.
    2179 c     Ici,l'evaporation evap est simplement calculee par l'equation de
    2180 c     conservation.
    21812458       water(il,i)=revap*revap
    21822459      else
    2183 cjyg----   Correction : si c6 <= 0, water(il,i)=0.
    2184        water(il,i) = 0.
     2460       water(il,i)= 0.
    21852461      endif
    2186 cJYG/IM : ci-dessous formulation originale de KE
    2187 c      evap(il,i)=-evap(il,i+1)
    2188 c    :            +(wdtrain(il)+sigd(il)*wt(il,i)*water(il,i+1))
    2189 c    :                 /(sigd(il)*(ph(il,i)-ph(il,i+1))*50.)
    2190 c
    2191 cJYG/IM : ci-dessous modification formulation originale de KE
    2192 c        pour eliminer oscillations verticales de pluie se produisant
    2193 c        lorsqu'il y a evaporation totale de la pluie
    2194 c
    2195 c       evap(il,i)= +(wdtrain(il)+sigd(il)*wt(il,i)*water(il,i+1)) !itlmd(jyg)
    2196 c     :                 /(sigd(il)*(ph(il,i)-ph(il,i+1))*100.)
    2197 c      end if  !itlmd(jyg)
    2198 cjyg---   Dans tous les cas, evaporation = [tt ce qui entre dans la couche i]
    2199 c                                    moins [tt ce qui sort de la couche i]
     2462c       print *, 'evap sans ice'
    22002463       evap(il,i)=
    22012464     :       (wdtrain(il)+sigd(il)*wt(il,i)*(water(il,i+1)-water(il,i)))
    22022465     :                 /(sigd(il)*(ph(il,i)-ph(il,i+1))*100.)
    2203 c
     2466
     2467       endif
    22042468       endif !(i.le.inb(il) .and. lwork(il))
    22052469995   Continue
     
    22152479      tevap(il)=max(0.0,evap(il,i))
    22162480      delth=max(0.001,(th(il,i)-th(il,i-1)))
     2481      if (cvflag_ice) then
     2482      if (cvflag_grav) then
     2483       mp(il,i)=100.*ginv*(lvcp(il,i)*sigd(il)*tevap(il)
     2484     :          *(p(il,i-1)-p(il,i))/delth
     2485     :          +lfcp(il,i)*sigd(il)*faci(il,i)*tevap(il)
     2486     :          *(p(il,i-1)-p(il,i))/delth
     2487     :          +lfcp(il,i)*sigd(il)*wt(il,i)/100.*fondue(il,i)
     2488     :          *(p(il,i-1)-p(il,i))/delth/(ph(il,i)-ph(il,i+1)))
     2489      else
     2490       mp(il,i)=10.*(lvcp(il,i)*sigd(il)*tevap(il)
     2491     :          *(p(il,i-1)-p(il,i))/delth
     2492     :          +lfcp(il,i)*sigd(il)*faci(il,i)*tevap(il)
     2493     :          *(p(il,i-1)-p(il,i))/delth
     2494     :          +lfcp(il,i)*sigd(il)*wt(il,i)/100.*fondue(il,i)
     2495     :          *(p(il,i-1)-p(il,i))/delth/(ph(il,i)-ph(il,i+1)))
     2496
     2497      endif
     2498      else
    22172499      if (cvflag_grav) then
    22182500       mp(il,i)=100.*ginv*lvcp(il,i)*sigd(il)*tevap(il)
     
    22232505      endif
    22242506c
     2507      endif
     2508c
    22252509       endif !(i.le.inb(il) .and. lwork(il) .and. i.ne.1)
    22262510996   Continue
     
    22432527     :               /(lvcp(il,i)*sigd(il)*th(il,i))
    22442528       af=xf*tf+mp(il,i+1)*mp(il,i+1)*tinv
     2529
     2530       if (cvflag_ice) then
     2531       bf=2.*(tinv*mp(il,i+1))**3+tinv*mp(il,i+1)*xf*tf
     2532     :            +50.*(p(il,i-1)-p(il,i))*xf*
     2533     :            (tevap(il)*(1.+(lf(il,i)/lv(il,i))*faci(il,i))+
     2534     :            (lf(il,i)/lv(il,i))*wt(il,i)/100.*fondue(il,i)/
     2535     :            (ph(il,i)-ph(il,i+1)))
     2536       else
     2537
    22452538       bf=2.*(tinv*mp(il,i+1))**3+tinv*mp(il,i+1)*xf*tf
    22462539     :            +50.*(p(il,i-1)-p(il,i))*xf*tevap(il)
     2540       endif
     2541
    22472542       fac2=1.0
    22482543       if(bf.lt.0.0)fac2=-1.0
     
    22622557       mp(il,i)=max(0.0,mp(il,i))
    22632558
     2559       if (cvflag_ice) then
    22642560       if (cvflag_grav) then
    22652561Cjyg : il y a vraisemblablement une erreur dans la ligne 2 suivante:
    22662562C il faut diviser par (mp(il,i)*sigd(il)*grav) et non par (mp(il,i)+sigd(il)*0.1).
    22672563C Et il faut bien revoir les facteurs 100.
    2268         b(il,i-1)=b(il,i)+100.0*(p(il,i-1)-p(il,i))*tevap(il)
     2564         b(il,i-1)=b(il,i)+100.0*(p(il,i-1)-p(il,i))*
     2565     :            (tevap(il)*(1.+(lf(il,i)/lv(il,i))*faci(il,i))+
     2566     :            (lf(il,i)/lv(il,i))*wt(il,i)/100.*fondue(il,i)
     2567     :            /(ph(il,i)-ph(il,i+1)))
     2568     2            /(mp(il,i)+sigd(il)*0.1)
     2569     3 -10.0*(th(il,i)-th(il,i-1))*t(il,i)/(lvcp(il,i)
     2570     : *sigd(il)*th(il,i))
     2571       else
     2572        b(il,i-1)=b(il,i)+100.0*(p(il,i-1)-p(il,i))*
     2573     :            (tevap(il)*(1.+(lf(il,i)/lv(il,i))*faci(il,i))+
     2574     :            (lf(il,i)/lv(il,i))*wt(il,i)/100.*fondue(il,i)
     2575     :            /(ph(il,i)-ph(il,i+1)))
     2576     2            /(mp(il,i)+sigd(il)*0.1)
     2577     3 -10.0*(th(il,i)-th(il,i-1))*t(il,i)/(lvcp(il,i)
     2578     : *sigd(il)*th(il,i))
     2579       endif
     2580       else
     2581       if (cvflag_grav) then
     2582         b(il,i-1)=b(il,i)+100.0*(p(il,i-1)-p(il,i))*tevap(il)
    22692583     2   /(mp(il,i)+sigd(il)*0.1)
    22702584     3 -10.0*(th(il,i)-th(il,i-1))*t(il,i)/(lvcp(il,i)
     
    22762590     : *sigd(il)*th(il,i))
    22772591       endif
     2592      endif
    22782593       b(il,i-1)=max(b(il,i-1),0.0)
    22792594c
     
    23912706     :                    ,icb,inb,delt
    23922707     :                    ,t,rr,t_wake,rr_wake,s_wake,u,v,tra
    2393      :                    ,gz,p,ph,h,hp,lv,cpn,th,th_wake
     2708     :                    ,gz,p,ph,h,hp,lv,lf,cpn,th,th_wake
    23942709     :                    ,ep,clw,m,tp,mp,rp,up,vp,trap
    2395      :                    ,wt,water,evap,b,sigd
     2710     :                    ,wt,water,ice,evap,fondue,faci,b,sigd
    23962711     :                    ,ment,qent,hent,iflag_mix,uent,vent
    23972712     :                    ,nent,elij,traent,sig
     
    24222737      real th(nloc,na), p(nloc,nd), tp(nloc,na)
    24232738      real lv(nloc,na), cpn(nloc,na), ep(nloc,na), clw(nloc,na)
     2739      real lf(nloc,na)
    24242740      real m(nloc,na), mp(nloc,na), rp(nloc,na), up(nloc,na)
    24252741      real vp(nloc,na), wt(nloc,nd), trap(nloc,nd,ntra)
    24262742      real water(nloc,na), evap(nloc,na), b(nloc,na), sigd(nloc)
     2743      real fondue(nloc,na),faci(nloc,na), ice(nloc,na)
    24272744      real ment(nloc,na,na), qent(nloc,na,na), uent(nloc,na,na)
    24282745      real hent(nloc,na,na)
     
    24552772      real cpinv, rdcp, dpinv
    24562773      real awat(nloc)
    2457       real lvcp(nloc,na), mke(nloc,na)
     2774      real lvcp(nloc,na), lfcp(nloc,na), mke(nloc,na)
    24582775      real am(nloc), work(nloc), ad(nloc), amp1(nloc)
    24592776c!!      real up1(nloc), dn1(nloc)
     
    25132830       do il=1,ncum
    25142831         lvcp(il,i)=lv(il,i)/cpn(il,i)
     2832         lfcp(il,i)=lf(il,i)/cpn(il,i)
    25152833       enddo
    25162834      enddo
     
    25222840      do il=1,ncum
    25232841       if(ep(il,inb(il)).ge.0.0001 .and. iflag(il) .le. 1)then
     2842        if (cvflag_ice) then
     2843        if (cvflag_grav) then
     2844           precip(il)=wt(il,1)*sigd(il)*(water(il,1)+ice(il,1))*86400.
     2845     :               *1000./(rowl*grav)
     2846        else
     2847         precip(il)=wt(il,1)*sigd(il)*(water(il,1)+ice(il,1))*8640.
     2848        endif
     2849        else
    25242850        if (cvflag_grav) then
    25252851           precip(il)=wt(il,1)*sigd(il)*water(il,1)*86400.*1000.
     
    25272853        else
    25282854         precip(il)=wt(il,1)*sigd(il)*water(il,1)*8640.
     2855        endif
    25292856        endif
    25302857       endif
     
    25392866       if(ep(il,inb(il)).ge.0.0001 .and. i.le.inb(il)
    25402867     :    .and. iflag(il) .le. 1)then
     2868        if (cvflag_ice) then
     2869        if (cvflag_grav) then
     2870           VPrecip(il,i) = wt(il,i)*sigd(il)*(water(il,i)+ice(il,i))
     2871     :                     /grav
     2872        else
     2873           VPrecip(il,i) = wt(il,i)*sigd(il)*(water(il,i)+ice(il,i))
     2874     :                     /10.
     2875        endif
     2876        else
    25412877        if (cvflag_grav) then
    25422878           VPrecip(il,i) = wt(il,i)*sigd(il)*water(il,i)/grav
    25432879        else
    25442880           VPrecip(il,i) = wt(il,i)*sigd(il)*water(il,i)/10.
     2881        endif
    25452882        endif
    25462883       endif
     
    25852922cjyg  Correction pour conserver l'eau
    25862923ccc       ft(il,1)=-0.5*lvcp(il,1)*sigd(il)*(evap(il,1)+evap(il,2)) !precip
    2587        ft(il,1)=-lvcp(il,1)*sigd(il)*evap(il,1)                  !precip
     2924       if (cvflag_ice) then
     2925       ft(il,1)=-lvcp(il,1)*sigd(il)*evap(il,1)
     2926     :           -lfcp(il,1)*sigd(il)*evap(il,1)*faci(il,1)
     2927     :           -lfcp(il,1)*sigd(il)*(fondue(il,1)*wt(il,1))/
     2928     :           (100.*(ph(il,1)-ph(il,2)))                               !precip
     2929       else
     2930       ft(il,1)=-lvcp(il,1)*sigd(il)*evap(il,1)
     2931       endif
    25882932
    25892933      if (cvflag_grav) then
     
    25952939      endif
    25962940
     2941      if (cvflag_ice) then
     2942        ft(il,1)=ft(il,1)+0.01*sigd(il)*wt(il,1)*(cl-cpd)*water(il,2)
     2943     :     *(t_wake(il,2)-t_wake(il,1))*work(il)/cpn(il,1)+
     2944     :     0.01*sigd(il)*wt(il,1)*(ci-cpd)*ice(il,2)*
     2945     :     (t_wake(il,2)-t_wake(il,1))*work(il)/cpn(il,1)
     2946      else
    25972947      ft(il,1)=ft(il,1)+0.01*sigd(il)*wt(il,1)*(cl-cpd)*water(il,2)
    25982948     :     *(t_wake(il,2)-t_wake(il,1))*work(il)/cpn(il,1)
     2949      endif
    25992950
    26002951      ftd(il,1) = ft(il,1)                        ! fin precip
     
    27913142       ! precip
    27923143ccc       ft(il,i)= -0.5*sigd(il)*lvcp(il,i)*(evap(il,i)+evap(il,i+1))
     3144       if (cvflag_ice) then
    27933145       ft(il,i)= -sigd(il)*lvcp(il,i)*evap(il,i)
     3146     :           -sigd(il)*lfcp(il,i)*evap(il,i)*faci(il,i)
     3147     :           -sigd(il)*lfcp(il,i)*fondue(il,i)*wt(il,i)/
     3148     :           (100.*(p(il,i-1)-p(il,i)))
     3149       else
     3150       ft(il,i)= -sigd(il)*lvcp(il,i)*evap(il,i)
     3151       endif
     3152
    27943153        rat=cpn(il,i-1)*cpinv
    27953154c
     
    27983157     :   *(mp(il,i+1)*t_wake(il,i)*b(il,i)
    27993158     :   -mp(il,i)*t_wake(il,i-1)*rat*b(il,i-1))*dpinv
     3159       if (cvflag_ice) then
    28003160       ft(il,i)=ft(il,i)+0.01*sigd(il)*wt(il,i)*(cl-cpd)*water(il,i+1)
    28013161     :           *(t_wake(il,i+1)-t_wake(il,i))*dpinv*cpinv
     3162     :           +0.01*sigd(il)*wt(il,i)*(ci-cpd)*ice(il,i+1)*
     3163     :           (t_wake(il,i+1)-t_wake(il,i))*dpinv*cpinv
     3164      else
     3165       ft(il,i)=ft(il,i)+0.01*sigd(il)*wt(il,i)*(cl-cpd)*water(il,i+1)
     3166     :           *(t_wake(il,i+1)-t_wake(il,i))*dpinv*cpinv
     3167      endif
     3168
    28023169       ftd(il,i)=ft(il,i)
    28033170        ! fin precip
     
    28183185     :   *(mp(il,i+1)*t_wake(il,i)*b(il,i)
    28193186     :   -mp(il,i)*t_wake(il,i-1)*rat*b(il,i-1))*dpinv
     3187
     3188       if (cvflag_ice) then
    28203189       ft(il,i)=ft(il,i)+0.01*sigd(il)*wt(il,i)*(cl-cpd)*water(il,i+1)
    28213190     :           *(t_wake(il,i+1)-t_wake(il,i))*dpinv*cpinv
     3191     :           +0.01*sigd(il)*wt(il,i)*(ci-cpd)*ice(il,i+1)*
     3192     :           (t_wake(il,i+1)-t_wake(il,i))*dpinv*cpinv
     3193       else
     3194       ft(il,i)=ft(il,i)+0.01*sigd(il)*wt(il,i)*(cl-cpd)*water(il,i+1)
     3195     :           *(t_wake(il,i+1)-t_wake(il,i))*dpinv*cpinv
     3196       endif
     3197
    28223198       ftd(il,i)=ft(il,i)
    28233199        ! fin precip
     
    37444120        return
    37454121        end
    3746 
  • LMDZ5/branches/testing/libf/phylmd/cv3a_compress.F

    r1669 r1864  
    66     :    ,u1,v1,gz1,th1,th1_wake
    77     :    ,tra1
    8      :    ,h1     ,lv1     ,cpn1   ,p1,ph1,tv1    ,tp1,tvp1,clw1
    9      :    ,h1_wake,lv1_wake,cpn1_wake     ,tv1_wake
     8     :    ,h1     ,lv1, lf1     ,cpn1   ,p1,ph1,tv1    ,tp1,tvp1,clw1
     9     :    ,h1_wake,lv1_wake,lf1_wake,cpn1_wake     ,tv1_wake
    1010     :    ,sig1,w01,ptop21
    1111     :    ,Ale1,Alp1
     
    1616     o    ,u,v,gz,th,th_wake
    1717     o    ,tra
    18      o    ,h     ,lv     ,cpn    ,p,ph,tv    ,tp,tvp,clw
    19      o    ,h_wake,lv_wake,cpn_wake    ,tv_wake
     18     o    ,h     ,lv, lf     ,cpn    ,p,ph,tv    ,tp,tvp,clw
     19     o    ,h_wake,lv_wake,lf_wake,cpn_wake    ,tv_wake
    2020     o    ,sig,w0,ptop2
    2121     o    ,Ale,Alp  )
     
    4545      real gz1(len,nd),th1(len,nd),th1_wake(len,nd)
    4646      real tra1(len,nd,ntra)
    47       real h1(len,nd),lv1(len,nd),cpn1(len,nd)
     47      real h1(len,nd),lv1(len,nd),lf1(len,nd),cpn1(len,nd)
    4848      real p1(len,nd),ph1(len,nd+1),tv1(len,nd),tp1(len,nd)
    4949      real tvp1(len,nd),clw1(len,nd)
    5050      real h1_wake(len,nd),lv1_wake(len,nd),cpn1_wake(len,nd)
    51       real tv1_wake(len,nd)
     51      real tv1_wake(len,nd),lf1_wake(len,nd)
    5252      real sig1(len,nd), w01(len,nd), ptop21(len)
    5353      real Ale1(len),Alp1(len)
     
    6565      real gz(len,nd),th(len,nd),th_wake(len,nd)
    6666      real tra(len,nd,ntra)
    67       real h(len,nd),lv(len,nd),cpn(len,nd)
     67      real h(len,nd),lv(len,nd),lf(len,nd),cpn(len,nd)
    6868      real p(len,nd),ph(len,nd+1),tv(len,nd),tp(len,nd)
    6969      real tvp(len,nd),clw(len,nd)
    7070      real h_wake(len,nd),lv_wake(len,nd),cpn_wake(len,nd)
    71       real tv_wake(len,nd)
     71      real tv_wake(len,nd),lf_wake(len,nd)
    7272      real sig(len,nd), w0(len,nd), ptop2(len)
    7373      real Ale(len),Alp(len)
     
    9999        h(nn,k)=h1(i,k)
    100100        lv(nn,k)=lv1(i,k)
     101        lf(nn,k)=lf1(i,k)
    101102        cpn(nn,k)=cpn1(i,k)
    102103        p(nn,k)=p1(i,k)
     
    108109        h_wake(nn,k)=h1_wake(i,k)
    109110        lv_wake(nn,k)=lv1_wake(i,k)
     111        lf_wake(nn,k)=lf1_wake(i,k)
    110112        cpn_wake(nn,k)=cpn1_wake(i,k)
    111113        tv_wake(nn,k)=tv1_wake(i,k)
  • LMDZ5/branches/testing/libf/phylmd/cv_driver.F

    r1795 r1864  
    341341! --- SET CONSTANTS AND PARAMETERS
    342342!-------------------------------------------------------------------
    343       print *, '-> cv_driver'      !jyg
     343!      print *, '-> cv_driver'      !jyg
    344344c -- set simulation flags:
    345345c   (common cvflag)
    346346
    347        CALL cv_flag
     347       CALL cv_flag(0)
    348348
    349349c -- set thermodynamical constants:
     
    494494 400  continue
    495495
    496          print*,'cv_driver : klon, ncum = ',len,ncum
     496!         print*,'cv_driver : klon, ncum = ',len,ncum
    497497
    498498      IF (ncum.gt.0) THEN
     
    6966969999  continue
    697697
    698       print *, 'fin cv_driver ->'      !jyg
     698!      print *, 'fin cv_driver ->'      !jyg
    699699      return
    700700      end
    701701
    702702!==================================================================
    703       SUBROUTINE cv_flag
     703      SUBROUTINE cv_flag(iflag_ice_thermo)
    704704      implicit none
     705
     706c Argument : iflag_ice_thermo : ice thermodynamics is taken into account if
     707c                               iflag_ice_thermo >=1
     708      INTEGER iflag_ice_thermo
    705709
    706710#include "cvflag.h"
     
    709713c differente de 10.0 dans convect3:
    710714      cvflag_grav = .TRUE.
     715      cvflag_ice = iflag_ice_thermo .GE. 1
    711716
    712717      return
     
    744749       cpv = RCPV
    745750       cl  = RCW
     751       ci  = RCS
    746752       rrv = RV
    747753       rrd = RD
    748754       lv0 = RLVTT
     755       lf0 = RLSTT-RLVTT
    749756       g   = RG     ! not used in convect3
    750757c ori      t0  = RTT
     
    758765      clmcpv=cl-cpv
    759766      clmcpd=cl-cpd
     767      clmci=cl-ci
    760768      cpdmcp=cpd-cpv
    761769      cpvmcpd=cpv-cpd
  • LMDZ5/branches/testing/libf/phylmd/cva_driver.F

    r1795 r1864  
    33!
    44      SUBROUTINE cva_driver(len,nd,ndp1,ntra,nloc,
    5      &                   iflag_con,iflag_mix,
     5     &                   iflag_con,iflag_mix,iflag_ice_thermo,
    66     &                   iflag_clos,delt,
    77     &                   t1,q1,qs1,t1_wake,q1_wake,qs1_wake,s1_wake,
     
    5252C      iflag_con     Integer        Input        version of convect (3/4)
    5353C      iflag_mix     Integer        Input        version of mixing  (0/1/2)
     54C   iflag_ice_thermo Integer        Input        accounting for ice thermodynamics (0/1)
    5455C      iflag_clos    Integer        Input        version of closure (0/1)
    5556C      delt          Real           Input        time step
     
    155156      integer iflag_con
    156157      integer iflag_mix
     158      integer iflag_ice_thermo
    157159      integer iflag_clos
    158160      real delt
     
    381383      real buoybase1(klon)
    382384
     385      real lf1(klon,klev) ,lf1_wake(klon,klev)
    383386      real lv1(klon,klev) ,lv1_wake(klon,klev)
    384387      real cpn1(klon,klev),cpn1_wake(klon,klev)
     
    419422      real gz(nloc,klev),h(nloc,klev)     ,hm(nloc,klev)
    420423      real               h_wake(nloc,klev),hm_wake(nloc,klev)
    421       real lv(nloc,klev)     ,cpn(nloc,klev)
    422       real lv_wake(nloc,klev),cpn_wake(nloc,klev)
     424      real lv(nloc,klev), lf(nloc,klev), cpn(nloc,klev)
     425      real lv_wake(nloc,klev), lf_wake(nloc,klev), cpn_wake(nloc,klev)
    423426      real p(nloc,klev),ph(nloc,klev+1),tv(nloc,klev)    ,tp(nloc,klev)
    424427      real                              tv_wake(nloc,klev)
     
    430433      real sig(nloc,klev), w0(nloc,klev), ptop2(nloc)
    431434      real hp(nloc,klev), ep(nloc,klev), sigp(nloc,klev)
    432       real frac(nloc), buoy(nloc,klev)
     435      real buoy(nloc,klev)
    433436      real cape(nloc)
    434437      real cin(nloc)
     
    444447      real sigd(nloc)
    445448!      real mp(nloc,klev), qp(nloc,klev), up(nloc,klev), vp(nloc,klev)
    446 !      real wt(nloc,klev), water(nloc,klev), evap(nloc,klev)
     449!      real wt(nloc,klev), water(nloc,klev), evap(nloc,klev), ice(nloc,klev)
    447450!      real b(nloc,klev), sigd(nloc)
    448451!      save mp,qp,up,vp,wt,water,evap,b
    449452      real, save, allocatable :: mp(:,:),qp(:,:),up(:,:),vp(:,:)
    450       real, save, allocatable :: wt(:,:),water(:,:),evap(:,:), b(:,:)
    451 c$OMP THREADPRIVATE(mp,qp,up,vp,wt,water,evap,b)
     453      real, save, allocatable :: wt(:,:),water(:,:),evap(:,:)
     454      real, save, allocatable :: ice(:,:),fondue(:,:), b(:,:)
     455      real, save, allocatable :: frac(:,:), faci(:,:)
     456c$OMP THREADPRIVATE(mp,qp,up,vp,wt,water,evap,ice,fondue,b,frac,faci)
    452457      real  ft(nloc,klev), fq(nloc,klev)
    453458      real ftd(nloc,klev), fqd(nloc,klev)
     
    496501         allocate(mp(nloc,klev), qp(nloc,klev), up(nloc,klev))
    497502         allocate(vp(nloc,klev), wt(nloc,klev), water(nloc,klev))
     503         allocate(ice(nloc,klev), fondue(nloc,klev))
    498504         allocate(evap(nloc,klev), b(nloc,klev))
     505         allocate(frac(nloc,klev), faci(nloc,klev))
    499506         first=.false.
    500507       endif
     
    502509c   (common cvflag)
    503510
    504        CALL cv_flag
     511       CALL cv_flag(iflag_ice_thermo)
    505512
    506513c -- set thermodynamical constants:
     
    610617!       print*,'t1, q1 ',t1,q1
    611618       CALL cv3_prelim(len,nd,ndp1,t1,q1,p1,ph1      ! nd->na
    612      o               ,lv1,cpn1,tv1,gz1,h1,hm1,th1)
     619     o               ,lv1,lf1,cpn1,tv1,gz1,h1,hm1,th1)
    613620   
    614621c
    615622       CALL cv3_prelim(len,nd,ndp1,t1_wake,q1_wake,p1,ph1 ! nd->na
    616      o               ,lv1_wake,cpn1_wake,tv1_wake,gz1_wake
     623     o               ,lv1_wake,lf1_wake,cpn1_wake,tv1_wake,gz1_wake
    617624     o               ,h1_wake,bid,th1_wake)
    618625   
     
    755762     :    ,u1,v1,gz1,th1,th1_wake
    756763     :    ,tra1
    757      :    ,h1     ,lv1     ,cpn1   ,p1,ph1,tv1    ,tp1,tvp1,clw1
    758      :    ,h1_wake,lv1_wake,cpn1_wake     ,tv1_wake
     764     :    ,h1     ,lv1, lf1,cpn1   ,p1,ph1,tv1    ,tp1,tvp1,clw1
     765     :    ,h1_wake,lv1_wake,lf1_wake,cpn1_wake     ,tv1_wake
    759766     :    ,sig1,w01,ptop21
    760767     :    ,Ale1,Alp1
     
    765772     o    ,u,v,gz,th,th_wake
    766773     o    ,tra
    767      o    ,h     ,lv     ,cpn    ,p,ph,tv    ,tp,tvp,clw
    768      o    ,h_wake,lv_wake,cpn_wake    ,tv_wake
     774     o    ,h     ,lv, lf     ,cpn    ,p,ph,tv    ,tp,tvp,clw
     775     o    ,h_wake,lv_wake,lf_wake,cpn_wake    ,tv_wake
    769776     o    ,sig,w0,ptop2
    770777     o    ,Ale,Alp  )
     
    800807       CALL cv3_undilute2(nloc,ncum,nd,icb,icbs,nk        !na->nd
    801808     :                        ,tnk,qnk,gznk,hnk,t,q,qs,gz
    802      :                        ,p,h,tv,lv,pbase,buoybase,plcl
    803      o                        ,inb,tp,tvp,clw,hp,ep,sigp,buoy)
     809     :                        ,p,h,tv,lv,lf,pbase,buoybase,plcl
     810     o                        ,inb,tp,tvp,clw,hp,ep,sigp,buoy
     811     :                        ,frac)
    804812   
    805813      endif
     
    816824!-------------------------------------------------------------------
    817825      IF (iflag_con .eq. 3) THEN
     826       if ((iflag_ice_thermo.eq.1).and.(iflag_mix.ne.0)) then
     827         write(*,*) " iflag_ice_thermo==1 requires iflag_mix==0",
     828     &   " but iflag_mix=",iflag_mix, ". Might as well stop here."
     829         stop
     830       endif
    818831       IF (iflag_mix .ge. 1 ) THEN
    819832         CALL zilch(supmax,nloc*klev)   
     
    877890        IF (iflag_mix.eq.0) THEN
    878891         CALL cv3_mixing(nloc,ncum,nd,nd,ntra,icb,nk,inb    ! na->nd
    879      :                       ,ph,t,q,qs,u,v,tra,h,lv,qnk
     892     :                       ,ph,t,q,qs,u,v,tra,h,lv,lf,frac,qnk
    880893     :                       ,unk,vnk,hp,tv,tvp,ep,clw,m,sig
    881894     o   ,ment,qent,uent,vent,nent,sigij,elij,ments,qents,traent)
     
    913926       CALL cv3_unsat(nloc,ncum,nd,nd,ntra,icb,inb,iflag    ! na->nd
    914927     :               ,t_wake,q_wake,qs_wake,gz,u,v,tra,p,ph
    915      :               ,th_wake,tv_wake,lv_wake,cpn_wake
     928     :               ,th_wake,tv_wake,lv_wake,lf_wake,cpn_wake
    916929     :               ,ep,sigp,clw
    917930     :               ,m,ment,elij,delt,plcl,coef_clos
    918      o          ,mp,qp,up,vp,trap,wt,water,evap,b,sigd
     931     o          ,mp,qp,up,vp,trap,wt,water,evap,fondue,ice
     932     :          ,faci,b,sigd
    919933     o          ,wdtrainA,wdtrainM)   ! RomP
    920934      endif
     
    943957     :                     ,icb,inb,delt
    944958     :                     ,t,q,t_wake,q_wake,s_wake,u,v,tra
    945      :                     ,gz,p,ph,h,hp,lv,cpn,th,th_wake
     959     :                     ,gz,p,ph,h,hp,lv,lf,cpn,th,th_wake
    946960     :                     ,ep,clw,m,tp,mp,qp,up,vp,trap
    947      :                     ,wt,water,evap,b,sigd
     961     :                     ,wt,water,ice,evap,fondue,faci,b,sigd
    948962     :                    ,ment,qent,hent,iflag_mix,uent,vent
    949963     :                    ,nent,elij,traent,sig
     
    10431057      return
    10441058      end
    1045 
  • LMDZ5/branches/testing/libf/phylmd/cvflag.h

    r766 r1864  
    33!
    44      logical cvflag_grav
     5      logical cvflag_ice
    56
    6       COMMON /cvflag/ cvflag_grav
     7      COMMON /cvflag/ cvflag_grav, cvflag_ice
    78c$OMP THREADPRIVATE(/cvflag/)
  • LMDZ5/branches/testing/libf/phylmd/cvthermo.h

    r766 r1864  
    44c Thermodynamical constants for convectL:
    55
    6       real cpd, cpv, cl, rrv, rrd, lv0, g, rowl, t0
    7       real clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl
     6      real cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0
     7      real clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl, clmci
    88      real eps, epsi, epsim1
    99      real ginv, hrd
    1010      real grav
    1111
    12       COMMON /cvthermo/ cpd, cpv, cl, rrv, rrd, lv0, g, rowl, t0
    13      :                 ,clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl
    14      :                 ,eps, epsi, epsim1, ginv, hrd, grav
     12      COMMON /cvthermo/ cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl
     13     :                 ,t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl
     14     :                 ,clmci, eps, epsi, epsim1, ginv, hrd, grav
    1515
    1616c$OMP THREADPRIVATE(/cvthermo/)
  • LMDZ5/branches/testing/libf/phylmd/declare_STDlev.h

    r1707 r1864  
    11cIM for NMC files
    2       real twriteSTD(klon,nlevSTD,nfiles)
    3       real qwriteSTD(klon,nlevSTD,nfiles)
    4       real rhwriteSTD(klon,nlevSTD,nfiles)
    5       real phiwriteSTD(klon,nlevSTD,nfiles)
    6       real uwriteSTD(klon,nlevSTD,nfiles)
    7       real vwriteSTD(klon,nlevSTD,nfiles)
    8       real wwriteSTD(klon,nlevSTD,nfiles)
     2!      real twriteSTD(klon,nlevSTD,nfiles)
     3!      real qwriteSTD(klon,nlevSTD,nfiles)
     4!      real rhwriteSTD(klon,nlevSTD,nfiles)
     5!      real phiwriteSTD(klon,nlevSTD,nfiles)
     6!      real uwriteSTD(klon,nlevSTD,nfiles)
     7!      real vwriteSTD(klon,nlevSTD,nfiles)
     8!      real wwriteSTD(klon,nlevSTD,nfiles)
    99
    1010      real twriteSTD3(klon,nlevSTD3)
  • LMDZ5/branches/testing/libf/phylmd/etat0_netcdf.F90

    r1795 r1864  
    504504  zmax0(:) = 40.
    505505  f0(:) = 1.e-5
    506   ema_work1(:,:) = 0.
    507   ema_work2(:,:) = 0.
     506  sig1(:,:) = 0.
     507  w01(:,:) = 0.
    508508  wake_deltat(:,:) = 0.
    509509  wake_deltaq(:,:) = 0.
  • LMDZ5/branches/testing/libf/phylmd/fisrtilp.F90

    r1796 r1864  
    88     frac_impa, frac_nucl, beta,                        &
    99     prfl, psfl, rhcl, zqta, fraca,                     &
    10      ztv, zpspsk, ztla, zthl, iflag_cldcon)
     10     ztv, zpspsk, ztla, zthl, iflag_cldcon,             &
     11     iflag_ice_thermo)
    1112
    1213  !
     
    5152  REAL zpspsk(klon,klev),ztla(klon,klev)
    5253  REAL zthl(klon,klev)
     54  REAL ztfondue, qsl, qsi
    5355
    5456  logical lognormale(klon)
     57  logical ice_thermo
    5558
    5659  !AA
     
    7780  INTEGER ncoreczq 
    7881  INTEGER iflag_cldcon
     82  INTEGER iflag_ice_thermo
    7983  PARAMETER (ninter=5)
    8084  LOGICAL evap_prec ! evaporation de la pluie
     
    97101  INTEGER i, k, n, kk
    98102  REAL zqs(klon), zdqs(klon), zdelta, zcor, zcvm5   
    99   REAL zrfl(klon), zrfln(klon), zqev, zqevt
    100   REAL zoliq(klon), zcond(klon), zq(klon), zqn(klon), zdelq
     103  REAL zrfl(klon), zrfln(klon), zqev, zqevt
     104  REAL zifl(klon), zifln(klon), zqev0,zqevi, zqevti
     105  REAL zoliq(klon), zcond(klon), zq(klon), zqn(klon), zdelq
     106  REAL zoliqp(klon), zoliqi(klon)
    101107  REAL ztglace, zt(klon)
    102108  INTEGER nexpo ! exponentiel pour glace/eau
    103109  REAL zdz(klon),zrho(klon),ztot      , zrhol(klon)
    104110  REAL zchau      ,zfroi      ,zfice(klon),zneb(klon)
     111  REAL zmelt, zpluie, zice, zcondold
     112  PARAMETER (ztfondue=278.15)
    105113  !
    106114  LOGICAL appel1er
     
    145153  DATA appel1er /.TRUE./
    146154  !ym
     155  ice_thermo = iflag_ice_thermo .GE. 1
    147156  zdelq=0.0
    148157
     
    188197  !
    189198  ztglace = RTT - 15.0
    190   nexpo = 6
     199!AJ<
     200  IF (ice_thermo) THEN
     201    nexpo = 2
     202  ELSE
     203    nexpo = 6
     204  ENDIF
     205!!  RLVTT = 2.501e6 ! pas de redefinition des constantes physiques (jyg)
     206!!  RLSTT = 2.834e6 ! pas de redefinition des constantes physiques (jyg)
     207!>AJ
    191208  !cc      nexpo = 1
    192209  !
     
    223240     !     DO i = 1, klon
    224241     zrfl(i) = 0.0
     242     zifl(i) = 0.0
    225243     zneb(i) = seuil_neb
    226244  ENDDO
     
    272290
    273291
     292     ! Calculer l'evaporation de la precipitation
     293     !
     294
     295
    274296     IF (evap_prec) THEN
    275297        DO i = 1, klon
    276            IF (zrfl(i) .GT.0.) THEN
     298!AJ<
     299!!           IF (zrfl(i) .GT.0.) THEN
     300           IF (zrfl(i)+zifl(i).GT.0.) THEN
     301!>AJ
    277302              IF (thermcep) THEN
    278303                 zdelta=MAX(0.,SIGN(1.,RTT-zt(i)))
     
    288313                 ENDIF
    289314              ENDIF
    290               zqev = MAX (0.0, (zqs(i)-zq(i))*zneb(i) )
    291               zqevt = coef_eva * (1.0-zq(i)/zqs(i)) * SQRT(zrfl(i)) &
    292                    * (paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
    293               zqevt = MAX(0.0,MIN(zqevt,zrfl(i))) &
    294                    * RG*dtime/(paprs(i,k)-paprs(i,k+1))
    295               zqev = MIN (zqev, zqevt)
    296               zrfln(i) = zrfl(i) - zqev*(paprs(i,k)-paprs(i,k+1)) &
    297                    /RG/dtime
    298 
    299               ! pour la glace, on ré-évapore toute la précip dans la
    300               ! couche du dessous
    301               ! la glace venant de la couche du dessus est simplement
    302               ! dans la couche du dessous.
    303 
    304               IF (zt(i) .LT. t_coup.and.reevap_ice) zrfln(i)=0.
    305 
    306               zq(i) = zq(i) - (zrfln(i)-zrfl(i)) &
    307                    * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime
    308               zt(i) = zt(i) + (zrfln(i)-zrfl(i)) &
    309                    * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime &
    310                    * RLVTT/RCPD/(1.0+RVTMP2*zq(i))
    311               zrfl(i) = zrfln(i)
    312            ENDIF
    313         ENDDO
    314      ENDIF
     315           ENDIF ! (zrfl(i)+zifl(i).GT.0.)
     316        ENDDO
     317!AJ<
     318       IF (.NOT. ice_thermo) THEN
     319        DO i = 1, klon
     320!AJ<
     321!!           IF (zrfl(i) .GT.0.) THEN
     322           IF (zrfl(i)+zifl(i).GT.0.) THEN
     323!>AJ
     324                zqev = MAX (0.0, (zqs(i)-zq(i))*zneb(i) )
     325                zqevt = coef_eva * (1.0-zq(i)/zqs(i)) * SQRT(zrfl(i)) &
     326                     * (paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
     327                zqevt = MAX(0.0,MIN(zqevt,zrfl(i))) &
     328                     * RG*dtime/(paprs(i,k)-paprs(i,k+1))
     329                zqev = MIN (zqev, zqevt)
     330                zrfln(i) = zrfl(i) - zqev*(paprs(i,k)-paprs(i,k+1)) &
     331                     /RG/dtime
     332       
     333                ! pour la glace, on ré-évapore toute la précip dans la
     334                ! couche du dessous
     335                ! la glace venant de la couche du dessus est simplement
     336                ! dans la couche du dessous.
     337       
     338                IF (zt(i) .LT. t_coup.and.reevap_ice) zrfln(i)=0.
     339       
     340                zq(i) = zq(i) - (zrfln(i)-zrfl(i)) &
     341                     * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime
     342                zt(i) = zt(i) + (zrfln(i)-zrfl(i)) &
     343                     * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime &
     344                     * RLVTT/RCPD/(1.0+RVTMP2*zq(i))
     345                zrfl(i) = zrfln(i)
     346                zifl(i) = 0.
     347           ENDIF ! (zrfl(i)+zifl(i).GT.0.)
     348        ENDDO
     349!
     350       ELSE ! (.NOT. ice_thermo)
     351!
     352        DO i = 1, klon
     353!AJ<
     354!!           IF (zrfl(i) .GT.0.) THEN
     355           IF (zrfl(i)+zifl(i).GT.0.) THEN
     356!>AJ
     357     !JAM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     358     ! Modification de l'évaporation avec la glace
     359     ! Différentiation entre précipitation liquide et solide
     360     ! On suppose que coef_evai=2*coef_eva
     361     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
     362     
     363         zqev0 = MAX (0.0, (zqs(i)-zq(i))*zneb(i) )
     364     !    zqev0 = MAX (0.0, zqs(i)-zq(i) )
     365
     366     !JAM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     367     ! On différencie qsat pour l'eau et la glace
     368     ! Si zdelta=1. --> glace
     369     ! Si zdelta=0. --> eau liquide
     370     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     371         
     372         qsl= R2ES*FOEEW(zt(i),0.)/pplay(i,k)
     373         qsl= MIN(0.5,qsl)
     374         zcor= 1./(1.-RETV*qsl)
     375         qsl= qsl*zcor
     376         
     377         zqevt = 1.*coef_eva*(1.0-zq(i)/qsl)*SQRT(zrfl(i)) &
     378              *(paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
     379         zqevt = MAX(0.0,MIN(zqevt,zrfl(i))) &
     380              *RG*dtime/(paprs(i,k)-paprs(i,k+1))
     381
     382         qsi= R2ES*FOEEW(zt(i),1.)/pplay(i,k)
     383         qsi= MIN(0.5,qsi)
     384         zcor= 1./(1.-RETV*qsi)
     385         qsi= qsi*zcor
     386
     387         zqevti = 1.*coef_eva*(1.0-zq(i)/qsi)*SQRT(zifl(i)) &
     388              *(paprs(i,k)-paprs(i,k+1))/pplay(i,k)*zt(i)*RD/RG
     389         zqevti = MAX(0.0,MIN(zqevti,zifl(i))) &
     390              *RG*dtime/(paprs(i,k)-paprs(i,k+1))   
     391
     392             
     393     !JAM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     394     ! Vérification sur l'évaporation
     395     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     396     
     397         IF (zqevt+zqevti.GT.zqev0) THEN
     398                  zqev=zqev0*zqevt/(zqevt+zqevti)
     399                  zqevi=zqev0*zqevti/(zqevt+zqevti)
     400             
     401         ELSE
     402             IF (zqevt+zqevti.GT.0.) THEN
     403                  zqev=MIN(zqev0*zqevt/(zqevt+zqevti),zqevt)
     404                  zqevi=MIN(zqev0*zqevti/(zqevt+zqevti),zqevti)
     405             ELSE
     406             zqev=0.
     407             zqevi=0.
     408             ENDIF
     409         ENDIF
     410     
     411         zrfln(i) = Max(0.,zrfl(i) - zqev*(paprs(i,k)-paprs(i,k+1)) &
     412                                 /RG/dtime)
     413         zifln(i) = Max(0.,zifl(i) - zqevi*(paprs(i,k)-paprs(i,k+1)) &
     414                                 /RG/dtime)
     415         
     416     ! Pour la glace, on révapore toute la précip dans la couche du dessous
     417     ! la glace venant de la couche du dessus est simplement dans la couche
     418     ! du dessous.
     419     
     420     !    IF (zt(i) .LT. t_coup.and.reevap_ice) zrfln(i)=0.
     421!         print*,zrfl(i),zrfln(i),zqevt,zqevti,RLMLT,'fluxdeprecip'
     422         zq(i) = zq(i) - (zrfln(i)+zifln(i)-zrfl(i)-zifl(i)) &
     423                  * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime
     424         zt(i) = zt(i) + (zrfln(i)-zrfl(i)) &
     425                  * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime &
     426                  * RLVTT/RCPD/(1.0+RVTMP2*zq(i)) &
     427                  + (zifln(i)-zifl(i)) &
     428                  * (RG/(paprs(i,k)-paprs(i,k+1)))*dtime &
     429                  * RLSTT/RCPD/(1.0+RVTMP2*zq(i))
     430     
     431         zrfl(i) = zrfln(i)
     432         zifl(i) = zifln(i)
     433
     434           ENDIF ! (zrfl(i)+zifl(i).GT.0.)
     435        ENDDO
     436
     437      ENDIF ! (.NOT. ice_thermo)
     438     
     439     ENDIF ! (evap_prec)
    315440     !
    316441     ! Calculer Qs et L/Cp*dQs/dT:
     
    478603        zq(i) = zq(i) - zcond(i)
    479604        !         zt(i) = zt(i) + zcond(i) * RLVTT/RCPD
    480         zt(i) = zt(i) + zcond(i) * RLVTT/RCPD/(1.0+RVTMP2*zq(i))
    481      ENDDO
     605     ENDDO
     606!AJ<
     607     IF (.NOT. ice_thermo) THEN
     608       DO i = 1, klon
     609         zt(i) = zt(i) + zcond(i) * RLVTT/RCPD/(1.0+RVTMP2*zq(i))
     610       ENDDO
     611     ELSE
     612       DO i = 1, klon
     613         zfice(i) = 1.0 - (zt(i)-ztglace) / (273.15-ztglace)
     614         zfice(i) = MIN(MAX(zfice(i),0.0),1.0)
     615         zfice(i) = zfice(i)**nexpo
     616         zt(i) = zt(i) + (1.-zfice(i))*zcond(i) * RLVTT/RCPD/(1.0+RVTMP2*zq(i)) &
     617                       +zfice(i)*zcond(i) * RLSTT/RCPD/(1.0+RVTMP2*zq(i))
     618!         print*,zt(i),zrfl(i),zifl(i),'temp1'
     619       ENDDO
     620     ENDIF
     621!>AJ
    482622     !
    483623     ! Partager l'eau condensee en precipitation et eau liquide nuageuse
     
    488628           zrho(i) = pplay(i,k) / zt(i) / RD
    489629           zdz(i) = (paprs(i,k)-paprs(i,k+1)) / (zrho(i)*RG)
     630        ENDIF
     631     ENDDO
     632!AJ<
     633     IF (.NOT. ice_thermo) THEN
     634     DO i = 1, klon
     635        IF (rneb(i,k).GT.0.0) THEN
    490636           zfice(i) = 1.0 - (zt(i)-ztglace) / (273.13-ztglace)
    491637           zfice(i) = MIN(MAX(zfice(i),0.0),1.0)
    492638           zfice(i) = zfice(i)**nexpo
     639     !!      zfice(i)=0.
     640        ENDIF
     641     ENDDO
     642     ENDIF
     643     DO i = 1, klon
     644        IF (rneb(i,k).GT.0.0) THEN
    493645           zneb(i) = MAX(rneb(i,k), seuil_neb)
     646     !      zt(i) = zt(i)+zcond(i)*zfice(i)*RLMLT/RCPD/(1.0+RVTMP2*zq(i)) 
     647!           print*,zt(i),'fractionglace'
     648!>AJ
    494649           radliq(i,k) = zoliq(i)/REAL(ninter+1)
    495650        ENDIF
     
    500655           IF (rneb(i,k).GT.0.0) THEN
    501656              zrhol(i) = zrho(i) * zoliq(i) / zneb(i)
    502 
     657              ! Initialization of zpluie and zice:
     658              zpluie=0
     659              zice=0
    503660              IF (zneb(i).EQ.seuil_neb) THEN
    504661                 ztot = 0.0
     
    519676                 zchau    = zct   *dtime/REAL(ninter) * zoliq(i) &
    520677                      *(1.0-EXP(-(zoliq(i)/zneb(i)/zcl   )**2)) *(1.-zfice(i))
    521                  ztot    = zchau    + zfroi
     678!AJ<
     679                 IF (.NOT. ice_thermo) THEN
     680                   ztot    = zchau + zfroi
     681                 ELSE
     682                   zpluie = MIN(MAX(zchau,0.0),zoliq(i)*(1.-zfice(i)))
     683                   zice = MIN(MAX(zfroi,0.0),zoliq(i)*zfice(i))
     684                   ztot    = zpluie    + zice
     685                 ENDIF
     686!>AJ
    522687                 ztot    = MAX(ztot   ,0.0)
    523688              ENDIF
    524689              ztot    = MIN(ztot,zoliq(i))
     690!AJ<
     691     !         zoliqp = MAX(zoliq(i)*(1.-zfice(i))-1.*zpluie   , 0.0)
     692     !         zoliqi = MAX(zoliq(i)*zfice(i)-1.*zice   , 0.0)
     693              zoliqp(i) = MAX(zoliq(i)*(1.-zfice(i))-1.*zpluie  , 0.0)
     694              zoliqi(i) = MAX(zoliq(i)*zfice(i)-1.*zice  , 0.0)
    525695              zoliq(i) = MAX(zoliq(i)-ztot   , 0.0)
     696!>AJ
    526697              radliq(i,k) = radliq(i,k) + zoliq(i)/REAL(ninter+1)
    527698           ENDIF
     
    529700     ENDDO
    530701     !
    531      DO i = 1, klon
    532         IF (rneb(i,k).GT.0.0) THEN
     702         IF (.NOT. ice_thermo) THEN
     703       DO i = 1, klon
     704         IF (rneb(i,k).GT.0.0) THEN
    533705           d_ql(i,k) = zoliq(i)
    534706           zrfl(i) = zrfl(i)+ MAX(zcond(i)-zoliq(i),0.0) &
    535707                * (paprs(i,k)-paprs(i,k+1))/(RG*dtime)
    536         ENDIF
    537         IF (zt(i).LT.RTT) THEN
     708         ENDIF
     709       ENDDO
     710     ELSE
     711       DO i = 1, klon
     712         IF (rneb(i,k).GT.0.0) THEN
     713           d_ql(i,k) = zoliq(i)
     714!AJ<
     715           zrfl(i) = zrfl(i)+ MAX(zcond(i)*(1.-zfice(i))-zoliqp(i),0.0) &
     716               *(paprs(i,k)-paprs(i,k+1))/(RG*dtime)
     717           zifl(i) = zifl(i)+ MAX(zcond(i)*zfice(i)-zoliqi(i),0.0) &
     718                    *(paprs(i,k)-paprs(i,k+1))/(RG*dtime) 
     719     !      zrfl(i) = zrfl(i)+  zpluie                         &
     720     !          *(paprs(i,k)-paprs(i,k+1))/(RG*dtime)
     721     !      zifl(i) = zifl(i)+  zice                    &
     722     !               *(paprs(i,k)-paprs(i,k+1))/(RG*dtime)                                   
     723
     724         ENDIF                     
     725       ENDDO
     726     ENDIF
     727
     728     IF (ice_thermo) THEN
     729       DO i = 1, klon
     730           zmelt = ((zt(i)-273.15)/(ztfondue-273.15))**2
     731           zmelt = MIN(MAX(zmelt,0.),1.)
     732           zrfl(i)=zrfl(i)+zmelt*zifl(i)
     733           zifl(i)=zifl(i)*(1.-zmelt)
     734!           print*,zt(i),'octavio1'
     735           zt(i)=zt(i)-zifl(i)*zmelt*(RG*dtime)/(paprs(i,k)-paprs(i,k+1)) &
     736                      *RLMLT/RCPD/(1.0+RVTMP2*zq(i))
     737!           print*,zt(i),zrfl(i),zifl(i),zmelt,'octavio2'
     738       ENDDO
     739     ENDIF
     740
     741       
     742     IF (.NOT. ice_thermo) THEN
     743       DO i = 1, klon
     744         IF (zt(i).LT.RTT) THEN
    538745           psfl(i,k)=zrfl(i)
    539         ELSE
     746         ELSE
    540747           prfl(i,k)=zrfl(i)
    541         ENDIF
    542      ENDDO
     748         ENDIF
     749       ENDDO
     750     ELSE
     751     ! JAM*************************************************
     752     ! Revoir partie ci-dessous: à quoi servent psfl et prfl?
     753     ! *****************************************************
     754
     755       DO i = 1, klon
     756     !   IF (zt(i).LT.RTT) THEN
     757           psfl(i,k)=zifl(i)
     758     !   ELSE
     759           prfl(i,k)=zrfl(i)
     760     !   ENDIF
     761!>AJ
     762       ENDDO
     763     ENDIF
     764     !
    543765     !
    544766     ! Calculer les tendances de q et de t:
     
    604826  DO i = 1, klon
    605827     IF ((t(i,1)+d_t(i,1)) .LT. RTT) THEN
    606         snow(i) = zrfl(i)
     828!AJ<
     829!!        snow(i) = zrfl(i)
     830        snow(i) = zrfl(i)+zifl(i)
     831!>AJ
    607832        zlh_solid(i) = RLSTT-RLVTT
    608833     ELSE
  • LMDZ5/branches/testing/libf/phylmd/hbtm.F

    r1279 r1864  
    44
    55      SUBROUTINE HBTM(knon, paprs, pplay,
    6      .                t2m,t10m,q2m,q10m,ustar,
     6     .                t2m,t10m,q2m,q10m,ustar,wstar,
    77     .                flux_t,flux_q,u,v,t,q,
    88     .                pblh,cape,EauLiq,ctei,pblT,
     
    5454      REAL q2m(klon), q10m(klon) ! q a 2 et 10m
    5555      REAL ustar(klon)
     56      REAL wstar(klon)       ! w*, convective velocity scale
    5657      REAL paprs(klon,klev+1) ! pression a inter-couche (Pa)
    5758      REAL pplay(klon,klev)   ! pression au milieu de couche (Pa)
     
    158159      REAL fak1(klon)       ! k*ustar*pblh
    159160      REAL fak2(klon)       ! k*wm*pblh
    160       REAL fak3(klon)       ! fakn*wstr/wm
     161      REAL fak3(klon)       ! fakn*wstar/wm
    161162      REAL pblk(klon)       ! level eddy diffusivity for momentum
    162163      REAL pr(klon)         ! Prandtl number for eddy diffusivities
     
    164165      REAL zh(klon)         ! zmzp / pblh
    165166      REAL zzh(klon)        ! (1-(zmzp/pblh))**2
    166       REAL wstr(klon)       ! w*, convective velocity scale
    167167      REAL zm(klon)         ! current level height
    168168      REAL zp(klon)         ! current level height + one level up
     
    625625          wm(i)      = ustar(i)*phiminv(i)
    626626          fak2(i)    = wm(i)*pblh(i)*vk
    627           wstr(i)    = (heatv(i)*RG*pblh(i)/zxt)**onet
    628           fak3(i)    = fakn*wstr(i)/wm(i)
     627          wstar(i)    = (heatv(i)*RG*pblh(i)/zxt)**onet
     628          fak3(i)    = fakn*wstar(i)/wm(i)
     629        ELSE
     630          wstar(i)=0.
    629631        ENDIF
    630632c Computes Theta_e for thermal (all cases : to be modified)
  • LMDZ5/branches/testing/libf/phylmd/ini_histrac.h

    r1750 r1864  
    147147
    148148! TD COUCHE-LIMITE
    149       IF (couchelimite) THEN
     149      IF (iflag_vdf_trac>=0) THEN
    150150        CALL histdef(nid_tra, "d_tr_cl_"//tname(iiq),      &
    151151             "tendance couche limite"// ttext(iiq), "?",   &
  • LMDZ5/branches/testing/libf/phylmd/iniphysiq.F

    r1707 r1864  
    1414     &                               klon_omp_end,klon_mpi_begin
    1515      USE comgeomphy, only : airephy,cuphy,cvphy,rlond,rlatd
    16 
     16      USE phyaqua_mod, only: iniaqua
    1717      IMPLICIT NONE
    1818c
  • LMDZ5/branches/testing/libf/phylmd/iophy.F90

    r1795 r1864  
    22! $Header$
    33!
    4 module iophy
    5  
    6 ! abd  REAL,private,allocatable,dimension(:),save :: io_lat
    7 ! abd  REAL,private,allocatable,dimension(:),save :: io_lon
     4MODULE iophy
     5
     6  USE phys_output_var_mod
     7#ifdef CPP_XIOS
     8  USE wxios
     9#endif
     10
     11#ifdef CPP_XIOS
     12  USE wxios
     13#endif
     14
     15! abd  REAL,private,allocatable,DIMENSION(:),save :: io_lat
     16! abd  REAL,private,allocatable,DIMENSION(:),save :: io_lon
    817  REAL,ALLOCATABLE,DIMENSION(:),SAVE :: io_lat
    918  REAL,ALLOCATABLE,DIMENSION(:),SAVE :: io_lon
     
    1423
    1524!$OMP THREADPRIVATE(itau_iophy)
    16  
     25
     26#ifdef CPP_XIOS
     27  INTERFACE histwrite_phy
     28    MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy,histwrite2d_phy_old,histwrite3d_phy_old,histwrite2d_xios,histwrite3d_xios
     29  END INTERFACE
     30#else
    1731  INTERFACE histwrite_phy
    1832    MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy,histwrite2d_phy_old,histwrite3d_phy_old
    1933  END INTERFACE
     34#endif
    2035
    2136  INTERFACE histbeg_phy_all
    22     MODULE PROCEDURE histbeg_phy,histbeg_phy_points
     37    MODULE PROCEDURE histbeg_phy,histbeg_phyxios,histbeg_phy_points
    2338  END INTERFACE
    2439
    2540
    26 contains
    27 
    28   subroutine init_iophy_new(rlat,rlon)
     41CONTAINS
     42
     43! ug Routine pour définir itau_iophy depuis phys_output_write_mod:
     44  SUBROUTINE set_itau_iophy(ito)
     45      IMPLICIT NONE
     46      INTEGER, INTENT(IN) :: ito
     47      itau_iophy = ito
     48  END SUBROUTINE
     49
     50  SUBROUTINE init_iophy_new(rlat,rlon)
    2951  USE dimphy
    3052  USE mod_phys_lmdz_para
    3153  USE mod_grid_phy_lmdz
    3254  USE ioipsl
    33   implicit none
    34   include 'dimensions.h'   
    35     real,dimension(klon),intent(in) :: rlon
    36     real,dimension(klon),intent(in) :: rlat
    37 
    38     REAL,dimension(klon_glo)        :: rlat_glo
    39     REAL,dimension(klon_glo)        :: rlon_glo
     55
     56  IMPLICIT NONE
     57  INCLUDE 'dimensions.h'   
     58    REAL,DIMENSION(klon),INTENT(IN) :: rlon
     59    REAL,DIMENSION(klon),INTENT(IN) :: rlat
     60
     61    REAL,DIMENSION(klon_glo)        :: rlat_glo
     62    REAL,DIMENSION(klon_glo)        :: rlon_glo
    4063   
    4164    INTEGER,DIMENSION(2) :: ddid
     
    4770    INTEGER,DIMENSION(2) :: dhe
    4871    INTEGER :: i   
     72    INTEGER :: data_ibegin, data_iend
    4973
    5074    CALL gather(rlat,rlat_glo)
     
    6589    ALLOCATE(io_lon(iim))
    6690    io_lon(:)=rlon_glo(2-1/(iim*jjm):iim+1-1/(iim*jjm))
     91!! (I) dtnb   : total number of domains
     92!! (I) dnb    : domain number
     93!! (I) did(:) : distributed dimensions identifiers
     94!!              (up to 5 dimensions are supported)
     95!! (I) dsg(:) : total number of points for each dimension
     96!! (I) dsl(:) : local number of points for each dimension
     97!! (I) dpf(:) : position of first local point for each dimension
     98!! (I) dpl(:) : position of last local point for each dimension
     99!! (I) dhs(:) : start halo size for each dimension
     100!! (I) dhe(:) : end halo size for each dimension
     101!! (C) cdnm   : Model domain definition name.
     102!!              The names actually supported are :
     103!!              "BOX", "APPLE", "ORANGE".
     104!!              These names are case insensitive.
    67105
    68106    ddid=(/ 1,2 /)
     
    72110    dpl=(/ iim, jj_end /)
    73111    dhs=(/ ii_begin-1,0 /)
    74     if (mpi_rank==mpi_size-1) then
     112    IF (mpi_rank==mpi_size-1) THEN
    75113      dhe=(/0,0/)
    76     else
     114    ELSE
    77115      dhe=(/ iim-ii_end,0 /) 
    78     endif
    79    
    80     call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe, &
     116    ENDIF
     117
     118#ifndef CPP_NO_IOIPSL   
     119    CALL flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe, &
    81120                      'APPLE',phys_domain_id)
    82 
     121#endif
     122#ifdef CPP_XIOS
     123    !Pour els soucis en MPI, réglage du masque:
     124    IF (mpi_rank == 0) THEN
     125        data_ibegin = 0
     126    ELSE
     127        data_ibegin = ii_begin - 1
     128    END IF
     129
     130    IF (mpi_rank == mpi_size-1) THEN
     131        data_iend = nbp_lon
     132    ELSE
     133        data_iend = ii_end + 1
     134    END IF
     135
     136    WRITE(*,*) "TOTO mpirank=",mpi_rank,"iibeg=",ii_begin , "jjbeg=",jj_begin,"jjnb=",jj_nb,"jjend=",jj_end
     137
     138    !On initialise le domaine xios, maintenant que tout est connu:
     139    !SUBROUTINE wxios_domain_param(dom_id, is_sequential, ni, nj, ni_glo, nj_glo,        &
     140    !                                ibegin, iend, jbegin, jend,                         &
     141    !                                data_ni, data_ibegin,                               &
     142    !                                io_lat, io_lon)
     143    CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
     144                            1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
     145                            klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
     146                            io_lat, io_lon)
     147#endif
    83148!$OMP END MASTER
    84149     
    85   end subroutine init_iophy_new
    86 
    87   subroutine init_iophy(lat,lon)
     150  END SUBROUTINE init_iophy_new
     151
     152  SUBROUTINE init_iophy(lat,lon)
    88153  USE dimphy
    89154  USE mod_phys_lmdz_para
    90   use ioipsl
    91   implicit none
    92   include 'dimensions.h'   
    93     real,dimension(iim),intent(in) :: lon
    94     real,dimension(jjm+1-1/(iim*jjm)),intent(in) :: lat
     155  USE ioipsl
     156  IMPLICIT NONE
     157  INCLUDE 'dimensions.h'   
     158    REAL,DIMENSION(iim),INTENT(IN) :: lon
     159    REAL,DIMENSION(jjm+1-1/(iim*jjm)),INTENT(IN) :: lat
    95160
    96161    INTEGER,DIMENSION(2) :: ddid
     
    120185    endif
    121186   
     187#ifndef CPP_NO_IOIPSL
    122188    call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe, &
    123189                      'APPLE',phys_domain_id)
    124 
     190#endif
    125191!$OMP END MASTER
    126192     
    127   end subroutine init_iophy
    128  
    129   subroutine histbeg_phy(name,itau0,zjulian,dtime,nhori,nid_day)
     193  end SUBROUTINE init_iophy
     194
     195 SUBROUTINE histbeg_phyxios(name,itau0,zjulian,dtime,ffreq,lev,nhori,nid_day)
    130196  USE dimphy
    131197  USE mod_phys_lmdz_para
    132198  use ioipsl
    133199  use write_field
    134   implicit none
     200  IMPLICIT NONE
    135201  include 'dimensions.h'
    136202   
    137     character*(*), intent(IN) :: name
    138     integer, intent(in) :: itau0
    139     real,intent(in) :: zjulian
    140     real,intent(in) :: dtime
     203    character*(*), INTENT(IN) :: name
     204    integer, INTENT(IN) :: itau0
     205    REAL,INTENT(IN) :: zjulian
     206    REAL,INTENT(IN) :: dtime
     207    character(LEN=*), INTENT(IN) :: ffreq
     208    INTEGER,INTENT(IN) :: lev
    141209    integer,intent(out) :: nhori
    142210    integer,intent(out) :: nid_day
     
    150218                   1,iim,1,jj_nb,itau0, zjulian, dtime, nhori, nid_day,phys_domain_id)
    151219    endif
     220
     221#ifdef CPP_XIOS
     222    ! ug OMP en chantier...
     223    IF((.NOT. is_using_mpi) .OR. is_mpi_root) THEN
     224        ! ug Création du fichier
     225        CALL wxios_add_file(name, ffreq, lev)
     226    END IF
     227#endif
    152228!$OMP END MASTER
    153229 
    154   end subroutine histbeg_phy
    155 
    156   subroutine histbeg_phy_points(rlon,rlat,pim,tabij,ipt,jpt, &
     230  END SUBROUTINE histbeg_phyxios
     231 
     232  SUBROUTINE histbeg_phy(name,itau0,zjulian,dtime,nhori,nid_day)
     233  USE dimphy
     234  USE mod_phys_lmdz_para
     235  use ioipsl
     236  use write_field
     237  IMPLICIT NONE
     238  include 'dimensions.h'
     239   
     240    character*(*), INTENT(IN) :: name
     241    integer, INTENT(IN) :: itau0
     242    REAL,INTENT(IN) :: zjulian
     243    REAL,INTENT(IN) :: dtime
     244    integer,intent(out) :: nhori
     245    integer,intent(out) :: nid_day
     246
     247!$OMP MASTER   
     248#ifndef CPP_NO_IOIPSL
     249    if (is_sequential) then
     250      call histbeg(name,iim,io_lon, jj_nb,io_lat(jj_begin:jj_end), &
     251                   1,iim,1,jj_nb,itau0, zjulian, dtime, nhori, nid_day)
     252    else
     253      call histbeg(name,iim,io_lon, jj_nb,io_lat(jj_begin:jj_end), &
     254                   1,iim,1,jj_nb,itau0, zjulian, dtime, nhori, nid_day,phys_domain_id)
     255    endif
     256#endif
     257!$OMP END MASTER
     258 
     259  END SUBROUTINE histbeg_phy
     260
     261
     262  SUBROUTINE histbeg_phy_points(rlon,rlat,pim,tabij,ipt,jpt, &
    157263             plon,plat,plon_bounds,plat_bounds, &
    158264             nname,itau0,zjulian,dtime,nnhori,nnid_day)
     
    162268  use ioipsl
    163269  use write_field
    164   implicit none
     270  IMPLICIT NONE
    165271  include 'dimensions.h'
    166272
    167     real,dimension(klon),intent(in) :: rlon
    168     real,dimension(klon),intent(in) :: rlat
    169     integer, intent(in) :: itau0
    170     real,intent(in) :: zjulian
    171     real,intent(in) :: dtime
    172     integer, intent(in) :: pim
     273    REAL,DIMENSION(klon),INTENT(IN) :: rlon
     274    REAL,DIMENSION(klon),INTENT(IN) :: rlat
     275    integer, INTENT(IN) :: itau0
     276    REAL,INTENT(IN) :: zjulian
     277    REAL,INTENT(IN) :: dtime
     278    integer, INTENT(IN) :: pim
    173279    integer, intent(out) :: nnhori
    174     character(len=20), intent(in) :: nname
     280    character(len=20), INTENT(IN) :: nname
    175281    INTEGER, intent(out) :: nnid_day
    176282    integer :: i
    177     REAL,dimension(klon_glo)        :: rlat_glo
    178     REAL,dimension(klon_glo)        :: rlon_glo
    179     INTEGER, DIMENSION(pim), intent(in)  :: tabij
    180     REAL,dimension(pim), intent(in) :: plat, plon
    181     INTEGER,dimension(pim), intent(in) :: ipt, jpt
    182     REAL,dimension(pim,2), intent(out) :: plat_bounds, plon_bounds
     283    REAL,DIMENSION(klon_glo)        :: rlat_glo
     284    REAL,DIMENSION(klon_glo)        :: rlon_glo
     285    INTEGER, DIMENSION(pim), INTENT(IN)  :: tabij
     286    REAL,DIMENSION(pim), INTENT(IN) :: plat, plon
     287    INTEGER,DIMENSION(pim), INTENT(IN) :: ipt, jpt
     288    REAL,DIMENSION(pim,2), intent(out) :: plat_bounds, plon_bounds
    183289
    184290    INTEGER, SAVE :: tabprocbeg, tabprocend
     
    187293    INTEGER, PARAMETER :: nip=1
    188294    INTEGER :: npproc
    189     REAL, allocatable, dimension(:) :: npplat, npplon
    190     REAL, allocatable, dimension(:,:) :: npplat_bounds, npplon_bounds
     295    REAL, allocatable, DIMENSION(:) :: npplat, npplon
     296    REAL, allocatable, DIMENSION(:,:) :: npplat_bounds, npplon_bounds
    191297    INTEGER, PARAMETER :: jjmp1=jjm+1-1/jjm
    192     REAL, dimension(iim,jjmp1) :: zx_lon, zx_lat
     298    REAL, DIMENSION(iim,jjmp1) :: zx_lon, zx_lat
    193299
    194300    CALL gather(rlat,rlat_glo)
     
    278384    ENDDO
    279385!    print*,'iophy is_sequential nname, nnhori, nnid_day=',trim(nname),nnhori,nnid_day
     386#ifndef CPP_NO_IOIPSL
    280387     call histbeg(nname,pim,plon,plon_bounds, &
    281388                           plat,plat_bounds, &
    282389                           itau0, zjulian, dtime, nnhori, nnid_day)
     390#endif
    283391    else
    284392     npproc=0
     
    317425      ENDIF
    318426     ENDDO
     427#ifndef CPP_NO_IOIPSL
    319428     call histbeg(nname,npstn,npplon,npplon_bounds, &
    320429                            npplat,npplat_bounds, &
    321430                            itau0,zjulian,dtime,nnhori,nnid_day,phys_domain_id)
     431#endif
    322432    endif
    323433!$OMP END MASTER
    324434
    325   end subroutine histbeg_phy_points
     435  end SUBROUTINE histbeg_phy_points
     436
     437
     438  SUBROUTINE histdef2d_old (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
     439
     440    USE ioipsl
     441    USE dimphy
     442    USE mod_phys_lmdz_para
     443
     444    IMPLICIT NONE
     445
     446    INCLUDE "dimensions.h"
     447    INCLUDE "temps.h"
     448    INCLUDE "clesphys.h"
     449
     450    INTEGER                          :: iff
     451    LOGICAL                          :: lpoint
     452    INTEGER, DIMENSION(nfiles)       :: flag_var
     453    CHARACTER(LEN=20)                 :: nomvar
     454    CHARACTER(LEN=*)                 :: titrevar
     455    CHARACTER(LEN=*)                 :: unitvar
     456
     457    REAL zstophym
     458
     459    IF (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') THEN
     460       zstophym=zoutm(iff)
     461    ELSE
     462       zstophym=zdtime_moy
     463    ENDIF
     464
     465    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
     466    CALL conf_physoutputs(nomvar,flag_var)
     467
     468    IF(.NOT.lpoint) THEN 
     469       IF ( flag_var(iff)<=lev_files(iff) ) THEN
     470          CALL histdef (nid_files(iff),nomvar,titrevar,unitvar, &
     471               iim,jj_nb,nhorim(iff), 1,1,1, -99, 32, &
     472               type_ecri(iff), zstophym,zoutm(iff))               
     473       ENDIF
     474    ELSE
     475       IF ( flag_var(iff)<=lev_files(iff) ) THEN
     476          CALL histdef (nid_files(iff),nomvar,titrevar,unitvar, &
     477               npstn,1,nhorim(iff), 1,1,1, -99, 32, &
     478               type_ecri(iff), zstophym,zoutm(iff))               
     479       ENDIF
     480    ENDIF
     481
     482    ! Set swaero_diag=true if at least one of the concerned variables are defined
     483    IF (nomvar=='topswad' .OR. nomvar=='topswai' .OR. nomvar=='solswad' .OR. nomvar=='solswai' ) THEN
     484       IF  ( flag_var(iff)<=lev_files(iff) ) THEN
     485          swaero_diag=.TRUE.
     486       END IF
     487    END IF
     488  END SUBROUTINE histdef2d_old
     489
     490
     491
     492  SUBROUTINE histdef3d_old (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
     493
     494    USE ioipsl
     495    USE dimphy
     496    USE mod_phys_lmdz_para
     497
     498    IMPLICIT NONE
     499
     500    INCLUDE "dimensions.h"
     501    INCLUDE "temps.h"
     502!    INCLUDE "indicesol.h"
     503    INCLUDE "clesphys.h"
     504
     505    INTEGER                          :: iff
     506    LOGICAL                          :: lpoint
     507    INTEGER, DIMENSION(nfiles)       :: flag_var
     508    CHARACTER(LEN=20)                 :: nomvar
     509    CHARACTER(LEN=*)                 :: titrevar
     510    CHARACTER(LEN=*)                 :: unitvar
     511
     512    REAL zstophym
     513
     514    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
     515    CALL conf_physoutputs(nomvar,flag_var)
     516
     517    IF (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') THEN
     518       zstophym=zoutm(iff)
     519    ELSE
     520       zstophym=zdtime_moy
     521    ENDIF
     522
     523    IF(.NOT.lpoint) THEN
     524       IF ( flag_var(iff)<=lev_files(iff) ) THEN
     525          CALL histdef (nid_files(iff), nomvar, titrevar, unitvar, &
     526               iim, jj_nb, nhorim(iff), klev, levmin(iff), &
     527               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, type_ecri(iff), &
     528               zstophym, zoutm(iff))
     529       ENDIF
     530    ELSE
     531       IF ( flag_var(iff)<=lev_files(iff) ) THEN
     532          CALL histdef (nid_files(iff), nomvar, titrevar, unitvar, &
     533               npstn,1,nhorim(iff), klev, levmin(iff), &
     534               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, &
     535               type_ecri(iff), zstophym,zoutm(iff))
     536       ENDIF
     537    ENDIF
     538  END SUBROUTINE histdef3d_old
     539
     540
     541
     542
     543
     544
     545
     546
     547  SUBROUTINE histdef2d (iff,var)
     548
     549    USE ioipsl
     550    USE dimphy
     551    USE mod_phys_lmdz_para
     552
     553    IMPLICIT NONE
     554
     555    INCLUDE "dimensions.h"
     556    INCLUDE "temps.h"
     557    INCLUDE "clesphys.h"
     558
     559    INTEGER                          :: iff
     560    TYPE(ctrl_out)                   :: var
     561
     562    REAL zstophym
     563    CHARACTER(LEN=20) :: typeecrit
     564
     565
     566    ! ug On récupère le type écrit de la structure:
     567    !       Assez moche, à refaire si meilleure méthode...
     568    IF (INDEX(var%type_ecrit(iff), "once") > 0) THEN
     569       typeecrit = 'once'
     570    ELSE IF(INDEX(var%type_ecrit(iff), "t_min") > 0) THEN
     571       typeecrit = 't_min(X)'
     572    ELSE IF(INDEX(var%type_ecrit(iff), "t_max") > 0) THEN
     573       typeecrit = 't_max(X)'
     574    ELSE IF(INDEX(var%type_ecrit(iff), "inst") > 0) THEN
     575       typeecrit = 'inst(X)'
     576    ELSE
     577       typeecrit = type_ecri_files(iff)
     578    ENDIF
     579
     580    IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN
     581       zstophym=zoutm(iff)
     582    ELSE
     583       zstophym=zdtime_moy
     584    ENDIF
     585
     586    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
     587    CALL conf_physoutputs(var%name, var%flag)
     588
     589    IF(.NOT.clef_stations(iff)) THEN 
     590
     591#ifdef CPP_XIOS
     592        CALL wxios_add_field_to_file(var%name, 2, iff, phys_out_filenames(iff), &
     593        var%description, var%unit, var%flag(iff), typeecrit)
     594#endif
     595#ifndef CPP_NO_IOIPSL
     596
     597       IF ( var%flag(iff)<=lev_files(iff) ) THEN
     598          CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
     599               iim,jj_nb,nhorim(iff), 1,1,1, -99, 32, &
     600               typeecrit, zstophym,zoutm(iff))               
     601       ENDIF
     602    ELSE
     603       IF ( var%flag(iff)<=lev_files(iff)) THEN
     604          CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
     605               npstn,1,nhorim(iff), 1,1,1, -99, 32, &
     606               typeecrit, zstophym,zoutm(iff))               
     607       ENDIF
     608#endif
     609    ENDIF
     610
     611    ! Set swaero_diag=true if at least one of the concerned variables are defined
     612    IF (var%name=='topswad' .OR. var%name=='topswai' .OR. var%name=='solswad' .OR. var%name=='solswai' ) THEN
     613       IF  ( var%flag(iff)<=lev_files(iff) ) THEN
     614          swaero_diag=.TRUE.
     615       END IF
     616    END IF
     617  END SUBROUTINE histdef2d
     618  SUBROUTINE histdef3d (iff,var)
     619
     620    USE ioipsl
     621    USE dimphy
     622    USE mod_phys_lmdz_para
     623
     624    IMPLICIT NONE
     625
     626    INCLUDE "dimensions.h"
     627    INCLUDE "temps.h"
     628    INCLUDE "clesphys.h"
     629
     630    INTEGER                          :: iff
     631    TYPE(ctrl_out)                   :: var
     632
     633    REAL zstophym
     634    CHARACTER(LEN=20) :: typeecrit
     635
     636    ! ug On récupère le type écrit de la structure:
     637    !       Assez moche, à refaire si meilleure méthode...
     638    IF (INDEX(var%type_ecrit(iff), "once") > 0) THEN
     639       typeecrit = 'once'
     640    ELSE IF(INDEX(var%type_ecrit(iff), "t_min") > 0) THEN
     641       typeecrit = 't_min(X)'
     642    ELSE IF(INDEX(var%type_ecrit(iff), "t_max") > 0) THEN
     643       typeecrit = 't_max(X)'
     644    ELSE IF(INDEX(var%type_ecrit(iff), "inst") > 0) THEN
     645       typeecrit = 'inst(X)'
     646    ELSE
     647       typeecrit = type_ecri_files(iff)
     648    ENDIF
     649
     650
     651    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
     652    CALL conf_physoutputs(var%name,var%flag)
     653
     654    IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN
     655       zstophym=zoutm(iff)
     656    ELSE
     657       zstophym=zdtime_moy
     658    ENDIF
     659
     660    IF(.NOT.clef_stations(iff)) THEN
     661
     662#ifdef CPP_XIOS
     663        CALL wxios_add_field_to_file(var%name, 3, iff, phys_out_filenames(iff), &
     664        var%description, var%unit, var%flag(iff), typeecrit)
     665#endif
     666#ifndef CPP_NO_IOIPSL
     667
     668       IF ( var%flag(iff)<=lev_files(iff) ) THEN
     669          CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
     670               iim, jj_nb, nhorim(iff), klev, levmin(iff), &
     671               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, typeecrit, &
     672               zstophym, zoutm(iff))
     673       ENDIF
     674    ELSE
     675       IF ( var%flag(iff)<=lev_files(iff)) THEN
     676          CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
     677               npstn,1,nhorim(iff), klev, levmin(iff), &
     678               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, &
     679               typeecrit, zstophym,zoutm(iff))
     680       ENDIF
     681#endif
     682    ENDIF
     683  END SUBROUTINE histdef3d
     684
     685  SUBROUTINE conf_physoutputs(nam_var,flag_var)
     686!!! Lecture des noms et niveau de sortie des variables dans output.def
     687    !   en utilisant les routines getin de IOIPSL 
     688    use ioipsl
     689
     690    IMPLICIT NONE
     691
     692    include 'iniprint.h'
     693
     694    CHARACTER(LEN=20)                :: nam_var
     695    INTEGER, DIMENSION(nfiles)      :: flag_var
     696
     697    IF(prt_level>10) WRITE(lunout,*)'Avant getin: nam_var flag_var ',nam_var,flag_var(:)
     698    CALL getin('flag_'//nam_var,flag_var)
     699    CALL getin('name_'//nam_var,nam_var)
     700    IF(prt_level>10) WRITE(lunout,*)'Apres getin: nam_var flag_var ',nam_var,flag_var(:)
     701
     702  END SUBROUTINE conf_physoutputs
     703
     704
    326705 
    327706  SUBROUTINE histwrite2d_phy_old(nid,lpoint,name,itau,field)
    328707  USE dimphy
    329708  USE mod_phys_lmdz_para
    330   USE phys_output_var_mod
    331709  USE ioipsl
    332710  IMPLICIT NONE
     
    334712  include 'iniprint.h'
    335713   
    336     integer,intent(in) :: nid
    337     logical,intent(in) :: lpoint
    338     character*(*), intent(IN) :: name
    339     integer, intent(in) :: itau
    340     real,dimension(:),intent(in) :: field
    341     REAL,dimension(klon_mpi) :: buffer_omp
    342     INTEGER, allocatable, dimension(:) :: index2d
     714    integer,INTENT(IN) :: nid
     715    logical,INTENT(IN) :: lpoint
     716    character*(*), INTENT(IN) :: name
     717    integer, INTENT(IN) :: itau
     718    REAL,DIMENSION(:),INTENT(IN) :: field
     719    REAL,DIMENSION(klon_mpi) :: buffer_omp
     720    INTEGER, allocatable, DIMENSION(:) :: index2d
    343721    REAL :: Field2d(iim,jj_nb)
    344722
    345723    integer :: ip
    346     real,allocatable,dimension(:) :: fieldok
    347 
    348 
    349     IF (size(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first dimension not equal to klon',1)
     724    REAL,allocatable,DIMENSION(:) :: fieldok
     725
     726
     727    IF (size(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first DIMENSION not equal to klon',1)
    350728   
    351729    CALL Gather_omp(field,buffer_omp)   
     
    387765
    388766 
    389   end subroutine histwrite2d_phy_old
    390 
    391   subroutine histwrite3d_phy_old(nid,lpoint,name,itau,field)
     767  end SUBROUTINE histwrite2d_phy_old
     768
     769  SUBROUTINE histwrite3d_phy_old(nid,lpoint,name,itau,field)
    392770  USE dimphy
    393771  USE mod_phys_lmdz_para
    394   USE phys_output_var_mod
    395772
    396773  use ioipsl
    397   implicit none
     774  IMPLICIT NONE
    398775  include 'dimensions.h'
    399776  include 'iniprint.h'
    400777   
    401     integer,intent(in) :: nid
    402     logical,intent(in) :: lpoint
    403     character*(*), intent(IN) :: name
    404     integer, intent(in) :: itau
    405     real,dimension(:,:),intent(in) :: field  ! --> field(klon,:)
    406     REAL,dimension(klon_mpi,size(field,2)) :: buffer_omp
     778    integer,INTENT(IN) :: nid
     779    logical,INTENT(IN) :: lpoint
     780    character*(*), INTENT(IN) :: name
     781    integer, INTENT(IN) :: itau
     782    REAL,DIMENSION(:,:),INTENT(IN) :: field  ! --> field(klon,:)
     783    REAL,DIMENSION(klon_mpi,size(field,2)) :: buffer_omp
    407784    REAL :: Field3d(iim,jj_nb,size(field,2))
    408785    INTEGER :: ip, n, nlev
    409     INTEGER, ALLOCATABLE, dimension(:) :: index3d
    410     real,allocatable, dimension(:,:) :: fieldok
    411 
    412 
    413     IF (size(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first dimension not equal to klon',1)
     786    INTEGER, ALLOCATABLE, DIMENSION(:) :: index3d
     787    REAL,allocatable, DIMENSION(:,:) :: fieldok
     788
     789
     790    IF (size(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
    414791    nlev=size(field,2)
    415792
     
    460837!$OMP END MASTER   
    461838
    462   end subroutine histwrite3d_phy_old
     839  end SUBROUTINE histwrite3d_phy_old
     840
     841
    463842
    464843
     
    468847  USE mod_phys_lmdz_para
    469848  USE ioipsl
    470 !Pour avoir nfiles, nidfiles tout ça tout ça...
    471   USE phys_output_var_mod
    472849 
    473  
     850
    474851
    475852#ifdef CPP_XIOS
    476 !  USE WXIOS
    477 #endif
     853  USE wxios
     854#endif
     855
    478856
    479857  IMPLICIT NONE
    480   include 'dimensions.h'
    481    
    482 !    integer,intent(in) :: nid
    483 !    logical,intent(in) :: lpoint
    484 !    character*(*), intent(IN) :: name
    485 !    integer, intent(in) :: itau
    486 !    real,dimension(:),intent(in) :: field
    487 
    488       TYPE(ctrl_out), INTENT(IN) :: var
    489       REAL, DIMENSION(:), INTENT(IN) :: field
    490       INTEGER, INTENT(IN), OPTIONAL :: STD_iff ! ug RUSTINE POUR LES STD LEVS.....
     858  INCLUDE 'dimensions.h'
     859  INCLUDE 'iniprint.h'
     860
     861    TYPE(ctrl_out), INTENT(IN) :: var
     862    REAL, DIMENSION(:), INTENT(IN) :: field
     863    INTEGER, INTENT(IN), OPTIONAL :: STD_iff ! ug RUSTINE POUR LES STD LEVS.....
    491864     
    492       INTEGER :: iff, iff_beg, iff_end
     865    INTEGER :: iff, iff_beg, iff_end
    493866     
    494     REAL,dimension(klon_mpi) :: buffer_omp
    495     INTEGER, allocatable, dimension(:) :: index2d
     867    REAL,DIMENSION(klon_mpi) :: buffer_omp
     868    INTEGER, allocatable, DIMENSION(:) :: index2d
    496869    REAL :: Field2d(iim,jj_nb)
    497870
    498871    INTEGER :: ip
    499872    REAL, ALLOCATABLE, DIMENSION(:) :: fieldok
     873
     874    IF (prt_level >= 9) WRITE(lunout,*)'Begin histrwrite2d ',var%name
    500875
    501876! ug RUSTINE POUR LES STD LEVS.....
     
    508883      END IF
    509884
    510     IF (size(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first dimension not equal to klon',1)
     885  ! On regarde si on est dans la phase de définition ou d'écriture:
     886  IF(.NOT.vars_defined) THEN
     887!$OMP MASTER
     888      !Si phase de définition.... on définit
     889      DO iff=iff_beg, iff_end
     890         IF (clef_files(iff)) THEN
     891            CALL histdef2d(iff, var)
     892         ENDIF
     893      ENDDO
     894!$OMP END MASTER
     895  ELSE
     896
     897    !Et sinon on.... écrit
     898    IF (SIZE(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first DIMENSION not equal to klon',1)
    511899   
    512900    CALL Gather_omp(field,buffer_omp)   
     
    521909                        ALLOCATE(index2d(iim*jj_nb))
    522910                        ALLOCATE(fieldok(iim*jj_nb))
    523    
     911#ifndef CPP_NO_IOIPSL
    524912                        CALL histwrite(nid_files(iff),var%name,itau_iophy,Field2d,iim*jj_nb,index2d)
     913#endif
    525914#ifdef CPP_XIOS
    526 !                        IF (iff .EQ. 1) THEN
    527 !                              CALL wxios_write_2D(var%name, Field2d)
    528 !                        ENDIF
     915                        IF (iff == iff_beg) THEN
     916                              CALL wxios_write_2D(var%name, Field2d)
     917                        ENDIF
    529918#endif
    530919                  ELSE
     
    533922
    534923                        IF (is_sequential) THEN
    535 !                            klon_mpi_begin=1
    536 !                             klon_mpi_end=klon
    537924                              DO ip=1, npstn
    538925                                    fieldok(ip)=buffer_omp(nptabij(ip))
     
    540927                             ELSE
    541928                              DO ip=1, npstn
    542 !                                   print*,'histwrite2d is_sequential npstn ip name nptabij',npstn,ip,name,nptabij(ip)
     929                                PRINT*,'histwrite2d is_sequential npstn ip namenptabij',npstn,ip,var%name,nptabij(ip)
    543930                                     IF(nptabij(ip).GE.klon_mpi_begin.AND. &
    544931                                        nptabij(ip).LE.klon_mpi_end) THEN
     
    547934                              ENDDO
    548935                       ENDIF
    549    
     936#ifndef CPP_NO_IOIPSL
    550937                       CALL histwrite(nid_files(iff),var%name,itau_iophy,fieldok,npstn,index2d)
     938#endif
    551939                  ENDIF
    552940                 
     
    556944      ENDDO
    557945!$OMP END MASTER   
    558 
     946  ENDIF ! vars_defined
     947  IF (prt_level >= 9) WRITE(lunout,*)'End histrwrite2d ',var%name
    559948  END SUBROUTINE histwrite2d_phy
    560949
    561950
    562951! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE
    563   SUBROUTINE histwrite3d_phy(var, field)
     952  SUBROUTINE histwrite3d_phy(var, field, STD_iff)
    564953  USE dimphy
    565954  USE mod_phys_lmdz_para
    566 
    567   use ioipsl
    568 !Pour avoir nfiles, nidfiles tout ça tout ça...
    569   USE phys_output_var_mod 
     955  USE ioipsl
    570956 
    571957
     
    576962
    577963  IMPLICIT NONE
    578   include 'dimensions.h'
    579    
    580 !    integer,intent(in) :: nid
    581 !    logical,intent(in) :: lpoint
    582 !    character*(*), intent(IN) :: name
    583 !    integer, intent(in) :: itau
    584 !    real,dimension(:,:),intent(in) :: field  ! --> field(klon,:)
    585 
    586       TYPE(ctrl_out), INTENT(IN) :: var
    587       REAL, DIMENSION(:,:), INTENT(IN) :: field ! --> field(klon,:)
    588 
     964  INCLUDE 'dimensions.h'
     965  INCLUDE 'iniprint.h'
     966
     967    TYPE(ctrl_out), INTENT(IN) :: var
     968    REAL, DIMENSION(:,:), INTENT(IN) :: field ! --> field(klon,:)
     969    INTEGER, INTENT(IN), OPTIONAL :: STD_iff ! ug RUSTINE POUR LES STD LEVS.....
     970     
     971    INTEGER :: iff, iff_beg, iff_end
    589972
    590973    REAL,DIMENSION(klon_mpi,SIZE(field,2)) :: buffer_omp
    591974    REAL :: Field3d(iim,jj_nb,SIZE(field,2))
    592     INTEGER :: ip, n, nlev, iff
     975    INTEGER :: ip, n, nlev
    593976    INTEGER, ALLOCATABLE, DIMENSION(:) :: index3d
    594977    REAL,ALLOCATABLE, DIMENSION(:,:) :: fieldok
    595978
    596     IF (size(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first dimension not equal to klon',1)
    597     nlev=size(field,2)
    598 
    599 !   print*,'hist3d_phy mpi_rank npstn=',mpi_rank,npstn
    600 
    601 !   DO ip=1, npstn
    602 !    print*,'hist3d_phy mpi_rank nptabij',mpi_rank,nptabij(ip)
    603 !   ENDDO
     979  IF (prt_level >= 9) write(lunout,*)'Begin histrwrite3d ',var%name
     980
     981! ug RUSTINE POUR LES STD LEVS.....
     982      IF (PRESENT(STD_iff)) THEN
     983            iff_beg = STD_iff
     984            iff_end = STD_iff
     985      ELSE
     986            iff_beg = 1
     987            iff_end = nfiles
     988      END IF
     989
     990  ! On regarde si on est dans la phase de définition ou d'écriture:
     991  IF(.NOT.vars_defined) THEN
     992      !Si phase de définition.... on définit
     993!$OMP MASTER
     994      DO iff=iff_beg, iff_end
     995        IF (clef_files(iff)) THEN
     996          CALL histdef3d(iff, var)
     997        ENDIF
     998      ENDDO
     999!$OMP END MASTER
     1000  ELSE
     1001    !Et sinon on.... écrit
     1002    IF (SIZE(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
     1003    nlev=SIZE(field,2)
     1004
    6041005
    6051006    CALL Gather_omp(field,buffer_omp)
     
    6091010
    6101011! BOUCLE SUR LES FICHIERS
    611       DO iff=1, nfiles
     1012     DO iff=iff_beg, iff_end
    6121013            IF (var%flag(iff) <= lev_files(iff) .AND. clef_files(iff)) THEN
    6131014                IF (.NOT.clef_stations(iff)) THEN
    6141015                        ALLOCATE(index3d(iim*jj_nb*nlev))
    6151016                        ALLOCATE(fieldok(iim*jj_nb,nlev))
     1017
     1018#ifndef CPP_NO_IOIPSL
    6161019                        CALL histwrite(nid_files(iff),var%name,itau_iophy,Field3d,iim*jj_nb*nlev,index3d)
     1020#endif
     1021
    6171022#ifdef CPP_XIOS
    618 !                        IF (iff .EQ. 1) THEN
    619 !                              CALL wxios_write_3D(var%name, Field3d(:,:,1:klev))
    620 !                        ENDIF
     1023                        IF (iff == 1) THEN
     1024                              CALL wxios_write_3D(var%name, Field3d(:,:,1:klev))
     1025                        ENDIF
    6211026#endif
    6221027                       
     
    6271032
    6281033                        IF (is_sequential) THEN
    629             !                  klon_mpi_begin=1
    630             !                  klon_mpi_end=klon
    6311034                              DO n=1, nlev
    6321035                                    DO ip=1, npstn
     
    6441047                              ENDDO
    6451048                        ENDIF
     1049#ifndef CPP_NO_IOIPSL
    6461050                        CALL histwrite(nid_files(iff),var%name,itau_iophy,fieldok,npstn*nlev,index3d)
     1051#endif
    6471052                  ENDIF
    6481053                  deallocate(index3d)
     
    6511056      ENDDO
    6521057!$OMP END MASTER   
     1058  ENDIF ! vars_defined
     1059  IF (prt_level >= 9) write(lunout,*)'End histrwrite3d ',var%name
    6531060  END SUBROUTINE histwrite3d_phy
    6541061 
     1062
     1063! VERSION DES HISTWRITE DEDIEES AU TOUT-XIOS-XML DEJA UTILISEE DANS PHYDEV
     1064#ifdef CPP_XIOS
     1065  SUBROUTINE histwrite2d_xios(field_name,field)
     1066  USE dimphy
     1067  USE mod_phys_lmdz_para
     1068  USE wxios
     1069
     1070
     1071  IMPLICIT NONE
     1072  INCLUDE 'dimensions.h'
     1073  INCLUDE 'iniprint.h'
     1074
     1075    CHARACTER(LEN=*), INTENT(IN) :: field_name
     1076    REAL, DIMENSION(:), INTENT(IN) :: field
     1077     
     1078    REAL,DIMENSION(klon_mpi) :: buffer_omp
     1079    INTEGER, allocatable, DIMENSION(:) :: index2d
     1080    REAL :: Field2d(iim,jj_nb)
     1081
     1082    INTEGER :: ip
     1083    REAL, ALLOCATABLE, DIMENSION(:) :: fieldok
     1084
     1085    IF (prt_level >= 9) WRITE(lunout,*)'Begin histrwrite2d_xios ',field_name
     1086
     1087    !Et sinon on.... écrit
     1088    IF (SIZE(field)/=klon) CALL abort_gcm('iophy::histwrite2d_xios','Field first DIMENSION not equal to klon',1)
     1089   
     1090    CALL Gather_omp(field,buffer_omp)   
     1091!$OMP MASTER
     1092    CALL grid1Dto2D_mpi(buffer_omp,Field2d)
     1093   
     1094!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1095!ATTENTION, STATIONS PAS GEREES !
     1096!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1097    !IF(.NOT.clef_stations(iff)) THEN
     1098    IF (.TRUE.) THEN
     1099        ALLOCATE(index2d(iim*jj_nb))
     1100        ALLOCATE(fieldok(iim*jj_nb))
     1101
     1102
     1103        CALL wxios_write_2D(field_name, Field2d)
     1104
     1105    ELSE
     1106        ALLOCATE(fieldok(npstn))
     1107        ALLOCATE(index2d(npstn))
     1108
     1109        IF (is_sequential) THEN
     1110            DO ip=1, npstn
     1111                fieldok(ip)=buffer_omp(nptabij(ip))
     1112            ENDDO
     1113        ELSE
     1114            DO ip=1, npstn
     1115                PRINT*,'histwrite2d_xios is_sequential npstn ip namenptabij',npstn,ip,field_name,nptabij(ip)
     1116                IF(nptabij(ip).GE.klon_mpi_begin.AND. &
     1117                nptabij(ip).LE.klon_mpi_end) THEN
     1118                    fieldok(ip)=buffer_omp(nptabij(ip)-klon_mpi_begin+1)
     1119                ENDIF
     1120            ENDDO
     1121        ENDIF
     1122
     1123    ENDIF
     1124                 
     1125    deallocate(index2d)
     1126    deallocate(fieldok)
     1127!$OMP END MASTER   
     1128
     1129  IF (prt_level >= 9) WRITE(lunout,*)'End histrwrite2d_xios ',field_name
     1130  END SUBROUTINE histwrite2d_xios
     1131
     1132
     1133! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE
     1134  SUBROUTINE histwrite3d_xios(field_name, field)
     1135  USE dimphy
     1136  USE mod_phys_lmdz_para
     1137  USE wxios
     1138
     1139
     1140  IMPLICIT NONE
     1141  INCLUDE 'dimensions.h'
     1142  INCLUDE 'iniprint.h'
     1143
     1144    CHARACTER(LEN=*), INTENT(IN) :: field_name
     1145    REAL, DIMENSION(:,:), INTENT(IN) :: field ! --> field(klon,:)
     1146
     1147    REAL,DIMENSION(klon_mpi,SIZE(field,2)) :: buffer_omp
     1148    REAL :: Field3d(iim,jj_nb,SIZE(field,2))
     1149    INTEGER :: ip, n, nlev
     1150    INTEGER, ALLOCATABLE, DIMENSION(:) :: index3d
     1151    REAL,ALLOCATABLE, DIMENSION(:,:) :: fieldok
     1152
     1153  IF (prt_level >= 9) write(lunout,*)'Begin histrwrite3d_xios ',field_name
     1154
     1155    !Et on.... écrit
     1156    IF (SIZE(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
     1157    nlev=SIZE(field,2)
     1158
     1159
     1160    CALL Gather_omp(field,buffer_omp)
     1161!$OMP MASTER
     1162    CALL grid1Dto2D_mpi(buffer_omp,field3d)
     1163
     1164!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1165!ATTENTION, STATIONS PAS GEREES !
     1166!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1167    !IF (.NOT.clef_stations(iff)) THEN
     1168    IF(.TRUE.)THEN
     1169        ALLOCATE(index3d(iim*jj_nb*nlev))
     1170        ALLOCATE(fieldok(iim*jj_nb,nlev))
     1171        CALL wxios_write_3D(field_name, Field3d(:,:,1:klev))
     1172                       
     1173    ELSE
     1174        nlev=size(field,2)
     1175        ALLOCATE(index3d(npstn*nlev))
     1176        ALLOCATE(fieldok(npstn,nlev))
     1177
     1178        IF (is_sequential) THEN
     1179            DO n=1, nlev
     1180                DO ip=1, npstn
     1181                    fieldok(ip,n)=buffer_omp(nptabij(ip),n)
     1182                ENDDO
     1183            ENDDO
     1184        ELSE
     1185            DO n=1, nlev
     1186                DO ip=1, npstn
     1187                    IF(nptabij(ip).GE.klon_mpi_begin.AND. &
     1188                    nptabij(ip).LE.klon_mpi_end) THEN
     1189                        fieldok(ip,n)=buffer_omp(nptabij(ip)-klon_mpi_begin+1,n)
     1190                    ENDIF
     1191                ENDDO
     1192            ENDDO
     1193        ENDIF
     1194    ENDIF
     1195    deallocate(index3d)
     1196    deallocate(fieldok)
     1197!$OMP END MASTER   
     1198
     1199  IF (prt_level >= 9) write(lunout,*)'End histrwrite3d_xios ',field_name
     1200  END SUBROUTINE histwrite3d_xios
     1201#endif
    6551202end module iophy
  • LMDZ5/branches/testing/libf/phylmd/mod_phys_lmdz_para.F90

    r1664 r1864  
    3232       is_master=.FALSE.
    3333     ENDIF
    34     CALL Test_transfert
     34     CALL Test_transfert
    3535!$OMP END PARALLEL   
    3636     IF (is_using_mpi .OR. is_using_omp) THEN
  • LMDZ5/branches/testing/libf/phylmd/pbl_surface_mod.F90

    r1795 r1864  
    174174       t,         q,         u,        v,             &
    175175       pplay,     paprs,     pctsrf,                  &
    176        ts,        alb1,      alb2,ustar, u10m, v10m, &
     176       ts,        alb1, alb2,ustar, u10m, v10m,wstar, &
    177177       lwdown_m,  cdragh,    cdragm,   zu1,    zv1,   &
    178178       alb1_m,    alb2_m,    zxsens,   zxevap,        &
     
    294294    REAL, DIMENSION(klon, nbsrf), INTENT(INOUT)     :: alb2    ! albedo in near infra-red SW interval
    295295    REAL, DIMENSION(klon, nbsrf), INTENT(INOUT)     :: ustar   ! u* (m/s)
     296    REAL, DIMENSION(klon, nbsrf+1), INTENT(INOUT)   :: wstar   ! w* (m/s)
    296297    REAL, DIMENSION(klon, nbsrf), INTENT(INOUT)     :: u10m    ! u speed at 10m
    297298    REAL, DIMENSION(klon, nbsrf), INTENT(INOUT)     :: v10m    ! v speed at 10m
     
    406407    REAL, DIMENSION(klon)              :: yt2m, yq2m, yu10m
    407408    REAL, DIMENSION(klon)              :: yustar
     409    REAL, DIMENSION(klon)              :: ywstar
    408410    REAL, DIMENSION(klon)              :: ywindsp
    409411    REAL, DIMENSION(klon)              :: yt10m, yq10m
     
    10651067       q2m(:,nsrf)    = 0.
    10661068       ustar(:,nsrf)   = 0.
     1069       wstar(:,nsrf)   = 0.
    10671070       u10m(:,nsrf)   = 0.
    10681071       v10m(:,nsrf)   = 0.
     
    11451148
    11461149!   print*,'OK pbl 5'
    1147        CALL HBTM(knon, ypaprs, ypplay, &
    1148             yt2m,yt10m,yq2m,yq10m,yustar, &
     1150       CALL hbtm(knon, ypaprs, ypplay, &
     1151            yt2m,yt10m,yq2m,yq10m,yustar,ywstar, &
    11491152            y_flux_t,y_flux_q,yu,yv,yt,yq, &
    11501153            ypblh,ycapCL,yoliqCL,ycteiCL,ypblT, &
     
    11541157          i = ni(j)
    11551158          pblh(i,nsrf)   = ypblh(j)
     1159          wstar(i,nsrf)  = ywstar(j)
    11561160          plcl(i,nsrf)   = ylcl(j)
    11571161          capCL(i,nsrf)  = ycapCL(j)
     
    12151219    s_therm(:) = 0.0 ; s_trmb1(:) = 0.0
    12161220    s_trmb2(:) = 0.0 ; s_trmb3(:) = 0.0
     1221    wstar(:,is_ave)=0.
    12171222   
    12181223!   print*,'OK pbl 9'
     
    12331238          zq2m(i)  = zq2m(i)  + q2m(i,nsrf)  * pctsrf(i,nsrf)
    12341239          zustar(i) = zustar(i) + ustar(i,nsrf) * pctsrf(i,nsrf)
     1240          wstar(i,is_ave)=wstar(i,is_ave)+wstar(i,nsrf)*pctsrf(i,nsrf)
    12351241          zu10m(i) = zu10m(i) + u10m(i,nsrf) * pctsrf(i,nsrf)
    12361242          zv10m(i) = zv10m(i) + v10m(i,nsrf) * pctsrf(i,nsrf)
  • LMDZ5/branches/testing/libf/phylmd/phys_local_var_mod.F90

    r1795 r1864  
    33!
    44      MODULE phys_local_var_mod
    5 
    65! Variables locales pour effectuer les appels en serie
    76!======================================================================
     
    187186!$OMP THREADPRIVATE(topswcf_aerop, solswcf_aerop)
    188187
     188
     189!Ajout de celles nécessaires au phys_output_write_mod
     190      REAL, SAVE, ALLOCATABLE :: slp(:)
     191!$OMP THREADPRIVATE(slp)
     192      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: sens, flwp, fiwp
     193!$OMP THREADPRIVATE(sens, flwp, fiwp)
     194      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: ale_wake, alp_wake, bils
     195!$OMP THREADPRIVATE(ale_wake, alp_wake, bils)
     196      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: cdragm, cdragh
     197!$OMP THREADPRIVATE(cdragm, cdragh)
     198      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: cldh, cldl, cldm, cldq, cldt, qsat2m, qsol
     199!$OMP THREADPRIVATE(cldh, cldl, cldm, cldq, cldt, qsat2m, qsol)
     200      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: dthmin, evap, fder, plcl, plfc, prw
     201!$OMP THREADPRIVATE(dthmin, evap, fder, plcl, plfc, prw)
     202      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zustar, zu10m, zv10m, rh2m
     203!$OMP THREADPRIVATE(zustar, zu10m, zv10m, rh2m)
     204      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: s_lcl, s_pblh, s_pblt, s_therm
     205!$OMP THREADPRIVATE(s_lcl, s_pblh, s_pblt, s_therm)
     206      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: slab_wfbils
     207!$OMP THREADPRIVATE(slab_wfbils)
     208      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: tpot, tpote, ue, uq, ve, vq, zxffonte
     209!$OMP THREADPRIVATE(tpot, tpote, ue, uq, ve, vq, zxffonte)
     210      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxfqcalving
     211!$OMP THREADPRIVATE(zxfqcalving)
     212      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxfluxlat, zxrugs, zxtsol, snow_lsc, zxfqfonte
     213!$OMP THREADPRIVATE(zxfluxlat, zxrugs, zxtsol, snow_lsc, zxfqfonte)
     214      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxqsurf, rain_lsc
     215!$OMP THREADPRIVATE(zxqsurf, rain_lsc)
     216      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: wake_h, wbeff, zmax_th, zq2m, zt2m
     217!$OMP THREADPRIVATE(wake_h, wbeff, zmax_th, zq2m, zt2m)
     218      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: weak_inversion
     219!$OMP THREADPRIVATE(weak_inversion)
     220      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: ale_bl_stat,alp_bl_conv,alp_bl_det
     221!$OMP THREADPRIVATE(ale_bl_stat,alp_bl_conv,alp_bl_det)
     222      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: alp_bl_fluct_m,alp_bl_fluct_tke
     223!$OMP THREADPRIVATE(alp_bl_fluct_m,alp_bl_fluct_tke)
     224      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: alp_bl_stat, n2, s2
     225!$OMP THREADPRIVATE(alp_bl_stat, n2, s2)
     226      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: proba_notrig, random_notrig
     227!$OMP THREADPRIVATE(proba_notrig, random_notrig)
     228      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: fsolsw, wfbils, wfbilo
     229!$OMP THREADPRIVATE(fsolsw, wfbils, wfbilo)
     230      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:)  :: t2m, fevap, fluxlat, fsollw,evap_pot
     231!$OMP THREADPRIVATE(t2m, fevap, fluxlat, fsollw,evap_pot)
     232      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: dnwd, dnwd0, upwd, omega
     233!$OMP THREADPRIVATE(dnwd, dnwd0, upwd, omega)
     234!      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: coefh, coefm, lambda_th
     235      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: lambda_th
     236!$OMP THREADPRIVATE(lambda_th)
     237      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: cldemi, cldfra, cldtau, fiwc, fl, re, flwc
     238!$OMP THREADPRIVATE(cldemi, cldfra, cldtau, fiwc, fl, re, flwc)
     239      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: ref_liq, ref_ice, theta, zphi
     240!$OMP THREADPRIVATE(ref_liq, ref_ice, theta, zphi)
     241      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: wake_omg, zx_rh
     242!$OMP THREADPRIVATE(wake_omg, zx_rh)
     243      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: frugs, agesno
     244!$OMP THREADPRIVATE(frugs, agesno)
     245      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: pmflxr, pmflxs, prfl, psfl, fraca
     246!$OMP THREADPRIVATE(pmflxr, pmflxs, prfl, psfl, fraca)
     247      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: Vprecip, zw2
     248!$OMP THREADPRIVATE(Vprecip, zw2)
     249      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: pmfd, pmfu
     250!$OMP THREADPRIVATE(pmfd, pmfu)
     251      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: fluxt, fluxu, fluxv
     252!$OMP THREADPRIVATE(fluxt, fluxu, fluxv)
     253      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: uwriteSTD, vwriteSTD, wwriteSTD
     254!$OMP THREADPRIVATE(uwriteSTD, vwriteSTD, wwriteSTD)
     255      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: phiwriteSTD, qwriteSTD, twriteSTD, rhwriteSTD
     256!$OMP THREADPRIVATE(phiwriteSTD, qwriteSTD, twriteSTD, rhwriteSTD)
     257
     258! ug et d'autres encore:
     259      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: wdtrainA, wdtrainM
     260!$OMP THREADPRIVATE(wdtrainA, wdtrainM)
     261      REAL,ALLOCATABLE,SAVE,DIMENSION(:,:) :: beta_prec
     262!$OMP THREADPRIVATE(beta_prec)
     263      REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: rneb
     264!$OMP THREADPRIVATE(rneb)
     265
    189266CONTAINS
    190267
     
    195272USE aero_mod
    196273USE indice_sol_mod
     274USE phys_output_var_mod
     275USE phys_state_var_mod
    197276
    198277IMPLICIT NONE
     
    279358      ALLOCATE(topswcf_aerop(klon,naero_grp), solswcf_aerop(klon,naero_grp))
    280359
     360! FH Ajout de celles nécessaires au phys_output_write_mod
     361
     362      ALLOCATE(slp(klon))
     363      ALLOCATE(ale_wake(klon), alp_wake(klon), bils(klon))
     364      ALLOCATE(cdragm(klon), cdragh(klon), cldh(klon), cldl(klon))
     365      ALLOCATE(cldm(klon), cldq(klon), cldt(klon), qsat2m(klon), qsol(klon))
     366      ALLOCATE(dthmin(klon), evap(klon), fder(klon), plcl(klon), plfc(klon))
     367      ALLOCATE(prw(klon), zustar(klon), zu10m(klon), zv10m(klon), rh2m(klon))
     368      ALLOCATE(s_lcl(klon))
     369      ALLOCATE(s_pblh(klon), s_pblt(klon), s_therm(klon))
     370      ALLOCATE(slab_wfbils(klon), tpot(klon), tpote(klon), ue(klon))
     371      ALLOCATE(uq(klon), ve(klon), vq(klon), zxffonte(klon))
     372      ALLOCATE(zxfqcalving(klon), zxfluxlat(klon), zxrugs(klon))
     373      ALLOCATE(zxtsol(klon), snow_lsc(klon), zxfqfonte(klon), zxqsurf(klon))
     374      ALLOCATE(rain_lsc(klon), wake_h(klon), wbeff(klon), zmax_th(klon))
     375      ALLOCATE(zq2m(klon), zt2m(klon), weak_inversion(klon))
     376      ALLOCATE(sens(klon), flwp(klon), fiwp(klon))
     377      ALLOCATE(ale_bl_stat(klon), alp_bl_conv(klon), alp_bl_det(klon))
     378      ALLOCATE(alp_bl_fluct_m(klon), alp_bl_fluct_tke(klon))
     379      ALLOCATE(alp_bl_stat(klon), n2(klon), s2(klon))
     380      ALLOCATE(proba_notrig(klon), random_notrig(klon))
     381
     382      ALLOCATE(dnwd(klon, klev), dnwd0(klon, klev))
     383!      ALLOCATE(upwd(klon, klev), omega(klon, klev), coefh(klon, klev))
     384      ALLOCATE(upwd(klon, klev), omega(klon, klev))
     385!      ALLOCATE(coefm(klon, klev), lambda_th(klon, klev), cldemi(klon, klev))
     386      ALLOCATE(lambda_th(klon, klev), cldemi(klon, klev))
     387      ALLOCATE(cldfra(klon, klev), cldtau(klon, klev), fiwc(klon, klev))
     388      ALLOCATE(fl(klon, klev), re(klon, klev), flwc(klon, klev))
     389      ALLOCATE(ref_liq(klon, klev), ref_ice(klon, klev), theta(klon, klev))
     390      ALLOCATE(zphi(klon, klev), wake_omg(klon, klev), zx_rh(klon, klev))
     391      ALLOCATE(pmfd(klon, klev), pmfu(klon, klev))
     392
     393      ALLOCATE(t2m(klon, nbsrf), fevap(klon, nbsrf), fluxlat(klon, nbsrf))
     394      ALLOCATE(frugs(klon, nbsrf), agesno(klon, nbsrf), fsollw(klon, nbsrf))
     395      ALLOCATE(fsolsw(klon, nbsrf), wfbils(klon, nbsrf), wfbilo(klon, nbsrf))
     396      ALLOCATE(evap_pot(klon, nbsrf))
     397
     398      ALLOCATE(pmflxr(klon, klev+1), pmflxs(klon, klev+1), prfl(klon, klev+1))
     399      ALLOCATE(psfl(klon, klev+1), fraca(klon, klev+1), Vprecip(klon, klev+1))
     400      ALLOCATE(zw2(klon, klev+1))
     401
     402      ALLOCATE(fluxu(klon, klev, nbsrf), fluxv(klon, klev, nbsrf))
     403      ALLOCATE(fluxt(klon, klev, nbsrf))
     404
     405      ALLOCATE(uwriteSTD(klon,nlevSTD,nfiles), vwriteSTD(klon,nlevSTD,nfiles))
     406      ALLOCATE(wwriteSTD(klon,nlevSTD,nfiles), phiwriteSTD(klon,nlevSTD,nfiles))
     407      ALLOCATE(qwriteSTD(klon,nlevSTD,nfiles), twriteSTD(klon,nlevSTD,nfiles))
     408      ALLOCATE(rhwriteSTD(klon,nlevSTD,nfiles))
     409
     410! ug et d'autres encore:
     411      ALLOCATE(wdtrainA(klon,klev),wdtrainM(klon,klev))
     412      ALLOCATE(beta_prec(klon,klev))
     413      ALLOCATE(rneb(klon,klev))
     414
     415
    281416END SUBROUTINE phys_local_var_init
    282417
     
    368503      deallocate(topswcf_aerop, solswcf_aerop)
    369504
     505
     506! FH Ajout de celles nécessaires au phys_output_write_mod
     507      DEALLOCATE(slp)
     508      DEALLOCATE(ale_wake, alp_wake, bils)
     509      DEALLOCATE(cdragm, cdragh, cldh, cldl)
     510      DEALLOCATE(cldm, cldq, cldt, qsat2m, qsol)
     511      DEALLOCATE(dthmin, evap, fder, plcl, plfc)
     512      DEALLOCATE(prw, zustar, zu10m, zv10m, rh2m, s_lcl)
     513      DEALLOCATE(s_pblh, s_pblt, s_therm)
     514      DEALLOCATE(slab_wfbils, tpot, tpote, ue)
     515      DEALLOCATE(uq, ve, vq, zxffonte)
     516      DEALLOCATE(zxfqcalving, zxfluxlat, zxrugs)
     517      DEALLOCATE(zxtsol, snow_lsc, zxfqfonte, zxqsurf)
     518      DEALLOCATE(rain_lsc, wake_h, wbeff, zmax_th)
     519      DEALLOCATE(zq2m, zt2m, weak_inversion)
     520      DEALLOCATE(sens, flwp, fiwp)
     521      DEALLOCATE(ale_bl_stat,alp_bl_conv,alp_bl_det)
     522      DEALLOCATE(alp_bl_fluct_m,alp_bl_fluct_tke)
     523      DEALLOCATE(alp_bl_stat, n2, s2)
     524      DEALLOCATE(proba_notrig, random_notrig)
     525
     526      DEALLOCATE(dnwd, dnwd0)
     527!      DEALLOCATE(upwd, omega, coefh)
     528      DEALLOCATE(upwd, omega)
     529!      DEALLOCATE(coefm, lambda_th, cldemi)
     530      DEALLOCATE(lambda_th, cldemi)
     531      DEALLOCATE(cldfra, cldtau, fiwc)
     532      DEALLOCATE(fl, re, flwc)
     533      DEALLOCATE(ref_liq, ref_ice, theta)
     534      DEALLOCATE(zphi, wake_omg, zx_rh)
     535      DEALLOCATE(pmfd, pmfu)
     536
     537      DEALLOCATE(t2m, fevap, fluxlat)
     538      DEALLOCATE(frugs, agesno, fsollw, evap_pot)
     539      DEALLOCATE(fsolsw, wfbils, wfbilo)
     540
     541      DEALLOCATE(pmflxr, pmflxs, prfl)
     542      DEALLOCATE(psfl, fraca, Vprecip)
     543      DEALLOCATE(zw2)
     544
     545      DEALLOCATE(fluxu, fluxv)
     546      DEALLOCATE(fluxt)
     547
     548      DEALLOCATE(uwriteSTD, vwriteSTD)
     549      DEALLOCATE(wwriteSTD, phiwriteSTD)
     550      DEALLOCATE(qwriteSTD, twriteSTD, rhwriteSTD)
     551
     552! ug et d'autres encore:
     553      DEALLOCATE(wdtrainA, wdtrainM)
     554      DEALLOCATE(beta_prec)
     555      DEALLOCATE(rneb)
     556
    370557END SUBROUTINE phys_local_var_end
    371558
  • LMDZ5/branches/testing/libf/phylmd/phys_output_ctrlout_mod.F90

    r1795 r1864  
    1919!!! Comosantes de la coordonnee sigma-hybride
    2020!!! Ap et Bp
    21   TYPE(ctrl_out), SAVE :: o_Ahyb = ctrl_out((/ 1, 1, 1, 1, 1, 1 /), &
    22         'Ap', '', '', (/ ('', i=1, 6) /))
    23   TYPE(ctrl_out), SAVE :: o_Bhyb = ctrl_out((/ 1, 1, 1, 1, 1, 1 /), &
    24         'Bp', '', '', (/ ('', i=1, 6) /))
    25   TYPE(ctrl_out), SAVE :: o_Alt = ctrl_out((/ 1, 1, 1, 1, 1, 1 /), &
    26         'Alt', '', '', (/ ('', i=1, 6) /))
     21  TYPE(ctrl_out), SAVE :: o_Ahyb = ctrl_out((/ 1, 1, 1, 1, 1, 1, 11, 11, 11 /), &
     22    'Ap', '', '', (/ ('', i=1, 9) /))
     23  TYPE(ctrl_out), SAVE :: o_Bhyb = ctrl_out((/ 1, 1, 1, 1, 1, 1, 11, 11, 11 /), &
     24    'Bp', '', '', (/ ('', i=1, 9) /))
     25  TYPE(ctrl_out), SAVE :: o_Alt = ctrl_out((/ 1, 1, 1, 1, 1, 1, 11, 11, 11 /), &
     26    'Alt', '', '', (/ ('', i=1, 9) /))
    2727
    2828!!! 1D
    29   TYPE(ctrl_out), SAVE :: o_phis = ctrl_out((/ 1, 1, 10, 5, 1, 1 /), &
    30         'phis', 'Surface geop.height', 'm2/s2', (/ ('', i=1, 6) /))
    31   TYPE(ctrl_out), SAVE :: o_aire = ctrl_out((/ 1, 1, 10,  10, 1, 1 /), &
    32         'aire', 'Grid area', '-', (/ 'once', 'once', 'once', 'once', 'once', 'once' /))
    33   TYPE(ctrl_out), SAVE :: o_contfracATM = ctrl_out((/ 10, 1,  1, 10, 10, 10 /), &
    34         'contfracATM', '% sfce ter+lic', '-', &
    35       (/ "once", "once", "once", "once", "once", "once" /))
    36   TYPE(ctrl_out), SAVE :: o_contfracOR = ctrl_out((/ 10, 1,  1, 10, 10, 10 /), &
    37         'contfracOR', '% sfce terre OR', '-', (/ ('', i=1, 6) /))
    38   TYPE(ctrl_out), SAVE :: o_aireTER = ctrl_out((/ 10, 10, 1, 10, 10, 10 /), &
    39         'aireTER', 'Grid area CONT', '-', (/ ('', i=1, 6) /))
     29  TYPE(ctrl_out), SAVE :: o_phis = ctrl_out((/ 1, 1, 10, 5, 1, 1, 11, 11, 11 /), &
     30    'phis', 'Surface geop.height', 'm2/s2', (/ ('', i=1, 9) /))
     31  TYPE(ctrl_out), SAVE :: o_aire = ctrl_out((/ 1, 1, 10,  10, 1, 1, 11, 11, 11 /), &
     32    'aire', 'Grid area', '-', (/ 'once', 'once', 'once', 'once', 'once', 'once', &
     33                                     'once', 'once', 'once' /))
     34  TYPE(ctrl_out), SAVE :: o_contfracATM = ctrl_out((/ 10, 1,  1, 10, 10, 10, 11, 11, 11 /), &
     35    'contfracATM', '% sfce ter+lic', '-', &
     36       (/ 'once', 'once', 'once', 'once', 'once', 'once', 'once', 'once', 'once' /))
     37  TYPE(ctrl_out), SAVE :: o_contfracOR = ctrl_out((/ 10, 1,  10, 10, 10, 10, 11, 11, 11 /), &
     38    'contfracOR', '% sfce terre OR', '-', (/ ('', i=1, 9) /))
     39  TYPE(ctrl_out), SAVE :: o_aireTER = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     40    'aireTER', 'Grid area CONT', '-', (/ ('', i=1, 9) /))
    4041
    4142!!! 2D
    42   TYPE(ctrl_out), SAVE :: o_flat = ctrl_out((/ 5, 1, 10, 10, 5, 10 /), &
    43         'flat', 'Latent heat flux', 'W/m2', (/ ('', i=1, 6) /))
    44   TYPE(ctrl_out), SAVE :: o_slp = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    45         'slp', 'Sea Level Pressure', 'Pa', (/ ('', i=1, 6) /))
    46   TYPE(ctrl_out), SAVE :: o_tsol = ctrl_out((/ 1, 1, 1, 5, 10, 10 /), &
    47         'tsol', 'Surface Temperature', 'K', (/ ('', i=1, 6) /))
    48   TYPE(ctrl_out), SAVE :: o_t2m = ctrl_out((/ 1, 1, 1, 5, 10, 10 /), &
    49         't2m', 'Temperature 2m', 'K', (/ ('', i=1, 6) /))
    50   TYPE(ctrl_out), SAVE :: o_t2m_min = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    51         't2m_min', 'Temp 2m min', 'K', &
    52       (/ "t_min(X)", "t_min(X)", "t_min(X)", "t_min(X)", "t_min(X)", "t_min(X)" /))
    53   TYPE(ctrl_out), SAVE :: o_t2m_max = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    54         't2m_max', 'Temp 2m max', 'K', &
    55       (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /))
     43  TYPE(ctrl_out), SAVE :: o_flat = ctrl_out((/ 5, 1, 10, 10, 5, 10, 11, 11, 11 /), &
     44    'flat', 'Latent heat flux', 'W/m2', (/ ('', i=1, 9) /))
     45  TYPE(ctrl_out), SAVE :: o_slp = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     46    'slp', 'Sea Level Pressure', 'Pa', (/ ('', i=1, 9) /))
     47  TYPE(ctrl_out), SAVE :: o_tsol = ctrl_out((/ 1, 1, 1, 5, 10, 10, 11, 11, 11 /), &
     48    'tsol', 'Surface Temperature', 'K', (/ ('', i=1, 9) /))
     49  TYPE(ctrl_out), SAVE :: o_t2m = ctrl_out((/ 1, 1, 1, 5, 10, 10, 11, 11, 11 /), &
     50    't2m', 'Temperature 2m', 'K', (/ ('', i=1, 9) /))
     51  TYPE(ctrl_out), SAVE :: o_t2m_min = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     52    't2m_min', 'Temp 2m min', 'K', &
     53      (/ "t_min(X)", "t_min(X)", "t_min(X)", "t_min(X)", "t_min(X)", "t_min(X)", "t_min(X)", "t_min(X)", "t_min(X)" /))
     54  TYPE(ctrl_out), SAVE :: o_t2m_max = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     55    't2m_max', 'Temp 2m max', 'K', &
     56      (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", &
     57         "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /))
    5658
    5759  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_t2m_srf = (/ &
    58       ctrl_out((/ 10, 6, 10, 10, 10, 10 /), &
    59         't2m_ter', "Temp 2m "//clnsurf(1), "K", (/ ('', i=1, 6) /)), &
    60       ctrl_out((/ 10, 6, 10, 10, 10, 10 /), &
    61         't2m_lic', "Temp 2m "//clnsurf(2), "K", (/ ('', i=1, 6) /)), &
    62       ctrl_out((/ 10, 6, 10, 10, 10, 10 /), &
    63         't2m_oce', "Temp 2m "//clnsurf(3), "K", (/ ('', i=1, 6) /)), &
    64       ctrl_out((/ 10, 6, 10, 10, 10, 10 /), &
    65         't2m_sic', "Temp 2m "//clnsurf(4), "K", (/ ('', i=1, 6) /)) /)
    66 
    67   TYPE(ctrl_out), SAVE :: o_wind10m = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    68         'wind10m', '10-m wind speed', 'm/s', (/ ('', i=1, 6) /))
    69   TYPE(ctrl_out), SAVE :: o_wind10max = ctrl_out((/ 10, 1, 10, 10, 10, 10 /), &
    70         'wind10max', '10m wind speed max', 'm/s', (/ ('', i=1, 6) /))
    71   TYPE(ctrl_out), SAVE :: o_sicf = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    72         'sicf', 'Sea-ice fraction', '-', (/ ('', i=1, 6) /))
    73   TYPE(ctrl_out), SAVE :: o_q2m = ctrl_out((/ 1, 1, 1, 5, 10, 10 /), &
    74         'q2m', 'Specific humidity 2m', 'kg/kg', (/ ('', i=1, 6) /))
    75   TYPE(ctrl_out), SAVE :: o_ustar = ctrl_out((/ 1, 1, 1, 5, 10, 10 /), &
    76         'ustar', 'Friction velocity', 'm/s', (/ ('', i=1, 6) /))
    77   TYPE(ctrl_out), SAVE :: o_u10m = ctrl_out((/ 1, 1, 1, 5, 10, 10 /), &
    78         'u10m', 'Vent zonal 10m', 'm/s', (/ ('', i=1, 6) /))
    79   TYPE(ctrl_out), SAVE :: o_v10m = ctrl_out((/ 1, 1, 1, 5, 10, 10 /), &
    80         'v10m', 'Vent meridien 10m', 'm/s', (/ ('', i=1, 6) /))
    81   TYPE(ctrl_out), SAVE :: o_psol = ctrl_out((/ 1, 1, 1, 5, 10, 10 /), &
    82         'psol', 'Surface Pressure', 'Pa', (/ ('', i=1, 6) /))
    83   TYPE(ctrl_out), SAVE :: o_qsurf = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    84         'qsurf', 'Surface Air humidity', 'kg/kg', (/ ('', i=1, 6) /))
     60      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     61    't2m_ter', "Temp 2m "//clnsurf(1), "K", (/ ('', i=1, 9) /)), &
     62      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     63    't2m_lic', "Temp 2m "//clnsurf(2), "K", (/ ('', i=1, 9) /)), &
     64      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     65    't2m_oce', "Temp 2m "//clnsurf(3), "K", (/ ('', i=1, 9) /)), &
     66      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     67    't2m_sic', "Temp 2m "//clnsurf(4), "K", (/ ('', i=1, 9) /)) /)
     68
     69  TYPE(ctrl_out), SAVE :: o_wind10m = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     70    'wind10m', '10-m wind speed', 'm/s', (/ ('', i=1, 9) /))
     71  TYPE(ctrl_out), SAVE :: o_wind10max = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     72    'wind10max', '10m wind speed max', 'm/s', (/ ('', i=1, 9) /))
     73  TYPE(ctrl_out), SAVE :: o_sicf = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     74    'sicf', 'Sea-ice fraction', '-', (/ ('', i=1, 9) /))
     75  TYPE(ctrl_out), SAVE :: o_q2m = ctrl_out((/ 1, 1, 1, 5, 10, 10, 11, 11, 11 /), &
     76    'q2m', 'Specific humidity 2m', 'kg/kg', (/ ('', i=1, 9) /))
     77  TYPE(ctrl_out), SAVE :: o_ustar = ctrl_out((/ 1, 1, 10, 5, 10, 10, 11, 11, 11 /), &
     78    'ustar', 'Friction velocity', 'm/s', (/ ('', i=1, 9) /))
     79  TYPE(ctrl_out), SAVE :: o_u10m = ctrl_out((/ 1, 1, 1, 5, 10, 10, 11, 11, 11 /), &
     80    'u10m', 'Vent zonal 10m', 'm/s', (/ ('', i=1, 9) /))
     81  TYPE(ctrl_out), SAVE :: o_v10m = ctrl_out((/ 1, 1, 1, 5, 10, 10, 11, 11, 11 /), &
     82    'v10m', 'Vent meridien 10m', 'm/s', (/ ('', i=1, 9) /))
     83  TYPE(ctrl_out), SAVE :: o_psol = ctrl_out((/ 1, 1, 1, 5, 10, 10, 11, 11, 11 /), &
     84    'psol', 'Surface Pressure', 'Pa', (/ ('', i=1, 9) /))
     85  TYPE(ctrl_out), SAVE :: o_qsurf = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     86    'qsurf', 'Surface Air humidity', 'kg/kg', (/ ('', i=1, 9) /))
    8587
    8688  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_ustar_srf     = (/ &
    87       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'ustar_ter', &
    88       "Friction velocity "//clnsurf(1),"m/s", (/ ('', i=1, 6) /)), &
    89       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'ustar_lic', &
    90       "Friction velocity "//clnsurf(2),"m/s", (/ ('', i=1, 6) /)), &
    91       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'ustar_oce', &
    92       "Friction velocity "//clnsurf(3),"m/s", (/ ('', i=1, 6) /)), &
    93       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'ustar_sic', &
    94       "Friction velocity "//clnsurf(4),"m/s", (/ ('', i=1, 6) /)) /)
     89      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'ustar_ter', &
     90      "Friction velocity "//clnsurf(1),"m/s", (/ ('', i=1, 9) /)), &
     91      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'ustar_lic', &
     92      "Friction velocity "//clnsurf(2),"m/s", (/ ('', i=1, 9) /)), &
     93      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'ustar_oce', &
     94      "Friction velocity "//clnsurf(3),"m/s", (/ ('', i=1, 9) /)), &
     95      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'ustar_sic', &
     96      "Friction velocity "//clnsurf(4),"m/s", (/ ('', i=1, 9) /)) /)
     97
     98  TYPE(ctrl_out), SAVE, DIMENSION(5) :: o_wstar         = (/ &
     99      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'wstar_ter', &
     100      "Friction velocity "//clnsurf(1),"m/s", (/ ('', i=1, 9) /)), &
     101      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'wstar_lic', &
     102      "Friction velocity "//clnsurf(2),"m/s", (/ ('', i=1, 9) /)), &
     103      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'wstar_oce', &
     104      "Friction velocity "//clnsurf(3),"m/s", (/ ('', i=1, 9) /)), &
     105      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'wstar_sic', &
     106      "Friction velocity "//clnsurf(4),"m/s", (/ ('', i=1, 9) /)), &
     107      ctrl_out((/ 5, 5, 10, 10, 10, 10, 11, 11, 11 /),'wstar', &
     108      "w* convective velocity "//clnsurf(4),"m/s", (/ ('', i=1, 9) /)) /)
    95109
    96110  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_u10m_srf     = (/ &
    97       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_ter', &
    98       "Vent Zonal 10m "//clnsurf(1),"m/s", (/ ('', i=1, 6) /)), &
    99       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_lic', &
    100       "Vent Zonal 10m "//clnsurf(2),"m/s", (/ ('', i=1, 6) /)), &
    101       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_oce', &
    102       "Vent Zonal 10m "//clnsurf(3),"m/s", (/ ('', i=1, 6) /)), &
    103       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'u10m_sic', &
    104       "Vent Zonal 10m "//clnsurf(4),"m/s", (/ ('', i=1, 6) /)) /)
     111      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'u10m_ter', &
     112      "Vent Zonal 10m "//clnsurf(1),"m/s", (/ ('', i=1, 9) /)), &
     113      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'u10m_lic', &
     114      "Vent Zonal 10m "//clnsurf(2),"m/s", (/ ('', i=1, 9) /)), &
     115      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'u10m_oce', &
     116      "Vent Zonal 10m "//clnsurf(3),"m/s", (/ ('', i=1, 9) /)), &
     117      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'u10m_sic', &
     118      "Vent Zonal 10m "//clnsurf(4),"m/s", (/ ('', i=1, 9) /)) /)
    105119
    106120  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_v10m_srf     = (/ &
    107       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_ter', &
    108       "Vent meredien 10m "//clnsurf(1),"m/s", (/ ('', i=1, 6) /)), &
    109       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_lic', &
    110       "Vent meredien 10m "//clnsurf(2),"m/s", (/ ('', i=1, 6) /)), &
    111       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_oce', &
    112       "Vent meredien 10m "//clnsurf(3),"m/s", (/ ('', i=1, 6) /)), &
    113       ctrl_out((/ 10, 6, 10, 10, 10, 10 /),'v10m_sic', &
    114       "Vent meredien 10m "//clnsurf(4),"m/s", (/ ('', i=1, 6) /)) /)
    115 
    116   TYPE(ctrl_out), SAVE :: o_qsol = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    117         'qsol', 'Soil watter content', 'mm', (/ ('', i=1, 6) /))
    118   TYPE(ctrl_out), SAVE :: o_ndayrain = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    119         'ndayrain', 'Number of dayrain(liq+sol)', '-', &
    120       (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)" /))
    121   TYPE(ctrl_out), SAVE :: o_precip = ctrl_out((/ 1, 1, 1, 10, 5, 10 /), &
    122         'precip', 'Precip Totale liq+sol', 'kg/(s*m2)', (/ ('', i=1, 6) /))
    123   TYPE(ctrl_out), SAVE :: o_plul = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    124         'plul', 'Large-scale Precip.', 'kg/(s*m2)', (/ ('', i=1, 6) /))
    125   TYPE(ctrl_out), SAVE :: o_pluc = ctrl_out((/ 1, 1, 1, 10, 5, 10 /), &
    126         'pluc', 'Convective Precip.', 'kg/(s*m2)', (/ ('', i=1, 6) /))
    127   TYPE(ctrl_out), SAVE :: o_snow = ctrl_out((/ 1, 1, 10, 10, 5, 10 /), &
    128         'snow', 'Snow fall', 'kg/(s*m2)', (/ ('', i=1, 6) /))
    129   TYPE(ctrl_out), SAVE :: o_evap = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    130         'evap', 'Evaporat', 'kg/(s*m2)', (/ ('', i=1, 6) /))
     121      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'v10m_ter', &
     122      "Vent meredien 10m "//clnsurf(1),"m/s", (/ ('', i=1, 9) /)), &
     123      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'v10m_lic', &
     124      "Vent meredien 10m "//clnsurf(2),"m/s", (/ ('', i=1, 9) /)), &
     125      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'v10m_oce', &
     126      "Vent meredien 10m "//clnsurf(3),"m/s", (/ ('', i=1, 9) /)), &
     127      ctrl_out((/ 10, 6, 10, 10, 10, 10, 11, 11, 11 /),'v10m_sic', &
     128      "Vent meredien 10m "//clnsurf(4),"m/s", (/ ('', i=1, 9) /)) /)
     129
     130  TYPE(ctrl_out), SAVE :: o_qsol = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     131    'qsol', 'Soil watter content', 'mm', (/ ('', i=1, 9) /))
     132  TYPE(ctrl_out), SAVE :: o_ndayrain = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     133    'ndayrain', 'Number of dayrain(liq+sol)', '-', &
     134      (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)" /))
     135  TYPE(ctrl_out), SAVE :: o_precip = ctrl_out((/ 1, 1, 1, 10, 5, 10, 11, 11, 11 /), &
     136    'precip', 'Precip Totale liq+sol', 'kg/(s*m2)', (/ ('', i=1, 9) /))
     137  TYPE(ctrl_out), SAVE :: o_plul = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     138    'plul', 'Large-scale Precip.', 'kg/(s*m2)', (/ ('', i=1, 9) /))
     139  TYPE(ctrl_out), SAVE :: o_pluc = ctrl_out((/ 1, 1, 1, 10, 5, 10, 11, 11, 11 /), &
     140    'pluc', 'Convective Precip.', 'kg/(s*m2)', (/ ('', i=1, 9) /))
     141  TYPE(ctrl_out), SAVE :: o_snow = ctrl_out((/ 1, 1, 10, 10, 5, 10, 11, 11, 11 /), &
     142    'snow', 'Snow fall', 'kg/(s*m2)', (/ ('', i=1, 9) /))
     143  TYPE(ctrl_out), SAVE :: o_evap = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     144    'evap', 'Evaporat', 'kg/(s*m2)', (/ ('', i=1, 9) /))
    131145
    132146  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_evap_srf     = (/ &
    133       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_ter', &
    134       "evaporation at surface "//clnsurf(1),"kg/(s*m2)", (/ ('', i=1, 6) /)), &
    135       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_lic', &
    136       "evaporation at surface "//clnsurf(2),"kg/(s*m2)", (/ ('', i=1, 6) /)), &
    137       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_oce', &
    138       "evaporation at surface "//clnsurf(3),"kg/(s*m2)", (/ ('', i=1, 6) /)), &
    139       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evap_sic', &
    140       "evaporation at surface "//clnsurf(4),"kg/(s*m2)", (/ ('', i=1, 6) /)) /)
    141 
    142   TYPE(ctrl_out), SAVE :: o_msnow = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    143         'msnow', 'Surface snow amount', 'kg/m2', (/ ('', i=1, 6) /))
    144   TYPE(ctrl_out), SAVE :: o_fsnow = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    145         'fsnow', 'Surface snow area fraction', '-', (/ ('', i=1, 6) /))
    146   TYPE(ctrl_out), SAVE :: o_tops = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    147         'tops', 'Solar rad. at TOA', 'W/m2', (/ ('', i=1, 6) /))
    148   TYPE(ctrl_out), SAVE :: o_tops0 = ctrl_out((/ 1, 5, 10, 10, 10, 10 /), &
    149         'tops0', 'CS Solar rad. at TOA', 'W/m2', (/ ('', i=1, 6) /))
    150   TYPE(ctrl_out), SAVE :: o_topl = ctrl_out((/ 1, 1, 10, 5, 10, 10 /), &
    151         'topl', 'IR rad. at TOA', 'W/m2', (/ ('', i=1, 6) /))
    152   TYPE(ctrl_out), SAVE :: o_topl0 = ctrl_out((/ 1, 5, 10, 10, 10, 10 /), &
    153         'topl0', 'IR rad. at TOA', 'W/m2', (/ ('', i=1, 6) /))
    154   TYPE(ctrl_out), SAVE :: o_SWupTOA = ctrl_out((/ 1, 4, 10, 10, 10, 10 /), &
    155         'SWupTOA', 'SWup at TOA', 'W/m2', (/ ('', i=1, 6) /))
    156   TYPE(ctrl_out), SAVE :: o_SWupTOAclr = ctrl_out((/ 1, 4, 10, 10, 10, 10 /), &
    157         'SWupTOAclr', 'SWup clear sky at TOA', 'W/m2', (/ ('', i=1, 6) /))
    158   TYPE(ctrl_out), SAVE :: o_SWdnTOA = ctrl_out((/ 1, 4, 10, 10, 10, 10 /), &
    159         'SWdnTOA', 'SWdn at TOA', 'W/m2', (/ ('', i=1, 6) /))
    160   TYPE(ctrl_out), SAVE :: o_SWdnTOAclr = ctrl_out((/ 1, 4, 10, 10, 10, 10 /), &
    161         'SWdnTOAclr', 'SWdn clear sky at TOA', 'W/m2', (/ ('', i=1, 6) /))
    162   TYPE(ctrl_out), SAVE :: o_nettop = ctrl_out((/ 1, 4, 10, 10, 10, 10 /), &
    163         'nettop', 'Net dn radiatif flux at TOA', 'W/m2', (/ ('', i=1, 6) /))
    164   TYPE(ctrl_out), SAVE :: o_SWup200 = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    165         'SWup200', 'SWup at 200mb', 'W/m2', (/ ('', i=1, 6) /))
    166   TYPE(ctrl_out), SAVE :: o_SWup200clr = ctrl_out((/ 10, 1, 10, 10, 10, 10 /), &
    167         'SWup200clr', 'SWup clear sky at 200mb', 'W/m2', (/ ('', i=1, 6) /))
    168   TYPE(ctrl_out), SAVE :: o_SWdn200 = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    169         'SWdn200', 'SWdn at 200mb', 'W/m2', (/ ('', i=1, 6) /))
    170   TYPE(ctrl_out), SAVE :: o_SWdn200clr = ctrl_out((/ 10, 1, 10, 10, 10, 10 /), &
    171         'SWdn200clr', 'SWdn clear sky at 200mb', 'W/m2', (/ ('', i=1, 6) /))
     147      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'evap_ter', &
     148      "evaporation at surface "//clnsurf(1),"kg/(s*m2)", (/ ('', i=1, 9) /)), &
     149      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'evap_lic', &
     150      "evaporation at surface "//clnsurf(2),"kg/(s*m2)", (/ ('', i=1, 9) /)), &
     151      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'evap_oce', &
     152      "evaporation at surface "//clnsurf(3),"kg/(s*m2)", (/ ('', i=1, 9) /)), &
     153      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'evap_sic', &
     154      "evaporation at surface "//clnsurf(4),"kg/(s*m2)", (/ ('', i=1, 9) /)) /)
     155
     156  TYPE(ctrl_out), SAVE :: o_msnow = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     157    'msnow', 'Surface snow amount', 'kg/m2', (/ ('', i=1, 9) /))
     158  TYPE(ctrl_out), SAVE :: o_fsnow = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     159    'fsnow', 'Surface snow area fraction', '-', (/ ('', i=1, 9) /))
     160  TYPE(ctrl_out), SAVE :: o_tops = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     161    'tops', 'Solar rad. at TOA', 'W/m2', (/ ('', i=1, 9) /))
     162  TYPE(ctrl_out), SAVE :: o_tops0 = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     163    'tops0', 'CS Solar rad. at TOA', 'W/m2', (/ ('', i=1, 9) /))
     164  TYPE(ctrl_out), SAVE :: o_topl = ctrl_out((/ 1, 1, 10, 5, 10, 10, 11, 11, 11 /), &
     165    'topl', 'IR rad. at TOA', 'W/m2', (/ ('', i=1, 9) /))
     166  TYPE(ctrl_out), SAVE :: o_topl0 = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     167    'topl0', 'IR rad. at TOA', 'W/m2', (/ ('', i=1, 9) /))
     168  TYPE(ctrl_out), SAVE :: o_SWupTOA = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11 /), &
     169    'SWupTOA', 'SWup at TOA', 'W/m2', (/ ('', i=1, 9) /))
     170  TYPE(ctrl_out), SAVE :: o_SWupTOAclr = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11 /), &
     171    'SWupTOAclr', 'SWup clear sky at TOA', 'W/m2', (/ ('', i=1, 9) /))
     172  TYPE(ctrl_out), SAVE :: o_SWdnTOA = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11 /), &
     173    'SWdnTOA', 'SWdn at TOA', 'W/m2', (/ ('', i=1, 9) /))
     174  TYPE(ctrl_out), SAVE :: o_SWdnTOAclr = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11 /), &
     175    'SWdnTOAclr', 'SWdn clear sky at TOA', 'W/m2', (/ ('', i=1, 9) /))
     176  TYPE(ctrl_out), SAVE :: o_nettop = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11 /), &
     177    'nettop', 'Net dn radiatif flux at TOA', 'W/m2', (/ ('', i=1, 9) /))
     178  TYPE(ctrl_out), SAVE :: o_SWup200 = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     179    'SWup200', 'SWup at 200mb', 'W/m2', (/ ('', i=1, 9) /))
     180  TYPE(ctrl_out), SAVE :: o_SWup200clr = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     181    'SWup200clr', 'SWup clear sky at 200mb', 'W/m2', (/ ('', i=1, 9) /))
     182  TYPE(ctrl_out), SAVE :: o_SWdn200 = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     183    'SWdn200', 'SWdn at 200mb', 'W/m2', (/ ('', i=1, 9) /))
     184  TYPE(ctrl_out), SAVE :: o_SWdn200clr = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     185    'SWdn200clr', 'SWdn clear sky at 200mb', 'W/m2', (/ ('', i=1, 9) /))
    172186
    173187  ! arajouter
    174   !  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOA', &
    175   !     (/ ('', i=1, 6) /))
    176   !  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWupTOAclr', &
    177   !     (/ ('', i=1, 6) /))
    178   !  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOA', &
    179   !     (/ ('', i=1, 6) /))
    180   !  type(ctrl_out),save :: o_LWdnTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10 /),'LWdnTOAclr', &
    181   !     (/ ('', i=1, 6) /))
    182   TYPE(ctrl_out), SAVE :: o_LWup200 = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    183         'LWup200', 'LWup at 200mb', 'W/m2', (/ ('', i=1, 6) /))
    184   TYPE(ctrl_out), SAVE :: o_LWup200clr = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    185         'LWup200clr', 'LWup clear sky at 200mb', 'W/m2', (/ ('', i=1, 6) /))
    186   TYPE(ctrl_out), SAVE :: o_LWdn200 = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    187         'LWdn200', 'LWdn at 200mb', 'W/m2', (/ ('', i=1, 6) /))
    188   TYPE(ctrl_out), SAVE :: o_LWdn200clr = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    189         'LWdn200clr', 'LWdn clear sky at 200mb', 'W/m2', (/ ('', i=1, 6) /))
    190   TYPE(ctrl_out), SAVE :: o_sols = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    191         'sols', 'Solar rad. at surf.', 'W/m2', (/ ('', i=1, 6) /))
    192   TYPE(ctrl_out), SAVE :: o_sols0 = ctrl_out((/ 1, 5, 10, 10, 10, 10 /), &
    193         'sols0', 'Solar rad. at surf.', 'W/m2', (/ ('', i=1, 6) /))
    194   TYPE(ctrl_out), SAVE :: o_soll = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    195         'soll', 'IR rad. at surface', 'W/m2', (/ ('', i=1, 6) /))
    196   TYPE(ctrl_out), SAVE :: o_soll0 = ctrl_out((/ 1, 5, 10, 10, 10, 10 /), &
    197         'soll0', 'IR rad. at surface', 'W/m2', (/ ('', i=1, 6) /))
    198   TYPE(ctrl_out), SAVE :: o_radsol = ctrl_out((/ 1, 7, 10, 10, 10, 10 /), &
    199         'radsol', 'Rayonnement au sol', 'W/m2', (/ ('', i=1, 6) /))
    200   TYPE(ctrl_out), SAVE :: o_SWupSFC = ctrl_out((/ 1, 4, 10, 10, 5, 10 /), &
    201         'SWupSFC', 'SWup at surface', 'W/m2', (/ ('', i=1, 6) /))
    202   TYPE(ctrl_out), SAVE :: o_SWupSFCclr = ctrl_out((/ 1, 4, 10, 10, 5, 10 /), &
    203         'SWupSFCclr', 'SWup clear sky at surface', 'W/m2', (/ ('', i=1, 6) /))
    204   TYPE(ctrl_out), SAVE :: o_SWdnSFC = ctrl_out((/ 1, 1, 10, 10, 5, 10 /), &
    205         'SWdnSFC', 'SWdn at surface', 'W/m2', (/ ('', i=1, 6) /))
    206   TYPE(ctrl_out), SAVE :: o_SWdnSFCclr = ctrl_out((/ 1, 4, 10, 10, 5, 10 /), &
    207         'SWdnSFCclr', 'SWdn clear sky at surface', 'W/m2', (/ ('', i=1, 6) /))
    208   TYPE(ctrl_out), SAVE :: o_LWupSFC = ctrl_out((/ 1, 4, 10, 10, 5, 10 /), &
    209         'LWupSFC', 'Upwd. IR rad. at surface', 'W/m2', (/ ('', i=1, 6) /))
    210   TYPE(ctrl_out), SAVE :: o_LWupSFCclr = ctrl_out((/ 1, 4, 10, 10, 5, 10 /), &
    211         'LWupSFCclr', 'CS Upwd. IR rad. at surface', 'W/m2', (/ ('', i=1, 6) /))
    212   TYPE(ctrl_out), SAVE :: o_LWdnSFC = ctrl_out((/ 1, 4, 10, 10, 5, 10 /), &
    213         'LWdnSFC', 'Down. IR rad. at surface', 'W/m2', (/ ('', i=1, 6) /))
    214   TYPE(ctrl_out), SAVE :: o_LWdnSFCclr = ctrl_out((/ 1, 4, 10, 10, 5, 10 /), &
    215         'LWdnSFCclr', 'Down. CS IR rad. at surface', 'W/m2', (/ ('', i=1, 6) /))
    216   TYPE(ctrl_out), SAVE :: o_bils = ctrl_out((/ 1, 2, 10, 5, 10, 10 /), &
    217         'bils', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 6) /))
    218   TYPE(ctrl_out), SAVE :: o_bils_tke = ctrl_out((/ 1, 2, 10, 5, 10, 10 /), &
    219         'bils_tke', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 6) /))
    220   TYPE(ctrl_out), SAVE :: o_bils_diss = ctrl_out((/ 1, 2, 10, 5, 10, 10 /), &
    221         'bils_diss', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 6) /))
    222   TYPE(ctrl_out), SAVE :: o_bils_ec = ctrl_out((/ 1, 2, 10, 5, 10, 10 /), &
    223         'bils_ec', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 6) /))
    224   TYPE(ctrl_out), SAVE :: o_bils_kinetic = ctrl_out((/ 1, 2, 10, 5, 10, 10 /), &
    225         'bils_kinetic', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 6) /))
    226   TYPE(ctrl_out), SAVE :: o_bils_enthalp = ctrl_out((/ 1, 2, 10, 5, 10, 10 /), &
    227         'bils_enthalp', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 6) /))
    228   TYPE(ctrl_out), SAVE :: o_bils_latent = ctrl_out((/ 1, 2, 10, 5, 10, 10 /), &
    229         'bils_latent', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 6) /))
    230   TYPE(ctrl_out), SAVE :: o_sens = ctrl_out((/ 1, 1, 10, 10, 5, 10 /), &
    231         'sens', 'Sensible heat flux', 'W/m2', (/ ('', i=1, 6) /))
    232   TYPE(ctrl_out), SAVE :: o_fder = ctrl_out((/ 1, 2, 10, 10, 10, 10 /), &
    233         'fder', 'Heat flux derivation', 'W/m2', (/ ('', i=1, 6) /))
    234   TYPE(ctrl_out), SAVE :: o_ffonte = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    235         'ffonte', 'Thermal flux for snow melting', 'W/m2', (/ ('', i=1, 6) /))
    236   TYPE(ctrl_out), SAVE :: o_fqcalving = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    237         'fqcalving', 'Ice Calving', 'kg/m2/s', (/ ('', i=1, 6) /))
    238   TYPE(ctrl_out), SAVE :: o_fqfonte = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    239         'fqfonte', 'Land ice melt', 'kg/m2/s', (/ ('', i=1, 6) /))
    240   TYPE(ctrl_out), SAVE :: o_taux = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    241         'taux', 'Zonal wind stress', 'Pa', (/ ('', i=1, 6) /))
    242   TYPE(ctrl_out), SAVE :: o_tauy = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    243         'tauy', 'Meridional wind stress', 'Pa', (/ ('', i=1, 6) /))
     188  !  type(ctrl_out),save :: o_LWupTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11 /),'LWupTOA', &
     189  !    (/ ('', i=1, 9) /))
     190  !  type(ctrl_out),save :: o_LWupTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11 /),'LWupTOAclr', &
     191  !    (/ ('', i=1, 9) /))
     192  !  type(ctrl_out),save :: o_LWdnTOA     = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11 /),'LWdnTOA', &
     193  !    (/ ('', i=1, 9) /))
     194  !  type(ctrl_out),save :: o_LWdnTOAclr  = ctrl_out((/ 1, 4, 10, 10, 10, 10, 11, 11, 11 /),'LWdnTOAclr', &
     195  !    (/ ('', i=1, 9) /))
     196  TYPE(ctrl_out), SAVE :: o_LWup200 = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     197    'LWup200', 'LWup at 200mb', 'W/m2', (/ ('', i=1, 9) /))
     198  TYPE(ctrl_out), SAVE :: o_LWup200clr = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     199    'LWup200clr', 'LWup clear sky at 200mb', 'W/m2', (/ ('', i=1, 9) /))
     200  TYPE(ctrl_out), SAVE :: o_LWdn200 = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     201    'LWdn200', 'LWdn at 200mb', 'W/m2', (/ ('', i=1, 9) /))
     202  TYPE(ctrl_out), SAVE :: o_LWdn200clr = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     203    'LWdn200clr', 'LWdn clear sky at 200mb', 'W/m2', (/ ('', i=1, 9) /))
     204  TYPE(ctrl_out), SAVE :: o_sols = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     205    'sols', 'Solar rad. at surf.', 'W/m2', (/ ('', i=1, 9) /))
     206  TYPE(ctrl_out), SAVE :: o_sols0 = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     207    'sols0', 'Solar rad. at surf.', 'W/m2', (/ ('', i=1, 9) /))
     208  TYPE(ctrl_out), SAVE :: o_soll = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     209    'soll', 'IR rad. at surface', 'W/m2', (/ ('', i=1, 9) /))
     210  TYPE(ctrl_out), SAVE :: o_soll0 = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     211    'soll0', 'IR rad. at surface', 'W/m2', (/ ('', i=1, 9) /))
     212  TYPE(ctrl_out), SAVE :: o_radsol = ctrl_out((/ 1, 7, 10, 10, 10, 10, 11, 11, 11 /), &
     213    'radsol', 'Rayonnement au sol', 'W/m2', (/ ('', i=1, 9) /))
     214  TYPE(ctrl_out), SAVE :: o_SWupSFC = ctrl_out((/ 1, 4, 10, 10, 5, 10, 11, 11, 11 /), &
     215    'SWupSFC', 'SWup at surface', 'W/m2', (/ ('', i=1, 9) /))
     216  TYPE(ctrl_out), SAVE :: o_SWupSFCclr = ctrl_out((/ 1, 4, 10, 10, 5, 10, 11, 11, 11 /), &
     217    'SWupSFCclr', 'SWup clear sky at surface', 'W/m2', (/ ('', i=1, 9) /))
     218  TYPE(ctrl_out), SAVE :: o_SWdnSFC = ctrl_out((/ 1, 1, 10, 10, 5, 10, 11, 11, 11 /), &
     219    'SWdnSFC', 'SWdn at surface', 'W/m2', (/ ('', i=1, 9) /))
     220  TYPE(ctrl_out), SAVE :: o_SWdnSFCclr = ctrl_out((/ 1, 4, 10, 10, 5, 10, 11, 11, 11 /), &
     221    'SWdnSFCclr', 'SWdn clear sky at surface', 'W/m2', (/ ('', i=1, 9) /))
     222  TYPE(ctrl_out), SAVE :: o_LWupSFC = ctrl_out((/ 1, 4, 10, 10, 5, 10, 11, 11, 11 /), &
     223    'LWupSFC', 'Upwd. IR rad. at surface', 'W/m2', (/ ('', i=1, 9) /))
     224  TYPE(ctrl_out), SAVE :: o_LWupSFCclr = ctrl_out((/ 1, 4, 10, 10, 5, 10, 11, 11, 11 /), &
     225    'LWupSFCclr', 'CS Upwd. IR rad. at surface', 'W/m2', (/ ('', i=1, 9) /))
     226  TYPE(ctrl_out), SAVE :: o_LWdnSFC = ctrl_out((/ 1, 4, 10, 10, 5, 10, 11, 11, 11 /), &
     227    'LWdnSFC', 'Down. IR rad. at surface', 'W/m2', (/ ('', i=1, 9) /))
     228  TYPE(ctrl_out), SAVE :: o_LWdnSFCclr = ctrl_out((/ 1, 4, 10, 10, 5, 10, 11, 11, 11 /), &
     229    'LWdnSFCclr', 'Down. CS IR rad. at surface', 'W/m2', (/ ('', i=1, 9) /))
     230  TYPE(ctrl_out), SAVE :: o_bils = ctrl_out((/ 1, 2, 10, 5, 10, 10, 11, 11, 11 /), &
     231    'bils', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 9) /))
     232  TYPE(ctrl_out), SAVE :: o_bils_tke = ctrl_out((/ 1, 2, 10, 5, 10, 10, 11, 11, 11 /), &
     233    'bils_tke', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 9) /))
     234  TYPE(ctrl_out), SAVE :: o_bils_diss = ctrl_out((/ 1, 2, 10, 5, 10, 10, 11, 11, 11 /), &
     235    'bils_diss', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 9) /))
     236  TYPE(ctrl_out), SAVE :: o_bils_ec = ctrl_out((/ 1, 2, 10, 5, 10, 10, 11, 11, 11 /), &
     237    'bils_ec', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 9) /))
     238  TYPE(ctrl_out), SAVE :: o_bils_kinetic = ctrl_out((/ 1, 2, 10, 5, 10, 10, 11, 11, 11 /), &
     239    'bils_kinetic', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 9) /))
     240  TYPE(ctrl_out), SAVE :: o_bils_enthalp = ctrl_out((/ 1, 2, 10, 5, 10, 10, 11, 11, 11 /), &
     241    'bils_enthalp', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 9) /))
     242  TYPE(ctrl_out), SAVE :: o_bils_latent = ctrl_out((/ 1, 2, 10, 5, 10, 10, 11, 11, 11 /), &
     243    'bils_latent', 'Surf. total heat flux', 'W/m2', (/ ('', i=1, 9) /))
     244  TYPE(ctrl_out), SAVE :: o_sens = ctrl_out((/ 1, 1, 10, 10, 5, 10, 11, 11, 11 /), &
     245    'sens', 'Sensible heat flux', 'W/m2', (/ ('', i=1, 9) /))
     246  TYPE(ctrl_out), SAVE :: o_fder = ctrl_out((/ 1, 2, 10, 10, 10, 10, 11, 11, 11 /), &
     247    'fder', 'Heat flux derivation', 'W/m2', (/ ('', i=1, 9) /))
     248  TYPE(ctrl_out), SAVE :: o_ffonte = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     249    'ffonte', 'Thermal flux for snow melting', 'W/m2', (/ ('', i=1, 9) /))
     250  TYPE(ctrl_out), SAVE :: o_fqcalving = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     251    'fqcalving', 'Ice Calving', 'kg/m2/s', (/ ('', i=1, 9) /))
     252  TYPE(ctrl_out), SAVE :: o_fqfonte = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     253    'fqfonte', 'Land ice melt', 'kg/m2/s', (/ ('', i=1, 9) /))
     254  TYPE(ctrl_out), SAVE :: o_taux = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     255    'taux', 'Zonal wind stress', 'Pa', (/ ('', i=1, 9) /))
     256  TYPE(ctrl_out), SAVE :: o_tauy = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     257    'tauy', 'Meridional wind stress', 'Pa', (/ ('', i=1, 9) /))
    244258
    245259  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_taux_srf = (/           &
    246       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_ter',             &
    247       "Zonal wind stress"//clnsurf(1), "Pa", (/ ('', i=1, 6) /)), &
    248       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_lic',             &
    249       "Zonal wind stress"//clnsurf(2), "Pa", (/ ('', i=1, 6) /)), &
    250       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_oce',             &
    251       "Zonal wind stress"//clnsurf(3), "Pa", (/ ('', i=1, 6) /)), &
    252       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'taux_sic',             &
    253       "Zonal wind stress"//clnsurf(4), "Pa", (/ ('', i=1, 6) /)) /)
     260      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'taux_ter',             &
     261      "Zonal wind stress"//clnsurf(1), "Pa", (/ ('', i=1, 9) /)), &
     262      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'taux_lic',             &
     263      "Zonal wind stress"//clnsurf(2), "Pa", (/ ('', i=1, 9) /)), &
     264      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'taux_oce',             &
     265      "Zonal wind stress"//clnsurf(3), "Pa", (/ ('', i=1, 9) /)), &
     266      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'taux_sic',             &
     267      "Zonal wind stress"//clnsurf(4), "Pa", (/ ('', i=1, 9) /)) /)
    254268
    255269  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_tauy_srf     = (/             &
    256       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_ter',                   &
    257       "Meridional wind stress "//clnsurf(1),"Pa", (/ ('', i=1, 6) /)),  &
    258       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_lic',                   &
    259       "Meridional wind stress "//clnsurf(2),"Pa", (/ ('', i=1, 6) /)),  &
    260       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_oce',                   &
    261       "Meridional wind stress "//clnsurf(3),"Pa", (/ ('', i=1, 6) /)),  &
    262       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tauy_sic',                   &
    263       "Meridional wind stress "//clnsurf(4),"Pa", (/ ('', i=1, 6) /)) /)
     270      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'tauy_ter',                   &
     271      "Meridional wind stress "//clnsurf(1),"Pa", (/ ('', i=1, 9) /)),  &
     272      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'tauy_lic',                   &
     273      "Meridional wind stress "//clnsurf(2),"Pa", (/ ('', i=1, 9) /)),  &
     274      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'tauy_oce',                   &
     275      "Meridional wind stress "//clnsurf(3),"Pa", (/ ('', i=1, 9) /)),  &
     276      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'tauy_sic',                   &
     277      "Meridional wind stress "//clnsurf(4),"Pa", (/ ('', i=1, 9) /)) /)
    264278
    265279  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_pourc_srf    = (/ &
    266       ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_ter',      &
    267       "% "//clnsurf(1),"%", (/ ('', i=1, 6) /)),            &
    268       ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_lic',      &
    269       "% "//clnsurf(2),"%", (/ ('', i=1, 6) /)),            &
    270       ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_oce',      &
    271       "% "//clnsurf(3),"%", (/ ('', i=1, 6) /)),            &
    272       ctrl_out((/ 1, 7, 10, 10, 10, 10 /),'pourc_sic',      &
    273       "% "//clnsurf(4),"%", (/ ('', i=1, 6) /)) /)
     280      ctrl_out((/ 1, 7, 10, 10, 10, 10, 11, 11, 11 /),'pourc_ter',      &
     281      "% "//clnsurf(1),"%", (/ ('', i=1, 9) /)),            &
     282      ctrl_out((/ 1, 7, 10, 10, 10, 10, 11, 11, 11 /),'pourc_lic',      &
     283      "% "//clnsurf(2),"%", (/ ('', i=1, 9) /)),            &
     284      ctrl_out((/ 1, 7, 10, 10, 10, 10, 11, 11, 11 /),'pourc_oce',      &
     285      "% "//clnsurf(3),"%", (/ ('', i=1, 9) /)),            &
     286      ctrl_out((/ 1, 7, 10, 10, 10, 10, 11, 11, 11 /),'pourc_sic',      &
     287      "% "//clnsurf(4),"%", (/ ('', i=1, 9) /)) /)
    274288
    275289  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_fract_srf    = (/ &
    276       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_ter',      &
    277       "Fraction "//clnsurf(1),"1", (/ ('', i=1, 6) /)),     &
    278       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_lic',      &
    279       "Fraction "//clnsurf(2),"1", (/ ('', i=1, 6) /)),     &
    280       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_oce',      &
    281       "Fraction "//clnsurf(3),"1", (/ ('', i=1, 6) /)),     &
    282       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'fract_sic',      &
    283       "Fraction "//clnsurf(4),"1", (/ ('', i=1, 6) /)) /)
     290      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'fract_ter',      &
     291      "Fraction "//clnsurf(1),"1", (/ ('', i=1, 9) /)),     &
     292      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'fract_lic',      &
     293      "Fraction "//clnsurf(2),"1", (/ ('', i=1, 9) /)),     &
     294      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'fract_oce',      &
     295      "Fraction "//clnsurf(3),"1", (/ ('', i=1, 9) /)),     &
     296      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'fract_sic',      &
     297      "Fraction "//clnsurf(4),"1", (/ ('', i=1, 9) /)) /)
    284298
    285299  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_tsol_srf     = (/ &
    286       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_ter',       &
    287       "Temperature "//clnsurf(1),"K", (/ ('', i=1, 6) /)),  &
    288       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_lic',       &
    289       "Temperature "//clnsurf(2),"K", (/ ('', i=1, 6) /)),  &
    290       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_oce',       &
    291       "Temperature "//clnsurf(3),"K", (/ ('', i=1, 6) /)),  &
    292       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'tsol_sic',       &
    293       "Temperature "//clnsurf(4),"K", (/ ('', i=1, 6) /)) /)
     300      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'tsol_ter',       &
     301      "Temperature "//clnsurf(1),"K", (/ ('', i=1, 9) /)),  &
     302      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'tsol_lic',       &
     303      "Temperature "//clnsurf(2),"K", (/ ('', i=1, 9) /)),  &
     304      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'tsol_oce',       &
     305      "Temperature "//clnsurf(3),"K", (/ ('', i=1, 9) /)),  &
     306      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'tsol_sic',       &
     307      "Temperature "//clnsurf(4),"K", (/ ('', i=1, 9) /)) /)
    294308
    295309  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_evappot_srf  = (/ &
    296       ctrl_out((/ 1, 6, 10, 10, 10, 10 /),'evappot_ter',    &
    297       "Temperature"//clnsurf(1),"K", (/ ('', i=1, 6) /)),   &
    298       ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'evappot_lic',    &
    299       "Temperature"//clnsurf(2),"K", (/ ('', i=1, 6) /)),   &
    300       ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'evappot_oce',    &
    301       "Temperature"//clnsurf(3),"K", (/ ('', i=1, 6) /)),   &
    302       ctrl_out((/ 4, 6, 10, 10, 10, 10 /),'evappot_sic',    &
    303       "Temperature"//clnsurf(4),"K", (/ ('', i=1, 6) /)) /)
     310      ctrl_out((/ 1, 6, 10, 10, 10, 10, 11, 11, 11 /),'evappot_ter',    &
     311      "Temperature"//clnsurf(1),"K", (/ ('', i=1, 9) /)),   &
     312      ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /),'evappot_lic',    &
     313      "Temperature"//clnsurf(2),"K", (/ ('', i=1, 9) /)),   &
     314      ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /),'evappot_oce',    &
     315      "Temperature"//clnsurf(3),"K", (/ ('', i=1, 9) /)),   &
     316      ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /),'evappot_sic',    &
     317      "Temperature"//clnsurf(4),"K", (/ ('', i=1, 9) /)) /)
    304318
    305319  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_sens_srf     = (/          &
    306       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_ter',                 &
    307       "Sensible heat flux "//clnsurf(1),"W/m2", (/ ('', i=1, 6) /)), &
    308       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_lic',                 &
    309       "Sensible heat flux "//clnsurf(2),"W/m2", (/ ('', i=1, 6) /)), &
    310       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_oce',                 &
    311       "Sensible heat flux "//clnsurf(3),"W/m2", (/ ('', i=1, 6) /)), &
    312       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'sens_sic',                 &
    313       "Sensible heat flux "//clnsurf(4),"W/m2", (/ ('', i=1, 6) /)) /)
     320      ctrl_out((/ 1, 6, 10, 7, 10, 10, 11, 11, 11 /),'sens_ter',                 &
     321      "Sensible heat flux "//clnsurf(1),"W/m2", (/ ('', i=1, 9) /)), &
     322      ctrl_out((/ 1, 6, 10, 7, 10, 10, 11, 11, 11 /),'sens_lic',                 &
     323      "Sensible heat flux "//clnsurf(2),"W/m2", (/ ('', i=1, 9) /)), &
     324      ctrl_out((/ 1, 6, 10, 7, 10, 10, 11, 11, 11 /),'sens_oce',                 &
     325      "Sensible heat flux "//clnsurf(3),"W/m2", (/ ('', i=1, 9) /)), &
     326      ctrl_out((/ 1, 6, 10, 7, 10, 10, 11, 11, 11 /),'sens_sic',                 &
     327      "Sensible heat flux "//clnsurf(4),"W/m2", (/ ('', i=1, 9) /)) /)
    314328
    315329  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_lat_srf      = (/        &
    316       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_ter',                &
    317       "Latent heat flux "//clnsurf(1),"W/m2", (/ ('', i=1, 6) /)), &
    318       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_lic',                &
    319       "Latent heat flux "//clnsurf(2),"W/m2", (/ ('', i=1, 6) /)), &
    320       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_oce',                &
    321       "Latent heat flux "//clnsurf(3),"W/m2", (/ ('', i=1, 6) /)), &
    322       ctrl_out((/ 1, 6, 10, 7, 10, 10 /),'lat_sic',                &
    323       "Latent heat flux "//clnsurf(4),"W/m2", (/ ('', i=1, 6) /)) /)
     330      ctrl_out((/ 1, 6, 10, 7, 10, 10, 11, 11, 11 /),'lat_ter',                &
     331      "Latent heat flux "//clnsurf(1),"W/m2", (/ ('', i=1, 9) /)), &
     332      ctrl_out((/ 1, 6, 10, 7, 10, 10, 11, 11, 11 /),'lat_lic',                &
     333      "Latent heat flux "//clnsurf(2),"W/m2", (/ ('', i=1, 9) /)), &
     334      ctrl_out((/ 1, 6, 10, 7, 10, 10, 11, 11, 11 /),'lat_oce',                &
     335      "Latent heat flux "//clnsurf(3),"W/m2", (/ ('', i=1, 9) /)), &
     336      ctrl_out((/ 1, 6, 10, 7, 10, 10, 11, 11, 11 /),'lat_sic',                &
     337      "Latent heat flux "//clnsurf(4),"W/m2", (/ ('', i=1, 9) /)) /)
    324338
    325339  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_flw_srf      = (/ &
    326       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_ter',       &
    327       "LW "//clnsurf(1),"W/m2", (/ ('', i=1, 6) /)),        &
    328       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_lic',       &
    329       "LW "//clnsurf(2),"W/m2", (/ ('', i=1, 6) /)),        &
    330       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_oce',       &
    331       "LW "//clnsurf(3),"W/m2", (/ ('', i=1, 6) /)),        &
    332       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'flw_sic',       &
    333       "LW "//clnsurf(4),"W/m2", (/ ('', i=1, 6) /)) /)
     340      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'flw_ter',       &
     341      "LW "//clnsurf(1),"W/m2", (/ ('', i=1, 9) /)),        &
     342      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'flw_lic',       &
     343      "LW "//clnsurf(2),"W/m2", (/ ('', i=1, 9) /)),        &
     344      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'flw_oce',       &
     345      "LW "//clnsurf(3),"W/m2", (/ ('', i=1, 9) /)),        &
     346      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'flw_sic',       &
     347      "LW "//clnsurf(4),"W/m2", (/ ('', i=1, 9) /)) /)
    334348
    335349  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_fsw_srf      = (/ &
    336       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_ter',       &
    337       "SW "//clnsurf(1),"W/m2", (/ ('', i=1, 6) /)),        &
    338       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_lic',       &
    339       "SW "//clnsurf(2),"W/m2", (/ ('', i=1, 6) /)),        &
    340       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_oce',       &
    341       "SW "//clnsurf(3),"W/m2", (/ ('', i=1, 6) /)),        &
    342       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'fsw_sic',       &
    343       "SW "//clnsurf(4),"W/m2", (/ ('', i=1, 6) /)) /)
     350      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'fsw_ter',       &
     351      "SW "//clnsurf(1),"W/m2", (/ ('', i=1, 9) /)),        &
     352      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'fsw_lic',       &
     353      "SW "//clnsurf(2),"W/m2", (/ ('', i=1, 9) /)),        &
     354      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'fsw_oce',       &
     355      "SW "//clnsurf(3),"W/m2", (/ ('', i=1, 9) /)),        &
     356      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'fsw_sic',       &
     357      "SW "//clnsurf(4),"W/m2", (/ ('', i=1, 9) /)) /)
    344358
    345359  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_wbils_srf    = (/ &
    346       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_ter',     &
    347       "Bilan sol "//clnsurf(1),"W/m2", (/ ('', i=1, 6) /)), &
    348       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_lic',     &
    349       "Bilan sol "//clnsurf(2),"W/m2", (/ ('', i=1, 6) /)), &
    350       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_oce',     &
    351       "Bilan sol "//clnsurf(3),"W/m2", (/ ('', i=1, 6) /)), &
    352       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbils_sic',     &
    353       "Bilan sol "//clnsurf(4),"W/m2", (/ ('', i=1, 6) /)) /)
     360      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'wbils_ter',     &
     361      "Bilan sol "//clnsurf(1),"W/m2", (/ ('', i=1, 9) /)), &
     362      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'wbils_lic',     &
     363      "Bilan sol "//clnsurf(2),"W/m2", (/ ('', i=1, 9) /)), &
     364      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'wbils_oce',     &
     365      "Bilan sol "//clnsurf(3),"W/m2", (/ ('', i=1, 9) /)), &
     366      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'wbils_sic',     &
     367      "Bilan sol "//clnsurf(4),"W/m2", (/ ('', i=1, 9) /)) /)
    354368
    355369  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_wbilo_srf    = (/      &
    356       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_ter',          &
    357       "Bilan eau "//clnsurf(1),"kg/(m2*s)", (/ ('', i=1, 6) /)), &
    358       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_lic',          &
    359       "Bilan eau "//clnsurf(2),"kg/(m2*s)", (/ ('', i=1, 6) /)), &
    360       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_oce',          &
    361       "Bilan eau "//clnsurf(3),"kg/(m2*s)", (/ ('', i=1, 6) /)), &
    362       ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'wbilo_sic',          &
    363       "Bilan eau "//clnsurf(4),"kg/(m2*s)", (/ ('', i=1, 6) /)) /)
    364 
    365   TYPE(ctrl_out), SAVE :: o_cdrm = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    366         'cdrm', 'Momentum drag coef.', '-', (/ ('', i=1, 6) /))
    367   TYPE(ctrl_out), SAVE :: o_cdrh = ctrl_out((/ 1, 10, 10, 7, 10, 10 /), &
    368         'cdrh', 'Heat drag coef.', '-', (/ ('', i=1, 6) /))
    369   TYPE(ctrl_out), SAVE :: o_cldl = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    370         'cldl', 'Low-level cloudiness', '-', (/ ('', i=1, 6) /))
    371   TYPE(ctrl_out), SAVE :: o_cldm = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    372         'cldm', 'Mid-level cloudiness', '-', (/ ('', i=1, 6) /))
    373   TYPE(ctrl_out), SAVE :: o_cldh = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    374         'cldh', 'High-level cloudiness', '-', (/ ('', i=1, 6) /))
    375   TYPE(ctrl_out), SAVE :: o_cldt = ctrl_out((/ 1, 1, 2, 10, 5, 10 /), &
    376         'cldt', 'Total cloudiness', '-', (/ ('', i=1, 6) /))
    377   TYPE(ctrl_out), SAVE :: o_cldq = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    378         'cldq', 'Cloud liquid water path', 'kg/m2', (/ ('', i=1, 6) /))
    379   TYPE(ctrl_out), SAVE :: o_lwp = ctrl_out((/ 1, 5, 10, 10, 10, 10 /), &
    380         'lwp', 'Cloud water path', 'kg/m2', (/ ('', i=1, 6) /))
    381   TYPE(ctrl_out), SAVE :: o_iwp = ctrl_out((/ 1, 5, 10, 10, 10, 10 /), &
    382         'iwp', 'Cloud ice water path', 'kg/m2', (/ ('', i=1, 6) /))
    383   TYPE(ctrl_out), SAVE :: o_ue = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    384         'ue', 'Zonal energy transport', '-', (/ ('', i=1, 6) /))
    385   TYPE(ctrl_out), SAVE :: o_ve = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    386         've', 'Merid energy transport', '-', (/ ('', i=1, 6) /))
    387   TYPE(ctrl_out), SAVE :: o_uq = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    388         'uq', 'Zonal humidity transport', '-', (/ ('', i=1, 6) /))
    389   TYPE(ctrl_out), SAVE :: o_vq = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    390         'vq', 'Merid humidity transport', '-', (/ ('', i=1, 6) /))
    391   TYPE(ctrl_out), SAVE :: o_cape = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    392         'cape', 'Conv avlbl pot ener', 'J/kg', (/ ('', i=1, 6) /))
    393   TYPE(ctrl_out), SAVE :: o_pbase = ctrl_out((/ 1, 5, 10, 10, 10, 10 /), &
    394         'pbase', 'Cld base pressure', 'Pa', (/ ('', i=1, 6) /))
    395   TYPE(ctrl_out), SAVE :: o_ptop = ctrl_out((/ 1, 5, 10, 10, 10, 10 /), &
    396         'ptop', 'Cld top pressure', 'Pa', (/ ('', i=1, 6) /))
    397   TYPE(ctrl_out), SAVE :: o_fbase = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    398         'fbase', 'Cld base mass flux', 'kg/m2/s', (/ ('', i=1, 6) /))
    399   TYPE(ctrl_out), SAVE :: o_plcl = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    400         'plcl', 'Lifting Condensation Level', 'hPa', (/ ('', i=1, 6) /))
    401   TYPE(ctrl_out), SAVE :: o_plfc = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    402         'plfc', 'Level of Free Convection', 'hPa', (/ ('', i=1, 6) /))
    403   TYPE(ctrl_out), SAVE :: o_wbeff = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    404         'wbeff', 'Conv. updraft velocity at LFC (<100)', 'm/s', (/ ('', i=1, 6) /))
    405   TYPE(ctrl_out), SAVE :: o_prw = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    406         'prw', 'Precipitable water', 'kg/m2', (/ ('', i=1, 6) /))
    407   TYPE(ctrl_out), SAVE :: o_s_pblh = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    408         's_pblh', 'Boundary Layer Height', 'm', (/ ('', i=1, 6) /))
    409   TYPE(ctrl_out), SAVE :: o_s_pblt = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    410         's_pblt', 't at Boundary Layer Height', 'K', (/ ('', i=1, 6) /))
    411   TYPE(ctrl_out), SAVE :: o_s_lcl = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    412         's_lcl', 'Condensation level', 'm', (/ ('', i=1, 6) /))
    413   TYPE(ctrl_out), SAVE :: o_s_therm = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    414         's_therm', 'Exces du thermique', 'K', (/ ('', i=1, 6) /))
     370      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'wbilo_ter',          &
     371      "Bilan eau "//clnsurf(1),"kg/(m2*s)", (/ ('', i=1, 9) /)), &
     372      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'wbilo_lic',          &
     373      "Bilan eau "//clnsurf(2),"kg/(m2*s)", (/ ('', i=1, 9) /)), &
     374      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'wbilo_oce',          &
     375      "Bilan eau "//clnsurf(3),"kg/(m2*s)", (/ ('', i=1, 9) /)), &
     376      ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'wbilo_sic',          &
     377      "Bilan eau "//clnsurf(4),"kg/(m2*s)", (/ ('', i=1, 9) /)) /)
     378
     379  TYPE(ctrl_out), SAVE :: o_cdrm = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     380    'cdrm', 'Momentum drag coef.', '-', (/ ('', i=1, 9) /))
     381  TYPE(ctrl_out), SAVE :: o_cdrh = ctrl_out((/ 1, 10, 10, 7, 10, 10, 11, 11, 11 /), &
     382    'cdrh', 'Heat drag coef.', '-', (/ ('', i=1, 9) /))
     383  TYPE(ctrl_out), SAVE :: o_cldl = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     384    'cldl', 'Low-level cloudiness', '-', (/ ('', i=1, 9) /))
     385  TYPE(ctrl_out), SAVE :: o_cldm = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     386    'cldm', 'Mid-level cloudiness', '-', (/ ('', i=1, 9) /))
     387  TYPE(ctrl_out), SAVE :: o_cldh = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     388    'cldh', 'High-level cloudiness', '-', (/ ('', i=1, 9) /))
     389  TYPE(ctrl_out), SAVE :: o_cldt = ctrl_out((/ 1, 1, 2, 10, 5, 10, 11, 11, 11 /), &
     390    'cldt', 'Total cloudiness', '-', (/ ('', i=1, 9) /))
     391  TYPE(ctrl_out), SAVE :: o_cldq = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     392    'cldq', 'Cloud liquid water path', 'kg/m2', (/ ('', i=1, 9) /))
     393  TYPE(ctrl_out), SAVE :: o_lwp = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     394    'lwp', 'Cloud water path', 'kg/m2', (/ ('', i=1, 9) /))
     395  TYPE(ctrl_out), SAVE :: o_iwp = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     396    'iwp', 'Cloud ice water path', 'kg/m2', (/ ('', i=1, 9) /))
     397  TYPE(ctrl_out), SAVE :: o_ue = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     398    'ue', 'Zonal energy transport', '-', (/ ('', i=1, 9) /))
     399  TYPE(ctrl_out), SAVE :: o_ve = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     400    've', 'Merid energy transport', '-', (/ ('', i=1, 9) /))
     401  TYPE(ctrl_out), SAVE :: o_uq = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     402    'uq', 'Zonal humidity transport', '-', (/ ('', i=1, 9) /))
     403  TYPE(ctrl_out), SAVE :: o_vq = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     404    'vq', 'Merid humidity transport', '-', (/ ('', i=1, 9) /))
     405  TYPE(ctrl_out), SAVE :: o_cape = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     406    'cape', 'Conv avlbl pot ener', 'J/kg', (/ ('', i=1, 9) /))
     407  TYPE(ctrl_out), SAVE :: o_pbase = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     408    'pbase', 'Cld base pressure', 'Pa', (/ ('', i=1, 9) /))
     409  TYPE(ctrl_out), SAVE :: o_ptop = ctrl_out((/ 1, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     410    'ptop', 'Cld top pressure', 'Pa', (/ ('', i=1, 9) /))
     411  TYPE(ctrl_out), SAVE :: o_fbase = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     412    'fbase', 'Cld base mass flux', 'kg/m2/s', (/ ('', i=1, 9) /))
     413  TYPE(ctrl_out), SAVE :: o_plcl = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     414    'plcl', 'Lifting Condensation Level', 'hPa', (/ ('', i=1, 9) /))
     415  TYPE(ctrl_out), SAVE :: o_plfc = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     416    'plfc', 'Level of Free Convection', 'hPa', (/ ('', i=1, 9) /))
     417  TYPE(ctrl_out), SAVE :: o_wbeff = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     418    'wbeff', 'Conv. updraft velocity at LFC (<100)', 'm/s', (/ ('', i=1, 9) /))
     419  TYPE(ctrl_out), SAVE :: o_prw = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     420    'prw', 'Precipitable water', 'kg/m2', (/ ('', i=1, 9) /))
     421  TYPE(ctrl_out), SAVE :: o_s_pblh = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     422    's_pblh', 'Boundary Layer Height', 'm', (/ ('', i=1, 9) /))
     423  TYPE(ctrl_out), SAVE :: o_s_pblt = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     424    's_pblt', 't at Boundary Layer Height', 'K', (/ ('', i=1, 9) /))
     425  TYPE(ctrl_out), SAVE :: o_s_lcl = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     426    's_lcl', 'Condensation level', 'm', (/ ('', i=1, 9) /))
     427  TYPE(ctrl_out), SAVE :: o_s_therm = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     428    's_therm', 'Exces du thermique', 'K', (/ ('', i=1, 9) /))
    415429  !IM : Les champs suivants (s_capCL, s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
    416   ! type(ctrl_out),save :: o_s_capCL      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_capCL', &
    417 !       (/ ('', i=1, 6) /))
    418   ! type(ctrl_out),save :: o_s_oliqCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_oliqCL', &
    419 !       (/ ('', i=1, 6) /))
    420   ! type(ctrl_out),save :: o_s_cteiCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_cteiCL', &
    421 !       (/ ('', i=1, 6) /))
    422   ! type(ctrl_out),save :: o_s_trmb1      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb1', &
    423 !       (/ ('', i=1, 6) /))
    424   ! type(ctrl_out),save :: o_s_trmb2      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb2', &
    425 !       (/ ('', i=1, 6) /))
    426   ! type(ctrl_out),save :: o_s_trmb3      = ctrl_out((/ 1, 10, 10, 10, 10, 10 /),'s_trmb3', &
    427         !(/ ('', i=1, 6) /))
    428   TYPE(ctrl_out), SAVE :: o_slab_bils = ctrl_out((/ 1, 1, 10, 10, 10, 10 /), &
    429         'slab_bils_oce', 'Bilan au sol sur ocean slab', 'W/m2', (/ ('', i=1, 6) /))
    430   TYPE(ctrl_out), SAVE :: o_ale_bl = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    431         'ale_bl', 'ALE BL', 'm2/s2', (/ ('', i=1, 6) /))
    432   TYPE(ctrl_out), SAVE :: o_alp_bl = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    433         'alp_bl', 'ALP BL', 'm2/s2', (/ ('', i=1, 6) /))
    434   TYPE(ctrl_out), SAVE :: o_ale_wk = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    435         'ale_wk', 'ALE WK', 'm2/s2', (/ ('', i=1, 6) /))
    436   TYPE(ctrl_out), SAVE :: o_alp_wk = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    437         'alp_wk', 'ALP WK', 'm2/s2', (/ ('', i=1, 6) /))
    438   TYPE(ctrl_out), SAVE :: o_ale = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    439         'ale', 'ALE', 'm2/s2', (/ ('', i=1, 6) /))
    440   TYPE(ctrl_out), SAVE :: o_alp = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    441         'alp', 'ALP', 'W/m2', (/ ('', i=1, 6) /))
    442   TYPE(ctrl_out), SAVE :: o_cin = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    443         'cin', 'Convective INhibition', 'm2/s2', (/ ('', i=1, 6) /))
    444   TYPE(ctrl_out), SAVE :: o_wape = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    445         'wape', '', '', (/ ('', i=1, 6) /))
     430  ! type(ctrl_out),save :: o_s_capCL      = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'s_capCL', &
     431!    (/ ('', i=1, 9) /))
     432  ! type(ctrl_out),save :: o_s_oliqCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'s_oliqCL', &
     433!    (/ ('', i=1, 9) /))
     434  ! type(ctrl_out),save :: o_s_cteiCL     = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'s_cteiCL', &
     435!    (/ ('', i=1, 9) /))
     436  ! type(ctrl_out),save :: o_s_trmb1      = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'s_trmb1', &
     437!    (/ ('', i=1, 9) /))
     438  ! type(ctrl_out),save :: o_s_trmb2      = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'s_trmb2', &
     439!    (/ ('', i=1, 9) /))
     440  ! type(ctrl_out),save :: o_s_trmb3      = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /),'s_trmb3', &
     441    !(/ ('', i=1, 9) /))
     442  TYPE(ctrl_out), SAVE :: o_slab_bils = ctrl_out((/ 1, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     443    'slab_bils_oce', 'Bilan au sol sur ocean slab', 'W/m2', (/ ('', i=1, 9) /))
     444  TYPE(ctrl_out), SAVE :: o_ale_bl = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     445    'ale_bl', 'ALE BL', 'm2/s2', (/ ('', i=1, 9) /))
     446  TYPE(ctrl_out), SAVE :: o_alp_bl = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     447    'alp_bl', 'ALP BL', 'm2/s2', (/ ('', i=1, 9) /))
     448  TYPE(ctrl_out), SAVE :: o_ale_wk = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     449    'ale_wk', 'ALE WK', 'm2/s2', (/ ('', i=1, 9) /))
     450  TYPE(ctrl_out), SAVE :: o_alp_wk = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     451    'alp_wk', 'ALP WK', 'm2/s2', (/ ('', i=1, 9) /))
     452  TYPE(ctrl_out), SAVE :: o_ale = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     453    'ale', 'ALE', 'm2/s2', (/ ('', i=1, 9) /))
     454  TYPE(ctrl_out), SAVE :: o_alp = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     455    'alp', 'ALP', 'W/m2', (/ ('', i=1, 9) /))
     456  TYPE(ctrl_out), SAVE :: o_cin = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     457    'cin', 'Convective INhibition', 'm2/s2', (/ ('', i=1, 9) /))
     458  TYPE(ctrl_out), SAVE :: o_wape = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     459    'wape', '', '', (/ ('', i=1, 9) /))
    446460
    447461!!! nrlmd le 10/04/2012
    448462
    449463!-------Spectre de thermiques de type 2 au LCL
    450   TYPE(ctrl_out), SAVE :: o_n2 = ctrl_out((/ 1, 1, 1, 6, 10, 10 /), &
    451         'n2', 'Nombre de panaches de type 2', ' ', (/ ('', i=1, 6) /))
    452   TYPE(ctrl_out), SAVE :: o_s2 = ctrl_out((/ 1, 1, 1, 6, 10, 10 /), &
    453         's2', 'Surface moyenne des panaches de type 2', 'm2', (/ ('', i=1, 6) /))
     464  TYPE(ctrl_out), SAVE :: o_n2 = ctrl_out((/ 1, 1, 1, 6, 10, 10, 11, 11, 11 /), &
     465    'n2', 'Nombre de panaches de type 2', ' ', (/ ('', i=1, 9) /))
     466  TYPE(ctrl_out), SAVE :: o_s2 = ctrl_out((/ 1, 1, 1, 6, 10, 10, 11, 11, 11 /), &
     467    's2', 'Surface moyenne des panaches de type 2', 'm2', (/ ('', i=1, 9) /))
    454468                                                                             
    455469!-------Déclenchement stochastique                                           
    456   TYPE(ctrl_out), SAVE :: o_proba_notrig = ctrl_out((/ 1, 1, 1, 6, 10, 10 /), &
    457         'proba_notrig', &
    458                          'Probabilité de non-déclenchement', ' ', (/ ('', i=1, 6) /))
    459   TYPE(ctrl_out), SAVE :: o_random_notrig = ctrl_out((/ 1, 1, 1, 6, 10, 10 /), &
    460         'random_notrig', &
    461                          'Tirage aléatoire de non-déclenchement', ' ', (/ ('', i=1, 6) /))
    462   TYPE(ctrl_out), SAVE :: o_ale_bl_stat = ctrl_out((/ 1, 1, 1, 6, 10, 10 /), &
    463         'ale_bl_stat', &
    464        'ALE_BL_STAT', 'm2/s2', (/ ('', i=1, 6) /))
    465   TYPE(ctrl_out), SAVE :: o_ale_bl_trig = ctrl_out((/ 1, 1, 1, 6, 10, 10 /), &
    466         'ale_bl_trig', &
    467        'ALE_BL_STAT + Condition P>Pseuil', 'm2/s2', (/ ('', i=1, 6) /))
     470  TYPE(ctrl_out), SAVE :: o_proba_notrig = ctrl_out((/ 1, 1, 1, 6, 10, 10, 11, 11, 11 /), &
     471    'proba_notrig', &
     472                         'Probabilité de non-déclenchement', ' ', (/ ('', i=1, 9) /))
     473  TYPE(ctrl_out), SAVE :: o_random_notrig = ctrl_out((/ 1, 1, 1, 6, 10, 10, 11, 11, 11 /), &
     474    'random_notrig', &
     475                         'Tirage aléatoire de non-déclenchement', ' ', (/ ('', i=1, 9) /))
     476  TYPE(ctrl_out), SAVE :: o_ale_bl_stat = ctrl_out((/ 1, 1, 1, 6, 10, 10, 11, 11, 11 /), &
     477    'ale_bl_stat', &
     478       'ALE_BL_STAT', 'm2/s2', (/ ('', i=1, 9) /))
     479  TYPE(ctrl_out), SAVE :: o_ale_bl_trig = ctrl_out((/ 1, 1, 1, 6, 10, 10, 11, 11, 11 /), &
     480    'ale_bl_trig', &
     481       'ALE_BL_STAT + Condition P>Pseuil', 'm2/s2', (/ ('', i=1, 9) /))
    468482
    469483!-------Fermeture statistique
    470   TYPE(ctrl_out), SAVE :: o_alp_bl_det = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    471         'alp_bl_det', 'ALP_BL_DET', 'W/m2', (/ ('', i=1, 6) /))
    472   TYPE(ctrl_out), SAVE :: o_alp_bl_fluct_m = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    473         'alp_bl_fluct_m', 'ALP_BL_FLUCT_M', 'W/m2', (/ ('', i=1, 6) /))
    474   TYPE(ctrl_out), SAVE :: o_alp_bl_fluct_tke = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    475         'alp_bl_fluct_tke', 'ALP_BL_FLUCT_TKE', 'W/m2', (/ ('', i=1, 6) /))
    476   TYPE(ctrl_out), SAVE :: o_alp_bl_conv = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    477         'alp_bl_conv', 'ALP_BL_CONV', 'W/m2', (/ ('', i=1, 6) /))
    478   TYPE(ctrl_out), SAVE :: o_alp_bl_stat = ctrl_out((/ 1, 1, 1, 10, 10, 10 /), &
    479         'alp_bl_stat', 'ALP_BL_STAT', 'W/m2', (/ ('', i=1, 6) /))
     484  TYPE(ctrl_out), SAVE :: o_alp_bl_det = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     485    'alp_bl_det', 'ALP_BL_DET', 'W/m2', (/ ('', i=1, 9) /))
     486  TYPE(ctrl_out), SAVE :: o_alp_bl_fluct_m = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     487    'alp_bl_fluct_m', 'ALP_BL_FLUCT_M', 'W/m2', (/ ('', i=1, 9) /))
     488  TYPE(ctrl_out), SAVE :: o_alp_bl_fluct_tke = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     489    'alp_bl_fluct_tke', 'ALP_BL_FLUCT_TKE', 'W/m2', (/ ('', i=1, 9) /))
     490  TYPE(ctrl_out), SAVE :: o_alp_bl_conv = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     491    'alp_bl_conv', 'ALP_BL_CONV', 'W/m2', (/ ('', i=1, 9) /))
     492  TYPE(ctrl_out), SAVE :: o_alp_bl_stat = ctrl_out((/ 1, 1, 1, 10, 10, 10, 11, 11, 11 /), &
     493    'alp_bl_stat', 'ALP_BL_STAT', 'W/m2', (/ ('', i=1, 9) /))
    480494
    481495!!! fin nrlmd le 10/04/2012
     
    484498
    485499  TYPE(ctrl_out), SAVE, DIMENSION(7) :: o_uSTDlevs     = (/                    &
    486       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u850', "Zonal wind 1hPa", "m/s",     &
    487       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    488       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u700', "Zonal wind 2hPa", "m/s",     &
    489       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    490       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u500', "Zonal wind 3hPa", "m/s",     &
    491       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    492       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u200', "Zonal wind 4hPa", "m/s",     &
    493       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    494       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u100', "Zonal wind 5hPa", "m/s",     &
    495       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    496       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u50', "Zonal wind 6hPa", "m/s",     &
    497       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    498       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'u10', "Zonal wind 7hPa", "m/s",     &
    499       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
     500      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'u850', "Zonal wind 1hPa", "m/s",     &
     501      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     502      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'u700', "Zonal wind 2hPa", "m/s",     &
     503      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     504      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'u500', "Zonal wind 3hPa", "m/s",     &
     505      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     506      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'u200', "Zonal wind 4hPa", "m/s",     &
     507      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     508      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'u100', "Zonal wind 5hPa", "m/s",     &
     509      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     510      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'u50', "Zonal wind 6hPa", "m/s",     &
     511      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     512      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'u10', "Zonal wind 7hPa", "m/s",     &
     513      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
    500514
    501515  TYPE(ctrl_out), SAVE, DIMENSION(7) :: o_vSTDlevs     = (/                     &
    502       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v850', "Meridional wind 1hPa", "m/s", &
    503       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
    504       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v700', "Meridional wind 2hPa", "m/s", &
    505       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
    506       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v500', "Meridional wind 3hPa", "m/s", &
    507       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
    508       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v200', "Meridional wind 4hPa", "m/s", &
    509       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
    510       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v100', "Meridional wind 5hPa", "m/s", &
    511       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
    512       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v50', "Meridional wind 6hPa", "m/s",  &
    513       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
    514       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'v10', "Meridional wind 7hPa", "m/s",  &
    515       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
     516      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'v850', "Meridional wind 1hPa", "m/s", &
     517      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
     518      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'v700', "Meridional wind 2hPa", "m/s", &
     519      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
     520      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'v500', "Meridional wind 3hPa", "m/s", &
     521      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
     522      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'v200', "Meridional wind 4hPa", "m/s", &
     523      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
     524      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'v100', "Meridional wind 5hPa", "m/s", &
     525      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
     526      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'v50', "Meridional wind 6hPa", "m/s",  &
     527      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)),  &
     528      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'v10', "Meridional wind 7hPa", "m/s",  &
     529      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
    516530
    517531  TYPE(ctrl_out), SAVE, DIMENSION(7) :: o_wSTDlevs     = (/                    &
    518       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w850', "Vertical wind 1hPa", "Pa/s", &
    519       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    520       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w700', "Vertical wind 2hPa", "Pa/s", &
    521       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    522       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w500', "Vertical wind 3hPa", "Pa/s", &
    523       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    524       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w200', "Vertical wind 4hPa", "Pa/s", &
    525       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    526       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w100', "Vertical wind 5hPa", "Pa/s", &
    527       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    528       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w50', "Vertical wind 6hPa", "Pa/s",  &
    529       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    530       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'w10', "Vertical wind 7hPa", "Pa/s",  &
    531       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
     532      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'w850', "Vertical wind 1hPa", "Pa/s", &
     533      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     534      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'w700', "Vertical wind 2hPa", "Pa/s", &
     535      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     536      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'w500', "Vertical wind 3hPa", "Pa/s", &
     537      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     538      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'w200', "Vertical wind 4hPa", "Pa/s", &
     539      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     540      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'w100', "Vertical wind 5hPa", "Pa/s", &
     541      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     542      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'w50', "Vertical wind 6hPa", "Pa/s",  &
     543      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     544      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'w10', "Vertical wind 7hPa", "Pa/s",  &
     545      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
    532546
    533547  TYPE(ctrl_out), SAVE, DIMENSION(7) :: o_tSTDlevs     = (/                    &
    534       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t850', "Temperature 1hPa", "K",      &
    535       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    536       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t700', "Temperature 2hPa", "K",      &
    537       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    538       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t500', "Temperature 3hPa", "K",      &
    539       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    540       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t200', "Temperature 4hPa", "K",      &
    541       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    542       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t100', "Temperature 5hPa", "K",      &
    543       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    544       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t50',  "Temperature 6hPa", "K",      &
    545       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    546       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'t10',  "Temperature 7hPa", "K",      &
    547       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
     548      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'t850', "Temperature 1hPa", "K",      &
     549      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     550      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'t700', "Temperature 2hPa", "K",      &
     551      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     552      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'t500', "Temperature 3hPa", "K",      &
     553      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     554      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'t200', "Temperature 4hPa", "K",      &
     555      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     556      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'t100', "Temperature 5hPa", "K",      &
     557      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     558      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'t50',  "Temperature 6hPa", "K",      &
     559      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     560      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'t10',  "Temperature 7hPa", "K",      &
     561      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
    548562
    549563  TYPE(ctrl_out), SAVE, DIMENSION(7) :: o_qSTDlevs     = (/                             &
    550       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q850', "Specific humidity 1hPa",              &
    551       "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    552       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q700', "Specific humidity 2hPa",              &
    553       "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    554       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q500', "Specific humidity 3hPa",              &
    555       "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    556       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q200', "Specific humidity 4hPa",              &
    557       "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    558       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q100', "Specific humidity 5hPa",              &
    559       "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    560       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q50', "Specific humidity 6hPa",               &
    561       "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    562       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'q10', "Specific humidity 7hPa",              &
    563       "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
     564      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'q850', "Specific humidity 1hPa", &
     565      "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     566      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'q700', "Specific humidity 2hPa", &
     567      "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     568      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'q500', "Specific humidity 3hPa", &
     569      "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     570      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'q200', "Specific humidity 4hPa", &
     571      "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     572      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'q100', "Specific humidity 5hPa", &
     573      "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     574      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'q50', "Specific humidity 6hPa",  &
     575      "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     576      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'q10', "Specific humidity 7hPa", &
     577      "kg/kg", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
    564578
    565579  TYPE(ctrl_out), SAVE, DIMENSION(7) :: o_zSTDlevs   = (/                           &
    566       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z850', "Geopotential height 1hPa",        &
    567       "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    568       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z700', "Geopotential height 2hPa",        &
    569       "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    570       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z500', "Geopotential height 3hPa",        &
    571       "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    572       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z200', "Geopotential height 4hPa",        &
    573       "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    574       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z100', "Geopotential height 5hPa",        &
    575       "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    576       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z50', "Geopotential height 6hPa",         &
    577       "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
    578       ctrl_out((/ 1, 7, 7, 10, 10, 10 /),'z10', "Geopotential height 7hPa",         &
    579       "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
    580 
    581   TYPE(ctrl_out), SAVE :: o_t_oce_sic = ctrl_out((/ 1, 10, 10, 10, 10, 10 /), &
    582         't_oce_sic', 'Temp mixte oce-sic', 'K', (/ ('', i=1, 6) /))
    583   TYPE(ctrl_out), SAVE :: o_weakinv = ctrl_out((/ 10, 1, 10, 10, 10, 10 /), &
    584         'weakinv', 'Weak inversion', '-', (/ ('', i=1, 6) /))
    585   TYPE(ctrl_out), SAVE :: o_dthmin = ctrl_out((/ 10, 1, 10, 10, 10, 10 /), &
    586         'dthmin', 'dTheta mini', 'K/m', (/ ('', i=1, 6) /))
     580      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'z850', "Geopotential height 1hPa",        &
     581      "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     582      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'z700', "Geopotential height 2hPa",        &
     583      "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     584      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'z500', "Geopotential height 3hPa",        &
     585      "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     586      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'z200', "Geopotential height 4hPa",        &
     587      "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     588      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'z100', "Geopotential height 5hPa",        &
     589      "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     590      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'z50', "Geopotential height 6hPa",         &
     591      "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)), &
     592      ctrl_out((/ 1, 7, 7, 10, 10, 10, 11, 11, 11 /),'z10', "Geopotential height 7hPa",         &
     593      "m", (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /)) /)
     594
     595  TYPE(ctrl_out), SAVE :: o_t_oce_sic = ctrl_out((/ 1, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     596    't_oce_sic', 'Temp mixte oce-sic', 'K', (/ ('', i=1, 9) /))
     597  TYPE(ctrl_out), SAVE :: o_weakinv = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     598    'weakinv', 'Weak inversion', '-', (/ ('', i=1, 9) /))
     599  TYPE(ctrl_out), SAVE :: o_dthmin = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     600    'dthmin', 'dTheta mini', 'K/m', (/ ('', i=1, 9) /))
    587601
    588602  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_u10_srf      = (/ &
    589       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_ter', "", "", (/ ('', i=1, 6) /)), &
    590       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_lic', "", "", (/ ('', i=1, 6) /)), &
    591       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_oce', "", "", (/ ('', i=1, 6) /)), &
    592       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'u10_sic', "", "", (/ ('', i=1, 6) /)) /)
     603      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'u10_ter', "", "", (/ ('', i=1, 9) /)), &
     604      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'u10_lic', "", "", (/ ('', i=1, 9) /)), &
     605      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'u10_oce', "", "", (/ ('', i=1, 9) /)), &
     606      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'u10_sic', "", "", (/ ('', i=1, 9) /)) /)
    593607
    594608  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_v10_srf      = (/ &
    595       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_ter', "", "", (/ ('', i=1, 6) /)), &
    596       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_lic', "", "", (/ ('', i=1, 6) /)), &
    597       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_oce', "", "", (/ ('', i=1, 6) /)), &
    598       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'v10_sic', "", "", (/ ('', i=1, 6) /)) /)
    599 
    600   TYPE(ctrl_out), SAVE :: o_cldtau = ctrl_out((/ 10, 5, 10, 10, 10, 10 /), &
    601         'cldtau', 'Cloud optical thickness', '1', (/ ('', i=1, 6) /))
    602   TYPE(ctrl_out), SAVE :: o_cldemi = ctrl_out((/ 10, 5, 10, 10, 10, 10 /), &
    603         'cldemi', 'Cloud optical emissivity', '1', (/ ('', i=1, 6) /))
    604   TYPE(ctrl_out), SAVE :: o_rh2m = ctrl_out((/ 5, 5, 10, 10, 10, 10 /), &
    605         'rh2m', 'Relative humidity at 2m', '%', (/ ('', i=1, 6) /))
    606   TYPE(ctrl_out), SAVE :: o_rh2m_min = ctrl_out((/ 10, 5, 10, 10, 10, 10 /), &
    607         'rh2m_min', 'Min Relative humidity at 2m', '%',                        &
    608       (/ 't_min(X)', 't_min(X)', 't_min(X)', 't_min(X)', 't_min(X)', 't_min(X)' /))
    609   TYPE(ctrl_out), SAVE :: o_rh2m_max = ctrl_out((/ 10, 5, 10, 10, 10, 10 /), &
    610         'rh2m_max', 'Max Relative humidity at 2m', '%',                        &
    611       (/ 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)' /))
    612   TYPE(ctrl_out), SAVE :: o_qsat2m = ctrl_out((/ 10, 5, 10, 10, 10, 10 /), &
    613         'qsat2m', 'Saturant humidity at 2m', '%', (/ ('', i=1, 6) /))
    614   TYPE(ctrl_out), SAVE :: o_tpot = ctrl_out((/ 10, 5, 10, 10, 10, 10 /), &
    615         'tpot', 'Surface air potential temperature', 'K', (/ ('', i=1, 6) /))
    616   TYPE(ctrl_out), SAVE :: o_tpote = ctrl_out((/ 10, 5, 10, 10, 10, 10 /), &
    617         'tpote', &
    618       'Surface air equivalent potential temperature', 'K', (/ ('', i=1, 6) /))
    619   TYPE(ctrl_out), SAVE :: o_tke = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    620         'tke ', 'TKE', 'm2/s2', (/ ('', i=1, 6) /))
    621   TYPE(ctrl_out), SAVE :: o_tke_max = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    622         'tke_max', 'TKE max', 'm2/s2',                                        &
    623       (/ 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)' /))
     609      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'v10_ter', "", "", (/ ('', i=1, 9) /)), &
     610      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'v10_lic', "", "", (/ ('', i=1, 9) /)), &
     611      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'v10_oce', "", "", (/ ('', i=1, 9) /)), &
     612      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'v10_sic', "", "", (/ ('', i=1, 9) /)) /)
     613
     614  TYPE(ctrl_out), SAVE :: o_cldtau = ctrl_out((/ 10, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     615    'cldtau', 'Cloud optical thickness', '1', (/ ('', i=1, 9) /))
     616  TYPE(ctrl_out), SAVE :: o_cldemi = ctrl_out((/ 10, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     617    'cldemi', 'Cloud optical emissivity', '1', (/ ('', i=1, 9) /))
     618  TYPE(ctrl_out), SAVE :: o_rh2m = ctrl_out((/ 5, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     619    'rh2m', 'Relative humidity at 2m', '%', (/ ('', i=1, 9) /))
     620  TYPE(ctrl_out), SAVE :: o_rh2m_min = ctrl_out((/ 10, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     621    'rh2m_min', 'Min Relative humidity at 2m', '%',                        &
     622      (/ 't_min(X)', 't_min(X)', 't_min(X)', 't_min(X)', 't_min(X)', 't_min(X)', 't_min(X)', 't_min(X)', 't_min(X)' /))
     623  TYPE(ctrl_out), SAVE :: o_rh2m_max = ctrl_out((/ 10, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     624    'rh2m_max', 'Max Relative humidity at 2m', '%',                        &
     625      (/ 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', &
     626         't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)' /))
     627  TYPE(ctrl_out), SAVE :: o_qsat2m = ctrl_out((/ 10, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     628    'qsat2m', 'Saturant humidity at 2m', '%', (/ ('', i=1, 9) /))
     629  TYPE(ctrl_out), SAVE :: o_tpot = ctrl_out((/ 10, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     630    'tpot', 'Surface air potential temperature', 'K', (/ ('', i=1, 9) /))
     631  TYPE(ctrl_out), SAVE :: o_tpote = ctrl_out((/ 10, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     632    'tpote', &
     633      'Surface air equivalent potential temperature', 'K', (/ ('', i=1, 9) /))
     634  TYPE(ctrl_out), SAVE :: o_tke = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     635    'tke ', 'TKE', 'm2/s2', (/ ('', i=1, 9) /))
     636  TYPE(ctrl_out), SAVE :: o_tke_max = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     637    'tke_max', 'TKE max', 'm2/s2',                                        &
     638      (/ 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', &
     639         't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)' /))
    624640
    625641  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_tke_srf      = (/             &
    626       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_ter',                   &
    627       "Max Turb. Kinetic Energy "//clnsurf(1),"-", (/ ('', i=1, 6) /)), &
    628       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_lic',                   &
    629       "Max Turb. Kinetic Energy "//clnsurf(2),"-", (/ ('', i=1, 6) /)), &
    630       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_oce',                   &
    631       "Max Turb. Kinetic Energy "//clnsurf(3),"-", (/ ('', i=1, 6) /)), &
    632       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_sic',                   &
    633       "Max Turb. Kinetic Energy "//clnsurf(4),"-", (/ ('', i=1, 6) /)) /)
    634 
    635   TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_tke_max_srf  = (/                                  &
    636       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_ter',                                    &
    637       "Max Turb. Kinetic Energy "//clnsurf(1),"-",                                           &
    638       (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /)), &
    639       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_lic',                                    &
    640       "Max Turb. Kinetic Energy "//clnsurf(2),"-",                                           &
    641       (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /)), &
    642       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_oce',                                    &
    643       "Max Turb. Kinetic Energy "//clnsurf(3),"-",                                           &
    644       (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /)), &
    645       ctrl_out((/ 10, 4, 10, 10, 10, 10 /),'tke_max_sic',                                    &
    646       "Max Turb. Kinetic Energy "//clnsurf(4),"-",                                           &
    647       (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /)) /)
    648 
    649   TYPE(ctrl_out), SAVE :: o_kz = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    650         'kz', 'Kz melange', 'm2/s', (/ ('', i=1, 6) /))
    651   TYPE(ctrl_out), SAVE :: o_kz_max = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    652         'kz_max', 'Kz melange max', 'm2/s',                                  &
    653       (/ 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)' /))
    654   TYPE(ctrl_out), SAVE :: o_SWnetOR = ctrl_out((/ 10, 10, 2, 10, 10, 10 /), &
    655         'SWnetOR', 'Sfce net SW radiation OR', 'W/m2', (/ ('', i=1, 6) /))
    656   TYPE(ctrl_out), SAVE :: o_SWdownOR = ctrl_out((/ 10, 10, 2, 10, 10, 10 /), &
    657         'SWdownOR', 'Sfce incident SW radiation OR', 'W/m2', (/ ('', i=1, 6) /))
    658   TYPE(ctrl_out), SAVE :: o_LWdownOR = ctrl_out((/ 10, 10, 2, 10, 10, 10 /), &
    659         'LWdownOR', 'Sfce incident LW radiation OR', 'W/m2', (/ ('', i=1, 6) /))
    660   TYPE(ctrl_out), SAVE :: o_snowl = ctrl_out((/ 10, 1, 10, 10, 10, 10 /), &
    661         'snowl', 'Solid Large-scale Precip.', 'kg/(m2*s)', (/ ('', i=1, 6) /))
    662   TYPE(ctrl_out), SAVE :: o_cape_max = ctrl_out((/ 10, 1, 10, 10, 10, 10 /), &
    663         'cape_max', 'CAPE max.', 'J/kg',                                       &
    664       (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /))
    665   TYPE(ctrl_out), SAVE :: o_solldown = ctrl_out((/ 10, 1, 10, 10, 10, 10 /), &
    666         'solldown', 'Down. IR rad. at surface', 'W/m2', (/ ('', i=1, 6) /))
    667   TYPE(ctrl_out), SAVE :: o_dtsvdfo = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    668         'dtsvdfo', 'Boundary-layer dTs(o)', 'K/s', (/ ('', i=1, 6) /))
    669   TYPE(ctrl_out), SAVE :: o_dtsvdft = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    670         'dtsvdft', 'Boundary-layer dTs(t)', 'K/s', (/ ('', i=1, 6) /))
    671   TYPE(ctrl_out), SAVE :: o_dtsvdfg = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    672         'dtsvdfg', 'Boundary-layer dTs(g)', 'K/s', (/ ('', i=1, 6) /))
    673   TYPE(ctrl_out), SAVE :: o_dtsvdfi = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    674         'dtsvdfi', 'Boundary-layer dTs(g)', 'K/s', (/ ('', i=1, 6) /))
    675   TYPE(ctrl_out), SAVE :: o_rugs = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    676         'rugs', 'rugosity', '-', (/ ('', i=1, 6) /))
    677   TYPE(ctrl_out), SAVE :: o_topswad = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    678         'topswad', 'ADE at TOA', 'W/m2', (/ ('', i=1, 6) /))
    679   TYPE(ctrl_out), SAVE :: o_topswad0 = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    680         'topswad0', 'ADE clear-sky at TOA', 'W/m2', (/ ('', i=1, 6) /))
    681   TYPE(ctrl_out), SAVE :: o_topswai = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    682         'topswai', 'AIE at TOA', 'W/m2', (/ ('', i=1, 6) /))
    683   TYPE(ctrl_out), SAVE :: o_solswad = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    684         'solswad', 'ADE at SRF', 'W/m2', (/ ('', i=1, 6) /))
    685   TYPE(ctrl_out), SAVE :: o_solswad0 = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    686         'solswad0', 'ADE clear-sky at SRF', 'W/m2', (/ ('', i=1, 6) /))
    687   TYPE(ctrl_out), SAVE :: o_solswai = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    688         'solswai', 'AIE at SFR', 'W/m2', (/ ('', i=1, 6) /))
    689 
    690 !  type(ctrl_out),save,dimension(10) :: o_tausumaero  = (/ ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASBCM', &
    691 !       (/ ('', i=1, 6) /)), &
     642      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_ter',       &
     643      "Max Turb. Kinetic Energy "//clnsurf(1),"-", (/ ('', i=1, 9) /)), &
     644      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_lic',       &
     645      "Max Turb. Kinetic Energy "//clnsurf(2),"-", (/ ('', i=1, 9) /)), &
     646      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_oce',       &
     647      "Max Turb. Kinetic Energy "//clnsurf(3),"-", (/ ('', i=1, 9) /)), &
     648      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_sic',       &
     649      "Max Turb. Kinetic Energy "//clnsurf(4),"-", (/ ('', i=1, 9) /)) /)
     650
     651  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_tke_max_srf  = (/                          &
     652      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_max_ter',                &
     653      "Max Turb. Kinetic Energy "//clnsurf(1),"-",                                   &
     654      (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", &
     655         "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /)), &
     656      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_max_lic',                &
     657      "Max Turb. Kinetic Energy "//clnsurf(2),"-",                                   &
     658      (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", &
     659         "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /)), &
     660      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_max_oce',                &
     661      "Max Turb. Kinetic Energy "//clnsurf(3),"-",                                   &
     662      (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", &
     663         "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /)), &
     664      ctrl_out((/ 10, 4, 10, 10, 10, 10, 11, 11, 11 /),'tke_max_sic',                &
     665      "Max Turb. Kinetic Energy "//clnsurf(4),"-",                                   &
     666      (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", &
     667         "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /)) /)
     668
     669  TYPE(ctrl_out), SAVE :: o_kz = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     670    'kz', 'Kz melange', 'm2/s', (/ ('', i=1, 9) /))
     671  TYPE(ctrl_out), SAVE :: o_kz_max = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     672    'kz_max', 'Kz melange max', 'm2/s',                                  &
     673      (/ 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', 't_max(X)', &
     674         't_max(X)', "t_max(X)", "t_max(X)", "t_max(X)" /))
     675  TYPE(ctrl_out), SAVE :: o_SWnetOR = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     676    'SWnetOR', 'Sfce net SW radiation OR', 'W/m2', (/ ('', i=1, 9) /))
     677  TYPE(ctrl_out), SAVE :: o_SWdownOR = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     678    'SWdownOR', 'Sfce incident SW radiation OR', 'W/m2', (/ ('', i=1, 9) /))
     679  TYPE(ctrl_out), SAVE :: o_LWdownOR = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     680    'LWdownOR', 'Sfce incident LW radiation OR', 'W/m2', (/ ('', i=1, 9) /))
     681  TYPE(ctrl_out), SAVE :: o_snowl = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     682    'snowl', 'Solid Large-scale Precip.', 'kg/(m2*s)', (/ ('', i=1, 9) /))
     683  TYPE(ctrl_out), SAVE :: o_cape_max = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     684    'cape_max', 'CAPE max.', 'J/kg',                                       &
     685      (/ "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)", &
     686         "t_max(X)", "t_max(X)", "t_max(X)", "t_max(X)" /))
     687  TYPE(ctrl_out), SAVE :: o_solldown = ctrl_out((/ 10, 1, 10, 10, 10, 10, 11, 11, 11 /), &
     688    'solldown', 'Down. IR rad. at surface', 'W/m2', (/ ('', i=1, 9) /))
     689  TYPE(ctrl_out), SAVE :: o_dtsvdfo = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     690    'dtsvdfo', 'Boundary-layer dTs(o)', 'K/s', (/ ('', i=1, 9) /))
     691  TYPE(ctrl_out), SAVE :: o_dtsvdft = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     692    'dtsvdft', 'Boundary-layer dTs(t)', 'K/s', (/ ('', i=1, 9) /))
     693  TYPE(ctrl_out), SAVE :: o_dtsvdfg = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     694    'dtsvdfg', 'Boundary-layer dTs(g)', 'K/s', (/ ('', i=1, 9) /))
     695  TYPE(ctrl_out), SAVE :: o_dtsvdfi = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     696    'dtsvdfi', 'Boundary-layer dTs(g)', 'K/s', (/ ('', i=1, 9) /))
     697  TYPE(ctrl_out), SAVE :: o_rugs = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     698    'rugs', 'rugosity', '-', (/ ('', i=1, 9) /))
     699  TYPE(ctrl_out), SAVE :: o_topswad = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     700    'topswad', 'ADE at TOA', 'W/m2', (/ ('', i=1, 9) /))
     701  TYPE(ctrl_out), SAVE :: o_topswad0 = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     702    'topswad0', 'ADE clear-sky at TOA', 'W/m2', (/ ('', i=1, 9) /))
     703  TYPE(ctrl_out), SAVE :: o_topswai = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     704    'topswai', 'AIE at TOA', 'W/m2', (/ ('', i=1, 9) /))
     705  TYPE(ctrl_out), SAVE :: o_solswad = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     706    'solswad', 'ADE at SRF', 'W/m2', (/ ('', i=1, 9) /))
     707  TYPE(ctrl_out), SAVE :: o_solswad0 = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     708    'solswad0', 'ADE clear-sky at SRF', 'W/m2', (/ ('', i=1, 9) /))
     709  TYPE(ctrl_out), SAVE :: o_solswai = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     710    'solswai', 'AIE at SFR', 'W/m2', (/ ('', i=1, 9) /))
     711
     712!  type(ctrl_out),save,dimension(10) :: o_tausumaero  = (/ ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_ASBCM', &
     713!    (/ ('', i=1, 9) /)), &
    692714  type(ctrl_out),save,dimension(11) :: o_tausumaero  =                           &
    693     (/ ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASBCM',                        &
    694       "Aerosol Optical depth at 550 nm "//name_aero(1),"1", (/ ('', i=1, 6) /)), &
    695        ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASPOMM',                       &
    696       "Aerosol Optical depth at 550 nm "//name_aero(2),"1", (/ ('', i=1, 6) /)), &
    697        ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSO4M',                       &
    698       "Aerosol Optical depth at 550 nm "//name_aero(3),"1", (/ ('', i=1, 6) /)), &
    699        ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSO4M',                       &
    700       "Aerosol Optical depth at 550 nm "//name_aero(4),"1", (/ ('', i=1, 6) /)), &
    701        ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_SSSSM',                        &
    702       "Aerosol Optical depth at 550 nm "//name_aero(5),"1", (/ ('', i=1, 6) /)), &
    703        ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_ASSSM',                        &
    704       "Aerosol Optical depth at 550 nm "//name_aero(6),"1", (/ ('', i=1, 6) /)), &
    705        ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CSSSM',                        &
    706       "Aerosol Optical depth at 550 nm "//name_aero(7),"1", (/ ('', i=1, 6) /)), &
    707        ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_CIDUSTM',                      &
    708       "Aerosol Optical depth at 550 nm "//name_aero(8),"1", (/ ('', i=1, 6) /)), &
    709        ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIBCM',                        &
    710       "Aerosol Optical depth at 550 nm "//name_aero(9),"1", (/ ('', i=1, 6) /)), &
    711        ctrl_out((/ 2, 6, 10, 10, 10, 10 /),'OD550_AIPOMM',                       &
    712       "Aerosol Optical depth at 550 nm "//name_aero(10),"1", (/ ('', i=1, 6) /)),&
    713        ctrl_out((/ 2, 2, 10, 10, 10, 10 /),'OD550_STRAT',                        &
    714       "Aerosol Optical depth at 550 nm "//name_aero(11),"1", (/ ('', i=1, 6) /)) /)
    715   TYPE(ctrl_out), SAVE :: o_od550aer = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    716         'od550aer', 'Total aerosol optical depth at 550nm', '-', (/ ('', i=1, 6) /))
    717   TYPE(ctrl_out), SAVE :: o_od865aer = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    718         'od865aer', 'Total aerosol optical depth at 870nm', '-', (/ ('', i=1, 6) /))
    719   TYPE(ctrl_out), SAVE :: o_absvisaer = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    720         'absvisaer', 'Absorption aerosol visible optical depth', '-', (/ ('', i=1, 6) /))
    721   TYPE(ctrl_out), SAVE :: o_od550lt1aer = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    722         'od550lt1aer', 'Fine mode optical depth', '-', (/ ('', i=1, 6) /))
    723   TYPE(ctrl_out), SAVE :: o_sconcso4 = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    724         'sconcso4', 'Surface Concentration of Sulfate ', 'kg/m3', (/ ('', i=1, 6) /))
    725   TYPE(ctrl_out), SAVE :: o_sconcoa = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    726         'sconcoa', 'Surface Concentration of Organic Aerosol ', 'kg/m3', (/ ('', i=1, 6) /))
    727   TYPE(ctrl_out), SAVE :: o_sconcbc = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    728         'sconcbc', 'Surface Concentration of Black Carbon ', 'kg/m3', (/ ('', i=1, 6) /))
    729   TYPE(ctrl_out), SAVE :: o_sconcss = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    730         'sconcss', 'Surface Concentration of Sea Salt ', 'kg/m3', (/ ('', i=1, 6) /))
    731   TYPE(ctrl_out), SAVE :: o_sconcdust = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    732         'sconcdust', 'Surface Concentration of Dust ', 'kg/m3', (/ ('', i=1, 6) /))
    733   TYPE(ctrl_out), SAVE :: o_concso4 = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    734         'concso4', 'Concentration of Sulfate ', 'kg/m3', (/ ('', i=1, 6) /))
    735   TYPE(ctrl_out), SAVE :: o_concoa = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    736         'concoa', 'Concentration of Organic Aerosol ', 'kg/m3', (/ ('', i=1, 6) /))
    737   TYPE(ctrl_out), SAVE :: o_concbc = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    738         'concbc', 'Concentration of Black Carbon ', 'kg/m3', (/ ('', i=1, 6) /))
    739   TYPE(ctrl_out), SAVE :: o_concss = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    740         'concss', 'Concentration of Sea Salt ', 'kg/m3', (/ ('', i=1, 6) /))
    741   TYPE(ctrl_out), SAVE :: o_concdust = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    742         'concdust', 'Concentration of Dust ', 'kg/m3', (/ ('', i=1, 6) /))
    743   TYPE(ctrl_out), SAVE :: o_loadso4 = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    744         'loadso4', 'Column Load of Sulfate ', 'kg/m2', (/ ('', i=1, 6) /))
    745   TYPE(ctrl_out), SAVE :: o_loadoa = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    746         'loadoa', 'Column Load of Organic Aerosol ', 'kg/m2', (/ ('', i=1, 6) /))
    747   TYPE(ctrl_out), SAVE :: o_loadbc = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    748         'loadbc', 'Column Load of Black Carbon ', 'kg/m2', (/ ('', i=1, 6) /))
    749   TYPE(ctrl_out), SAVE :: o_loadss = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    750         'loadss', 'Column Load of Sea Salt ', 'kg/m2', (/ ('', i=1, 6) /))
    751   TYPE(ctrl_out), SAVE :: o_loaddust = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    752         'loaddust', 'Column Load of Dust ', 'kg/m2', (/ ('', i=1, 6) /))
    753   TYPE(ctrl_out), SAVE :: o_swtoaas_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    754         'swtoaas_nat', 'Natural aerosol radiative forcing all-sky at TOA', 'W/m2', (/ ('', i=1, 6) /))
    755   TYPE(ctrl_out), SAVE :: o_swsrfas_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    756         'swsrfas_nat', 'Natural aerosol radiative forcing all-sky at SRF', 'W/m2', (/ ('', i=1, 6) /))
    757   TYPE(ctrl_out), SAVE :: o_swtoacs_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    758         'swtoacs_nat', 'Natural aerosol radiative forcing clear-sky at TOA', 'W/m2', (/ ('', i=1, 6) /))
    759   TYPE(ctrl_out), SAVE :: o_swsrfcs_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    760         'swsrfcs_nat', 'Natural aerosol radiative forcing clear-sky at SRF', 'W/m2', (/ ('', i=1, 6) /))
    761   TYPE(ctrl_out), SAVE :: o_swtoaas_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    762         'swtoaas_ant', 'Anthropogenic aerosol radiative forcing all-sky at TOA', 'W/m2', (/ ('', i=1, 6) /))
    763   TYPE(ctrl_out), SAVE :: o_swsrfas_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    764         'swsrfas_ant', 'Anthropogenic aerosol radiative forcing all-sky at SRF', 'W/m2', (/ ('', i=1, 6) /))
    765   TYPE(ctrl_out), SAVE :: o_swtoacs_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    766         'swtoacs_ant', 'Anthropogenic aerosol radiative forcing clear-sky at TOA', 'W/m2', (/ ('', i=1, 6) /))
    767   TYPE(ctrl_out), SAVE :: o_swsrfcs_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    768         'swsrfcs_ant', 'Anthropogenic aerosol radiative forcing clear-sky at SRF', 'W/m2', (/ ('', i=1, 6) /))
    769   TYPE(ctrl_out), SAVE :: o_swtoacf_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    770         'swtoacf_nat', 'Natural aerosol impact on cloud radiative forcing at TOA', 'W/m2', (/ ('', i=1, 6) /))
    771   TYPE(ctrl_out), SAVE :: o_swsrfcf_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    772         'swsrfcf_nat', 'Natural aerosol impact on cloud radiative forcing  at SRF', 'W/m2', (/ ('', i=1, 6) /))
    773   TYPE(ctrl_out), SAVE :: o_swtoacf_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    774         'swtoacf_ant', 'Anthropogenic aerosol impact on cloud radiative forcing at TOA', 'W/m2', (/ ('', i=1, 6) /))
    775   TYPE(ctrl_out), SAVE :: o_swsrfcf_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    776         'swsrfcf_ant', 'Anthropogenic aerosol impact on cloud radiative forcing at SRF', 'W/m2', (/ ('', i=1, 6) /))
    777   TYPE(ctrl_out), SAVE :: o_swtoacf_zero = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    778         'swtoacf_zero', 'Cloud radiative forcing (allsky-clearsky fluxes) at TOA', 'W/m2', (/ ('', i=1, 6) /))
    779   TYPE(ctrl_out), SAVE :: o_swsrfcf_zero = ctrl_out((/ 4, 6, 10, 10, 10, 10 /), &
    780         'swsrfcf_zero', 'Cloud radiative forcing (allsky-clearsky fluxes) at SRF', 'W/m2', (/ ('', i=1, 6) /))
    781   TYPE(ctrl_out), SAVE :: o_cldncl = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    782         'cldncl', 'CDNC at top of liquid water cloud', 'm-3', (/ ('', i=1, 6) /))
    783   TYPE(ctrl_out), SAVE :: o_reffclwtop = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    784         'reffclwtop', 'Droplet effective radius at top of liquid water cloud', 'm', (/ ('', i=1, 6) /))
    785   TYPE(ctrl_out), SAVE :: o_cldnvi = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    786         'cldnvi', 'Column Integrated Cloud Droplet Number', 'm-2', (/ ('', i=1, 6) /))
    787   TYPE(ctrl_out), SAVE :: o_lcc = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    788         'lcc', 'Cloud liquid fraction at top of cloud', '1', (/ ('', i=1, 6) /))
     715    (/ ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_ASBCM',                        &
     716      "Aerosol Optical depth at 550 nm "//name_aero(1),"1", (/ ('', i=1, 9) /)), &
     717       ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_ASPOMM',                       &
     718      "Aerosol Optical depth at 550 nm "//name_aero(2),"1", (/ ('', i=1, 9) /)), &
     719       ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_ASSO4M',                       &
     720      "Aerosol Optical depth at 550 nm "//name_aero(3),"1", (/ ('', i=1, 9) /)), &
     721       ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_CSSO4M',                       &
     722      "Aerosol Optical depth at 550 nm "//name_aero(4),"1", (/ ('', i=1, 9) /)), &
     723       ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_SSSSM',                        &
     724      "Aerosol Optical depth at 550 nm "//name_aero(5),"1", (/ ('', i=1, 9) /)), &
     725       ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_ASSSM',                        &
     726      "Aerosol Optical depth at 550 nm "//name_aero(6),"1", (/ ('', i=1, 9) /)), &
     727       ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_CSSSM',                        &
     728      "Aerosol Optical depth at 550 nm "//name_aero(7),"1", (/ ('', i=1, 9) /)), &
     729       ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_CIDUSTM',                      &
     730      "Aerosol Optical depth at 550 nm "//name_aero(8),"1", (/ ('', i=1, 9) /)), &
     731       ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_AIBCM',                        &
     732      "Aerosol Optical depth at 550 nm "//name_aero(9),"1", (/ ('', i=1, 9) /)), &
     733       ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /),'OD550_AIPOMM',                       &
     734      "Aerosol Optical depth at 550 nm "//name_aero(10),"1", (/ ('', i=1, 9) /)),&
     735       ctrl_out((/ 2, 2, 10, 10, 10, 10, 11, 11, 11 /),'OD550_STRAT',                        &
     736      "Aerosol Optical depth at 550 nm "//name_aero(11),"1", (/ ('', i=1, 9) /)) /)
     737  TYPE(ctrl_out), SAVE :: o_od550aer = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     738    'od550aer', 'Total aerosol optical depth at 550nm', '-', (/ ('', i=1, 9) /))
     739  TYPE(ctrl_out), SAVE :: o_od865aer = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     740    'od865aer', 'Total aerosol optical depth at 870nm', '-', (/ ('', i=1, 9) /))
     741  TYPE(ctrl_out), SAVE :: o_absvisaer = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     742    'absvisaer', 'Absorption aerosol visible optical depth', '-', (/ ('', i=1, 9) /))
     743  TYPE(ctrl_out), SAVE :: o_od550lt1aer = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     744    'od550lt1aer', 'Fine mode optical depth', '-', (/ ('', i=1, 9) /))
     745  TYPE(ctrl_out), SAVE :: o_sconcso4 = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     746    'sconcso4', 'Surface Concentration of Sulfate ', 'kg/m3', (/ ('', i=1, 9) /))
     747  TYPE(ctrl_out), SAVE :: o_sconcoa = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     748    'sconcoa', 'Surface Concentration of Organic Aerosol ', 'kg/m3', (/ ('', i=1, 9) /))
     749  TYPE(ctrl_out), SAVE :: o_sconcbc = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     750    'sconcbc', 'Surface Concentration of Black Carbon ', 'kg/m3', (/ ('', i=1, 9) /))
     751  TYPE(ctrl_out), SAVE :: o_sconcss = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     752    'sconcss', 'Surface Concentration of Sea Salt ', 'kg/m3', (/ ('', i=1, 9) /))
     753  TYPE(ctrl_out), SAVE :: o_sconcdust = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     754    'sconcdust', 'Surface Concentration of Dust ', 'kg/m3', (/ ('', i=1, 9) /))
     755  TYPE(ctrl_out), SAVE :: o_concso4 = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     756    'concso4', 'Concentration of Sulfate ', 'kg/m3', (/ ('', i=1, 9) /))
     757  TYPE(ctrl_out), SAVE :: o_concoa = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     758    'concoa', 'Concentration of Organic Aerosol ', 'kg/m3', (/ ('', i=1, 9) /))
     759  TYPE(ctrl_out), SAVE :: o_concbc = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     760    'concbc', 'Concentration of Black Carbon ', 'kg/m3', (/ ('', i=1, 9) /))
     761  TYPE(ctrl_out), SAVE :: o_concss = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     762    'concss', 'Concentration of Sea Salt ', 'kg/m3', (/ ('', i=1, 9) /))
     763  TYPE(ctrl_out), SAVE :: o_concdust = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     764    'concdust', 'Concentration of Dust ', 'kg/m3', (/ ('', i=1, 9) /))
     765  TYPE(ctrl_out), SAVE :: o_loadso4 = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     766    'loadso4', 'Column Load of Sulfate ', 'kg/m2', (/ ('', i=1, 9) /))
     767  TYPE(ctrl_out), SAVE :: o_loadoa = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     768    'loadoa', 'Column Load of Organic Aerosol ', 'kg/m2', (/ ('', i=1, 9) /))
     769  TYPE(ctrl_out), SAVE :: o_loadbc = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     770    'loadbc', 'Column Load of Black Carbon ', 'kg/m2', (/ ('', i=1, 9) /))
     771  TYPE(ctrl_out), SAVE :: o_loadss = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     772    'loadss', 'Column Load of Sea Salt ', 'kg/m2', (/ ('', i=1, 9) /))
     773  TYPE(ctrl_out), SAVE :: o_loaddust = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     774    'loaddust', 'Column Load of Dust ', 'kg/m2', (/ ('', i=1, 9) /))
     775  TYPE(ctrl_out), SAVE :: o_swtoaas_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     776    'swtoaas_nat', 'Natural aerosol radiative forcing all-sky at TOA', 'W/m2', (/ ('', i=1, 9) /))
     777  TYPE(ctrl_out), SAVE :: o_swsrfas_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     778    'swsrfas_nat', 'Natural aerosol radiative forcing all-sky at SRF', 'W/m2', (/ ('', i=1, 9) /))
     779  TYPE(ctrl_out), SAVE :: o_swtoacs_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     780    'swtoacs_nat', 'Natural aerosol radiative forcing clear-sky at TOA', 'W/m2', (/ ('', i=1, 9) /))
     781  TYPE(ctrl_out), SAVE :: o_swsrfcs_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     782    'swsrfcs_nat', 'Natural aerosol radiative forcing clear-sky at SRF', 'W/m2', (/ ('', i=1, 9) /))
     783  TYPE(ctrl_out), SAVE :: o_swtoaas_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     784    'swtoaas_ant', 'Anthropogenic aerosol radiative forcing all-sky at TOA', 'W/m2', (/ ('', i=1, 9) /))
     785  TYPE(ctrl_out), SAVE :: o_swsrfas_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     786    'swsrfas_ant', 'Anthropogenic aerosol radiative forcing all-sky at SRF', 'W/m2', (/ ('', i=1, 9) /))
     787  TYPE(ctrl_out), SAVE :: o_swtoacs_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     788    'swtoacs_ant', 'Anthropogenic aerosol radiative forcing clear-sky at TOA', 'W/m2', (/ ('', i=1, 9) /))
     789  TYPE(ctrl_out), SAVE :: o_swsrfcs_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     790    'swsrfcs_ant', 'Anthropogenic aerosol radiative forcing clear-sky at SRF', 'W/m2', (/ ('', i=1, 9) /))
     791  TYPE(ctrl_out), SAVE :: o_swtoacf_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     792    'swtoacf_nat', 'Natural aerosol impact on cloud radiative forcing at TOA', 'W/m2', (/ ('', i=1, 9) /))
     793  TYPE(ctrl_out), SAVE :: o_swsrfcf_nat = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     794    'swsrfcf_nat', 'Natural aerosol impact on cloud radiative forcing  at SRF', 'W/m2', (/ ('', i=1, 9) /))
     795  TYPE(ctrl_out), SAVE :: o_swtoacf_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     796    'swtoacf_ant', 'Anthropogenic aerosol impact on cloud radiative forcing at TOA', 'W/m2', (/ ('', i=1, 9) /))
     797  TYPE(ctrl_out), SAVE :: o_swsrfcf_ant = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     798    'swsrfcf_ant', 'Anthropogenic aerosol impact on cloud radiative forcing at SRF', 'W/m2', (/ ('', i=1, 9) /))
     799  TYPE(ctrl_out), SAVE :: o_swtoacf_zero = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     800    'swtoacf_zero', 'Cloud radiative forcing (allsky-clearsky fluxes) at TOA', 'W/m2', (/ ('', i=1, 9) /))
     801  TYPE(ctrl_out), SAVE :: o_swsrfcf_zero = ctrl_out((/ 4, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     802    'swsrfcf_zero', 'Cloud radiative forcing (allsky-clearsky fluxes) at SRF', 'W/m2', (/ ('', i=1, 9) /))
     803  TYPE(ctrl_out), SAVE :: o_cldncl = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     804    'cldncl', 'CDNC at top of liquid water cloud', 'm-3', (/ ('', i=1, 9) /))
     805  TYPE(ctrl_out), SAVE :: o_reffclwtop = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     806    'reffclwtop', 'Droplet effective radius at top of liquid water cloud', 'm', (/ ('', i=1, 9) /))
     807  TYPE(ctrl_out), SAVE :: o_cldnvi = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     808    'cldnvi', 'Column Integrated Cloud Droplet Number', 'm-2', (/ ('', i=1, 9) /))
     809  TYPE(ctrl_out), SAVE :: o_lcc = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     810    'lcc', 'Cloud liquid fraction at top of cloud', '1', (/ ('', i=1, 9) /))
    789811
    790812
    791813!!!!!!!!!!!!!!!!!!!!!! 3D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    792   TYPE(ctrl_out), SAVE :: o_ec550aer = ctrl_out((/ 2, 6, 10, 10, 10, 10 /), &
    793         'ec550aer', 'Extinction at 550nm', 'm^-1', (/ ('', i=1, 6) /))
    794   TYPE(ctrl_out), SAVE :: o_lwcon = ctrl_out((/ 2, 5, 10, 10, 10, 10 /), &
    795         'lwcon', 'Cloud liquid water content', 'kg/kg', (/ ('', i=1, 6) /))
    796   TYPE(ctrl_out), SAVE :: o_iwcon = ctrl_out((/ 2, 5, 10, 10, 10, 10 /), &
    797         'iwcon', 'Cloud ice water content', 'kg/kg', (/ ('', i=1, 6) /))
    798   TYPE(ctrl_out), SAVE :: o_temp = ctrl_out((/ 2, 3, 4, 10, 10, 10 /), &
    799         'temp', 'Air temperature', 'K', (/ ('', i=1, 6) /))
    800   TYPE(ctrl_out), SAVE :: o_theta = ctrl_out((/ 2, 3, 4, 10, 10, 10 /), &
    801         'theta', 'Potential air temperature', 'K', (/ ('', i=1, 6) /))
    802   TYPE(ctrl_out), SAVE :: o_ovap = ctrl_out((/ 2, 3, 4, 10, 10, 10 /), &
    803         'ovap', 'Specific humidity', 'kg/kg', (/ ('', i=1, 6) /))
    804   TYPE(ctrl_out), SAVE :: o_ovapinit = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    805         'ovapinit', 'Specific humidity (begin of timestep)', 'kg/kg', (/ ('', i=1, 6) /))
    806   TYPE(ctrl_out), SAVE :: o_oliq = ctrl_out((/ 2, 3, 4, 10, 10, 10 /), &
    807         'oliq', 'Condensed water', 'kg/kg', (/ ('', i=1, 6) /))
    808   TYPE(ctrl_out), SAVE :: o_wvapp = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    809         'wvapp', '', '', (/ ('', i=1, 6) /))
    810   TYPE(ctrl_out), SAVE :: o_geop = ctrl_out((/ 2, 3, 10, 10, 10, 10 /), &
    811         'geop', 'Geopotential height', 'm2/s2', (/ ('', i=1, 6) /))
    812   TYPE(ctrl_out), SAVE :: o_vitu = ctrl_out((/ 2, 3, 4, 6, 10, 10 /), &
    813         'vitu', 'Zonal wind', 'm/s', (/ ('', i=1, 6) /))
    814   TYPE(ctrl_out), SAVE :: o_vitv = ctrl_out((/ 2, 3, 4, 6, 10, 10 /), &
    815         'vitv', 'Meridional wind', 'm/s', (/ ('', i=1, 6) /))
    816   TYPE(ctrl_out), SAVE :: o_vitw = ctrl_out((/ 2, 3, 10, 6, 10, 10 /), &
    817         'vitw', 'Vertical wind', 'Pa/s', (/ ('', i=1, 6) /))
    818   TYPE(ctrl_out), SAVE :: o_pres = ctrl_out((/ 2, 3, 10, 10, 10, 10 /), &
    819         'pres', 'Air pressure', 'Pa', (/ ('', i=1, 6) /))
    820   TYPE(ctrl_out), SAVE :: o_paprs = ctrl_out((/ 2, 3, 10, 10, 10, 10 /), &
    821         'paprs', 'Air pressure Inter-Couches', 'Pa', (/ ('', i=1, 6) /))
    822   TYPE(ctrl_out), SAVE :: o_mass = ctrl_out((/ 2, 3, 10, 10, 10, 10 /), &
    823         'mass', 'Masse Couches', 'kg/m2', (/ ('', i=1, 6) /))
    824   TYPE(ctrl_out), SAVE :: o_zfull = ctrl_out((/ 2, 3, 10, 10, 10, 10 /), &
    825         'zfull', 'Altitude of full pressure levels', 'm', (/ ('', i=1, 6) /))
    826   TYPE(ctrl_out), SAVE :: o_zhalf = ctrl_out((/ 2, 3, 10, 10, 10, 10 /), &
    827         'zhalf', 'Altitude of half pressure levels', 'm', (/ ('', i=1, 6) /))
    828   TYPE(ctrl_out), SAVE :: o_rneb = ctrl_out((/ 2, 5, 10, 10, 10, 10 /), &
    829         'rneb', 'Cloud fraction', '-', (/ ('', i=1, 6) /))
    830   TYPE(ctrl_out), SAVE :: o_rnebcon = ctrl_out((/ 2, 5, 10, 10, 10, 10 /), &
    831         'rnebcon', 'Convective Cloud Fraction', '-', (/ ('', i=1, 6) /))
    832   TYPE(ctrl_out), SAVE :: o_rnebls = ctrl_out((/ 2, 5, 10, 10, 10, 10 /), &
    833         'rnebls', 'LS Cloud fraction', '-', (/ ('', i=1, 6) /))
    834   TYPE(ctrl_out), SAVE :: o_rhum = ctrl_out((/ 2, 5, 10, 10, 10, 10 /), &
    835         'rhum', 'Relative humidity', '-', (/ ('', i=1, 6) /))
    836   TYPE(ctrl_out), SAVE :: o_ozone = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    837         'ozone', 'Ozone mole fraction', '-', (/ ('', i=1, 6) /))
    838   TYPE(ctrl_out), SAVE :: o_ozone_light = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    839         'ozone_daylight', 'Daylight ozone mole fraction', '-', (/ ('', i=1, 6) /))
    840   TYPE(ctrl_out), SAVE :: o_upwd = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    841         'upwd', 'saturated updraft', 'kg/m2/s', (/ ('', i=1, 6) /))
    842   TYPE(ctrl_out), SAVE :: o_dtphy = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    843         'dtphy', 'Physics dT', 'K/s', (/ ('', i=1, 6) /))
    844   TYPE(ctrl_out), SAVE :: o_dqphy = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    845         'dqphy', 'Physics dQ', '(kg/kg)/s', (/ ('', i=1, 6) /))
    846   TYPE(ctrl_out), SAVE :: o_pr_con_l = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    847         'pr_con_l', 'Convective precipitation lic', ' ', (/ ('', i=1, 6) /))
    848   TYPE(ctrl_out), SAVE :: o_pr_con_i = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    849         'pr_con_i', 'Convective precipitation ice', ' ', (/ ('', i=1, 6) /))
    850   TYPE(ctrl_out), SAVE :: o_pr_lsc_l = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    851         'pr_lsc_l', 'Large scale precipitation lic', ' ', (/ ('', i=1, 6) /))
    852   TYPE(ctrl_out), SAVE :: o_pr_lsc_i = ctrl_out((/ 2, 10, 10, 10, 10, 10 /), &
    853         'pr_lsc_i', 'Large scale precipitation ice', ' ', (/ ('', i=1, 6) /))
    854   TYPE(ctrl_out), SAVE :: o_re = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    855         're', 'Cloud droplet effective radius', 'um', (/ ('', i=1, 6) /))
    856   TYPE(ctrl_out), SAVE :: o_fl = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    857         'fl', 'Denominator of Cloud droplet effective radius', ' ', (/ ('', i=1, 6) /))
    858   TYPE(ctrl_out), SAVE :: o_scdnc = ctrl_out((/ 2,  6, 10, 10, 10, 10 /), &
    859         'scdnc', 'Cloud droplet number concentration', 'm-3', (/ ('', i=1, 6) /))
    860   TYPE(ctrl_out), SAVE :: o_reffclws = ctrl_out((/ 2,  6, 10, 10, 10, 10 /), &
    861         'reffclws', 'Stratiform Cloud Droplet Effective Radius (aerosol diags.)', 'm', (/ ('', i=1, 6) /))
    862   TYPE(ctrl_out), SAVE :: o_reffclwc = ctrl_out((/ 2,  6, 10, 10, 10, 10 /), &
    863         'reffclwc', 'Convective Cloud Droplet Effective Radius (aerosol diags.)', 'm', (/ ('', i=1, 6) /))
    864   TYPE(ctrl_out), SAVE :: o_lcc3d = ctrl_out((/ 2,  6, 10, 10, 10, 10 /), &
    865         'lcc3d', 'Cloud liquid fraction', '1', (/ ('', i=1, 6) /))
    866   TYPE(ctrl_out), SAVE :: o_lcc3dcon = ctrl_out((/ 2,  6, 10, 10, 10, 10 /), &
    867         'lcc3dcon', 'Convective cloud liquid fraction', '1', (/ ('', i=1, 6) /))
    868   TYPE(ctrl_out), SAVE :: o_lcc3dstra = ctrl_out((/ 2,  6, 10, 10, 10, 10 /), &
    869         'lcc3dstra', 'Stratiform cloud liquid fraction', '1', (/ ('', i=1, 6) /))
     814  TYPE(ctrl_out), SAVE :: o_ec550aer = ctrl_out((/ 2, 6, 10, 10, 10, 10, 11, 11, 11 /), &
     815    'ec550aer', 'Extinction at 550nm', 'm^-1', (/ ('', i=1, 9) /))
     816  TYPE(ctrl_out), SAVE :: o_lwcon = ctrl_out((/ 2, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     817    'lwcon', 'Cloud liquid water content', 'kg/kg', (/ ('', i=1, 9) /))
     818  TYPE(ctrl_out), SAVE :: o_iwcon = ctrl_out((/ 2, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     819    'iwcon', 'Cloud ice water content', 'kg/kg', (/ ('', i=1, 9) /))
     820  TYPE(ctrl_out), SAVE :: o_temp = ctrl_out((/ 2, 3, 4, 10, 10, 10, 11, 11, 11 /), &
     821    'temp', 'Air temperature', 'K', (/ ('', i=1, 9) /))
     822  TYPE(ctrl_out), SAVE :: o_theta = ctrl_out((/ 2, 3, 4, 10, 10, 10, 11, 11, 11 /), &
     823    'theta', 'Potential air temperature', 'K', (/ ('', i=1, 9) /))
     824  TYPE(ctrl_out), SAVE :: o_ovap = ctrl_out((/ 2, 3, 4, 10, 10, 10, 11, 11, 11 /), &
     825    'ovap', 'Specific humidity', 'kg/kg', (/ ('', i=1, 9) /))
     826  TYPE(ctrl_out), SAVE :: o_ovapinit = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     827    'ovapinit', 'Specific humidity (begin of timestep)', 'kg/kg', (/ ('', i=1, 9) /))
     828  TYPE(ctrl_out), SAVE :: o_oliq = ctrl_out((/ 2, 3, 4, 10, 10, 10, 11, 11, 11 /), &
     829    'oliq', 'Condensed water', 'kg/kg', (/ ('', i=1, 9) /))
     830  TYPE(ctrl_out), SAVE :: o_wvapp = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     831    'wvapp', '', '', (/ ('', i=1, 9) /))
     832  TYPE(ctrl_out), SAVE :: o_geop = ctrl_out((/ 2, 3, 10, 10, 10, 10, 11, 11, 11 /), &
     833    'geop', 'Geopotential height', 'm2/s2', (/ ('', i=1, 9) /))
     834  TYPE(ctrl_out), SAVE :: o_vitu = ctrl_out((/ 2, 3, 4, 6, 10, 10, 11, 11, 11 /), &
     835    'vitu', 'Zonal wind', 'm/s', (/ ('', i=1, 9) /))
     836  TYPE(ctrl_out), SAVE :: o_vitv = ctrl_out((/ 2, 3, 4, 6, 10, 10, 11, 11, 11 /), &
     837    'vitv', 'Meridional wind', 'm/s', (/ ('', i=1, 9) /))
     838  TYPE(ctrl_out), SAVE :: o_vitw = ctrl_out((/ 2, 3, 10, 6, 10, 10, 11, 11, 11 /), &
     839    'vitw', 'Vertical wind', 'Pa/s', (/ ('', i=1, 9) /))
     840  TYPE(ctrl_out), SAVE :: o_pres = ctrl_out((/ 2, 3, 10, 10, 10, 10, 11, 11, 11 /), &
     841    'pres', 'Air pressure', 'Pa', (/ ('', i=1, 9) /))
     842  TYPE(ctrl_out), SAVE :: o_paprs = ctrl_out((/ 2, 3, 10, 10, 10, 10, 11, 11, 11 /), &
     843    'paprs', 'Air pressure Inter-Couches', 'Pa', (/ ('', i=1, 9) /))
     844  TYPE(ctrl_out), SAVE :: o_mass = ctrl_out((/ 2, 3, 10, 10, 10, 10, 11, 11, 11 /), &
     845    'mass', 'Masse Couches', 'kg/m2', (/ ('', i=1, 9) /))
     846  TYPE(ctrl_out), SAVE :: o_zfull = ctrl_out((/ 2, 3, 10, 10, 10, 10, 11, 11, 11 /), &
     847    'zfull', 'Altitude of full pressure levels', 'm', (/ ('', i=1, 9) /))
     848  TYPE(ctrl_out), SAVE :: o_zhalf = ctrl_out((/ 2, 3, 10, 10, 10, 10, 11, 11, 11 /), &
     849    'zhalf', 'Altitude of half pressure levels', 'm', (/ ('', i=1, 9) /))
     850  TYPE(ctrl_out), SAVE :: o_rneb = ctrl_out((/ 2, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     851    'rneb', 'Cloud fraction', '-', (/ ('', i=1, 9) /))
     852  TYPE(ctrl_out), SAVE :: o_rnebcon = ctrl_out((/ 2, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     853    'rnebcon', 'Convective Cloud Fraction', '-', (/ ('', i=1, 9) /))
     854  TYPE(ctrl_out), SAVE :: o_rnebls = ctrl_out((/ 2, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     855    'rnebls', 'LS Cloud fraction', '-', (/ ('', i=1, 9) /))
     856  TYPE(ctrl_out), SAVE :: o_rhum = ctrl_out((/ 2, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     857    'rhum', 'Relative humidity', '-', (/ ('', i=1, 9) /))
     858  TYPE(ctrl_out), SAVE :: o_ozone = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     859    'ozone', 'Ozone mole fraction', '-', (/ ('', i=1, 9) /))
     860  TYPE(ctrl_out), SAVE :: o_ozone_light = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     861    'ozone_daylight', 'Daylight ozone mole fraction', '-', (/ ('', i=1, 9) /))
     862  TYPE(ctrl_out), SAVE :: o_upwd = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     863    'upwd', 'saturated updraft', 'kg/m2/s', (/ ('', i=1, 9) /))
     864  TYPE(ctrl_out), SAVE :: o_dtphy = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     865    'dtphy', 'Physics dT', 'K/s', (/ ('', i=1, 9) /))
     866  TYPE(ctrl_out), SAVE :: o_dqphy = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     867    'dqphy', 'Physics dQ', '(kg/kg)/s', (/ ('', i=1, 9) /))
     868  TYPE(ctrl_out), SAVE :: o_pr_con_l = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     869    'pr_con_l', 'Convective precipitation lic', ' ', (/ ('', i=1, 9) /))
     870  TYPE(ctrl_out), SAVE :: o_pr_con_i = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     871    'pr_con_i', 'Convective precipitation ice', ' ', (/ ('', i=1, 9) /))
     872  TYPE(ctrl_out), SAVE :: o_pr_lsc_l = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     873    'pr_lsc_l', 'Large scale precipitation lic', ' ', (/ ('', i=1, 9) /))
     874  TYPE(ctrl_out), SAVE :: o_pr_lsc_i = ctrl_out((/ 2, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     875    'pr_lsc_i', 'Large scale precipitation ice', ' ', (/ ('', i=1, 9) /))
     876  TYPE(ctrl_out), SAVE :: o_re = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     877    're', 'Cloud droplet effective radius', 'um', (/ ('', i=1, 9) /))
     878  TYPE(ctrl_out), SAVE :: o_fl = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     879    'fl', 'Denominator of Cloud droplet effective radius', ' ', (/ ('', i=1, 9) /))
     880  TYPE(ctrl_out), SAVE :: o_scdnc = ctrl_out((/ 2,  6, 10, 10, 10, 10, 11, 11, 11 /), &
     881    'scdnc', 'Cloud droplet number concentration', 'm-3', (/ ('', i=1, 9) /))
     882  TYPE(ctrl_out), SAVE :: o_reffclws = ctrl_out((/ 2,  6, 10, 10, 10, 10, 11, 11, 11 /), &
     883    'reffclws', 'Stratiform Cloud Droplet Effective Radius (aerosol diags.)', 'm', (/ ('', i=1, 9) /))
     884  TYPE(ctrl_out), SAVE :: o_reffclwc = ctrl_out((/ 2,  6, 10, 10, 10, 10, 11, 11, 11 /), &
     885    'reffclwc', 'Convective Cloud Droplet Effective Radius (aerosol diags.)', 'm', (/ ('', i=1, 9) /))
     886  TYPE(ctrl_out), SAVE :: o_lcc3d = ctrl_out((/ 2,  6, 10, 10, 10, 10, 11, 11, 11 /), &
     887    'lcc3d', 'Cloud liquid fraction', '1', (/ ('', i=1, 9) /))
     888  TYPE(ctrl_out), SAVE :: o_lcc3dcon = ctrl_out((/ 2,  6, 10, 10, 10, 10, 11, 11, 11 /), &
     889    'lcc3dcon', 'Convective cloud liquid fraction', '1', (/ ('', i=1, 9) /))
     890  TYPE(ctrl_out), SAVE :: o_lcc3dstra = ctrl_out((/ 2,  6, 10, 10, 10, 10, 11, 11, 11 /), &
     891    'lcc3dstra', 'Stratiform cloud liquid fraction', '1', (/ ('', i=1, 9) /))
    870892!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    871893
    872894  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_albe_srf     = (/ &
    873       ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_ter', "Albedo VIS surf. "//clnsurf(1),"-", (/ ('', i=1, 6) /)), &
    874       ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_lic', "Albedo VIS surf. "//clnsurf(2),"-", (/ ('', i=1, 6) /)), &
    875       ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_oce', "Albedo VIS surf. "//clnsurf(3),"-", (/ ('', i=1, 6) /)), &
    876       ctrl_out((/ 3, 7, 10, 7, 10, 10 /),'albe_sic', "Albedo VIS surf. "//clnsurf(4),"-", (/ ('', i=1, 6) /)) /)
     895      ctrl_out((/ 3, 7, 10, 7, 10, 10, 11, 11, 11 /),'albe_ter', "Albedo VIS surf. "//clnsurf(1),"-", (/ ('', i=1, 9) /)), &
     896      ctrl_out((/ 3, 7, 10, 7, 10, 10, 11, 11, 11 /),'albe_lic', "Albedo VIS surf. "//clnsurf(2),"-", (/ ('', i=1, 9) /)), &
     897      ctrl_out((/ 3, 7, 10, 7, 10, 10, 11, 11, 11 /),'albe_oce', "Albedo VIS surf. "//clnsurf(3),"-", (/ ('', i=1, 9) /)), &
     898      ctrl_out((/ 3, 7, 10, 7, 10, 10, 11, 11, 11 /),'albe_sic', "Albedo VIS surf. "//clnsurf(4),"-", (/ ('', i=1, 9) /)) /)
    877899
    878900  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_ages_srf     = (/ &
    879       ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ages_ter', "Snow age", "day", (/ ('', i=1, 6) /)), &
    880       ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_lic', "Snow age", "day", (/ ('', i=1, 6) /)), &
    881       ctrl_out((/ 10, 10, 10, 10, 10, 10 /),'ages_oce',"Snow age", "day", (/ ('', i=1, 6) /)), &
    882       ctrl_out((/ 3, 10, 10, 10, 10, 10 /),'ages_sic',"Snow age", "day", (/ ('', i=1, 6) /)) /)
     901      ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'ages_ter', "Snow age", "day", (/ ('', i=1, 9) /)), &
     902      ctrl_out((/ 3, 10, 10, 10, 10, 10, 11, 11, 11 /),'ages_lic', "Snow age", "day", (/ ('', i=1, 9) /)), &
     903      ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /),'ages_oce',"Snow age", "day", (/ ('', i=1, 9) /)), &
     904      ctrl_out((/ 3, 10, 10, 10, 10, 10, 11, 11, 11 /),'ages_sic',"Snow age", "day", (/ ('', i=1, 9) /)) /)
    883905
    884906  TYPE(ctrl_out), SAVE, DIMENSION(4) :: o_rugs_srf     = (/ &
    885       ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_ter', "Surface roughness "//clnsurf(1),"m", (/ ('', i=1, 6) /)), &
    886       ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_lic', "Surface roughness "//clnsurf(2),"m", (/ ('', i=1, 6) /)), &
    887       ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_oce', "Surface roughness "//clnsurf(3),"m", (/ ('', i=1, 6) /)), &
    888       ctrl_out((/ 3, 6, 10, 10, 10, 10 /),'rugs_sic', "Surface roughness "//clnsurf(4),"m", (/ ('', i=1, 6) /)) /)
    889 
    890   TYPE(ctrl_out), SAVE :: o_alb1 = ctrl_out((/ 3, 10, 10, 10, 10, 10 /), &
    891         'alb1', 'Surface VIS albedo', '-', (/ ('', i=1, 6) /))
    892   TYPE(ctrl_out), SAVE :: o_alb2 = ctrl_out((/ 3, 10, 10, 10, 10, 10 /), &
    893         'alb2', 'Surface Near IR albedo', '-', (/ ('', i=1, 6) /))
    894   TYPE(ctrl_out), SAVE :: o_clwcon = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    895         'clwcon', 'Convective Cloud Liquid water content', 'kg/kg', (/ ('', i=1, 6) /))
    896   TYPE(ctrl_out), SAVE :: o_Ma = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    897         'Ma', 'undilute adiab updraft', 'kg/m2/s', (/ ('', i=1, 6) /))
    898   TYPE(ctrl_out), SAVE :: o_dnwd = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    899         'dnwd', 'saturated downdraft', 'kg/m2/s', (/ ('', i=1, 6) /))
    900   TYPE(ctrl_out), SAVE :: o_dnwd0 = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    901         'dnwd0', 'unsat. downdraft', 'kg/m2/s', (/ ('', i=1, 6) /))
    902   TYPE(ctrl_out), SAVE :: o_mc = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    903         'mc', 'Convective mass flux', 'kg/m2/s', (/ ('', i=1, 6) /))
    904   TYPE(ctrl_out), SAVE :: o_ftime_con = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    905         'ftime_con', 'Fraction of time convection Occurs', ' ',                 &
    906       (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /))
    907   TYPE(ctrl_out), SAVE :: o_dtdyn = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    908         'dtdyn', 'Dynamics dT', 'K/s', (/ ('', i=1, 6) /))
    909   TYPE(ctrl_out), SAVE :: o_dqdyn = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    910         'dqdyn', 'Dynamics dQ', '(kg/kg)/s', (/ ('', i=1, 6) /))
    911   TYPE(ctrl_out), SAVE :: o_dudyn = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    912         'dudyn', 'Dynamics dU', 'm/s2', (/ ('', i=1, 6) /))
    913   TYPE(ctrl_out), SAVE :: o_dvdyn = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    914         'dvdyn', 'Dynamics dV', 'm/s2', (/ ('', i=1, 6) /))
    915   TYPE(ctrl_out), SAVE :: o_dtcon = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    916         'dtcon', 'Convection dT', 'K/s', (/ ('', i=1, 6) /))
    917   TYPE(ctrl_out), SAVE :: o_ducon = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    918         'ducon', 'Convection du', 'm/s2', (/ ('', i=1, 6) /))
    919   TYPE(ctrl_out), SAVE :: o_dvcon = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    920         'dvcon', 'Convection dv', 'm/s2', (/ ('', i=1, 6) /))
    921   TYPE(ctrl_out), SAVE :: o_dqcon = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    922         'dqcon', 'Convection dQ', '(kg/kg)/s', (/ ('', i=1, 6) /))
    923   TYPE(ctrl_out), SAVE :: o_dtwak = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    924         'dtwak', 'Wake dT', 'K/s', (/ ('', i=1, 6) /))
    925   TYPE(ctrl_out), SAVE :: o_dqwak = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    926         'dqwak', 'Wake dQ', '(kg/kg)/s', (/ ('', i=1, 6) /))
    927   TYPE(ctrl_out), SAVE :: o_wake_h = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    928         'wake_h', 'wake_h', '-', (/ ('', i=1, 6) /))
    929   TYPE(ctrl_out), SAVE :: o_wake_s = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    930         'wake_s', 'wake_s', '-', (/ ('', i=1, 6) /))
    931   TYPE(ctrl_out), SAVE :: o_wake_deltat = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    932         'wake_deltat', 'wake_deltat', ' ', (/ ('', i=1, 6) /))
    933   TYPE(ctrl_out), SAVE :: o_wake_deltaq = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    934         'wake_deltaq', 'wake_deltaq', ' ', (/ ('', i=1, 6) /))
    935   TYPE(ctrl_out), SAVE :: o_wake_omg = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    936         'wake_omg', 'wake_omg', ' ', (/ ('', i=1, 6) /))
    937   TYPE(ctrl_out), SAVE :: o_wdtrainA = ctrl_out((/ 4, 1, 10,  4,  1, 10 /), &
    938         'wdtrainA', 'precipitation from AA', '-', (/ ('', i=1, 6) /))
    939   TYPE(ctrl_out), SAVE :: o_wdtrainM = ctrl_out((/ 4, 1, 10,  4,  1, 10 /), &
    940         'wdtrainM', 'precipitation from mixture', '-', (/ ('', i=1, 6) /))
    941   TYPE(ctrl_out), SAVE :: o_Vprecip = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    942         'Vprecip', 'precipitation vertical profile', '-', (/ ('', i=1, 6) /))
    943   TYPE(ctrl_out), SAVE :: o_ftd = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    944         'ftd', 'tend temp due aux descentes precip', '-', (/ ('', i=1, 6) /))
    945   TYPE(ctrl_out), SAVE :: o_fqd = ctrl_out((/ 4, 5, 10, 10, 10, 10 /), &
    946         'fqd', 'tend vap eau due aux descentes precip', '-', (/ ('', i=1, 6) /))
    947   TYPE(ctrl_out), SAVE :: o_dtlsc = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    948         'dtlsc', 'Condensation dT', 'K/s', (/ ('', i=1, 6) /))
    949   TYPE(ctrl_out), SAVE :: o_dtlschr = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    950         'dtlschr', 'Large-scale condensational heating rate', 'K/s', (/ ('', i=1, 6) /))
    951   TYPE(ctrl_out), SAVE :: o_dqlsc = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    952         'dqlsc', 'Condensation dQ', '(kg/kg)/s', (/ ('', i=1, 6) /))
    953   TYPE(ctrl_out), SAVE :: o_beta_prec = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    954         'beta_prec', 'LS Conversion rate to prec', '(kg/kg)/s', (/ ('', i=1, 6) /))
    955   TYPE(ctrl_out), SAVE :: o_dtvdf = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    956         'dtvdf', 'Boundary-layer dT', 'K/s', (/ ('', i=1, 6) /))
    957   TYPE(ctrl_out), SAVE :: o_dtdis = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    958         'dtdis', 'TKE dissipation dT', 'K/s', (/ ('', i=1, 6) /))
    959   TYPE(ctrl_out), SAVE :: o_dqvdf = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    960         'dqvdf', 'Boundary-layer dQ', '(kg/kg)/s', (/ ('', i=1, 6) /))
    961   TYPE(ctrl_out), SAVE :: o_dteva = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    962         'dteva', 'Reevaporation dT', 'K/s', (/ ('', i=1, 6) /))
    963   TYPE(ctrl_out), SAVE :: o_dqeva = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    964         'dqeva', 'Reevaporation dQ', '(kg/kg)/s', (/ ('', i=1, 6) /))
     907      ctrl_out((/ 3, 6, 10, 10, 10, 10, 11, 11, 11 /),'rugs_ter', "Surface roughness "//clnsurf(1),"m", (/ ('', i=1, 9) /)), &
     908      ctrl_out((/ 3, 6, 10, 10, 10, 10, 11, 11, 11 /),'rugs_lic', "Surface roughness "//clnsurf(2),"m", (/ ('', i=1, 9) /)), &
     909      ctrl_out((/ 3, 6, 10, 10, 10, 10, 11, 11, 11 /),'rugs_oce', "Surface roughness "//clnsurf(3),"m", (/ ('', i=1, 9) /)), &
     910      ctrl_out((/ 3, 6, 10, 10, 10, 10, 11, 11, 11 /),'rugs_sic', "Surface roughness "//clnsurf(4),"m", (/ ('', i=1, 9) /)) /)
     911
     912  TYPE(ctrl_out), SAVE :: o_alb1 = ctrl_out((/ 3, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     913    'alb1', 'Surface VIS albedo', '-', (/ ('', i=1, 9) /))
     914  TYPE(ctrl_out), SAVE :: o_alb2 = ctrl_out((/ 3, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     915    'alb2', 'Surface Near IR albedo', '-', (/ ('', i=1, 9) /))
     916  TYPE(ctrl_out), SAVE :: o_clwcon = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     917    'clwcon', 'Convective Cloud Liquid water content', 'kg/kg', (/ ('', i=1, 9) /))
     918  TYPE(ctrl_out), SAVE :: o_Ma = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     919    'Ma', 'undilute adiab updraft', 'kg/m2/s', (/ ('', i=1, 9) /))
     920  TYPE(ctrl_out), SAVE :: o_dnwd = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     921    'dnwd', 'saturated downdraft', 'kg/m2/s', (/ ('', i=1, 9) /))
     922  TYPE(ctrl_out), SAVE :: o_dnwd0 = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     923    'dnwd0', 'unsat. downdraft', 'kg/m2/s', (/ ('', i=1, 9) /))
     924  TYPE(ctrl_out), SAVE :: o_mc = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     925    'mc', 'Convective mass flux', 'kg/m2/s', (/ ('', i=1, 9) /))
     926  TYPE(ctrl_out), SAVE :: o_ftime_con = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     927    'ftime_con', 'Fraction of time convection Occurs', ' ',                 &
     928      (/ 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)', 'inst(X)' /))
     929  TYPE(ctrl_out), SAVE :: o_dtdyn = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     930    'dtdyn', 'Dynamics dT', 'K/s', (/ ('', i=1, 9) /))
     931  TYPE(ctrl_out), SAVE :: o_dqdyn = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     932    'dqdyn', 'Dynamics dQ', '(kg/kg)/s', (/ ('', i=1, 9) /))
     933  TYPE(ctrl_out), SAVE :: o_dudyn = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     934    'dudyn', 'Dynamics dU', 'm/s2', (/ ('', i=1, 9) /))
     935  TYPE(ctrl_out), SAVE :: o_dvdyn = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     936    'dvdyn', 'Dynamics dV', 'm/s2', (/ ('', i=1, 9) /))
     937  TYPE(ctrl_out), SAVE :: o_dtcon = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     938    'dtcon', 'Convection dT', 'K/s', (/ ('', i=1, 9) /))
     939  TYPE(ctrl_out), SAVE :: o_ducon = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     940    'ducon', 'Convection du', 'm/s2', (/ ('', i=1, 9) /))
     941  TYPE(ctrl_out), SAVE :: o_dvcon = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     942    'dvcon', 'Convection dv', 'm/s2', (/ ('', i=1, 9) /))
     943  TYPE(ctrl_out), SAVE :: o_dqcon = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     944    'dqcon', 'Convection dQ', '(kg/kg)/s', (/ ('', i=1, 9) /))
     945  TYPE(ctrl_out), SAVE :: o_dtwak = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     946    'dtwak', 'Wake dT', 'K/s', (/ ('', i=1, 9) /))
     947  TYPE(ctrl_out), SAVE :: o_dqwak = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     948    'dqwak', 'Wake dQ', '(kg/kg)/s', (/ ('', i=1, 9) /))
     949  TYPE(ctrl_out), SAVE :: o_wake_h = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     950    'wake_h', 'wake_h', '-', (/ ('', i=1, 9) /))
     951  TYPE(ctrl_out), SAVE :: o_wake_s = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     952    'wake_s', 'wake_s', '-', (/ ('', i=1, 9) /))
     953  TYPE(ctrl_out), SAVE :: o_wake_deltat = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     954    'wake_deltat', 'wake_deltat', ' ', (/ ('', i=1, 9) /))
     955  TYPE(ctrl_out), SAVE :: o_wake_deltaq = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     956    'wake_deltaq', 'wake_deltaq', ' ', (/ ('', i=1, 9) /))
     957  TYPE(ctrl_out), SAVE :: o_wake_omg = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     958    'wake_omg', 'wake_omg', ' ', (/ ('', i=1, 9) /))
     959  TYPE(ctrl_out), SAVE :: o_wdtrainA = ctrl_out((/ 4, 1, 10,  4,  1, 10, 11, 11, 110 /), &
     960    'wdtrainA', 'precipitation from AA', '-', (/ ('', i=1, 9) /))
     961  TYPE(ctrl_out), SAVE :: o_wdtrainM = ctrl_out((/ 4, 1, 10,  4,  1, 10, 11, 11, 110 /), &
     962    'wdtrainM', 'precipitation from mixture', '-', (/ ('', i=1, 9) /))
     963  TYPE(ctrl_out), SAVE :: o_Vprecip = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     964    'Vprecip', 'precipitation vertical profile', '-', (/ ('', i=1, 9) /))
     965  TYPE(ctrl_out), SAVE :: o_ftd = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     966    'ftd', 'tend temp due aux descentes precip', '-', (/ ('', i=1, 9) /))
     967  TYPE(ctrl_out), SAVE :: o_fqd = ctrl_out((/ 4, 5, 10, 10, 10, 10, 11, 11, 11 /), &
     968    'fqd', 'tend vap eau due aux descentes precip', '-', (/ ('', i=1, 9) /))
     969  TYPE(ctrl_out), SAVE :: o_dtlsc = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     970    'dtlsc', 'Condensation dT', 'K/s', (/ ('', i=1, 9) /))
     971  TYPE(ctrl_out), SAVE :: o_dtlschr = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     972    'dtlschr', 'Large-scale condensational heating rate', 'K/s', (/ ('', i=1, 9) /))
     973  TYPE(ctrl_out), SAVE :: o_dqlsc = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     974    'dqlsc', 'Condensation dQ', '(kg/kg)/s', (/ ('', i=1, 9) /))
     975  TYPE(ctrl_out), SAVE :: o_beta_prec = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     976    'beta_prec', 'LS Conversion rate to prec', '(kg/kg)/s', (/ ('', i=1, 9) /))
     977  TYPE(ctrl_out), SAVE :: o_dtvdf = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     978    'dtvdf', 'Boundary-layer dT', 'K/s', (/ ('', i=1, 9) /))
     979  TYPE(ctrl_out), SAVE :: o_dtdis = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     980    'dtdis', 'TKE dissipation dT', 'K/s', (/ ('', i=1, 9) /))
     981  TYPE(ctrl_out), SAVE :: o_dqvdf = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     982    'dqvdf', 'Boundary-layer dQ', '(kg/kg)/s', (/ ('', i=1, 9) /))
     983  TYPE(ctrl_out), SAVE :: o_dteva = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     984    'dteva', 'Reevaporation dT', 'K/s', (/ ('', i=1, 9) /))
     985  TYPE(ctrl_out), SAVE :: o_dqeva = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     986    'dqeva', 'Reevaporation dQ', '(kg/kg)/s', (/ ('', i=1, 9) /))
    965987
    966988!!!!!!!!!!!!!!!! Specifique thermiques
    967   TYPE(ctrl_out), SAVE :: o_dqlscth = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    968         'dqlscth', 'dQ therm.', '(kg/kg)/s', (/ ('', i=1, 6) /))
    969   TYPE(ctrl_out), SAVE :: o_dqlscst = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    970         'dqlscst', 'dQ strat.', '(kg/kg)/s', (/ ('', i=1, 6) /))
    971   TYPE(ctrl_out), SAVE :: o_dtlscth = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    972         'dtlscth', 'dQ therm.', 'K/s', (/ ('', i=1, 6) /))
    973   TYPE(ctrl_out), SAVE :: o_dtlscst = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    974         'dtlscst', 'dQ strat.', 'K/s', (/ ('', i=1, 6) /))
    975   TYPE(ctrl_out), SAVE :: o_plulth = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    976         'plulth', 'Rainfall therm.', 'K/s', (/ ('', i=1, 6) /))
    977   TYPE(ctrl_out), SAVE :: o_plulst = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    978         'plulst', 'Rainfall strat.', 'K/s', (/ ('', i=1, 6) /))
    979   TYPE(ctrl_out), SAVE :: o_lmaxth = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    980         'lmaxth', "Upper level thermals", "", (/ ('', i=1, 6) /))
    981   TYPE(ctrl_out), SAVE :: o_ptconvth = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    982         'ptconvth', 'POINTS CONVECTIFS therm.', ' ', (/ ('', i=1, 6) /))
     989  TYPE(ctrl_out), SAVE :: o_dqlscth = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     990    'dqlscth', 'dQ therm.', '(kg/kg)/s', (/ ('', i=1, 9) /))
     991  TYPE(ctrl_out), SAVE :: o_dqlscst = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     992    'dqlscst', 'dQ strat.', '(kg/kg)/s', (/ ('', i=1, 9) /))
     993  TYPE(ctrl_out), SAVE :: o_dtlscth = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     994    'dtlscth', 'dQ therm.', 'K/s', (/ ('', i=1, 9) /))
     995  TYPE(ctrl_out), SAVE :: o_dtlscst = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     996    'dtlscst', 'dQ strat.', 'K/s', (/ ('', i=1, 9) /))
     997  TYPE(ctrl_out), SAVE :: o_plulth = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     998    'plulth', 'Rainfall therm.', 'K/s', (/ ('', i=1, 9) /))
     999  TYPE(ctrl_out), SAVE :: o_plulst = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1000    'plulst', 'Rainfall strat.', 'K/s', (/ ('', i=1, 9) /))
     1001  TYPE(ctrl_out), SAVE :: o_lmaxth = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1002    'lmaxth', "Upper level thermals", "", (/ ('', i=1, 9) /))
     1003  TYPE(ctrl_out), SAVE :: o_ptconvth = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1004    'ptconvth', 'POINTS CONVECTIFS therm.', ' ', (/ ('', i=1, 9) /))
    9831005!!!!!!!!!!!!!!!!!!!!!!!!
    984   TYPE(ctrl_out), SAVE :: o_ptconv = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    985         'ptconv', 'POINTS CONVECTIFS', ' ', (/ ('', i=1, 6) /))
    986   TYPE(ctrl_out), SAVE :: o_ratqs = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    987         'ratqs', 'RATQS', ' ', (/ ('', i=1, 6) /))
    988   TYPE(ctrl_out), SAVE :: o_dtthe = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    989         'dtthe', 'Thermal dT', 'K/s', (/ ('', i=1, 6) /))
    990   TYPE(ctrl_out), SAVE :: o_f_th = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    991         'f_th', 'Thermal plume mass flux', 'kg/(m2*s)', (/ ('', i=1, 6) /))
    992   TYPE(ctrl_out), SAVE :: o_e_th = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    993         'e_th', 'Thermal plume entrainment', 'K/s', (/ ('', i=1, 6) /))
    994   TYPE(ctrl_out), SAVE :: o_w_th = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    995         'w_th', 'Thermal plume vertical velocity', 'm/s', (/ ('', i=1, 6) /))
    996   TYPE(ctrl_out), SAVE :: o_lambda_th = ctrl_out((/ 10, 10, 10, 10, 10, 10 /), &
    997         'lambda_th', 'Thermal plume vertical velocity', 'm/s', (/ ('', i=1, 6) /))
    998   TYPE(ctrl_out), SAVE :: o_ftime_th = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    999         'ftime_th', 'Fraction of time Shallow convection occurs', ' ', (/ ('', i=1, 6) /))
    1000   TYPE(ctrl_out), SAVE :: o_q_th = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1001         'q_th', 'Thermal plume total humidity', 'kg/kg', (/ ('', i=1, 6) /))
    1002   TYPE(ctrl_out), SAVE :: o_a_th = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1003         'a_th', "Thermal plume fraction", "", (/ ('', i=1, 6) /))
    1004   TYPE(ctrl_out), SAVE :: o_d_th = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1005         'd_th', 'Thermal plume detrainment', 'K/s', (/ ('', i=1, 6) /))
    1006   TYPE(ctrl_out), SAVE :: o_f0_th = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1007         'f0_th', 'Thermal closure mass flux', 'K/s', (/ ('', i=1, 6) /))
    1008   TYPE(ctrl_out), SAVE :: o_zmax_th = ctrl_out((/ 4,  4,  4,  5, 10, 10 /), &
    1009         'zmax_th', 'Thermal plume height', 'K/s', (/ ('', i=1, 6) /))
    1010   TYPE(ctrl_out), SAVE :: o_dqthe = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1011         'dqthe', 'Thermal dQ', '(kg/kg)/s', (/ ('', i=1, 6) /))
    1012   TYPE(ctrl_out), SAVE :: o_dtajs = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1013         'dtajs', 'Dry adjust. dT', 'K/s', (/ ('', i=1, 6) /))
    1014   TYPE(ctrl_out), SAVE :: o_dqajs = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1015         'dqajs', 'Dry adjust. dQ', '(kg/kg)/s', (/ ('', i=1, 6) /))
    1016   TYPE(ctrl_out), SAVE :: o_dtswr = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1017         'dtswr', 'SW radiation dT', 'K/s', (/ ('', i=1, 6) /))
    1018   TYPE(ctrl_out), SAVE :: o_dtsw0 = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1019         'dtsw0', 'CS SW radiation dT', 'K/s', (/ ('', i=1, 6) /))
    1020   TYPE(ctrl_out), SAVE :: o_dtlwr = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1021         'dtlwr', 'LW radiation dT', 'K/s', (/ ('', i=1, 6) /))
    1022   TYPE(ctrl_out), SAVE :: o_dtlw0 = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1023         'dtlw0', 'CS LW radiation dT', 'K/s', (/ ('', i=1, 6) /))
    1024   TYPE(ctrl_out), SAVE :: o_dtec = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1025         'dtec', 'Cinetic dissip dT', 'K/s', (/ ('', i=1, 6) /))
    1026   TYPE(ctrl_out), SAVE :: o_duvdf = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1027         'duvdf', 'Boundary-layer dU', 'm/s2', (/ ('', i=1, 6) /))
    1028   TYPE(ctrl_out), SAVE :: o_dvvdf = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1029         'dvvdf', 'Boundary-layer dV', 'm/s2', (/ ('', i=1, 6) /))
    1030   TYPE(ctrl_out), SAVE :: o_duoro = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1031         'duoro', 'Orography dU', 'm/s2', (/ ('', i=1, 6) /))
    1032   TYPE(ctrl_out), SAVE :: o_dvoro = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1033         'dvoro', 'Orography dV', 'm/s2', (/ ('', i=1, 6) /))
    1034   TYPE(ctrl_out), SAVE :: o_dulif = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1035         'dulif', 'Orography dU', 'm/s2', (/ ('', i=1, 6) /))
    1036   TYPE(ctrl_out), SAVE :: o_dvlif = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1037         'dvlif', 'Orography dV', 'm/s2', (/ ('', i=1, 6) /))
    1038   TYPE(ctrl_out), SAVE :: o_duhin = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1039         'duhin', 'Hines GWD dU', 'm/s2', (/ ('', i=1, 6) /))
    1040   TYPE(ctrl_out), SAVE :: o_dvhin = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1041         'dvhin', 'Hines GWD dV', 'm/s2', (/ ('', i=1, 6) /))
    1042   TYPE(ctrl_out), SAVE :: o_dtoro = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1043         'dtoro', 'Orography dT', 'K/s', (/ ('', i=1, 6) /))
    1044   TYPE(ctrl_out), SAVE :: o_dtlif = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1045         'dtlif', 'Orography dT', 'K/s', (/ ('', i=1, 6) /))
    1046   TYPE(ctrl_out), SAVE :: o_dthin = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1047         'dthin', 'Hines GWD dT', 'K/s', (/ ('', i=1, 6) /))
     1006  TYPE(ctrl_out), SAVE :: o_ptconv = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1007    'ptconv', 'POINTS CONVECTIFS', ' ', (/ ('', i=1, 9) /))
     1008  TYPE(ctrl_out), SAVE :: o_ratqs = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1009    'ratqs', 'RATQS', ' ', (/ ('', i=1, 9) /))
     1010  TYPE(ctrl_out), SAVE :: o_dtthe = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1011    'dtthe', 'Thermal dT', 'K/s', (/ ('', i=1, 9) /))
     1012  TYPE(ctrl_out), SAVE :: o_f_th = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1013    'f_th', 'Thermal plume mass flux', 'kg/(m2*s)', (/ ('', i=1, 9) /))
     1014  TYPE(ctrl_out), SAVE :: o_e_th = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1015    'e_th', 'Thermal plume entrainment', 'K/s', (/ ('', i=1, 9) /))
     1016  TYPE(ctrl_out), SAVE :: o_w_th = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1017    'w_th', 'Thermal plume vertical velocity', 'm/s', (/ ('', i=1, 9) /))
     1018  TYPE(ctrl_out), SAVE :: o_lambda_th = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1019    'lambda_th', 'Thermal plume vertical velocity', 'm/s', (/ ('', i=1, 9) /))
     1020  TYPE(ctrl_out), SAVE :: o_ftime_th = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1021    'ftime_th', 'Fraction of time Shallow convection occurs', ' ', (/ ('', i=1, 9) /))
     1022  TYPE(ctrl_out), SAVE :: o_q_th = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1023    'q_th', 'Thermal plume total humidity', 'kg/kg', (/ ('', i=1, 9) /))
     1024  TYPE(ctrl_out), SAVE :: o_a_th = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1025    'a_th', "Thermal plume fraction", "", (/ ('', i=1, 9) /))
     1026  TYPE(ctrl_out), SAVE :: o_d_th = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1027    'd_th', 'Thermal plume detrainment', 'K/s', (/ ('', i=1, 9) /))
     1028  TYPE(ctrl_out), SAVE :: o_f0_th = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1029    'f0_th', 'Thermal closure mass flux', 'K/s', (/ ('', i=1, 9) /))
     1030  TYPE(ctrl_out), SAVE :: o_zmax_th = ctrl_out((/ 4,  4,  4,  5, 10, 10, 11, 11, 11 /), &
     1031    'zmax_th', 'Thermal plume height', 'K/s', (/ ('', i=1, 9) /))
     1032  TYPE(ctrl_out), SAVE :: o_dqthe = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1033    'dqthe', 'Thermal dQ', '(kg/kg)/s', (/ ('', i=1, 9) /))
     1034  TYPE(ctrl_out), SAVE :: o_dtajs = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1035    'dtajs', 'Dry adjust. dT', 'K/s', (/ ('', i=1, 9) /))
     1036  TYPE(ctrl_out), SAVE :: o_dqajs = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1037    'dqajs', 'Dry adjust. dQ', '(kg/kg)/s', (/ ('', i=1, 9) /))
     1038  TYPE(ctrl_out), SAVE :: o_dtswr = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1039    'dtswr', 'SW radiation dT', 'K/s', (/ ('', i=1, 9) /))
     1040  TYPE(ctrl_out), SAVE :: o_dtsw0 = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1041    'dtsw0', 'CS SW radiation dT', 'K/s', (/ ('', i=1, 9) /))
     1042  TYPE(ctrl_out), SAVE :: o_dtlwr = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1043    'dtlwr', 'LW radiation dT', 'K/s', (/ ('', i=1, 9) /))
     1044  TYPE(ctrl_out), SAVE :: o_dtlw0 = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1045    'dtlw0', 'CS LW radiation dT', 'K/s', (/ ('', i=1, 9) /))
     1046  TYPE(ctrl_out), SAVE :: o_dtec = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1047    'dtec', 'Cinetic dissip dT', 'K/s', (/ ('', i=1, 9) /))
     1048  TYPE(ctrl_out), SAVE :: o_duvdf = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1049    'duvdf', 'Boundary-layer dU', 'm/s2', (/ ('', i=1, 9) /))
     1050  TYPE(ctrl_out), SAVE :: o_dvvdf = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1051    'dvvdf', 'Boundary-layer dV', 'm/s2', (/ ('', i=1, 9) /))
     1052  TYPE(ctrl_out), SAVE :: o_duoro = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1053    'duoro', 'Orography dU', 'm/s2', (/ ('', i=1, 9) /))
     1054  TYPE(ctrl_out), SAVE :: o_dvoro = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1055    'dvoro', 'Orography dV', 'm/s2', (/ ('', i=1, 9) /))
     1056  TYPE(ctrl_out), SAVE :: o_dulif = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1057    'dulif', 'Orography dU', 'm/s2', (/ ('', i=1, 9) /))
     1058  TYPE(ctrl_out), SAVE :: o_dvlif = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1059    'dvlif', 'Orography dV', 'm/s2', (/ ('', i=1, 9) /))
     1060  TYPE(ctrl_out), SAVE :: o_duhin = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1061    'duhin', 'Hines GWD dU', 'm/s2', (/ ('', i=1, 9) /))
     1062  TYPE(ctrl_out), SAVE :: o_dvhin = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1063    'dvhin', 'Hines GWD dV', 'm/s2', (/ ('', i=1, 9) /))
     1064  TYPE(ctrl_out), SAVE :: o_dtoro = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1065    'dtoro', 'Orography dT', 'K/s', (/ ('', i=1, 9) /))
     1066  TYPE(ctrl_out), SAVE :: o_dtlif = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1067    'dtlif', 'Orography dT', 'K/s', (/ ('', i=1, 9) /))
     1068  TYPE(ctrl_out), SAVE :: o_dthin = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1069    'dthin', 'Hines GWD dT', 'K/s', (/ ('', i=1, 9) /))
    10481070
    10491071  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_trac(:)
    10501072  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_trac_cum(:)
    1051   TYPE(ctrl_out), SAVE :: o_rsu = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1052         'rsu', 'SW upward radiation', 'W m-2', (/ ('', i=1, 6) /))
    1053   TYPE(ctrl_out), SAVE :: o_rsd = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1054         'rsd', 'SW downward radiation', 'W m-2', (/ ('', i=1, 6) /))
    1055   TYPE(ctrl_out), SAVE :: o_rlu = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1056         'rlu', 'LW upward radiation', 'W m-2', (/ ('', i=1, 6) /))
    1057   TYPE(ctrl_out), SAVE :: o_rld = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1058         'rld', 'LW downward radiation', 'W m-2', (/ ('', i=1, 6) /))
    1059   TYPE(ctrl_out), SAVE :: o_rsucs = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1060         'rsucs', 'SW CS upward radiation', 'W m-2', (/ ('', i=1, 6) /))
    1061   TYPE(ctrl_out), SAVE :: o_rsdcs = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1062         'rsdcs', 'SW CS downward radiation', 'W m-2', (/ ('', i=1, 6) /))
    1063   TYPE(ctrl_out), SAVE :: o_rlucs = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1064         'rlucs', 'LW CS upward radiation', 'W m-2', (/ ('', i=1, 6) /))
    1065   TYPE(ctrl_out), SAVE :: o_rldcs = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1066         'rldcs', 'LW CS downward radiation', 'W m-2', (/ ('', i=1, 6) /))
    1067   TYPE(ctrl_out), SAVE :: o_tnt = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1068         'tnt', 'Tendency of air temperature', 'K s-1', (/ ('', i=1, 6) /))
    1069   TYPE(ctrl_out), SAVE :: o_tntc = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1070         'tntc', 'Tendency of air temperature due to Moist Convection', 'K s-1', (/ ('', i=1, 6) /))
    1071   TYPE(ctrl_out), SAVE :: o_tntr = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1072         'tntr', 'Air temperature tendency due to Radiative heating', 'K s-1', (/ ('', i=1, 6) /))
    1073   TYPE(ctrl_out), SAVE :: o_tntscpbl = ctrl_out((/ 4, 10, 10, 10, 10, 10 /),                  &
    1074         'tntscpbl', 'Air temperature tendency due to St cloud and precipitation and BL mixing', &
    1075       'K s-1', (/ ('', i=1, 6) /))
    1076   TYPE(ctrl_out), SAVE :: o_tnhus = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1077         'tnhus', 'Tendency of specific humidity', 's-1', (/ ('', i=1, 6) /))
    1078   TYPE(ctrl_out), SAVE :: o_tnhusc = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1079         'tnhusc', 'Tendency of specific humidity due to convection', 's-1', (/ ('', i=1, 6) /))
    1080   TYPE(ctrl_out), SAVE :: o_tnhusscpbl = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1081         'tnhusscpbl', 'Tendency of Specific humidity due to ST cl, precip and BL mixing', 's-1', (/ ('', i=1, 6) /))
    1082   TYPE(ctrl_out), SAVE :: o_evu = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1083         'evu', 'Eddy viscosity coefficient for Momentum Variables', 'm2 s-1', (/ ('', i=1, 6) /))
    1084   TYPE(ctrl_out), SAVE :: o_h2o = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1085         'h2o', 'Mass Fraction of Water', '1', (/ ('', i=1, 6) /))
    1086   TYPE(ctrl_out), SAVE :: o_mcd = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1087         'mcd', 'Downdraft COnvective Mass Flux', 'kg/(m2*s)', (/ ('', i=1, 6) /))
    1088   TYPE(ctrl_out), SAVE :: o_dmc = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1089         'dmc', 'Deep COnvective Mass Flux', 'kg/(m2*s)', (/ ('', i=1, 6) /))
    1090   TYPE(ctrl_out), SAVE :: o_ref_liq = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1091         'ref_liq', 'Effective radius of convective cloud liquid water particle', 'm', (/ ('', i=1, 6) /))
    1092   TYPE(ctrl_out), SAVE :: o_ref_ice = ctrl_out((/ 4, 10, 10, 10, 10, 10 /), &
    1093         'ref_ice', 'Effective radius of startiform cloud ice particle', 'm', (/ ('', i=1, 6) /))
    1094   TYPE(ctrl_out), SAVE :: o_rsut4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1095         'rsut4co2', 'TOA Out SW in 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1096   TYPE(ctrl_out), SAVE :: o_rlut4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1097         'rlut4co2', 'TOA Out LW in 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1098   TYPE(ctrl_out), SAVE :: o_rsutcs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1099         'rsutcs4co2', 'TOA Out CS SW in 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1100   TYPE(ctrl_out), SAVE :: o_rlutcs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1101         'rlutcs4co2', 'TOA Out CS LW in 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1102   TYPE(ctrl_out), SAVE :: o_rsu4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1103         'rsu4co2', 'Upwelling SW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1104   TYPE(ctrl_out), SAVE :: o_rlu4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1105         'rlu4co2', 'Upwelling LW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1106   TYPE(ctrl_out), SAVE :: o_rsucs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1107         'rsucs4co2', 'Upwelling CS SW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1108   TYPE(ctrl_out), SAVE :: o_rlucs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1109         'rlucs4co2', 'Upwelling CS LW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1110   TYPE(ctrl_out), SAVE :: o_rsd4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1111         'rsd4co2', 'Downwelling SW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1112   TYPE(ctrl_out), SAVE :: o_rld4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1113         'rld4co2', 'Downwelling LW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1114   TYPE(ctrl_out), SAVE :: o_rsdcs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1115         'rsdcs4co2', 'Downwelling CS SW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
    1116   TYPE(ctrl_out), SAVE :: o_rldcs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10 /), &
    1117         'rldcs4co2', 'Downwelling CS LW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 6) /))
     1073  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_vdf(:)
     1074  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_the(:)
     1075  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_con(:)
     1076  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_lessi_impa(:)
     1077  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_lessi_nucl(:)
     1078  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_insc(:)
     1079  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_bcscav(:)
     1080  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_evapls(:)
     1081  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_ls(:)
     1082  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_trsp(:)
     1083  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_sscav(:)
     1084  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_sat(:)
     1085  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_uscav(:)
     1086  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_dry(:)
     1087
     1088  TYPE(ctrl_out), SAVE :: o_rsu = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1089    'rsu', 'SW upward radiation', 'W m-2', (/ ('', i=1, 9) /))
     1090  TYPE(ctrl_out), SAVE :: o_rsd = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1091    'rsd', 'SW downward radiation', 'W m-2', (/ ('', i=1, 9) /))
     1092  TYPE(ctrl_out), SAVE :: o_rlu = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1093    'rlu', 'LW upward radiation', 'W m-2', (/ ('', i=1, 9) /))
     1094  TYPE(ctrl_out), SAVE :: o_rld = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1095    'rld', 'LW downward radiation', 'W m-2', (/ ('', i=1, 9) /))
     1096  TYPE(ctrl_out), SAVE :: o_rsucs = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1097    'rsucs', 'SW CS upward radiation', 'W m-2', (/ ('', i=1, 9) /))
     1098  TYPE(ctrl_out), SAVE :: o_rsdcs = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1099    'rsdcs', 'SW CS downward radiation', 'W m-2', (/ ('', i=1, 9) /))
     1100  TYPE(ctrl_out), SAVE :: o_rlucs = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1101    'rlucs', 'LW CS upward radiation', 'W m-2', (/ ('', i=1, 9) /))
     1102  TYPE(ctrl_out), SAVE :: o_rldcs = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1103    'rldcs', 'LW CS downward radiation', 'W m-2', (/ ('', i=1, 9) /))
     1104  TYPE(ctrl_out), SAVE :: o_tnt = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1105    'tnt', 'Tendency of air temperature', 'K s-1', (/ ('', i=1, 9) /))
     1106  TYPE(ctrl_out), SAVE :: o_tntc = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1107    'tntc', 'Tendency of air temperature due to Moist Convection', 'K s-1', (/ ('', i=1, 9) /))
     1108  TYPE(ctrl_out), SAVE :: o_tntr = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1109    'tntr', 'Air temperature tendency due to Radiative heating', 'K s-1', (/ ('', i=1, 9) /))
     1110  TYPE(ctrl_out), SAVE :: o_tntscpbl = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /),                  &
     1111    'tntscpbl', 'Air temperature tendency due to St cloud and precipitation and BL mixing', &
     1112      'K s-1', (/ ('', i=1, 9) /))
     1113  TYPE(ctrl_out), SAVE :: o_tnhus = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1114    'tnhus', 'Tendency of specific humidity', 's-1', (/ ('', i=1, 9) /))
     1115  TYPE(ctrl_out), SAVE :: o_tnhusc = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1116    'tnhusc', 'Tendency of specific humidity due to convection', 's-1', (/ ('', i=1, 9) /))
     1117  TYPE(ctrl_out), SAVE :: o_tnhusscpbl = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1118    'tnhusscpbl', 'Tendency of Specific humidity due to ST cl, precip and BL mixing', 's-1', (/ ('', i=1, 9) /))
     1119  TYPE(ctrl_out), SAVE :: o_evu = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1120    'evu', 'Eddy viscosity coefficient for Momentum Variables', 'm2 s-1', (/ ('', i=1, 9) /))
     1121  TYPE(ctrl_out), SAVE :: o_h2o = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1122    'h2o', 'Mass Fraction of Water', '1', (/ ('', i=1, 9) /))
     1123  TYPE(ctrl_out), SAVE :: o_mcd = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1124    'mcd', 'Downdraft COnvective Mass Flux', 'kg/(m2*s)', (/ ('', i=1, 9) /))
     1125  TYPE(ctrl_out), SAVE :: o_dmc = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1126    'dmc', 'Deep COnvective Mass Flux', 'kg/(m2*s)', (/ ('', i=1, 9) /))
     1127  TYPE(ctrl_out), SAVE :: o_ref_liq = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1128    'ref_liq', 'Effective radius of convective cloud liquid water particle', 'm', (/ ('', i=1, 9) /))
     1129  TYPE(ctrl_out), SAVE :: o_ref_ice = ctrl_out((/ 4, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1130    'ref_ice', 'Effective radius of startiform cloud ice particle', 'm', (/ ('', i=1, 9) /))
     1131  TYPE(ctrl_out), SAVE :: o_rsut4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1132    'rsut4co2', 'TOA Out SW in 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1133  TYPE(ctrl_out), SAVE :: o_rlut4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1134    'rlut4co2', 'TOA Out LW in 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1135  TYPE(ctrl_out), SAVE :: o_rsutcs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1136    'rsutcs4co2', 'TOA Out CS SW in 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1137  TYPE(ctrl_out), SAVE :: o_rlutcs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1138    'rlutcs4co2', 'TOA Out CS LW in 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1139  TYPE(ctrl_out), SAVE :: o_rsu4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1140    'rsu4co2', 'Upwelling SW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1141  TYPE(ctrl_out), SAVE :: o_rlu4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1142    'rlu4co2', 'Upwelling LW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1143  TYPE(ctrl_out), SAVE :: o_rsucs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1144    'rsucs4co2', 'Upwelling CS SW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1145  TYPE(ctrl_out), SAVE :: o_rlucs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1146    'rlucs4co2', 'Upwelling CS LW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1147  TYPE(ctrl_out), SAVE :: o_rsd4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1148    'rsd4co2', 'Downwelling SW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1149  TYPE(ctrl_out), SAVE :: o_rld4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1150    'rld4co2', 'Downwelling LW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1151  TYPE(ctrl_out), SAVE :: o_rsdcs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1152    'rsdcs4co2', 'Downwelling CS SW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1153  TYPE(ctrl_out), SAVE :: o_rldcs4co2 = ctrl_out((/ 5, 10, 10, 10, 10, 10, 11, 11, 11 /), &
     1154    'rldcs4co2', 'Downwelling CS LW 4xCO2 atmosphere', 'W/m2', (/ ('', i=1, 9) /))
     1155
     1156!!!!!!!!!!!!! Sorties niveaux standards de pression NMC
     1157  TYPE(ctrl_out), SAVE :: o_tnondef = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1158       'tnondef', 'Undefined value of T', 'K', (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", &
     1159       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1160  TYPE(ctrl_out), SAVE :: o_ta = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1161       'ta', 'Air temperature', 'K', (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", &
     1162       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1163  TYPE(ctrl_out), SAVE :: o_zg  = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1164       'zg', 'Geopotential height', 'm', (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", &
     1165       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1166  TYPE(ctrl_out), SAVE :: o_hus = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1167       'hus', 'Specific humidity', '1', (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", &
     1168       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))                                                                                   
     1169  TYPE(ctrl_out), SAVE :: o_hur = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1170       'hur', 'Relative humidity', '%', (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", &
     1171       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1172  TYPE(ctrl_out), SAVE :: o_ua = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1173       'ua', 'Eastward wind', 'm s-1', (/ "inst(X)", "inst(X)", "inst(X)", "inst(X)", &
     1174       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1175  TYPE(ctrl_out), SAVE :: o_va = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1176       'va', 'Northward wind', 'm s-1', (/ ('', i=1, 9)/))
     1177  TYPE(ctrl_out), SAVE :: o_wap = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1178       'wap', 'Lagrangian tendency of air pressure', 'Pa s-1', (/ "inst(X)", "inst(X)", "inst(X)", &
     1179       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1180  TYPE(ctrl_out), SAVE :: o_psbg = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1181       'psbg', 'Lagrangian tendency of air pressure', 'Pa s-1', (/ "inst(X)", "inst(X)", "inst(X)", &
     1182       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1183  TYPE(ctrl_out), SAVE :: o_tro3 = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1184       'tro3', 'Ozone mole fraction', '1e-9', (/ "inst(X)", "inst(X)", "inst(X)", &
     1185       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1186  TYPE(ctrl_out), SAVE :: o_tro3_daylight = ctrl_out((/ 11, 11, 11, 11, 11, 11, 5, 5, 5 /), &
     1187       'tro3_daylight', 'Daylight ozone mole fraction', '1e-9', (/ "inst(X)", "inst(X)", "inst(X)", &
     1188       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1189  TYPE(ctrl_out), SAVE :: o_uxv = ctrl_out((/ 11, 11, 11, 11, 11, 11, 6, 6, 6 /), &
     1190       'uv', 'uv', 'm2/s2', (/ "inst(X)", "inst(X)", "inst(X)", &
     1191       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))
     1192  TYPE(ctrl_out), SAVE :: o_vxq = ctrl_out((/ 11, 11, 11, 11, 11, 11, 6, 6, 6 /), &
     1193       'vq', 'vq', 'm/s * (kg/kg)', (/ "inst(X)", "inst(X)", "inst(X)", &
     1194       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))                                                                                                   
     1195  TYPE(ctrl_out), SAVE :: o_vxT = ctrl_out((/ 11, 11, 11, 11, 11, 11, 6, 6, 6 /), &
     1196       'vT', 'vT', 'mK/s', (/ "inst(X)", "inst(X)", "inst(X)", &
     1197       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))                                                                                     
     1198  TYPE(ctrl_out), SAVE :: o_wxq = ctrl_out((/ 11, 11, 11, 11, 11, 11, 6, 6, 6 /), &
     1199       'wq', 'wq', '(Pa/s)*(kg/kg)', (/ "inst(X)", "inst(X)", "inst(X)", &
     1200       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))                                                                               
     1201  TYPE(ctrl_out), SAVE :: o_vxphi = ctrl_out((/ 11, 11, 11, 11, 11, 11, 6, 6, 6 /), &
     1202       'vphi', 'vphi', 'm2/s', (/ "inst(X)", "inst(X)", "inst(X)", &
     1203       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))                                                                                 
     1204  TYPE(ctrl_out), SAVE :: o_wxT = ctrl_out((/ 11, 11, 11, 11, 11, 11, 6, 6, 6 /), &
     1205       'wT', 'wT', '"K*Pa/s', (/ "inst(X)", "inst(X)", "inst(X)", &
     1206       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))                                                                                     
     1207  TYPE(ctrl_out), SAVE :: o_uxu = ctrl_out((/ 11, 11, 11, 11, 11, 11, 6, 6, 6 /), &
     1208       'u2', 'u2', 'm2/s2', (/ "inst(X)", "inst(X)", "inst(X)", &
     1209       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))                                                                                                                                         
     1210  TYPE(ctrl_out), SAVE :: o_vxv = ctrl_out((/ 11, 11, 11, 11, 11, 11, 6, 6, 6 /), &
     1211       'v2', 'v2', 'm2/s2', (/ "inst(X)", "inst(X)", "inst(X)", &
     1212       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))                                                                               
     1213   TYPE(ctrl_out), SAVE :: o_TxT = ctrl_out((/ 11, 11, 11, 11, 11, 11, 6, 6, 6 /), &
     1214       'T2', 'T2', 'K2', (/ "inst(X)", "inst(X)", "inst(X)", &
     1215       "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)", "inst(X)"  /))                                                                                 
    11181216
    11191217END MODULE phys_output_ctrlout_mod
  • LMDZ5/branches/testing/libf/phylmd/phys_output_mod.F90

    r1795 r1864  
    11! $Id$
    22!
     3
     4MODULE phys_output_mod
     5  USE indice_sol_mod
     6  USE phys_output_var_mod
     7  USE aero_mod, only : naero_spc,name_aero
     8  USE phys_output_write_mod, ONLY : phys_output_write
     9
    310! Abderrahmane 12 2007
    411!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    1017!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1118
    12 MODULE phys_output_mod
    13   USE indice_sol_mod
    14   USE phys_output_var_mod
    15   USE phys_output_ctrlout_mod
    16   USE aero_mod, only : naero_spc,name_aero
    17 
    18   IMPLICIT NONE
    19 
    20   PRIVATE histdef2d, histdef3d, conf_physoutputs
    21 
    22   REAL, PRIVATE, SAVE                :: zdtime
    23   !$OMP THREADPRIVATE(zdtime)
    24 
    25 
    26 
    2719CONTAINS
    2820
     
    3325
    3426  SUBROUTINE phys_output_open(rlon,rlat,pim,tabij,ipt,jpt,plon,plat, &
    35        jjmp1,nlevSTD,clevSTD,nbteta, &
     27       jjmp1,nlevSTD,clevSTD,rlevSTD,nbteta, &
    3628       ctetaSTD, dtime, ok_veget, &
    3729       type_ocean, iflag_pbl,ok_mensuel,ok_journe, &
    3830       ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, read_climoz, &
    3931       phys_out_filestations, &
    40        new_aod, aerosol_couple, flag_aerosol_strat)   
     32       new_aod, aerosol_couple, flag_aerosol_strat, &
     33       pdtphys, paprs, pphis, pplay, lmax_th, ptconv, ptconvth, ivap, &
     34       d_t, qx, d_qx, zmasse, ok_sync)   
    4135
    4236    USE iophy
     
    4741    USE mod_phys_lmdz_para
    4842    USE aero_mod, only : naero_spc,name_aero
     43    USE phys_output_ctrlout_mod
     44
     45#ifdef CPP_XIOS
     46    ! ug Pour les sorties XIOS
     47    USE wxios
     48#endif
    4949
    5050    IMPLICIT NONE
     
    5656    include "iniprint.h"
    5757
    58     real,dimension(klon),intent(in) :: rlon
    59     real,dimension(klon),intent(in) :: rlat
    60     INTEGER, intent(in)             :: pim
     58    ! ug Nouveaux arguments nécessaires au histwrite_mod:
     59    INTEGER, INTENT(IN)                         :: ivap
     60    INTEGER, DIMENSION(klon), INTENT(IN)        :: lmax_th
     61    LOGICAL, INTENT(IN)                         :: ok_sync
     62    LOGICAL, DIMENSION(klon, klev), INTENT(IN)  :: ptconv, ptconvth
     63    REAL, INTENT(IN)                            :: pdtphys
     64    REAL, DIMENSION(klon), INTENT(IN)           :: pphis
     65    REAL, DIMENSION(klon, klev), INTENT(IN)     :: pplay, d_t
     66    REAL, DIMENSION(klon, klev+1), INTENT(IN)   :: paprs
     67    REAL, DIMENSION(klon,klev,nqtot), INTENT(IN):: qx, d_qx
     68    REAL, DIMENSION(klon, llm), INTENT(IN)      :: zmasse
     69
     70
     71    REAL,DIMENSION(klon),INTENT(IN) :: rlon
     72    REAL,DIMENSION(klon),INTENT(IN) :: rlat
     73    INTEGER, INTENT(IN)             :: pim
    6174    INTEGER, DIMENSION(pim)            :: tabij
    62     INTEGER,dimension(pim), intent(in) :: ipt, jpt
    63     REAL,dimension(pim), intent(in) :: plat, plon
    64     REAL,dimension(pim,2) :: plat_bounds, plon_bounds
     75    INTEGER,DIMENSION(pim), INTENT(IN) :: ipt, jpt
     76    REAL,DIMENSION(pim), INTENT(IN) :: plat, plon
     77    REAL,DIMENSION(pim,2) :: plat_bounds, plon_bounds
    6578
    6679    INTEGER                               :: jjmp1
     
    6982    LOGICAL                               :: ok_LES,ok_ade,ok_aie,flag_aerosol_strat
    7083    LOGICAL                               :: new_aod, aerosol_couple
    71     INTEGER, intent(in)::  read_climoz ! read ozone climatology
     84    INTEGER, INTENT(IN)::  read_climoz ! read ozone climatology
    7285    !     Allowed values are 0, 1 and 2
    7386    !     0: do not read an ozone climatology
     
    8194    REAL, DIMENSION(klev)                 :: Ahyb, Bhyb, Alt
    8295    CHARACTER(LEN=4), DIMENSION(nlevSTD)  :: clevSTD
     96    REAL, DIMENSION(nlevSTD)              :: rlevSTD
    8397    INTEGER                               :: nsrf, k, iq, iiq, iff, i, j, ilev
    8498    INTEGER                               :: naero
     
    90104    CHARACTER(LEN=3)                      :: ctetaSTD(nbteta)
    91105    REAL, DIMENSION(nfiles)               :: ecrit_files
    92     CHARACTER(LEN=20), DIMENSION(nfiles)  :: phys_out_filenames
    93106    INTEGER, DIMENSION(iim*jjmp1)         ::  ndex2d
    94107    INTEGER, DIMENSION(iim*jjmp1*klev)    :: ndex3d
     
    97110    INTEGER, DIMENSION(nfiles)            :: phys_out_levmin, phys_out_levmax
    98111    INTEGER, DIMENSION(nfiles)            :: phys_out_filelevels
    99     CHARACTER(LEN=20), DIMENSION(nfiles)  :: chtimestep   = (/ 'DefFreq', 'DefFreq','DefFreq', 'DefFreq', 'DefFreq', 'DefFreq' /)
     112    CHARACTER(LEN=20), DIMENSION(nfiles)  :: chtimestep   = (/ '1mth', '1mth', '1mth', '1mth', '1mth', &
     113                                                               '1mth', '1mth', '1mth', '1mth' /)
    100114    LOGICAL, DIMENSION(nfiles)            :: phys_out_filekeys
    101115    LOGICAL, DIMENSION(nfiles)            :: phys_out_filestations
     
    104118    !                 entre [phys_out_lonmin,phys_out_lonmax] et [phys_out_latmin,phys_out_latmax]
    105119
    106     LOGICAL, DIMENSION(nfiles), SAVE  :: phys_out_regfkey       = (/ .FALSE., .FALSE., .FALSE.,  .FALSE., .FALSE., .FALSE. /)
    107     REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmin        = (/   -180.,   -180.,   -180.,    -180.,   -180.,   -180. /)
    108     REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmax        = (/    180.,    180.,    180.,     180.,    180.,    180. /)
    109     REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmin        = (/    -90.,    -90.,    -90.,     -90.,    -90.,    -90. /)
    110     REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmax        = (/     90.,     90.,     90.,     90.,     90.,     90. /)
     120    LOGICAL, DIMENSION(nfiles), SAVE  :: phys_out_regfkey       = (/ .FALSE., .FALSE., .FALSE.,  .FALSE., &
     121                                                                    .FALSE., .FALSE., .FALSE., .FALSE.,  .FALSE. /)
     122    REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmin        = (/   -180.,   -180.,   -180.,    -180., &
     123                                                                     -180.,   -180., -180.,   -180.,    -180. /)
     124    REAL, DIMENSION(nfiles), SAVE     :: phys_out_lonmax        = (/    180.,    180.,    180.,     180., &
     125                                                                      180.,    180., 180.,    180.,     180. /)
     126    REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmin        = (/    -90.,    -90.,    -90.,     -90., &
     127                                                                    -90., -90., -90.,    -90.,     -90. /)
     128    REAL, DIMENSION(nfiles), SAVE     :: phys_out_latmax        = (/  90.,     90.,     90.,     90., &
     129                                                                    90., 90., 90., 90., 90. /)                       
     130#ifdef CPP_XIOS
     131    ! ug Variables utilisées pour récupérer le calendrier pour xios
     132    INTEGER :: x_an, x_mois, x_jour
     133    REAL :: x_heure
     134#endif
    111135
    112136    WRITE(lunout,*) 'Debut phys_output_mod.F90'
     
    115139    IF (.NOT. ALLOCATED(o_trac)) ALLOCATE(o_trac(nqtot))
    116140    IF (.NOT. ALLOCATED(o_trac_cum)) ALLOCATE(o_trac_cum(nqtot))
    117 
    118     levmax = (/ klev, klev, klev, klev, klev, klev /)
     141    ALLOCATE(o_dtr_the(nqtot),o_dtr_con(nqtot),o_dtr_lessi_impa(nqtot))
     142    ALLOCATE(o_dtr_lessi_nucl(nqtot),o_dtr_insc(nqtot),o_dtr_bcscav(nqtot))
     143    ALLOCATE(o_dtr_evapls(nqtot),o_dtr_ls(nqtot),o_dtr_trsp(nqtot))
     144    ALLOCATE(o_dtr_sscav(nqtot),o_dtr_sat(nqtot),o_dtr_uscav(nqtot))
     145    ALLOCATE(o_dtr_dry(nqtot),o_dtr_vdf(nqtot))
     146
     147
     148    levmax = (/ klev, klev, klev, klev, klev, klev, nlevSTD, nlevSTD, nlevSTD /)
    119149
    120150    phys_out_filenames(1) = 'histmth'
     
    124154    phys_out_filenames(5) = 'histLES'
    125155    phys_out_filenames(6) = 'histstn'
     156    phys_out_filenames(7) = 'histmthNMC'
     157    phys_out_filenames(8) = 'histdayNMC'
     158    phys_out_filenames(9) = 'histhfNMC.nc'
    126159
    127160    type_ecri(1) = 'ave(X)'
     
    131164    type_ecri(5) = 'ave(X)'
    132165    type_ecri(6) = 'inst(X)'
     166    type_ecri(7) = 'inst(X)'
     167    type_ecri(8) = 'inst(X)'
     168    type_ecri(9) = 'inst(X)'
    133169
    134170    clef_files(1) = ok_mensuel
     
    138174    clef_files(5) = ok_LES
    139175    clef_files(6) = ok_instan
     176    clef_files(7) = ok_histNMC(1)
     177    clef_files(8) = ok_histNMC(2)
     178    clef_files(9) = ok_histNMC(3)
    140179
    141180    !sortir des fichiers "stations" si clef_stations(:)=.TRUE.
     
    146185    clef_stations(5) = .FALSE.
    147186    clef_stations(6) = .FALSE.
     187    clef_stations(7) = .FALSE.
     188    clef_stations(8) = .FALSE.
     189    clef_stations(9) = .FALSE.
    148190
    149191    lev_files(1) = lev_histmth
     
    153195    lev_files(5) = lev_histLES
    154196    lev_files(6) = lev_histins
     197    lev_files(7) = levout_histNMC(1)
     198    lev_files(8) = levout_histNMC(2)
     199    lev_files(9) = levout_histNMC(3)
    155200
    156201    ecrit_files(1) = ecrit_mth
     
    160205    ecrit_files(5) = ecrit_LES
    161206    ecrit_files(6) = ecrit_ins
     207    ecrit_files(7) = freq_outNMC(1)/86400.
     208    ecrit_files(8) = freq_outNMC(2)/86400.
     209    ecrit_files(9) = freq_outNMC(3)/86400.
    162210
    163211    !! Lectures des parametres de sorties dans physiq.def
     
    195243    WRITE(lunout,*)'phys_out_filelevels=',lev_files
    196244
     245#ifdef CPP_XIOS
     246    ! ug Réglage du calendrier xios
     247    !Temps julian => an, mois, jour, heure
     248    CALL ymds2ju(annee_ref, 1, day_ref, 0.0, zjulian)
     249    CALL ju2ymds(zjulian, x_an, x_mois, x_jour, x_heure)
     250    CALL wxios_set_cal(dtime, calend, x_an, x_mois, x_jour, x_heure)
     251#endif
     252
    197253!!!!!!!!!!!!!!!!!!!!!!! Boucle sur les fichiers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    198254    ! Appel de histbeg et histvert pour creer le fichier et les niveaux verticaux !!
     
    200256!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    201257
    202     zdtime = dtime         ! Frequence ou l on moyenne
     258    zdtime_moy = dtime         ! Frequence ou l on moyenne
    203259
    204260    ! Calcul des Ahyb, Bhyb et Alt
     
    226282       zoutm(iff) = ecrit_files(iff) ! Frequence ou l on ecrit en seconde
    227283
     284
     285#ifdef CPP_XIOS
     286    ! ug déclaration des axes verticaux de chaque fichier:
     287    CALL wxios_add_vaxis("presnivs", phys_out_filenames(iff), &
     288            levmax(iff) - levmin(iff) + 1, presnivs(levmin(iff):levmax(iff)))
     289    CALL wxios_add_vaxis("Ahyb", phys_out_filenames(iff), &
     290            levmax(iff) - levmin(iff) + 1, Ahyb)
     291    CALL wxios_add_vaxis("Bhyb", phys_out_filenames(iff), &
     292            levmax(iff) - levmin(iff) + 1, Bhyb)
     293    CALL wxios_add_vaxis("Ahyb", phys_out_filenames(iff), &
     294            levmax(iff) - levmin(iff) + 1, Alt)
     295
     296    IF (clef_files(iff)) THEN
     297         CALL wxios_add_file(phys_out_filenames(iff),chtimestep(iff),lev_files(iff))
     298    END IF
     299#endif
     300
    228301       IF (clef_files(iff)) THEN
    229302
     
    243316!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    244317          IF (phys_out_regfkey(iff)) then
    245 
    246318             imin_ins=1
    247319             imax_ins=iim
     
    283355                  itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
    284356          else
    285              CALL histbeg_phy(phys_out_filenames(iff),itau_phy,zjulian,dtime,nhorim(iff),nid_files(iff))
     357             CALL histbeg_phy_all(phys_out_filenames(iff),itau_phy,zjulian,&
     358                 dtime,nhorim(iff),nid_files(iff))
    286359          endif
    287360
    288           CALL histvert(nid_files(iff), "presnivs", "Vertical levels", "Pa", &
     361#ifndef CPP_NO_IOIPSL
     362          if (iff.le.6) then
     363             CALL histvert(nid_files(iff), "presnivs", "Vertical levels", "Pa", & 
    289364               levmax(iff) - levmin(iff) + 1, &
    290365               presnivs(levmin(iff):levmax(iff)), nvertm(iff),"down")
    291 
    292 !!!!!!!!!!!!! Traitement des champs 3D pour histhf !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    293 !!!!!!!!!!!!!!! A Revoir plus tard !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    294           !          IF (iff.eq.3.and.lev_files(iff).ge.4) THEN
    295           !          CALL histbeg_phy("histhf3d",itau_phy, &
    296           !     &                     zjulian, dtime, &
    297           !     &                     nhorim, nid_hf3d)
    298 
    299           !         CALL histvert(nid_hf3d, "presnivs", &
    300           !     &                 "Vertical levels", "mb", &
    301           !     &                 klev, presnivs/100., nvertm)
    302           !          ENDIF
    303           !
    304 !!!! Composentes de la coordonnee sigma-hybride
     366!!!! Composantes de la coordonnee sigma-hybride
    305367          CALL histvert(nid_files(iff), "Ahyb","Ahyb comp of Hyb Cord ", "Pa", &
    306368               levmax(iff) - levmin(iff) + 1,Ahyb,nvertap(iff))
     
    309371               levmax(iff) - levmin(iff) + 1,Bhyb,nvertbp(iff))
    310372
    311           CALL histvert(nid_files(iff), "Alt","Height approx for scale heigh of 8km at levels", "Km", &
     373          CALL histvert(nid_files(iff), "Alt","Height approx for scale heigh of 8km at levels", "Km", &                       
    312374               levmax(iff) - levmin(iff) + 1,Alt,nvertAlt(iff))
    313375
    314           !   CALL histvert(nid_files(iff), "preff","Reference pressure", "Pa", &
    315           !                 1,preff,nvertp0(iff))
    316 !!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    317     CALL histdef2d(iff,o_aire)
    318     CALL histdef2d(iff,o_contfracATM)
    319 
    320 !!! Champs 2D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    321     CALL histdef2d(iff,o_phis)
    322     CALL histdef2d(iff,o_contfracOR)
    323     CALL histdef2d(iff,o_aireTER)
    324     CALL histdef2d(iff,o_flat)
    325     CALL histdef2d(iff,o_slp)
    326     CALL histdef2d(iff,o_tsol)
    327     CALL histdef2d(iff,o_t2m)
    328     CALL histdef2d(iff,o_t2m_min)
    329     CALL histdef2d(iff,o_t2m_max)
    330     CALL histdef2d(iff,o_wind10m)
    331     CALL histdef2d(iff,o_wind10max)
    332     CALL histdef2d(iff,o_sicf)
    333     CALL histdef2d(iff,o_q2m)
    334     CALL histdef2d(iff,o_ustar)
    335     CALL histdef2d(iff,o_u10m)
    336     CALL histdef2d(iff,o_v10m)
    337     CALL histdef2d(iff,o_psol)
    338     CALL histdef2d(iff,o_qsurf)
    339 
    340     IF (.NOT. ok_veget) THEN
    341       CALL histdef2d(iff,o_qsol)
    342     ENDIF
    343     CALL histdef2d(iff,o_ndayrain)
    344     CALL histdef2d(iff,o_precip)
    345     CALL histdef2d(iff,o_plul)
    346     CALL histdef2d(iff,o_pluc)
    347     CALL histdef2d(iff,o_snow)
    348     CALL histdef2d(iff,o_msnow)
    349     CALL histdef2d(iff,o_fsnow)
    350     CALL histdef2d(iff,o_evap)
    351     CALL histdef2d(iff,o_tops)
    352     CALL histdef2d(iff,o_tops0)
    353     CALL histdef2d(iff,o_topl)
    354     CALL histdef2d(iff,o_topl0)
    355     CALL histdef2d(iff,o_SWupTOA)
    356     CALL histdef2d(iff,o_SWupTOAclr)
    357     CALL histdef2d(iff,o_SWdnTOA)
    358     CALL histdef2d(iff,o_SWdnTOAclr)
    359     CALL histdef2d(iff,o_nettop)
    360     CALL histdef2d(iff,o_SWup200)
    361     CALL histdef2d(iff,o_SWup200clr)
    362     CALL histdef2d(iff,o_SWdn200)
    363     CALL histdef2d(iff,o_SWdn200clr)
    364     CALL histdef2d(iff,o_LWup200)
    365     CALL histdef2d(iff,o_LWup200clr)
    366     CALL histdef2d(iff,o_LWdn200)
    367     CALL histdef2d(iff,o_LWdn200clr)
    368     CALL histdef2d(iff,o_sols)
    369     CALL histdef2d(iff,o_sols0)
    370     CALL histdef2d(iff,o_soll)
    371     CALL histdef2d(iff,o_radsol)
    372     CALL histdef2d(iff,o_soll0)
    373     CALL histdef2d(iff,o_SWupSFC)
    374     CALL histdef2d(iff,o_SWupSFCclr)
    375     CALL histdef2d(iff,o_SWdnSFC)
    376     CALL histdef2d(iff,o_SWdnSFCclr)
    377     CALL histdef2d(iff,o_LWupSFC)
    378     CALL histdef2d(iff,o_LWdnSFC)
    379     CALL histdef2d(iff,o_LWupSFCclr)
    380     CALL histdef2d(iff,o_LWdnSFCclr)
    381     CALL histdef2d(iff,o_bils)
    382     CALL histdef2d(iff,o_bils_ec)
    383     CALL histdef2d(iff,o_bils_tke)
    384     CALL histdef2d(iff,o_bils_diss)
    385     CALL histdef2d(iff,o_bils_kinetic)
    386     CALL histdef2d(iff,o_bils_enthalp)
    387     CALL histdef2d(iff,o_bils_latent)
    388     CALL histdef2d(iff,o_sens)
    389     CALL histdef2d(iff,o_fder)
    390     CALL histdef2d(iff,o_ffonte)
    391     CALL histdef2d(iff,o_fqcalving)
    392     CALL histdef2d(iff,o_fqfonte)
    393     CALL histdef2d(iff,o_taux)
    394     CALL histdef2d(iff,o_tauy)
    395 
    396     DO nsrf = 1, nbsrf
    397       CALL histdef2d(iff,o_pourc_srf(nsrf))
    398       CALL histdef2d(iff,o_fract_srf(nsrf))
    399       CALL histdef2d(iff, o_taux_srf(nsrf))
    400       CALL histdef2d(iff, o_tauy_srf(nsrf))
    401       CALL histdef2d(iff, o_tsol_srf(nsrf))
    402       CALL histdef2d(iff, o_evappot_srf(nsrf))
    403       CALL histdef2d(iff, o_ustar_srf(nsrf))
    404       CALL histdef2d(iff, o_u10m_srf(nsrf))
    405       CALL histdef2d(iff, o_evap_srf(nsrf))
    406       CALL histdef2d(iff, o_v10m_srf(nsrf))
    407       CALL histdef2d(iff, o_t2m_srf(nsrf))
    408       CALL histdef2d(iff, o_sens_srf(nsrf))
    409       CALL histdef2d(iff, o_lat_srf(nsrf))
    410       CALL histdef2d(iff, o_flw_srf(nsrf))
    411       CALL histdef2d(iff, o_fsw_srf(nsrf))
    412       CALL histdef2d(iff, o_wbils_srf(nsrf))
    413       CALL histdef2d(iff, o_wbilo_srf(nsrf))
    414       IF (iflag_pbl>1 ) then
    415             CALL histdef2d(iff, o_tke_srf(nsrf))
    416             CALL histdef2d(iff, o_tke_max_srf(nsrf))
    417       ENDIF
    418 
    419       CALL histdef2d(iff, o_albe_srf(nsrf))
    420       CALL histdef2d(iff, o_rugs_srf(nsrf))
    421       CALL histdef2d(iff, o_ages_srf(nsrf))
    422     END DO
    423 
    424     IF (new_aod .AND. (.NOT. aerosol_couple)) THEN
    425       IF (ok_ade.OR.ok_aie) THEN
    426           CALL histdef2d(iff,o_od550aer)
    427           CALL histdef2d(iff,o_od865aer)
    428           CALL histdef2d(iff,o_absvisaer)
    429           CALL histdef2d(iff,o_od550lt1aer)
    430           CALL histdef2d(iff,o_sconcso4)
    431           CALL histdef2d(iff,o_sconcoa)
    432           CALL histdef2d(iff,o_sconcbc)
    433           CALL histdef2d(iff,o_sconcss)
    434           CALL histdef2d(iff,o_sconcdust)
    435           CALL histdef3d(iff,o_concso4)
    436           CALL histdef3d(iff,o_concoa)
    437           CALL histdef3d(iff,o_concbc)
    438           CALL histdef3d(iff,o_concss)
    439           CALL histdef3d(iff,o_concdust)
    440           CALL histdef2d(iff,o_loadso4)
    441           CALL histdef2d(iff,o_loadoa)
    442           CALL histdef2d(iff,o_loadbc)
    443           CALL histdef2d(iff,o_loadss)
    444           CALL histdef2d(iff,o_loaddust)
    445 !--STRAT AER
    446       ENDIF
    447       IF (ok_ade.OR.ok_aie.OR.flag_aerosol_strat) THEN
    448         DO naero = 1, naero_spc
    449           CALL histdef2d(iff, o_tausumaero(naero))
    450         END DO
    451       ENDIF
    452     ENDIF
    453 
    454     IF (ok_ade) THEN
    455       CALL histdef2d(iff,o_topswad)
    456       CALL histdef2d(iff,o_topswad0)
    457       CALL histdef2d(iff,o_solswad)
    458       CALL histdef2d(iff,o_solswad0)
    459       CALL histdef2d(iff,o_swtoaas_nat)
    460       CALL histdef2d(iff,o_swsrfas_nat)
    461       CALL histdef2d(iff,o_swtoacs_nat)
    462       CALL histdef2d(iff,o_swsrfcs_nat)
    463       CALL histdef2d(iff,o_swtoaas_ant)
    464       CALL histdef2d(iff,o_swsrfas_ant)
    465       CALL histdef2d(iff,o_swtoacs_ant)
    466       CALL histdef2d(iff,o_swsrfcs_ant)
    467 
    468       IF (.NOT. aerosol_couple) THEN
    469             CALL histdef2d(iff,o_swtoacf_nat)
    470             CALL histdef2d(iff,o_swsrfcf_nat)
    471             CALL histdef2d(iff,o_swtoacf_ant)
    472             CALL histdef2d(iff,o_swsrfcf_ant)
    473             CALL histdef2d(iff,o_swtoacf_zero)
    474             CALL histdef2d(iff,o_swsrfcf_zero)
    475       ENDIF
    476     ENDIF
    477 
    478     IF (ok_aie) THEN
    479       CALL histdef2d(iff,o_topswai)
    480       CALL histdef2d(iff,o_solswai)
    481                   !Cloud droplet number concentration
    482       CALL histdef3d(iff,o_scdnc)
    483       CALL histdef2d(iff,o_cldncl)
    484       CALL histdef3d(iff,o_reffclws)
    485       CALL histdef3d(iff,o_reffclwc)
    486       CALL histdef2d(iff,o_cldnvi)
    487       CALL histdef3d(iff,o_lcc3d)
    488       CALL histdef3d(iff,o_lcc3dcon)
    489       CALL histdef3d(iff,o_lcc3dstra)
    490       CALL histdef2d(iff,o_lcc)
    491       CALL histdef2d(iff,o_reffclwtop)
    492     ENDIF
    493     CALL histdef2d(iff,o_alb1)
    494     CALL histdef2d(iff,o_alb2)
    495     CALL histdef2d(iff,o_cdrm)
    496     CALL histdef2d(iff,o_cdrh)
    497     CALL histdef2d(iff,o_cldl)
    498     CALL histdef2d(iff,o_cldm)
    499     CALL histdef2d(iff,o_cldh)
    500     CALL histdef2d(iff,o_cldt)
    501     CALL histdef2d(iff,o_cldq)
    502     CALL histdef2d(iff,o_lwp)
    503     CALL histdef2d(iff,o_iwp)
    504     CALL histdef2d(iff,o_ue)
    505     CALL histdef2d(iff,o_ve)
    506     CALL histdef2d(iff,o_uq)
    507     CALL histdef2d(iff,o_vq)
    508 
    509     IF(iflag_con.GE.3) THEN ! sb
    510       CALL histdef2d(iff,o_cape)
    511       CALL histdef2d(iff,o_pbase)
    512       CALL histdef2d(iff,o_ptop)
    513       CALL histdef2d(iff,o_fbase)
    514       IF (iflag_con /= 30) THEN
    515             CALL histdef2d(iff,o_plcl)
    516             CALL histdef2d(iff,o_plfc)
    517             CALL histdef2d(iff,o_wbeff)
    518       ENDIF
    519       CALL histdef2d(iff,o_cape_max)
    520       CALL histdef3d(iff,o_upwd)
    521       CALL histdef3d(iff,o_Ma)
    522       CALL histdef3d(iff,o_dnwd)
    523       CALL histdef3d(iff,o_dnwd0)
    524       CALL histdef3d(iff,o_mc)
    525       CALL histdef2d(iff,o_ftime_con)
    526     ENDIF !iflag_con .GE. 3
    527     CALL histdef2d(iff,o_prw)
    528     CALL histdef2d(iff,o_s_pblh)
    529     CALL histdef2d(iff,o_s_pblt)
    530     CALL histdef2d(iff,o_s_lcl)
    531     CALL histdef2d(iff,o_s_therm)
    532           !IM : Les champs suivants (s_oliqCL, s_cteiCL, s_trmb1, s_trmb2, s_trmb3) ne sont pas definis dans HBTM.F
    533           !CALL histdef2d(iff, &
    534           !o_s_capCL%flag,o_s_capCL%name, "Conv avlbl pot enerfor ABL", "J/m2" )
    535           !CALL histdef2d(iff, &
    536           !o_s_oliqCL%flag,o_s_oliqCL%name, "Liq Water in BL", "kg/m2")
    537           !CALL histdef2d(iff, &
    538           !o_s_cteiCL%flag,o_s_cteiCL%name, "Instability criteria(ABL)", "K")
    539           !CALL histdef2d(iff, &
    540           !o_s_trmb1%flag,o_s_trmb1%name, "deep_cape(HBTM2)", "J/m2")
    541           !CALL histdef2d(iff, &
    542           !o_s_trmb2%flag,o_s_trmb2%name, "inhibition (HBTM2)", "J/m2")
    543           !CALL histdef2d(iff, &
    544           !o_s_trmb3%flag,o_s_trmb3%name, "Point Omega (HBTM2)", "m")
    545 
    546           ! Champs interpolles sur des niveaux de pression
    547 
    548           ! Attention a reverifier
    549 
    550     ilev=0       
    551     DO k=1, nlevSTD
    552       bb2=clevSTD(k)
    553       IF(bb2.EQ."850".OR.bb2.EQ."700".OR.bb2.EQ."500".OR.bb2.EQ."200" &
    554                   .OR.bb2.EQ."100".OR.bb2.EQ."50".OR.bb2.EQ."10")THEN
    555             ilev=ilev+1
    556             !     print*,'ilev k bb2 flag name ',ilev,k, bb2,o_uSTDlevs(ilev)%flag,o_uSTDlevs(ilev)%name
    557             CALL histdef2d(iff,o_uSTDlevs(ilev))
    558             CALL histdef2d(iff,o_vSTDlevs(ilev))
    559             CALL histdef2d(iff,o_wSTDlevs(ilev))
    560             CALL histdef2d(iff,o_zSTDlevs(ilev))
    561             CALL histdef2d(iff,o_qSTDlevs(ilev))
    562             CALL histdef2d(iff,o_tSTDlevs(ilev))
    563       ENDIF !(bb2.EQ."850".OR.bb2.EQ."700".OR."500".OR.bb2.EQ."200".OR.bb2.EQ."50".OR.bb2.EQ."10")
    564     ENDDO
    565 
    566     CALL histdef2d(iff,o_t_oce_sic)
    567 
    568     IF (type_ocean=='slab') THEN
    569       CALL histdef2d(iff,o_slab_bils)
    570     ENDIF
    571 
    572     ! Couplage conv-CL
    573     IF (iflag_con.GE.3) THEN
    574       IF (iflag_coupl>=1) THEN
    575             CALL histdef2d(iff,o_ale_bl)
    576             CALL histdef2d(iff,o_alp_bl)
    577       ENDIF
    578     ENDIF !(iflag_con.GE.3)
    579 
    580     CALL histdef2d(iff,o_weakinv)
    581     CALL histdef2d(iff,o_dthmin)
    582 
    583     CALL histdef2d(iff,o_rh2m)
    584     CALL histdef2d(iff,o_rh2m_min)
    585     CALL histdef2d(iff,o_rh2m_max)
    586 
    587     CALL histdef2d(iff,o_qsat2m)
    588     CALL histdef2d(iff,o_tpot)
    589     CALL histdef2d(iff,o_tpote)
    590     CALL histdef2d(iff,o_SWnetOR)
    591     CALL histdef2d(iff,o_SWdownOR)
    592     CALL histdef2d(iff,o_LWdownOR)
    593     CALL histdef2d(iff,o_snowl)
    594     CALL histdef2d(iff,o_solldown)
    595     CALL histdef2d(iff,o_dtsvdfo)
    596     CALL histdef2d(iff,o_dtsvdft)
    597     CALL histdef2d(iff,o_dtsvdfg)
    598     CALL histdef2d(iff,o_dtsvdfi)
    599     CALL histdef2d(iff,o_rugs)
    600 
    601           ! Champs 3D:
    602     CALL histdef3d(iff,o_ec550aer)
    603     CALL histdef3d(iff,o_lwcon)
    604     CALL histdef3d(iff,o_iwcon)
    605     CALL histdef3d(iff,o_temp)
    606     CALL histdef3d(iff,o_theta)
    607     CALL histdef3d(iff,o_ovap)
    608     CALL histdef3d(iff,o_oliq)
    609     CALL histdef3d(iff,o_ovapinit)
    610     CALL histdef3d(iff,o_geop)
    611     CALL histdef3d(iff,o_vitu)
    612     CALL histdef3d(iff,o_vitv)
    613     CALL histdef3d(iff,o_vitw)
    614     CALL histdef3d(iff,o_pres)
    615     CALL histdef3d(iff,o_paprs)
    616     CALL histdef3d(iff,o_mass)
    617     CALL histdef3d(iff,o_zfull)
    618     CALL histdef3d(iff,o_zhalf)
    619     CALL histdef3d(iff,o_rneb)
    620     CALL histdef3d(iff,o_rnebcon)
    621     CALL histdef3d(iff,o_rnebls)
    622     CALL histdef3d(iff,o_rhum)
    623     CALL histdef3d(iff,o_ozone)
    624 
    625     IF (read_climoz == 2) THEN
    626       CALL histdef3d(iff,o_ozone_light)
    627     END IF
    628 
    629     CALL histdef3d(iff,o_dtphy)
    630     CALL histdef3d(iff,o_dqphy)
    631     CALL histdef3d(iff,o_cldtau)
    632     CALL histdef3d(iff,o_cldemi)
    633 !IM: bug ?? dimensionnement variables (klon,klev+1) pmflxr, pmflxs, prfl, psfl
    634     CALL histdef3d(iff,o_pr_con_l)
    635     CALL histdef3d(iff,o_pr_con_i)
    636     CALL histdef3d(iff,o_pr_lsc_l)
    637     CALL histdef3d(iff,o_pr_lsc_i)
    638 !Cloud droplet effective radius
    639     CALL histdef3d(iff,o_re)
    640     CALL histdef3d(iff,o_fl)
    641 !FH Sorties pour la couche limite
    642     IF (iflag_pbl>1) THEN
    643       CALL histdef3d(iff,o_tke)
    644       CALL histdef3d(iff,o_tke_max)
    645     ENDIF
    646     CALL histdef3d(iff,o_kz)
    647     CALL histdef3d(iff,o_kz_max)
    648     CALL histdef3d(iff,o_clwcon)
    649     CALL histdef3d(iff,o_dtdyn)
    650     CALL histdef3d(iff,o_dqdyn)
    651     CALL histdef3d(iff,o_dudyn)
    652     CALL histdef3d(iff,o_dvdyn)
    653     CALL histdef3d(iff,o_dtcon)
    654     CALL histdef3d(iff,o_ducon)
    655     CALL histdef3d(iff,o_dvcon)
    656     CALL histdef3d(iff,o_dqcon)
    657 
    658 ! Wakes
    659     IF(iflag_con.EQ.3) THEN
    660       IF (iflag_wake >= 1) THEN
    661             CALL histdef2d(iff,o_ale_wk)
    662             CALL histdef2d(iff,o_alp_wk)
    663             CALL histdef2d(iff,o_ale)
    664             CALL histdef2d(iff,o_alp)
    665             CALL histdef2d(iff,o_cin)
    666             CALL histdef2d(iff,o_wape)
    667             CALL histdef2d(iff,o_wake_h)
    668             CALL histdef2d(iff,o_wake_s)
    669             CALL histdef3d(iff,o_dtwak)
    670             CALL histdef3d(iff,o_dqwak)
    671             CALL histdef3d(iff,o_wake_deltat)
    672             CALL histdef3d(iff,o_wake_deltaq)
    673             CALL histdef3d(iff,o_wake_omg)
    674       ENDIF
    675 !!! RomP             CALL histdef3d(iff,o_Vprecip%flag,o_Vprecip%name, "precipitation vertical profile", "-")
    676       CALL histdef3d(iff,o_ftd)
    677       CALL histdef3d(iff,o_fqd)
    678     ENDIF !(iflag_con.EQ.3)
    679 
    680     IF(iflag_con.GE.3) THEN   !  RomP >>>
    681       CALL histdef3d(iff,o_wdtrainA)
    682       CALL histdef3d(iff,o_wdtrainM)
    683       CALL histdef3d(iff,o_Vprecip)
    684     ENDIF !(iflag_con.GE.3)   ! <<< RomP
    685 
    686 !!! nrlmd le 10/04/2012
    687 
    688     IF (iflag_trig_bl>=1) THEN
    689       CALL histdef2d(iff,o_n2)
    690       CALL histdef2d(iff,o_s2)
    691       CALL histdef2d(iff,o_proba_notrig)
    692       CALL histdef2d(iff,o_random_notrig)
    693       CALL histdef2d(iff,o_ale_bl_trig)
    694       CALL histdef2d(iff,o_ale_bl_stat)
    695     ENDIF  !(iflag_trig_bl>=1)
    696 
    697     IF (iflag_clos_bl>=1) THEN
    698       CALL histdef2d(iff,o_alp_bl_det)
    699       CALL histdef2d(iff,o_alp_bl_fluct_m)
    700       CALL histdef2d(iff,o_alp_bl_fluct_tke)
    701       CALL histdef2d(iff,o_alp_bl_conv)
    702       CALL histdef2d(iff,o_alp_bl_stat)
    703     ENDIF  !(iflag_clos_bl>=1)
    704 
    705 !!! fin nrlmd le 10/04/2012
    706     CALL histdef3d(iff,o_dtlsc)
    707     CALL histdef3d(iff,o_dtlschr)
    708     CALL histdef3d(iff,o_dqlsc)
    709     CALL histdef3d(iff,o_beta_prec)
    710     CALL histdef3d(iff,o_dtvdf)
    711     CALL histdef3d(iff,o_dtdis)
    712     CALL histdef3d(iff,o_dqvdf)
    713     CALL histdef3d(iff,o_dteva)
    714     CALL histdef3d(iff,o_dqeva)
    715     CALL histdef3d(iff,o_ptconv)
    716     CALL histdef3d(iff,o_ratqs)
    717     CALL histdef3d(iff,o_dtthe)
    718 
    719     IF (iflag_thermals.ge.1) THEN
    720       CALL histdef3d(iff,o_dqlscth)
    721       CALL histdef3d(iff,o_dqlscst)
    722       CALL histdef3d(iff,o_dtlscth)
    723       CALL histdef3d(iff,o_dtlscst)
    724       CALL histdef2d(iff,o_plulth)
    725       CALL histdef2d(iff,o_plulst)
    726       CALL histdef2d(iff,o_lmaxth)
    727       CALL histdef3d(iff,o_ptconvth)
    728       CALL histdef3d(iff,o_f_th)
    729       CALL histdef3d(iff,o_e_th)
    730       CALL histdef3d(iff,o_w_th)
    731       CALL histdef3d(iff,o_lambda_th)
    732       CALL histdef2d(iff,o_ftime_th)
    733       CALL histdef3d(iff,o_q_th)
    734       CALL histdef3d(iff,o_a_th)
    735       CALL histdef3d(iff,o_d_th)
    736       CALL histdef2d(iff,o_f0_th)
    737       CALL histdef2d(iff,o_zmax_th)
    738       CALL histdef3d(iff,o_dqthe)
    739     ENDIF !iflag_thermals.ge.1
    740 
    741     CALL histdef3d(iff,o_dtajs)
    742     CALL histdef3d(iff,o_dqajs)
    743     CALL histdef3d(iff,o_dtswr)
    744     CALL histdef3d(iff,o_dtsw0)
    745     CALL histdef3d(iff,o_dtlwr)
    746     CALL histdef3d(iff,o_dtlw0)
    747     CALL histdef3d(iff,o_dtec)
    748     CALL histdef3d(iff,o_duvdf)
    749     CALL histdef3d(iff,o_dvvdf)
    750 
    751     IF (ok_orodr) THEN
    752       CALL histdef3d(iff,o_duoro)
    753       CALL histdef3d(iff,o_dvoro)
    754       CALL histdef3d(iff,o_dtoro)
    755     ENDIF
    756 
    757     IF (ok_orolf) THEN
    758       CALL histdef3d(iff,o_dulif)
    759       CALL histdef3d(iff,o_dvlif)
    760       CALL histdef3d(iff,o_dtlif)
    761     ENDIF
    762 
    763     IF (ok_hines) then
    764       CALL histdef3d(iff,o_duhin)
    765       CALL histdef3d(iff,o_dvhin)
    766       CALL histdef3d(iff,o_dthin)
    767     ENDIF
    768 
    769     CALL histdef3d(iff,o_rsu)
    770     CALL histdef3d(iff,o_rsd)
    771     CALL histdef3d(iff,o_rlu)
    772     CALL histdef3d(iff,o_rld)
    773     CALL histdef3d(iff,o_rsucs)
    774     CALL histdef3d(iff,o_rsdcs)
    775     CALL histdef3d(iff,o_rlucs)
    776     CALL histdef3d(iff,o_rldcs)
    777     CALL histdef3d(iff,o_tnt)
    778     CALL histdef3d(iff,o_tntc)
    779     CALL histdef3d(iff,o_tntr)
    780     CALL histdef3d(iff,o_tntscpbl)
    781     CALL histdef3d(iff,o_tnhus)
    782     CALL histdef3d(iff,o_tnhusc)
    783     CALL histdef3d(iff,o_tnhusscpbl)
    784     CALL histdef3d(iff,o_evu)
    785     CALL histdef3d(iff,o_h2o)
    786     CALL histdef3d(iff,o_mcd)
    787     CALL histdef3d(iff,o_dmc)
    788     CALL histdef3d(iff,o_ref_liq)
    789     CALL histdef3d(iff,o_ref_ice)
    790 
    791     IF (RCO2_per.NE.RCO2_act.OR.RCH4_per.NE.RCH4_act.OR. &
    792                RN2O_per.NE.RN2O_act.OR.RCFC11_per.NE.RCFC11_act.OR. &
    793                RCFC12_per.NE.RCFC12_act) THEN
    794       CALL histdef2d(iff,o_rsut4co2)
    795       CALL histdef2d(iff,o_rlut4co2)
    796       CALL histdef2d(iff,o_rsutcs4co2)
    797       CALL histdef2d(iff,o_rlutcs4co2)
    798       CALL histdef3d(iff,o_rsu4co2)
    799       CALL histdef3d(iff,o_rlu4co2)
    800       CALL histdef3d(iff,o_rsucs4co2)
    801       CALL histdef3d(iff,o_rlucs4co2)
    802       CALL histdef3d(iff,o_rsd4co2)
    803       CALL histdef3d(iff,o_rld4co2)
    804       CALL histdef3d(iff,o_rsdcs4co2)
    805       CALL histdef3d(iff,o_rldcs4co2)
    806 
    807     ENDIF
    808 
     376          else
     377             CALL histvert(nid_files(iff), "plev", "pressure", "Pa", &
     378               levmax(iff) - levmin(iff) + 1, &
     379              rlevSTD(levmin(iff):levmax(iff)), nvertm(iff), "down")
     380          endif
     381#endif
    809382
    810383      IF (nqtot>=3) THEN
    811384            DO iq=3,nqtot 
    812385            iiq=niadv(iq)
    813             o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1, 10 /),tname(iiq),'Tracer '//ttext(iiq), "-",&
    814                   (/ '', '', '', '', '', '' /))
    815             CALL histdef3d(iff, o_trac(iq-2))
    816             o_trac_cum(iq-2) = ctrl_out((/ 3, 4, 10, 10, 10, 10 /),'cum'//tname(iiq),&
    817                   'Cumulated tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /))
    818             CALL histdef2d(iff, o_trac_cum(iq-2))
     386            o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1, 10, 11, 11, 11 /), &
     387                           tname(iiq),'Tracer '//ttext(iiq), "-",  &
     388                           (/ '', '', '', '', '', '', '', '', '' /))
     389
     390            o_dtr_vdf(iq-2) = ctrl_out((/ 5, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     391                              'd'//trim(tname(iq))//'_vdf',  &
     392                              'Tendance tracer '//ttext(iiq), "-" , &
     393                              (/ '', '', '', '', '', '', '', '', '' /))
     394
     395            o_dtr_the(iq-2) = ctrl_out((/ 5, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     396                              'd'//trim(tname(iq))//'_the', &
     397                              'Tendance tracer '//ttext(iiq), "-", &
     398                              (/ '', '', '', '', '', '', '', '', '' /))
     399
     400            o_dtr_con(iq-2) = ctrl_out((/ 5, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     401                              'd'//trim(tname(iq))//'_con', &
     402                              'Tendance tracer '//ttext(iiq), "-", &
     403                              (/ '', '', '', '', '', '', '', '', '' /))
     404
     405            o_dtr_lessi_impa(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     406                                     'd'//trim(tname(iq))//'_lessi_impa', &
     407                                     'Tendance tracer '//ttext(iiq), "-", &
     408                                     (/ '', '', '', '', '', '', '', '', '' /))
     409
     410            o_dtr_lessi_nucl(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     411                                     'd'//trim(tname(iq))//'_lessi_nucl', &
     412                                     'Tendance tracer '//ttext(iiq), "-", &
     413                                     (/ '', '', '', '', '', '', '', '', '' /))
     414
     415            o_dtr_insc(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     416                               'd'//trim(tname(iq))//'_insc', &
     417                               'Tendance tracer '//ttext(iiq), "-", &
     418                               (/ '', '', '', '', '', '', '', '', '' /))
     419
     420            o_dtr_bcscav(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     421                                 'd'//trim(tname(iq))//'_bcscav', &
     422                                 'Tendance tracer '//ttext(iiq), "-", &
     423                                 (/ '', '', '', '', '', '', '', '', '' /))
     424
     425            o_dtr_evapls(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     426                                 'd'//trim(tname(iq))//'_evapls', &
     427                                 'Tendance tracer '//ttext(iiq), "-", &
     428                                 (/ '', '', '', '', '', '', '', '', '' /))
     429
     430            o_dtr_ls(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     431                             'd'//trim(tname(iq))//'_ls', &
     432                             'Tendance tracer '//ttext(iiq), "-", &
     433                             (/ '', '', '', '', '', '', '', '', '' /))
     434
     435            o_dtr_trsp(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     436                               'd'//trim(tname(iq))//'_trsp', &
     437                               'Tendance tracer '//ttext(iiq), "-", &
     438                               (/ '', '', '', '', '', '', '', '', '' /))
     439
     440            o_dtr_sscav(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     441                                'd'//trim(tname(iq))//'_sscav', &
     442                                'Tendance tracer '//ttext(iiq), "-", &
     443                                (/ '', '', '', '', '', '', '', '', '' /))
     444
     445            o_dtr_sat(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     446                               'd'//trim(tname(iq))//'_sat', &
     447                               'Tendance tracer '//ttext(iiq), "-", &
     448                               (/ '', '', '', '', '', '', '', '', '' /))
     449
     450            o_dtr_uscav(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     451                                'd'//trim(tname(iq))//'_uscav', &
     452                                'Tendance tracer '//ttext(iiq), "-", &
     453                                 (/ '', '', '', '', '', '', '', '', '' /))
     454
     455            o_dtr_dry(iq-2) = ctrl_out((/ 7, 7, 7, 7, 10, 10, 11, 11, 11 /), &
     456                              'cum'//'d'//trim(tname(iq))//'_dry', &
     457                              'tracer tendency dry deposition'//ttext(iiq), "-", &
     458                              (/ '', '', '', '', '', '', '', '', '' /))
     459
     460            o_trac_cum(iq-2) = ctrl_out((/ 3, 4, 10, 10, 10, 10, 11, 11, 11 /), &
     461                               'cum'//tname(iiq),&
     462                               'Cumulated tracer '//ttext(iiq), "-", &
     463                               (/ '', '', '', '', '', '', '', '', '' /))
    819464            ENDDO
    820465      ENDIF
    821 
    822       CALL histend(nid_files(iff))
    823 
    824       ndex2d = 0
    825       ndex3d = 0
    826466
    827467    ENDIF ! clef_files
     
    837477    ecrit_LES = ecrit_files(5)
    838478    ecrit_ins = ecrit_files(6)
     479    freq_outNMC(1) = ecrit_files(7)*86400.
     480    freq_outNMC(2) = ecrit_files(8)*86400.
     481    freq_outNMC(3) = ecrit_files(9)*86400.
    839482
    840483    WRITE(lunout,*)'swaero_diag=',swaero_diag
     
    842485  end SUBROUTINE phys_output_open
    843486
    844   SUBROUTINE histdef2d_old (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
    845 
    846     USE ioipsl
    847     USE dimphy
    848     USE mod_phys_lmdz_para
    849     USE iophy
    850 
    851     IMPLICIT NONE
    852 
    853     INCLUDE "dimensions.h"
    854     INCLUDE "temps.h"
    855     INCLUDE "clesphys.h"
    856 
    857     INTEGER                          :: iff
    858     LOGICAL                          :: lpoint
    859     INTEGER, DIMENSION(nfiles)       :: flag_var
    860     CHARACTER(LEN=20)                 :: nomvar
    861     CHARACTER(LEN=*)                 :: titrevar
    862     CHARACTER(LEN=*)                 :: unitvar
    863 
    864     REAL zstophym
    865 
    866     IF (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') THEN
    867        zstophym=zoutm(iff)
    868     ELSE
    869        zstophym=zdtime
    870     ENDIF
    871 
    872     ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
    873     CALL conf_physoutputs(nomvar,flag_var)
    874 
    875     IF(.NOT.lpoint) THEN 
    876        IF ( flag_var(iff)<=lev_files(iff) ) THEN
    877           CALL histdef (nid_files(iff),nomvar,titrevar,unitvar, &
    878                iim,jj_nb,nhorim(iff), 1,1,1, -99, 32, &
    879                type_ecri(iff), zstophym,zoutm(iff))               
    880        ENDIF
    881     ELSE
    882        IF ( flag_var(iff)<=lev_files(iff) ) THEN
    883           CALL histdef (nid_files(iff),nomvar,titrevar,unitvar, &
    884                npstn,1,nhorim(iff), 1,1,1, -99, 32, &
    885                type_ecri(iff), zstophym,zoutm(iff))               
    886        ENDIF
    887     ENDIF
    888 
    889     ! Set swaero_diag=true if at least one of the concerned variables are defined
    890     IF (nomvar=='topswad' .OR. nomvar=='topswai' .OR. nomvar=='solswad' .OR. nomvar=='solswai' ) THEN
    891        IF  ( flag_var(iff)<=lev_files(iff) ) THEN
    892           swaero_diag=.TRUE.
    893        END IF
    894     END IF
    895   END SUBROUTINE histdef2d_old
    896 
    897   SUBROUTINE histdef2d (iff,var)
    898 
    899     USE ioipsl
    900     USE dimphy
    901     USE mod_phys_lmdz_para
    902     USE iophy
    903 
    904     IMPLICIT NONE
    905 
    906     INCLUDE "dimensions.h"
    907     INCLUDE "temps.h"
    908     INCLUDE "clesphys.h"
    909 
    910     INTEGER                          :: iff
    911     TYPE(ctrl_out)                   :: var
    912 
    913     REAL zstophym
    914     CHARACTER(LEN=20) :: typeecrit
    915 
    916     ! ug On récupère le type écrit de la structure:
    917     !       Assez moche, à refaire si meilleure méthode...
    918     IF (INDEX(var%type_ecrit(iff), "once") > 0) THEN
    919        typeecrit = 'once'
    920     ELSE IF(INDEX(var%type_ecrit(iff), "t_min") > 0) THEN
    921        typeecrit = 't_min(X)'
    922     ELSE IF(INDEX(var%type_ecrit(iff), "t_max") > 0) THEN
    923        typeecrit = 't_max(X)'
    924     ELSE IF(INDEX(var%type_ecrit(iff), "inst") > 0) THEN
    925        typeecrit = 'inst(X)'
    926     ELSE
    927        typeecrit = type_ecri_files(iff)
    928     ENDIF
    929 
    930     IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN
    931        zstophym=zoutm(iff)
    932     ELSE
    933        zstophym=zdtime
    934     ENDIF
    935 
    936     ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
    937     CALL conf_physoutputs(var%name, var%flag)
    938 
    939     IF(.NOT.clef_stations(iff)) THEN 
    940        IF ( var%flag(iff)<=lev_files(iff) ) THEN
    941           CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
    942                iim,jj_nb,nhorim(iff), 1,1,1, -99, 32, &
    943                typeecrit, zstophym,zoutm(iff))               
    944        ENDIF
    945     ELSE
    946        IF ( var%flag(iff)<=lev_files(iff)) THEN
    947           CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
    948                npstn,1,nhorim(iff), 1,1,1, -99, 32, &
    949                typeecrit, zstophym,zoutm(iff))               
    950        ENDIF
    951     ENDIF
    952 
    953     ! Set swaero_diag=true if at least one of the concerned variables are defined
    954     IF (var%name=='topswad' .OR. var%name=='topswai' .OR. var%name=='solswad' .OR. var%name=='solswai' ) THEN
    955        IF  ( var%flag(iff)<=lev_files(iff) ) THEN
    956           swaero_diag=.TRUE.
    957        END IF
    958     END IF
    959   END SUBROUTINE histdef2d
    960 
    961   SUBROUTINE histdef3d_old (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
    962 
    963     USE ioipsl
    964     USE dimphy
    965     USE mod_phys_lmdz_para
    966     USE iophy
    967 
    968     IMPLICIT NONE
    969 
    970     INCLUDE "dimensions.h"
    971     INCLUDE "temps.h"
    972 !    INCLUDE "indicesol.h"
    973     INCLUDE "clesphys.h"
    974 
    975     INTEGER                          :: iff
    976     LOGICAL                          :: lpoint
    977     INTEGER, DIMENSION(nfiles)       :: flag_var
    978     CHARACTER(LEN=20)                 :: nomvar
    979     CHARACTER(LEN=*)                 :: titrevar
    980     CHARACTER(LEN=*)                 :: unitvar
    981 
    982     REAL zstophym
    983 
    984     ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
    985     CALL conf_physoutputs(nomvar,flag_var)
    986 
    987     IF (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') THEN
    988        zstophym=zoutm(iff)
    989     ELSE
    990        zstophym=zdtime
    991     ENDIF
    992 
    993     IF(.NOT.lpoint) THEN
    994        IF ( flag_var(iff)<=lev_files(iff) ) THEN
    995           CALL histdef (nid_files(iff), nomvar, titrevar, unitvar, &
    996                iim, jj_nb, nhorim(iff), klev, levmin(iff), &
    997                levmax(iff)-levmin(iff)+1, nvertm(iff), 32, type_ecri(iff), &
    998                zstophym, zoutm(iff))
    999        ENDIF
    1000     ELSE
    1001        IF ( flag_var(iff)<=lev_files(iff) ) THEN
    1002           CALL histdef (nid_files(iff), nomvar, titrevar, unitvar, &
    1003                npstn,1,nhorim(iff), klev, levmin(iff), &
    1004                levmax(iff)-levmin(iff)+1, nvertm(iff), 32, &
    1005                type_ecri(iff), zstophym,zoutm(iff))
    1006        ENDIF
    1007     ENDIF
    1008   END SUBROUTINE histdef3d_old
    1009 
    1010   SUBROUTINE histdef3d (iff,var)
    1011 
    1012     USE ioipsl
    1013     USE dimphy
    1014     USE mod_phys_lmdz_para
    1015     USE iophy
    1016 
    1017     IMPLICIT NONE
    1018 
    1019     INCLUDE "dimensions.h"
    1020     INCLUDE "temps.h"
    1021     INCLUDE "clesphys.h"
    1022 
    1023     INTEGER                          :: iff
    1024     TYPE(ctrl_out)                   :: var
    1025 
    1026     REAL zstophym
    1027     CHARACTER(LEN=20) :: typeecrit
    1028 
    1029     ! ug On récupère le type écrit de la structure:
    1030     !       Assez moche, à refaire si meilleure méthode...
    1031     IF (INDEX(var%type_ecrit(iff), "once") > 0) THEN
    1032        typeecrit = 'once'
    1033     ELSE IF(INDEX(var%type_ecrit(iff), "t_min") > 0) THEN
    1034        typeecrit = 't_min(X)'
    1035     ELSE IF(INDEX(var%type_ecrit(iff), "t_max") > 0) THEN
    1036        typeecrit = 't_max(X)'
    1037     ELSE IF(INDEX(var%type_ecrit(iff), "inst") > 0) THEN
    1038        typeecrit = 'inst(X)'
    1039     ELSE
    1040        typeecrit = type_ecri_files(iff)
    1041     ENDIF
    1042 
    1043 
    1044     ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
    1045     CALL conf_physoutputs(var%name,var%flag)
    1046 
    1047     IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN
    1048        zstophym=zoutm(iff)
    1049     ELSE
    1050        zstophym=zdtime
    1051     ENDIF
    1052 
    1053     IF(.NOT.clef_stations(iff)) THEN
    1054        IF ( var%flag(iff)<=lev_files(iff) ) THEN
    1055           CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
    1056                iim, jj_nb, nhorim(iff), klev, levmin(iff), &
    1057                levmax(iff)-levmin(iff)+1, nvertm(iff), 32, typeecrit, &
    1058                zstophym, zoutm(iff))
    1059        ENDIF
    1060     ELSE
    1061        IF ( var%flag(iff)<=lev_files(iff)) THEN
    1062           CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
    1063                npstn,1,nhorim(iff), klev, levmin(iff), &
    1064                levmax(iff)-levmin(iff)+1, nvertm(iff), 32, &
    1065                typeecrit, zstophym,zoutm(iff))
    1066        ENDIF
    1067     ENDIF
    1068   END SUBROUTINE histdef3d
    1069 
    1070   SUBROUTINE conf_physoutputs(nam_var,flag_var)
    1071 !!! Lecture des noms et niveau de sortie des variables dans output.def
    1072     !   en utilisant les routines getin de IOIPSL 
    1073     use ioipsl
    1074 
    1075     IMPLICIT NONE
    1076 
    1077     include 'iniprint.h'
    1078 
    1079     CHARACTER(LEN=20)                :: nam_var
    1080     INTEGER, DIMENSION(nfiles)      :: flag_var
    1081 
    1082     IF(prt_level>10) WRITE(lunout,*)'Avant getin: nam_var flag_var ',nam_var,flag_var(:)
    1083     CALL getin('flag_'//nam_var,flag_var)
    1084     CALL getin('name_'//nam_var,nam_var)
    1085     IF(prt_level>10) WRITE(lunout,*)'Apres getin: nam_var flag_var ',nam_var,flag_var(:)
    1086 
    1087   END SUBROUTINE conf_physoutputs
     487
    1088488
    1089489  SUBROUTINE convers_timesteps(str,dtime,timestep)
  • LMDZ5/branches/testing/libf/phylmd/phys_output_var_mod.F90

    r1795 r1864  
    2525
    2626! ug Plein de variables venues de phys_output_mod
    27       INTEGER, PARAMETER                           :: nfiles = 6
     27      INTEGER, PARAMETER                           :: nfiles = 9
    2828      LOGICAL, DIMENSION(nfiles), SAVE             :: clef_files
    2929      LOGICAL, DIMENSION(nfiles), SAVE             :: clef_stations
     
    4141      CHARACTER(LEN=20), DIMENSION(nfiles), SAVE  :: type_ecri_files, phys_out_filetypes
    4242!$OMP THREADPRIVATE(type_ecri_files, phys_out_filetypes)
     43    CHARACTER(LEN=20), DIMENSION(nfiles), SAVE  :: phys_out_filenames
     44!$OMP THREADPRIVATE(phys_out_filenames)
    4345
    4446 ! swaero_diag : flag indicates if it is necessary to do calculation for some aerosol diagnostics
     
    4951      INTEGER, SAVE:: levmax(nfiles)
    5052!$OMP THREADPRIVATE(levmin, levmax)
     53
     54      REAL, SAVE                :: zdtime_moy
     55!$OMP THREADPRIVATE(zdtime_moy)
     56
     57      LOGICAL, SAVE :: vars_defined = .FALSE. ! ug PAS THREADPRIVATE ET C'EST NORMAL
    5158
    5259  TYPE ctrl_out
  • LMDZ5/branches/testing/libf/phylmd/phys_state_var_mod.F90

    r1795 r1864  
    6868      REAL, ALLOCATABLE, SAVE :: zmax0(:), f0(:) !
    6969!$OMP THREADPRIVATE(zmax0,f0)
    70       REAL, ALLOCATABLE, SAVE :: ema_work1(:,:), ema_work2(:,:)
    71 !$OMP THREADPRIVATE(ema_work1,ema_work2)
     70      REAL, ALLOCATABLE, SAVE :: sig1(:,:), w01(:,:)
     71!$OMP THREADPRIVATE(sig1,w01)
    7272      REAL, ALLOCATABLE, SAVE :: entr_therm(:,:), fm_therm(:,:)
    7373!$OMP THREADPRIVATE(entr_therm,fm_therm)
     
    332332      REAL,SAVE,ALLOCATABLE :: newsst(:)
    333333!$OMP THREADPRIVATE(newsst)
    334       REAL,SAVE,ALLOCATABLE :: ustar(:,:),u10m(:,:), v10m(:,:)
    335 !$OMP THREADPRIVATE(ustar,u10m,v10m)
     334      REAL,SAVE,ALLOCATABLE :: ustar(:,:),u10m(:,:), v10m(:,:),wstar(:,:)
     335!$OMP THREADPRIVATE(ustar,u10m,v10m,wstar)
    336336!
    337337! ok_ade=T -ADE=topswad-topsw
     
    400400      ALLOCATE(coefm(klon,klev+1,nbsrf+1))
    401401      ALLOCATE(zmax0(klon), f0(klon))
    402       ALLOCATE(ema_work1(klon,klev), ema_work2(klon,klev))
     402      ALLOCATE(sig1(klon,klev), w01(klon,klev))
    403403      ALLOCATE(entr_therm(klon,klev), fm_therm(klon,klev+1))
    404404      ALLOCATE(detr_therm(klon,klev))
     
    508508      ALLOCATE(rlonPOS(klon))
    509509      ALLOCATE(newsst(klon))
    510       ALLOCATE(ustar(klon,nbsrf),u10m(klon,nbsrf), v10m(klon,nbsrf))
     510      ALLOCATE(ustar(klon,nbsrf),u10m(klon,nbsrf), v10m(klon,nbsrf),wstar(klon,nbsrf+1))
    511511      ALLOCATE(topswad(klon), solswad(klon))
    512512      ALLOCATE(topswai(klon), solswai(klon))
     
    536536      deallocate(ratqs, pbl_tke,coefh,coefm)
    537537      deallocate(zmax0, f0)
    538       deallocate(ema_work1, ema_work2)
     538      deallocate(sig1, w01)
    539539      deallocate(entr_therm, fm_therm)
    540540      deallocate(detr_therm)
     
    619619      deallocate(rlonPOS)
    620620      deallocate(newsst)
    621       deallocate(ustar,u10m, v10m)
     621      deallocate(ustar,u10m, v10m,wstar)
    622622      deallocate(topswad, solswad)
    623623      deallocate(topswai, solswai)
  • LMDZ5/branches/testing/libf/phylmd/physiq.F

    r1795 r1864  
    2929      USE phys_state_var_mod ! Variables sauvegardees de la physique
    3030      USE phys_output_var_mod ! Variables pour les ecritures des sorties
     31      USE phys_output_write_mod
    3132      USE fonte_neige_mod, ONLY  : fonte_neige_get_vars
    3233      USE phys_output_mod
     
    4445      use conf_phys_m, only: conf_phys
    4546      use radlwsw_m, only: radlwsw
     47      use phyaqua_mod, only: zenang_an
    4648      USE control_mod
    4749#ifdef REPROBUS
     
    4951#endif
    5052      USE indice_sol_mod
     53      USE phytrac_mod, ONLY : phytrac
    5154
    5255!IM stations CFMIP
     
    173176      PARAMETER (ok_region=.FALSE.)
    174177c======================================================================
    175       real weak_inversion(klon),dthmin(klon)
    176178      real seuil_inversion
    177179      save seuil_inversion
     
    184186      REAL zz,znum,zden
    185187      REAL wmax_th(klon)
    186       REAL zmax_th(klon)
    187188      REAL tau_overturning_th(klon)
    188189
     
    220221      REAL u(klon,klev)
    221222      REAL v(klon,klev)
    222       REAL t(klon,klev),theta(klon,klev),thetal(klon,klev)
     223      REAL t(klon,klev),thetal(klon,klev)
    223224c thetal: ligne suivante a decommenter si vous avez les fichiers     MPL 20130625
    224225c fth_fonctions.F90 et parkind1.F90
     
    227228      REAL qx(klon,klev,nqtot)
    228229      REAL flxmass_w(klon,klev)
    229       REAL omega(klon,klev) ! vitesse verticale en Pa/s
    230230      REAL d_u(klon,klev)
    231231      REAL d_v(klon,klev)
     
    242242      real clw(klon,klev),elij(klon,klev,klev)
    243243      real epmlmMm(klon,klev,klev),eplaMm(klon,klev)
    244       real wdtrainA(klon,klev),wdtrainM(klon,klev)
    245244! RomP <<<
    246245!IM definition dynamique o_trac dans phys_output_open
     
    281280c
    282281c
    283 c prw: precipitable water
    284       real prw(klon)
    285282
    286283      REAL convliq(klon,klev)  ! eau liquide nuageuse convective
     
    295292c flwp, fiwp = Liquid Water Path & Ice Water Path (kg/m2)
    296293c flwc, fiwc = Liquid Water Content & Ice Water Content (kg/kg)
    297       REAL flwp(klon), fiwp(klon)
    298       REAL flwc(klon,klev), fiwc(klon,klev)
    299294      REAL flwp_c(klon), fiwp_c(klon)
    300295      REAL flwc_c(klon,klev), fiwc_c(klon,klev)
     
    302297      REAL flwc_s(klon,klev), fiwc_s(klon,klev)
    303298
    304       REAL evap_pot(klon,nbsrf)
    305299
    306300cIM ISCCP simulator v3.4
     
    528522c$OMP THREADPRIVATE(itap)
    529523c
    530       real slp(klon) ! sea level pressure
    531 c
    532       REAL fevap(klon,nbsrf)
    533       REAL fluxlat(klon,nbsrf)
    534 c
    535       REAL qsol(klon)
    536524      REAL,save ::  solarlong0
    537525c$OMP THREADPRIVATE(solarlong0)
     
    544532c
    545533      INTEGER igwd,idx(klon),itest(klon)
    546 c
    547       REAL agesno(klon,nbsrf)
    548534c
    549535c      REAL,allocatable,save :: run_off_lic_0(:)
     
    565551
    566552      REAL mip(klon,klev)  ! mass flux shed by the adiab ascent at each level
    567       REAL Vprecip(klon,klev+1)   ! precipitation vertical profile
    568553c
    569554      REAL wape_prescr, fip_prescr
     
    589574c$OMP THREADPRIVATE(wake_s_min_lsp)
    590575
    591       real ale_wake(klon)
    592       real alp_wake(klon)
    593576
    594577      real ok_wk_lsp(klon)
     
    609592      REAL wake_dtPBL(klon,klev)      ! Wake : differential heating (wake - unpertubed) PBL
    610593      REAL wake_dqPBL(klon,klev)      ! Wake : differential moistening (wake - unpertubed) PBL
    611       REAL wake_omg(klon,klev)        ! Wake : velocity difference (wake - unpertubed)
    612594      REAL wake_ddeltat(klon,klev),wake_ddeltaq(klon,klev)
    613595      REAL wake_dp_deltomg(klon,klev) ! Wake : gradient vertical de wake_omg
     
    615597c
    616598cpourquoi y'a pas de save??
    617       REAL wake_h(klon)               ! Wake : hauteur de la poche froide
    618599c
    619600      INTEGER wake_k(klon)            ! Wake sommet
     
    645626cRR:fin declarations poches froides
    646627c=======================================================================================================
    647 
    648       REAL zw2(klon,klev+1)
    649       REAL fraca(klon,klev+1)       
     628       
    650629      REAL ztv(klon,klev),ztva(klon,klev)
    651630      REAL zpspsk(klon,klev)
     
    665644      real env_tke_max0(klon)                                ! TKE dans l'environnement au LCL
    666645
    667 c---Spectre de thermiques de type 2 au LCL
    668       real n2(klon),s2(klon)
    669       real ale_bl_stat(klon)
    670 
    671646c---D\'eclenchement stochastique
    672647      integer :: tau_trig(klon)
    673       real proba_notrig(klon)
    674       real random_notrig(klon)
    675648
    676649c--------Statistical Boundary Layer Closure: ALP_BL--------
     
    680653      real env_tke_max(klon,klev)                            ! Profil de TKE dans l'environnement
    681654
    682 c---Fermeture statistique
    683       real alp_bl_det(klon)                                     ! ALP d\'terministe du thermique unique
    684       real alp_bl_fluct_m(klon)                                 ! ALP li\'ee aux fluctuations de flux de masse sous-nuageux
    685       real alp_bl_fluct_tke(klon)                               ! ALP li\'ee aux fluctuations d'\'energie cin\'etique sous-nuageuse
    686       real alp_bl_conv(klon)                                    ! ALP li\'ee \`a grande \'echelle
    687       real alp_bl_stat(klon)                                    ! ALP totale
    688655
    689656ccc fin nrlmd le 10/04/2012
     
    697664c Variables locales:
    698665c
    699       REAL cdragh(klon) ! drag coefficient pour T and Q
    700       REAL cdragm(klon) ! drag coefficient pour vent
    701666cAA
    702667cAA  Pour phytrac
    703668      REAL u1(klon)             ! vents dans la premiere couche U
    704669      REAL v1(klon)             ! vents dans la premiere couche V
    705 
    706       REAL zxffonte(klon), zxfqcalving(klon),zxfqfonte(klon)
    707670
    708671c@$$      LOGICAL offline           ! Controle du stockage ds "physique"
     
    713676! RomP >>>
    714677      REAL beta_prec_fisrt(klon,klev) ! taux de conv de l'eau cond (fisrt)
    715       REAL beta_prec(klon,klev)       ! taux de conv de l'eau cond (utilise)
    716678! RomP <<<
    717679      INTEGER       :: iii
     
    722684c
    723685cIM 050204 END
    724       REAL evap(klon), devap(klon) ! evaporation et sa derivee
    725       REAL sens(klon), dsens(klon) ! chaleur sensible et sa derivee
    726 
    727       REAL bils(klon) ! bilan de chaleur au sol
    728 
    729       REAL wfbilo(klon,nbsrf) ! bilan d'eau, pour chaque
    730 C                             ! type de sous-surface et pondere par la fraction
    731       REAL wfbils(klon,nbsrf) ! bilan de chaleur au sol, pour chaque
    732 C                             ! type de sous-surface et pondere par la fraction
    733       REAL slab_wfbils(klon)  ! bilan de chaleur au sol pour le cas de slab, sur les points d'ocean
    734 
    735       REAL fder(klon)         
    736       REAL ve(klon) ! integr. verticale du transport meri. de l'energie
    737       REAL vq(klon) ! integr. verticale du transport meri. de l'eau
    738       REAL ue(klon) ! integr. verticale du transport zonal de l'energie
    739       REAL uq(klon) ! integr. verticale du transport zonal de l'eau
    740 c
    741       REAL frugs(klon,nbsrf)
    742       REAL zxrugs(klon) ! longueur de rugosite
     686      REAL devap(klon) ! evaporation et sa derivee
     687      REAL dsens(klon) ! chaleur sensible et sa derivee
     688
    743689c
    744690c Conditions aux limites
     
    804750      REAL diafra(klon,klev)  ! fraction nuageuse
    805751      REAL cldliq(klon,klev)  ! eau liquide nuageuse
    806       REAL cldfra(klon,klev)  ! fraction nuageuse
    807       REAL cldtau(klon,klev)  ! epaisseur optique
    808       REAL cldemi(klon,klev)  ! emissivite infrarouge
    809752c
    810753CXXX PB
    811754      REAL fluxq(klon,klev, nbsrf)   ! flux turbulent d'humidite
    812       REAL fluxt(klon,klev, nbsrf)   ! flux turbulent de chaleur
    813       REAL fluxu(klon,klev, nbsrf)   ! flux turbulent de vitesse u
    814       REAL fluxv(klon,klev, nbsrf)   ! flux turbulent de vitesse v
    815755c
    816756      REAL zxfluxt(klon, klev)
     
    818758      REAL zxfluxu(klon, klev)
    819759      REAL zxfluxv(klon, klev)
    820 CXXX
    821 c
    822       REAL fsollw(klon, nbsrf)   ! bilan flux IR pour chaque sous surface
    823       REAL fsolsw(klon, nbsrf)   ! flux solaire absorb. pour chaque sous surface
     760
    824761c Le rayonnement n'est pas calcule tous les pas, il faut donc
    825762c                      sauvegarder les sorties du rayonnement
     
    834771      REAL conv_q(klon,klev) ! convergence de l'humidite (kg/kg/s)
    835772      REAL conv_t(klon,klev) ! convergence de la temperature(K/s)
    836 c
    837       REAL cldl(klon),cldm(klon),cldh(klon) !nuages bas, moyen et haut
    838       REAL cldt(klon),cldq(klon) !nuage total, eau liquide integree
    839 c
    840       REAL zxtsol(klon), zxqsurf(klon), zxsnow(klon), zxfluxlat(klon)
     773
     774c
     775      REAL zxsnow(klon)
    841776      REAL zxsnow_dummy(klon)
    842777c
     
    857792      REAL t_coup
    858793      PARAMETER (t_coup=234.0)
    859 c
    860       REAL zphi(klon,klev)
     794
    861795cym A voir plus tard !!
    862796cym      REAL zx_relief(iim,jjmp1)
     
    864798c
    865799c Grandeurs de sorties
    866       REAL s_pblh(klon), s_lcl(klon), s_capCL(klon)
    867       REAL s_oliqCL(klon), s_cteiCL(klon), s_pblt(klon)
    868       REAL s_therm(klon), s_trmb1(klon), s_trmb2(klon)
     800      REAL s_capCL(klon)
     801      REAL s_oliqCL(klon), s_cteiCL(klon)
     802      REAL s_trmb1(klon), s_trmb2(klon)
    869803      REAL s_trmb3(klon)
    870804cKE43
    871805c Variables locales pour la convection de K. Emanuel (sb):
    872 c
    873       REAL upwd(klon,klev)      ! saturated updraft mass flux
    874       REAL dnwd(klon,klev)      ! saturated downdraft mass flux
    875       REAL dnwd0(klon,klev)     ! unsaturated downdraft mass flux
     806
    876807      REAL tvp(klon,klev)       ! virtual temp of lifted parcel
    877       REAL plcl(klon)           ! Lifting Condensation Level
    878       REAL plfc(klon)           ! Level of Free Convection
    879       REAL wbeff(klon)          ! saturated updraft velocity at LFC
    880808      CHARACTER*40 capemaxcels  !max(CAPE)
    881809
     
    902830c eva: evaporation de l'eau liquide nuageuse
    903831c vdf: couche limite (Vertical DiFfusion)
    904       REAL rneb(klon,klev)
    905832
    906833! tendance nulles
     
    914841cIM 081204 END
    915842c
    916       REAL pmfu(klon,klev), pmfd(klon,klev)
    917843      REAL pen_u(klon,klev), pen_d(klon,klev)
    918844      REAL pde_u(klon,klev), pde_d(klon,klev)
    919845      INTEGER kcbot(klon), kctop(klon), kdtop(klon)
    920       REAL pmflxr(klon,klev+1), pmflxs(klon,klev+1)
    921       REAL prfl(klon,klev+1), psfl(klon,klev+1)
    922 c
    923       REAL rain_lsc(klon)
    924       REAL snow_lsc(klon)
    925846c
    926847      REAL ratqsc(klon,klev)
     
    935856      logical ok_newmicro
    936857      save ok_newmicro
    937       real ref_liq(klon,klev), ref_ice(klon,klev)
    938858c$OMP THREADPRIVATE(ok_newmicro)
    939859      save fact_cldcon,facttemps
     
    973893c Variables locales pour effectuer les appels en serie
    974894c
    975       REAL zx_rh(klon,klev)
    976895cIM RH a 2m (la surface)
    977       REAL rh2m(klon), qsat2m(klon)
    978       REAL tpot(klon), tpote(klon)
    979896      REAL Lheat
    980897
     
    10911008      REAL ZRCPD
    10921009c-jld ec_conser
    1093       REAL t2m(klon,nbsrf)  ! temperature a 2m
    10941010      REAL q2m(klon,nbsrf)  ! humidite a 2m
    10951011
    10961012cIM: t2m, q2m, ustar, u10m, v10m et t2mincels, t2maxcels
    1097       REAL zt2m(klon), zq2m(klon)             !temp., hum. 2m moyenne s/ 1 maille
    1098       REAL zustar(klon),zu10m(klon), zv10m(klon)  ! u* et vents a 10m moyennes s/1 maille
    10991013      CHARACTER*40 t2mincels, t2maxcels       !t2m min., t2m max
    11001014      CHARACTER*40 tinst, tave, typeval
    11011015      REAL cldtaupi(klon,klev)  ! Cloud optical thickness for pre-industrial (pi) aerosols
    11021016
    1103       REAL re(klon, klev)       ! Cloud droplet effective radius
    1104       REAL fl(klon, klev)  ! denominator of re
    11051017
    11061018      REAL re_top(klon), fl_top(klon) ! CDR at top of liquid water clouds
     
    12281140! Utilise notamment en 1D mais peut etre active egalement en 3D
    12291141! en imposant la valeur de igout.
    1230 c======================================================================
    1231 
     1142c======================================================================d
    12321143      if (prt_level.ge.1) then
    12331144          igout=klon/2+1/klon
     
    12501161
    12511162c======================================================================
    1252 
    1253 cym => necessaire pour iflag_con != 2   
    1254       pmfd(:,:) = 0.
    1255       pen_u(:,:) = 0.
    1256       pen_d(:,:) = 0.
    1257       pde_d(:,:) = 0.
    1258       pde_u(:,:) = 0.
    1259       aam=0.
    1260 
    1261       torsfc=0.
    1262       forall (k=1: llm) zmasse(:, k) = (paprs(:, k)-paprs(:, k+1)) / rg
    12631163
    12641164      if (first) then
     
    13011201
    13021202      endif  ! first
     1203
     1204cym => necessaire pour iflag_con != 2   
     1205      pmfd(:,:) = 0.
     1206      pen_u(:,:) = 0.
     1207      pen_d(:,:) = 0.
     1208      pde_d(:,:) = 0.
     1209      pde_u(:,:) = 0.
     1210      aam=0.
     1211
     1212      torsfc=0.
     1213      forall (k=1: llm) zmasse(:, k) = (paprs(:, k)-paprs(:, k+1)) / rg
     1214
     1215
    13031216
    13041217       modname = 'physiq'
     
    16001513       call phys_output_open(rlon,rlat,nCFMIP,tabijGCM,
    16011514     &                       iGCM,jGCM,lonGCM,latGCM,
    1602      &                       jjmp1,nlevSTD,clevSTD,
     1515     &                       jjmp1,nlevSTD,clevSTD,rlevSTD,
    16031516     &                       nbteta, ctetaSTD, dtime,ok_veget,
    16041517     &                       type_ocean,iflag_pbl,ok_mensuel,ok_journe,
     
    16061519     &                       read_climoz, phys_out_filestations,
    16071520     &                       new_aod, aerosol_couple,
    1608      &                       flag_aerosol_strat )
     1521     &                       flag_aerosol_strat, pdtphys, paprs, pphis,
     1522     &                       pplay, lmax_th, ptconv, ptconvth, ivap,
     1523     &                       d_t, qx, d_qx, zmasse, ok_sync)
    16091524c$OMP END MASTER
    16101525c$OMP BARRIER
    16111526
     1527#undef histISCCP
    16121528#ifdef histISCCP
    16131529#include "ini_histISCCP.h"
    1614 #endif
    1615 
    1616 #ifdef histNMC
    1617 #include "ini_histhfNMC.h"
    1618 #include "ini_histdayNMC.h"
    1619 #include "ini_histmthNMC.h"
    16201530#endif
    16211531
     
    19691879      DO i = 1, klon
    19701880         zlvdcp=RLVTT/RCPD/(1.0+RVTMP2*q_seri(i,k))
    1971 c        zlsdcp=RLSTT/RCPD/(1.0+RVTMP2*q_seri(i,k))
    1972          zlsdcp=RLVTT/RCPD/(1.0+RVTMP2*q_seri(i,k))
     1881cjyg<
     1882c      Attention : Arnaud a propose des formules completement differentes
     1883c                  A verifier !!!
     1884         zlsdcp=RLSTT/RCPD/(1.0+RVTMP2*q_seri(i,k))
     1885         IF (iflag_ice_thermo .EQ. 0) THEN
     1886           zlsdcp=zlvdcp
     1887         ENDIF
     1888c>jyg
     1889
    19731890         zdelta = MAX(0.,SIGN(1.,RTT-t_seri(i,k)))
    19741891         zb = MAX(0.0,ql_seri(i,k))
     
    20832000     e     t_seri,    q_seri,    u_seri,  v_seri,   
    20842001     e     pplay,     paprs,     pctsrf,           
    2085      +     ftsol,     falb1,     falb2,   ustar, u10m,   v10m,
     2002     +     ftsol,falb1,falb2,ustar,u10m,v10m,wstar,
    20862003     s     sollwdown, cdragh,    cdragm,  u1,    v1,
    20872004     s     albsol1,   albsol2,   sens,    evap, 
     
    23542271                nbtr_tmp=nbtr
    23552272             END IF
    2356           CALL concvl (iflag_con,iflag_clos,
     2273cjyg   iflag_con est dans clesphys
     2274cc          CALL concvl (iflag_con,iflag_clos,
     2275          CALL concvl (iflag_clos,
    23572276     .        dtime,paprs,pplay,t_undi,q_undi,
    23582277     .        t_wake,q_wake,wake_s,
    23592278     .        u_seri,v_seri,tr_seri,nbtr_tmp,
    23602279     .        ALE,ALP,
    2361      .        ema_work1,ema_work2,
     2280     .        sig1,w01,
    23622281     .        d_t_con,d_q_con,d_u_con,d_v_con,d_tr,
    23632282     .        rain_con, snow_con, ibas_con, itop_con, sigd,
     
    23922311     .        paprs,pplay,t_seri,q_seri,
    23932312     .        u_seri,v_seri,tr_seri,ntra,
    2394      .        ema_work1,ema_work2,
     2313     .        sig1,w01,
    23952314     .        d_t_con,d_q_con,d_u_con,d_v_con,d_tr,
    23962315     .        rain_con, snow_con, ibas_con, itop_con,
     
    28562775     .           frac_impa, frac_nucl, beta_prec_fisrt,
    28572776     .           prfl, psfl, rhcl,
    2858      .           zqasc, fraca,ztv,zpspsk,ztla,zthl,iflag_cldcon )
     2777     .           zqasc, fraca,ztv,zpspsk,ztla,zthl,iflag_cldcon,
     2778     .           iflag_ice_thermo)
    28592779
    28602780      WHERE (rain_lsc < 0) rain_lsc = 0.
     
    37293649     I     paprs,    pplay,     pmfu,     pmfd,
    37303650     I     pen_u,    pde_u,     pen_d,    pde_d,
    3731      I     cdragh,   coefh(:,:,is_ave),     fm_therm, entr_therm,
     3651     I     cdragh,   coefh(:,:,is_ave),   fm_therm, entr_therm,
    37323652     I     u1,       v1,        ftsol,    pctsrf,
    3733      I     ustar,     u10m,      v10m,
     3653     I     zustar,   zu10m,     zv10m,
     3654     I     wstar(:,is_ave),    ale_bl,         ale_wake,
    37343655     I     rlat,     rlon,
    37353656     I     frac_impa,frac_nucl, beta_prec_fisrt,beta_prec,
     
    40313952      endif
    40323953
    4033 #include "phys_output_write_new.h"
     3954
     3955!On effectue les sorties:
     3956
     3957      CALL phys_output_write(itap, pdtphys, paprs, pphis,               &
     3958     &                  pplay, lmax_th, aerosol_couple,                 &
     3959     &                  ok_ade, ok_aie, ivap, new_aod, ok_sync,         &
     3960     &                  ptconv, read_climoz, clevSTD, freq_moyNMC,      &
     3961     &                  ptconvth, d_t, qx, d_qx, zmasse,                &
     3962     &                  flag_aerosol_strat)
    40343963
    40353964
     
    40383967#ifdef histISCCP
    40393968#include "write_histISCCP.h"
    4040 #endif
    4041 
    4042 #ifdef histNMC
    4043 #include "write_histhfNMC.h"
    4044 #include "write_histdayNMC.h"
    4045 #include "write_histmthNMC.h"
    40463969#endif
    40473970
  • LMDZ5/branches/testing/libf/phylmd/radlwsw_m.F90

    r1795 r1864  
    334334!===== iflag_rrtm ================================================
    335335!     
     336    print*,'iflag_rrtm = ', iflag_rrtm
    336337    IF (iflag_rrtm == 0) THEN
    337338       ! Old radiation scheme, used for AR4 runs
  • LMDZ5/branches/testing/libf/phylmd/readaerosolstrato.F90

    r1795 r1864  
    3333    integer i, k, band, wave
    3434    integer, save :: mth_pre
     35!$OMP THREADPRIVATE(mth_pre)
    3536
    3637    real, allocatable, dimension(:,:), save :: tau_aer_strat
     
    4142    real, allocatable:: tauaerstrat_mois(:, :, :)
    4243    real, allocatable:: tauaerstrat_mois_glo(:, :)
    43     real, allocatable:: tauaerstrat_mois_glo_bands(:,:,:)
    4444
    4545! For NetCDF:
     
    6161    IF (.not.ALLOCATED(tau_aer_strat)) ALLOCATE(tau_aer_strat(klon,klev))
    6262
     63!--only read file if beginning of run or start of new month
     64    IF (debut.OR.mth_cur.NE.mth_pre) THEN
     65
    6366    IF (is_mpi_root) THEN
    64 
    65     IF (debut.OR.mth_cur.NE.mth_pre) THEN
    6667
    6768    IF (nbands.NE.2) THEN
     
    107108    ENDIF
    108109
    109     ALLOCATE(tauaerstrat(n_lon, n_lat, n_lev, n_month))
    110     ALLOCATE(tauaerstrat_mois(n_lon, n_lat, n_lev))
    111     ALLOCATE(tauaerstrat_mois_glo(klon_glo, n_lev))
    112     ALLOCATE(tauaerstrat_mois_glo_bands(klon_glo, n_lev,nbands))
     110    IF (.not.ALLOCATED(tauaerstrat))          ALLOCATE(tauaerstrat(n_lon, n_lat, n_lev, n_month))
     111    IF (.not.ALLOCATED(tauaerstrat_mois))     ALLOCATE(tauaerstrat_mois(n_lon, n_lat, n_lev))
     112    IF (.not.ALLOCATED(tauaerstrat_mois_glo)) ALLOCATE(tauaerstrat_mois_glo(klon_glo, n_lev))
    113113
    114114!--reading stratospheric AOD at 550 nm
     
    128128    CALL grid2dTo1d_glo(tauaerstrat_mois,tauaerstrat_mois_glo)
    129129
     130!    DEALLOCATE(tauaerstrat)
     131!    DEALLOCATE(tauaerstrat_mois)
     132!    DEALLOCATE(tauaerstrat_mois_glo)
     133 
     134    ENDIF !--is_mpi_root
     135
    130136!--scatter on all proc
    131137    CALL scatter(tauaerstrat_mois_glo,tau_aer_strat)
    132138
    133     DEALLOCATE(tauaerstrat)
    134     DEALLOCATE(tauaerstrat_mois)
    135     DEALLOCATE(tauaerstrat_mois_glo)
    136  
     139!--keep memory of previous month
    137140    mth_pre=mth_cur
    138141
    139142    ENDIF !--debut ou nouveau mois
    140143
    141     ENDIF !--is_mpi_root
    142 
    143144!--total vertical aod at the 5 wavelengths
    144145    DO wave=1, nwave
    145146    DO k=1, klev
    146     tausum_aero(:,wave,id_strat)=tausum_aero(:,wave,id_strat)+tau_aer_strat(:,k)*alpha_strat_wave(wave)/alpha_strat_wave(2)
     147    tausum_aero(:,wave,id_STRAT)=tausum_aero(:,wave,id_STRAT)+tau_aer_strat(:,k)*alpha_strat_wave(wave)/alpha_strat_wave(2)
     148!    tausum_aero(:,wave,id_ASBCM)=tausum_aero(:,wave,id_ASBCM)+tau_aer_strat(:,k)*alpha_strat_wave(wave)/alpha_strat_wave(2)
    147149    ENDDO
    148150    ENDDO
  • LMDZ5/branches/testing/libf/phylmd/traclmdz_mod.F90

    r1795 r1864  
    337337  SUBROUTINE traclmdz(nstep, julien, gmtime, pdtphys, t_seri, paprs, pplay, &
    338338       cdragh,  coefh, yu1, yv1, ftsol, pctsrf, xlat, xlon, couchelimite, sh, &
    339        rh, pphi, ustar, zu10m, zv10m, &
     339       rh, pphi, ustar, wstar, ale_bl, ale_wake,  zu10m, zv10m, &
    340340!!          tr_seri, source, solsym, d_tr_cl, zmasse)                      !RomP
    341341          tr_seri, source, solsym, d_tr_cl,d_tr_dec, zmasse)               !RomP
     
    385385    REAL,DIMENSION(klon,klev),INTENT(IN) :: pphi    ! geopotentie
    386386    REAL,DIMENSION(klon),INTENT(IN)      :: ustar   ! ustar (m/s)
     387    REAL,DIMENSION(klon),INTENT(IN)      :: wstar,ale_bl,ale_wake   ! wstar (m/s) and Avail. Lifti. Energ.
    387388    REAL,DIMENSION(klon),INTENT(IN)      :: zu10m   ! vent zonal 10m (m/s)
    388389    REAL,DIMENSION(klon),INTENT(IN)      :: zv10m   ! vent zonal 10m (m/s)
  • LMDZ5/branches/testing/libf/phylmd/write_histrac.h

    r1750 r1864  
    4545
    4646! TD COUCHE-LIMITE
    47       IF (couchelimite) THEN
     47      IF (iflag_vdf_trac>=0) THEN
    4848        CALL histwrite_phy(nid_tra,.FALSE.,"d_tr_cl_"//tname(iiq),itau_w,d_tr_cl(:,:,it))
    4949        CALL histwrite_phy(nid_tra,.FALSE.,"d_tr_dry_"//tname(iiq),itau_w,d_tr_dry(:,it))
  • LMDZ5/branches/testing/makegcm

    r1707 r1864  
    2323set OPTIMI='-C debug -eC '
    2424set OPTIMI=' -ftrace '
    25 set OPT_LINUX="-i4 -O3 -r8 -DNC_DOUBLE"
    26 set OPT_LINUX="-i4 -O3 -r8 -DNC_DOUBLE"
     25set OPT_LINUX="-O3 -fdefault-real-8 -DNC_DOUBLE"
     26set OPT_LINUX="-O3 -fdefault-real-8 -DNC_DOUBLE"
    2727set io=ioipsl
    2828set cosp=false
    2929
    30 set FC_LINUX=g95
    31 set FC_LINUX=g95
    32 #set FC_LINUX=g95
    33 if ( $FC_LINUX == g95 ) then
    34   set OPT_LINUX="-i4 -O3 -r8 -DNC_DOUBLE"
     30set FC_LINUX=gfortran
     31set FC_LINUX=gfortran
     32#set FC_LINUX=gfortran
     33if ( $FC_LINUX == gfortran ) then
     34  set OPT_LINUX="-O3 -fdefault-real-8 -DNC_DOUBLE"
    3535else if ( $FC_LINUX == gfortran ) then
    36   set OPT_LINUX="-i4 -O3 -r8 -DNC_DOUBLE"
    37 #   set OPT_LINUX="-i4 -O3 -r8 -DNC_DOUBLE"
    38   set OPT_LINUX="-i4 -O3 -r8 -DNC_DOUBLE"
     36  set OPT_LINUX="-O3 -fdefault-real-8 -DNC_DOUBLE"
     37#   set OPT_LINUX="-O3 -fdefault-real-8 -DNC_DOUBLE"
     38  set OPT_LINUX="-O3 -fdefault-real-8 -DNC_DOUBLE"
    3939else
    4040# pgf90 options
    41   set OPT_LINUX="-i4 -O3 -r8 -DNC_DOUBLE"
     41  set OPT_LINUX="-O3 -fdefault-real-8 -DNC_DOUBLE"
    4242endif
    4343
     
    5454setenv IOIPSLDIR /tmpdir/fairhead/Aqua/LMDZ20120327.trunk/modipsl/lib
    5555setenv MODIPSLDIR /tmpdir/fairhead/Aqua/LMDZ20120327.trunk/modipsl/lib
    56 setenv NCDFINC /tmpdir/fairhead/Aqua/LMDZ20120327.trunk/netcdf-4.0.1/include
    57 setenv NCDFLIB /tmpdir/fairhead/Aqua/LMDZ20120327.trunk/netcdf-4.0.1/lib
     56setenv NCDFINC /tmpdir/fairhead/Test_HEAD/LMDZ20130808.trunk/netcdf-4.0.1/include
     57setenv NCDFLIB /tmpdir/fairhead/Test_HEAD/LMDZ20130808.trunk/netcdf-4.0.1/lib
    5858
    5959
     
    107107  if ( ! $?NCDFLIB ) then
    108108    echo You must initialize the variable NCDFLIB in your environnement
    109     echo for instance: "setenv NCDFLIB /d3/idelkadi/MODELE_LMDZ/LMDZ20121005.trunk/netcdf-4.0.1/lib
     109    echo for instance: "setenv NCDFLIB /tmpdir/fairhead/Test_HEAD/LMDZ20130808.trunk/netcdf-4.0.1/lib
    110110    exit
    111111  endif
    112112  if ( ! $?NCDFINC ) then
    113113    echo You must initialize the variable NCDFINC in your environnement
    114     echo for instance: "setenv NCDFINC /d3/idelkadi/MODELE_LMDZ/LMDZ20121005.trunk/netcdf-4.0.1/include
     114    echo for instance: "setenv NCDFINC /tmpdir/fairhead/Test_HEAD/LMDZ20130808.trunk/netcdf-4.0.1/include
    115115    exit
    116116  endif
     
    262262else if $LINUX then
    263263#################
    264    if ( $FC_LINUX == pgf90 || $FC_LINUX == g95 || $FC_LINUX == gfortran ) then
     264   if ( $FC_LINUX == pgf90 || $FC_LINUX == gfortran || $FC_LINUX == gfortran ) then
    265265     set optim=" $OPT_LINUX "
    266266     set optim90=" $OPT_LINUX "
     
    519519             set optim90="$optim90"" -g -ffpe-trap=invalid,zero,overflow -fbounds-check -Wall "
    520520             set optimtru90="$optimtru90"" -ffpe-trap=invalid,zero,overflow -g -fbounds-check -Wall "
    521            else if ( $FC_LINUX == 'g95' ) then
     521           else if ( $FC_LINUX == 'gfortran' ) then
    522522             set optim="$optim"" -g -fbounds-check -freal=nan -ftrace=full -Wall "
    523523             set optim90="$optim90"" -g -fbounds-check -freal=nan -ftrace=full -Wall "
     
    581581   set cppflags="$cppflags -DCPP_VEGET"
    582582#   set link_veget=" -lsechiba -lparameters -lstomate  "
    583    set link_veget=" -lsechiba -lparameters -lstomate"
     583   set link_veget=" -lsechiba -lparameters -lstomate -lparallel -lorglob -lorchidee"
    584584   if ( $XNEC || $X8BRODIE || $X6NEC) then
    585585#      set link_veget=" -lsxsechiba -lsxparameters -lsxstomate -lsxorglob -lsxparallel"
     
    841841       set opt_link="$opt_link  -L$MODIPSLDIR $link_veget -L$NCDFLIB -lnetcdf "
    842842     endif
    843    else if ($FC_LINUX == 'g95' || $FC_LINUX == 'gfortran' ) then
     843   else if ($FC_LINUX == 'gfortran' || $FC_LINUX == 'gfortran' ) then
    844844     if ( $io == "ioipsl" ) then
    845        set opt_link="$opt_link -L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdff -lnetcdf -lioipsl -lnetcdff -lnetcdf "
     845       set opt_link="$opt_link -L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB  -lnetcdf -lioipsl -lnetcdf "
    846846     else
    847        set opt_link="$opt_link -L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdff -lnetcdf "
     847       set opt_link="$opt_link -L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf "
    848848     endif
    849849   endif
     
    10151015   set optimtru90=" $optimtru90 -module $libo "
    10161016   set optim90=" $optim90 -module $libo "
    1017  else if ( $FC_LINUX == 'g95' ) then
    1018    set optimtru90=" $optimtru90 -fmod=$libo  "
    1019    set optim90=" $optim90 -fmod=$libo  "
     1017 else if ( $FC_LINUX == 'gfortran' ) then
     1018   set optimtru90=" $optimtru90 -I$libo  "
     1019   set optim90=" $optim90 -I$libo  "
    10201020 else if ( $FC_LINUX == 'gfortran' ) then
    10211021   set optimtru90=" $optimtru90 -M $libo  "
  • LMDZ5/branches/testing/makelmdz

    r1795 r1864  
    306306  FLAG_PARA=''
    307307else
    308   FLAG_PARA="par"
     308  FLAG_PARA="$paramem"
    309309fi
    310310
     
    351351fi
    352352
    353 if [[ "$veget" == "orchidee2.0" ]]
    354 then
    355 # orchidee2.0 :
    356 # Compile with ORCHIDEE 2.0 (or more recent)
     353
     354#==============================================================================
     355if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" ]
     356then
     357
     358   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    357359   CPP_KEY="$CPP_KEY CPP_VEGET"
    358    INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    359    LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}orchidee "
    360 elif [[ "$veget" == "orchidee1.9" ]]
    361 then
    362 # orchidee1.9 :
    363 # Compile with ORCHIDEE version up to the inclusion of OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
    364    CPP_KEY="$CPP_KEY CPP_VEGET ORCHIDEE_NOOPENMP"
    365    INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    366    LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}sechiba -l${LIBPREFIX}parameters -l${LIBPREFIX}stomate -l${LIBPREFIX}parallel -l${LIBPREFIX}orglob"
    367 elif [[ "$veget" == "true" ]]
    368 then
    369 # true :
    370 # Obsolete, for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6
    371 # For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments
    372    CPP_KEY="$CPP_KEY CPP_VEGET"
    373    INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    374    LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}sechiba -l${LIBPREFIX}parameters -l${LIBPREFIX}stomate -l${LIBPREFIX}parallel -l${LIBPREFIX}orglob"
    375 elif [[ "$veget" != "false" ]]
    376 then
     360# temporary, for Orchidee versions 1.9.* (before openmp activation)
     361   if [[ "$veget" == "orchidee1.9" ]] ; then
     362      CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP"
     363   fi
     364   if [[ "$veget" == "orchidee2.0" ]] ; then
     365      orch_libs="sechiba parameters stomate parallel orglob orchidee"
     366   else
     367      orch_libs="sechiba parameters stomate parallel orglob"
     368   fi
     369   LIB="${LIB} -L${ORCH_LIBDIR}"
     370   for lib in ${orch_libs} ; do
     371      if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then
     372         LIB="${LIB} -l${LIBPREFIX}$lib "
     373      fi
     374   done
     375elif [[ "$veget" != "false" ]] ; then
    377376   echo "Option -v $veget does not exist"
    378377   echo "Use ./makelmdz -h for more information"
     
    380379fi
    381380
     381#===============================================================================
    382382if [[ $io == ioipsl ]]
    383383then
     
    453453########################################################################
    454454
    455 dimension=`echo $dim | wc -w`
    456 echo dimension $dimension
    457 
    458 if (( $dimension == 3 ))
    459 then
    460   cd $LIBFGCM/grid
    461   \rm fxyprim.h
    462   cp -p fxy_${grille}.h fxyprim.h
     455if (( $dimc == 3 )) ; then
     456   cd $LIBFGCM/grid
     457   \rm fxyprim.h
     458   cp -p fxy_${grille}.h fxyprim.h
     459   filtre="FILTRE=$filtre"
     460   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d${FLAG_PARA} '
     461elif (( $dimc == 2 )) ; then
     462   filtre="FILTRE= L_FILTRE= "
     463   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn2d'
     464elif (( $dimc == 1 )) ; then
     465   filtre="L_DYN= DYN= FILTRE= L_FILTRE= DIRMAIN=phy$physique "
     466   INCLUDE="$INCLUDE "'-I$(LIBF)/dyn3d' # Pas tres propre
    463467else
    464   echo "Probleme dans les dimensions de la dynamique !!"
    465   echo "Non reactive pour l'instant !!!"
    466 fi
    467 
    468 ######################################################################
    469 # Gestion du filtre qui n'existe qu'en 3d.
    470 ######################################################################
    471 
    472 if (( `expr $dimc \> 2` == 1 ))
    473 then
    474    filtre="FILTRE=$filtre"
    475 else
    476    filtre="FILTRE= L_FILTRE= "
    477 fi
    478 echo MACRO FILTRE $filtre
    479 
    480 echo $dimc
     468   echo Dimension dimc=$dimc pas prevu ; exit
     469fi
    481470
    482471######################################################################
    483472# Creation du suffixe de la configuration
    484473######################################################################
    485 
    486474
    487475SUFF_NAME=_${dim_full}
     
    531519########################################################################
    532520cd $LMDGCM
     521
    533522find libf -name '*.[Fh]' -print > tmp77
    534523find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print > tmp90
     
    560549
    561550# library directory name:
    562 if [[ "$parallel" == "none" ]]
    563 then
    564   nomlib=${arch}_${physique}_${dim_full}_${grille}_${compil_mod}
    565 else
    566   nomlib=${arch}_${physique}_${dim_full}_${grille}_${compil_mod}_${FLAG_PARA}
    567 fi
     551nomlib=`echo ${arch}_${physique}_${dim_full}_${grille}_${compil_mod}_parall${parallel}_${CPP_KEY}_${FLAG_PARA} | sed -e 's/ //g' -e 's/-//g ' | sed -e 's/CPP_//g'`
     552echo $nomlib
    568553
    569554if [[ ! -d "${LIBOGCM}/${nomlib}" ]]
     
    585570  INCLUDE="$INCLUDE"' -I$(LIBF)/phy'"$physique"
    586571fi
    587 INCLUDE="$INCLUDE"' -I$(LIBF)/dyn'${dimc}'d'$FLAG_PARA' -I'${LIBOGCM}/${nomlib}
     572INCLUDE="$INCLUDE"' -I'${LIBOGCM}/${nomlib}
    588573
    589574# ranlib utility (check it exists or else default to ls)
     
    645630DIM=$dimc \
    646631FLAG_PARA=$FLAG_PARA \
    647 L_ADJNT="$adjnt" \
     632L_ADJNT=$adjnt \
    648633L_COSP="$lcosp" \
    649634L_CHIMIE="$libchimie" \
     
    660645PROG=$code
    661646
     647
    662648if [[ -r $LIBFGCM/grid/dimensions.h ]]
    663649then
  • LMDZ5/branches/testing/makelmdz_fcm

    r1795 r1864  
    2929LIBPREFIX=""
    3030cosp=false
     31job=1
     32full=''
    3133
    3234LMDGCM=`/bin/pwd`
     
    7981[-filtre NOMFILTRE]        : use filtre from libf/NOMFILTRE (default: filtrez)
    8082[-link LINKS]              : additional links with other libraries
     83[-j n]                     : active parallel compiling on ntask
     84[-full]                    : full recompiling
    8185[-fcm_path path]           : path to the fcm tool (default: tools/fcm/bin)
    8286[-ext_src path]            : path to an additional set of routines to compile with the model
     
    147151      "-ext_src")
    148152          EXT_SRC=$2 ; shift ; shift ;;
     153      "-j")
     154          job=$2 ; shift ; shift ;;
     155      "-full")
     156          full="-full" ; shift ;;
    149157
    150158      "-arch")
     
    248256fi
    249257
    250 if [[ "$veget" == "orchidee2.0" ]]
    251 then
    252 # orchidee2.0 :
    253 # Compile with ORCHIDEE 2.0 (or more recent)
     258if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" ]
     259then
     260#NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6
     261#    For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments
     262#    option orchidee1.9 : Compile with ORCHIDEE version up to the inclusion of OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
     263   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    254264   CPP_KEY="$CPP_KEY CPP_VEGET"
    255    INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    256    LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}orchidee "
    257 elif [[ "$veget" == "orchidee1.9" ]]
    258 then
    259 # orchidee1.9 :
    260 # Compile with ORCHIDEE version up to the inclusion of OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
    261    CPP_KEY="$CPP_KEY CPP_VEGET ORCHIDEE_NOOPENMP"
    262    INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    263    LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}sechiba -l${LIBPREFIX}parameters -l${LIBPREFIX}stomate -l${LIBPREFIX}parallel -l${LIBPREFIX}orglob"
    264 elif [[ "$veget" == "true" ]]
    265 then
    266 # true :
    267 # Obsolete, for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6
    268 # For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments
    269    CPP_KEY="$CPP_KEY CPP_VEGET"
    270    INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    271    LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}sechiba -l${LIBPREFIX}parameters -l${LIBPREFIX}stomate -l${LIBPREFIX}parallel -l${LIBPREFIX}orglob"
    272 elif [[ "$veget" != "false" ]]
    273 then
     265# temporary, for Orchidee versions 1.9.* (before openmp activation)
     266   if [[ "$veget" == "orchidee1.9" ]] ; then
     267      CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP"
     268   fi
     269   if [[ "$veget" == "orchidee2.0" ]] ; then
     270      orch_libs="sechiba parameters stomate parallel orglob orchidee"
     271   else
     272      orch_libs="sechiba parameters stomate parallel orglob"
     273   fi
     274   LIB="${LIB} -L${ORCH_LIBDIR}"
     275   for lib in ${orch_libs} ; do
     276      if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then
     277         LIB="${LIB} -l${LIBPREFIX}$lib "
     278      fi
     279   done
     280elif [[ "$veget" != "false" ]] ; then
    274281   echo "Option -v $veget does not exist"
    275282   echo "Use ./makelmdz_fcm -h for more information"
     
    468475
    469476rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock
    470 ./build_gcm ${fcm_path}
     477./build_gcm ${fcm_path} -j $job $full
    471478
    472479rm -rf tmp_src
Note: See TracChangeset for help on using the changeset viewer.