[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 | !!---------------------------------------------------------------------- |
---|
[5836] | 13 | !! trc_zdf : update the tracer trend with the lateral diffusion |
---|
| 14 | !! trc_zdf_ini : initialization, namelist read, and parameters control |
---|
[2030] | 15 | !!---------------------------------------------------------------------- |
---|
[5836] | 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 |
---|
[2030] | 24 | |
---|
| 25 | IMPLICIT NONE |
---|
| 26 | PRIVATE |
---|
| 27 | |
---|
[5836] | 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) |
---|
[2030] | 34 | |
---|
| 35 | INTEGER :: nzdf = 0 ! type vertical diffusion algorithm used |
---|
| 36 | ! ! defined from ln_zdf... namlist logicals) |
---|
[6140] | 37 | REAL(wp) :: r2dttrc ! vertical profile time-step, = 2 rdt |
---|
| 38 | ! ! except at nittrc000 (=rdt) if neuler=0 |
---|
[2030] | 39 | |
---|
| 40 | !! * Substitutions |
---|
| 41 | # include "zdfddm_substitute.h90" |
---|
| 42 | # include "vectopt_loop_substitute.h90" |
---|
| 43 | !!---------------------------------------------------------------------- |
---|
[5836] | 44 | !! NEMO/TOP 3.7 , NEMO Consortium (2015) |
---|
[2281] | 45 | !! $Id$ |
---|
[2715] | 46 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[2030] | 47 | !!---------------------------------------------------------------------- |
---|
| 48 | CONTAINS |
---|
[2715] | 49 | |
---|
[2030] | 50 | SUBROUTINE trc_zdf( kt ) |
---|
| 51 | !!---------------------------------------------------------------------- |
---|
| 52 | !! *** ROUTINE trc_zdf *** |
---|
| 53 | !! |
---|
| 54 | !! ** Purpose : compute the vertical ocean tracer physics. |
---|
| 55 | !!--------------------------------------------------------------------- |
---|
| 56 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 57 | ! |
---|
| 58 | INTEGER :: jk, jn |
---|
| 59 | CHARACTER (len=22) :: charout |
---|
[3294] | 60 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrtrd ! 4D workspace |
---|
[2030] | 61 | !!--------------------------------------------------------------------- |
---|
[3294] | 62 | ! |
---|
| 63 | IF( nn_timing == 1 ) CALL timing_start('trc_zdf') |
---|
| 64 | ! |
---|
[5385] | 65 | IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN ! at nittrc000 |
---|
[6140] | 66 | r2dttrc = rdttrc ! = rdttrc (use or restarting with Euler time stepping) |
---|
[5385] | 67 | ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN ! at nittrc000 or nittrc000+1 |
---|
[6140] | 68 | r2dttrc = 2. * rdttrc ! = 2 rdttrc (leapfrog) |
---|
[2030] | 69 | ENDIF |
---|
| 70 | |
---|
| 71 | IF( l_trdtrc ) THEN |
---|
[3294] | 72 | CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
[2030] | 73 | ztrtrd(:,:,:,:) = tra(:,:,:,:) |
---|
| 74 | ENDIF |
---|
| 75 | |
---|
| 76 | SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend |
---|
[6140] | 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 |
---|
[2030] | 79 | END SELECT |
---|
| 80 | |
---|
[3632] | 81 | IF( l_trdtrc ) THEN ! save the vertical diffusive trends for further diagnostics |
---|
[2030] | 82 | DO jn = 1, jptra |
---|
| 83 | DO jk = 1, jpkm1 |
---|
[6140] | 84 | ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dttrc ) - ztrtrd(:,:,jk,jn) |
---|
[2030] | 85 | END DO |
---|
[4990] | 86 | CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) |
---|
[2030] | 87 | END DO |
---|
[3294] | 88 | CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
[2030] | 89 | ENDIF |
---|
| 90 | ! ! print mean trends (used for debugging) |
---|
| 91 | IF( ln_ctl ) THEN |
---|
| 92 | WRITE(charout, FMT="('zdf ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 93 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
| 94 | END IF |
---|
| 95 | ! |
---|
[3294] | 96 | IF( nn_timing == 1 ) CALL timing_stop('trc_zdf') |
---|
| 97 | ! |
---|
[2030] | 98 | END SUBROUTINE trc_zdf |
---|
| 99 | |
---|
| 100 | |
---|
[5836] | 101 | SUBROUTINE trc_zdf_ini |
---|
[2030] | 102 | !!---------------------------------------------------------------------- |
---|
[5836] | 103 | !! *** ROUTINE trc_zdf_ini *** |
---|
[2030] | 104 | !! |
---|
| 105 | !! ** Purpose : Choose the vertical mixing scheme |
---|
| 106 | !! |
---|
| 107 | !! ** Method : Set nzdf from ln_zdfexp |
---|
| 108 | !! nzdf = 0 explicit (time-splitting) scheme (ln_trczdf_exp=T) |
---|
| 109 | !! = 1 implicit (euler backward) scheme (ln_trczdf_exp=F) |
---|
[2476] | 110 | !! NB: The implicit scheme is required when using : |
---|
| 111 | !! - rotated lateral mixing operator |
---|
[5836] | 112 | !! - TKE, GLS vertical mixing scheme |
---|
[2030] | 113 | !!---------------------------------------------------------------------- |
---|
[5836] | 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 |
---|
| 133 | ENDIF |
---|
[2030] | 134 | |
---|
[5836] | 135 | ! ! Define the vertical tracer physics scheme |
---|
| 136 | IF( ln_trczdf_exp ) THEN ; nzdf = 0 ! explicit scheme |
---|
| 137 | ELSE ; nzdf = 1 ! implicit scheme |
---|
[2030] | 138 | ENDIF |
---|
| 139 | |
---|
[5836] | 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 |
---|
[2030] | 145 | #endif |
---|
[5836] | 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 ', & |
---|
[2476] | 148 | & ' the implicit scheme is required, set ln_trczdf_exp = .false.' ) |
---|
[2030] | 149 | |
---|
| 150 | IF(lwp) THEN |
---|
| 151 | WRITE(numout,*) |
---|
| 152 | WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' |
---|
| 153 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 154 | IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme' |
---|
| 155 | IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme' |
---|
| 156 | ENDIF |
---|
[5836] | 157 | ! |
---|
| 158 | END SUBROUTINE trc_zdf_ini |
---|
| 159 | |
---|
[2030] | 160 | #else |
---|
| 161 | !!---------------------------------------------------------------------- |
---|
| 162 | !! Default option Empty module |
---|
| 163 | !!---------------------------------------------------------------------- |
---|
| 164 | CONTAINS |
---|
| 165 | SUBROUTINE trc_zdf( kt ) |
---|
| 166 | INTEGER, INTENT(in) :: kt |
---|
| 167 | WRITE(*,*) 'trc_zdf: You should not have seen this print! error?', kt |
---|
| 168 | END SUBROUTINE trc_zdf |
---|
| 169 | #endif |
---|
| 170 | !!============================================================================== |
---|
| 171 | END MODULE trczdf |
---|