[2030] | 1 | MODULE trczdf |
---|
| 2 | !!============================================================================== |
---|
| 3 | !! *** MODULE trczdf *** |
---|
| 4 | !! Ocean Passive tracers : vertical diffusive trends |
---|
| 5 | !!===================================================================== |
---|
| 6 | !! History : 9.0 ! 2005-11 (G. Madec) Original code |
---|
| 7 | !! NEMO 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA |
---|
| 8 | !!---------------------------------------------------------------------- |
---|
| 9 | #if defined key_top |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | !! 'key_top' TOP models |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !! trc_ldf : update the tracer trend with the lateral diffusion |
---|
| 14 | !! ldf_ctl : initialization, namelist read, and parameters control |
---|
| 15 | !!---------------------------------------------------------------------- |
---|
| 16 | USE oce_trc ! ocean dynamics and active tracers |
---|
[9163] | 17 | USE domvvl ! variable volume |
---|
[2030] | 18 | USE trc ! ocean passive tracers variables |
---|
| 19 | USE trcnam_trp ! passive tracers transport namelist variables |
---|
| 20 | USE trazdf_exp ! vertical diffusion: explicit (tra_zdf_exp routine) |
---|
| 21 | USE trazdf_imp ! vertical diffusion: implicit (tra_zdf_imp routine) |
---|
[4990] | 22 | USE trd_oce |
---|
[2030] | 23 | USE trdtra |
---|
[2715] | 24 | USE prtctl_trc ! Print control |
---|
[2030] | 25 | |
---|
| 26 | IMPLICIT NONE |
---|
| 27 | PRIVATE |
---|
| 28 | |
---|
[2715] | 29 | PUBLIC trc_zdf ! called by step.F90 |
---|
| 30 | PUBLIC trc_zdf_alloc ! called by nemogcm.F90 |
---|
[2030] | 31 | |
---|
| 32 | INTEGER :: nzdf = 0 ! type vertical diffusion algorithm used |
---|
| 33 | ! ! defined from ln_zdf... namlist logicals) |
---|
[2715] | 34 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: r2dt ! vertical profile time-step, = 2 rdttra |
---|
[3294] | 35 | ! ! except at nittrc000 (=rdttra) if neuler=0 |
---|
[2030] | 36 | |
---|
| 37 | !! * Substitutions |
---|
| 38 | # include "domzgr_substitute.h90" |
---|
| 39 | # include "zdfddm_substitute.h90" |
---|
| 40 | # include "vectopt_loop_substitute.h90" |
---|
| 41 | !!---------------------------------------------------------------------- |
---|
[2287] | 42 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[6486] | 43 | !! $Id$ |
---|
[2715] | 44 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[2030] | 45 | !!---------------------------------------------------------------------- |
---|
| 46 | CONTAINS |
---|
| 47 | |
---|
[2715] | 48 | INTEGER FUNCTION trc_zdf_alloc() |
---|
| 49 | !!---------------------------------------------------------------------- |
---|
| 50 | !! *** ROUTINE trc_zdf_alloc *** |
---|
| 51 | !!---------------------------------------------------------------------- |
---|
| 52 | ALLOCATE( r2dt(jpk) , STAT=trc_zdf_alloc ) |
---|
| 53 | ! |
---|
| 54 | IF( trc_zdf_alloc /= 0 ) CALL ctl_warn('trc_zdf_alloc : failed to allocate array.') |
---|
| 55 | ! |
---|
| 56 | END FUNCTION trc_zdf_alloc |
---|
| 57 | |
---|
| 58 | |
---|
[2030] | 59 | SUBROUTINE trc_zdf( kt ) |
---|
| 60 | !!---------------------------------------------------------------------- |
---|
| 61 | !! *** ROUTINE trc_zdf *** |
---|
| 62 | !! |
---|
| 63 | !! ** Purpose : compute the vertical ocean tracer physics. |
---|
| 64 | !!--------------------------------------------------------------------- |
---|
| 65 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 66 | ! |
---|
| 67 | INTEGER :: jk, jn |
---|
| 68 | CHARACTER (len=22) :: charout |
---|
[3294] | 69 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrtrd ! 4D workspace |
---|
[2030] | 70 | !!--------------------------------------------------------------------- |
---|
[3294] | 71 | ! |
---|
| 72 | IF( nn_timing == 1 ) CALL timing_start('trc_zdf') |
---|
| 73 | ! |
---|
| 74 | IF( kt == nittrc000 ) CALL zdf_ctl ! initialisation & control of options |
---|
[2030] | 75 | |
---|
[5385] | 76 | IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN ! at nittrc000 |
---|
| 77 | r2dt(:) = rdttrc(:) ! = rdttrc (use or restarting with Euler time stepping) |
---|
| 78 | ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN ! at nittrc000 or nittrc000+1 |
---|
| 79 | r2dt(:) = 2. * rdttrc(:) ! = 2 rdttrc (leapfrog) |
---|
[2030] | 80 | ENDIF |
---|
| 81 | |
---|
| 82 | IF( l_trdtrc ) THEN |
---|
[3294] | 83 | CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
[2030] | 84 | ztrtrd(:,:,:,:) = tra(:,:,:,:) |
---|
| 85 | ENDIF |
---|
| 86 | |
---|
| 87 | SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend |
---|
| 88 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
[3294] | 89 | CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) |
---|
[2034] | 90 | WRITE(charout, FMT="('zdf1 ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 91 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[3294] | 92 | CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt, trb, tra, jptra ) |
---|
[2034] | 93 | WRITE(charout, FMT="('zdf2 ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 94 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[3294] | 95 | CASE ( 0 ) ; CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) ! explicit scheme |
---|
| 96 | CASE ( 1 ) ; CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt, trb, tra, jptra ) ! implicit scheme |
---|
[2030] | 97 | |
---|
| 98 | END SELECT |
---|
| 99 | |
---|
[3632] | 100 | IF( l_trdtrc ) THEN ! save the vertical diffusive trends for further diagnostics |
---|
[9163] | 101 | !! JPALM -- 18-08-2017 -- vvl case, do as done by G Nurser in trazdf |
---|
| 102 | IF( lk_vvl ) THEN |
---|
| 103 | DO jn = 1, jptra |
---|
| 104 | DO jk = 1, jpkm1 |
---|
| 105 | ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn)*fse3t_a(:,:,jk) - & |
---|
| 106 | trb(:,:,jk,jn)*fse3t_b(:,:,jk) ) & |
---|
| 107 | / (fse3t_n(:,:,jk)*r2dt(jk)) ) - ztrtrd(:,:,jk,jn) |
---|
| 108 | END DO |
---|
| 109 | END DO |
---|
| 110 | ELSE |
---|
| 111 | DO jn = 1, jptra |
---|
| 112 | DO jk = 1, jpkm1 |
---|
| 113 | ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn) |
---|
| 114 | END DO |
---|
| 115 | END DO |
---|
| 116 | ENDIF |
---|
[2030] | 117 | DO jn = 1, jptra |
---|
[4990] | 118 | CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) |
---|
[2030] | 119 | END DO |
---|
[3294] | 120 | CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
[2030] | 121 | ENDIF |
---|
| 122 | ! ! print mean trends (used for debugging) |
---|
| 123 | IF( ln_ctl ) THEN |
---|
| 124 | WRITE(charout, FMT="('zdf ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 125 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
| 126 | END IF |
---|
| 127 | ! |
---|
[3294] | 128 | IF( nn_timing == 1 ) CALL timing_stop('trc_zdf') |
---|
| 129 | ! |
---|
[2030] | 130 | END SUBROUTINE trc_zdf |
---|
| 131 | |
---|
| 132 | |
---|
| 133 | SUBROUTINE zdf_ctl |
---|
| 134 | !!---------------------------------------------------------------------- |
---|
| 135 | !! *** ROUTINE zdf_ctl *** |
---|
| 136 | !! |
---|
| 137 | !! ** Purpose : Choose the vertical mixing scheme |
---|
| 138 | !! |
---|
| 139 | !! ** Method : Set nzdf from ln_zdfexp |
---|
| 140 | !! nzdf = 0 explicit (time-splitting) scheme (ln_trczdf_exp=T) |
---|
| 141 | !! = 1 implicit (euler backward) scheme (ln_trczdf_exp=F) |
---|
[2476] | 142 | !! NB: The implicit scheme is required when using : |
---|
| 143 | !! - rotated lateral mixing operator |
---|
| 144 | !! - TKE, GLS or KPP vertical mixing scheme |
---|
[2030] | 145 | !!---------------------------------------------------------------------- |
---|
| 146 | |
---|
| 147 | ! Define the vertical tracer physics scheme |
---|
| 148 | ! ========================================== |
---|
| 149 | |
---|
| 150 | ! Choice from ln_zdfexp already read in namelist in zdfini module |
---|
| 151 | IF( ln_trczdf_exp ) THEN ! use explicit scheme |
---|
| 152 | nzdf = 0 |
---|
| 153 | ELSE ! use implicit scheme |
---|
| 154 | nzdf = 1 |
---|
| 155 | ENDIF |
---|
| 156 | |
---|
| 157 | ! Force implicit schemes |
---|
| 158 | IF( ln_trcldf_iso ) nzdf = 1 ! iso-neutral lateral physics |
---|
| 159 | IF( ln_trcldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate |
---|
[2476] | 160 | #if defined key_zdftke || defined key_zdfgls || defined key_zdfkpp |
---|
| 161 | nzdf = 1 ! TKE, GLS or KPP physics |
---|
[2030] | 162 | #endif |
---|
| 163 | IF( ln_trczdf_exp .AND. nzdf == 1 ) THEN |
---|
[2476] | 164 | CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS or KPP vertical scheme ', & |
---|
| 165 | & ' the implicit scheme is required, set ln_trczdf_exp = .false.' ) |
---|
[2030] | 166 | ENDIF |
---|
| 167 | |
---|
| 168 | ! Test: esopa |
---|
| 169 | IF( lk_esopa ) nzdf = -1 ! All schemes used |
---|
| 170 | |
---|
| 171 | IF(lwp) THEN |
---|
| 172 | WRITE(numout,*) |
---|
| 173 | WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' |
---|
| 174 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 175 | IF( nzdf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
| 176 | IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme' |
---|
| 177 | IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme' |
---|
| 178 | ENDIF |
---|
| 179 | |
---|
| 180 | END SUBROUTINE zdf_ctl |
---|
| 181 | #else |
---|
| 182 | !!---------------------------------------------------------------------- |
---|
| 183 | !! Default option Empty module |
---|
| 184 | !!---------------------------------------------------------------------- |
---|
| 185 | CONTAINS |
---|
| 186 | SUBROUTINE trc_zdf( kt ) |
---|
| 187 | INTEGER, INTENT(in) :: kt |
---|
| 188 | WRITE(*,*) 'trc_zdf: You should not have seen this print! error?', kt |
---|
| 189 | END SUBROUTINE trc_zdf |
---|
| 190 | #endif |
---|
| 191 | !!============================================================================== |
---|
| 192 | END MODULE trczdf |
---|