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.
zdfmxl.F90 in branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/ZDF – NEMO

source: branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfmxl.F90 @ 2633

Last change on this file since 2633 was 2633, checked in by trackstand2, 13 years ago

Renamed wrk_use => wrk_in_use and wrk_release => wrk_not_released

  • Property svn:keywords set to Id
File size: 5.8 KB
Line 
1MODULE zdfmxl
2   !!======================================================================
3   !!                       ***  MODULE  zdfmxl  ***
4   !! Ocean physics: mixed layer depth
5   !!======================================================================
6   !! History :  1.0  ! 2003-08  (G. Madec)  original code
7   !!            3.2  ! 2009-07  (S. Masson, G. Madec)  IOM + merge of DO-loop
8   !!----------------------------------------------------------------------
9   !!   zdf_mxl      : Compute the turbocline and mixed layer depths.
10   !!----------------------------------------------------------------------
11   USE oce             ! ocean dynamics and tracers variables
12   USE dom_oce         ! ocean space and time domain variables
13   USE zdf_oce         ! ocean vertical physics
14   USE in_out_manager  ! I/O manager
15   USE prtctl          ! Print control
16   USE iom
17
18   IMPLICIT NONE
19   PRIVATE
20
21   PUBLIC   zdf_mxl       ! called by step.F90
22
23   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   nmln    !: number of level in the mixed layer (used by TOP)
24   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmld    !: mixing layer depth (turbocline)      [m]
25   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmlp    !: mixed layer depth  (rho=rho0+zdcrit) [m]
26   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmlpt   !: mixed layer depth at t-points        [m]
27
28   !! * Substitutions
29#  include "domzgr_substitute.h90"
30   !!----------------------------------------------------------------------
31   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
32   !! $Id$
33   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
34   !!----------------------------------------------------------------------
35CONTAINS
36
37   INTEGER FUNCTION zdf_mxl_alloc()
38      !!----------------------------------------------------------------------
39      !!               ***  FUNCTION zdf_mxl_alloc  ***
40      !!----------------------------------------------------------------------
41      ALLOCATE( nmln(jpi,jpj), hmld(jpi,jpj), hmlp(jpi,jpj), hmlpt(jpi,jpj), STAT=zdf_mxl_alloc)
42      !
43      IF( lk_mpp             )   CALL mpp_sum ( zdf_mxl_alloc )
44      IF( zdf_mxl_alloc /= 0 )   CALL ctl_warn('zdf_mxl_alloc: failed to allocate arrays.')
45   END FUNCTION zdf_mxl_alloc
46
47
48   SUBROUTINE zdf_mxl( kt )
49      !!----------------------------------------------------------------------
50      !!                  ***  ROUTINE zdfmxl  ***
51      !!                   
52      !! ** Purpose :   Compute the turbocline depth and the mixed layer depth
53      !!              with density criteria.
54      !!
55      !! ** Method  :   The mixed layer depth is the shallowest W depth with
56      !!      the density of the corresponding T point (just bellow) bellow a
57      !!      given value defined locally as rho(10m) + zrho_c
58      !!               The turbocline depth is the depth at which the vertical
59      !!      eddy diffusivity coefficient (resulting from the vertical physics
60      !!      alone, not the isopycnal part, see trazdf.F) fall below a given
61      !!      value defined locally (avt_c here taken equal to 5 cm/s2)
62      !!
63      !! ** Action  :   nmln, hmld, hmlp, hmlpt
64      !!----------------------------------------------------------------------
65      USE wrk_nemo, ONLY: iwrk_in_use, iwrk_not_released
66      USE wrk_nemo, ONLY: imld => iwrk_2d_1    ! 2D workspace
67      !!
68      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
69      !!
70      INTEGER                     ::   ji, jj, jk          ! dummy loop indices
71      INTEGER                     ::   iikn, iiki          ! temporary integer within a do loop
72      REAL(wp)                    ::   zrho_c = 0.01_wp    ! density criterion for mixed layer depth
73      REAL(wp)                    ::   zavt_c = 5.e-4_wp   ! Kz criterion for the turbocline depth
74      !!----------------------------------------------------------------------
75
76      IF( iwrk_in_use(2,1) )THEN
77         CALL ctl_stop('zdf_mxl : requested workspace array unavailable.')   ;   RETURN
78      END IF
79
80      IF( kt == nit000 ) THEN
81         IF(lwp) WRITE(numout,*)
82         IF(lwp) WRITE(numout,*) 'zdf_mxl : mixed layer depth'
83         IF(lwp) WRITE(numout,*) '~~~~~~~ '
84         !                              ! allocate zdfmxl arrays
85         IF( zdf_mxl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'zdf_mxl : unable to allocate arrays' )
86      ENDIF
87
88      ! w-level of the mixing and mixed layers
89      nmln(:,:) = mbkt(:,:) + 1        ! Initialization to the number of w ocean point
90      imld(:,:) = mbkt(:,:) + 1
91      DO jk = jpkm1, nlb10, -1         ! from the bottom to nlb10
92         DO jj = 1, jpj
93            DO ji = 1, jpi
94               IF( rhop(ji,jj,jk) > rhop(ji,jj,nla10) + zrho_c )   nmln(ji,jj) = jk      ! Mixed layer
95               IF( avt (ji,jj,jk) < zavt_c                     )   imld(ji,jj) = jk      ! Turbocline
96            END DO
97         END DO
98      END DO
99      ! depth of the mixing and mixed layers
100      DO jj = 1, jpj
101         DO ji = 1, jpi
102            iiki = imld(ji,jj)
103            iikn = nmln(ji,jj)
104            hmld (ji,jj) = fsdepw(ji,jj,iiki  ) * tmask(ji,jj,1)    ! Turbocline depth
105            hmlp (ji,jj) = fsdepw(ji,jj,iikn  ) * tmask(ji,jj,1)    ! Mixed layer depth
106            hmlpt(ji,jj) = fsdept(ji,jj,iikn-1)                     ! depth of the last T-point inside the mixed layer
107         END DO
108      END DO
109      CALL iom_put( "mldr10_1", hmlp )   ! mixed layer depth
110      CALL iom_put( "mldkz5"  , hmld )   ! turbocline depth
111     
112      IF(ln_ctl)   CALL prt_ctl( tab2d_1=REAL(nmln,wp), clinfo1=' nmln : ', tab2d_2=hmlp, clinfo2=' hmlp : ', ovlap=1 )
113      !
114      IF( iwrk_not_released(2,1) )   CALL ctl_stop('zdf_mxl : failed to release workspace array')
115      !
116   END SUBROUTINE zdf_mxl
117
118   !!======================================================================
119END MODULE zdfmxl
Note: See TracBrowser for help on using the repository browser.