Ignore:
Timestamp:
Dec 12, 2025, 5:26:10 PM (6 weeks ago)
Author:
Sebastien Nguyen
Message:

Changes to compile LMDZ-OR-ISO and wrtie output variables Rsol isotopes soil ratio) xtevap xtcoastal xtrivflu. Changes from CA and ND to write output variables xtprw (precipitatble water) uxt and vxt (meridional and zonal advected humidity) Rlandice and xtsnow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/pbl_surface_mod.F90

    r5894 r5927  
    3434  USE config_ocean_skin_m, ONLY : activate_ocean_skin
    3535#ifdef ISO
    36   USE infotrac_phy, ONLY: niso,ntraciso=>ntiso   
     36  USE infotrac_phy, ONLY: niso,ntraciso=>ntiso
     37  USE phys_local_var_mod, ONLY: Rsol !! SN soil isotope ratio for LMDZORISO
    3738#endif
    3839
     
    6162
    6263#ifdef ISO
    63   REAL, ALLOCATABLE, DIMENSION(:,:,:), PRIVATE, SAVE   :: xtsnow   ! snow at surface
     64  REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE   :: xtsnow   ! snow at surface
    6465  !$OMP THREADPRIVATE(xtsnow)
    65   REAL, ALLOCATABLE, DIMENSION(:,:), PRIVATE, SAVE   :: Rland_ice   ! snow at surface
     66  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: Rland_ice  ! ice bucket bellow snowpack
    6667  !$OMP THREADPRIVATE(Rland_ice) 
    67   REAL, ALLOCATABLE, DIMENSION(:,:), PRIVATE, SAVE   :: Roce   ! snow at surface
     68  REAL, ALLOCATABLE, DIMENSION(:,:), PRIVATE, SAVE   :: Roce
    6869  !$OMP THREADPRIVATE(Roce) 
    6970#endif
     
    9192!GG
    9293!  SUBROUTINE pbl_surface_init(fder_rst, snow_rst, qsurf_rst, ftsoil_rst)
    93   SUBROUTINE pbl_surface_init(fder_rst, snow_rst, qsurf_rst, ftsoil_rst, hice_rst,tice_rst,bilg_cumul_rst)
     94  SUBROUTINE pbl_surface_init(fder_rst, snow_rst, qsurf_rst, ftsoil_rst, hice_rst, tice_rst, bilg_cumul_rst)
    9495!GG
    9596
     
    234235
    235236#ifdef ISO
    236   SUBROUTINE pbl_surface_init_iso(xtsnow_rst,Rland_ice_rst)
     237  SUBROUTINE pbl_surface_init_iso(xtsnow_rst,Rland_ice_rst,Rsol_rst)
    237238
    238239! This routine should be called after the restart file has been read.
     
    251252! Input variables
    252253!****************************************************************************************
    253     REAL, DIMENSION(niso,klon, nbsrf), INTENT(IN)          :: xtsnow_rst
    254     REAL, DIMENSION(niso,klon), INTENT(IN)          :: Rland_ice_rst
     254    REAL, DIMENSION(niso,klon, nbsrf), INTENT(IN)   :: xtsnow_rst
     255    REAL, DIMENSION(niso,klon), INTENT(IN)          :: Rland_ice_rst, Rsol_rst
    255256 
    256257! Local variables
     
    259260    CHARACTER(len=80)             :: abort_message
    260261    CHARACTER(len = 20)           :: modname = 'pbl_surface_init'
    261     integer i,ixt
     262    INTEGER                       :: i,ixt
    262263   
    263264!****************************************************************************************
     
    277278    xtsnow(:,:,:)  = xtsnow_rst(:,:,:)
    278279    Rland_ice(:,:) = Rland_ice_rst(:,:)
     280    Rsol(:,:)      = Rsol_rst(:,:)
    279281    Roce(:,:)      = 0.0
    280282
     
    283285         CALL iso_verif_egalite_vect2D( &
    284286     &           xtsnow,snow, &
    285      &           'pbl_surface_mod 170',niso,klon,nbsrf)
     287     &           'pbl_surface_mod 286',niso,klon,nbsrf)
    286288         DO i=1,klon 
    287289            IF (iso_eau >= 0) THEN 
    288290              CALL iso_verif_egalite(Rland_ice(iso_eau,i),1.0, &
    289      &         'pbl_surf_mod 177')
     291     &         'pbl_surf_mod 290')
     292              CALL iso_verif_egalite(Rsol(iso_eau,i),1.0, &
     293     &         'pbl_surf_mod 292')
    290294            ENDIF
    291295         ENDDO
     
    371375!!!
    372376#ifdef ISO
    373      &   ,xtrain_f, xtsnow_f,xt, &
     377     &   ,xtrain_f,xtsnow_f,xt, &
    374378     &   wake_dlxt,zxxtevap,xtevap, &
    375379     &   d_xt,d_xt_w,d_xt_x, &
    376380     &   xtsol,dflux_xt,zxxtsnow,zxfluxxt,flux_xt, &
    377      &   h1_diag,runoff_diag,xtrunoff_diag &
     381     &   h1_diag,runoff_diag,xtrunoff_diag, &
     382     &   xtriverflow,xtcoastalflow &
    378383#endif     
    379384     &   )
     
    458463    USE carbon_cycle_mod,   ONLY : carbon_cycle_cpl, carbon_cycle_tr, level_coupling_esm
    459464    USE carbon_cycle_mod,   ONLY : co2_send, nbcf_out, fields_out, yfields_out, cfname_out
    460     use hbtm_mod, only: hbtm
     465    USE hbtm_mod,           ONLY : hbtm
    461466    USE indice_sol_mod
    462467    USE time_phylmdz_mod,   ONLY : day_ini,annee_ref,itau_phy
     
    464469    USE print_control_mod,  ONLY : prt_level,lunout
    465470#ifdef ISO
    466   USE isotopes_mod, ONLY: Rdefault,iso_eau
     471    USE isotopes_mod, ONLY: Rdefault,iso_eau
    467472#ifdef ISOVERIF
    468         USE isotopes_verif_mod
     473    USE isotopes_verif_mod
    469474#endif
    470475#ifdef ISOTRAC
    471         USE isotrac_mod, only: index_iso
    472 #endif
    473 #endif
    474 USE dimpft_mod_h
     476    USE isotrac_mod, ONLY: index_iso
     477#endif
     478#endif
     479    USE dimpft_mod_h
    475480    USE flux_arp_mod_h
    476481    USE compbl_mod_h
    477482    USE yoethf_mod_h
    478         USE clesphys_mod_h
     483    USE clesphys_mod_h
    479484    USE ioipsl_getin_p_mod, ONLY : getin_p
    480     use phys_state_var_mod, only: ds_ns, dt_ns, delta_sst, delta_sal, dter, &
     485    USE phys_state_var_mod, ONLY : ds_ns, dt_ns, delta_sst, delta_sal, dter, &
    481486         dser, dt_ds, zsig, zmea, &
    482487         frac_tersrf, z0m_tersrf, ratio_z0m_z0h_tersrf, albedo_tersrf !AM
    483     use phys_output_var_mod, only: tkt, tks, taur, sss
    484     use lmdz_blowing_snow_ini, only : zeta_bs
    485     use wxios_mod, ONLY: missing_val_xios => missing_val, using_xios
    486     USE netcdf, only: missing_val_netcdf => nf90_fill_real
    487     USE dimsoil_mod_h, ONLY: nsoilmx
    488     USE surf_param_mod, ONLY: eff_surf_param  !AM
     488    USE phys_output_var_mod, ONLY : tkt, tks, taur, sss
     489    USE lmdz_blowing_snow_ini, ONLY : zeta_bs
     490    USE wxios_mod, ONLY : missing_val_xios => missing_val, using_xios
     491    USE netcdf, ONLY : missing_val_netcdf => nf90_fill_real
     492    USE dimsoil_mod_h, ONLY : nsoilmx
     493    USE surf_param_mod, ONLY : eff_surf_param  !AM
    489494
    490495    USE yomcst_mod_h
    491 IMPLICIT NONE
     496
     497    IMPLICIT NONE
    492498
    493499    INCLUDE "FCTTRE.h"
     
    619625#ifdef ISO
    620626    REAL, DIMENSION(ntraciso,klon),        INTENT(OUT)       :: zxxtevap     ! water vapour flux at surface, positiv upwards
    621     REAL, DIMENSION(ntraciso,klon, klev),  INTENT(OUT)       :: d_xt        ! change in water vapour
     627    REAL, DIMENSION(ntraciso,klon, klev),  INTENT(OUT)       :: d_xt         ! change in water vapour
    622628    REAL, DIMENSION(klon),                 INTENT(OUT)       :: runoff_diag
    623629    REAL, DIMENSION(niso,klon),            INTENT(OUT)       :: xtrunoff_diag
     630    REAL, DIMENSION(niso,klon),            INTENT(OUT)       :: xtriverflow   ! PRSN LMDZORISO variables
     631    REAL, DIMENSION(niso,klon),            INTENT(OUT)       :: xtcoastalflow ! PRSN Fin
    624632    REAL, DIMENSION(ntraciso,klon,klev),   INTENT(OUT)       :: d_xt_w
    625633    REAL, DIMENSION(ntraciso,klon,klev),   INTENT(OUT)       :: d_xt_x
     
    794802    REAL, DIMENSION(niso,klon)         :: yxtrunoff_diag
    795803    REAL, DIMENSION(niso,klon)         :: yRland_ice   
     804    REAL, DIMENSION(niso,klon)         :: yxtriverflow
     805    REAL, DIMENSION(niso,klon)         :: yxtcoastalflow
     806    REAL, DIMENSION(niso,klon)         :: yRsol
    796807#endif
    797808    REAL, DIMENSION(klon)              :: ysolsw, ysollw
     
    804815    REAL, DIMENSION(klon)              :: y_dflux_t, y_dflux_q
    805816#ifdef ISO
    806     REAL, DIMENSION(ntraciso,klon)     ::  y_flux_xt1
    807     REAL, DIMENSION(ntraciso,klon)     ::  y_dflux_xt
     817    REAL, DIMENSION(ntraciso,klon)     :: y_flux_xt1
     818    REAL, DIMENSION(ntraciso,klon)     :: y_dflux_xt
    808819#endif
    809820    REAL, DIMENSION(klon)              :: y_flux_u1, y_flux_v1
     
    11971208      DO i=1,klon
    11981209        DO ixt=1,niso
    1199           CALL iso_verif_noNaN(xtsol(ixt,i),'pbl_surface 608')
     1210          CALL iso_verif_noNaN(xtsol(ixt,i),'pbl_surface 1209')
    12001211        ENDDO
    12011212      ENDDO
     
    12051216        IF (iso_eau >= 0) THEN 
    12061217          CALL iso_verif_egalite_choix(Rland_ice(iso_eau,i),1.0, &
    1207      &         'pbl_surf_mod 585',errmax,errmaxrel)
     1218     &         'pbl_surf_mod 1216',errmax,errmaxrel)
    12081219          CALL iso_verif_egalite_choix(xtsnow_f(iso_eau,i),snow_f(i), &
    1209      &         'pbl_surf_mod 594',errmax,errmaxrel)
     1220     &         'pbl_surf_mod 1218',errmax,errmaxrel)
    12101221          IF (iso_verif_egalite_choix_nostop(xtsol(iso_eau,i),qsol(i), &
    1211      &         'pbl_surf_mod 596',errmax,errmaxrel) == 1) THEN
     1222     &         'pbl_surf_mod 1220',errmax,errmaxrel) == 1) THEN
    12121223                WRITE(*,*) 'i=',i
    12131224                STOP
     
    12151226          DO nsrf=1,nbsrf
    12161227            CALL iso_verif_egalite_choix(xtsnow(iso_eau,i,nsrf),snow(i,nsrf), &
    1217      &         'pbl_surf_mod 598',errmax,errmaxrel)
     1228     &         'pbl_surf_mod 1226',errmax,errmaxrel)
    12181229          ENDDO
    12191230        ENDIF !IF (iso_eau >= 0) THEN   
     
    12231234          IF (iso_eau >= 0) THEN 
    12241235            CALL iso_verif_egalite_choix(xt(iso_eau,i,k),q(i,k), &
    1225      &           'pbl_surf_mod 595',errmax,errmaxrel)
     1236     &           'pbl_surf_mod 1234',errmax,errmaxrel)
    12261237          ENDIF !IF (iso_eau >= 0) THEN 
    12271238        ENDDO !DO i=1,knon 
     
    14601471   flux_xt = 0.0
    14611472   yRland_ice = 0.0
     1473   yrunoff_diag = 0.0
     1474   yxtrunoff_diag = 0.0
     1475   yxtriverflow = 0.0
     1476   yxtcoastalflow = 0.0
     1477   yRsol = 0.0
    14621478!   d_xt = 0.0     
    14631479   y_dflux_xt = 0.0 
     
    18211837          !IF (nsrf == is_lic) THEN
    18221838          DO ixt=1,niso
    1823             yRland_ice(ixt,j)= Rland_ice(ixt,i) 
     1839            yRland_ice(ixt,j)    = Rland_ice(ixt,i) 
     1840            yxtriverflow(ixt,j)  = xtriverflow(ixt,i)
     1841            yxtcoastalflow(ixt,j)= xtcoastalflow(ixt,i)
     1842            yRsol(ixt,j)         = Rsol(ixt,i)
    18241843          ENDDO   
    18251844          !endif !IF (nsrf == is_lic) THEN
     
    25862605         &      ,yxtrain_f, yxtsnow_f,yxt1, &
    25872606         &      yxtsnow,yxtsol,yxtevap,h1, &
    2588          &      yrunoff_diag,yxtrunoff_diag,yRland_ice &
     2607         &      yrunoff_diag,yxtrunoff_diag,yRland_ice, &
     2608         &      yxtriverflow,yxtcoastalflow,yRsol &
    25892609#endif               
    25902610         &      )
     
    26582678                  ypsref, yu1, yv1, ygustiness, yrugoro, pctsrf, &
    26592679                  ysnow, yqsurf, yqsol,yqbs1, yagesno, &
    2660                   ytsoil, yz0m, yz0h, SFRWL, yalb_dir_new, yalb_dif_new, yevap, yicesub_lic, yfluxsens,yfluxlat, &
     2680                  ytsoil, yz0m, yz0h, SFRWL, yalb_dir_new, yalb_dif_new, yevap, yicesub_lic, yfluxsens, yfluxlat, &
    26612681                  yfluxbs, ytsurf_new, y_dflux_t, y_dflux_q, &
    26622682                  yzmea, yzsig, ycldt, &
     
    26962716               DO ixt=1,ntraciso
    26972717                 CALL iso_verif_noNaN(yxtevap(ixt,j), &
    2698                         &             'pbl_surface 1095a: apres surf_landice')
     2718                        &             'pbl_surface 2716a: apres surf_landice')
    26992719               ENDDO
    2700                 do ixt=1,niso
    2701                    call iso_verif_noNaN(yxtsol(ixt,j), &
    2702                         &      'pbl_surface 1095b: apres surf_landice')
    2703                 enddo
    2704              enddo
     2720               DO ixt=1,niso
     2721                 CALL iso_verif_noNaN(yxtsol(ixt,j), &
     2722                        &      'pbl_surface 2720b: apres surf_landice')
     2723               ENDDO
     2724             ENDDO
    27052725#endif
    27062726#ifdef ISOVERIF
    27072727             !write(*,*) 'pbl_surface_mod 1060: sortie surf_landice'
    2708              do j=1,knon
     2728             DO j=1,knon
    27092729               IF (iso_eau >= 0) THEN     
    27102730                 CALL iso_verif_egalite(yxtsnow(iso_eau,j), &
    2711                         &               ysnow(j),'pbl_surf_mod 1064')
     2731                        &               ysnow(j),'pbl_surf_mod 2729')
    27122732               ENDIF !if (iso_eau >= 0) THEN
    27132733             ENDDO !DO i=1,klon
     
    34643484          dflux_q(i) = dflux_q(i) + y_dflux_q(j)*ypct(j)
    34653485#ifdef ISO
    3466         DO ixt=1,niso
    3467           xtsnow(ixt,i,nsrf) = yxtsnow(ixt,j) 
    3468         ENDDO
    3469         DO ixt=1,ntraciso
    3470           xtevap(ixt,i,nsrf) = - flux_xt(ixt,i,1,nsrf)
    3471           dflux_xt(ixt,i) = dflux_xt(ixt,i) + y_dflux_xt(ixt,j)*ypct(j)
    3472         ENDDO 
    3473         IF (nsrf == is_lic) THEN
    34743486          DO ixt=1,niso
    3475             Rland_ice(ixt,i) = yRland_ice(ixt,j) 
    3476           ENDDO
    3477         ENDIF !IF (nsrf == is_lic) THEN     
     3487            xtsnow(ixt,i,nsrf) = yxtsnow(ixt,j) 
     3488          ENDDO
     3489          DO ixt=1,ntraciso
     3490            xtevap(ixt,i,nsrf) = - flux_xt(ixt,i,1,nsrf)
     3491            dflux_xt(ixt,i) = dflux_xt(ixt,i) + y_dflux_xt(ixt,j)*ypct(j)
     3492          ENDDO 
     3493          IF (nsrf == is_lic) THEN
     3494            DO ixt=1,niso
     3495              Rland_ice(ixt,i) = yRland_ice(ixt,j) 
     3496            ENDDO
     3497          ENDIF !IF (nsrf == is_lic) THEN     
     3498          IF (nsrf == is_ter) THEN
     3499            DO ixt=1,niso
     3500              xtriverflow(ixt,i)  = yxtriverflow(ixt,j)
     3501              xtcoastalflow(ixt,i)= yxtcoastalflow(ixt,j)
     3502              Rsol(ixt,i) = yRsol(ixt,j) 
     3503            ENDDO
     3504          ENDIF !IF (nsrf == is_ter) THEN
    34783505#ifdef ISOVERIF
    3479         IF (iso_eau.gt.0) THEN 
    3480           call iso_verif_egalite_choix(Rland_ice(iso_eau,i),1.0, &
    3481      &         'pbl_surf_mod 1230',errmax,errmaxrel)
    3482         ENDIF !if (iso_eau.gt.0) then
     3506          IF (iso_eau.GT.0) THEN 
     3507            CALL iso_verif_egalite_choix(Rland_ice(iso_eau,i),1.0, &
     3508     &         'pbl_surf_mod 3506',errmax,errmaxrel)
     3509            CALL iso_verif_egalite_choix(Rsol(iso_eau,i),1.0, &
     3510     &         'pbl_surf_mod 3508',errmax,errmaxrel)
     3511          ENDIF !if (iso_eau.gt.0) then
    34833512#endif       
    34843513#endif
     
    44094438  SUBROUTINE pbl_surface_final(fder_rst, snow_rst, qsurf_rst, ftsoil_rst &
    44104439#ifdef ISO
    4411        ,xtsnow_rst,Rland_ice_rst &
     4440       ,xtsnow_rst,Rland_ice_rst,Rsol_rst &
    44124441#endif       
    44134442       )
     
    44314460    REAL, DIMENSION(niso,klon, nbsrf), INTENT(OUT)     :: xtsnow_rst
    44324461    REAL, DIMENSION(niso,klon), INTENT(OUT)            :: Rland_ice_rst
     4462    REAL, DIMENSION(niso,klon), INTENT(OUT)            :: Rsol_rst
    44334463#endif
    44344464
     
    44454475    xtsnow_rst(:,:,:)  = xtsnow(:,:,:)
    44464476    Rland_ice_rst(:,:) = Rland_ice(:,:)
     4477    Rsol_rst(:,:)     = Rsol(:,:)
    44474478#endif
    44484479
     
    44644495    IF (ALLOCATED(xtsnow)) DEALLOCATE(xtsnow)
    44654496    IF (ALLOCATED(Rland_ice)) DEALLOCATE(Rland_ice)
     4497    IF (ALLOCATED(Rsol)) DEALLOCATE(Rsol)
    44664498    IF (ALLOCATED(Roce)) DEALLOCATE(Roce)
    44674499#endif
     
    44924524    ! Give default values where new fraction has appread
    44934525
    4494 USE compbl_mod_h
    4495         USE clesphys_mod_h
     4526    USE compbl_mod_h
     4527    USE clesphys_mod_h
    44964528    USE indice_sol_mod
    4497     use phys_state_var_mod, only: delta_sal, ds_ns, dt_ns, delta_sst, dter, &
     4529    USE phys_state_var_mod, ONLY: delta_sal, ds_ns, dt_ns, delta_sst, dter, &
    44984530         dser, dt_ds
    4499     use config_ocean_skin_m, only: activate_ocean_skin
     4531    USE config_ocean_skin_m, ONLY: activate_ocean_skin
    45004532
    45014533! Input variables
Note: See TracChangeset for help on using the changeset viewer.