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.
diatmb.F90 in NEMO/branches/UKMO/dev_r9950_old_tidal_mixing/src/OCE/DIA – NEMO

source: NEMO/branches/UKMO/dev_r9950_old_tidal_mixing/src/OCE/DIA/diatmb.F90 @ 10328

Last change on this file since 10328 was 10328, checked in by davestorkey, 5 years ago

UKMO/dev_r9950_old_tidal_mixing branch: clear SVN keywords.

File size: 6.3 KB
Line 
1MODULE diatmb 
2   !!======================================================================
3   !!                       ***  MODULE  diaharm  ***
4   !! Harmonic analysis of tidal constituents
5   !!======================================================================
6   !! History :  3.6  !  08-2014  (E O'Dea)  Original code
7   !!            3.7  !  05-2016  (G. Madec)  use mbkt, mikt to account for ocean cavities
8   !!----------------------------------------------------------------------
9   USE oce             ! ocean dynamics and tracers variables
10   USE dom_oce         ! ocean space and time domain
11   !
12   USE in_out_manager  ! I/O units
13   USE iom             ! I/0 library
14
15   IMPLICIT NONE
16   PRIVATE
17
18   LOGICAL , PUBLIC ::   ln_diatmb     !: Top Middle and Bottom output
19   PUBLIC   dia_tmb_init            ! routine called by nemogcm.F90
20   PUBLIC   dia_tmb                 ! routine called by diawri.F90
21
22   !!----------------------------------------------------------------------
23   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
24   !! $Id$
25   !! Software governed by the CeCILL license (see ./LICENSE)
26   !!----------------------------------------------------------------------
27CONTAINS
28
29   SUBROUTINE dia_tmb_init 
30      !!---------------------------------------------------------------------------
31      !!                  ***  ROUTINE dia_tmb_init  ***
32      !!     
33      !! ** Purpose :   Initialization of tmb namelist
34      !!       
35      !! ** Method  :   Read namelist
36      !!---------------------------------------------------------------------------
37      INTEGER ::   ios                 ! Local integer output status for namelist read
38      !
39      NAMELIST/nam_diatmb/ ln_diatmb
40      !!----------------------------------------------------------------------
41      !
42      REWIND( numnam_ref )              ! Read Namelist nam_diatmb in reference namelist : TMB diagnostics
43      READ  ( numnam_ref, nam_diatmb, IOSTAT=ios, ERR= 901 )
44901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_diatmb in reference namelist', lwp )
45 
46      REWIND( numnam_cfg )              ! Namelist nam_diatmb in configuration namelist  TMB diagnostics
47      READ  ( numnam_cfg, nam_diatmb, IOSTAT = ios, ERR = 902 )
48902   IF( ios >  0 ) CALL ctl_nam ( ios , 'nam_diatmb in configuration namelist', lwp )
49      IF(lwm) WRITE ( numond, nam_diatmb )
50
51      IF(lwp) THEN                   ! Control print
52         WRITE(numout,*)
53         WRITE(numout,*) 'dia_tmb_init : Output Top, Middle, Bottom Diagnostics'
54         WRITE(numout,*) '~~~~~~~~~~~~'
55         WRITE(numout,*) '   Namelist nam_diatmb : set tmb outputs '
56         WRITE(numout,*) '      Switch for TMB diagnostics (T) or not (F)  ln_diatmb  = ', ln_diatmb
57      ENDIF
58      !
59   END SUBROUTINE dia_tmb_init
60
61
62   SUBROUTINE dia_calctmb( pfield, ptmb )
63      !!---------------------------------------------------------------------
64      !!                  ***  ROUTINE dia_tmb  ***
65      !!                   
66      !! ** Purpose :    Find the Top, Mid and Bottom fields of water Column
67      !!
68      !! ** Method  :    use mbkt, mikt to find surface, mid and bottom of
69      !!              model levels due to potential existence of ocean cavities
70      !!
71      !!----------------------------------------------------------------------
72      REAL(wp), DIMENSION(jpi, jpj, jpk), INTENT(in   ) ::   pfield   ! Input 3D field and mask
73      REAL(wp), DIMENSION(jpi, jpj,  3 ), INTENT(  out) ::   ptmb     ! top, middle, bottom extracted from pfield
74      !
75      INTEGER ::   ji, jj   ! Dummy loop indices
76      INTEGER ::   itop, imid, ibot   ! local integers
77      REAL(wp)::   zmdi = 1.e+20_wp   ! land value
78      !!---------------------------------------------------------------------
79      !
80      DO jj = 1, jpj
81         DO ji = 1, jpi
82            itop = mikt(ji,jj)                        ! top    ocean
83            ibot = mbkt(ji,jj)                        ! bottom ocean
84            imid =  itop + ( ibot - itop + 1 ) / 2    ! middle ocean         
85            !                   
86            ptmb(ji,jj,1) = pfield(ji,jj,itop)*tmask(ji,jj,itop) + zmdi*( 1._wp-tmask(ji,jj,itop) )
87            ptmb(ji,jj,2) = pfield(ji,jj,imid)*tmask(ji,jj,imid) + zmdi*( 1._wp-tmask(ji,jj,imid) )
88            ptmb(ji,jj,3) = pfield(ji,jj,ibot)*tmask(ji,jj,ibot) + zmdi*( 1._wp-tmask(ji,jj,ibot) )
89         END DO
90      END DO
91      !
92   END SUBROUTINE dia_calctmb
93
94
95   SUBROUTINE dia_tmb
96      !!----------------------------------------------------------------------
97      !!                 ***  ROUTINE dia_tmb  ***
98      !! ** Purpose :   Write diagnostics for Top, Mid and Bottom of water Column
99      !!
100      !! ** Method  :  use mikt,mbkt to find surface, mid and bottom of model levels
101      !!      calls calctmb to retrieve TMB values before sending to iom_put
102      !!
103      !!--------------------------------------------------------------------
104      REAL(wp) ::   zmdi =1.e+20     ! land value
105      REAL(wp), DIMENSION(jpi,jpj,3) :: zwtmb    ! workspace
106      !!--------------------------------------------------------------------
107      !
108      CALL dia_calctmb( tsn(:,:,:,jp_tem), zwtmb )
109      !ssh already output but here we output it masked
110      CALL iom_put( "sshnmasked", sshn(:,:)*tmask(:,:,1) + zmdi*(1.0 - tmask(:,:,1)) )
111      CALL iom_put( "top_temp"  , zwtmb(:,:,1) )    ! tmb Temperature
112      CALL iom_put( "mid_temp"  , zwtmb(:,:,2) )    ! tmb Temperature
113      CALL iom_put( "bot_temp"  , zwtmb(:,:,3) )    ! tmb Temperature
114      !
115      CALL dia_calctmb( tsn(:,:,:,jp_sal), zwtmb )
116      CALL iom_put( "top_sal"   , zwtmb(:,:,1) )    ! tmb Salinity
117      CALL iom_put( "mid_sal"   , zwtmb(:,:,2) )    ! tmb Salinity
118      CALL iom_put( "bot_sal"   , zwtmb(:,:,3) )    ! tmb Salinity
119      !
120      CALL dia_calctmb( un(:,:,:), zwtmb )
121      CALL iom_put( "top_u"     , zwtmb(:,:,1) )    ! tmb  U Velocity
122      CALL iom_put( "mid_u"     , zwtmb(:,:,2) )    ! tmb  U Velocity
123      CALL iom_put( "bot_u"     , zwtmb(:,:,3) )    ! tmb  U Velocity
124      !
125      CALL dia_calctmb( vn(:,:,:), zwtmb )
126      CALL iom_put( "top_v"     , zwtmb(:,:,1) )    ! tmb  V Velocity
127      CALL iom_put( "mid_v"     , zwtmb(:,:,2) )    ! tmb  V Velocity
128      CALL iom_put( "bot_v"     , zwtmb(:,:,3) )    ! tmb  V Velocity
129      !
130   END SUBROUTINE dia_tmb
131
132   !!======================================================================
133END MODULE diatmb
Note: See TracBrowser for help on using the repository browser.