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/UKMO/dev_r5518_v3.4_asm_nemovar_community/NEMOGCM/NEMO/OPA_SRC/ZDF – NEMO

source: branches/UKMO/dev_r5518_v3.4_asm_nemovar_community/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfmxl.F90 @ 6630

Last change on this file since 6630 was 6630, checked in by kingr, 8 years ago

Adpated changes required to apply 2D surft increments in AMM7 from NEMO3.4 branch /branches/dev/frwe/vn3.4_ASM_NEMOVAR_community.

File size: 8.1 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   !!            3.7  ! 2012-03  (G. Madec)  make public the density criteria for trdmxl
9   !!             -   ! 2014-02  (F. Roquet)  mixed layer depth calculated using N2 instead of rhop
10   !!----------------------------------------------------------------------
11   !!   zdf_mxl      : Compute the turbocline and mixed layer depths.
12   !!----------------------------------------------------------------------
13   USE oce             ! ocean dynamics and tracers variables
14   USE dom_oce         ! ocean space and time domain variables
15   USE zdf_oce         ! ocean vertical physics
16   USE in_out_manager  ! I/O manager
17   USE prtctl          ! Print control
18   USE phycst          ! physical constants
19   USE iom             ! I/O library
20   USE lib_mpp         ! MPP library
21   USE wrk_nemo        ! work arrays
22   USE timing          ! Timing
23   USE trc_oce, ONLY : lk_offline ! offline flag
24
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   zdf_mxl       ! called by step.F90
29   PUBLIC   zdf_mxl_alloc ! Used in zdf_tke_init
30
31   INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   nmln    !: number of level in the mixed layer (used by TOP)
32   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmld    !: mixing layer depth (turbocline)      [m]
33   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmlp    !: mixed layer depth  (rho=rho0+zdcrit) [m]
34   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmlpt   !: mixed layer depth at t-points        [m]
35   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   hmld_tref  !: mixed layer depth at t-points - temperature criterion [m]
36
37   REAL(wp), PUBLIC ::   rho_c = 0.01_wp    !: density criterion for mixed layer depth
38   REAL(wp)         ::   avt_c = 5.e-4_wp   ! Kz criterion for the turbocline depth
39
40   !! * Substitutions
41#  include "domzgr_substitute.h90"
42   !!----------------------------------------------------------------------
43   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
44   !! $Id$
45   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
46   !!----------------------------------------------------------------------
47CONTAINS
48
49   INTEGER FUNCTION zdf_mxl_alloc()
50      !!----------------------------------------------------------------------
51      !!               ***  FUNCTION zdf_mxl_alloc  ***
52      !!----------------------------------------------------------------------
53      zdf_mxl_alloc = 0      ! set to zero if no array to be allocated
54      IF( .NOT. ALLOCATED( nmln ) ) THEN
55         ALLOCATE( nmln(jpi,jpj), hmld(jpi,jpj), hmlp(jpi,jpj), hmlpt(jpi,jpj), &
56         &                           hmld_tref(jpi,jpj), STAT= zdf_mxl_alloc )
57         !
58         IF( lk_mpp             )   CALL mpp_sum ( zdf_mxl_alloc )
59         IF( zdf_mxl_alloc /= 0 )   CALL ctl_warn('zdf_mxl_alloc: failed to allocate arrays.')
60         !
61      ENDIF
62   END FUNCTION zdf_mxl_alloc
63
64
65   SUBROUTINE zdf_mxl( kt )
66      !!----------------------------------------------------------------------
67      !!                  ***  ROUTINE zdfmxl  ***
68      !!                   
69      !! ** Purpose :   Compute the turbocline depth and the mixed layer depth
70      !!              with density criteria.
71      !!
72      !! ** Method  :   The mixed layer depth is the shallowest W depth with
73      !!      the density of the corresponding T point (just bellow) bellow a
74      !!      given value defined locally as rho(10m) + rho_c
75      !!               The turbocline depth is the depth at which the vertical
76      !!      eddy diffusivity coefficient (resulting from the vertical physics
77      !!      alone, not the isopycnal part, see trazdf.F) fall below a given
78      !!      value defined locally (avt_c here taken equal to 5 cm/s2 by default)
79      !!
80      !! ** Action  :   nmln, hmld, hmlp, hmlpt
81      !!----------------------------------------------------------------------
82      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
83      !
84      INTEGER  ::   ji, jj, jk   ! dummy loop indices
85      INTEGER  ::   iikn, iiki, ikt, imkt   ! local integer
86      REAL(wp) ::   zN2_c        ! local scalar
87      INTEGER, POINTER, DIMENSION(:,:) ::   imld   ! 2D workspace
88      REAL(wp) ::   t_ref               ! Reference temperature 
89      REAL(wp) ::   temp_c = 0.2        ! temperature criterion for mixed layer depth 
90      !!----------------------------------------------------------------------
91      !
92      IF( nn_timing == 1 )  CALL timing_start('zdf_mxl')
93      !
94      CALL wrk_alloc( jpi,jpj, imld )
95
96      IF( kt == nit000 ) THEN
97         IF(lwp) WRITE(numout,*)
98         IF(lwp) WRITE(numout,*) 'zdf_mxl : mixed layer depth'
99         IF(lwp) WRITE(numout,*) '~~~~~~~ '
100         !                             ! allocate zdfmxl arrays
101         IF( zdf_mxl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'zdf_mxl : unable to allocate arrays' )
102      ENDIF
103
104      ! w-level of the mixing and mixed layers
105      nmln(:,:)  = nlb10               ! Initialization to the number of w ocean point
106      hmlp(:,:)  = 0._wp               ! here hmlp used as a dummy variable, integrating vertically N^2
107      zN2_c = grav * rho_c * r1_rau0   ! convert density criteria into N^2 criteria
108      DO jk = nlb10, jpkm1
109         DO jj = 1, jpj                ! Mixed layer level: w-level
110            DO ji = 1, jpi
111               ikt = mbkt(ji,jj)
112               hmlp(ji,jj) = hmlp(ji,jj) + MAX( rn2b(ji,jj,jk) , 0._wp ) * fse3w(ji,jj,jk)
113               IF( hmlp(ji,jj) < zN2_c )   nmln(ji,jj) = MIN( jk , ikt ) + 1   ! Mixed layer level
114            END DO
115         END DO
116      END DO
117      !
118      ! w-level of the turbocline
119      imld(:,:) = mbkt(:,:) + 1        ! Initialization to the number of w ocean point
120      DO jk = jpkm1, nlb10, -1         ! from the bottom to nlb10
121         DO jj = 1, jpj
122            DO ji = 1, jpi
123               imkt = mikt(ji,jj)
124               IF( avt (ji,jj,jk) < avt_c )   imld(ji,jj) = MAX( imkt, jk )      ! Turbocline
125            END DO
126         END DO
127      END DO
128      ! depth of the mixing and mixed layers
129      DO jj = 1, jpj
130         DO ji = 1, jpi
131            iiki = imld(ji,jj)
132            iikn = nmln(ji,jj)
133            imkt = mikt(ji,jj)
134            hmld (ji,jj) = ( fsdepw(ji,jj,iiki  ) - fsdepw(ji,jj,imkt ) ) * ssmask(ji,jj)    ! Turbocline depth
135            hmlp (ji,jj) = ( fsdepw(ji,jj,iikn  ) - fsdepw(ji,jj,imkt ) ) * ssmask(ji,jj)    ! Mixed layer depth
136            hmlpt(ji,jj) = ( fsdept(ji,jj,iikn-1) - fsdepw(ji,jj,imkt ) ) * ssmask(ji,jj)    ! depth of the last T-point inside the mixed layer
137         END DO
138      END DO
139      IF( .NOT.lk_offline ) THEN            ! no need to output in offline mode
140         CALL iom_put( "mldr10_1", hmlp )   ! mixed layer depth
141         CALL iom_put( "mldkz5"  , hmld )   ! turbocline depth
142      ENDIF
143
144      !For the AMM model assimiation uses a temperature based mixed layer depth 
145      !This is defined here 
146      DO jj = 1, jpj 
147         DO ji = 1, jpi 
148           hmld_tref(ji,jj)=fsdept(ji,jj,1  )   
149           IF(ssmask(ji,jj) > 0.)THEN 
150             t_ref=tsn(ji,jj,1,jp_tem) 
151             DO jk=2,jpk 
152               IF(ssmask(ji,jj)==0.)THEN 
153                  hmld_tref(ji,jj)=fsdept(ji,jj,jk ) 
154                  EXIT 
155               ELSEIF( ABS(tsn(ji,jj,jk,jp_tem)-t_ref) < temp_c)THEN 
156                  hmld_tref(ji,jj)=fsdept(ji,jj,jk ) 
157               ELSE 
158                  EXIT 
159               ENDIF 
160             ENDDO 
161           ENDIF 
162         ENDDO 
163      ENDDO
164     
165      IF(ln_ctl)   CALL prt_ctl( tab2d_1=REAL(nmln,wp), clinfo1=' nmln : ', tab2d_2=hmlp, clinfo2=' hmlp : ', ovlap=1 )
166      !
167      CALL wrk_dealloc( jpi,jpj, imld )
168      !
169      IF( nn_timing == 1 )  CALL timing_stop('zdf_mxl')
170      !
171   END SUBROUTINE zdf_mxl
172
173   !!======================================================================
174END MODULE zdfmxl
Note: See TracBrowser for help on using the repository browser.