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 12154 for NEMO/branches/2019/dev_r12072_MERGE_OPTION2_2019/src/OCE/DIA – NEMO

Ignore:
Timestamp:
2019-12-10T15:44:23+01:00 (4 years ago)
Author:
cetlod
Message:

commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r12072_MERGE_OPTION2_2019/src/OCE/DIA/diawri.F90

    r11536 r12154  
    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 
    7073   INTEGER ::          nb_T              , ndim_bT   ! grid_T 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 ::   nid_A, nz_A, nh_A, ndim_A, ndim_hA   ! grid_ABL file    
    7478   INTEGER ::   ndex(1)                              ! ??? 
    7579   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_hT, ndex_hU, ndex_hV 
     80   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_hA, ndex_A ! ABL 
    7681   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_T, ndex_U, ndex_V 
    7782   INTEGER, SAVE, ALLOCATABLE, DIMENSION(:) :: ndex_bT 
     
    414419         &      ndex_hV(jpi*jpj) , ndex_V(jpi*jpj*jpk) , STAT=ierr(1) ) 
    415420         ! 
    416       dia_wri_alloc = MAXVAL(ierr) 
     421     dia_wri_alloc = MAXVAL(ierr) 
    417422      CALL mpp_sum( 'diawri', dia_wri_alloc ) 
    418423      ! 
    419424   END FUNCTION dia_wri_alloc 
    420  
    421     
     425  
     426   INTEGER FUNCTION dia_wri_alloc_abl() 
     427      !!---------------------------------------------------------------------- 
     428     ALLOCATE(   ndex_hA(jpi*jpj), ndex_A (jpi*jpj*jpkam1), STAT=dia_wri_alloc_abl) 
     429      CALL mpp_sum( 'diawri', dia_wri_alloc_abl ) 
     430      ! 
     431   END FUNCTION dia_wri_alloc_abl 
     432  
    422433   SUBROUTINE dia_wri( kt ) 
    423434      !!--------------------------------------------------------------------- 
     
    440451      INTEGER  ::   ierr                                     ! error code return from allocation 
    441452      INTEGER  ::   iimi, iima, ipk, it, itmod, ijmi, ijma   ! local integers 
     453      INTEGER  ::   ipka                                     ! ABL 
    442454      INTEGER  ::   jn, ierror                               ! local integers 
    443455      REAL(wp) ::   zsto, zout, zmax, zjulian                ! local scalars 
     
    445457      REAL(wp), DIMENSION(jpi,jpj)   :: zw2d       ! 2D workspace 
    446458      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zw3d       ! 3D workspace 
     459      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zw3d_abl   ! ABL 3D workspace 
    447460      !!---------------------------------------------------------------------- 
    448461      ! 
     
    478491      ijmi = 1      ;      ijma = jpj 
    479492      ipk = jpk 
     493      IF(ln_abl) ipka = jpkam1 
    480494 
    481495      ! define time axis 
     
    580594            &          "m", ipk, gdepw_1d, nz_W, "down" ) 
    581595 
     596         IF( ln_abl ) THEN  
     597         ! Define the ABL grid FILE ( nid_A ) 
     598            CALL dia_nam( clhstnam, nn_write, 'grid_ABL' ) 
     599            IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam    ! filename 
     600            CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit 
     601               &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       & 
     602               &          nit000-1, zjulian, rdt, nh_A, nid_A, domain_id=nidom, snc4chunks=snc4set ) 
     603            CALL histvert( nid_A, "ght_abl", "Vertical T levels",      &  ! Vertical grid: gdept 
     604               &           "m", ipka, ght_abl(2:jpka), nz_A, "up" ) 
     605            !                                                            ! Index of ocean points 
     606         ALLOCATE( zw3d_abl(jpi,jpj,ipka) )  
     607         zw3d_abl(:,:,:) = 1._wp  
     608         CALL wheneq( jpi*jpj*ipka, zw3d_abl, 1, 1., ndex_A , ndim_A  )      ! volume 
     609            CALL wheneq( jpi*jpj     , zw3d_abl, 1, 1., ndex_hA, ndim_hA )      ! surface 
     610         DEALLOCATE(zw3d_abl) 
     611         ENDIF 
    582612 
    583613         ! Declare all the output fields as NETCDF variables 
     
    629659         CALL histdef( nid_T, "sowindsp", "wind speed at 10m"                  , "m/s"    ,   &  ! wndm 
    630660            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    631 ! 
     661         ! 
     662         IF( ln_abl ) THEN 
     663            CALL histdef( nid_A, "t_abl", "Potential Temperature"     , "K"        ,       &  ! t_abl 
     664               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout ) 
     665            CALL histdef( nid_A, "q_abl", "Humidity"                  , "kg/kg"    ,       &  ! q_abl 
     666               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     667            CALL histdef( nid_A, "u_abl", "Atmospheric U-wind   "     , "m/s"        ,     &  ! u_abl 
     668               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout ) 
     669            CALL histdef( nid_A, "v_abl", "Atmospheric V-wind   "     , "m/s"    ,         &  ! v_abl 
     670               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     671            CALL histdef( nid_A, "tke_abl", "Atmospheric TKE   "     , "m2/s2"    ,        &  ! tke_abl 
     672               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     673            CALL histdef( nid_A, "avm_abl", "Atmospheric turbulent viscosity", "m2/s"   ,  &  ! avm_abl 
     674               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     675            CALL histdef( nid_A, "avt_abl", "Atmospheric turbulent diffusivity", "m2/s2",  &  ! avt_abl 
     676               &          jpi, jpj, nh_A, ipka, 1, ipka, nz_A, 32, clop, zsto, zout )  
     677            CALL histdef( nid_A, "pblh", "Atmospheric boundary layer height "  , "m",      &  ! pblh 
     678               &          jpi, jpj, nh_A,  1  , 1, 1   , -99 , 32, clop, zsto, zout )                  
     679#if defined key_si3 
     680            CALL histdef( nid_A, "oce_frac", "Fraction of open ocean"  , " ",      &  ! ato_i 
     681               &          jpi, jpj, nh_A,  1  , 1, 1   , -99 , 32, clop, zsto, zout ) 
     682#endif 
     683            CALL histend( nid_A, snc4chunks=snc4set ) 
     684         ENDIF 
     685         ! 
    632686         IF( ln_icebergs ) THEN 
    633687            CALL histdef( nid_T, "calving"             , "calving mass input"                       , "kg/s"   , & 
     
    787841      CALL histwrite( nid_T, "soicecov", it, fr_i          , ndim_hT, ndex_hT )   ! ice fraction    
    788842      CALL histwrite( nid_T, "sowindsp", it, wndm          , ndim_hT, ndex_hT )   ! wind speed    
    789 ! 
     843      ! 
     844      IF( ln_abl ) THEN  
     845         ALLOCATE( zw3d_abl(jpi,jpj,jpka) ) 
     846         IF( ln_mskland )   THEN  
     847            DO jk=1,jpka 
     848               zw3d_abl(:,:,jk) = tmask(:,:,1) 
     849            END DO        
     850         ELSE 
     851            zw3d_abl(:,:,:) = 1._wp      
     852         ENDIF        
     853         CALL histwrite( nid_A,  "pblh"   , it, pblh(:,:)                  *zw3d_abl(:,:,1     ), ndim_hA, ndex_hA )   ! pblh  
     854         CALL histwrite( nid_A,  "u_abl"  , it, u_abl   (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! u_abl 
     855         CALL histwrite( nid_A,  "v_abl"  , it, v_abl   (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! v_abl 
     856         CALL histwrite( nid_A,  "t_abl"  , it, tq_abl  (:,:,2:jpka,nt_n,1)*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! t_abl 
     857         CALL histwrite( nid_A,  "q_abl"  , it, tq_abl  (:,:,2:jpka,nt_n,2)*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! q_abl        
     858         CALL histwrite( nid_A,  "tke_abl", it, tke_abl (:,:,2:jpka,nt_n  )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! tke_abl 
     859         CALL histwrite( nid_A,  "avm_abl", it, avm_abl (:,:,2:jpka       )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! avm_abl 
     860         CALL histwrite( nid_A,  "avt_abl", it, avt_abl (:,:,2:jpka       )*zw3d_abl(:,:,2:jpka), ndim_A , ndex_A  )   ! avt_abl  
     861#if defined key_si3 
     862         CALL histwrite( nid_A,  "oce_frac"   , it, ato_i(:,:)                                  , ndim_hA, ndex_hA )   ! ato_i 
     863#endif 
     864         DEALLOCATE(zw3d_abl) 
     865      ENDIF 
     866      ! 
    790867      IF( ln_icebergs ) THEN 
    791868         ! 
     
    857934         CALL histclo( nid_V ) 
    858935         CALL histclo( nid_W ) 
     936         IF(ln_abl) CALL histclo( nid_A ) 
    859937      ENDIF 
    860938      ! 
     
    9261004         CALL iom_rstput( 0, 0, inum, 'sdvecrtz', wsd            )    ! now StokesDrift k-velocity 
    9271005      ENDIF 
     1006      IF ( ln_abl ) THEN 
     1007         CALL iom_rstput ( 0, 0, inum, "uz1_abl",   u_abl(:,:,2,nt_a  ) )   ! now first level i-wind 
     1008         CALL iom_rstput ( 0, 0, inum, "vz1_abl",   v_abl(:,:,2,nt_a  ) )   ! now first level j-wind 
     1009         CALL iom_rstput ( 0, 0, inum, "tz1_abl",  tq_abl(:,:,2,nt_a,1) )   ! now first level temperature 
     1010         CALL iom_rstput ( 0, 0, inum, "qz1_abl",  tq_abl(:,:,2,nt_a,2) )   ! now first level humidity 
     1011      ENDIF 
    9281012  
    9291013#if defined key_si3 
Note: See TracChangeset for help on using the changeset viewer.