New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 11334 for NEMO/branches/2019/dev_r11265_ASINTER-01_Guillaume_ABL1D/src/OCE/DIA/diawri.F90 – NEMO

Ignore:
Timestamp:
2019-07-24T11:20:42+02:00 (5 years ago)
Author:
flemarie
Message:

Follow-on to the ABL implementation (see ticket #2131)

  • Modification of diawri.F90 to output ABL variables with IOIPSL (i.e. without key_iomput)
  • Modification of ice_var_agg in icevar.F90 to allow the use of tm_su in ABL and bulk
  • Error handling in case ln_abl = .true. and ABL sources were not compiled
  • ABL now works with SI3 considering an average over ice categories
  • Update reference namelist to avoid runtime warnings due to nam_tide
  • Sanity checks with ORCA2 for the following configurations :

1 - ABL src + ln_blk = .true.
2 - ABL src + ln_abl = .true.
3 - no ABL src + ln_blk = .true.

All configurations are MPP reproducible and configurations 1 and 3 results are identical

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11265_ASINTER-01_Guillaume_ABL1D/src/OCE/DIA/diawri.F90

    r10425 r11334  
    2626   !!---------------------------------------------------------------------- 
    2727   USE oce            ! ocean dynamics and tracers  
     28   USE abl            ! abl variables in case ln_abl = .true. 
    2829   USE dom_oce        ! ocean space and time domain 
    2930   USE phycst         ! physical constants 
     
    6667   PUBLIC   dia_wri_state 
    6768   PUBLIC   dia_wri_alloc           ! Called by nemogcm module 
    68  
     69#if ! defined key_iomput    
     70   PUBLIC   dia_wri_alloc_abl       ! Called by sbcabl  module (if ln_abl = .true.) 
     71#endif 
    6972   INTEGER ::   nid_T, nz_T, nh_T, ndim_T, ndim_hT   ! grid_T file 
    70    INTEGER ::          nb_T              , ndim_bT   ! grid_T file 
     73   INTEGER ::          nb_T, ndim_bT                 ! grid_T file 
    7174   INTEGER ::   nid_U, nz_U, nh_U, ndim_U, ndim_hU   ! grid_U file 
    7275   INTEGER ::   nid_V, nz_V, nh_V, ndim_V, ndim_hV   ! grid_V file 
    7376   INTEGER ::   nid_W, nz_W, nh_W                    ! grid_W file 
     77   INTEGER ::   ndim_A, ndim_hA   ! grid_T file    
     78   INTEGER ::   nid_A, nz_A, nh_A                    ! grid_ABL file    
    7479   INTEGER ::   ndex(1)                              ! ??? 
    75    INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_hT, ndex_hU, ndex_hV 
    76    INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_T, ndex_U, ndex_V 
     80   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_hT, ndex_hU, ndex_hV, ndex_hA 
     81   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_T, ndex_U, ndex_V, ndex_A 
    7782   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_bT 
    7883 
     
    409414         &      ndex_hU(jpi*jpj) , ndex_U(jpi*jpj*jpk) ,     & 
    410415         &      ndex_hV(jpi*jpj) , ndex_V(jpi*jpj*jpk) , STAT=ierr(1) ) 
    411          ! 
    412       dia_wri_alloc = MAXVAL(ierr) 
     416     dia_wri_alloc = MAXVAL(ierr) 
    413417      CALL mpp_sum( 'diawri', dia_wri_alloc ) 
    414418      ! 
    415419   END FUNCTION dia_wri_alloc 
    416  
    417     
     420  
     421   INTEGER FUNCTION dia_wri_alloc_abl() 
     422      !!---------------------------------------------------------------------- 
     423     ALLOCATE(   ndex_hA(jpi*jpj), ndex_A (jpi*jpj*jpkam1), STAT=dia_wri_alloc_abl) 
     424      CALL mpp_sum( 'diawri', dia_wri_alloc_abl ) 
     425      ! 
     426   END FUNCTION dia_wri_alloc_abl 
     427  
    418428   SUBROUTINE dia_wri( kt ) 
    419429      !!--------------------------------------------------------------------- 
     
    435445      INTEGER  ::   ji, jj, jk                               ! dummy loop indices 
    436446      INTEGER  ::   ierr                                     ! error code return from allocation 
    437       INTEGER  ::   iimi, iima, ipk, it, itmod, ijmi, ijma   ! local integers 
     447      INTEGER  ::   iimi, iima, ipk, it, itmod, ijmi, ijma, ipka   ! local integers 
    438448      INTEGER  ::   jn, ierror                               ! local integers 
    439449      REAL(wp) ::   zsto, zout, zmax, zjulian                ! local scalars 
     
    441451      REAL(wp), DIMENSION(jpi,jpj)   :: zw2d       ! 2D workspace 
    442452      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zw3d       ! 3D workspace 
     453      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zw3d_abl   ! 3D workspace 
    443454      !!---------------------------------------------------------------------- 
    444455      !  
     
    449460         ninist = 0 
    450461      ENDIF 
     462      
    451463      ! 
    452464      ! 0. Initialisation 
     
    472484      ijmi = 1      ;      ijma = jpj 
    473485      ipk = jpk 
     486     IF(ln_abl) ipka = jpkam1 
    474487 
    475488      ! define time axis 
     
    574587            &          "m", ipk, gdepw_1d, nz_W, "down" ) 
    575588 
     589         IF( ln_abl ) THEN  
     590         ! Define the ABL grid FILE ( nid_A ) 
     591            CALL dia_nam( clhstnam, nwrite, 'grid_ABL' ) 
     592            IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam    ! filename 
     593            CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit 
     594               &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       & 
     595               &          nit000-1, zjulian, rdt, nh_A, nid_A, domain_id=nidom, snc4chunks=snc4set ) 
     596            CALL histvert( nid_A, "ght_abl", "Vertical T levels",      &  ! Vertical grid: gdept 
     597               &           "m", ipka, ght_abl(2:jpka), nz_A, "up" ) 
     598            !                                                            ! Index of ocean points 
     599         ALLOCATE( zw3d_abl(jpi,jpj,ipka) )  
     600         zw3d_abl(:,:,:) = 1._wp  
     601         CALL wheneq( jpi*jpj*ipka, zw3d_abl, 1, 1., ndex_A , ndim_A  )      ! volume 
     602            CALL wheneq( jpi*jpj     , zw3d_abl, 1, 1., ndex_hA, ndim_hA )      ! surface 
     603         DEALLOCATE(zw3d_abl) 
     604         ENDIF 
    576605 
    577606         ! Declare all the output fields as NETCDF variables 
     
    623652         CALL histdef( nid_T, "sowindsp", "wind speed at 10m"                  , "m/s"    ,   &  ! wndm 
    624653            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
     654! 
     655         IF( ln_abl ) THEN 
     656         !                                                                                      !!! nid_A : 3D 
     657         CALL histdef( nid_A, "t_abl", "Potential Temperature"     , "K"        ,       &  ! t_abl 
     658               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout ) 
     659            CALL histdef( nid_A, "q_abl", "Humidity"                  , "kg/kg"    ,       &  ! q_abl 
     660               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     661            CALL histdef( nid_A, "u_abl", "Atmospheric U-wind   "     , "m/s"        ,     &  ! u_abl 
     662               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout ) 
     663            CALL histdef( nid_A, "v_abl", "Atmospheric V-wind   "     , "m/s"    ,         &  ! v_abl 
     664               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     665            CALL histdef( nid_A, "tke_abl", "Atmospheric TKE   "     , "m2/s2"    ,        &  ! tke_abl 
     666               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     667            CALL histdef( nid_A, "avm_abl", "Atmospheric turbulent viscosity", "m2/s"   ,  &  ! avm_abl 
     668               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     669            CALL histdef( nid_A, "avt_abl", "Atmospheric turbulent diffusivity", "m2/s2",  &  ! avt_abl 
     670               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     671            CALL histdef( nid_A, "pblh", "Atmospheric boundary layer height "  , "m",      &  ! pblh 
     672               &          jpi, jpj, nh_A,  1  , 1, 1   , -99 , 32, clop, zsto, zout )                  
     673#if defined key_si3 
     674            CALL histdef( nid_A, "oce_frac", "Fraction of open ocean"  , " ",      &  ! ato_i 
     675               &          jpi, jpj, nh_A,  1  , 1, 1   , -99 , 32, clop, zsto, zout ) 
     676#endif 
     677          CALL histend( nid_A, snc4chunks=snc4set ) 
     678       ! 
     679       ENDIF 
    625680! 
    626681         IF( ln_icebergs ) THEN 
     
    676731          
    677732         clmx ="l_max(only(x))"    ! max index on a period 
    678 !         CALL histdef( nid_T, "sobowlin", "Bowl Index"                         , "W-point",   &  ! bowl INDEX  
    679 !            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clmx, zsto, zout ) 
     733         CALL histdef( nid_T, "sobowlin", "Bowl Index"                         , "W-point",   &  ! bowl INDEX  
     734            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clmx, zsto, zout ) 
    680735#if defined key_diahth 
    681736         CALL histdef( nid_T, "sothedep", "Thermocline Depth"                  , "m"      ,   & ! hth 
     
    790845      CALL histwrite( nid_T, "soicecov", it, fr_i          , ndim_hT, ndex_hT )   ! ice fraction    
    791846      CALL histwrite( nid_T, "sowindsp", it, wndm          , ndim_hT, ndex_hT )   ! wind speed    
     847! 
     848      IF( ln_abl ) THEN  
     849        ALLOCATE( zw3d_abl(jpi,jpj,jpka) ) 
     850        IF( ln_mskland )   THEN  
     851          DO jk=1,jpka 
     852             zw3d_abl(:,:,jk) = tmask(:,:,1) 
     853            END DO 
     854       ELSE 
     855            zw3d_abl(:,:,:) = 1._wp      
     856         ENDIF        
     857       CALL histwrite( nid_A,  "pblh"   , it, pblh(:,:)                  *zw3d_abl(:,:,1     ), ndim_hA, ndex_hA )   ! pblh  
     858        CALL histwrite( nid_A,  "u_abl"  , it, u_abl   (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! u_abl 
     859        CALL histwrite( nid_A,  "v_abl"  , it, v_abl   (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! v_abl 
     860        CALL histwrite( nid_A,  "t_abl"  , it, tq_abl  (:,:,2:jpka,nt_n,1)*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! t_abl 
     861        CALL histwrite( nid_A,  "q_abl"  , it, tq_abl  (:,:,2:jpka,nt_n,2)*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! q_abl      
     862        CALL histwrite( nid_A,  "tke_abl", it, tke_abl (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! tke_abl 
     863        CALL histwrite( nid_A,  "avm_abl", it, avm_abl (:,:,2:jpka       )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! avm_abl 
     864        CALL histwrite( nid_A,  "avt_abl", it, avt_abl (:,:,2:jpka       )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! avt_abl   
     865#if defined key_si3 
     866         CALL histwrite( nid_A,  "oce_frac"   , it, ato_i(:,:)                                  , ndim_hA, ndex_hA )   ! ato_i 
     867#endif 
     868       DEALLOCATE(zw3d_abl) 
     869     ENDIF 
    792870! 
    793871      IF( ln_icebergs ) THEN 
     
    826904         CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping 
    827905      ENDIF 
    828 !      zw2d(:,:) = FLOAT( nmln(:,:) ) * tmask(:,:,1) 
    829 !      CALL histwrite( nid_T, "sobowlin", it, zw2d          , ndim_hT, ndex_hT )   ! ??? 
     906      zw2d(:,:) = FLOAT( nmln(:,:) ) * tmask(:,:,1) 
     907      CALL histwrite( nid_T, "sobowlin", it, zw2d          , ndim_hT, ndex_hT )   ! ??? 
    830908 
    831909#if defined key_diahth 
     
    862940         CALL histclo( nid_V ) 
    863941         CALL histclo( nid_W ) 
     942         IF(ln_abl) CALL histclo( nid_A ) 
    864943      ENDIF 
    865944      ! 
Note: See TracChangeset for help on using the changeset viewer.