Changeset 6404 for branches/2015/dev_r5803_UKMO_AGRIF_Vert_interp/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90
- Timestamp:
- 2016-03-29T11:24:48+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2015/dev_r5803_UKMO_AGRIF_Vert_interp/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90
r6401 r6404 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 d_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 options74 75 65 IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN ! at nittrc000 76 r2dt (:) = rdttrc(:)! = rdttrc (use or restarting with Euler time stepping)66 r2dttrc = rdttrc ! = rdttrc (use or restarting with Euler time stepping) 77 67 ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN ! at nittrc000 or nittrc000+1 78 r2dt (:) = 2. * rdttrc(:)! = 2 rdttrc (leapfrog)68 r2dttrc = 2. * rdttrc ! = 2 rdttrc (leapfrog) 79 69 ENDIF 80 70 … … 85 75 86 76 SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend 87 CASE ( -1 ) ! esopa: test all possibility with control print 88 CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) 89 WRITE(charout, FMT="('zdf1 ')") ; CALL prt_ctl_trc_info(charout) 90 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 91 CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt, trb, tra, jptra ) 92 WRITE(charout, FMT="('zdf2 ')") ; CALL prt_ctl_trc_info(charout) 93 CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 94 CASE ( 0 ) ; CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) ! explicit scheme 95 CASE ( 1 ) ; CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt, trb, tra, jptra ) ! implicit scheme 96 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 97 79 END SELECT 98 80 … … 100 82 DO jn = 1, jptra 101 83 DO jk = 1, jpkm1 102 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) 103 85 END DO 104 86 CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) … … 117 99 118 100 119 SUBROUTINE zdf_ctl101 SUBROUTINE trc_zdf_ini 120 102 !!---------------------------------------------------------------------- 121 !! *** ROUTINE zdf_ctl***103 !! *** ROUTINE trc_zdf_ini *** 122 104 !! 123 105 !! ** Purpose : Choose the vertical mixing scheme … … 128 110 !! NB: The implicit scheme is required when using : 129 111 !! - rotated lateral mixing operator 130 !! - TKE, GLS or KPPvertical mixing scheme112 !! - TKE, GLS vertical mixing scheme 131 113 !!---------------------------------------------------------------------- 132 133 ! Define the vertical tracer physics scheme 134 ! ========================================== 135 136 ! Choice from ln_zdfexp already read in namelist in zdfini module 137 IF( ln_trczdf_exp ) THEN ! use explicit scheme 138 nzdf = 0 139 ELSE ! use implicit scheme 140 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 141 133 ENDIF 142 134 143 ! Force implicit schemes 144 IF( ln_trcldf_iso ) nzdf = 1 ! iso-neutral lateral physics 145 IF( ln_trcldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate 146 #if defined key_zdftke || defined key_zdfgls || defined key_zdfkpp 147 nzdf = 1 ! TKE, GLS or KPP physics 148 #endif 149 IF( ln_trczdf_exp .AND. nzdf == 1 ) THEN 150 CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS or KPP vertical scheme ', & 151 & ' 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 152 138 ENDIF 153 139 154 ! Test: esopa 155 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.' ) 156 149 157 150 IF(lwp) THEN … … 159 152 WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' 160 153 WRITE(numout,*) '~~~~~~~~~~~' 161 IF( nzdf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used'162 154 IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme' 163 155 IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme' 164 156 ENDIF 165 166 END SUBROUTINE zdf_ctl 157 ! 158 END SUBROUTINE trc_zdf_ini 159 167 160 #else 168 161 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.