Ignore:
Timestamp:
Feb 24, 2017, 7:50:33 PM (7 years ago)
Author:
jyg
Message:

New diagnostics to verify energy conservation.
Some corrections to improve energy conservation.
Some bug correction.

New output variables and new flags are

introduced:

(1)New variables: d_xx_col is the budget over

each column of variable "xx".

(2) fl_ebil: 0 -> no diag; 1 -> diags activated
(3) fl_cor_ebil: 0 -> no correction ensuring

energy conservation; 1 -> first set of
corrections.

+ ok_bad_ecmwf_thermo: if true, a bug setting

RVTMP2 to 0 is fixed; for backward compatibility
the default is "false".

File:
1 edited

Legend:

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

    r2795 r2799  
    242242
    243243    USE cmp_seri_mod
     244    USE add_phys_tend_mod, only : add_pbl_tend, add_phys_tend, prt_enerbil, &
     245  &      fl_ebil, fl_cor_ebil
    244246
    245247    !IM stations CFMIP
     
    406408    REAL pphis(klon)
    407409    REAL presnivs(klev)
    408     REAL znivsig(klev)
    409     real pir
     410!JLD    REAL znivsig(klev)
     411!JLD    real pir
    410412
    411413    REAL u(klon,klev)
     
    467469    ! jmin_debut : indice minimum de j; nbptj : nombre de points en
    468470    ! direction j (latitude)
    469     INTEGER imin_debut, nbpti
    470     INTEGER jmin_debut, nbptj
     471!JLD    INTEGER imin_debut, nbpti
     472!JLD    INTEGER jmin_debut, nbptj
    471473    !IM: region='3d' <==> sorties en global
    472474    CHARACTER*3 region
     
    617619    real env_tke_max0(klon)     ! TKE dans l'environnement au LCL
    618620
    619     !---D\'eclenchement stochastique
    620     integer :: tau_trig(klon)
     621!JLD    !---D\'eclenchement stochastique
     622!JLD    integer :: tau_trig(klon)
    621623
    622624    REAL,SAVE :: random_notrig_max=1.
     
    652654    REAL beta_prec_fisrt(klon,klev) ! taux de conv de l'eau cond (fisrt)
    653655    ! RomP <<<
    654 
    655     REAL          :: calday
    656656
    657657    !IM cf FH pour Tiedtke 080604
     
    751751    REAL conv_t(klon,klev) ! convergence de la temperature(K/s)
    752752    !
     753#ifdef INCA
    753754    REAL zxsnow_dummy(klon)
     755#endif
    754756    REAL zsav_tsol(klon)
    755757    !
     
    762764    LOGICAL zx_ajustq
    763765    !
    764     REAL za, zb
    765     REAL zx_t, zx_qs, zdelta, zcor, zlvdcp, zlsdcp
     766    REAL za
     767    REAL zx_t, zx_qs, zdelta, zcor
    766768    real zqsat(klon,klev)
    767769    !
    768     INTEGER i, k, iq, j, nsrf, ll, l
     770    INTEGER i, k, iq, nsrf, l
    769771    !
    770772    REAL t_coup
     
    874876
    875877    !
    876     integer itau_w   ! pas de temps ecriture = itap + itau_phy
     878!JLD    integer itau_w   ! pas de temps ecriture = itap + itau_phy
    877879    !
    878880    !
     
    886888    REAL tabcntr0( length       )
    887889    !
    888     INTEGER ndex2d(nbp_lon*nbp_lat)
     890!JLD    INTEGER ndex2d(nbp_lon*nbp_lat)
    889891    !IM
    890892    !
    891893    !IM AMIP2 BEG
    892     REAL moyglo, mountor
     894!JLD    REAL moyglo, mountor
    893895    !IM 141004 BEG
    894896    REAL zustrdr(klon), zvstrdr(klon)
     
    904906    !  REAL airedyn(nbp_lon+1,nbp_lat)
    905907    !IM 190504 END
    906     LOGICAL ok_msk
    907     REAL msk(klon)
     908!JLD    LOGICAL ok_msk
     909!JLD    REAL msk(klon)
    908910    !ym A voir plus tard
    909911    !ym      REAL zm_wo(jjmp1, klev)
     
    912914    REAL zx_tmp_fi2d(klon)      ! variable temporaire grille physique
    913915    REAL zx_tmp_fi3d(klon,klev) ! variable temporaire pour champs 3D
    914     REAL zx_tmp_2d(nbp_lon,nbp_lat)
    915     REAL zx_lon(nbp_lon,nbp_lat)
    916     REAL zx_lat(nbp_lon,nbp_lat)
     916!JLD    REAL zx_tmp_2d(nbp_lon,nbp_lat)
     917!JLD    REAL zx_lon(nbp_lon,nbp_lat)
     918!JLD    REAL zx_lat(nbp_lon,nbp_lat)
    917919    !
    918920    INTEGER nid_ctesGCM
     
    930932    REAL uq_lay(klon,klev) ! transport zonal de l'eau a chaque niveau vert.
    931933    !
    932     REAL zjulian
    933     SAVE zjulian
    934 !$OMP THREADPRIVATE(zjulian)
    935 
    936     INTEGER nhori, nvert
    937     REAL zsto
    938     REAL zstophy, zout
     934!JLD    REAL zjulian
     935!JLD    SAVE zjulian
     936!JLD!$OMP THREADPRIVATE(zjulian)
     937
     938!JLD    INTEGER nhori, nvert
     939!JLD    REAL zsto
     940!JLD    REAL zstophy, zout
    939941
    940942    character*20 modname
     
    950952    parameter (prof2d_on = 1, prof3d_on = 2, &
    951953         prof2d_av = 3, prof3d_av = 4)
    952     !     Variables liees au bilan d'energie et d'enthalpi
    953954    REAL ztsol(klon)
    954     REAL      d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec
    955     REAL      d_h_vcol_phy
    956     REAL      fs_bound, fq_bound
    957     SAVE      d_h_vcol_phy
    958     !$OMP THREADPRIVATE(d_h_vcol_phy)
    959     REAL      zero_v(klon)
    960     CHARACTER*40 ztit
    961     INTEGER   ip_ebil  ! PRINT level for energy conserv. diag.
    962     SAVE      ip_ebil
    963     DATA      ip_ebil/0/
    964     !$OMP THREADPRIVATE(ip_ebil)
    965955    REAL q2m(klon,nbsrf)  ! humidite a 2m
    966956
    967957    !IM: t2m, q2m, ustar, u10m, v10m et t2mincels, t2maxcels
    968958    CHARACTER*40 t2mincels, t2maxcels       !t2m min., t2m max
    969     CHARACTER*40 tinst, tave, typeval
     959    CHARACTER*40 tinst, tave
    970960    REAL cldtaupi(klon,klev) ! Cloud optical thickness for
    971961    ! pre-industrial (pi) aerosols
     
    10251015    ! vars_climoz(1:read_climoz): variables names in climoz file.
    10261016
    1027     INTEGER ierr
    10281017    include "YOMCST.h"
    10291018    include "YOETHF.h"
     
    10391028    ! Declarations pour Simulateur COSP
    10401029    !============================================================
     1030#ifdef CPP_COSP
    10411031    real :: mr_ozone(klon,klev)
    1042 
     1032#endif
    10431033    !IM stations CFMIP
    10441034    INTEGER, SAVE :: nCFMIP
     
    10891079    !--OB variables for mass fixer (hard coded for now)
    10901080    logical, parameter :: mass_fixer=.false.
    1091     real qql1(klon),qql2(klon),zdz,corrqql
     1081    real qql1(klon),qql2(klon),corrqql
    10921082
    10931083    ! Ehouarn: set value of jjmp1 since it is no longer a "fixed parameter"
     
    11931183
    11941184    modname = 'physiq'
    1195     !IM
    1196     IF (ip_ebil_phy.ge.1) THEN
    1197        DO i=1,klon
    1198           zero_v(i)=0.
    1199        ENDDO
    1200     ENDIF
    12011185
    12021186    IF (debut) THEN
     
    12101194       iflag_wake_tend = 0
    12111195       CALL getin_p('iflag_wake_tend',iflag_wake_tend)
     1196       ok_bad_ecmwf_thermo=.TRUE. ! By default thermodynamical constants are set
     1197                                  ! in rrtm/suphec.F90 (and rvtmp2 is set to 0).
     1198       CALL getin_p('ok_bad_ecmwf_thermo',ok_bad_ecmwf_thermo)
     1199       fl_ebil = 0 ! by default, conservation diagnostics are desactivated
     1200       CALL getin_p('fl_ebil',fl_ebil)
     1201       fl_cor_ebil = 0 ! by default, no correction to ensure energy conservation
     1202       CALL getin_p('fl_cor_ebil',fl_cor_ebil)
    12121203    ENDIF
    12131204
     
    12731264       clwcon(:,:) = 0.0
    12741265
    1275        !IM     
    1276        IF (ip_ebil_phy.ge.1) d_h_vcol_phy=0.
    12771266       !
    12781267       print*,'iflag_coupl,iflag_clos,iflag_wake', &
     
    20081997     CALL add_phys_tend &
    20091998            (du0,dv0,d_t_eva,d_q_eva,d_ql_eva,d_qi_eva,paprs,&
    2010                'eva',abortphy,flag_inhib_tend)
     1999               'eva',abortphy,flag_inhib_tend,itap)
     2000    call prt_enerbil('eva',itap)
    20112001
    20122002    !=========================================================================
     
    22302220          CALL add_pbl_tend &
    22312221               (d_u_vdf,d_v_vdf,d_t_vdf+d_t_diss,d_q_vdf,dql0,dqi0,paprs,&
    2232                'vdf',abortphy,flag_inhib_tend)
     2222               'vdf',abortphy,flag_inhib_tend,itap)
    22332223       ELSE
    22342224          CALL add_phys_tend &
    22352225               (d_u_vdf,d_v_vdf,d_t_vdf+d_t_diss,d_q_vdf,dql0,dqi0,paprs,&
    2236                'vdf',abortphy,flag_inhib_tend)
    2237        ENDIF
     2226               'vdf',abortphy,flag_inhib_tend,itap)
     2227       ENDIF
     2228       call prt_enerbil('vdf',itap)
    22382229       !--------------------------------------------------------------------
    22392230
     
    26162607
    26172608    CALL add_phys_tend(d_u_con, d_v_con, d_t_con, d_q_con, dql0, dqi0, paprs, &
    2618          'convection',abortphy,flag_inhib_tend)
     2609         'convection',abortphy,flag_inhib_tend,itap)
     2610    call prt_enerbil('convection',itap)
    26192611
    26202612    !-------------------------------------------------------------------------
     
    27452737       ! ajout des tendances des poches froides
    27462738       CALL add_phys_tend(du0,dv0,d_t_wake,d_q_wake,dql0,dqi0,paprs,'wake', &
    2747             abortphy,flag_inhib_tend)
     2739            abortphy,flag_inhib_tend,itap)
     2740       call prt_enerbil('wake',itap)
    27482741       !------------------------------------------------------------------------
    27492742
     
    27542747            (d_deltat_wk, d_deltaq_wk, d_s_wk, d_dens_wk, wake_k, &
    27552748             'wake', abortphy)
    2756 
     2749          call prt_enerbil('wake',itap)
    27572750       ENDIF   ! (iflag_wake_tend .GT. 0.)
    27582751
     
    28752868             CALL add_wake_tend &
    28762869                 (d_deltat_the, d_deltaq_the, dsig0, ddens0, wkoccur1, 'the', abortphy)
     2870             call prt_enerbil('the',itap)
    28772871          !
    28782872          ENDIF  ! (mod(iflag_pbl_split/2,2) .EQ. 1)
    28792873          !
    28802874          CALL add_phys_tend(d_u_ajs,d_v_ajs,d_t_ajs,d_q_ajs,  &
    2881                              dql0,dqi0,paprs,'thermals', abortphy,flag_inhib_tend)
     2875                             dql0,dqi0,paprs,'thermals', abortphy,flag_inhib_tend,itap)
     2876          call prt_enerbil('thermals',itap)
    28822877          !
    28832878!
     
    29412936          ! ajout des tendances de l'ajustement sec ou des thermiques
    29422937          CALL add_phys_tend(du0,dv0,d_t_ajsb,d_q_ajsb,dql0,dqi0,paprs, &
    2943                'ajsb',abortphy,flag_inhib_tend)
     2938               'ajsb',abortphy,flag_inhib_tend,itap)
     2939          call prt_enerbil('ajsb',itap)
    29442940          d_t_ajs(:,:)=d_t_ajs(:,:)+d_t_ajsb(:,:)
    29452941          d_q_ajs(:,:)=d_q_ajs(:,:)+d_q_ajsb(:,:)
     
    29842980    WHERE (snow_lsc < 0) snow_lsc = 0.
    29852981
     2982!+JLD
     2983!    write(*,9000) 'phys lsc',"enerbil: bil_q, bil_e,",rain_lsc+snow_lsc &
     2984!        & ,((rcw-rcpd)*rain_lsc + (rcs-rcpd)*snow_lsc)*t_seri(1,1)-rlvtt*rain_lsc+rlstt*snow_lsc &
     2985!        & ,rain_lsc,snow_lsc
     2986!    write(*,9000) "rcpv","rcw",rcpv,rcw,rcs,t_seri(1,1)
     2987!-JLD
    29862988    CALL add_phys_tend(du0,dv0,d_t_lsc,d_q_lsc,d_ql_lsc,d_qi_lsc,paprs, &
    2987          'lsc',abortphy,flag_inhib_tend)
     2989         'lsc',abortphy,flag_inhib_tend,itap)
     2990    call prt_enerbil('lsc',itap)
    29882991    rain_num(:)=0.
    29892992    DO k = 1, klev
     
    37643767    ENDDO
    37653768
    3766     CALL add_phys_tend(du0,dv0,d_t_swr,dq0,dql0,dqi0,paprs,'SW',abortphy,flag_inhib_tend)
    3767     CALL add_phys_tend(du0,dv0,d_t_lwr,dq0,dql0,dqi0,paprs,'LW',abortphy,flag_inhib_tend)
     3769    CALL add_phys_tend(du0,dv0,d_t_swr,dq0,dql0,dqi0,paprs,'SW',abortphy,flag_inhib_tend,itap)
     3770    call prt_enerbil('SW',itap)
     3771    CALL add_phys_tend(du0,dv0,d_t_lwr,dq0,dql0,dqi0,paprs,'LW',abortphy,flag_inhib_tend,itap)
     3772    call prt_enerbil('LW',itap)
    37683773
    37693774    !
     
    38353840       ! ajout des tendances de la trainee de l'orographie
    38363841       CALL add_phys_tend(d_u_oro,d_v_oro,d_t_oro,dq0,dql0,dqi0,paprs,'oro', &
    3837             abortphy,flag_inhib_tend)
     3842            abortphy,flag_inhib_tend,itap)
     3843       call prt_enerbil('oro',itap)
    38383844       !----------------------------------------------------------------------
    38393845       !
     
    38813887       ! ajout des tendances de la portance de l'orographie
    38823888       CALL add_phys_tend(d_u_lif, d_v_lif, d_t_lif, dq0, dql0, dqi0, paprs, &
    3883             'lif', abortphy,flag_inhib_tend)
     3889            'lif', abortphy,flag_inhib_tend,itap)
     3890       call prt_enerbil('lif',itap)
    38843891    ENDIF ! fin de test sur ok_orolf
    38853892
     
    39043911       d_t_hin(:, :)=0.
    39053912       CALL add_phys_tend(du_gwd_hines, dv_gwd_hines, d_t_hin, dq0, dql0, &
    3906             dqi0, paprs, 'hin', abortphy,flag_inhib_tend)
     3913            dqi0, paprs, 'hin', abortphy,flag_inhib_tend,itap)
     3914       call prt_enerbil('hin',itap)
    39073915    ENDIF
    39083916
     
    39213929
    39223930       CALL add_phys_tend(du_gwd_front, dv_gwd_front, dt0, dq0, dql0, dqi0, &
    3923             paprs, 'front_gwd_rando', abortphy,flag_inhib_tend)
     3931            paprs, 'front_gwd_rando', abortphy,flag_inhib_tend,itap)
     3932       call prt_enerbil('front_gwd_rando',itap)
    39243933    ENDIF
    39253934
     
    39293938            du_gwd_rando, dv_gwd_rando, east_gwstress, west_gwstress)
    39303939       CALL add_phys_tend(du_gwd_rando, dv_gwd_rando, dt0, dq0, dql0, dqi0, &
    3931             paprs, 'flott_gwd_rando', abortphy,flag_inhib_tend)
     3940            paprs, 'flott_gwd_rando', abortphy,flag_inhib_tend,itap)
     3941       call prt_enerbil('flott_gwd_rando',itap)
    39323942       zustr_gwd_rando=0.
    39333943       zvstr_gwd_rando=0.
     
    39793989       ! ajout de la tendance d'humidite due au methane
    39803990       CALL add_phys_tend(du0, dv0, dt0, d_q_ch4*dtime, dql0, dqi0, paprs, &
    3981             'q_ch4', abortphy,flag_inhib_tend)
     3991            'q_ch4', abortphy,flag_inhib_tend,itap)
    39823992    ENDIF
    39833993    !
Note: See TracChangeset for help on using the changeset viewer.