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 9893 – NEMO

Changeset 9893


Ignore:
Timestamp:
2018-07-06T17:12:24+02:00 (6 years ago)
Author:
davestorkey
Message:

UKMO/dev_r9885_proto_GO8_package branch: restart datestamping and MLD diagnostic.

Location:
NEMO/branches/UKMO/dev_r9885_proto_GO8_package
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/dev_r9885_proto_GO8_package/cfgs/SHARED/field_def_nemo-oce.xml

    r9812 r9893  
    6262         <field id="mldr10_1max"  long_name="Max of Mixed Layer Depth (dsigma = 0.01 wrt 10m)"   field_ref="mldr10_1"   operation="maximum"                                                                          /> 
    6363         <field id="mldr10_1min"  long_name="Min of Mixed Layer Depth (dsigma = 0.01 wrt 10m)"   field_ref="mldr10_1"   operation="minimum"                                                                          /> 
     64         <field id="mldzint_1"    long_name="Mixed Layer Depth interpolated"                     standard_name="ocean_mixed_layer_thickness"                                                       unit="m"          /> 
     65         <field id="mldzint_2"    long_name="Mixed Layer Depth interpolated"                     standard_name="ocean_mixed_layer_thickness"                                                       unit="m"          /> 
     66         <field id="mldzint_3"    long_name="Mixed Layer Depth interpolated"                     standard_name="ocean_mixed_layer_thickness"                                                       unit="m"          /> 
     67         <field id="mldzint_4"    long_name="Mixed Layer Depth interpolated"                     standard_name="ocean_mixed_layer_thickness"                                                       unit="m"          /> 
     68         <field id="mldzint_5"    long_name="Mixed Layer Depth interpolated"                     standard_name="ocean_mixed_layer_thickness"                                                       unit="m"          /> 
     69         <field id="mldhtc_1"     long_name="Mixed Layer Depth integrated heat content"          standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"       /> 
     70         <field id="mldhtc_2"     long_name="Mixed Layer Depth integrated heat content"          standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"       /> 
     71         <field id="mldhtc_3"     long_name="Mixed Layer Depth integrated heat content"          standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"       /> 
     72         <field id="mldhtc_4"     long_name="Mixed Layer Depth integrated heat content"          standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"       /> 
     73         <field id="mldhtc_5"     long_name="Mixed Layer Depth integrated heat content"          standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"       /> 
    6474         <field id="heatc"        long_name="Heat content vertically integrated"                 standard_name="integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content"   unit="J/m2"       /> 
    6575         <field id="saltc"        long_name="Salt content vertically integrated"                                                                                                                   unit="1e-3*kg/m2" /> 
  • NEMO/branches/UKMO/dev_r9885_proto_GO8_package/src/ICE/icerst.F90

    r9892 r9893  
    2121   USE in_out_manager ! I/O manager 
    2222   USE iom            ! I/O manager library 
     23   USE ioipsl, ONLY : ju2ymds    ! for calendar 
    2324   USE lib_mpp        ! MPP library 
    2425   USE lib_fortran    ! fortran utilities (glob_sum + no signed zero) 
     
    4647      INTEGER, INTENT(in) ::   kt       ! number of iteration 
    4748      ! 
     49      INTEGER             ::   iyear, imonth, iday 
     50      REAL (wp)           ::   zsec 
     51      REAL (wp)           ::   zfjulday 
    4852      CHARACTER(len=20)   ::   clkt     ! ocean time-step define as a character 
    4953      CHARACTER(len=50)   ::   clname   ! ice output restart file name 
     
    6064         IF( nitrst <= nitend .AND. nitrst > 0 ) THEN 
    6165            ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
    62             IF( nitrst > 99999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
    63             ELSE                           ;   WRITE(clkt, '(i8.8)') nitrst 
     66            IF ( ln_rstdate ) THEN 
     67               zfjulday = fjulday + (2*nn_fsbc+1)*rdt / rday 
     68               IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday )   zfjulday = REAL(NINT(zfjulday),wp)   ! avoid truncation error 
     69               CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec )            
     70               WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 
     71            ELSE 
     72               IF( nitrst > 99999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
     73               ELSE                           ;   WRITE(clkt, '(i8.8)') nitrst 
     74               ENDIF 
    6475            ENDIF 
    6576            ! create the file 
  • NEMO/branches/UKMO/dev_r9885_proto_GO8_package/src/OCE/DOM/domain.F90

    r9892 r9893  
    292292         &             nn_it000, nn_itend , nn_date0    , nn_time0     , nn_leapy  , nn_istate ,     & 
    293293         &             nn_stock, nn_write , ln_mskland  , ln_clobber   , nn_chunksz, nn_euler  ,     & 
    294          &             ln_cfmeta, ln_iscpl, ln_xios_read, nn_wxios 
     294         &             ln_cfmeta, ln_iscpl, ln_xios_read, nn_wxios, ln_rstdate 
    295295      NAMELIST/namdom/ ln_linssh, rn_isfhmin, rn_rdt, rn_atfp, ln_crs, ln_meshmask 
    296296#if defined key_netcdf4 
     
    338338         WRITE(numout,*) '      frequency of output file        nn_write        = ', nn_write 
    339339         WRITE(numout,*) '      mask land points                ln_mskland      = ', ln_mskland 
     340         WRITE(numout,*) '      date-stamp restart files        ln_rstdate = ', ln_rstdate 
    340341         WRITE(numout,*) '      additional CF standard metadata ln_cfmeta       = ', ln_cfmeta 
    341342         WRITE(numout,*) '      overwrite an existing file      ln_clobber      = ', ln_clobber 
  • NEMO/branches/UKMO/dev_r9885_proto_GO8_package/src/OCE/ICB/icbrst.F90

    r9892 r9893  
    2525   USE netcdf         ! netcdf routines for IO 
    2626   USE iom 
     27   USE ioipsl, ONLY : ju2ymds    ! for calendar 
    2728   USE icb_oce        ! define iceberg arrays 
    2829   USE icbutl         ! iceberg utility routines 
     
    157158      INTEGER ::   jn   ! dummy loop index 
    158159      INTEGER ::   ix_dim, iy_dim, ik_dim, in_dim 
    159       CHARACTER(len=256)     :: cl_path 
    160       CHARACTER(len=256)     :: cl_filename 
     160      INTEGER             ::   iyear, imonth, iday 
     161      REAL (wp)           ::   zsec 
     162      REAL (wp)           ::   zfjulday 
     163      CHARACTER(len=256)  :: cl_path 
     164      CHARACTER(len=256)  :: cl_filename 
     165      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character 
    161166      TYPE(iceberg), POINTER :: this 
    162167      TYPE(point)  , POINTER :: pt 
     
    166171      cl_path = TRIM(cn_ocerst_outdir) 
    167172      IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/' 
     173      IF ( ln_rstdate ) THEN 
     174         zfjulday = fjulday + rdt / rday 
     175         IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday )   zfjulday = REAL(NINT(zfjulday),wp)   ! avoid truncation error 
     176         CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec )            
     177         WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 
     178      ELSE 
     179         IF( kt > 999999999 ) THEN   ;   WRITE(clkt, *       ) kt 
     180         ELSE                        ;   WRITE(clkt, '(i8.8)') kt 
     181         ENDIF 
     182      ENDIF 
    168183      IF( lk_mpp ) THEN 
    169          WRITE(cl_filename,'(A,"_icebergs_",I8.8,"_restart_",I4.4,".nc")') TRIM(cexper), kt, narea-1 
     184         WRITE(cl_filename,'(A,"_icebergs_",A,"_restart_",I4.4,".nc")') TRIM(cexper), TRIM(ADJUSTL(clkt)), narea-1 
    170185      ELSE 
    171          WRITE(cl_filename,'(A,"_icebergs_",I8.8,"_restart.nc")') TRIM(cexper), kt 
     186         WRITE(cl_filename,'(A,"_icebergs_",A,"_restart.nc")') TRIM(cexper), TRIM(ADJUSTL(clkt)) 
    172187      ENDIF 
    173188      IF (nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, write_restart: creating ',TRIM(cl_path)//TRIM(cl_filename) 
  • NEMO/branches/UKMO/dev_r9885_proto_GO8_package/src/OCE/IOM/in_out_manager.F90

    r9892 r9893  
    4040   INTEGER, DIMENSION(10) :: nn_stocklist  !: restart dump times 
    4141   LOGICAL       ::   ln_mskland       !: mask land points in NetCDF outputs (costly: + ~15%) 
     42   LOGICAL       ::   ln_rstdate       !: T=> stamp output restart files with date instead of timestep 
    4243   LOGICAL       ::   ln_cfmeta        !: output additional data to netCDF files required for compliance with the CF metadata standard 
    4344   LOGICAL       ::   ln_clobber       !: clobber (overwrite) an existing file 
  • NEMO/branches/UKMO/dev_r9885_proto_GO8_package/src/OCE/IOM/restart.F90

    r9892 r9893  
    2727   USE in_out_manager  ! I/O manager 
    2828   USE iom             ! I/O module 
     29   USE ioipsl, ONLY : ju2ymds    ! for calendar 
    2930   USE diurnal_bulk 
    3031 
     
    5859      INTEGER, INTENT(in) ::   kt     ! ocean time-step 
    5960      !! 
     61      INTEGER             ::   iyear, imonth, iday 
     62      REAL (wp)           ::   zsec 
     63      REAL (wp)           ::   zfjulday 
    6064      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character 
    6165      CHARACTER(LEN=50)   ::   clname   ! ocean output restart file name 
     
    8791         IF( nitrst <= nitend .AND. nitrst > 0 ) THEN  
    8892            ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
    89             IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
    90             ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
     93            IF ( ln_rstdate ) THEN 
     94               zfjulday = fjulday + rdt / rday 
     95               IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday )   zfjulday = REAL(NINT(zfjulday),wp)   ! avoid truncation error 
     96               CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec )            
     97               WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 
     98            ELSE 
     99               IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
     100               ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
     101               ENDIF 
    91102            ENDIF 
    92103            ! create the file 
  • NEMO/branches/UKMO/dev_r9885_proto_GO8_package/src/OCE/ZDF/zdfmxl.F90

    r9892 r9893  
    1515   USE trc_oce  , ONLY: l_offline         ! ocean space and time domain variables 
    1616   USE zdf_oce        ! ocean vertical physics 
     17   USE eosbn2         ! for zdf_mxl_zint 
    1718   ! 
    1819   USE in_out_manager ! I/O manager 
     
    3132   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmlp    !: mixed layer depth  (rho=rho0+zdcrit) [m]   (used by LDF) 
    3233   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmlpt   !: depth of the last T-point inside the mixed layer [m] (used by LDF) 
    33  
     34   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:,:) ::   hmld_zint  !: vertically-interpolated mixed layer depth   [m] 
     35   REAL(wp), PUBLIC, ALLOCATABLE,       DIMENSION(:,:) ::   htc_mld    ! Heat content of hmld_zint 
     36   LOGICAL, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)    :: ll_found   ! Is T_b to be found by interpolation ? 
     37   LOGICAL, PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  :: ll_belowml ! Flag points below mixed layer when ll_found=F 
    3438   REAL(wp), PUBLIC ::   rho_c = 0.01_wp    !: density criterion for mixed layer depth 
    3539   REAL(wp)         ::   avt_c = 5.e-4_wp   ! Kz criterion for the turbocline depth 
     40 
     41   TYPE, PUBLIC :: MXL_ZINT   !: Structure for MLD defs 
     42      INTEGER   :: mld_type   ! mixed layer type      
     43      REAL(wp)  :: zref       ! depth of initial T_ref 
     44      REAL(wp)  :: dT_crit    ! Critical temp diff 
     45      REAL(wp)  :: iso_frac   ! Fraction of rn_dT_crit  
     46   END TYPE MXL_ZINT 
    3647 
    3748   !!---------------------------------------------------------------------- 
     
    4859      zdf_mxl_alloc = 0      ! set to zero if no array to be allocated 
    4960      IF( .NOT. ALLOCATED( nmln ) ) THEN 
    50          ALLOCATE( nmln(jpi,jpj), hmld(jpi,jpj), hmlp(jpi,jpj), hmlpt(jpi,jpj), STAT= zdf_mxl_alloc ) 
     61         ALLOCATE( nmln(jpi,jpj), hmld(jpi,jpj), hmlp(jpi,jpj), hmlpt(jpi,jpj), hmld_zint(jpi,jpj),     & 
     62   &          htc_mld(jpi,jpj), ll_found(jpi,jpj), ll_belowml(jpi,jpj,jpk), STAT= zdf_mxl_alloc )          
    5163         ! 
    5264         IF( lk_mpp             )   CALL mpp_sum ( zdf_mxl_alloc ) 
     
    137149      ENDIF 
    138150      ! 
     151      ! Vertically-interpolated mixed-layer depth diagnostic 
     152      CALL zdf_mxl_zint( kt ) 
     153      ! 
    139154      IF(ln_ctl)   CALL prt_ctl( tab2d_1=REAL(nmln,wp), clinfo1=' nmln : ', tab2d_2=hmlp, clinfo2=' hmlp : ' ) 
    140155      ! 
    141156   END SUBROUTINE zdf_mxl 
     157 
     158   SUBROUTINE zdf_mxl_zint_mld( sf )  
     159      !!----------------------------------------------------------------------------------  
     160      !!                    ***  ROUTINE zdf_mxl_zint_mld  ***  
     161      !                                                                         
     162      !   Calculate vertically-interpolated mixed layer depth diagnostic.  
     163      !             
     164      !   This routine can calculate the mixed layer depth diagnostic suggested by 
     165      !   Kara et al, 2000, JGR, 105, 16803, but is more general and can calculate 
     166      !   vertically-interpolated mixed-layer depth diagnostics with other parameter 
     167      !   settings set in the namzdf_mldzint namelist.   
     168      !  
     169      !   If mld_type=1 the mixed layer depth is calculated as the depth at which the   
     170      !   density has increased by an amount equivalent to a temperature difference of   
     171      !   0.8C at the surface.  
     172      !  
     173      !   For other values of mld_type the mixed layer is calculated as the depth at   
     174      !   which the temperature differs by 0.8C from the surface temperature.   
     175      !                                                                         
     176      !   David Acreman, Daley Calvert                                       
     177      !  
     178      !!-----------------------------------------------------------------------------------  
     179 
     180      TYPE(MXL_ZINT), INTENT(in)  :: sf 
     181 
     182      ! Diagnostic criteria 
     183      INTEGER   :: nn_mld_type   ! mixed layer type      
     184      REAL(wp)  :: rn_zref       ! depth of initial T_ref 
     185      REAL(wp)  :: rn_dT_crit    ! Critical temp diff 
     186      REAL(wp)  :: rn_iso_frac   ! Fraction of rn_dT_crit used 
     187 
     188      ! Local variables 
     189      REAL(wp), PARAMETER :: zepsilon = 1.e-30          ! local small value 
     190      INTEGER, DIMENSION(jpi,jpj) :: ikmt          ! number of active tracer levels  
     191      INTEGER, DIMENSION(jpi,jpj) :: ik_ref        ! index of reference level  
     192      INTEGER, DIMENSION(jpi,jpj) :: ik_iso        ! index of last uniform temp level  
     193      REAL, DIMENSION(jpi,jpj,jpk)  :: zT            ! Temperature or density  
     194      REAL, DIMENSION(jpi,jpj)    :: ppzdep        ! depth for use in calculating d(rho)  
     195      REAL, DIMENSION(jpi,jpj)    :: zT_ref        ! reference temperature  
     196      REAL    :: zT_b                                   ! base temperature  
     197      REAL, DIMENSION(jpi,jpj,jpk)  :: zdTdz         ! gradient of zT  
     198      REAL, DIMENSION(jpi,jpj,jpk)  :: zmoddT        ! Absolute temperature difference  
     199      REAL    :: zdz                                    ! depth difference  
     200      REAL    :: zdT                                    ! temperature difference  
     201      REAL, DIMENSION(jpi,jpj)    :: zdelta_T      ! difference critereon  
     202      REAL, DIMENSION(jpi,jpj)    :: zRHO1, zRHO2  ! Densities  
     203      INTEGER :: ji, jj, jk                             ! loop counter  
     204 
     205      !!-------------------------------------------------------------------------------------  
     206      !   
     207      ! Unpack structure 
     208      nn_mld_type = sf%mld_type 
     209      rn_zref     = sf%zref 
     210      rn_dT_crit  = sf%dT_crit 
     211      rn_iso_frac = sf%iso_frac 
     212 
     213      ! Set the mixed layer depth criterion at each grid point  
     214      IF( nn_mld_type == 0 ) THEN 
     215         zdelta_T(:,:) = rn_dT_crit 
     216         zT(:,:,:) = rhop(:,:,:) 
     217      ELSE IF( nn_mld_type == 1 ) THEN 
     218         ppzdep(:,:)=0.0  
     219         call eos ( tsn(:,:,1,:), ppzdep(:,:), zRHO1(:,:) )  
     220! Use zT temporarily as a copy of tsn with rn_dT_crit added to SST  
     221! [assumes number of tracers less than number of vertical levels]  
     222         zT(:,:,1:jpts)=tsn(:,:,1,1:jpts)  
     223         zT(:,:,jp_tem)=zT(:,:,1)+rn_dT_crit  
     224         CALL eos( zT(:,:,1:jpts), ppzdep(:,:), zRHO2(:,:) )  
     225         zdelta_T(:,:) = abs( zRHO1(:,:) - zRHO2(:,:) ) * rau0  
     226         ! RHO from eos (2d version) doesn't calculate north or east halo:  
     227         CALL lbc_lnk( zdelta_T, 'T', 1. )  
     228         zT(:,:,:) = rhop(:,:,:)  
     229      ELSE  
     230         zdelta_T(:,:) = rn_dT_crit                       
     231         zT(:,:,:) = tsn(:,:,:,jp_tem)                            
     232      END IF  
     233 
     234      ! Calculate the gradient of zT and absolute difference for use later  
     235      DO jk = 1 ,jpk-2  
     236         zdTdz(:,:,jk)  =    ( zT(:,:,jk+1) - zT(:,:,jk) ) / e3w_n(:,:,jk+1)  
     237         zmoddT(:,:,jk) = abs( zT(:,:,jk+1) - zT(:,:,jk) )  
     238      END DO  
     239 
     240      ! Find density/temperature at the reference level (Kara et al use 10m).           
     241      ! ik_ref is the index of the box centre immediately above or at the reference level  
     242      ! Find rn_zref in the array of model level depths and find the ref     
     243      ! density/temperature by linear interpolation.                                    
     244      DO jk = jpkm1, 2, -1  
     245         WHERE ( gdept_n(:,:,jk) > rn_zref )  
     246           ik_ref(:,:) = jk - 1  
     247           zT_ref(:,:) = zT(:,:,jk-1) + zdTdz(:,:,jk-1) * ( rn_zref - gdept_n(:,:,jk-1) )  
     248         END WHERE  
     249      END DO  
     250 
     251      ! If the first grid box centre is below the reference level then use the  
     252      ! top model level to get zT_ref  
     253      WHERE ( gdept_n(:,:,1) > rn_zref )   
     254         zT_ref = zT(:,:,1)  
     255         ik_ref = 1  
     256      END WHERE  
     257 
     258      ! The number of active tracer levels is 1 less than the number of active w levels  
     259      ikmt(:,:) = mbkt(:,:) - 1  
     260 
     261      ! Initialize / reset 
     262      ll_found(:,:) = .false. 
     263 
     264      IF ( rn_iso_frac - zepsilon > 0. ) THEN 
     265         ! Search for a uniform density/temperature region where adjacent levels           
     266         ! differ by less than rn_iso_frac * deltaT.                                       
     267         ! ik_iso is the index of the last level in the uniform layer   
     268         ! ll_found indicates whether the mixed layer depth can be found by interpolation  
     269         ik_iso(:,:)   = ik_ref(:,:)  
     270         DO jj = 1, nlcj  
     271            DO ji = 1, nlci  
     272!CDIR NOVECTOR  
     273               DO jk = ik_ref(ji,jj), ikmt(ji,jj)-1  
     274                  IF ( zmoddT(ji,jj,jk) > ( rn_iso_frac * zdelta_T(ji,jj) ) ) THEN  
     275                     ik_iso(ji,jj)   = jk  
     276                     ll_found(ji,jj) = ( zmoddT(ji,jj,jk) > zdelta_T(ji,jj) )  
     277                     EXIT  
     278                  END IF  
     279               END DO  
     280            END DO  
     281         END DO  
     282 
     283         ! Use linear interpolation to find depth of mixed layer base where possible  
     284         hmld_zint(:,:) = rn_zref  
     285         DO jj = 1, jpj  
     286            DO ji = 1, jpi  
     287               IF (ll_found(ji,jj) .and. tmask(ji,jj,1) == 1.0) THEN  
     288                  zdz =  abs( zdelta_T(ji,jj) / zdTdz(ji,jj,ik_iso(ji,jj)) )  
     289                  hmld_zint(ji,jj) = gdept_n(ji,jj,ik_iso(ji,jj)) + zdz  
     290               END IF  
     291            END DO  
     292         END DO  
     293      END IF 
     294 
     295      ! If ll_found = .false. then calculate MLD using difference of zdelta_T     
     296      ! from the reference density/temperature  
     297  
     298! Prevent this section from working on land points  
     299      WHERE ( tmask(:,:,1) /= 1.0 )  
     300         ll_found = .true.  
     301      END WHERE  
     302  
     303      DO jk=1, jpk  
     304         ll_belowml(:,:,jk) = abs( zT(:,:,jk) - zT_ref(:,:) ) >= zdelta_T(:,:)   
     305      END DO  
     306  
     307! Set default value where interpolation cannot be used (ll_found=false)   
     308      DO jj = 1, jpj  
     309         DO ji = 1, jpi  
     310            IF ( .not. ll_found(ji,jj) )  hmld_zint(ji,jj) = gdept_n(ji,jj,ikmt(ji,jj))  
     311         END DO  
     312      END DO  
     313 
     314      DO jj = 1, jpj  
     315         DO ji = 1, jpi  
     316!CDIR NOVECTOR  
     317            DO jk = ik_ref(ji,jj)+1, ikmt(ji,jj)  
     318               IF ( ll_found(ji,jj) ) EXIT  
     319               IF ( ll_belowml(ji,jj,jk) ) THEN                 
     320                  zT_b = zT_ref(ji,jj) + zdelta_T(ji,jj) * SIGN(1.0, zdTdz(ji,jj,jk-1) )  
     321                  zdT  = zT_b - zT(ji,jj,jk-1)                                       
     322                  zdz  = zdT / zdTdz(ji,jj,jk-1)                                        
     323                  hmld_zint(ji,jj) = gdept_n(ji,jj,jk-1) + zdz  
     324                  EXIT                                                    
     325               END IF  
     326            END DO  
     327         END DO  
     328      END DO  
     329 
     330      hmld_zint(:,:) = hmld_zint(:,:)*tmask(:,:,1)  
     331      !   
     332   END SUBROUTINE zdf_mxl_zint_mld 
     333 
     334   SUBROUTINE zdf_mxl_zint_htc( kt ) 
     335      !!---------------------------------------------------------------------- 
     336      !!                  ***  ROUTINE zdf_mxl_zint_htc  *** 
     337      !!  
     338      !! ** Purpose :    
     339      !! 
     340      !! ** Method  :    
     341      !!---------------------------------------------------------------------- 
     342 
     343      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     344 
     345      INTEGER :: ji, jj, jk 
     346      INTEGER :: ikmax 
     347      REAL(wp) :: zc, zcoef 
     348      ! 
     349      INTEGER,  ALLOCATABLE, DIMENSION(:,:) ::   ilevel 
     350      REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   zthick_0, zthick 
     351 
     352      !!---------------------------------------------------------------------- 
     353 
     354      IF( .NOT. ALLOCATED(ilevel) ) THEN 
     355         ALLOCATE( ilevel(jpi,jpj), zthick_0(jpi,jpj), & 
     356         &         zthick(jpi,jpj), STAT=ji ) 
     357         IF( lk_mpp  )   CALL mpp_sum(ji) 
     358         IF( ji /= 0 )   CALL ctl_stop( 'STOP', 'zdf_mxl_zint_htc : unable to allocate arrays' ) 
     359      ENDIF 
     360 
     361      ! Find last whole model T level above the MLD 
     362      ilevel(:,:)   = 0 
     363      zthick_0(:,:) = 0._wp 
     364 
     365      DO jk = 1, jpkm1   
     366         DO jj = 1, jpj 
     367            DO ji = 1, jpi                     
     368               zthick_0(ji,jj) = zthick_0(ji,jj) + e3t_n(ji,jj,jk) 
     369               IF( zthick_0(ji,jj) < hmld_zint(ji,jj) )   ilevel(ji,jj) = jk 
     370            END DO 
     371         END DO 
     372         WRITE(numout,*) 'zthick_0(jk =',jk,') =',zthick_0(2,2) 
     373         WRITE(numout,*) 'gdepw_n(jk+1 =',jk+1,') =',gdepw_n(2,2,jk+1) 
     374      END DO 
     375 
     376      ! Surface boundary condition 
     377      IF( ln_linssh ) THEN  ;   zthick(:,:) = sshn(:,:)   ;   htc_mld(:,:) = tsn(:,:,1,jp_tem) * sshn(:,:) * tmask(:,:,1)    
     378      ELSE                  ;   zthick(:,:) = 0._wp       ;   htc_mld(:,:) = 0._wp                                    
     379      ENDIF 
     380 
     381      ! Deepest whole T level above the MLD 
     382      ikmax = MIN( MAXVAL( ilevel(:,:) ), jpkm1 ) 
     383 
     384      ! Integration down to last whole model T level 
     385      DO jk = 1, ikmax 
     386         DO jj = 1, jpj 
     387            DO ji = 1, jpi 
     388               zc = e3t_n(ji,jj,jk) * REAL( MIN( MAX( 0, ilevel(ji,jj) - jk + 1 ) , 1  )  )    ! 0 below ilevel 
     389               zthick(ji,jj) = zthick(ji,jj) + zc 
     390               htc_mld(ji,jj) = htc_mld(ji,jj) + zc * tsn(ji,jj,jk,jp_tem) * tmask(ji,jj,jk) 
     391            END DO 
     392         END DO 
     393      END DO 
     394 
     395      ! Subsequent partial T level 
     396      zthick(:,:) = hmld_zint(:,:) - zthick(:,:)   !   remaining thickness to reach MLD 
     397 
     398      DO jj = 1, jpj 
     399         DO ji = 1, jpi 
     400            htc_mld(ji,jj) = htc_mld(ji,jj) + tsn(ji,jj,ilevel(ji,jj)+1,jp_tem)  &  
     401      &                      * MIN( e3t_n(ji,jj,ilevel(ji,jj)+1), zthick(ji,jj) ) * tmask(ji,jj,ilevel(ji,jj)+1) 
     402         END DO 
     403      END DO 
     404 
     405      WRITE(numout,*) 'htc_mld(after) =',htc_mld(2,2) 
     406 
     407      ! Convert to heat content 
     408      zcoef = rau0 * rcp 
     409      htc_mld(:,:) = zcoef * htc_mld(:,:) 
     410 
     411   END SUBROUTINE zdf_mxl_zint_htc 
     412 
     413   SUBROUTINE zdf_mxl_zint( kt ) 
     414      !!---------------------------------------------------------------------- 
     415      !!                  ***  ROUTINE zdf_mxl_zint  *** 
     416      !!  
     417      !! ** Purpose :    
     418      !! 
     419      !! ** Method  :    
     420      !!---------------------------------------------------------------------- 
     421 
     422      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
     423 
     424      INTEGER :: ios 
     425      INTEGER :: jn 
     426 
     427      INTEGER :: nn_mld_diag = 0    ! number of diagnostics 
     428 
     429      CHARACTER(len=1) :: cmld 
     430 
     431      TYPE(MXL_ZINT) :: sn_mld1, sn_mld2, sn_mld3, sn_mld4, sn_mld5 
     432      TYPE(MXL_ZINT), SAVE, DIMENSION(5) ::   mld_diags 
     433 
     434      NAMELIST/namzdf_mldzint/ nn_mld_diag, sn_mld1, sn_mld2, sn_mld3, sn_mld4, sn_mld5 
     435 
     436      !!---------------------------------------------------------------------- 
     437       
     438      IF( kt == nit000 ) THEN 
     439         REWIND( numnam_ref )              ! Namelist namzdf_mldzint in reference namelist  
     440         READ  ( numnam_ref, namzdf_mldzint, IOSTAT = ios, ERR = 901) 
     441901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_mldzint in reference namelist', lwp ) 
     442 
     443         REWIND( numnam_cfg )              ! Namelist namzdf_mldzint in configuration namelist  
     444         READ  ( numnam_cfg, namzdf_mldzint, IOSTAT = ios, ERR = 902 ) 
     445902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_mldzint in configuration namelist', lwp ) 
     446         IF(lwm) WRITE ( numond, namzdf_mldzint ) 
     447 
     448         IF( nn_mld_diag > 5 )   CALL ctl_stop( 'STOP', 'zdf_mxl_ini: Specify no more than 5 MLD definitions' ) 
     449 
     450         mld_diags(1) = sn_mld1 
     451         mld_diags(2) = sn_mld2 
     452         mld_diags(3) = sn_mld3 
     453         mld_diags(4) = sn_mld4 
     454         mld_diags(5) = sn_mld5 
     455 
     456         IF( lwp .AND. (nn_mld_diag > 0) ) THEN 
     457            WRITE(numout,*) '=============== Vertically-interpolated mixed layer ================' 
     458            WRITE(numout,*) '(Diagnostic number, nn_mld_type, rn_zref, rn_dT_crit, rn_iso_frac)' 
     459            DO jn = 1, nn_mld_diag 
     460               WRITE(numout,*) 'MLD criterion',jn,':' 
     461               WRITE(numout,*) '    nn_mld_type =', mld_diags(jn)%mld_type 
     462               WRITE(numout,*) '    rn_zref ='    , mld_diags(jn)%zref 
     463               WRITE(numout,*) '    rn_dT_crit =' , mld_diags(jn)%dT_crit 
     464               WRITE(numout,*) '    rn_iso_frac =', mld_diags(jn)%iso_frac 
     465            END DO 
     466            WRITE(numout,*) '====================================================================' 
     467         ENDIF 
     468      ENDIF 
     469 
     470      IF( nn_mld_diag > 0 ) THEN 
     471         DO jn = 1, nn_mld_diag 
     472            WRITE(cmld,'(I1)') jn 
     473            IF( iom_use( "mldzint_"//cmld ) .OR. iom_use( "mldhtc_"//cmld ) ) THEN 
     474               CALL zdf_mxl_zint_mld( mld_diags(jn) ) 
     475 
     476               IF( iom_use( "mldzint_"//cmld ) ) THEN 
     477                  CALL iom_put( "mldzint_"//cmld, hmld_zint(:,:) ) 
     478               ENDIF 
     479 
     480               IF( iom_use( "mldhtc_"//cmld ) )  THEN 
     481                  CALL zdf_mxl_zint_htc( kt ) 
     482                  CALL iom_put( "mldhtc_"//cmld , htc_mld(:,:)   ) 
     483               ENDIF 
     484            ENDIF 
     485         END DO 
     486      ENDIF 
     487 
     488   END SUBROUTINE zdf_mxl_zint 
    142489 
    143490   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.