- Timestamp:
- 2016-01-08T10:35:19+01:00 (8 years ago)
- Location:
- branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP
- Files:
-
- 5 deleted
- 9 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90
r4610 r6225 4 4 !! Ocean passive tracers: advection trend 5 5 !!============================================================================== 6 !! History : 2.0 ! 05-11 (G. Madec) Original code 7 !! 3.0 ! 10-06 (C. Ethe) Adapted to passive tracers 6 !! History : 2.0 ! 2005-11 (G. Madec) Original code 7 !! 3.0 ! 2010-06 (C. Ethe) Adapted to passive tracers 8 !! 3.7 ! 2014-05 (G. Madec, C. Ethe) Add 2nd/4th order cases for CEN and FCT schemes 8 9 !!---------------------------------------------------------------------- 9 10 #if defined key_top … … 11 12 !! 'key_top' TOP models 12 13 !!---------------------------------------------------------------------- 13 !! trc_adv : compute ocean tracer advection trend 14 !! trc_adv_ctl : control the different options of advection scheme 15 !!---------------------------------------------------------------------- 16 USE oce_trc ! ocean dynamics and active tracers 17 USE trc ! ocean passive tracers variables 18 USE trcnam_trp ! passive tracers transport namelist variables 19 USE traadv_cen2 ! 2nd order centered scheme (tra_adv_cen2 routine) 20 USE traadv_tvd ! TVD scheme (tra_adv_tvd routine) 21 USE traadv_muscl ! MUSCL scheme (tra_adv_muscl routine) 22 USE traadv_muscl2 ! MUSCL2 scheme (tra_adv_muscl2 routine) 23 USE traadv_ubs ! UBS scheme (tra_adv_ubs routine) 24 USE traadv_qck ! QUICKEST scheme (tra_adv_qck routine) 25 USE traadv_eiv ! eddy induced velocity (tra_adv_eiv routine) 26 USE traadv_mle ! ML eddy induced velocity (tra_adv_mle routine) 27 USE ldftra_oce ! lateral diffusion coefficient on tracers 28 USE prtctl_trc ! Print control 14 !! trc_adv : compute ocean tracer advection trend 15 !! trc_adv_ini : control the different options of advection scheme 16 !!---------------------------------------------------------------------- 17 USE oce_trc ! ocean dynamics and active tracers 18 USE trc ! ocean passive tracers variables 19 USE traadv_cen ! centered scheme (tra_adv_cen routine) 20 USE traadv_fct ! FCT scheme (tra_adv_fct routine) 21 USE traadv_mus ! MUSCL scheme (tra_adv_mus routine) 22 USE traadv_ubs ! UBS scheme (tra_adv_ubs routine) 23 USE traadv_qck ! QUICKEST scheme (tra_adv_qck routine) 24 USE traadv_mle ! ML eddy induced velocity (tra_adv_mle routine) 25 USE ldftra ! lateral diffusion coefficient on tracers 26 USE ldfslp ! Lateral diffusion: slopes of neutral surfaces 27 ! 28 USE prtctl_trc ! Print control 29 29 30 30 IMPLICIT NONE 31 31 PRIVATE 32 32 33 PUBLIC trc_adv ! routine called by step module 34 PUBLIC trc_adv_alloc ! routine called by nemogcm module 35 36 INTEGER :: nadv ! choice of the type of advection scheme 37 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: r2dt ! vertical profile time-step, = 2 rdttra 38 ! ! except at nitrrc000 (=rdttra) if neuler=0 33 PUBLIC trc_adv 34 PUBLIC trc_adv_ini 35 36 ! !!* Namelist namtrc_adv * 37 LOGICAL :: ln_trcadv_cen ! centered scheme flag 38 INTEGER :: nn_cen_h, nn_cen_v ! =2/4 : horizontal and vertical choices of the order of CEN scheme 39 LOGICAL :: ln_trcadv_fct ! FCT scheme flag 40 INTEGER :: nn_fct_h, nn_fct_v ! =2/4 : horizontal and vertical choices of the order of FCT scheme 41 INTEGER :: nn_fct_zts ! >=1 : 2nd order FCT with vertical sub-timestepping 42 LOGICAL :: ln_trcadv_mus ! MUSCL scheme flag 43 LOGICAL :: ln_mus_ups ! use upstream scheme in vivcinity of river mouths 44 LOGICAL :: ln_trcadv_ubs ! UBS scheme flag 45 INTEGER :: nn_ubs_v ! =2/4 : vertical choice of the order of UBS scheme 46 LOGICAL :: ln_trcadv_qck ! QUICKEST scheme flag 47 48 ! ! choices of advection scheme: 49 INTEGER, PARAMETER :: np_NO_adv = 0 ! no T-S advection 50 INTEGER, PARAMETER :: np_CEN = 1 ! 2nd/4th order centered scheme 51 INTEGER, PARAMETER :: np_FCT = 2 ! 2nd/4th order Flux Corrected Transport scheme 52 INTEGER, PARAMETER :: np_FCT_zts = 3 ! 2nd order FCT scheme with vertical sub-timestepping 53 INTEGER, PARAMETER :: np_MUS = 4 ! MUSCL scheme 54 INTEGER, PARAMETER :: np_UBS = 5 ! 3rd order Upstream Biased Scheme 55 INTEGER, PARAMETER :: np_QCK = 6 ! QUICK scheme 56 57 INTEGER :: nadv ! chosen advection scheme 58 ! 59 REAL(wp) :: r2dttrc ! vertical profile time-step, = 2 rdt 60 ! ! except at nitrrc000 (=rdt) if neuler=0 39 61 40 62 !! * Substitutions 41 # include "domzgr_substitute.h90"42 63 # include "vectopt_loop_substitute.h90" 43 64 !!---------------------------------------------------------------------- 44 !! NEMO/TOP 3. 3 , NEMO Consortium (2010)65 !! NEMO/TOP 3.7 , NEMO Consortium (2015) 45 66 !! $Id$ 46 67 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 47 68 !!---------------------------------------------------------------------- 48 69 CONTAINS 49 50 INTEGER FUNCTION trc_adv_alloc()51 !!----------------------------------------------------------------------52 !! *** ROUTINE trc_adv_alloc ***53 !!----------------------------------------------------------------------54 55 ALLOCATE( r2dt(jpk), STAT=trc_adv_alloc )56 57 IF( trc_adv_alloc /= 0 ) CALL ctl_warn('trc_adv_alloc : failed to allocate array.')58 59 END FUNCTION trc_adv_alloc60 61 70 62 71 SUBROUTINE trc_adv( kt ) … … 68 77 !! ** Method : - Update the tracer with the advection term following nadv 69 78 !!---------------------------------------------------------------------- 70 !!71 79 INTEGER, INTENT(in) :: kt ! ocean time-step index 72 80 ! 73 INTEGER :: jk 81 INTEGER :: jk ! dummy loop index 74 82 CHARACTER (len=22) :: charout 75 83 REAL(wp), POINTER, DIMENSION(:,:,:) :: zun, zvn, zwn ! effective velocity 76 84 !!---------------------------------------------------------------------- 77 85 ! 78 IF( nn_timing == 1 ) CALL timing_start('trc_adv') 79 ! 80 CALL wrk_alloc( jpi, jpj, jpk, zun, zvn, zwn ) 81 ! 82 83 IF( kt == nittrc000 ) CALL trc_adv_ctl ! initialisation & control of options 84 85 IF( ln_top_euler) THEN 86 r2dt(:) = rdttrc(:) ! = rdttrc (use Euler time stepping) 87 ELSE 88 IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! at nittrc000 89 r2dt(:) = rdttrc(:) ! = rdttrc (restarting with Euler time stepping) 90 ELSEIF( kt <= nittrc000 + 1 ) THEN ! at nittrc000 or nittrc000+1 91 r2dt(:) = 2. * rdttrc(:) ! = 2 rdttrc (leapfrog) 92 ENDIF 93 ENDIF 94 95 ! ! effective transport 86 IF( nn_timing == 1 ) CALL timing_start('trc_adv') 87 ! 88 CALL wrk_alloc( jpi,jpj,jpk, zun, zvn, zwn ) 89 ! 90 IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN ! at nittrc000 91 r2dttrc = rdttrc ! = rdttrc (use or restarting with Euler time stepping) 92 ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN ! at nittrc000 or nittrc000+1 93 r2dttrc = 2. * rdttrc ! = 2 rdttrc (leapfrog) 94 ENDIF 95 ! !== effective transport ==! 96 96 DO jk = 1, jpkm1 97 ! ! eulerian transport only 98 zun(:,:,jk) = e2u (:,:) * fse3u(:,:,jk) * un(:,:,jk) 99 zvn(:,:,jk) = e1v (:,:) * fse3v(:,:,jk) * vn(:,:,jk) 97 zun(:,:,jk) = e2u (:,:) * e3u_n(:,:,jk) * un(:,:,jk) ! eulerian transport 98 zvn(:,:,jk) = e1v (:,:) * e3v_n(:,:,jk) * vn(:,:,jk) 100 99 zwn(:,:,jk) = e1e2t(:,:) * wn(:,:,jk) 101 !102 100 END DO 103 101 ! 104 IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN 102 IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN ! add z-tilde and/or vvl corrections 105 103 zun(:,:,:) = zun(:,:,:) + un_td(:,:,:) 106 104 zvn(:,:,:) = zvn(:,:,:) + vn_td(:,:,:) 107 105 ENDIF 108 106 ! 109 zun(:,:,jpk) = 0._wp ! no transport trough the bottom 110 zvn(:,:,jpk) = 0._wp ! no transport trough the bottom 111 zwn(:,:,jpk) = 0._wp ! no transport trough the bottom 112 113 IF( lk_traldf_eiv .AND. .NOT. ln_traldf_grif ) & ! add the eiv transport (if necessary) 114 & CALL tra_adv_eiv( kt, nittrc000, zun, zvn, zwn, 'TRC' ) 115 ! 116 IF( ln_mle ) CALL tra_adv_mle( kt, nittrc000, zun, zvn, zwn, 'TRC' ) ! add the mle transport (if necessary) 117 ! 118 SELECT CASE ( nadv ) !== compute advection trend and add it to general trend ==! 119 CASE ( 1 ) ; CALL tra_adv_cen2 ( kt, nittrc000, 'TRC', zun, zvn, zwn, trb, trn, tra, jptra ) ! 2nd order centered 120 CASE ( 2 ) ; CALL tra_adv_tvd ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) ! TVD 121 CASE ( 3 ) ; CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, tra, jptra, ln_trcadv_msc_ups ) ! MUSCL 122 CASE ( 4 ) ; CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) ! MUSCL2 123 CASE ( 5 ) ; CALL tra_adv_ubs ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) ! UBS 124 CASE ( 6 ) ; CALL tra_adv_qck ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) ! QUICKEST 125 ! 126 CASE (-1 ) !== esopa: test all possibility with control print ==! 127 CALL tra_adv_cen2 ( kt, nittrc000, 'TRC', zun, zvn, zwn, trb, trn, tra, jptra ) 128 WRITE(charout, FMT="('adv1')") ; CALL prt_ctl_trc_info(charout) 129 CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 130 CALL tra_adv_tvd ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) 131 WRITE(charout, FMT="('adv2')") ; CALL prt_ctl_trc_info(charout) 132 CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 133 CALL tra_adv_muscl ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, tra, jptra, ln_trcadv_msc_ups ) 134 WRITE(charout, FMT="('adv3')") ; CALL prt_ctl_trc_info(charout) 135 CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 136 CALL tra_adv_muscl2( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) 137 WRITE(charout, FMT="('adv4')") ; CALL prt_ctl_trc_info(charout) 138 CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 139 CALL tra_adv_ubs ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) 140 WRITE(charout, FMT="('adv5')") ; CALL prt_ctl_trc_info(charout) 141 CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 142 CALL tra_adv_qck ( kt, nittrc000, 'TRC', r2dt, zun, zvn, zwn, trb, trn, tra, jptra ) 143 WRITE(charout, FMT="('adv6')") ; CALL prt_ctl_trc_info(charout) 144 CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm,clinfo2='trd') 145 ! 107 IF( ln_ldfeiv .AND. .NOT. ln_traldf_triad ) & 108 & CALL ldf_eiv_trp( kt, nittrc000, zun, zvn, zwn, 'TRC' ) ! add the eiv transport 109 ! 110 IF( ln_mle ) CALL tra_adv_mle( kt, nittrc000, zun, zvn, zwn, 'TRC' ) ! add the mle transport 111 ! 112 zun(:,:,jpk) = 0._wp ! no transport trough the bottom 113 zvn(:,:,jpk) = 0._wp 114 zwn(:,:,jpk) = 0._wp 115 ! 116 ! 117 SELECT CASE ( nadv ) !== compute advection trend and add it to general trend ==! 118 ! 119 CASE ( np_CEN ) ! Centered : 2nd / 4th order 120 CALL tra_adv_cen ( kt, nittrc000,'TRC', zun, zvn, zwn , trn, tra, jptra, nn_cen_h, nn_cen_v ) 121 CASE ( np_FCT ) ! FCT : 2nd / 4th order 122 CALL tra_adv_fct ( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb, trn, tra, jptra, nn_fct_h, nn_fct_v ) 123 CASE ( np_FCT_zts ) ! 2nd order FCT with vertical time-splitting 124 CALL tra_adv_fct_zts( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb, trn, tra, jptra , nn_fct_zts ) 125 CASE ( np_MUS ) ! MUSCL 126 CALL tra_adv_mus ( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb, tra, jptra , ln_mus_ups ) 127 CASE ( np_UBS ) ! UBS 128 CALL tra_adv_ubs ( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb, trn, tra, jptra , nn_ubs_v ) 129 CASE ( np_QCK ) ! QUICKEST 130 CALL tra_adv_qck ( kt, nittrc000,'TRC', r2dttrc, zun, zvn, zwn, trb, trn, tra, jptra ) 131 ! 146 132 END SELECT 147 148 ! ! print mean trends (used for debugging) 149 IF( ln_ctl ) THEN 133 ! 134 IF( ln_ctl ) THEN !== print mean trends (used for debugging) 150 135 WRITE(charout, FMT="('adv ')") ; CALL prt_ctl_trc_info(charout) 151 136 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 152 137 END IF 153 138 ! 154 CALL wrk_dealloc( jpi, jpj, jpk,zun, zvn, zwn )139 CALL wrk_dealloc( jpi,jpj,jpk, zun, zvn, zwn ) 155 140 ! 156 141 IF( nn_timing == 1 ) CALL timing_stop('trc_adv') … … 159 144 160 145 161 SUBROUTINE trc_adv_ ctl146 SUBROUTINE trc_adv_ini 162 147 !!--------------------------------------------------------------------- 163 !! *** ROUTINE trc_adv_ ctl***148 !! *** ROUTINE trc_adv_ini *** 164 149 !! 165 150 !! ** Purpose : Control the consistency between namelist options for … … 167 152 !!---------------------------------------------------------------------- 168 153 INTEGER :: ioptio 169 !!---------------------------------------------------------------------- 170 171 ioptio = 0 ! Parameter control 172 IF( ln_trcadv_cen2 ) ioptio = ioptio + 1 173 IF( ln_trcadv_tvd ) ioptio = ioptio + 1 174 IF( ln_trcadv_muscl ) ioptio = ioptio + 1 175 IF( ln_trcadv_muscl2 ) ioptio = ioptio + 1 176 IF( ln_trcadv_ubs ) ioptio = ioptio + 1 177 IF( ln_trcadv_qck ) ioptio = ioptio + 1 178 IF( lk_esopa ) ioptio = 1 179 154 INTEGER :: ios ! Local integer output status for namelist read 155 !! 156 NAMELIST/namtrc_adv/ ln_trcadv_cen, nn_cen_h, nn_cen_v, & ! CEN 157 & ln_trcadv_fct, nn_fct_h, nn_fct_v, nn_fct_zts, & ! FCT 158 & ln_trcadv_mus, ln_mus_ups, & ! MUSCL 159 & ln_trcadv_ubs, nn_ubs_v, & ! UBS 160 & ln_trcadv_qck ! QCK 161 !!---------------------------------------------------------------------- 162 ! 163 REWIND( numnat_ref ) ! namtrc_adv in reference namelist 164 READ ( numnat_ref, namtrc_adv, IOSTAT = ios, ERR = 901) 165 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_adv in reference namelist', lwp ) 166 167 REWIND( numnat_cfg ) ! namtrc_adv in configuration namelist 168 READ ( numnat_cfg, namtrc_adv, IOSTAT = ios, ERR = 902 ) 169 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_adv in configuration namelist', lwp ) 170 IF(lwm) WRITE ( numont, namtrc_adv ) 171 172 IF(lwp) THEN ! Namelist print 173 WRITE(numout,*) 174 WRITE(numout,*) 'trc_adv_ini : choice/control of the tracer advection scheme' 175 WRITE(numout,*) '~~~~~~~~~~~' 176 WRITE(numout,*) ' Namelist namtrc_adv : chose a advection scheme for tracers' 177 WRITE(numout,*) ' centered scheme ln_trcadv_cen = ', ln_trcadv_cen 178 WRITE(numout,*) ' horizontal 2nd/4th order nn_cen_h = ', nn_fct_h 179 WRITE(numout,*) ' vertical 2nd/4th order nn_cen_v = ', nn_fct_v 180 WRITE(numout,*) ' Flux Corrected Transport scheme ln_trcadv_fct = ', ln_trcadv_fct 181 WRITE(numout,*) ' horizontal 2nd/4th order nn_fct_h = ', nn_fct_h 182 WRITE(numout,*) ' vertical 2nd/4th order nn_fct_v = ', nn_fct_v 183 WRITE(numout,*) ' 2nd order + vertical sub-timestepping nn_fct_zts = ', nn_fct_zts 184 WRITE(numout,*) ' MUSCL scheme ln_trcadv_mus = ', ln_trcadv_mus 185 WRITE(numout,*) ' + upstream scheme near river mouths ln_mus_ups = ', ln_mus_ups 186 WRITE(numout,*) ' UBS scheme ln_trcadv_ubs = ', ln_trcadv_ubs 187 WRITE(numout,*) ' vertical 2nd/4th order nn_ubs_v = ', nn_ubs_v 188 WRITE(numout,*) ' QUICKEST scheme ln_trcadv_qck = ', ln_trcadv_qck 189 ENDIF 190 ! 191 192 ioptio = 0 !== Parameter control ==! 193 IF( ln_trcadv_cen ) ioptio = ioptio + 1 194 IF( ln_trcadv_fct ) ioptio = ioptio + 1 195 IF( ln_trcadv_mus ) ioptio = ioptio + 1 196 IF( ln_trcadv_ubs ) ioptio = ioptio + 1 197 IF( ln_trcadv_qck ) ioptio = ioptio + 1 198 199 ! 200 IF( ioptio == 0 ) THEN 201 nadv = np_NO_adv 202 CALL ctl_warn( 'trc_adv_init: You are running without tracer advection.' ) 203 ENDIF 180 204 IF( ioptio /= 1 ) CALL ctl_stop( 'Choose ONE advection scheme in namelist namtrc_adv' ) 181 182 ! ! Set nadv 183 IF( ln_trcadv_cen2 ) nadv = 1 184 IF( ln_trcadv_tvd ) nadv = 2 185 IF( ln_trcadv_muscl ) nadv = 3 186 IF( ln_trcadv_muscl2 ) nadv = 4 187 IF( ln_trcadv_ubs ) nadv = 5 188 IF( ln_trcadv_qck ) nadv = 6 189 IF( lk_esopa ) nadv = -1 190 205 ! 206 IF( ln_trcadv_cen .AND. ( nn_cen_h /= 2 .AND. nn_cen_h /= 4 ) & 207 .AND. ( nn_cen_v /= 2 .AND. nn_cen_v /= 4 ) ) THEN 208 CALL ctl_stop( 'trc_adv_init: CEN scheme, choose 2nd or 4th order' ) 209 ENDIF 210 IF( ln_trcadv_fct .AND. ( nn_fct_h /= 2 .AND. nn_fct_h /= 4 ) & 211 .AND. ( nn_fct_v /= 2 .AND. nn_fct_v /= 4 ) ) THEN 212 CALL ctl_stop( 'trc_adv_init: FCT scheme, choose 2nd or 4th order' ) 213 ENDIF 214 IF( ln_trcadv_fct .AND. nn_fct_zts > 0 ) THEN 215 IF( nn_fct_h == 4 ) THEN 216 nn_fct_h = 2 217 CALL ctl_stop( 'trc_adv_init: force 2nd order FCT scheme, 4th order does not exist with sub-timestepping' ) 218 ENDIF 219 IF( .NOT.ln_linssh ) THEN 220 CALL ctl_stop( 'trc_adv_init: vertical sub-timestepping not allow in non-linear free surface' ) 221 ENDIF 222 IF( nn_fct_zts == 1 ) CALL ctl_warn( 'trc_adv_init: FCT with ONE sub-timestep = FCT without sub-timestep' ) 223 ENDIF 224 IF( ln_trcadv_ubs .AND. ( nn_ubs_v /= 2 .AND. nn_ubs_v /= 4 ) ) THEN 225 CALL ctl_stop( 'trc_adv_init: UBS scheme, choose 2nd or 4th order' ) 226 ENDIF 227 IF( ln_trcadv_ubs .AND. nn_ubs_v == 4 ) THEN 228 CALL ctl_warn( 'trc_adv_init: UBS scheme, only 2nd FCT scheme available on the vertical. It will be used' ) 229 ENDIF 230 IF( ln_isfcav ) THEN ! ice-shelf cavities 231 IF( ln_trcadv_cen .AND. nn_cen_v /= 4 .OR. & ! NO 4th order with ISF 232 & ln_trcadv_fct .AND. nn_fct_v /= 4 ) CALL ctl_stop( 'tra_adv_init: 4th order COMPACT scheme not allowed with ISF' ) 233 ENDIF 234 ! 235 ! !== used advection scheme ==! 236 ! ! set nadv 237 IF( ln_trcadv_cen ) nadv = np_CEN 238 IF( ln_trcadv_fct ) nadv = np_FCT 239 IF( ln_trcadv_fct .AND. nn_fct_zts > 0 ) nadv = np_FCT_zts 240 IF( ln_trcadv_mus ) nadv = np_MUS 241 IF( ln_trcadv_ubs ) nadv = np_UBS 242 IF( ln_trcadv_qck ) nadv = np_QCK 243 ! 191 244 IF(lwp) THEN ! Print the choice 192 245 WRITE(numout,*) 193 IF( nadv == 1 ) WRITE(numout,*) ' 2nd order scheme is used' 194 IF( nadv == 2 ) WRITE(numout,*) ' TVD scheme is used' 195 IF( nadv == 3 ) WRITE(numout,*) ' MUSCL scheme is used' 196 IF( nadv == 4 ) WRITE(numout,*) ' MUSCL2 scheme is used' 197 IF( nadv == 5 ) WRITE(numout,*) ' UBS scheme is used' 198 IF( nadv == 6 ) WRITE(numout,*) ' QUICKEST scheme is used' 199 IF( nadv == -1 ) WRITE(numout,*) ' esopa test: use all advection scheme' 200 ENDIF 201 ! 202 END SUBROUTINE trc_adv_ctl 246 IF( nadv == np_NO_adv ) WRITE(numout,*) ' NO passive tracer advection' 247 IF( nadv == np_CEN ) WRITE(numout,*) ' CEN scheme is used. Horizontal order: ', nn_cen_h, & 248 & ' Vertical order: ', nn_cen_v 249 IF( nadv == np_FCT ) WRITE(numout,*) ' FCT scheme is used. Horizontal order: ', nn_fct_h, & 250 & ' Vertical order: ', nn_fct_v 251 IF( nadv == np_FCT_zts ) WRITE(numout,*) ' use 2nd order FCT with ', nn_fct_zts,'vertical sub-timestepping' 252 IF( nadv == np_MUS ) WRITE(numout,*) ' MUSCL scheme is used' 253 IF( nadv == np_UBS ) WRITE(numout,*) ' UBS scheme is used' 254 IF( nadv == np_QCK ) WRITE(numout,*) ' QUICKEST scheme is used' 255 ENDIF 256 ! 257 END SUBROUTINE trc_adv_ini 203 258 204 259 #else -
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcbbl.F90
r4513 r6225 22 22 USE oce_trc ! ocean dynamics and active tracers variables 23 23 USE trc ! ocean passive tracers variables 24 USE trcnam_trp ! passive tracers transport namelist variables25 24 USE trabbl ! 26 25 USE prtctl_trc ! Print control for debbuging 27 USE trd mod_oce26 USE trd_oce 28 27 USE trdtra 29 28 30 29 PUBLIC trc_bbl ! routine called by step.F90 31 30 32 33 !! * Substitutions34 # include "top_substitute.h90"35 31 !!---------------------------------------------------------------------- 36 32 !! NEMO/TOP 3.3 , NEMO Consortium (2010) … … 93 89 DO jn = 1, jptra 94 90 ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) 95 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_bbl, ztrtrd(:,:,:,jn) )91 CALL trd_tra( kt, 'TRC', jn, jptra_bbl, ztrtrd(:,:,:,jn) ) 96 92 END DO 97 93 CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) ! temporary save of trends -
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90
r4359 r6225 18 18 USE oce_trc ! ocean dynamics and tracers variables 19 19 USE trc ! ocean passive tracers variables 20 USE trcnam_trp ! passive tracers transport namelist variables21 20 USE trcdta 22 21 USE tradmp 23 22 USE prtctl_trc ! Print control for debbuging 24 23 USE trdtra 25 USE trdmod_oce 24 USE trd_oce 25 USE iom 26 26 27 27 IMPLICIT NONE 28 28 PRIVATE 29 29 30 PUBLIC trc_dmp ! routine called by step.F90 31 PUBLIC trc_dmp_clo ! routine called by step.F90 32 PUBLIC trc_dmp_alloc ! routine called by nemogcm.F90 30 PUBLIC trc_dmp 31 PUBLIC trc_dmp_clo 32 PUBLIC trc_dmp_alloc 33 PUBLIC trc_dmp_ini 34 35 INTEGER , PUBLIC :: nn_zdmp_tr ! = 0/1/2 flag for damping in the mixed layer 36 CHARACTER(LEN=200) , PUBLIC :: cn_resto_tr !File containing restoration coefficient 33 37 34 38 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: restotr ! restoring coeff. on tracers (s-1) … … 39 43 40 44 !! * Substitutions 41 # include " top_substitute.h90"45 # include "vectopt_loop_substitute.h90" 42 46 !!---------------------------------------------------------------------- 43 47 !! NEMO/TOP 3.3 , NEMO Consortium (2010) 44 !! $ Header: /home/opalod/NEMOCVSROOT/NEMO/TOP_SRC/TRP/trcdmp.F90,v 1.11 2006/09/01 14:03:49 opalod Exp$48 !! $Id$ 45 49 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 46 50 !!---------------------------------------------------------------------- … … 75 79 !! ** Action : - update the tracer trends tra with the newtonian 76 80 !! damping trends. 77 !! - save the trends ('key_trdmld_trc') 78 !!---------------------------------------------------------------------- 79 !! 80 INTEGER, INTENT( in ) :: kt ! ocean time-step index 81 !! 82 INTEGER :: ji, jj, jk, jn, jl ! dummy loop indices 83 REAL(wp) :: ztra ! temporary scalars 84 CHARACTER (len=22) :: charout 81 !! - save the trends ('key_trdmxl_trc') 82 !!---------------------------------------------------------------------- 83 INTEGER, INTENT(in) :: kt ! ocean time-step index 84 ! 85 INTEGER :: ji, jj, jk, jn, jl ! dummy loop indices 86 CHARACTER (len=22) :: charout 85 87 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd 86 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrcdta ! 3D workspace88 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrcdta ! 3D workspace 87 89 !!---------------------------------------------------------------------- 88 90 ! 89 91 IF( nn_timing == 1 ) CALL timing_start('trc_dmp') 90 92 ! 91 ! 0. Initialization (first time-step only)92 ! --------------93 IF( kt == nittrc000 ) CALL trc_dmp_init94 95 93 IF( l_trdtrc ) CALL wrk_alloc( jpi, jpj, jpk, ztrtrd ) ! temporary save of trends 96 94 ! … … 104 102 ! 105 103 IF( ln_trc_ini(jn) ) THEN ! update passive tracers arrays with input data read from file 106 104 ! 107 105 jl = n_trc_index(jn) 108 106 CALL trc_dta( kt, sf_trcdta(jl),rf_trfac(jl) ) ! read tracer data at nit000 109 107 ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:) 110 108 ! 111 109 SELECT CASE ( nn_zdmp_tr ) 112 110 ! … … 115 113 DO jj = 2, jpjm1 116 114 DO ji = fs_2, fs_jpim1 ! vector opt. 117 ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 118 tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 115 tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 119 116 END DO 120 117 END DO 121 118 END DO 122 !119 ! 123 120 CASE ( 1 ) !== no damping in the turbocline (avt > 5 cm2/s) ==! 124 121 DO jk = 1, jpkm1 125 122 DO jj = 2, jpjm1 126 123 DO ji = fs_2, fs_jpim1 ! vector opt. 127 IF( avt(ji,jj,jk) <= 5.e-4 ) THEN 128 ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 129 tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 124 IF( avt(ji,jj,jk) <= 5.e-4_wp ) THEN 125 tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 130 126 ENDIF 131 127 END DO 132 128 END DO 133 129 END DO 134 !130 ! 135 131 CASE ( 2 ) !== no damping in the mixed layer ==! 136 132 DO jk = 1, jpkm1 137 133 DO jj = 2, jpjm1 138 134 DO ji = fs_2, fs_jpim1 ! vector opt. 139 IF( fsdept(ji,jj,jk) >= hmlp (ji,jj) ) THEN 140 ztra = restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 141 tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 135 IF( gdept_n(ji,jj,jk) >= hmlp (ji,jj) ) THEN 136 tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + restotr(ji,jj,jk) * ( ztrcdta(ji,jj,jk) - trb(ji,jj,jk,jn) ) 142 137 END IF 143 138 END DO 144 139 END DO 145 140 END DO 146 !141 ! 147 142 END SELECT 148 143 ! … … 151 146 IF( l_trdtrc ) THEN 152 147 ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:) 153 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_dmp, ztrtrd )148 CALL trd_tra( kt, 'TRC', jn, jptra_dmp, ztrtrd ) 154 149 END IF 155 150 ! ! =========== … … 161 156 IF( l_trdtrc ) CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd ) 162 157 ! ! print mean trends (used for debugging) 163 IF( ln_ctl ) THEN 164 WRITE(charout, FMT="('dmp ')") ; CALL prt_ctl_trc_info(charout) 165 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 158 IF( ln_ctl ) THEN 159 WRITE(charout, FMT="('dmp ')") 160 CALL prt_ctl_trc_info(charout) 161 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 166 162 ENDIF 167 163 ! … … 169 165 ! 170 166 END SUBROUTINE trc_dmp 167 168 169 SUBROUTINE trc_dmp_ini 170 !!---------------------------------------------------------------------- 171 !! *** ROUTINE trc_dmp_ini *** 172 !! 173 !! ** Purpose : Initialization for the newtonian damping 174 !! 175 !! ** Method : read the nammbf namelist and check the parameters 176 !! called by trc_dmp at the first timestep (nittrc000) 177 !!---------------------------------------------------------------------- 178 INTEGER :: ios, imask ! local integers 179 !! 180 NAMELIST/namtrc_dmp/ nn_zdmp_tr , cn_resto_tr 181 !!---------------------------------------------------------------------- 182 ! 183 IF( nn_timing == 1 ) CALL timing_start('trc_dmp_init') 184 ! 185 REWIND( numnat_ref ) ! Namelist namtrc_dmp in reference namelist : Passive tracers newtonian damping 186 READ ( numnat_ref, namtrc_dmp, IOSTAT = ios, ERR = 909) 187 909 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in reference namelist', lwp ) 188 189 REWIND( numnat_cfg ) ! Namelist namtrc_dmp in configuration namelist : Passive tracers newtonian damping 190 READ ( numnat_cfg, namtrc_dmp, IOSTAT = ios, ERR = 910) 191 910 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dmp in configuration namelist', lwp ) 192 IF(lwm) WRITE ( numont, namtrc_dmp ) 193 194 IF(lwp) THEN ! Namelist print 195 WRITE(numout,*) 196 WRITE(numout,*) 'trc_dmp : Passive tracers newtonian damping' 197 WRITE(numout,*) '~~~~~~~' 198 WRITE(numout,*) ' Namelist namtrc_dmp : set damping parameter' 199 WRITE(numout,*) ' mixed layer damping option nn_zdmp_tr = ', nn_zdmp_tr, '(zoom: forced to 0)' 200 WRITE(numout,*) ' Restoration coeff file cn_resto_tr = ', cn_resto_tr 201 ENDIF 202 ! 203 IF( lzoom .AND. .NOT.lk_c1d ) nn_zdmp_tr = 0 ! restoring to climatology at closed north or south boundaries 204 SELECT CASE ( nn_zdmp_tr ) 205 CASE ( 0 ) ; IF(lwp) WRITE(numout,*) ' tracer damping throughout the water column' 206 CASE ( 1 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the turbocline (avt > 5 cm2/s)' 207 CASE ( 2 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the mixed layer' 208 CASE DEFAULT 209 WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr 210 CALL ctl_stop(ctmp1) 211 END SELECT 212 213 IF( .NOT.lk_c1d ) THEN 214 IF( .NOT. ln_tradmp ) & 215 & CALL ctl_stop( 'passive trace damping need ln_tradmp to compute damping coef.' ) 216 ! 217 ! ! Read damping coefficients from file 218 !Read in mask from file 219 CALL iom_open ( cn_resto_tr, imask) 220 CALL iom_get ( imask, jpdom_autoglo, 'resto', restotr) 221 CALL iom_close( imask ) 222 ! 223 ENDIF 224 IF( nn_timing == 1 ) CALL timing_stop('trc_dmp_init') 225 ! 226 END SUBROUTINE trc_dmp_ini 227 171 228 172 229 SUBROUTINE trc_dmp_clo( kt ) … … 182 239 !! nctsi2(), nctsj2() : north-east Closed sea limits (i,j) 183 240 !!---------------------------------------------------------------------- 184 INTEGER, INTENT( in ) :: kt 185 ! 186 INTEGER :: ji, jj, jk, jn, jl, jc! dummy loop indicesa187 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrcdta ! 3D workspace188 189 !!---------------------------------------------------------------------- 190 241 INTEGER, INTENT( in ) :: kt ! ocean time-step index 242 ! 243 INTEGER :: ji , jj, jk, jn, jl, jc ! dummy loop indicesa 244 INTEGER :: isrow ! local index 245 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrcdta ! 3D workspace 246 !!---------------------------------------------------------------------- 247 ! 191 248 IF( kt == nit000 ) THEN 192 249 ! initial values … … 200 257 ! 201 258 SELECT CASE ( jp_cfg ) 259 ! ! ======================= 260 CASE ( 1 ) ! eORCA_R1 configuration 261 ! ! ======================= 262 isrow = 332 - jpjglo 263 ! 264 ! Caspian Sea 265 nctsi1(1) = 332 ; nctsj1(1) = 243 - isrow 266 nctsi2(1) = 344 ; nctsj2(1) = 275 - isrow 267 ! 202 268 ! ! ======================= 203 269 CASE ( 2 ) ! ORCA_R2 configuration … … 291 357 END SUBROUTINE trc_dmp_clo 292 358 293 294 SUBROUTINE trc_dmp_init295 !!----------------------------------------------------------------------296 !! *** ROUTINE trc_dmp_init ***297 !!298 !! ** Purpose : Initialization for the newtonian damping299 !!300 !! ** Method : read the nammbf namelist and check the parameters301 !! called by trc_dmp at the first timestep (nittrc000)302 !!----------------------------------------------------------------------303 !304 IF( nn_timing == 1 ) CALL timing_start('trc_dmp_init')305 !306 SELECT CASE ( nn_hdmp_tr )307 CASE ( -1 ) ; IF(lwp) WRITE(numout,*) ' tracer damping in the Med & Red seas only'308 CASE ( 1:90 ) ; IF(lwp) WRITE(numout,*) ' tracer damping poleward of', nn_hdmp_tr, ' degrees'309 CASE DEFAULT310 WRITE(ctmp1,*) ' bad flag value for nn_hdmp_tr = ', nn_hdmp_tr311 CALL ctl_stop(ctmp1)312 END SELECT313 314 IF( lzoom ) nn_zdmp_tr = 0 ! restoring to climatology at closed north or south boundaries315 SELECT CASE ( nn_zdmp_tr )316 CASE ( 0 ) ; IF(lwp) WRITE(numout,*) ' tracer damping throughout the water column'317 CASE ( 1 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the turbocline (avt > 5 cm2/s)'318 CASE ( 2 ) ; IF(lwp) WRITE(numout,*) ' no tracer damping in the mixed layer'319 CASE DEFAULT320 WRITE(ctmp1,*) 'bad flag value for nn_zdmp_tr = ', nn_zdmp_tr321 CALL ctl_stop(ctmp1)322 END SELECT323 324 IF( .NOT. ln_tradmp ) &325 & CALL ctl_stop( 'passive trace damping need key_tradmp to compute damping coef.' )326 !327 ! ! Damping coefficients initialization328 IF( lzoom ) THEN ; CALL dtacof_zoom( restotr )329 ELSE ; CALL dtacof( nn_hdmp_tr, rn_surf_tr, rn_bot_tr, rn_dep_tr, &330 & nn_file_tr, 'TRC' , restotr )331 ENDIF332 !333 IF( nn_timing == 1 ) CALL timing_stop('trc_dmp_init')334 !335 END SUBROUTINE trc_dmp_init336 337 359 #else 338 360 !!---------------------------------------------------------------------- … … 346 368 #endif 347 369 348 349 370 !!====================================================================== 350 371 END MODULE trcdmp -
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90
r3294 r6225 4 4 !! Ocean Passive tracers : lateral diffusive trends 5 5 !!===================================================================== 6 !! History : 9.0 ! 2005-11 (G. Madec) Original code 7 !! NEMO 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA 6 !! History : 1.0 ! 2005-11 (G. Madec) Original code 7 !! 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA 8 !! 3.7 ! 2014-03 (G. Madec) LDF simplification 8 9 !!---------------------------------------------------------------------- 9 10 #if defined key_top … … 11 12 !! 'key_top' TOP models 12 13 !!---------------------------------------------------------------------- 13 !!---------------------------------------------------------------------- 14 !! trc_ldf : update the tracer trend with the lateral diffusion 15 !! ldf_ctl : initialization, namelist read, and parameters control 16 !!---------------------------------------------------------------------- 17 USE oce_trc ! ocean dynamics and active tracers 18 USE trc ! ocean passive tracers variables 19 USE trcnam_trp ! passive tracers transport namelist variables 20 USE ldftra_oce ! lateral diffusion coefficient on tracers 21 USE ldfslp ! ??? 22 USE traldf_bilapg ! lateral mixing (tra_ldf_bilapg routine) 23 USE traldf_bilap ! lateral mixing (tra_ldf_bilap routine) 24 USE traldf_iso ! lateral mixing (tra_ldf_iso routine) 25 USE traldf_iso_grif ! lateral mixing (tra_ldf_iso_grif routine) 26 USE traldf_lap ! lateral mixing (tra_ldf_lap routine) 27 USE trdmod_oce 28 USE trdtra 29 USE prtctl_trc ! Print control 14 !! trc_ldf : update the tracer trend with the lateral diffusion 15 !! trc_ldf_ini : initialization, namelist read, and parameters control 16 !!---------------------------------------------------------------------- 17 USE trc ! ocean passive tracers variables 18 USE oce_trc ! ocean dynamics and active tracers 19 USE ldfslp ! lateral diffusion: iso-neutral slope 20 USE traldf_lap_blp ! lateral diffusion: lap/bilaplacian iso-level operator (tra_ldf_lap/_blp routine) 21 USE traldf_iso ! lateral diffusion: laplacian iso-neutral standard operator (tra_ldf_iso routine) 22 USE traldf_triad ! lateral diffusion: laplacian iso-neutral triad operator (tra_ldf_ triad routine) 23 USE trd_oce ! trends: ocean variables 24 USE trdtra ! trends manager: tracers 25 ! 26 USE prtctl_trc ! Print control 30 27 31 28 IMPLICIT NONE 32 29 PRIVATE 33 30 34 PUBLIC trc_ldf ! called by step.F90 35 ! !!: ** lateral mixing namelist (nam_trcldf) ** 36 REAL(wp) :: rldf_rat ! ratio between active and passive tracers diffusive coefficient 31 PUBLIC trc_ldf 32 PUBLIC trc_ldf_ini 33 ! 34 LOGICAL , PUBLIC :: ln_trcldf_lap !: laplacian operator 35 LOGICAL , PUBLIC :: ln_trcldf_blp !: bilaplacian operator 36 LOGICAL , PUBLIC :: ln_trcldf_lev !: iso-level direction 37 LOGICAL , PUBLIC :: ln_trcldf_hor !: horizontal direction (rotation to geopotential) 38 LOGICAL , PUBLIC :: ln_trcldf_iso !: iso-neutral direction (standard) 39 LOGICAL , PUBLIC :: ln_trcldf_triad !: iso-neutral direction (triad) 40 REAL(wp), PUBLIC :: rn_ahtrc_0 !: laplacian diffusivity coefficient for passive tracer [m2/s] 41 REAL(wp), PUBLIC :: rn_bhtrc_0 !: bilaplacian - -- - - [m4/s] 42 ! 43 ! !!: ** lateral mixing namelist (nam_trcldf) ** 44 REAL(wp) :: rldf ! ratio between active and passive tracers diffusive coefficient 45 37 46 INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals) 47 38 48 !! * Substitutions 39 # include "domzgr_substitute.h90"40 49 # include "vectopt_loop_substitute.h90" 41 50 !!---------------------------------------------------------------------- 42 !! NEMO/TOP 3. 3 , NEMO Consortium (2010)51 !! NEMO/TOP 3.7 , NEMO Consortium (2014) 43 52 !! $Id$ 44 53 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 45 54 !!---------------------------------------------------------------------- 46 47 55 CONTAINS 48 56 … … 55 63 !!---------------------------------------------------------------------- 56 64 INTEGER, INTENT( in ) :: kt ! ocean time-step index 57 ! !65 ! 58 66 INTEGER :: jn 59 67 CHARACTER (len=22) :: charout 68 REAL(wp), POINTER, DIMENSION(:,:,:) :: zahu, zahv 60 69 REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrtrd 61 70 !!---------------------------------------------------------------------- … … 63 72 IF( nn_timing == 1 ) CALL timing_start('trc_ldf') 64 73 ! 65 IF( kt == nittrc000 ) CALL ldf_ctl ! initialisation & control of options66 67 rldf = rldf_rat68 69 74 IF( l_trdtrc ) THEN 70 CALL wrk_alloc( jpi, jpj, jpk, jptra,ztrtrd )75 CALL wrk_alloc( jpi,jpj,jpk,jptra, ztrtrd ) 71 76 ztrtrd(:,:,:,:) = tra(:,:,:,:) 72 77 ENDIF 73 74 SELECT CASE ( nldf ) ! compute lateral mixing trend and add it to the general trend 75 CASE ( 0 ) ; CALL tra_ldf_lap ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra ) ! iso-level laplacian 76 CASE ( 1 ) ! rotated laplacian 77 IF( ln_traldf_grif ) THEN 78 CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 79 ELSE 80 CALL tra_ldf_iso ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 81 ENDIF 82 CASE ( 2 ) ; CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra ) ! iso-level bilaplacian 83 CASE ( 3 ) ; CALL tra_ldf_bilapg( kt, nittrc000, 'TRC', trb, tra, jptra ) ! s-coord. horizontal bilaplacian 84 ! 85 CASE ( -1 ) ! esopa: test all possibility with control print 86 CALL tra_ldf_lap ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra ) 87 WRITE(charout, FMT="('ldf0 ')") ; CALL prt_ctl_trc_info(charout) 88 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 89 IF( ln_traldf_grif ) THEN 90 CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 91 ELSE 92 CALL tra_ldf_iso ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 93 ENDIF 94 WRITE(charout, FMT="('ldf1 ')") ; CALL prt_ctl_trc_info(charout) 95 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 96 CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra ) 97 WRITE(charout, FMT="('ldf2 ')") ; CALL prt_ctl_trc_info(charout) 98 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 99 CALL tra_ldf_bilapg( kt, nittrc000, 'TRC', trb, tra, jptra ) 100 WRITE(charout, FMT="('ldf3 ')") ; CALL prt_ctl_trc_info(charout) 101 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 78 ! 79 ! !* set the lateral diffusivity coef. for passive tracer 80 CALL wrk_alloc( jpi,jpj,jpk, zahu, zahv ) 81 zahu(:,:,:) = rldf * ahtu(:,:,:) 82 zahv(:,:,:) = rldf * ahtv(:,:,:) 83 84 SELECT CASE ( nldf ) !* compute lateral mixing trend and add it to the general trend 85 ! 86 CASE ( np_lap ) ! iso-level laplacian 87 CALL tra_ldf_lap ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, tra, jptra, 1 ) 88 ! 89 CASE ( np_lap_i ) ! laplacian : standard iso-neutral operator (Madec) 90 CALL tra_ldf_iso ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, trb, tra, jptra, 1 ) 91 ! 92 CASE ( np_lap_it ) ! laplacian : triad iso-neutral operator (griffies) 93 CALL tra_ldf_triad( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb, trb, tra, jptra, 1 ) 94 ! 95 CASE ( np_blp , np_blp_i , np_blp_it ) ! bilaplacian: all operator (iso-level, -neutral) 96 CALL tra_ldf_blp ( kt, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi, trb , tra, jptra, nldf ) 97 ! 102 98 END SELECT 103 99 ! 104 IF( l_trdtrc ) THEN ! save the horizontal diffusive trends for further diagnostics100 IF( l_trdtrc ) THEN ! send the trends for further diagnostics 105 101 DO jn = 1, jptra 106 102 ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) 107 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_ldf, ztrtrd(:,:,:,jn) )103 CALL trd_tra( kt, 'TRC', jn, jptra_ldf, ztrtrd(:,:,:,jn) ) 108 104 END DO 109 105 CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) 110 106 ENDIF 111 ! ! print mean trends (used for debugging) 112 IF( ln_ctl ) THEN 113 WRITE(charout, FMT="('ldf ')") ; CALL prt_ctl_trc_info(charout) 114 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 115 ENDIF 107 ! 108 IF( ln_ctl ) THEN ! print mean trends (used for debugging) 109 WRITE(charout, FMT="('ldf ')") 110 CALL prt_ctl_trc_info(charout) 111 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 112 ENDIF 113 ! 114 CALL wrk_dealloc( jpi,jpj,jpk, zahu, zahv ) 116 115 ! 117 116 IF( nn_timing == 1 ) CALL timing_stop('trc_ldf') … … 120 119 121 120 122 SUBROUTINE ldf_ctl121 SUBROUTINE trc_ldf_ini 123 122 !!---------------------------------------------------------------------- 124 123 !! *** ROUTINE ldf_ctl *** 125 124 !! 126 !! ** Purpose : Choice of the operator for the lateral tracerdiffusion125 !! ** Purpose : Define the operator for the lateral diffusion 127 126 !! 128 127 !! ** Method : set nldf from the namtra_ldf logicals 129 !! nldf == -2 No lateral diffusion130 !! nldf == -1 ESOPA test: ALL operators are used131 128 !! nldf == 0 laplacian operator 132 129 !! nldf == 1 Rotated laplacian operator … … 134 131 !! nldf == 3 Rotated bilaplacian 135 132 !!---------------------------------------------------------------------- 136 INTEGER :: ioptio, ierr ! temporary integers 137 !!---------------------------------------------------------------------- 138 139 IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN 140 IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN 141 rldf_rat = 1.0_wp 142 ELSE 143 CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) 144 END IF 145 ELSE 146 rldf_rat = rn_ahtrc_0 / rn_aht_0 147 END IF 148 ! Define the lateral mixing oparator for tracers 149 ! =============================================== 150 151 ! ! control the input 133 INTEGER :: ioptio, ierr ! temporary integers 134 INTEGER :: ios ! Local integer output status for namelist read 135 !! 136 NAMELIST/namtrc_ldf/ ln_trcldf_lap, ln_trcldf_blp, & 137 & ln_trcldf_lev, ln_trcldf_hor, ln_trcldf_iso, ln_trcldf_triad, & 138 & rn_ahtrc_0 , rn_bhtrc_0 139 !!---------------------------------------------------------------------- 140 ! 141 REWIND( numnat_ref ) ! namtrc_ldf in reference namelist 142 READ ( numnat_ref, namtrc_ldf, IOSTAT = ios, ERR = 903) 143 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ldf in reference namelist', lwp ) 144 ! 145 REWIND( numnat_cfg ) ! namtrc_ldf in configuration namelist 146 READ ( numnat_cfg, namtrc_ldf, IOSTAT = ios, ERR = 904 ) 147 904 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ldf in configuration namelist', lwp ) 148 IF(lwm) WRITE ( numont, namtrc_ldf ) 149 ! 150 IF(lwp) THEN ! Namelist print 151 WRITE(numout,*) 152 WRITE(numout,*) 'trc_ldf_ini : lateral tracer diffusive operator' 153 WRITE(numout,*) '~~~~~~~~~~~' 154 WRITE(numout,*) ' Namelist namtrc_ldf : set lateral mixing parameters (type, direction, coefficients)' 155 WRITE(numout,*) ' operator' 156 WRITE(numout,*) ' laplacian ln_trcldf_lap = ', ln_trcldf_lap 157 WRITE(numout,*) ' bilaplacian ln_trcldf_blp = ', ln_trcldf_blp 158 WRITE(numout,*) ' direction of action' 159 WRITE(numout,*) ' iso-level ln_trcldf_lev = ', ln_trcldf_lev 160 WRITE(numout,*) ' horizontal (geopotential) ln_trcldf_hor = ', ln_trcldf_hor 161 WRITE(numout,*) ' iso-neutral (standard) ln_trcldf_iso = ', ln_trcldf_iso 162 WRITE(numout,*) ' iso-neutral (triad) ln_trcldf_triad = ', ln_trcldf_triad 163 WRITE(numout,*) ' diffusivity coefficient' 164 WRITE(numout,*) ' laplacian rn_ahtrc_0 = ', rn_ahtrc_0 165 WRITE(numout,*) ' bilaplacian rn_bhtrc_0 = ', rn_bhtrc_0 166 ENDIF 167 ! 168 ! ! control the namelist parameters 152 169 ioptio = 0 153 IF( ln_trcldf_lap ) ioptio = ioptio + 1 154 IF( ln_trcldf_bilap ) ioptio = ioptio + 1 155 IF( ioptio > 1 ) CALL ctl_stop( ' use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 156 IF( ioptio == 0 ) nldf = -2 ! No lateral diffusion 170 IF( ln_trcldf_lap ) ioptio = ioptio + 1 171 IF( ln_trcldf_blp ) ioptio = ioptio + 1 172 IF( ioptio > 1 ) CALL ctl_stop( 'trc_ldf_ctl: use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 173 IF( ioptio == 0 ) nldf = np_no_ldf ! No lateral diffusion 174 175 IF( ln_trcldf_lap .AND. ln_trcldf_blp ) CALL ctl_stop( 'trc_ldf_ctl: bilaplacian should be used on both TRC and TRA' ) 176 IF( ln_trcldf_blp .AND. ln_trcldf_lap ) CALL ctl_stop( 'trc_ldf_ctl: laplacian should be used on both TRC and TRA' ) 177 ! 157 178 ioptio = 0 158 IF( ln_trcldf_lev el) ioptio = ioptio + 1159 IF( ln_trcldf_hor 160 IF( ln_trcldf_iso 161 IF( ioptio /= 1 ) CALL ctl_stop( 'use only ONE direction (level/hor/iso)' )162 179 IF( ln_trcldf_lev ) ioptio = ioptio + 1 180 IF( ln_trcldf_hor ) ioptio = ioptio + 1 181 IF( ln_trcldf_iso ) ioptio = ioptio + 1 182 IF( ioptio /= 1 ) CALL ctl_stop( 'trc_ldf_ctl: use only ONE direction (level/hor/iso)' ) 183 ! 163 184 ! defined the type of lateral diffusion from ln_trcldf_... logicals 164 185 ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully 165 186 ierr = 0 166 IF( ln_trcldf_lap ) THEN ! laplacian operator187 IF( ln_trcldf_lap ) THEN !== laplacian operator ==! 167 188 IF ( ln_zco ) THEN ! z-coordinate 168 IF ( ln_trcldf_level ) nldf = 0 ! iso-level (no rotation) 169 IF ( ln_trcldf_hor ) nldf = 0 ! horizontal (no rotation) 170 IF ( ln_trcldf_iso ) nldf = 1 ! isoneutral ( rotation) 171 ENDIF 172 IF ( ln_zps ) THEN ! z-coordinate 173 IF ( ln_trcldf_level ) ierr = 1 ! iso-level not allowed 174 IF ( ln_trcldf_hor ) nldf = 0 ! horizontal (no rotation) 175 IF ( ln_trcldf_iso ) nldf = 1 ! isoneutral ( rotation) 176 ENDIF 177 IF ( ln_sco ) THEN ! z-coordinate 178 IF ( ln_trcldf_level ) nldf = 0 ! iso-level (no rotation) 179 IF ( ln_trcldf_hor ) nldf = 1 ! horizontal ( rotation) 180 IF ( ln_trcldf_iso ) nldf = 1 ! isoneutral ( rotation) 181 ENDIF 182 ENDIF 183 184 IF( ln_trcldf_bilap ) THEN ! bilaplacian operator 189 IF ( ln_trcldf_lev ) nldf = np_lap ! iso-level = horizontal (no rotation) 190 IF ( ln_trcldf_hor ) nldf = np_lap ! iso-level = horizontal (no rotation) 191 IF ( ln_trcldf_iso ) nldf = np_lap_i ! iso-neutral: standard ( rotation) 192 IF ( ln_trcldf_triad ) nldf = np_lap_it ! iso-neutral: triad ( rotation) 193 ENDIF 194 IF ( ln_zps ) THEN ! z-coordinate with partial step 195 IF ( ln_trcldf_lev ) ierr = 1 ! iso-level not allowed 196 IF ( ln_trcldf_hor ) nldf = np_lap ! horizontal (no rotation) 197 IF ( ln_trcldf_iso ) nldf = np_lap_i ! iso-neutral: standard (rotation) 198 IF ( ln_trcldf_triad ) nldf = np_lap_it ! iso-neutral: triad (rotation) 199 ENDIF 200 IF ( ln_sco ) THEN ! s-coordinate 201 IF ( ln_trcldf_lev ) nldf = np_lap ! iso-level (no rotation) 202 IF ( ln_trcldf_hor ) nldf = np_lap_it ! horizontal ( rotation) !!gm a checker.... 203 IF ( ln_trcldf_iso ) nldf = np_lap_i ! iso-neutral: standard (rotation) 204 IF ( ln_trcldf_triad ) nldf = np_lap_it ! iso-neutral: triad (rotation) 205 ENDIF 206 ! ! diffusivity ratio: passive / active tracers 207 IF( ABS(rn_aht_0) < 2._wp*TINY(1._wp) ) THEN 208 IF( ABS(rn_ahtrc_0) < 2._wp*TINY(1._wp) ) THEN 209 rldf = 1.0_wp 210 ELSE 211 CALL ctl_stop( 'trc_ldf_ctl : cannot define rldf, rn_aht_0==0, rn_ahtrc_0 /=0' ) 212 ENDIF 213 ELSE 214 rldf = rn_ahtrc_0 / rn_aht_0 215 ENDIF 216 ENDIF 217 ! 218 IF( ln_trcldf_blp ) THEN !== bilaplacian operator ==! 185 219 IF ( ln_zco ) THEN ! z-coordinate 186 IF ( ln_trcldf_level ) nldf = 2 ! iso-level (no rotation) 187 IF ( ln_trcldf_hor ) nldf = 2 ! horizontal (no rotation) 188 IF ( ln_trcldf_iso ) ierr = 2 ! isoneutral ( rotation) 189 ENDIF 190 IF ( ln_zps ) THEN ! z-coordinate 191 IF ( ln_trcldf_level ) ierr = 1 ! iso-level not allowed 192 IF ( ln_trcldf_hor ) nldf = 2 ! horizontal (no rotation) 193 IF ( ln_trcldf_iso ) ierr = 2 ! isoneutral ( rotation) 194 ENDIF 195 IF ( ln_sco ) THEN ! z-coordinate 196 IF ( ln_trcldf_level ) nldf = 2 ! iso-level (no rotation) 197 IF ( ln_trcldf_hor ) nldf = 3 ! horizontal ( rotation) 198 IF ( ln_trcldf_iso ) ierr = 2 ! isoneutral ( rotation) 199 ENDIF 200 ENDIF 201 202 IF( ierr == 1 ) CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) 203 IF( ierr == 2 ) CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) 204 IF( lk_traldf_eiv .AND. .NOT.ln_trcldf_iso ) & 205 CALL ctl_stop( ' eddy induced velocity on tracers', & 206 & ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) 207 IF( nldf == 1 .OR. nldf == 3 ) THEN ! rotation 208 IF( .NOT.lk_ldfslp ) CALL ctl_stop( ' the rotation of the diffusive tensor require key_ldfslp' ) 209 #if defined key_offline 210 l_traldf_rot = .TRUE. ! needed for trazdf_imp 211 #endif 212 ENDIF 213 214 IF( lk_esopa ) THEN 215 IF(lwp) WRITE(numout,*) ' esopa control: use all lateral physics options' 216 nldf = -1 217 ENDIF 218 219 IF( .NOT. ln_trcldf_diff ) THEN 220 IF(lwp) WRITE(numout,*) ' No lateral diffusion on passive tracers' 221 nldf = -2 222 ENDIF 223 220 IF ( ln_trcldf_lev ) nldf = np_blp ! iso-level = horizontal (no rotation) 221 IF ( ln_trcldf_hor ) nldf = np_blp ! iso-level = horizontal (no rotation) 222 IF ( ln_trcldf_iso ) nldf = np_blp_i ! iso-neutral: standard (rotation) 223 IF ( ln_trcldf_triad ) nldf = np_blp_it ! iso-neutral: triad (rotation) 224 ENDIF 225 IF ( ln_zps ) THEN ! z-coordinate with partial step 226 IF ( ln_trcldf_lev ) ierr = 1 ! iso-level not allowed 227 IF ( ln_trcldf_hor ) nldf = np_blp ! horizontal (no rotation) 228 IF ( ln_trcldf_iso ) nldf = np_blp_i ! iso-neutral: standard (rotation) 229 IF ( ln_trcldf_triad ) nldf = np_blp_it ! iso-neutral: triad (rotation) 230 ENDIF 231 IF ( ln_sco ) THEN ! s-coordinate 232 IF ( ln_trcldf_lev ) nldf = np_blp ! iso-level (no rotation) 233 IF ( ln_trcldf_hor ) nldf = np_blp_it ! horizontal ( rotation) !!gm a checker.... 234 IF ( ln_trcldf_iso ) nldf = np_blp_i ! iso-neutral: standard (rotation) 235 IF ( ln_trcldf_triad ) nldf = np_blp_it ! iso-neutral: triad (rotation) 236 ENDIF 237 ! ! diffusivity ratio: passive / active tracers 238 IF( ABS(rn_bht_0) < 2._wp*TINY(1._wp) ) THEN 239 IF( ABS(rn_bhtrc_0) < 2._wp*TINY(1._wp) ) THEN 240 rldf = 1.0_wp 241 ELSE 242 CALL ctl_stop( 'trc_ldf_ctl : cannot define rldf, rn_aht_0==0, rn_ahtrc_0 /=0' ) 243 ENDIF 244 ELSE 245 rldf = SQRT( ABS( rn_bhtrc_0 / rn_bht_0 ) ) 246 ENDIF 247 ENDIF 248 ! 249 IF( ierr == 1 ) CALL ctl_stop( 'trc_ldf_ctl: iso-level in z-partial step, not allowed' ) 250 IF( ln_ldfeiv .AND. .NOT.ln_trcldf_iso ) CALL ctl_stop( 'trc_ldf_ctl: eiv requires isopycnal laplacian diffusion' ) 251 IF( nldf == 1 .OR. nldf == 3 ) l_ldfslp = .TRUE. ! slope of neutral surfaces required 252 ! 224 253 IF(lwp) THEN 225 254 WRITE(numout,*) 226 IF( nldf == -2 ) WRITE(numout,*) ' NO lateral diffusion' 227 IF( nldf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' 228 IF( nldf == 0 ) WRITE(numout,*) ' laplacian operator' 229 IF( nldf == 1 ) WRITE(numout,*) ' Rotated laplacian operator' 230 IF( nldf == 2 ) WRITE(numout,*) ' bilaplacian operator' 231 IF( nldf == 3 ) WRITE(numout,*) ' Rotated bilaplacian' 232 ENDIF 233 234 IF( ln_trcldf_bilap ) THEN 235 IF(lwp) WRITE(numout,*) ' biharmonic tracer diffusion' 236 IF( rn_ahtrc_0 > 0 .AND. .NOT. lk_esopa ) CALL ctl_stop( 'The horizontal diffusivity coef. rn_ahtrc_0 must be negative' ) 237 ELSE 238 IF(lwp) WRITE(numout,*) ' harmonic tracer diffusion (default)' 239 IF( rn_ahtrc_0 < 0 .AND. .NOT. lk_esopa ) CALL ctl_stop('The horizontal diffusivity coef. rn_ahtrc_0 must be positive' ) 240 ENDIF 241 242 ! ratio between active and passive tracers diffusive coef. 243 IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN 244 IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN 245 rldf_rat = 1.0_wp 246 ELSE 247 CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) 248 END IF 249 ELSE 250 rldf_rat = rn_ahtrc_0 / rn_aht_0 251 END IF 252 IF( rldf_rat < 0 ) THEN 253 IF( .NOT.lk_offline ) THEN 254 CALL ctl_stop( 'Choose the same type of diffusive scheme both for active & passive tracers' ) 255 ELSE 256 CALL ctl_stop( 'Change the sign of rn_aht_0 in namelist to -/+1' ) 257 ENDIF 258 ENDIF 259 ! 260 END SUBROUTINE ldf_ctl 255 SELECT CASE( nldf ) 256 CASE( np_no_ldf ) ; WRITE(numout,*) ' NO lateral diffusion' 257 CASE( np_lap ) ; WRITE(numout,*) ' laplacian iso-level operator' 258 CASE( np_lap_i ) ; WRITE(numout,*) ' Rotated laplacian operator (standard)' 259 CASE( np_lap_it ) ; WRITE(numout,*) ' Rotated laplacian operator (triad)' 260 CASE( np_blp ) ; WRITE(numout,*) ' bilaplacian iso-level operator' 261 CASE( np_blp_i ) ; WRITE(numout,*) ' Rotated bilaplacian operator (standard)' 262 CASE( np_blp_it ) ; WRITE(numout,*) ' Rotated bilaplacian operator (triad)' 263 END SELECT 264 ENDIF 265 ! 266 END SUBROUTINE trc_ldf_ini 261 267 #else 262 268 !!---------------------------------------------------------------------- -
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90
r4611 r6225 30 30 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 31 31 USE prtctl_trc ! Print control for debbuging 32 USE trd mod_oce32 USE trd_oce 33 33 USE trdtra 34 34 USE tranxt 35 USE trcbdy ! BDY open boundaries 36 USE bdy_par, only: lk_bdy 35 37 # if defined key_agrif 36 38 USE agrif_top_interp … … 41 43 42 44 PUBLIC trc_nxt ! routine called by step.F90 43 PUBLIC trc_nxt_alloc ! routine called by nemogcm.F9044 45 45 REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:) :: r2dt46 REAL(wp) :: r2dttrc 46 47 47 48 !!---------------------------------------------------------------------- … … 51 52 !!---------------------------------------------------------------------- 52 53 CONTAINS 53 54 INTEGER FUNCTION trc_nxt_alloc()55 !!----------------------------------------------------------------------56 !! *** ROUTINE trc_nxt_alloc ***57 !!----------------------------------------------------------------------58 ALLOCATE( r2dt(jpk), STAT=trc_nxt_alloc )59 !60 IF( trc_nxt_alloc /= 0 ) CALL ctl_warn('trc_nxt_alloc : failed to allocate array')61 !62 END FUNCTION trc_nxt_alloc63 64 54 65 55 SUBROUTINE trc_nxt( kt ) … … 101 91 WRITE(numout,*) 'trc_nxt : time stepping on passive tracers' 102 92 ENDIF 103 104 ! Update after tracer on domain lateral boundaries 105 DO jn = 1, jptra 93 ! 94 #if defined key_agrif 95 CALL Agrif_trc ! AGRIF zoom boundaries 96 #endif 97 DO jn = 1, jptra ! Update after tracer on domain lateral boundaries 106 98 CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. ) 107 99 END DO 108 100 101 IF( lk_bdy ) CALL trc_bdy( kt ) 109 102 110 #if defined key_bdy 111 !! CALL bdy_trc( kt ) ! BDY open boundaries 112 #endif 113 #if defined key_agrif 114 CALL Agrif_trc ! AGRIF zoom boundaries 115 #endif 116 117 118 ! set time step size (Euler/Leapfrog) 119 IF( neuler == 0 .AND. kt == nittrc000 ) THEN ; r2dt(:) = rdttrc(:) ! at nittrc000 (Euler) 120 ELSEIF( kt <= nittrc000 + 1 ) THEN ; r2dt(:) = 2.* rdttrc(:) ! at nit000 or nit000+1 (Leapfrog) 103 ! ! set time step size (Euler/Leapfrog) 104 IF( neuler == 0 .AND. kt == nittrc000 ) THEN ; r2dttrc = rdttrc ! at nittrc000 (Euler) 105 ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN ; r2dttrc = 2.* rdttrc ! at nit000 or nit000+1 (Leapfrog) 121 106 ENDIF 122 107 123 ! trends computation initialisation 124 IF( l_trdtrc ) THEN 125 CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrdt ) !* store now fields before applying the Asselin filter 108 IF( l_trdtrc ) THEN ! trends: store now fields before the Asselin filter application 109 CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrdt ) 126 110 ztrdt(:,:,:,:) = trn(:,:,:,:) 127 111 ENDIF 128 ! Leap-Frog + Asselin filter time stepping 129 IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! Euler time-stepping at first time-step 130 ! ! (only swap) 112 ! ! Leap-Frog + Asselin filter time stepping 113 IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! Euler time-stepping at first time-step (only swap) 131 114 DO jn = 1, jptra 132 115 DO jk = 1, jpkm1 … … 134 117 END DO 135 118 END DO 136 ! 137 ELSE 138 ! Leap-Frog + Asselin filter time stepping 139 IF( lk_vvl ) THEN ; CALL tra_nxt_vvl( kt, nittrc000, 'TRC', trb, trn, tra, jptra ) ! variable volume level (vvl) 140 ELSE ; CALL tra_nxt_fix( kt, nittrc000, 'TRC', trb, trn, tra, jptra ) ! fixed volume level 119 ELSE ! Asselin filter + swap 120 IF( ln_linssh ) THEN ; CALL tra_nxt_fix( kt, nittrc000, 'TRC', trb, trn, tra, jptra ) ! linear ssh 121 ELSE ; CALL tra_nxt_vvl( kt, nittrc000, rdttrc, 'TRC', trb, trn, tra, & 122 & sbc_trc, sbc_trc_b, jptra ) ! non-linear ssh 141 123 ENDIF 124 ! 125 DO jn = 1, jptra 126 CALL lbc_lnk( trb(:,:,:,jn), 'T', 1._wp ) 127 CALL lbc_lnk( trn(:,:,:,jn), 'T', 1._wp ) 128 CALL lbc_lnk( tra(:,:,:,jn), 'T', 1._wp ) 129 END DO 142 130 ENDIF 143 144 ! trends computation 145 IF( l_trdtrc ) THEN ! trends 131 ! 132 IF( l_trdtrc ) THEN ! trends: send Asselin filter trends to trdtra manager for further diagnostics 146 133 DO jn = 1, jptra 147 134 DO jk = 1, jpkm1 148 zfact = 1. e0 / r2dt(jk)135 zfact = 1._wp / r2dttrc 149 136 ztrdt(:,:,jk,jn) = ( trb(:,:,jk,jn) - ztrdt(:,:,jk,jn) ) * zfact 150 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_atf, ztrdt )137 CALL trd_tra( kt, 'TRC', jn, jptra_atf, ztrdt ) 151 138 END DO 152 139 END DO -
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90
r3680 r6225 15 15 USE oce_trc ! ocean dynamics and tracers variables 16 16 USE trc ! ocean passive tracers variables 17 USE trd mod_oce17 USE trd_oce 18 18 USE trdtra 19 19 USE prtctl_trc ! Print control for debbuging … … 22 22 PRIVATE 23 23 24 PUBLIC trc_rad ! routine called by trcstp.F90 25 26 !! * Substitutions 27 # include "top_substitute.h90" 24 PUBLIC trc_rad 25 PUBLIC trc_rad_ini 26 27 LOGICAL , PUBLIC :: ln_trcrad !: flag to artificially correct negative concentrations 28 28 29 !!---------------------------------------------------------------------- 29 30 !! NEMO/TOP 3.3 , NEMO Consortium (2010) … … 76 77 ! 77 78 END SUBROUTINE trc_rad 79 80 SUBROUTINE trc_rad_ini 81 !!--------------------------------------------------------------------- 82 !! *** ROUTINE trc _rad_ini *** 83 !! 84 !! ** Purpose : read namelist options 85 !!---------------------------------------------------------------------- 86 INTEGER :: ios ! Local integer output status for namelist read 87 NAMELIST/namtrc_rad/ ln_trcrad 88 !!---------------------------------------------------------------------- 89 90 ! 91 REWIND( numnat_ref ) ! namtrc_rad in reference namelist 92 READ ( numnat_ref, namtrc_rad, IOSTAT = ios, ERR = 907) 93 907 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_rad in reference namelist', lwp ) 94 95 REWIND( numnat_cfg ) ! namtrc_rad in configuration namelist 96 READ ( numnat_cfg, namtrc_rad, IOSTAT = ios, ERR = 908 ) 97 908 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_rad in configuration namelist', lwp ) 98 IF(lwm) WRITE ( numont, namtrc_rad ) 99 100 IF(lwp) THEN ! ! Control print 101 WRITE(numout,*) 102 WRITE(numout,*) ' Namelist namtrc_rad : treatment of negative concentrations' 103 WRITE(numout,*) ' correct artificially negative concen. or not ln_trcrad = ', ln_trcrad 104 ENDIF 105 ! 106 END SUBROUTINE trc_rad_ini 78 107 79 108 SUBROUTINE trc_rad_sms( kt, ptrb, ptrn, jp_sms0, jp_sms1, cpreserv ) … … 156 185 ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt 157 186 ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt 158 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_radb, ztrtrdb ) ! Asselin-like trend handling159 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_radn, ztrtrdn ) ! standard trend handling187 CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb ) ! Asselin-like trend handling 188 CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn ) ! standard trend handling 160 189 ! 161 190 ENDIF … … 187 216 ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt 188 217 ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt 189 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_radb, ztrtrdb ) ! Asselin-like trend handling190 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_radn, ztrtrdn ) ! standard trend handling218 CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb ) ! Asselin-like trend handling 219 CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn ) ! standard trend handling 191 220 ! 192 221 ENDIF -
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90
r3719 r6225 19 19 USE trc ! ocean passive tracers variables 20 20 USE prtctl_trc ! Print control for debbuging 21 USE trdmod_oce 21 USE iom 22 USE trd_oce 22 23 USE trdtra 23 24 … … 28 29 29 30 !! * Substitutions 30 # include " top_substitute.h90"31 # include "vectopt_loop_substitute.h90" 31 32 !!---------------------------------------------------------------------- 32 33 !! NEMO/TOP 3.3 , NEMO Consortium (2010) … … 60 61 INTEGER, INTENT( in ) :: kt ! ocean time-step index 61 62 ! 62 INTEGER :: ji, jj, jn ! dummy loop indices 63 REAL(wp) :: zsrau, zse3t ! temporary scalars 63 INTEGER :: ji, jj, jn ! dummy loop indices 64 REAL(wp) :: zse3t, zrtrn, zratio, zfact ! temporary scalars 65 REAL(wp) :: zswitch, zftra, zcd, zdtra, ztfx, ztra ! temporary scalars 64 66 CHARACTER (len=22) :: charout 65 67 REAL(wp), POINTER, DIMENSION(:,: ) :: zsfx 66 68 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd 69 67 70 !!--------------------------------------------------------------------- 68 71 ! … … 70 73 ! 71 74 ! Allocate temporary workspace 72 CALL wrk_alloc( jpi, jpj, zsfx ) 73 IF( l_trdtrc ) CALL wrk_alloc( jpi, jpj, jpk, ztrtrd ) 75 CALL wrk_alloc( jpi,jpj, zsfx ) 76 IF( l_trdtrc ) CALL wrk_alloc( jpi,jpj,jpk, ztrtrd ) 77 ! 78 zrtrn = 1.e-15_wp 79 80 SELECT CASE( nn_ice_embd ) ! levitating or embedded sea-ice option 81 CASE( 0 ) ; zswitch = 1 ! (0) standard levitating sea-ice : salt exchange only 82 CASE( 1, 2 ) ; zswitch = 0 ! (1) levitating sea-ice: salt and volume exchange but no pressure effect 83 ! ! (2) embedded sea-ice : salt and volume fluxes and pressure 84 END SELECT 85 86 IF( ln_top_euler) THEN 87 r2dt = rdttrc ! = rdttrc (use Euler time stepping) 88 ELSE 89 IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! at nittrc000 90 r2dt = rdttrc ! = rdttrc (restarting with Euler time stepping) 91 ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN ! at nittrc000 or nittrc000+1 92 r2dt = 2. * rdttrc ! = 2 rdttrc (leapfrog) 93 ENDIF 94 ENDIF 95 74 96 75 97 IF( kt == nittrc000 ) THEN … … 77 99 IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition' 78 100 IF(lwp) WRITE(numout,*) '~~~~~~~ ' 101 102 IF( ln_rsttr .AND. & ! Restart: read in restart file 103 iom_varid( numrtr, 'sbc_'//TRIM(ctrcnm(1))//'_b', ldstop = .FALSE. ) > 0 ) THEN 104 IF(lwp) WRITE(numout,*) ' nittrc000-nn_dttrc surface tracer content forcing fields red in the restart file' 105 zfact = 0.5_wp 106 DO jn = 1, jptra 107 CALL iom_get( numrtr, jpdom_autoglo, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc_b(:,:,jn) ) ! before tracer content sbc 108 END DO 109 ELSE ! No restart or restart not found: Euler forward time stepping 110 zfact = 1._wp 111 sbc_trc_b(:,:,:) = 0._wp 112 ENDIF 113 ELSE ! Swap of forcing fields 114 IF( ln_top_euler ) THEN 115 zfact = 1._wp 116 sbc_trc_b(:,:,:) = 0._wp 117 ELSE 118 zfact = 0.5_wp 119 sbc_trc_b(:,:,:) = sbc_trc(:,:,:) 120 ENDIF 121 ! 79 122 ENDIF 80 123 … … 83 126 ! Coupling offline : runoff are in emp which contains E-P-R 84 127 ! 85 IF( .NOT. lk_offline .AND. lk_vvl) THEN ! online coupling with vvl128 IF( .NOT. lk_offline .AND. .NOT.ln_linssh ) THEN ! online coupling with vvl 86 129 zsfx(:,:) = 0._wp 87 130 ELSE ! online coupling free surface or offline with free surface … … 90 133 91 134 ! 0. initialization 92 zsrau = 1. / rau093 135 DO jn = 1, jptra 94 136 ! 95 IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn) ! save trends 96 ! ! add the trend to the general tracer trend 137 IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn) ! save trends 138 139 IF ( nn_ice_tr == -1 ) THEN ! No tracers in sea ice (null concentration in sea ice) 140 141 DO jj = 2, jpj 142 DO ji = fs_2, fs_jpim1 ! vector opt. 143 sbc_trc(ji,jj,jn) = zsfx(ji,jj) * r1_rau0 * trn(ji,jj,1,jn) 144 END DO 145 END DO 146 147 ELSE 148 149 DO jj = 2, jpj 150 DO ji = fs_2, fs_jpim1 ! vector opt. 151 zse3t = 1. / e3t_n(ji,jj,1) 152 ! tracer flux at the ice/ocean interface (tracer/m2/s) 153 zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice 154 zcd = trc_o(ji,jj,jn) * fmmflx(ji,jj) ! concentration dilution due to freezing-melting, 155 ! only used in the levitating sea ice case 156 ! tracer flux only : add concentration dilution term in net tracer flux, no F-M in volume flux 157 ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux 158 ztfx = zftra + zswitch * zcd ! net tracer flux (+C/D if no ice/ocean mass exchange) 159 160 zdtra = r1_rau0 * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) ) 161 IF ( zdtra < 0. ) THEN 162 zratio = -zdtra * zse3t * r2dt / ( trn(ji,jj,1,jn) + zrtrn ) 163 zdtra = MIN(1.0, zratio) * zdtra ! avoid negative concentrations to arise 164 ENDIF 165 sbc_trc(ji,jj,jn) = zdtra 166 END DO 167 END DO 168 ENDIF 169 ! Concentration dilution effect on tracers due to evaporation & precipitation 97 170 DO jj = 2, jpj 98 171 DO ji = fs_2, fs_jpim1 ! vector opt. 99 zse3t = 1. / fse3t(ji,jj,1)100 tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zsfx(ji,jj) * zsrau * trn(ji,jj,1,jn) * zse3t172 zse3t = zfact / e3t_n(ji,jj,1) 173 tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + ( sbc_trc_b(ji,jj,jn) + sbc_trc(ji,jj,jn) ) * zse3t 101 174 END DO 102 175 END DO 103 176 ! 104 177 IF( l_trdtrc ) THEN 105 178 ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:) 106 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_nsr, ztrtrd )179 CALL trd_tra( kt, 'TRC', jn, jptra_nsr, ztrtrd ) 107 180 END IF 108 181 ! ! =========== 109 182 END DO ! tracer loop 110 183 ! ! =========== 184 185 ! Write in the tracer restar file 186 ! ******************************* 187 IF( lrst_trc ) THEN 188 IF(lwp) WRITE(numout,*) 189 IF(lwp) WRITE(numout,*) 'sbc : ocean surface tracer content forcing fields written in tracer restart file ', & 190 & 'at it= ', kt,' date= ', ndastp 191 IF(lwp) WRITE(numout,*) '~~~~' 192 DO jn = 1, jptra 193 CALL iom_rstput( kt, nitrst, numrtw, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc(:,:,jn) ) 194 END DO 195 ENDIF 196 ! 111 197 IF( ln_ctl ) THEN 112 198 WRITE(charout, FMT="('sbc ')") ; CALL prt_ctl_trc_info(charout) 113 199 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 114 200 ENDIF 115 CALL wrk_dealloc( jpi, jpj,zsfx )116 IF( l_trdtrc ) CALL wrk_dealloc( jpi, jpj, jpk,ztrtrd )201 CALL wrk_dealloc( jpi,jpj, zsfx ) 202 IF( l_trdtrc ) CALL wrk_dealloc( jpi,jpj,jpk, ztrtrd ) 117 203 ! 118 204 IF( nn_timing == 1 ) CALL timing_stop('trc_sbc') -
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trctrp.F90
r4148 r6225 15 15 USE oce_trc ! ocean dynamics and active tracers variables 16 16 USE trc ! ocean passive tracers variables 17 USE trcnam_trp ! passive tracers transport namelist variables18 17 USE trabbl ! bottom boundary layer (trc_bbl routine) 19 18 USE trcbbl ! bottom boundary layer (trc_bbl routine) 20 USE zdfkpp ! KPP non-local tracer fluxes (trc_kpp routine)21 19 USE trcdmp ! internal damping (trc_dmp routine) 22 20 USE trcldf ! lateral mixing (trc_ldf routine) … … 27 25 USE trcsbc ! surface boundary condition (trc_sbc routine) 28 26 USE zpshde ! partial step: hor. derivative (zps_hde routine) 27 USE trcbdy ! BDY open boundaries 28 USE bdy_par, only: lk_bdy 29 29 30 30 #if defined key_agrif … … 38 38 PUBLIC trc_trp ! called by trc_stp 39 39 40 !! * Substitutions41 # include "top_substitute.h90"42 40 !!---------------------------------------------------------------------- 43 41 !! NEMO/TOP 3.3 , NEMO Consortium (2010) … … 48 46 CONTAINS 49 47 50 SUBROUTINE trc_trp( k stp)48 SUBROUTINE trc_trp( kt ) 51 49 !!---------------------------------------------------------------------- 52 50 !! *** ROUTINE trc_trp *** … … 57 55 !! - Update the passive tracers 58 56 !!---------------------------------------------------------------------- 59 INTEGER, INTENT( in ) :: k stp! ocean time-step index57 INTEGER, INTENT( in ) :: kt ! ocean time-step index 60 58 !! --------------------------------------------------------------------- 61 59 ! … … 64 62 IF( .NOT. lk_c1d ) THEN 65 63 ! 66 CALL trc_sbc( kstp ) ! surface boundary condition 67 IF( lk_trabbl ) CALL trc_bbl( kstp ) ! advective (and/or diffusive) bottom boundary layer scheme 68 IF( ln_trcdmp ) CALL trc_dmp( kstp ) ! internal damping trends 69 IF( ln_trcdmp_clo ) CALL trc_dmp_clo( kstp ) ! internal damping trends on closed seas only 70 CALL trc_adv( kstp ) ! horizontal & vertical advection 71 CALL trc_ldf( kstp ) ! lateral mixing 72 IF( .NOT. lk_offline .AND. lk_zdfkpp ) & 73 & CALL trc_kpp( kstp ) ! KPP non-local tracer fluxes 64 CALL trc_sbc ( kt ) ! surface boundary condition 65 IF( lk_trabbl ) CALL trc_bbl ( kt ) ! advective (and/or diffusive) bottom boundary layer scheme 66 IF( ln_trcdmp ) CALL trc_dmp ( kt ) ! internal damping trends 67 IF( ln_trcdmp_clo ) CALL trc_dmp_clo( kt ) ! internal damping trends on closed seas only 68 IF( lk_bdy ) CALL trc_bdy_dmp( kt ) ! BDY damping trends 69 CALL trc_adv ( kt ) ! horizontal & vertical advection 70 ! ! Partial top/bottom cell: GRADh( trb ) 71 IF( ln_zps ) THEN 72 IF( ln_isfcav ) THEN ; CALL zps_hde_isf( kt, jptra, trb, pgtu=gtru, pgtv=gtrv, pgtui=gtrui, pgtvi=gtrvi ) ! both top & bottom 73 ELSE ; CALL zps_hde ( kt, jptra, trb, gtru, gtrv ) ! only bottom 74 ENDIF 75 ENDIF 76 ! 77 CALL trc_ldf ( kt ) ! lateral mixing 74 78 #if defined key_agrif 75 IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_trc 79 IF(.NOT. Agrif_Root()) CALL Agrif_Sponge_trc ! tracers sponge 76 80 #endif 77 CALL trc_zdf ( kstp )! vertical mixing and after tracer fields78 CALL trc_nxt ( kstp )! tracer fields at next time step79 IF( ln_trcrad ) CALL trc_rad ( kstp )! Correct artificial negative concentrations81 CALL trc_zdf ( kt ) ! vertical mixing and after tracer fields 82 CALL trc_nxt ( kt ) ! tracer fields at next time step 83 IF( ln_trcrad ) CALL trc_rad ( kt ) ! Correct artificial negative concentrations 80 84 81 85 #if defined key_agrif 82 IF( .NOT. Agrif_Root()) CALL Agrif_Update_Trc( kstp )! Update tracer at AGRIF zoom boundaries : children only86 IF( .NOT.Agrif_Root()) CALL Agrif_Update_Trc( kt ) ! Update tracer at AGRIF zoom boundaries : children only 83 87 #endif 84 IF( ln_zps ) CALL zps_hde( kstp, jptra, trn, gtru, gtrv ) ! Partial steps: now horizontal gradient of passive85 ! tracers at the bottom ocean level86 88 ! 87 89 ELSE ! 1D vertical configuration 88 CALL trc_sbc( kstp ) ! surface boundary condition 89 IF( .NOT. lk_offline .AND. lk_zdfkpp ) & 90 & CALL trc_kpp( kstp ) ! KPP non-local tracer fluxes 91 CALL trc_zdf( kstp ) ! vertical mixing and after tracer fields 92 CALL trc_nxt( kstp ) ! tracer fields at next time step 93 IF( ln_trcrad ) CALL trc_rad( kstp ) ! Correct artificial negative concentrations 90 CALL trc_sbc( kt ) ! surface boundary condition 91 IF( ln_trcdmp ) CALL trc_dmp( kt ) ! internal damping trends 92 CALL trc_zdf( kt ) ! vertical mixing and after tracer fields 93 CALL trc_nxt( kt ) ! tracer fields at next time step 94 IF( ln_trcrad ) CALL trc_rad( kt ) ! Correct artificial negative concentrations 94 95 ! 95 96 END IF … … 104 105 !!---------------------------------------------------------------------- 105 106 CONTAINS 106 SUBROUTINE trc_trp( k stp) ! Empty routine107 INTEGER, INTENT(in) :: k stp108 WRITE(*,*) 'trc_trp: You should not have seen this print! error?', k stp107 SUBROUTINE trc_trp( kt ) ! Empty routine 108 INTEGER, INTENT(in) :: kt 109 WRITE(*,*) 'trc_trp: You should not have seen this print! error?', kt 109 110 END SUBROUTINE trc_trp 110 111 #endif -
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90
r3680 r6225 11 11 !! 'key_top' TOP models 12 12 !!---------------------------------------------------------------------- 13 !! trc_ ldf: update the tracer trend with the lateral diffusion14 !! ldf_ctl: initialization, namelist read, and parameters control13 !! trc_zdf : update the tracer trend with the lateral diffusion 14 !! trc_zdf_ini : initialization, namelist read, and parameters control 15 15 !!---------------------------------------------------------------------- 16 USE oce_trc ! ocean dynamics and active tracers17 USE trc ! ocean passive tracers variables18 USE tr cnam_trp ! passive tracers transport namelistvariables19 USE trazdf_exp 20 USE trazdf_imp 21 USE tr dmod_oce22 USE trdtra 23 USE prtctl_trc 16 USE trc ! ocean passive tracers variables 17 USE oce_trc ! ocean dynamics and active tracers 18 USE trd_oce ! trends: ocean variables 19 USE trazdf_exp ! vertical diffusion: explicit (tra_zdf_exp routine) 20 USE trazdf_imp ! vertical diffusion: implicit (tra_zdf_imp routine) 21 USE trcldf ! passive tracers: lateral diffusion 22 USE trdtra ! trends manager: tracers 23 USE prtctl_trc ! Print control 24 24 25 25 IMPLICIT NONE 26 26 PRIVATE 27 27 28 PUBLIC trc_zdf ! called by step.F90 29 PUBLIC trc_zdf_alloc ! called by nemogcm.F90 28 PUBLIC trc_zdf ! called by step.F90 29 PUBLIC trc_zdf_ini ! called by nemogcm.F90 30 31 ! !!** Vertical diffusion (nam_trczdf) ** 32 LOGICAL , PUBLIC :: ln_trczdf_exp !: explicit vertical diffusion scheme flag 33 INTEGER , PUBLIC :: nn_trczdf_exp !: number of sub-time step (explicit time stepping) 30 34 31 35 INTEGER :: nzdf = 0 ! type vertical diffusion algorithm used 32 36 ! ! defined from ln_zdf... namlist logicals) 33 REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:) :: r2dt ! vertical profile time-step, = 2 rdttra34 ! ! except at nittrc000 (=rdttra) if neuler=037 REAL(wp) :: r2dttrc ! vertical profile time-step, = 2 rdt 38 ! ! except at nittrc000 (=rdt) if neuler=0 35 39 36 40 !! * Substitutions 37 # include "domzgr_substitute.h90"38 41 # include "zdfddm_substitute.h90" 39 42 # include "vectopt_loop_substitute.h90" 40 43 !!---------------------------------------------------------------------- 41 !! NEMO/TOP 3. 3 , NEMO Consortium (2010)44 !! NEMO/TOP 3.7 , NEMO Consortium (2015) 42 45 !! $Id$ 43 46 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 44 47 !!---------------------------------------------------------------------- 45 48 CONTAINS 46 47 INTEGER FUNCTION trc_zdf_alloc()48 !!----------------------------------------------------------------------49 !! *** ROUTINE trc_zdf_alloc ***50 !!----------------------------------------------------------------------51 ALLOCATE( r2dt(jpk) , STAT=trc_zdf_alloc )52 !53 IF( trc_zdf_alloc /= 0 ) CALL ctl_warn('trc_zdf_alloc : failed to allocate array.')54 !55 END FUNCTION trc_zdf_alloc56 57 49 58 50 SUBROUTINE trc_zdf( kt ) … … 71 63 IF( nn_timing == 1 ) CALL timing_start('trc_zdf') 72 64 ! 73 IF( kt == nittrc000 ) CALL zdf_ctl ! initialisation & control of options 74 75 IF( ln_top_euler) THEN 76 r2dt(:) = rdttrc(:) ! = rdttrc (use Euler time stepping) 77 ELSE 78 IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! at nittrc000 79 r2dt(:) = rdttrc(:) ! = rdttrc (restarting with Euler time stepping) 80 ELSEIF( kt <= nittrc000 + 1 ) THEN ! at nittrc000 or nittrc000+1 81 r2dt(:) = 2. * rdttrc(:) ! = 2 rdttrc (leapfrog) 82 ENDIF 65 IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN ! at nittrc000 66 r2dttrc = rdttrc ! = rdttrc (use or restarting with Euler time stepping) 67 ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN ! at nittrc000 or nittrc000+1 68 r2dttrc = 2. * rdttrc ! = 2 rdttrc (leapfrog) 83 69 ENDIF 84 70 … … 89 75 90 76 SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend 91 CASE ( -1 ) ! esopa: test all possibility with control print 92 CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) 93 WRITE(charout, FMT="('zdf1 ')") ; CALL prt_ctl_trc_info(charout) 94 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 95 CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt, trb, tra, jptra ) 96 WRITE(charout, FMT="('zdf2 ')") ; CALL prt_ctl_trc_info(charout) 97 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 98 CASE ( 0 ) ; CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) ! explicit scheme 99 CASE ( 1 ) ; CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt, trb, tra, jptra ) ! implicit scheme 100 77 CASE ( 0 ) ; CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dttrc, nn_trczdf_exp, trb, tra, jptra ) ! explicit scheme 78 CASE ( 1 ) ; CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dttrc, trb, tra, jptra ) ! implicit scheme 101 79 END SELECT 102 80 … … 104 82 DO jn = 1, jptra 105 83 DO jk = 1, jpkm1 106 ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt (jk)) - ztrtrd(:,:,jk,jn)84 ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dttrc ) - ztrtrd(:,:,jk,jn) 107 85 END DO 108 CALL trd_tra( kt, 'TRC', jn, jptra_ trd_zdf, ztrtrd(:,:,:,jn) )86 CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) 109 87 END DO 110 88 CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) … … 121 99 122 100 123 SUBROUTINE zdf_ctl101 SUBROUTINE trc_zdf_ini 124 102 !!---------------------------------------------------------------------- 125 !! *** ROUTINE zdf_ctl***103 !! *** ROUTINE trc_zdf_ini *** 126 104 !! 127 105 !! ** Purpose : Choose the vertical mixing scheme … … 132 110 !! NB: The implicit scheme is required when using : 133 111 !! - rotated lateral mixing operator 134 !! - TKE, GLS or KPPvertical mixing scheme112 !! - TKE, GLS vertical mixing scheme 135 113 !!---------------------------------------------------------------------- 136 137 ! Define the vertical tracer physics scheme 138 ! ========================================== 139 140 ! Choice from ln_zdfexp already read in namelist in zdfini module 141 IF( ln_trczdf_exp ) THEN ! use explicit scheme 142 nzdf = 0 143 ELSE ! use implicit scheme 144 nzdf = 1 114 INTEGER :: ios ! Local integer output status for namelist read 115 !! 116 NAMELIST/namtrc_zdf/ ln_trczdf_exp , nn_trczdf_exp 117 !!---------------------------------------------------------------------- 118 ! 119 REWIND( numnat_ref ) ! namtrc_zdf in reference namelist 120 READ ( numnat_ref, namtrc_zdf, IOSTAT = ios, ERR = 905) 121 905 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in reference namelist', lwp ) 122 ! 123 REWIND( numnat_cfg ) ! namtrc_zdf in configuration namelist 124 READ ( numnat_cfg, namtrc_zdf, IOSTAT = ios, ERR = 906 ) 125 906 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in configuration namelist', lwp ) 126 IF(lwm) WRITE ( numont, namtrc_zdf ) 127 ! 128 IF(lwp) THEN ! Control print 129 WRITE(numout,*) 130 WRITE(numout,*) ' Namelist namtrc_zdf : set vertical diffusion parameters' 131 WRITE(numout,*) ' time splitting / backward scheme ln_trczdf_exp = ', ln_trczdf_exp 132 WRITE(numout,*) ' number of time step nn_trczdf_exp = ', nn_trczdf_exp 145 133 ENDIF 146 134 147 ! Force implicit schemes 148 IF( ln_trcldf_iso ) nzdf = 1 ! iso-neutral lateral physics 149 IF( ln_trcldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate 150 #if defined key_zdftke || defined key_zdfgls || defined key_zdfkpp 151 nzdf = 1 ! TKE, GLS or KPP physics 152 #endif 153 IF( ln_trczdf_exp .AND. nzdf == 1 ) THEN 154 CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS or KPP vertical scheme ', & 155 & ' the implicit scheme is required, set ln_trczdf_exp = .false.' ) 135 ! ! Define the vertical tracer physics scheme 136 IF( ln_trczdf_exp ) THEN ; nzdf = 0 ! explicit scheme 137 ELSE ; nzdf = 1 ! implicit scheme 156 138 ENDIF 157 139 158 ! Test: esopa 159 IF( lk_esopa ) nzdf = -1 ! All schemes used 140 ! ! Force implicit schemes 141 IF( ln_trcldf_iso ) nzdf = 1 ! iso-neutral lateral physics 142 IF( ln_trcldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate 143 #if defined key_zdftke || defined key_zdfgls 144 nzdf = 1 ! TKE or GLS physics 145 #endif 146 IF( ln_trczdf_exp .AND. nzdf == 1 ) & 147 CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS vertical scheme ', & 148 & ' the implicit scheme is required, set ln_trczdf_exp = .false.' ) 160 149 161 150 IF(lwp) THEN … … 163 152 WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' 164 153 WRITE(numout,*) '~~~~~~~~~~~' 165 IF( nzdf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used'166 154 IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme' 167 155 IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme' 168 156 ENDIF 169 170 END SUBROUTINE zdf_ctl 157 ! 158 END SUBROUTINE trc_zdf_ini 159 171 160 #else 172 161 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.