Changeset 5484 for CONFIG


Ignore:
Timestamp:
10/30/20 11:37:20 (3 years ago)
Author:
aclsce
Message:

Updated LMDZ sources modified to be used in IPSLCM7 configuration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CONFIG/UNIFORM/v7/IPSLCM7/SOURCES/LMDZ/physiq_mod.F90

    r5479 r5484  
    11! 
    2 ! $Id: physiq_mod.F90 3780 2020-10-22 12:50:18Z evignon $ 
     2! $Id: physiq_mod.F90 3666 2020-04-20 10:13:34Z lfalletti $ 
    33! 
    44!#define IO_DEBUG 
     
    1616       d_u, d_v, d_t, d_qx, d_ps) 
    1717 
    18 ! For clarity, the "USE" section is now arranged in alphabetical order, 
    19 ! with a separate section for CPP keys 
    20 ! PLEASE try to follow this rule  
    21  
    22     USE ACAMA_GWD_rando_m, only: ACAMA_GWD_rando 
    23     USE aero_mod 
    24     USE add_phys_tend_mod, only : add_pbl_tend, add_phys_tend, diag_phys_tend, prt_enerbil, & 
    25   &      fl_ebil, fl_cor_ebil 
    2618    USE assert_m, only: assert 
    27     USE change_srf_frac_mod 
    28     USE conf_phys_m, only: conf_phys 
    29     USE carbon_cycle_mod, ONLY : infocfields_init, RCO2_glo, carbon_cycle_rad 
    30     USE CFMIP_point_locations   ! IM stations CFMIP 
    31     USE cmp_seri_mod 
    32     USE dimphy 
    33     USE etat0_limit_unstruct_mod 
    34     USE FLOTT_GWD_rando_m, only: FLOTT_GWD_rando 
    35     USE fonte_neige_mod, ONLY  : fonte_neige_get_vars 
    36     USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg 
    3719    USE ioipsl, only: histbeg, histvert, histdef, histend, histsync, & 
    3820         histwrite, ju2ymds, ymds2ju, getin 
    39     USE ioipsl_getin_p_mod, ONLY : getin_p 
    40     USE indice_sol_mod 
    41     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, type_trac 
    42     USE iophy 
    43     USE limit_read_mod, ONLY : init_limit_read 
    44     USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev, klon_glo, grid1dTo2d_glo, grid_type, unstructured 
    45     USE mod_phys_lmdz_mpi_data, only: is_mpi_root 
    46     USE mod_phys_lmdz_para 
    47     USE netcdf95, only: nf95_close 
    48     USE netcdf, only: nf90_fill_real     ! IM for NMC files 
    49     USE open_climoz_m, only: open_climoz ! ozone climatology from a file 
    50     USE ozonecm_m, only: ozonecm ! ozone of J.-F. Royer 
    51     USE pbl_surface_mod, ONLY : pbl_surface 
    52     USE phyaqua_mod, only: zenang_an 
    53     USE phystokenc_mod, ONLY: offline, phystokenc 
     21    USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg 
    5422    USE phys_cal_mod, only: year_len, mth_len, days_elapsed, jh_1jan, & 
    5523         year_cur, mth_cur,jD_cur, jH_cur, jD_ref, day_cur, hour 
    56 !!  USE phys_local_var_mod, ONLY : a long list of variables 
    57 !!              ==> see below, after "CPP Keys" section 
    58     USE phys_state_var_mod ! Variables sauvegardees de la physique 
    59     USE phys_output_mod 
    60     USE phys_output_ctrlout_mod 
     24    USE write_field_phy 
     25    USE dimphy 
     26    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, type_trac 
     27    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev, klon_glo, grid1dTo2d_glo, grid_type, unstructured 
     28    USE mod_phys_lmdz_para 
     29    USE iophy 
    6130    USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level 
    62     USE readaerosol_mod, ONLY : init_aero_fromfile 
    63     USE readaerosolstrato_m, ONLY : init_readaerosolstrato 
    64     USE radlwsw_m, only: radlwsw 
    65     USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz 
    66     USE regr_pr_time_av_m, only: regr_pr_time_av 
     31    USE phystokenc_mod, ONLY: offline, phystokenc 
     32    USE time_phylmdz_mod, only: raz_date, day_step_phy, update_time,current_time 
     33    USE vampir 
     34    USE pbl_surface_mod, ONLY : pbl_surface 
     35    USE change_srf_frac_mod 
    6736    USE surface_data,     ONLY : type_ocean, ok_veget, ok_snow 
    68     USE time_phylmdz_mod, only: annee_ref, current_time, day_ini, day_ref, & 
    69           day_step_phy, itau_phy, pdtphys, raz_date, start_time, update_time 
    70     USE tracinca_mod, ONLY: config_inca 
    7137    USE tropopause_m,     ONLY: dyn_tropopause 
    72     USE vampir 
    73     USE VERTICAL_LAYERS_MOD, ONLY: aps,bps, ap, bp 
    74     USE write_field_phy 
    75  
    76     !USE cmp_seri_mod 
    77 !    USE add_phys_tend_mod, only : add_pbl_tend, add_phys_tend, diag_phys_tend, prt_enerbil, & 
    78 !  &      fl_ebil, fl_cor_ebil 
    79  
    80 !!!!!!!!!!!!!!!!!! "USE" section for CPP keys !!!!!!!!!!!!!!!!!!!!!!!! 
    81 ! 
    82 ! 
    8338#ifdef CPP_Dust 
    84     USE phytracr_spl_mod, ONLY: phytracr_spl, phytracr_spl_out_init 
    85     USE phys_output_write_spl_mod 
    86 #else 
    87     USE phytrac_mod, ONLY : phytrac_init, phytrac 
    88     USE phys_output_write_mod 
     39    USE phytracr_spl_mod, ONLY: phytracr_spl 
    8940#endif 
    90  
    91  
    92 #ifdef REPROBUS 
    93     USE CHEM_REP, ONLY : Init_chem_rep_xjour, & 
    94          d_q_rep,d_ql_rep,d_qi_rep,ptrop,ttrop, & 
    95          ztrop, gravit,itroprep, Z1,Z2,fac,B 
    96 #endif 
    97  
    98  
    99 #ifdef CPP_RRTM 
    100     USE YOERAD, ONLY : NRADLP 
    101     USE YOESW, ONLY : RSUN 
    102 #endif 
    103  
    104  
    10541#ifdef CPP_StratAer 
    10642    USE strataer_mod, ONLY: strataer_init 
    10743#endif 
    108  
    109  
    110 #ifdef CPP_XIOS 
    111     USE xios, ONLY: xios_update_calendar, xios_context_finalize, & 
    112             xios_get_field_attr, xios_field_is_active 
    113     USE wxios, ONLY: missing_val, missing_val_omp 
    114 #endif 
    115 #ifndef CPP_XIOS 
    116     USE paramLMDZ_phy_mod 
    117 #endif 
    118 ! 
    119 ! 
    120 !!!!!!!!!!!!!!!!!!  END "USE" for CPP keys !!!!!!!!!!!!!!!!!!!!!! 
    121  
    122 USE phys_local_var_mod, ONLY: phys_local_var_init, phys_local_var_end, & 
     44    USE phys_local_var_mod, ONLY: phys_local_var_init, phys_local_var_end, & 
    12345       ! [Variables internes non sauvegardees de la physique] 
    12446       ! Variables locales pour effectuer les appels en serie 
     
    273195       ref_liq, ref_ice, theta,  & 
    274196       ref_liq_pi, ref_ice_pi,  & 
    275        zphi, zx_rh, zx_rhl, zx_rhi, & 
     197       zphi, zx_rh, & 
    276198       pmfd, pmfu,  & 
    277199       ! 
     
    294216       zxsnow,snowhgt,qsnow,to_ice,sissnow,runoff,albsol3_lic 
    295217       ! 
    296  
     218    USE phys_state_var_mod ! Variables sauvegardees de la physique 
     219#ifdef CPP_Dust 
     220    USE phys_output_write_spl_mod 
     221#else 
     222    USE phys_output_var_mod ! Variables pour les ecritures des sorties 
     223#endif 
     224 
     225    USE phys_output_write_mod 
     226    USE fonte_neige_mod, ONLY  : fonte_neige_get_vars 
     227    USE phys_output_mod 
     228    USE phys_output_ctrlout_mod 
     229    USE open_climoz_m, only: open_climoz ! ozone climatology from a file 
     230    USE regr_pr_time_av_m, only: regr_pr_time_av 
     231    USE netcdf95, only: nf95_close 
     232    !IM for NMC files 
     233    USE netcdf, only: nf90_fill_real 
     234    USE mod_phys_lmdz_mpi_data, only: is_mpi_root 
     235    USE aero_mod 
     236    USE ozonecm_m, only: ozonecm ! ozone of J.-F. Royer 
     237    USE conf_phys_m, only: conf_phys 
     238    USE radlwsw_m, only: radlwsw 
     239    USE phyaqua_mod, only: zenang_an 
     240    USE time_phylmdz_mod, only: day_step_phy, annee_ref, day_ref, itau_phy, & 
     241         start_time, pdtphys, day_ini 
     242    USE tracinca_mod, ONLY: config_inca 
     243#ifdef CPP_XIOS 
     244    USE wxios, ONLY: missing_val, missing_val_omp 
     245    USE xios, ONLY: xios_get_field_attr, xios_field_is_active 
     246#endif 
     247#ifdef REPROBUS 
     248    USE CHEM_REP, ONLY : Init_chem_rep_xjour, & 
     249         d_q_rep,d_ql_rep,d_qi_rep,ptrop,ttrop, & 
     250         ztrop, gravit,itroprep, Z1,Z2,fac,B 
     251#endif 
     252    USE indice_sol_mod 
     253    USE phytrac_mod, ONLY : phytrac_init, phytrac 
     254    USE carbon_cycle_mod, ONLY : infocfields_init, RCO2_glo, carbon_cycle_rad 
     255 
     256#ifdef CPP_RRTM 
     257    USE YOERAD, ONLY : NRADLP 
     258    USE YOESW, ONLY : RSUN 
     259#endif 
     260    USE ioipsl_getin_p_mod, ONLY : getin_p 
     261 
     262#ifndef CPP_XIOS 
     263    USE paramLMDZ_phy_mod 
     264#endif 
     265 
     266    USE cmp_seri_mod 
     267    USE add_phys_tend_mod, only : add_pbl_tend, add_phys_tend, diag_phys_tend, prt_enerbil, & 
     268  &      fl_ebil, fl_cor_ebil 
     269 
     270    !IM stations CFMIP 
     271    USE CFMIP_point_locations 
     272    USE FLOTT_GWD_rando_m, only: FLOTT_GWD_rando 
     273    USE ACAMA_GWD_rando_m, only: ACAMA_GWD_rando 
     274    USE VERTICAL_LAYERS_MOD, ONLY: aps,bps, ap, bp 
     275    USE etat0_limit_unstruct_mod 
     276#ifdef CPP_XIOS 
     277    USE xios, ONLY: xios_update_calendar, xios_context_finalize 
     278#endif 
     279    USE limit_read_mod, ONLY : init_limit_read 
     280    USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz 
     281    USE readaerosol_mod, ONLY : init_aero_fromfile 
     282    USE readaerosolstrato_m, ONLY : init_readaerosolstrato 
    297283 
    298284    IMPLICIT NONE 
     
    13611347       iflag_phytrac = 1 ! by default we do want to call phytrac 
    13621348       CALL getin_p('iflag_phytrac',iflag_phytrac) 
    1363 #ifdef CPP_Dust 
    1364        IF (iflag_phytrac.EQ.0) THEN  
    1365          WRITE(lunout,*) 'In order to run with SPLA, iflag_phytrac will be forced to 1' 
    1366          iflag_phytrac = 1 
    1367        ENDIF 
    1368 #endif   
    13691349       nvm_lmdz = 13 
    13701350       CALL getin_p('NVM',nvm_lmdz) 
     
    15351515       ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
    15361516       CALL init_iophy_new(latitude_deg,longitude_deg) 
    1537        CALL create_etat0_limit_unstruct 
    1538        CALL phyetat0 ("startphy.nc",clesphy0,tabcntr0) 
    15391517 
    15401518          !=================================================================== 
     
    16311609#ifdef CPP_COSP 
    16321610      IF (ok_cosp) THEN 
    1633 !           DO k = 1, klev 
    1634 !             DO i = 1, klon 
    1635 !               phicosp(i,k) = pphi(i,k) + pphis(i) 
    1636 !             ENDDO 
    1637 !           ENDDO 
     1611           DO k = 1, klev 
     1612             DO i = 1, klon 
     1613               phicosp(i,k) = pphi(i,k) + pphis(i) 
     1614             ENDDO 
     1615           ENDDO 
    16381616        CALL phys_cosp(itap,phys_tstep,freq_cosp, & 
    16391617               ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, & 
     
    16531631#ifdef CPP_COSP2 
    16541632        IF (ok_cosp) THEN 
    1655 !           DO k = 1, klev 
    1656 !             DO i = 1, klon 
    1657 !               phicosp(i,k) = pphi(i,k) + pphis(i) 
    1658 !             ENDDO 
    1659 !           ENDDO 
     1633           DO k = 1, klev 
     1634             DO i = 1, klon 
     1635               phicosp(i,k) = pphi(i,k) + pphis(i) 
     1636             ENDDO 
     1637           ENDDO 
    16601638          CALL phys_cosp2(itap,phys_tstep,freq_cosp, & 
    16611639               ok_mensuelCOSP,ok_journeCOSP,ok_hfCOSP, & 
     
    17031681 
    17041682       CALL iniradia(klon,klev,paprs(1,1:klev+1)) 
    1705  
    1706        ! Initialisation des champs dans phytrac* qui sont utilisés par phys_output_write* 
    1707 #ifdef CPP_Dust 
    1708        ! Quand on utilise SPLA, on force iflag_phytrac=1 
    1709        CALL phytracr_spl_out_init() 
    1710        CALL phys_output_write_spl(itap, pdtphys, paprs, pphis,                  & 
    1711                                 pplay, lmax_th, aerosol_couple,                 & 
    1712                                 ok_ade, ok_aie, ivap, ok_sync,                  & 
    1713                                 ptconv, read_climoz, clevSTD,                   & 
    1714                                 ptconvth, d_t, qx, d_qx, d_tr_dyn, zmasse,      & 
    1715                                 flag_aerosol, flag_aerosol_strat, ok_cdnc) 
    1716 #else 
    1717        ! phys_output_write écrit des variables traceurs seulement si iflag_phytrac == 1  
    1718        ! donc seulement dans ce cas on doit appeler phytrac_init() 
     1683       ! Initialisation des champs dans phytrac qui sont utilisés par phys_output_write 
    17191684       IF (iflag_phytrac == 1 ) THEN 
    17201685          CALL phytrac_init() 
    1721        ENDIF 
     1686        ENDIF 
     1687 
    17221688       CALL phys_output_write(itap, pdtphys, paprs, pphis,                    & 
    17231689                              pplay, lmax_th, aerosol_couple,                 & 
     
    17261692                              ptconvth, d_u, d_t, qx, d_qx, zmasse,           & 
    17271693                              flag_aerosol, flag_aerosol_strat, ok_cdnc) 
    1728 #endif 
    1729  
    17301694 
    17311695#ifdef CPP_XIOS 
     
    17331697#endif 
    17341698       IF(read_climoz>=1 .AND. create_etat0_limit) CALL regr_horiz_time_climoz(read_climoz,ok_daily_climoz) 
     1699       CALL create_etat0_limit_unstruct 
     1700       CALL phyetat0 ("startphy.nc",clesphy0,tabcntr0) 
    17351701 
    17361702!jyg< 
     
    25482514            longitude_deg, latitude_deg, rugoro,  zrmu0,      & 
    25492515            zsig,      sollwdown, pphi,    cldt,      & 
    2550             rain_fall, snow_fall, solsw,   solswfdiff, sollw,     & 
     2516            rain_fall, snow_fall, solsw,   sollw,     & 
    25512517            gustiness,                                & 
    25522518            t_seri,    q_seri,    u_seri,  v_seri,    & 
     
    37383704          ENDIF 
    37393705          zx_rh(i,k) = q_seri(i,k)/zx_qs 
    3740           zx_rhl(i,k) = q_seri(i,k)/(qsatl(zx_t)/pplay(i,k)) 
    3741           zx_rhi(i,k) = q_seri(i,k)/(qsats(zx_t)/pplay(i,k)) 
    37423706          zqsat(i,k)=zx_qs 
    37433707       ENDDO 
     
    41794143               heat,heat0,cool,cool0,albpla, & 
    41804144               heat_volc,cool_volc, & 
    4181                topsw,toplw,solsw,solswfdiff,sollw, & 
     4145               topsw,toplw,solsw,sollw, & 
    41824146               sollwdown, & 
    41834147               topsw0,toplw0,solsw0,sollw0, & 
     
    42664230                     heatp,heat0p,coolp,cool0p,albplap, & 
    42674231                     heat_volc,cool_volc, & 
    4268                      topswp,toplwp,solswp,solswfdiffp,sollwp, & 
     4232                     topswp,toplwp,solswp,sollwp, & 
    42694233                     sollwdownp, & 
    42704234                     topsw0p,toplw0p,solsw0p,sollw0p, & 
     
    47364700#ifdef CPP_COSPV2 
    47374701       IF (itap.eq.1.or.MOD(itap,NINT(freq_cosp/phys_tstep)).EQ.0) THEN 
    4738 !        IF (MOD(itap,NINT(freq_cosp/phys_tstep)).EQ.0) THEN 
    47394702 
    47404703          IF (prt_level .GE.10) THEN 
    47414704             print*,'freq_cosp',freq_cosp 
    47424705          ENDIF 
    4743            DO k = 1, klev 
    4744              DO i = 1, klon 
    4745                phicosp(i,k) = pphi(i,k) + pphis(i) 
    4746              ENDDO 
    4747            ENDDO 
    47484706          mr_ozone=wo(:, :, 1) * dobson_u * 1e3 / zmasse 
    47494707                 print*,'Dans physiq.F avant appel ' 
     
    48114769    ENDIF 
    48124770 
     4771    IF (iflag_phytrac == 1 ) THEN 
     4772 
    48134773#ifdef CPP_Dust 
    4814     !  Avec SPLA, iflag_phytrac est forcé =1  
    4815     CALL       phytracr_spl ( debut,lafin , jD_cur,jH_cur,iflag_con,       &  ! I 
     4774      CALL       phytracr_spl ( debut,lafin , jD_cur,jH_cur,iflag_con,       &  ! I 
    48164775                      pdtphys,ftsol,                                   &  ! I 
    48174776                      t,q_seri,paprs,pplay,RHcl,                  &  ! I 
     
    48294788 
    48304789#else 
    4831     IF (iflag_phytrac == 1 ) THEN 
    4832       CALL phytrac ( & 
     4790 
     4791    CALL phytrac ( & 
    48334792         itap,     days_elapsed+1,    jH_cur,   debut, & 
    48344793         lafin,    phys_tstep,     u, v,     t, & 
     
    48674826 
    48684827#endif 
     4828 
     4829#endif 
    48694830    ENDIF    ! (iflag_phytrac=1) 
    4870  
    4871 #endif 
    4872     !ENDIF    ! (iflag_phytrac=1) 
    48734831 
    48744832    IF (offline) THEN 
     
    51705128  CALL phys_output_write_spl(itap, pdtphys, paprs, pphis,  & 
    51715129       pplay, lmax_th, aerosol_couple,                 & 
    5172        ok_ade, ok_aie, ivap, ok_sync,                  & 
     5130       ok_ade, ok_aie, ivap, ok_sync,         & 
    51735131       ptconv, read_climoz, clevSTD,                   & 
    51745132       ptconvth, d_t, qx, d_qx, d_tr_dyn, zmasse,      & 
     
    51895147#endif 
    51905148 
    5191 ! Pour XIOS : On remet des variables a .false. apres un premier appel 
     5149! On remet des variables a .false. apres un premier appel 
    51925150    IF (debut) THEN 
    51935151#ifdef CPP_XIOS 
Note: See TracChangeset for help on using the changeset viewer.