[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) |
---|
| 37 | !! * Substitutions |
---|
| 38 | # include "vectopt_loop_substitute.h90" |
---|
| 39 | !!---------------------------------------------------------------------- |
---|
[5836] | 40 | !! NEMO/TOP 3.7 , NEMO Consortium (2015) |
---|
[7753] | 41 | !! $Id$ |
---|
[2715] | 42 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[2030] | 43 | !!---------------------------------------------------------------------- |
---|
| 44 | CONTAINS |
---|
[2715] | 45 | |
---|
[2030] | 46 | SUBROUTINE trc_zdf( kt ) |
---|
| 47 | !!---------------------------------------------------------------------- |
---|
| 48 | !! *** ROUTINE trc_zdf *** |
---|
| 49 | !! |
---|
| 50 | !! ** Purpose : compute the vertical ocean tracer physics. |
---|
| 51 | !!--------------------------------------------------------------------- |
---|
| 52 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 53 | ! |
---|
[7753] | 54 | INTEGER :: jk, jn |
---|
[2030] | 55 | CHARACTER (len=22) :: charout |
---|
[3294] | 56 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrtrd ! 4D workspace |
---|
[2030] | 57 | !!--------------------------------------------------------------------- |
---|
[3294] | 58 | ! |
---|
| 59 | IF( nn_timing == 1 ) CALL timing_start('trc_zdf') |
---|
| 60 | ! |
---|
[2030] | 61 | IF( l_trdtrc ) THEN |
---|
[3294] | 62 | CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
[7753] | 63 | ztrtrd(:,:,:,:) = tra(:,:,:,:) |
---|
[2030] | 64 | ENDIF |
---|
| 65 | |
---|
| 66 | SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend |
---|
[6140] | 67 | CASE ( 0 ) ; CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dttrc, nn_trczdf_exp, trb, tra, jptra ) ! explicit scheme |
---|
| 68 | CASE ( 1 ) ; CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dttrc, trb, tra, jptra ) ! implicit scheme |
---|
[2030] | 69 | END SELECT |
---|
| 70 | |
---|
[3632] | 71 | IF( l_trdtrc ) THEN ! save the vertical diffusive trends for further diagnostics |
---|
[2030] | 72 | DO jn = 1, jptra |
---|
| 73 | DO jk = 1, jpkm1 |
---|
[7753] | 74 | ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dttrc ) - ztrtrd(:,:,jk,jn) |
---|
[2030] | 75 | END DO |
---|
[4990] | 76 | CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) |
---|
[2030] | 77 | END DO |
---|
[3294] | 78 | CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
[2030] | 79 | ENDIF |
---|
| 80 | ! ! print mean trends (used for debugging) |
---|
| 81 | IF( ln_ctl ) THEN |
---|
| 82 | WRITE(charout, FMT="('zdf ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 83 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
| 84 | END IF |
---|
| 85 | ! |
---|
[3294] | 86 | IF( nn_timing == 1 ) CALL timing_stop('trc_zdf') |
---|
| 87 | ! |
---|
[2030] | 88 | END SUBROUTINE trc_zdf |
---|
| 89 | |
---|
| 90 | |
---|
[5836] | 91 | SUBROUTINE trc_zdf_ini |
---|
[2030] | 92 | !!---------------------------------------------------------------------- |
---|
[5836] | 93 | !! *** ROUTINE trc_zdf_ini *** |
---|
[2030] | 94 | !! |
---|
| 95 | !! ** Purpose : Choose the vertical mixing scheme |
---|
| 96 | !! |
---|
| 97 | !! ** Method : Set nzdf from ln_zdfexp |
---|
| 98 | !! nzdf = 0 explicit (time-splitting) scheme (ln_trczdf_exp=T) |
---|
| 99 | !! = 1 implicit (euler backward) scheme (ln_trczdf_exp=F) |
---|
[2476] | 100 | !! NB: The implicit scheme is required when using : |
---|
| 101 | !! - rotated lateral mixing operator |
---|
[5836] | 102 | !! - TKE, GLS vertical mixing scheme |
---|
[2030] | 103 | !!---------------------------------------------------------------------- |
---|
[5836] | 104 | INTEGER :: ios ! Local integer output status for namelist read |
---|
| 105 | !! |
---|
| 106 | NAMELIST/namtrc_zdf/ ln_trczdf_exp , nn_trczdf_exp |
---|
| 107 | !!---------------------------------------------------------------------- |
---|
| 108 | ! |
---|
| 109 | REWIND( numnat_ref ) ! namtrc_zdf in reference namelist |
---|
| 110 | READ ( numnat_ref, namtrc_zdf, IOSTAT = ios, ERR = 905) |
---|
| 111 | 905 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in reference namelist', lwp ) |
---|
| 112 | ! |
---|
| 113 | REWIND( numnat_cfg ) ! namtrc_zdf in configuration namelist |
---|
| 114 | READ ( numnat_cfg, namtrc_zdf, IOSTAT = ios, ERR = 906 ) |
---|
| 115 | 906 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in configuration namelist', lwp ) |
---|
| 116 | IF(lwm) WRITE ( numont, namtrc_zdf ) |
---|
| 117 | ! |
---|
| 118 | IF(lwp) THEN ! Control print |
---|
| 119 | WRITE(numout,*) |
---|
| 120 | WRITE(numout,*) ' Namelist namtrc_zdf : set vertical diffusion parameters' |
---|
| 121 | WRITE(numout,*) ' time splitting / backward scheme ln_trczdf_exp = ', ln_trczdf_exp |
---|
| 122 | WRITE(numout,*) ' number of time step nn_trczdf_exp = ', nn_trczdf_exp |
---|
| 123 | ENDIF |
---|
[2030] | 124 | |
---|
[5836] | 125 | ! ! Define the vertical tracer physics scheme |
---|
| 126 | IF( ln_trczdf_exp ) THEN ; nzdf = 0 ! explicit scheme |
---|
| 127 | ELSE ; nzdf = 1 ! implicit scheme |
---|
[2030] | 128 | ENDIF |
---|
| 129 | |
---|
[5836] | 130 | ! ! Force implicit schemes |
---|
| 131 | IF( ln_trcldf_iso ) nzdf = 1 ! iso-neutral lateral physics |
---|
| 132 | IF( ln_trcldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate |
---|
| 133 | #if defined key_zdftke || defined key_zdfgls |
---|
| 134 | nzdf = 1 ! TKE or GLS physics |
---|
[2030] | 135 | #endif |
---|
[5836] | 136 | IF( ln_trczdf_exp .AND. nzdf == 1 ) & |
---|
| 137 | CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS vertical scheme ', & |
---|
[2476] | 138 | & ' the implicit scheme is required, set ln_trczdf_exp = .false.' ) |
---|
[2030] | 139 | |
---|
| 140 | IF(lwp) THEN |
---|
| 141 | WRITE(numout,*) |
---|
| 142 | WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' |
---|
| 143 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 144 | IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme' |
---|
| 145 | IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme' |
---|
| 146 | ENDIF |
---|
[5836] | 147 | ! |
---|
| 148 | END SUBROUTINE trc_zdf_ini |
---|
| 149 | |
---|
[2030] | 150 | #else |
---|
| 151 | !!---------------------------------------------------------------------- |
---|
| 152 | !! Default option Empty module |
---|
| 153 | !!---------------------------------------------------------------------- |
---|
| 154 | CONTAINS |
---|
| 155 | SUBROUTINE trc_zdf( kt ) |
---|
| 156 | INTEGER, INTENT(in) :: kt |
---|
| 157 | WRITE(*,*) 'trc_zdf: You should not have seen this print! error?', kt |
---|
| 158 | END SUBROUTINE trc_zdf |
---|
| 159 | #endif |
---|
| 160 | !!============================================================================== |
---|
| 161 | END MODULE trczdf |
---|