Changeset 1807 for LMDZ5/trunk


Ignore:
Timestamp:
Jul 19, 2013, 4:32:37 PM (11 years ago)
Author:
Ehouarn Millour
Message:

Unification de la définition et de l'écriture des variables dans la routine histwrite_phy (le premier appel définit les variables, les suivants écrivent). Nettoyage de phys_output_mod, déplacement des histdef_23d dans iophy. Ajout de prints de débogage dans histwrite_phy.
UG
...................................................

Unification of definition and writing of vars in histwrite_phy routine (the first call defines vars, the others do the writing). Cleaning up of phys_output_mod, moving of histdef23_d routines into iophy. Adding debugging prints to histwrite_phy.
UG

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

Legend:

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

    r1797 r1807  
    22! $Header$
    33!
    4 module iophy
    5  
     4MODULE iophy
     5
     6  USE phys_output_var_mod
     7
    68! abd  REAL,private,allocatable,DIMENSION(:),save :: io_lat
    79! abd  REAL,private,allocatable,DIMENSION(:),save :: io_lon
     
    331333
    332334  end SUBROUTINE histbeg_phy_points
     335
     336
     337  SUBROUTINE histdef2d_old (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
     338
     339    USE ioipsl
     340    USE dimphy
     341    USE mod_phys_lmdz_para
     342
     343    IMPLICIT NONE
     344
     345    INCLUDE "dimensions.h"
     346    INCLUDE "temps.h"
     347    INCLUDE "clesphys.h"
     348
     349    INTEGER                          :: iff
     350    LOGICAL                          :: lpoint
     351    INTEGER, DIMENSION(nfiles)       :: flag_var
     352    CHARACTER(LEN=20)                 :: nomvar
     353    CHARACTER(LEN=*)                 :: titrevar
     354    CHARACTER(LEN=*)                 :: unitvar
     355
     356    REAL zstophym
     357
     358    IF (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') THEN
     359       zstophym=zoutm(iff)
     360    ELSE
     361       zstophym=zdtime_moy
     362    ENDIF
     363
     364    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
     365    CALL conf_physoutputs(nomvar,flag_var)
     366
     367    IF(.NOT.lpoint) THEN 
     368       IF ( flag_var(iff)<=lev_files(iff) ) THEN
     369          CALL histdef (nid_files(iff),nomvar,titrevar,unitvar, &
     370               iim,jj_nb,nhorim(iff), 1,1,1, -99, 32, &
     371               type_ecri(iff), zstophym,zoutm(iff))               
     372       ENDIF
     373    ELSE
     374       IF ( flag_var(iff)<=lev_files(iff) ) THEN
     375          CALL histdef (nid_files(iff),nomvar,titrevar,unitvar, &
     376               npstn,1,nhorim(iff), 1,1,1, -99, 32, &
     377               type_ecri(iff), zstophym,zoutm(iff))               
     378       ENDIF
     379    ENDIF
     380
     381    ! Set swaero_diag=true if at least one of the concerned variables are defined
     382    IF (nomvar=='topswad' .OR. nomvar=='topswai' .OR. nomvar=='solswad' .OR. nomvar=='solswai' ) THEN
     383       IF  ( flag_var(iff)<=lev_files(iff) ) THEN
     384          swaero_diag=.TRUE.
     385       END IF
     386    END IF
     387  END SUBROUTINE histdef2d_old
     388
     389
     390
     391  SUBROUTINE histdef3d_old (iff,lpoint,flag_var,nomvar,titrevar,unitvar)
     392
     393    USE ioipsl
     394    USE dimphy
     395    USE mod_phys_lmdz_para
     396
     397    IMPLICIT NONE
     398
     399    INCLUDE "dimensions.h"
     400    INCLUDE "temps.h"
     401!    INCLUDE "indicesol.h"
     402    INCLUDE "clesphys.h"
     403
     404    INTEGER                          :: iff
     405    LOGICAL                          :: lpoint
     406    INTEGER, DIMENSION(nfiles)       :: flag_var
     407    CHARACTER(LEN=20)                 :: nomvar
     408    CHARACTER(LEN=*)                 :: titrevar
     409    CHARACTER(LEN=*)                 :: unitvar
     410
     411    REAL zstophym
     412
     413    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
     414    CALL conf_physoutputs(nomvar,flag_var)
     415
     416    IF (type_ecri(iff)=='inst(X)'.OR.type_ecri(iff)=='once') THEN
     417       zstophym=zoutm(iff)
     418    ELSE
     419       zstophym=zdtime_moy
     420    ENDIF
     421
     422    IF(.NOT.lpoint) THEN
     423       IF ( flag_var(iff)<=lev_files(iff) ) THEN
     424          CALL histdef (nid_files(iff), nomvar, titrevar, unitvar, &
     425               iim, jj_nb, nhorim(iff), klev, levmin(iff), &
     426               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, type_ecri(iff), &
     427               zstophym, zoutm(iff))
     428       ENDIF
     429    ELSE
     430       IF ( flag_var(iff)<=lev_files(iff) ) THEN
     431          CALL histdef (nid_files(iff), nomvar, titrevar, unitvar, &
     432               npstn,1,nhorim(iff), klev, levmin(iff), &
     433               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, &
     434               type_ecri(iff), zstophym,zoutm(iff))
     435       ENDIF
     436    ENDIF
     437  END SUBROUTINE histdef3d_old
     438
     439
     440
     441
     442
     443
     444
     445
     446  SUBROUTINE histdef2d (iff,var)
     447
     448    USE ioipsl
     449    USE dimphy
     450    USE mod_phys_lmdz_para
     451
     452    IMPLICIT NONE
     453
     454    INCLUDE "dimensions.h"
     455    INCLUDE "temps.h"
     456    INCLUDE "clesphys.h"
     457
     458    INTEGER                          :: iff
     459    TYPE(ctrl_out)                   :: var
     460
     461    REAL zstophym
     462    CHARACTER(LEN=20) :: typeecrit
     463
     464
     465    ! ug On récupère le type écrit de la structure:
     466    !       Assez moche, à refaire si meilleure méthode...
     467    IF (INDEX(var%type_ecrit(iff), "once") > 0) THEN
     468       typeecrit = 'once'
     469    ELSE IF(INDEX(var%type_ecrit(iff), "t_min") > 0) THEN
     470       typeecrit = 't_min(X)'
     471    ELSE IF(INDEX(var%type_ecrit(iff), "t_max") > 0) THEN
     472       typeecrit = 't_max(X)'
     473    ELSE IF(INDEX(var%type_ecrit(iff), "inst") > 0) THEN
     474       typeecrit = 'inst(X)'
     475    ELSE
     476       typeecrit = type_ecri_files(iff)
     477    ENDIF
     478
     479    IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN
     480       zstophym=zoutm(iff)
     481    ELSE
     482       zstophym=zdtime_moy
     483    ENDIF
     484
     485    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
     486    CALL conf_physoutputs(var%name, var%flag)
     487
     488    IF(.NOT.clef_stations(iff)) THEN 
     489       IF ( var%flag(iff)<=lev_files(iff) ) THEN
     490          CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
     491               iim,jj_nb,nhorim(iff), 1,1,1, -99, 32, &
     492               typeecrit, zstophym,zoutm(iff))               
     493       ENDIF
     494    ELSE
     495       IF ( var%flag(iff)<=lev_files(iff)) THEN
     496          CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
     497               npstn,1,nhorim(iff), 1,1,1, -99, 32, &
     498               typeecrit, zstophym,zoutm(iff))               
     499       ENDIF
     500    ENDIF
     501
     502    ! Set swaero_diag=true if at least one of the concerned variables are defined
     503    IF (var%name=='topswad' .OR. var%name=='topswai' .OR. var%name=='solswad' .OR. var%name=='solswai' ) THEN
     504       IF  ( var%flag(iff)<=lev_files(iff) ) THEN
     505          swaero_diag=.TRUE.
     506       END IF
     507    END IF
     508  END SUBROUTINE histdef2d
     509  SUBROUTINE histdef3d (iff,var)
     510
     511    USE ioipsl
     512    USE dimphy
     513    USE mod_phys_lmdz_para
     514
     515    IMPLICIT NONE
     516
     517    INCLUDE "dimensions.h"
     518    INCLUDE "temps.h"
     519    INCLUDE "clesphys.h"
     520
     521    INTEGER                          :: iff
     522    TYPE(ctrl_out)                   :: var
     523
     524    REAL zstophym
     525    CHARACTER(LEN=20) :: typeecrit
     526
     527    ! ug On récupère le type écrit de la structure:
     528    !       Assez moche, à refaire si meilleure méthode...
     529    IF (INDEX(var%type_ecrit(iff), "once") > 0) THEN
     530       typeecrit = 'once'
     531    ELSE IF(INDEX(var%type_ecrit(iff), "t_min") > 0) THEN
     532       typeecrit = 't_min(X)'
     533    ELSE IF(INDEX(var%type_ecrit(iff), "t_max") > 0) THEN
     534       typeecrit = 't_max(X)'
     535    ELSE IF(INDEX(var%type_ecrit(iff), "inst") > 0) THEN
     536       typeecrit = 'inst(X)'
     537    ELSE
     538       typeecrit = type_ecri_files(iff)
     539    ENDIF
     540
     541
     542    ! Appel a la lecture des noms et niveau d'ecriture des variables dans output.def
     543    CALL conf_physoutputs(var%name,var%flag)
     544
     545    IF (typeecrit=='inst(X)'.OR.typeecrit=='once') THEN
     546       zstophym=zoutm(iff)
     547    ELSE
     548       zstophym=zdtime_moy
     549    ENDIF
     550
     551    IF(.NOT.clef_stations(iff)) THEN
     552       IF ( var%flag(iff)<=lev_files(iff) ) THEN
     553          CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
     554               iim, jj_nb, nhorim(iff), klev, levmin(iff), &
     555               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, typeecrit, &
     556               zstophym, zoutm(iff))
     557       ENDIF
     558    ELSE
     559       IF ( var%flag(iff)<=lev_files(iff)) THEN
     560          CALL histdef (nid_files(iff), var%name, var%description, var%unit, &
     561               npstn,1,nhorim(iff), klev, levmin(iff), &
     562               levmax(iff)-levmin(iff)+1, nvertm(iff), 32, &
     563               typeecrit, zstophym,zoutm(iff))
     564       ENDIF
     565    ENDIF
     566  END SUBROUTINE histdef3d
     567
     568  SUBROUTINE conf_physoutputs(nam_var,flag_var)
     569!!! Lecture des noms et niveau de sortie des variables dans output.def
     570    !   en utilisant les routines getin de IOIPSL 
     571    use ioipsl
     572
     573    IMPLICIT NONE
     574
     575    include 'iniprint.h'
     576
     577    CHARACTER(LEN=20)                :: nam_var
     578    INTEGER, DIMENSION(nfiles)      :: flag_var
     579
     580    IF(prt_level>10) WRITE(lunout,*)'Avant getin: nam_var flag_var ',nam_var,flag_var(:)
     581    CALL getin('flag_'//nam_var,flag_var)
     582    CALL getin('name_'//nam_var,nam_var)
     583    IF(prt_level>10) WRITE(lunout,*)'Apres getin: nam_var flag_var ',nam_var,flag_var(:)
     584
     585  END SUBROUTINE conf_physoutputs
     586
     587
    333588 
    334589  SUBROUTINE histwrite2d_phy_old(nid,lpoint,name,itau,field)
    335590  USE dimphy
    336591  USE mod_phys_lmdz_para
    337   USE phys_output_var_mod
    338592  USE ioipsl
    339593  IMPLICIT NONE
     
    399653  USE dimphy
    400654  USE mod_phys_lmdz_para
    401   USE phys_output_var_mod
    402655
    403656  use ioipsl
     
    470723
    471724
     725
     726
    472727! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE
    473728  SUBROUTINE histwrite2d_phy(var,field, STD_iff)
     
    475730  USE mod_phys_lmdz_para
    476731  USE ioipsl
    477 !Pour avoir nfiles, nidfiles tout ça tout ça...
    478   USE phys_output_var_mod
    479732 
    480  
     733
    481734
    482735#ifdef CPP_XIOS
     
    485738
    486739  IMPLICIT NONE
    487   include 'dimensions.h'
    488    
    489 !    integer,INTENT(IN) :: nid
    490 !    logical,INTENT(IN) :: lpoint
    491 !    character*(*), INTENT(IN) :: name
    492 !    integer, INTENT(IN) :: itau
    493 !    REAL,DIMENSION(:),INTENT(IN) :: field
    494 
    495       TYPE(ctrl_out), INTENT(IN) :: var
    496       REAL, DIMENSION(:), INTENT(IN) :: field
    497       INTEGER, INTENT(IN), OPTIONAL :: STD_iff ! ug RUSTINE POUR LES STD LEVS.....
     740  INCLUDE 'dimensions.h'
     741  INCLUDE 'iniprint.h'
     742
     743    TYPE(ctrl_out), INTENT(IN) :: var
     744    REAL, DIMENSION(:), INTENT(IN) :: field
     745    INTEGER, INTENT(IN), OPTIONAL :: STD_iff ! ug RUSTINE POUR LES STD LEVS.....
    498746     
    499       INTEGER :: iff, iff_beg, iff_end
     747    INTEGER :: iff, iff_beg, iff_end
    500748     
    501749    REAL,DIMENSION(klon_mpi) :: buffer_omp
     
    505753    INTEGER :: ip
    506754    REAL, ALLOCATABLE, DIMENSION(:) :: fieldok
     755
     756    IF (prt_level >= 9) WRITE(lunout,*)'Begin histrwrite2d ',var%name
    507757
    508758! ug RUSTINE POUR LES STD LEVS.....
     
    515765      END IF
    516766
    517     IF (size(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first DIMENSION not equal to klon',1)
     767  ! On regarde si on est dans la phase de définition ou d'écriture:
     768  IF(.NOT.vars_defined) THEN
     769
     770      !Si phase de définition.... on définit
     771      DO iff=iff_beg, iff_end
     772         IF (clef_files(iff)) THEN
     773            CALL histdef2d(iff, var)
     774         ENDIF
     775      ENDDO
     776  ELSE
     777
     778    !Et sinon on.... écrit
     779    IF (SIZE(field)/=klon) CALL abort_gcm('iophy::histwrite2d','Field first DIMENSION not equal to klon',1)
    518780   
    519781    CALL Gather_omp(field,buffer_omp)   
     
    540802
    541803                        IF (is_sequential) THEN
    542 !                            klon_mpi_begin=1
    543 !                             klon_mpi_end=klon
    544804                              DO ip=1, npstn
    545805                                    fieldok(ip)=buffer_omp(nptabij(ip))
     
    547807                             ELSE
    548808                              DO ip=1, npstn
    549 !                                   print*,'histwrite2d is_sequential npstn ip name nptabij',npstn,ip,name,nptabij(ip)
     809                                PRINT*,'histwrite2d is_sequential npstn ip namenptabij',npstn,ip,var%name,nptabij(ip)
    550810                                     IF(nptabij(ip).GE.klon_mpi_begin.AND. &
    551811                                        nptabij(ip).LE.klon_mpi_end) THEN
     
    563823      ENDDO
    564824!$OMP END MASTER   
    565 
     825  ENDIF ! vars_defined
     826  IF (prt_level >= 9) WRITE(lunout,*)'End histrwrite2d ',var%name
    566827  END SUBROUTINE histwrite2d_phy
    567828
    568829
    569830! ug NOUVELLE VERSION DES WRITE AVEC LA BOUCLE DO RENTREE
    570   SUBROUTINE histwrite3d_phy(var, field)
     831  SUBROUTINE histwrite3d_phy(var, field, STD_iff)
    571832  USE dimphy
    572833  USE mod_phys_lmdz_para
    573 
    574   use ioipsl
    575 !Pour avoir nfiles, nidfiles tout ça tout ça...
    576   USE phys_output_var_mod 
     834  USE ioipsl
    577835 
    578836
     
    583841
    584842  IMPLICIT NONE
    585   include 'dimensions.h'
    586    
    587 !    integer,INTENT(IN) :: nid
    588 !    logical,INTENT(IN) :: lpoint
    589 !    character*(*), INTENT(IN) :: name
    590 !    integer, INTENT(IN) :: itau
    591 !    REAL,DIMENSION(:,:),INTENT(IN) :: field  ! --> field(klon,:)
    592 
    593       TYPE(ctrl_out), INTENT(IN) :: var
    594       REAL, DIMENSION(:,:), INTENT(IN) :: field ! --> field(klon,:)
    595 
     843  INCLUDE 'dimensions.h'
     844  INCLUDE 'iniprint.h'
     845
     846    TYPE(ctrl_out), INTENT(IN) :: var
     847    REAL, DIMENSION(:,:), INTENT(IN) :: field ! --> field(klon,:)
     848    INTEGER, INTENT(IN), OPTIONAL :: STD_iff ! ug RUSTINE POUR LES STD LEVS.....
     849     
     850    INTEGER :: iff
    596851
    597852    REAL,DIMENSION(klon_mpi,SIZE(field,2)) :: buffer_omp
    598853    REAL :: Field3d(iim,jj_nb,SIZE(field,2))
    599     INTEGER :: ip, n, nlev, iff
     854    INTEGER :: ip, n, nlev
    600855    INTEGER, ALLOCATABLE, DIMENSION(:) :: index3d
    601856    REAL,ALLOCATABLE, DIMENSION(:,:) :: fieldok
    602857
    603     IF (size(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
    604     nlev=size(field,2)
    605 
    606 !   print*,'hist3d_phy mpi_rank npstn=',mpi_rank,npstn
    607 
    608 !   DO ip=1, npstn
    609 !    print*,'hist3d_phy mpi_rank nptabij',mpi_rank,nptabij(ip)
    610 !   ENDDO
     858  IF (prt_level >= 9) write(lunout,*)'Begin histrwrite3d ',var%name
     859
     860  ! On regarde si on est dans la phase de définition ou d'écriture:
     861  IF(.NOT.vars_defined) THEN
     862      !Si phase de définition.... on définit
     863      DO iff=1, nfiles
     864        IF (clef_files(iff)) THEN
     865          CALL histdef3d(iff, var)
     866        ENDIF
     867      ENDDO
     868  ELSE
     869    !Et sinon on.... écrit
     870    IF (SIZE(field,1)/=klon) CALL abort_gcm('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
     871    nlev=SIZE(field,2)
     872
    611873
    612874    CALL Gather_omp(field,buffer_omp)
     
    634896
    635897                        IF (is_sequential) THEN
    636             !                  klon_mpi_begin=1
    637             !                  klon_mpi_end=klon
    638898                              DO n=1, nlev
    639899                                    DO ip=1, npstn
     
    658918      ENDDO
    659919!$OMP END MASTER   
     920  ENDIF ! vars_defined
     921  IF (prt_level >= 9) write(lunout,*)'End histrwrite3d ',var%name
    660922  END SUBROUTINE histwrite3d_phy
    661923 
  • LMDZ5/trunk/libf/phylmd/phys_output_mod.F90

    r1791 r1807  
    1313  USE indice_sol_mod
    1414  USE phys_output_var_mod
    15   USE phys_output_ctrlout_mod
    1615  USE aero_mod, only : naero_spc,name_aero
    1716
    1817  IMPLICIT NONE
    19 
    20   PRIVATE histdef2d, histdef3d, conf_physoutputs
    21 
    22   REAL, PRIVATE, SAVE                :: zdtime
    23   !$OMP THREADPRIVATE(zdtime)
    24 
    25 
    2618
    2719CONTAINS
     
    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_write_mod
     44    USE phys_output_ctrlout_mod
    4945
    5046    IMPLICIT NONE
     
    5652    include "iniprint.h"
    5753
    58     real,dimension(klon),intent(in) :: rlon
    59     real,dimension(klon),intent(in) :: rlat
    60     INTEGER, intent(in)             :: pim
     54    ! ug Nouveaux arguments nécessaires au histwrite_mod:
     55    INTEGER, INTENT(IN)                         :: ivap
     56    INTEGER, DIMENSION(klon), INTENT(IN)        :: lmax_th
     57    LOGICAL, INTENT(IN)                         :: ok_sync
     58    LOGICAL, DIMENSION(klon, klev), INTENT(IN)  :: ptconv, ptconvth
     59    REAL, INTENT(IN)                            :: pdtphys
     60    REAL, DIMENSION(klon), INTENT(IN)           :: pphis
     61    REAL, DIMENSION(klon, klev), INTENT(IN)     :: pplay, d_t
     62    REAL, DIMENSION(klon, klev+1), INTENT(IN)   :: paprs
     63    REAL, DIMENSION(klon,klev,nqtot), INTENT(IN):: qx, d_qx
     64    REAL, DIMENSION(klon, llm), INTENT(IN)      :: zmasse
     65
     66
     67    REAL,DIMENSION(klon),INTENT(IN) :: rlon
     68    REAL,DIMENSION(klon),INTENT(IN) :: rlat
     69    INTEGER, INTENT(IN)             :: pim
    6170    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
     71    INTEGER,DIMENSION(pim), INTENT(IN) :: ipt, jpt
     72    REAL,DIMENSION(pim), INTENT(IN) :: plat, plon
     73    REAL,DIMENSION(pim,2) :: plat_bounds, plon_bounds
    6574
    6675    INTEGER                               :: jjmp1
     
    6978    LOGICAL                               :: ok_LES,ok_ade,ok_aie,flag_aerosol_strat
    7079    LOGICAL                               :: new_aod, aerosol_couple
    71     INTEGER, intent(in)::  read_climoz ! read ozone climatology
     80    INTEGER, INTENT(IN)::  read_climoz ! read ozone climatology
    7281    !     Allowed values are 0, 1 and 2
    7382    !     0: do not read an ozone climatology
     
    200209!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    201210
    202     zdtime = dtime         ! Frequence ou l on moyenne
     211    zdtime_moy = dtime         ! Frequence ou l on moyenne
    203212
    204213    ! Calcul des Ahyb, Bhyb et Alt
     
    302311          !          ENDIF
    303312          !
    304 !!!! Composentes de la coordonnee sigma-hybride
     313!!!! Composantes de la coordonnee sigma-hybride
    305314          CALL histvert(nid_files(iff), "Ahyb","Ahyb comp of Hyb Cord ", "Pa", &
    306315               levmax(iff) - levmin(iff) + 1,Ahyb,nvertap(iff))
     
    314323          !   CALL histvert(nid_files(iff), "preff","Reference pressure", "Pa", &
    315324          !                 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
    808325
    809326
     
    813330            o_trac(iq-2) = ctrl_out((/ 4, 5, 1, 1, 1, 10 /),tname(iiq),'Tracer '//ttext(iiq), "-",&
    814331                  (/ '', '', '', '', '', '' /))
    815             CALL histdef3d(iff, o_trac(iq-2))
    816332            o_trac_cum(iq-2) = ctrl_out((/ 3, 4, 10, 10, 10, 10 /),'cum'//tname(iiq),&
    817333                  'Cumulated tracer '//ttext(iiq), "-", (/ '', '', '', '', '', '' /))
    818             CALL histdef2d(iff, o_trac_cum(iq-2))
    819334            ENDDO
    820335      ENDIF
    821336
    822       CALL histend(nid_files(iff))
    823 
    824       ndex2d = 0
    825       ndex3d = 0
    826 
    827337    ENDIF ! clef_files
    828338
     339    ENDDO !  iff
     340
     341    !On déclare les sorties avec un premier appel à phys_output_write:
     342
     343      CALL phys_output_write(0, pdtphys, paprs, pphis,               &
     344     &                  pplay, lmax_th, aerosol_couple,                 &
     345     &                  ok_ade, ok_aie, ivap, new_aod, ok_sync,         &
     346     &                  ptconv, read_climoz, clevSTD, ptconvth,         &
     347     &                  d_t, qx, d_qx, zmasse, flag_aerosol_strat)
     348
     349    DO iff=1,nfiles
     350        IF (clef_files(iff)) THEN
     351          CALL histend(nid_files(iff))
     352
     353          ndex2d = 0
     354          ndex3d = 0
     355
     356        ENDIF ! clef_files
    829357    ENDDO !  iff
    830358
     
    842370  end SUBROUTINE phys_output_open
    843371
    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
     372
    1088373
    1089374  SUBROUTINE convers_timesteps(str,dtime,timestep)
  • LMDZ5/trunk/libf/phylmd/phys_output_var_mod.F90

    r1797 r1807  
    5050!$OMP THREADPRIVATE(levmin, levmax)
    5151
    52       LOGICAL, SAVE :: vars_defined = .TRUE.
    53 !$OMP THREADPRIVATE(vars_defined)
     52      REAL, SAVE                :: zdtime_moy
     53!$OMP THREADPRIVATE(zdtime_moy)
     54
     55      LOGICAL, SAVE :: vars_defined = .FALSE. ! ug PAS THREADPRIVATE ET C'EST NORMAL
    5456
    5557  TYPE ctrl_out
  • LMDZ5/trunk/libf/phylmd/phys_output_write_F90.h

    r1798 r1807  
    11
    2       ndex2d = 0
    3       ndex3d = 0
    42
    53!!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    64      CALL histwrite_phy(o_phis, pphis)
    7        IF (.TRUE.) THEN
    85      CALL histwrite_phy(o_aire, airephy)
    96      DO i=1, klon
     
    118      ENDDO
    129      CALL histwrite_phy(o_contfracATM, zx_tmp_fi2d)
    13        ENDIF
    1410      CALL histwrite_phy(o_contfracOR, pctsrf(:,is_ter))
    1511      CALL histwrite_phy(o_aireTER, paire_ter)
     
    1915      CALL histwrite_phy(o_tsol, zxtsol)
    2016      CALL histwrite_phy(o_t2m, zt2m)
    21       IF (.TRUE.) THEN
    2217      CALL histwrite_phy(o_t2m_min, zt2m)
    2318      CALL histwrite_phy(o_t2m_max, zt2m)
    24        ENDIF
     19
    2520      DO i=1, klon
    2621       zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
    2722      ENDDO
    2823      CALL histwrite_phy(o_wind10m, zx_tmp_fi2d)
    29       IF (.TRUE.) THEN
     24
    3025      DO i=1, klon
    3126       zx_tmp_fi2d(i)=SQRT(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
    3227      ENDDO
    3328      CALL histwrite_phy(o_wind10max, zx_tmp_fi2d)
    34       ENDIF
     29
    3530      DO i = 1, klon
    3631         zx_tmp_fi2d(i) = pctsrf(i,is_sic)
     
    179174       pbl_tke(:,1:klev,nsrf))
    180175
    181       IF (.TRUE.) THEN
     176
    182177      CALL histwrite_phy(o_tke_max_srf(nsrf),  &
    183178       pbl_tke(:,1:klev,nsrf))
    184       ENDIF
     179
    185180      ENDIF
    186181
     
    211206      CALL histwrite_phy(o_wbeff, wbeff)
    212207        end if
    213       IF (.TRUE.) THEN
     208
    214209      CALL histwrite_phy(o_cape_max, cape)
    215       ENDIF
     210
    216211      CALL histwrite_phy(o_upwd, upwd)
    217212      CALL histwrite_phy(o_Ma, Ma)
     
    353348       ENDIF  !(iflag_clos_bl>=1)
    354349!!! fin nrlmd le 10/04/2012
    355       WRITE(*,*) "TOTOTYPE OCEAN=",type_ocean
    356350      IF (type_ocean=='slab ') THEN
    357       WRITE(*,*) "TOTOTYPE OCEAN=slab "
    358351      CALL histwrite_phy(o_slab_bils, slab_wfbils)
    359352      ENDIF !type_ocean == force/slab
     
    372365      ENDDO
    373366      CALL histwrite_phy(o_rh2m, zx_tmp_fi2d)
    374       IF (.TRUE.) THEN
     367
    375368      DO i=1, klon
    376369       zx_tmp_fi2d(i)=MIN(100.,rh2m(i)*100.)
     
    381374      ENDDO
    382375      CALL histwrite_phy(o_rh2m_max, zx_tmp_fi2d)
    383       ENDIF
     376
    384377      CALL histwrite_phy(o_qsat2m, qsat2m)
    385378      CALL histwrite_phy(o_tpot, tpot)
     
    548541      enddo
    549542      CALL histwrite_phy(o_tke, zx_tmp_fi3d)
    550       IF (.TRUE.) THEN
     543
    551544      CALL histwrite_phy(o_tke_max, zx_tmp_fi3d)
    552545      ENDIF
    553       endif
     546
    554547      CALL histwrite_phy(o_kz, coefh(:,:,is_ave))
    555       IF (.TRUE.) THEN
     548
    556549      CALL histwrite_phy(o_kz_max, coefh(:,:,is_ave))
    557       ENDIF
     550
    558551      CALL histwrite_phy(o_clwcon, clwcon0)
    559552      CALL histwrite_phy(o_dtdyn, d_t_dyn)
     
    579572      zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
    580573      CALL histwrite_phy(o_dqcon, zx_tmp_fi3d)
    581       if(iflag_thermals.eq.1)then
    582       zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
    583       CALL histwrite_phy(o_tnhusc, zx_tmp_fi3d)
    584       else if(iflag_thermals.gt.1.and.iflag_wake.EQ.1)then
    585       zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys + &
    586                                  d_q_ajs(1:klon,1:klev)/pdtphys + &
    587                                  d_q_wake(1:klon,1:klev)/pdtphys
    588       CALL histwrite_phy(o_tnhusc, zx_tmp_fi3d)
    589       endif
     574
     575      IF(iflag_thermals.EQ.1) THEN
     576        zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys
     577        CALL histwrite_phy(o_tnhusc, zx_tmp_fi3d)
     578      ELSE IF(iflag_thermals.GT.1.AND.iflag_wake.EQ.1) THEN
     579         zx_tmp_fi3d(1:klon,1:klev)=d_q_con(1:klon,1:klev)/pdtphys + &
     580                                     d_q_ajs(1:klon,1:klev)/pdtphys + &
     581                                     d_q_wake(1:klon,1:klev)/pdtphys
     582         CALL histwrite_phy(o_tnhusc, zx_tmp_fi3d)
     583      ENDIF
     584
    590585      zx_tmp_fi3d(1:klon,1:klev)=d_t_lsc(1:klon,1:klev)/pdtphys
    591586      CALL histwrite_phy(o_dtlsc, zx_tmp_fi3d)
     
    763758      CALL histwrite_phy(o_rsdcs4co2, swdn0p)
    764759      CALL histwrite_phy(o_rldcs4co2, lwdn0p)
    765       endif
    766         if (nqtot.GE.3) THEN
     760      ENDIF
     761        IF (nqtot.GE.3) THEN
    767762         DO iq=3,nqtot
    768       CALL histwrite_phy(o_trac(iq-2), qx(:,:,iq))
     763             CALL histwrite_phy(o_trac(iq-2), qx(:,:,iq))
    769764         ENDDO
    770765         DO iq=3,nqtot
    771766         zx_tmp_fi2d=0.
    772          do k=1,klev
     767         DO k=1,klev
    773768            zx_tmp_fi2d(:)=zx_tmp_fi2d(:)+zmasse(:,k)*qx(:,k,iq)
    774          enddo
    775       CALL histwrite_phy(o_trac_cum(iq-2), zx_tmp_fi2d)
    776          ENDDO
    777         endif
    778 
     769         ENDDO
     770            CALL histwrite_phy(o_trac_cum(iq-2), zx_tmp_fi2d)
     771         ENDDO
     772        ENDIF
     773
  • LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90

    r1798 r1807  
    88! Author: Ulysse GERARD (effective implementation)
    99
    10    USE phys_output_var_mod
    1110
    1211   CONTAINS
     
    9190          ENDIF
    9291      END DO
     92
     93    ELSE
     94    vars_defined = .TRUE.
    9395    ENDIF
    9496
    9597     
    96     vars_defined = .TRUE.
     98
    9799
    98100    END SUBROUTINE phys_output_write
  • LMDZ5/trunk/libf/phylmd/physiq.F

    r1798 r1807  
    15171517     &                       read_climoz, phys_out_filestations,
    15181518     &                       new_aod, aerosol_couple,
    1519      &                       flag_aerosol_strat )
     1519     &                       flag_aerosol_strat, pdtphys, paprs, pphis,
     1520     &                       pplay, lmax_th, ptconv, ptconvth, ivap,
     1521     &                       d_t, qx, d_qx, zmasse, ok_sync)
    15201522c$OMP END MASTER
    15211523c$OMP BARRIER
Note: See TracChangeset for help on using the changeset viewer.