- Timestamp:
- 2016-06-06T07:57:00+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/DIA/diatmb.F90
r6140 r6667 4 4 !! Harmonic analysis of tidal constituents 5 5 !!====================================================================== 6 !! History : 3.6 ! 2014 (E O'Dea) Original code 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 7 8 !!---------------------------------------------------------------------- 8 9 USE oce ! ocean dynamics and tracers variables 9 10 USE dom_oce ! ocean space and time domain 11 ! 10 12 USE in_out_manager ! I/O units 11 13 USE iom ! I/0 library … … 31 33 !! *** ROUTINE dia_tmb_init *** 32 34 !! 33 !! ** Purpose :Initialization of tmb namelist35 !! ** Purpose : Initialization of tmb namelist 34 36 !! 35 !! ** Method : Read namelist 36 !! History 37 !! 3.6 ! 08-14 (E. O'Dea) Routine to initialize dia_tmb 37 !! ** Method : Read namelist 38 38 !!--------------------------------------------------------------------------- 39 !!40 39 INTEGER :: ios ! Local integer output status for namelist read 41 40 ! … … 59 58 WRITE(numout,*) 'Switch for TMB diagnostics (T) or not (F) ln_diatmb = ', ln_diatmb 60 59 ENDIF 61 60 ! 62 61 END SUBROUTINE dia_tmb_init 63 62 64 SUBROUTINE dia_calctmb( pinfield,pouttmb ) 63 64 SUBROUTINE dia_calctmb( pfield, ptmb ) 65 65 !!--------------------------------------------------------------------- 66 66 !! *** ROUTINE dia_tmb *** … … 68 68 !! ** Purpose : Find the Top, Mid and Bottom fields of water Column 69 69 !! 70 !! ** Method : 71 !! use mbathy to find surface, mid and bottom of model levels70 !! ** Method : use mbkt, mikt to find surface, mid and bottom of 71 !! model levels due to potential existence of ocean cavities 72 72 !! 73 !! History :74 !! 3.6 ! 08-14 (E. O'Dea) Routine based on dia_wri_foam75 73 !!---------------------------------------------------------------------- 76 !! * Modules used 77 78 ! Routine to map 3d field to top, middle, bottom 79 IMPLICIT NONE 80 81 82 ! Routine arguments 83 REAL(wp), DIMENSION(jpi, jpj, jpk), INTENT(IN ) :: pinfield ! Input 3d field and mask 84 REAL(wp), DIMENSION(jpi, jpj, 3 ), INTENT( OUT) :: pouttmb ! Output top, middle, bottom 85 86 87 88 ! Local variables 89 INTEGER :: ji,jj,jk ! Dummy loop indices 90 91 ! Local Real 92 REAL(wp) :: zmdi ! set masked values 93 94 zmdi=1.e+20 !missing data indicator for masking 95 96 ! Calculate top 97 pouttmb(:,:,1) = pinfield(:,:,1)*tmask(:,:,1) + zmdi*(1.0-tmask(:,:,1)) 98 99 ! Calculate middle 100 DO jj = 1,jpj 101 DO ji = 1,jpi 102 jk = max(1,mbathy(ji,jj)/2) 103 pouttmb(ji,jj,2) = pinfield(ji,jj,jk)*tmask(ji,jj,jk) + zmdi*(1.0-tmask(ji,jj,jk)) 74 REAL(wp), DIMENSION(jpi, jpj, jpk), INTENT(in ) :: pfield ! Input 3d field and mask 75 REAL(wp), DIMENSION(jpi, jpj, 3 ), INTENT( out) :: ptmb ! top, middle, bottom extracted from pfield 76 ! 77 INTEGER :: ji, jj ! Dummy loop indices 78 INTEGER :: itop, imid, ibot ! local integers 79 REAL(wp) :: zmdi = 1.e+20_wp ! land value 80 !!--------------------------------------------------------------------- 81 ! 82 DO jj = 1, jpj 83 DO ji = 1, jpi 84 itop = mikt(ji,jj) ! top ocean 85 ibot = mbkt(ji,jj) ! bottom ocean 86 imid = itop + ( ibot - itop + 1 ) / 2 ! middle ocean 87 ! 88 ptmb(ji,jj,1) = pfield(ji,jj,itop)*tmask(ji,jj,itop) + zmdi*( 1._wp-tmask(ji,jj,itop) ) 89 ptmb(ji,jj,2) = pfield(ji,jj,imid)*tmask(ji,jj,imid) + zmdi*( 1._wp-tmask(ji,jj,imid) ) 90 ptmb(ji,jj,3) = pfield(ji,jj,ibot)*tmask(ji,jj,ibot) + zmdi*( 1._wp-tmask(ji,jj,ibot) ) 104 91 END DO 105 92 END DO 106 107 ! Calculate bottom 108 DO jj = 1,jpj 109 DO ji = 1,jpi 110 jk = max(1,mbathy(ji,jj) - 1) 111 pouttmb(ji,jj,3) = pinfield(ji,jj,jk)*tmask(ji,jj,jk) + zmdi*(1.0-tmask(ji,jj,jk)) 112 END DO 113 END DO 114 93 ! 115 94 END SUBROUTINE dia_calctmb 116 117 95 118 96 … … 122 100 !! ** Purpose : Write diagnostics for Top, Mid and Bottom of water Column 123 101 !! 124 !! ** Method : 125 !! use mbathy to find surface, mid and bottom of model levels 102 !! ** Method : use mikt,mbkt to find surface, mid and bottom of model levels 126 103 !! calls calctmb to retrieve TMB values before sending to iom_put 127 104 !! 128 !! History :129 !! 3.6 ! 08-14 (E. O'Dea)130 !!131 105 !!-------------------------------------------------------------------- 132 REAL(wp), POINTER, DIMENSION(:,:,:) :: zwtmb ! temporary workspace 133 REAL(wp) :: zmdi ! set masked values 134 135 zmdi=1.e+20 !missing data indicator for maskin 136 106 REAL(wp) :: zmdi =1.e+20 ! land value 107 REAL(wp), POINTER, DIMENSION(:,:,:) :: zwtmb ! workspace 108 !!-------------------------------------------------------------------- 109 ! 137 110 IF (ln_diatmb) THEN 138 CALL wrk_alloc( jpi , jpj, 3, zwtmb )111 CALL wrk_alloc( jpi,jpj,3 , zwtmb ) 139 112 CALL dia_calctmb( tsn(:,:,:,jp_tem),zwtmb ) 140 113 !ssh already output but here we output it masked 141 CALL iom_put( "sshnmasked" , sshn(:,:)*tmask(:,:,1) + zmdi*(1.0 - tmask(:,:,1)) ) ! tmb Temperature114 CALL iom_put( "sshnmasked" , sshn(:,:)*tmask(:,:,1) + zmdi*(1.0 - tmask(:,:,1)) ) 142 115 CALL iom_put( "top_temp" , zwtmb(:,:,1) ) ! tmb Temperature 143 116 CALL iom_put( "mid_temp" , zwtmb(:,:,2) ) ! tmb Temperature … … 161 134 CALL iom_put( "bot_v" , zwtmb(:,:,3) ) ! tmb V Velocity 162 135 !Called in dynspg_ts.F90 CALL iom_put( "baro_v" , vn_b ) ! Barotropic V Velocity 136 CALL wrk_dealloc( jpi,jpj,3 , zwtmb ) 163 137 ELSE 164 138 CALL ctl_warn('dia_tmb: tmb diagnostic is set to false you should not have seen this') 165 139 ENDIF 166 140 ! 167 141 END SUBROUTINE dia_tmb 168 142 !!======================================================================
Note: See TracChangeset
for help on using the changeset viewer.