- Timestamp:
- 2016-07-19T10:38:35+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/NERC/dev_r5549_BDY_ZEROGRAD/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90
r5120 r6808 4 4 !! Ocean Active tracers : lateral diffusive trends 5 5 !!===================================================================== 6 !! History : 9.0 ! 2005-11 (G. Madec) Original code7 !! NEMO3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA8 !! ----------------------------------------------------------------------9 10 !! ----------------------------------------------------------------------11 !! tra_ldf : update the tracer trend with the lateral diffusion12 !! tra_ldf_init : initialization, namelist read, and parameters control 13 !! ldf_ano : compute lateral diffusion for constant T-S profiles14 !! ----------------------------------------------------------------------15 USE oce ! ocean dynamics and tracers16 USE dom_oce ! ocean space and time domain17 USE phycst ! physical constants18 USE ldftra_oce ! ocean tracer lateral physics19 USE ldfslp ! ???20 USE traldf_bilapg ! lateral mixing (tra_ldf_bilapg routine)21 USE traldf_bilap ! lateral mixing (tra_ldf_bilap routine)22 USE traldf_ iso ! lateral mixing (tra_ldf_iso routine)23 USE traldf_iso _grif ! lateral mixing (tra_ldf_iso_grif routine)24 USE traldf_ lap ! lateral mixing (tra_ldf_lap routine)25 USE trd_oce 26 USE trdtra ! trends manager: tracers6 !! History : 9.0 ! 2005-11 (G. Madec) Original code 7 !! NEMO 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA 8 !! 3.7 ! 2013-12 (G. Madec) remove the optional computation from T & S anomaly profiles and traldf_bilapg 9 !! - ! 2013-12 (F. Lemarie, G. Madec) triad operator (Griffies) + Method of Stabilizing Correction 10 !! - ! 2014-01 (G. Madec, S. Masson) restructuration/simplification of lateral diffusive operators 11 !!---------------------------------------------------------------------- 12 13 !!---------------------------------------------------------------------- 14 !! tra_ldf : update the tracer trend with the lateral diffusion trend 15 !! tra_ldf_init : initialization, namelist read, and parameters control 16 !!---------------------------------------------------------------------- 17 USE oce ! ocean dynamics and tracers 18 USE dom_oce ! ocean space and time domain 19 USE phycst ! physical constants 20 USE ldftra ! lateral diffusion: eddy diffusivity & EIV coeff. 21 USE ldfslp ! lateral diffusion: iso-neutral slope 22 USE traldf_lap_blp ! lateral diffusion: laplacian iso-level operator (tra_ldf_lap/_blp routines) 23 USE traldf_iso ! lateral diffusion: laplacian iso-neutral standard operator (tra_ldf_iso routine ) 24 USE traldf_triad ! lateral diffusion: laplacian iso-neutral triad operator (tra_ldf_triad routine ) 25 USE trd_oce ! trends: ocean variables 26 USE trdtra ! ocean active tracers trends 27 27 ! 28 USE prtctl 29 USE in_out_manager 30 USE lib_mpp 31 USE lbclnk 32 USE wrk_nemo 33 USE timing 28 USE prtctl ! Print control 29 USE in_out_manager ! I/O manager 30 USE lib_mpp ! distribued memory computing library 31 USE lbclnk ! ocean lateral boundary conditions (or mpp link) 32 USE wrk_nemo ! Memory allocation 33 USE timing ! Timing 34 34 35 35 IMPLICIT NONE … … 37 37 38 38 PUBLIC tra_ldf ! called by step.F90 39 PUBLIC tra_ldf_init ! called by opa.F9039 PUBLIC tra_ldf_init ! called by nemogcm.F90 40 40 ! 41 INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_traldf_... namlist logicals) 42 43 REAL, SAVE, ALLOCATABLE, DIMENSION(:,:,:) :: t0_ldf, s0_ldf !: lateral diffusion trends of T & S for a cst profile 44 ! ! (key_traldf_ano only) 45 41 INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_traldf_... (namlist logicals) 42 46 43 !! * Substitutions 47 # include "domzgr_substitute.h90"48 44 # include "vectopt_loop_substitute.h90" 49 45 !!---------------------------------------------------------------------- 50 !! NEMO/OPA 3. 3 , NEMO Consortium (2010)46 !! NEMO/OPA 3.7 , NEMO Consortium (2015) 51 47 !! $Id$ 52 48 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 65 61 !!---------------------------------------------------------------------- 66 62 ! 67 IF( nn_timing == 1 ) CALL timing_start('tra_ldf') 68 ! 69 rldf = 1 ! For active tracers the 70 63 IF( nn_timing == 1 ) CALL timing_start('tra_ldf') 64 ! 71 65 IF( l_trdtra ) THEN !* Save ta and sa trends 72 CALL wrk_alloc( jpi, jpj, jpk,ztrdt, ztrds )66 CALL wrk_alloc( jpi,jpj,jpk, ztrdt, ztrds ) 73 67 ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 74 68 ztrds(:,:,:) = tsa(:,:,:,jp_sal) 75 69 ENDIF 76 77 SELECT CASE ( nldf ) ! compute lateral mixing trend and add it to the general trend 78 CASE ( 0 ) ; CALL tra_ldf_lap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & 79 & tsb, tsa, jpts ) ! iso-level laplacian 80 CASE ( 1 ) ! rotated laplacian 81 IF( ln_traldf_grif ) THEN 82 CALL tra_ldf_iso_grif( kt, nit000,'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 ) ! Griffies operator 83 ELSE 84 CALL tra_ldf_iso ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & 85 & tsb, tsa, jpts, ahtb0 ) ! Madec operator 86 ENDIF 87 CASE ( 2 ) ; CALL tra_ldf_bilap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & 88 & tsb, tsa, jpts ) ! iso-level bilaplacian 89 CASE ( 3 ) ; CALL tra_ldf_bilapg ( kt, nit000, 'TRA', tsb, tsa, jpts ) ! s-coord. geopot. bilap. 90 ! 91 CASE ( -1 ) ! esopa: test all possibility with control print 92 CALL tra_ldf_lap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & 93 & tsb, tsa, jpts ) 94 CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf0 - Ta: ', mask1=tmask, & 95 & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) 96 IF( ln_traldf_grif ) THEN 97 CALL tra_ldf_iso_grif( kt, nit000, 'TRA', gtsu, gtsv, tsb, tsa, jpts, ahtb0 ) 98 ELSE 99 CALL tra_ldf_iso ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & 100 & tsb, tsa, jpts, ahtb0 ) 101 ENDIF 102 CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf1 - Ta: ', mask1=tmask, & 103 & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) 104 CALL tra_ldf_bilap ( kt, nit000, 'TRA', gtsu, gtsv, gtui, gtvi, & 105 & tsb, tsa, jpts ) 106 CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf2 - Ta: ', mask1=tmask, & 107 & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) 108 CALL tra_ldf_bilapg( kt, nit000, 'TRA', tsb, tsa, jpts ) 109 CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf3 - Ta: ', mask1=tmask, & 110 & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) 70 ! 71 SELECT CASE ( nldf ) !* compute lateral mixing trend and add it to the general trend 72 CASE ( np_lap ) ! laplacian: iso-level operator 73 CALL tra_ldf_lap ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb, tsa, jpts, 1 ) 74 CASE ( np_lap_i ) ! laplacian: standard iso-neutral operator (Madec) 75 CALL tra_ldf_iso ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb, tsb, tsa, jpts, 1 ) 76 CASE ( np_lap_it ) ! laplacian: triad iso-neutral operator (griffies) 77 CALL tra_ldf_triad( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb, tsb, tsa, jpts, 1 ) 78 CASE ( np_blp , np_blp_i , np_blp_it ) ! bilaplacian: iso-level & iso-neutral operators 79 CALL tra_ldf_blp ( kt, nit000,'TRA', ahtu, ahtv, gtsu, gtsv, gtui, gtvi, tsb , tsa, jpts, nldf ) 111 80 END SELECT 112 113 #if defined key_traldf_ano 114 tsa(:,:,:,jp_tem) = tsa(:,:,:,jp_tem) - t0_ldf(:,:,:) ! anomaly: substract the reference diffusivity 115 tsa(:,:,:,jp_sal) = tsa(:,:,:,jp_sal) - s0_ldf(:,:,:) 116 #endif 117 118 IF( l_trdtra ) THEN ! save the horizontal diffusive trends for further diagnostics 81 ! 82 IF( l_trdtra ) THEN !* save the horizontal diffusive trends for further diagnostics 119 83 ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:) 120 84 ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:) 121 85 CALL trd_tra( kt, 'TRA', jp_tem, jptra_ldf, ztrdt ) 122 86 CALL trd_tra( kt, 'TRA', jp_sal, jptra_ldf, ztrds ) 123 CALL wrk_dealloc( jpi, jpj, jpk,ztrdt, ztrds )124 ENDIF 125 ! !print mean trends (used for debugging)87 CALL wrk_dealloc( jpi,jpj,jpk, ztrdt, ztrds ) 88 ENDIF 89 ! !* print mean trends (used for debugging) 126 90 IF(ln_ctl) CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' ldf - Ta: ', mask1=tmask, & 127 91 & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) 128 92 ! 129 IF( nn_timing == 1 ) CALL timing_stop('tra_ldf')93 IF( nn_timing == 1 ) CALL timing_stop('tra_ldf') 130 94 ! 131 95 END SUBROUTINE tra_ldf … … 139 103 !! 140 104 !! ** Method : set nldf from the namtra_ldf logicals 141 !! nldf == -1 ESOPA test: ALL operators are used 142 !! nldf == 0 laplacian operator 143 !! nldf == 1 Rotated laplacian operator 144 !! nldf == 2 bilaplacian operator 145 !! nldf == 3 Rotated bilaplacian 146 !!---------------------------------------------------------------------- 147 INTEGER :: ioptio, ierr ! temporary integers 148 !!---------------------------------------------------------------------- 149 150 ! Define the lateral mixing oparator for tracers 151 ! =============================================== 152 153 IF(lwp) THEN ! Namelist print 105 !!---------------------------------------------------------------------- 106 INTEGER :: ioptio, ierr ! temporary integers 107 !!---------------------------------------------------------------------- 108 ! 109 IF(lwp) THEN ! Namelist print 154 110 WRITE(numout,*) 155 111 WRITE(numout,*) 'tra_ldf_init : lateral tracer diffusive operator' 156 112 WRITE(numout,*) '~~~~~~~~~~~' 157 WRITE(numout,*) ' Namelist namtra_ldf already read in ldftra module'158 WRITE(numout,*) ' see ldf_tra_init report for lateral mixing parameters'113 WRITE(numout,*) ' Namelist namtra_ldf: already read in ldftra module' 114 WRITE(numout,*) ' see ldf_tra_init report for lateral mixing parameters' 159 115 WRITE(numout,*) 160 116 ENDIF 161 162 ! ! control the input117 ! ! use of lateral operator or not 118 nldf = np_ERROR 163 119 ioptio = 0 164 IF( ln_traldf_lap ) ioptio = ioptio + 1 165 IF( ln_traldf_bilap ) ioptio = ioptio + 1 166 IF( ioptio > 1 ) CALL ctl_stop( ' use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 167 IF( ioptio == 0 ) nldf = -2 ! No lateral diffusion 168 ioptio = 0 169 IF( ln_traldf_level ) ioptio = ioptio + 1 170 IF( ln_traldf_hor ) ioptio = ioptio + 1 171 IF( ln_traldf_iso ) ioptio = ioptio + 1 172 IF( ioptio > 1 ) CALL ctl_stop( ' use only ONE direction (level/hor/iso)' ) 173 174 ! defined the type of lateral diffusion from ln_traldf_... logicals 175 ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully 176 ierr = 0 177 IF( ln_traldf_lap ) THEN ! laplacian operator 178 IF ( ln_zco ) THEN ! z-coordinate 179 IF ( ln_traldf_level ) nldf = 0 ! iso-level (no rotation) 180 IF ( ln_traldf_hor ) nldf = 0 ! horizontal (no rotation) 181 IF ( ln_traldf_iso ) nldf = 1 ! isoneutral ( rotation) 120 IF( ln_traldf_lap ) ioptio = ioptio + 1 121 IF( ln_traldf_blp ) ioptio = ioptio + 1 122 IF( ioptio > 1 ) CALL ctl_stop( 'tra_ldf_init: use ONE or NONE of the 2 lap/bilap operator type on tracer' ) 123 IF( ioptio == 0 ) nldf = np_no_ldf ! No lateral diffusion 124 ! 125 IF( nldf /= np_no_ldf ) THEN ! direction ==>> type of operator 126 ioptio = 0 127 IF( ln_traldf_lev ) ioptio = ioptio + 1 128 IF( ln_traldf_hor ) ioptio = ioptio + 1 129 IF( ln_traldf_iso ) ioptio = ioptio + 1 130 IF( ioptio > 1 ) CALL ctl_stop( 'tra_ldf_init: use only ONE direction (level/hor/iso)' ) 131 ! 132 ! ! defined the type of lateral diffusion from ln_traldf_... logicals 133 ierr = 0 134 IF( ln_traldf_lap ) THEN ! laplacian operator 135 IF ( ln_zco ) THEN ! z-coordinate 136 IF ( ln_traldf_lev ) nldf = np_lap ! iso-level = horizontal (no rotation) 137 IF ( ln_traldf_hor ) nldf = np_lap ! iso-level = horizontal (no rotation) 138 IF ( ln_traldf_iso ) nldf = np_lap_i ! iso-neutral: standard ( rotation) 139 IF ( ln_traldf_triad ) nldf = np_lap_it ! iso-neutral: triad ( rotation) 140 ENDIF 141 IF ( ln_zps ) THEN ! z-coordinate with partial step 142 IF ( ln_traldf_lev ) ierr = 1 ! iso-level not allowed 143 IF ( ln_traldf_hor ) nldf = np_lap ! horizontal (no rotation) 144 IF ( ln_traldf_iso ) nldf = np_lap_i ! iso-neutral: standard (rotation) 145 IF ( ln_traldf_triad ) nldf = np_lap_it ! iso-neutral: triad (rotation) 146 ENDIF 147 IF ( ln_sco ) THEN ! s-coordinate 148 IF ( ln_traldf_lev ) nldf = np_lap ! iso-level (no rotation) 149 IF ( ln_traldf_hor ) nldf = np_lap_i ! horizontal ( rotation) 150 IF ( ln_traldf_iso ) nldf = np_lap_i ! iso-neutral: standard ( rotation) 151 IF ( ln_traldf_triad ) nldf = np_lap_it ! iso-neutral: triad ( rotation) 152 ENDIF 182 153 ENDIF 183 IF ( ln_zps ) THEN ! zps-coordinate 184 IF ( ln_traldf_level ) ierr = 1 ! iso-level not allowed 185 IF ( ln_traldf_hor ) nldf = 0 ! horizontal (no rotation) 186 IF ( ln_traldf_iso ) nldf = 1 ! isoneutral ( rotation) 154 ! 155 IF( ln_traldf_blp ) THEN ! bilaplacian operator 156 IF ( ln_zco ) THEN ! z-coordinate 157 IF ( ln_traldf_lev ) nldf = np_blp ! iso-level = horizontal (no rotation) 158 IF ( ln_traldf_hor ) nldf = np_blp ! iso-level = horizontal (no rotation) 159 IF ( ln_traldf_iso ) nldf = np_blp_i ! iso-neutral: standard ( rotation) 160 IF ( ln_traldf_triad ) nldf = np_blp_it ! iso-neutral: triad ( rotation) 161 ENDIF 162 IF ( ln_zps ) THEN ! z-coordinate with partial step 163 IF ( ln_traldf_lev ) ierr = 1 ! iso-level not allowed 164 IF ( ln_traldf_hor ) nldf = np_blp ! horizontal (no rotation) 165 IF ( ln_traldf_iso ) nldf = np_blp_i ! iso-neutral: standard ( rotation) 166 IF ( ln_traldf_triad ) nldf = np_blp_it ! iso-neutral: triad ( rotation) 167 ENDIF 168 IF ( ln_sco ) THEN ! s-coordinate 169 IF ( ln_traldf_lev ) nldf = np_blp ! iso-level (no rotation) 170 IF ( ln_traldf_hor ) nldf = np_blp_it ! horizontal ( rotation) 171 IF ( ln_traldf_iso ) nldf = np_blp_i ! iso-neutral: standard ( rotation) 172 IF ( ln_traldf_triad ) nldf = np_blp_it ! iso-neutral: triad ( rotation) 173 ENDIF 187 174 ENDIF 188 IF ( ln_sco ) THEN ! s-coordinate 189 IF ( ln_traldf_level ) nldf = 0 ! iso-level (no rotation) 190 IF ( ln_traldf_hor ) nldf = 1 ! horizontal ( rotation) 191 IF ( ln_traldf_iso ) nldf = 1 ! isoneutral ( rotation) 192 ENDIF 193 ENDIF 194 195 IF( ln_traldf_bilap ) THEN ! bilaplacian operator 196 IF ( ln_zco ) THEN ! z-coordinate 197 IF ( ln_traldf_level ) nldf = 2 ! iso-level (no rotation) 198 IF ( ln_traldf_hor ) nldf = 2 ! horizontal (no rotation) 199 IF ( ln_traldf_iso ) ierr = 2 ! isoneutral ( rotation) 200 ENDIF 201 IF ( ln_zps ) THEN ! zps-coordinate 202 IF ( ln_traldf_level ) ierr = 1 ! iso-level not allowed 203 IF ( ln_traldf_hor ) nldf = 2 ! horizontal (no rotation) 204 IF ( ln_traldf_iso ) ierr = 2 ! isoneutral ( rotation) 205 ENDIF 206 IF ( ln_sco ) THEN ! s-coordinate 207 IF ( ln_traldf_level ) nldf = 2 ! iso-level (no rotation) 208 IF ( ln_traldf_hor ) nldf = 3 ! horizontal ( rotation) 209 IF ( ln_traldf_iso ) ierr = 2 ! isoneutral ( rotation) 210 ENDIF 211 ENDIF 212 213 IF( nldf == 3 ) CALL ctl_warn( 'geopotential bilaplacian tracer diffusion in s-coords not thoroughly tested' ) 214 IF( ierr == 1 ) CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) 215 IF( ierr == 2 ) CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) 216 IF( lk_traldf_eiv .AND. .NOT.ln_traldf_iso ) & 217 CALL ctl_stop( ' eddy induced velocity on tracers', & 218 & ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) 219 IF( nldf == 1 .OR. nldf == 3 ) THEN ! rotation 220 IF( .NOT.lk_ldfslp ) CALL ctl_stop( ' the rotation of the diffusive tensor require key_ldfslp' ) 221 l_traldf_rot = .TRUE. ! needed for trazdf_imp 222 ENDIF 223 224 IF( lk_esopa ) THEN 225 IF(lwp) WRITE(numout,*) ' esopa control: use all lateral physics options' 226 nldf = -1 227 ENDIF 228 175 ENDIF 176 ! 177 IF( ierr == 1 ) CALL ctl_stop( 'iso-level in z-partial step, not allowed' ) 178 IF( ln_ldfeiv .AND. .NOT.( ln_traldf_iso .OR. ln_traldf_triad ) ) & 179 & CALL ctl_stop( 'eddy induced velocity on tracers requires iso-neutral laplacian diffusion' ) 180 ! 181 IF( nldf == np_lap_i .OR. nldf == np_lap_it .OR. & 182 & nldf == np_blp_i .OR. nldf == np_blp_it ) l_ldfslp = .TRUE. ! slope of neutral surfaces required 183 ! 229 184 IF(lwp) THEN 230 185 WRITE(numout,*) 231 IF( nldf == -2 ) WRITE(numout,*) ' NO lateral diffusion' 232 IF( nldf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' 233 IF( nldf == 0 ) WRITE(numout,*) ' laplacian operator' 234 IF( nldf == 1 ) WRITE(numout,*) ' Rotated laplacian operator' 235 IF( nldf == 2 ) WRITE(numout,*) ' bilaplacian operator' 236 IF( nldf == 3 ) WRITE(numout,*) ' Rotated bilaplacian' 237 ENDIF 238 239 ! Reference T & S diffusivity (if necessary) 240 ! =========================== 241 CALL ldf_ano 186 SELECT CASE( nldf ) 187 CASE( np_no_ldf ) ; WRITE(numout,*) ' NO lateral diffusion' 188 CASE( np_lap ) ; WRITE(numout,*) ' laplacian iso-level operator' 189 CASE( np_lap_i ) ; WRITE(numout,*) ' Rotated laplacian operator (standard)' 190 CASE( np_lap_it ) ; WRITE(numout,*) ' Rotated laplacian operator (triad)' 191 CASE( np_blp ) ; WRITE(numout,*) ' bilaplacian iso-level operator' 192 CASE( np_blp_i ) ; WRITE(numout,*) ' Rotated bilaplacian operator (standard)' 193 CASE( np_blp_it ) ; WRITE(numout,*) ' Rotated bilaplacian operator (triad)' 194 END SELECT 195 ENDIF 242 196 ! 243 197 END SUBROUTINE tra_ldf_init 244 245 #if defined key_traldf_ano246 !!----------------------------------------------------------------------247 !! 'key_traldf_ano' T & S lateral diffusion on anomalies248 !!----------------------------------------------------------------------249 250 SUBROUTINE ldf_ano251 !!----------------------------------------------------------------------252 !! *** ROUTINE ldf_ano ***253 !!254 !! ** Purpose : initializations of255 !!----------------------------------------------------------------------256 !257 USE zdf_oce ! vertical mixing258 USE trazdf ! vertical mixing: double diffusion259 USE zdfddm ! vertical mixing: double diffusion260 !261 INTEGER :: jk ! Dummy loop indice262 INTEGER :: ierr ! local integer263 LOGICAL :: llsave ! local logical264 REAL(wp) :: zt0, zs0, z12 ! local scalar265 REAL(wp), POINTER, DIMENSION(:,:,:) :: zt_ref, zs_ref, ztb, zsb, zavt266 !!----------------------------------------------------------------------267 !268 IF( nn_timing == 1 ) CALL timing_start('ldf_ano')269 !270 CALL wrk_alloc( jpi, jpj, jpk, zt_ref, zs_ref, ztb, zsb, zavt )271 !272 273 IF(lwp) THEN274 WRITE(numout,*)275 WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on anomalies'276 WRITE(numout,*) '~~~~~~~~~~~'277 ENDIF278 279 ! ! allocate trabbl arrays280 ALLOCATE( t0_ldf(jpi,jpj,jpk) , s0_ldf(jpi,jpj,jpk) , STAT=ierr )281 IF( lk_mpp ) CALL mpp_sum( ierr )282 IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'ldf_ano: unable to allocate arrays' )283 284 ! defined the T & S reference profiles285 ! ------------------------------------286 zt0 =10.e0 ! homogeneous ocean287 zs0 =35.e0288 zt_ref(:,:,:) = 10.0 * tmask(:,:,:)289 zs_ref(:,:,:) = 35.0 * tmask(:,:,:)290 IF(lwp) WRITE(numout,*) ' homogeneous ocean T = ', zt0, ' S = ',zs0291 292 ! Initialisation of gtui/gtvi in case of no cavity293 IF ( .NOT. ln_isfcav ) THEN294 gtui(:,:,:) = 0.0_wp295 gtvi(:,:,:) = 0.0_wp296 END IF297 ! ! T & S profile (to be coded +namelist parameter298 299 ! prepare the ldf computation300 ! ---------------------------301 llsave = l_trdtra302 l_trdtra = .false. ! desactivate trend computation303 t0_ldf(:,:,:) = 0.e0304 s0_ldf(:,:,:) = 0.e0305 ztb (:,:,:) = tsb (:,:,:,jp_tem)306 zsb (:,:,:) = tsb (:,:,:,jp_sal)307 ua (:,:,:) = tsa (:,:,:,jp_tem)308 va (:,:,:) = tsa (:,:,:,jp_sal)309 zavt (:,:,:) = avt(:,:,:)310 IF( lk_zdfddm ) THEN CALL ctl_stop( ' key_traldf_ano with key_zdfddm not implemented' )311 ! set tb, sb to reference values and avr to zero312 tsb (:,:,:,jp_tem) = zt_ref(:,:,:)313 tsb (:,:,:,jp_sal) = zs_ref(:,:,:)314 tsa (:,:,:,jp_tem) = 0.e0315 tsa (:,:,:,jp_sal) = 0.e0316 avt(:,:,:) = 0.e0317 318 ! Compute the ldf trends319 ! ----------------------320 CALL tra_ldf( nit000 + 1 ) ! horizontal components (+1: no more init)321 CALL tra_zdf( nit000 ) ! vertical component (if necessary nit000 to performed the init)322 323 ! finalise the computation and recover all arrays324 ! -----------------------------------------------325 l_trdtra = llsave326 z12 = 2.e0327 IF( neuler == 1) z12 = 1.e0328 IF( ln_zdfexp ) THEN ! ta,sa are the trends329 t0_ldf(:,:,:) = tsa(:,:,:,jp_tem)330 s0_ldf(:,:,:) = tsa(:,:,:,jp_sal)331 ELSE332 DO jk = 1, jpkm1333 t0_ldf(:,:,jk) = ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / ( z12 *rdttra(jk) )334 s0_ldf(:,:,jk) = ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / ( z12 *rdttra(jk) )335 END DO336 ENDIF337 tsb(:,:,:,jp_tem) = ztb (:,:,:)338 tsb(:,:,:,jp_sal) = zsb (:,:,:)339 tsa(:,:,:,jp_tem) = ua (:,:,:)340 tsa(:,:,:,jp_sal) = va (:,:,:)341 avt(:,:,:) = zavt(:,:,:)342 !343 CALL wrk_dealloc( jpi, jpj, jpk, zt_ref, zs_ref, ztb, zsb, zavt )344 !345 IF( nn_timing == 1 ) CALL timing_stop('ldf_ano')346 !347 END SUBROUTINE ldf_ano348 349 #else350 !!----------------------------------------------------------------------351 !! default option : Dummy code NO T & S background profiles352 !!----------------------------------------------------------------------353 SUBROUTINE ldf_ano354 IF(lwp) THEN355 WRITE(numout,*)356 WRITE(numout,*) 'tra:ldf_ano : lateral diffusion acting on the full fields'357 WRITE(numout,*) '~~~~~~~~~~~'358 ENDIF359 END SUBROUTINE ldf_ano360 #endif361 198 362 199 !!======================================================================
Note: See TracChangeset
for help on using the changeset viewer.