[4756] | 1 | MODULE diatmb |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE diaharm *** |
---|
| 4 | !! Harmonic analysis of tidal constituents |
---|
| 5 | !!====================================================================== |
---|
[7646] | 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 |
---|
[4756] | 8 | !!---------------------------------------------------------------------- |
---|
| 9 | USE oce ! ocean dynamics and tracers variables |
---|
| 10 | USE dom_oce ! ocean space and time domain |
---|
[7646] | 11 | ! |
---|
[4756] | 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 | !!---------------------------------------------------------------------- |
---|
[9598] | 23 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[10068] | 24 | !! $Id$ |
---|
| 25 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[4756] | 26 | !!---------------------------------------------------------------------- |
---|
| 27 | CONTAINS |
---|
| 28 | |
---|
| 29 | SUBROUTINE dia_tmb_init |
---|
| 30 | !!--------------------------------------------------------------------------- |
---|
| 31 | !! *** ROUTINE dia_tmb_init *** |
---|
| 32 | !! |
---|
[7646] | 33 | !! ** Purpose : Initialization of tmb namelist |
---|
[4756] | 34 | !! |
---|
[7646] | 35 | !! ** Method : Read namelist |
---|
[4756] | 36 | !!--------------------------------------------------------------------------- |
---|
| 37 | INTEGER :: ios ! Local integer output status for namelist read |
---|
| 38 | ! |
---|
| 39 | NAMELIST/nam_diatmb/ ln_diatmb |
---|
| 40 | !!---------------------------------------------------------------------- |
---|
| 41 | ! |
---|
[9124] | 42 | REWIND( numnam_ref ) ! Read Namelist nam_diatmb in reference namelist : TMB diagnostics |
---|
| 43 | READ ( numnam_ref, nam_diatmb, IOSTAT=ios, ERR= 901 ) |
---|
[4756] | 44 | 901 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 ) |
---|
[9124] | 48 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nam_diatmb in configuration namelist', lwp ) |
---|
[4756] | 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,*) '~~~~~~~~~~~~' |
---|
[9490] | 55 | WRITE(numout,*) ' Namelist nam_diatmb : set tmb outputs ' |
---|
| 56 | WRITE(numout,*) ' Switch for TMB diagnostics (T) or not (F) ln_diatmb = ', ln_diatmb |
---|
[4756] | 57 | ENDIF |
---|
[7646] | 58 | ! |
---|
[4756] | 59 | END SUBROUTINE dia_tmb_init |
---|
| 60 | |
---|
[7646] | 61 | |
---|
| 62 | SUBROUTINE dia_calctmb( pfield, ptmb ) |
---|
[4756] | 63 | !!--------------------------------------------------------------------- |
---|
| 64 | !! *** ROUTINE dia_tmb *** |
---|
| 65 | !! |
---|
| 66 | !! ** Purpose : Find the Top, Mid and Bottom fields of water Column |
---|
| 67 | !! |
---|
[7646] | 68 | !! ** Method : use mbkt, mikt to find surface, mid and bottom of |
---|
| 69 | !! model levels due to potential existence of ocean cavities |
---|
[4756] | 70 | !! |
---|
| 71 | !!---------------------------------------------------------------------- |
---|
[9124] | 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 |
---|
[7646] | 74 | ! |
---|
[9124] | 75 | INTEGER :: ji, jj ! Dummy loop indices |
---|
| 76 | INTEGER :: itop, imid, ibot ! local integers |
---|
| 77 | REAL(wp):: zmdi = 1.e+20_wp ! land value |
---|
[7646] | 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 | ! |
---|
[9124] | 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) ) |
---|
[4756] | 89 | END DO |
---|
| 90 | END DO |
---|
[7646] | 91 | ! |
---|
[4756] | 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 | !! |
---|
[7646] | 100 | !! ** Method : use mikt,mbkt to find surface, mid and bottom of model levels |
---|
[4756] | 101 | !! calls calctmb to retrieve TMB values before sending to iom_put |
---|
| 102 | !! |
---|
| 103 | !!-------------------------------------------------------------------- |
---|
[7646] | 104 | REAL(wp) :: zmdi =1.e+20 ! land value |
---|
[9125] | 105 | REAL(wp), DIMENSION(jpi,jpj,3) :: zwtmb ! workspace |
---|
[7646] | 106 | !!-------------------------------------------------------------------- |
---|
| 107 | ! |
---|
[9124] | 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 |
---|
[7646] | 114 | ! |
---|
[9124] | 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 | ! |
---|
[4756] | 130 | END SUBROUTINE dia_tmb |
---|
[9124] | 131 | |
---|
[4756] | 132 | !!====================================================================== |
---|
| 133 | END MODULE diatmb |
---|